[all-commits] [llvm/llvm-project] 1d7829: [Sema][BFloat] Forbid arithmetic on vectors of bfl...

Simon Tatham via All-commits all-commits at lists.llvm.org
Fri Aug 7 03:27:19 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d782942500b2cbc9765ccf16264bb498850cefb
      https://github.com/llvm/llvm-project/commit/1d782942500b2cbc9765ccf16264bb498850cefb
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2020-08-07 (Fri, 07 Aug 2020)

  Changed paths:
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/Sema/arm-bfloat.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list