[all-commits] [llvm/llvm-project] 9218f9: [clang][aarch64] ACLE: Support implicit casts betw...

Cullen Rhodes via All-commits all-commits at lists.llvm.org
Thu Sep 17 02:36:13 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9218f9283802b2d1ff33c490761fdb925b1e56d9
      https://github.com/llvm/llvm-project/commit/9218f9283802b2d1ff33c490761fdb925b1e56d9
  Author: Cullen Rhodes <cullen.rhodes at arm.com>
  Date:   2020-09-17 (Thu, 17 Sep 2020)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp
    M clang/test/CodeGen/attr-arm-sve-vector-bits-cast.c
    M clang/test/Sema/attr-arm-sve-vector-bits.c
    M clang/test/SemaCXX/attr-arm-sve-vector-bits.cpp

  Log Message:
  -----------
  [clang][aarch64] ACLE: Support implicit casts between GNU and SVE vectors

This patch adds support for implicit casting between GNU vectors and SVE
vectors when `__ARM_FEATURE_SVE_BITS==N`, as defined by the Arm C
Language Extensions (ACLE, version 00bet5, section 3.7.3.3) for SVE [1].

This behavior makes it possible to use GNU vectors with ACLE functions
that operate on VLAT. For example:

  typedef int8_t vec __attribute__((vector_size(32)));
  vec f(vec x) { return svasrd_x(svptrue_b8(), x, 1); }

Tests are also added for implicit casting between GNU and fixed-length
SVE vectors created by the 'arm_sve_vector_bits' attribute. This
behavior makes it possible to use VLST with existing interfaces that
operate on GNUT. For example:

  typedef int8_t vec1 __attribute__((vector_size(32)));
  void f(vec1);
  #if __ARM_FEATURE_SVE_BITS==256 && __ARM_FEATURE_SVE_VECTOR_OPERATORS
  typedef svint8_t vec2 __attribute__((arm_sve_vector_bits(256)));
  void g(vec2 x) { f(x); } // OK
  #endif

The `__ARM_FEATURE_SVE_VECTOR_OPERATORS` feature macro indicates
interoperability with the GNU vector extension. This is the first patch
providing support for this feature, which once complete will be enabled
by the `-msve-vector-bits` flag, as the `__ARM_FEATURE_SVE_BITS` feature
currently is.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: efriedma

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




More information about the All-commits mailing list