HomePhabricator

[Sema][BFloat] Forbid arithmetic on vectors of bfloat.

Authored by simon_tatham on Aug 7 2020, 2:26 AM.

Description

[Sema][BFloat] Forbid arithmetic on vectors of bfloat.

Vectors of bfloat are a storage format only; you're supposed to
explicitly convert them to a wider type to do arithmetic on them.
But currently, if you write something like

bfloat16x4_t test(bfloat16x4_t a, bfloat16x4_t b) { return a + b; }

then the clang frontend accepts it without error, and (ARM or AArch64)
isel fails to generate code for it.

Added a rule in Sema that forbids the attempt from even being made,
and tests that check it. In particular, we also outlaw arithmetic
between vectors of bfloat and any other vector type.

Patch by Luke Cheeseman.

Reviewed By: LukeGeeson

Differential Revision: https://reviews.llvm.org/D85009

Details

Committed
simon_tathamAug 7 2020, 3:25 AM
Reviewer
LukeGeeson
Differential Revision
D85009: [Sema][BFloat] Forbid arithmetic on vectors of bfloat.
Parents
rG24cca30f7f0d: Remove unreachable return (PR47026)
Branches
Unknown
Tags
Unknown