[PATCH] D91067: [AArch64][SVE] Support implicit lax vector conversions for SVE types

Joe Ellis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 04:00:35 PST 2020


joechrisellis created this revision.
joechrisellis added reviewers: peterwaller-arm, fpetrogalli, DavidTruby.
Herald added subscribers: cfe-commits, psnobl, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: clang.
joechrisellis requested review of this revision.

Lax vector conversions was behaving incorrectly for implicit casts
between scalable and fixed-length vector types. For example, this:

  #include <arm_sve.h>
  
  #define N __ARM_FEATURE_SVE_BITS
  #define FIXED_ATTR __attribute__((arm_sve_vector_bits(N)))
  
  typedef svfloat32_t fixed_float32_t FIXED_ATTR;
  typedef svfloat64_t fixed_float64_t FIXED_ATTR;
  
  void allowed_depending() {
    fixed_float32_t fs32;
    svfloat64_t s64;
  
    fs32 = s64;
  }

... would fail because the vectors have differing lane sizes. This patch
implements the correct behaviour for
-flax-vector-conversions={none,all,integer}. Specifically:

- -flax-vector-conversions=none prevents all lax vector conversions between scalable and fixed-sized vectors.
- -flax-vector-conversions=integer allows lax vector conversions between scalable and fixed-size vectors whose element types are integers.
- -flax-vector-conversions=all allows all lax vector conversions between scalable and fixed-size vectors (including those with floating point element types).

The implicit conversions are implemented as bitcasts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91067

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Sema/aarch64-sve-lax-vector-conversions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91067.303816.patch
Type: text/x-patch
Size: 6360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201109/7498a2a3/attachment.bin>


More information about the cfe-commits mailing list