[clang] [llvm] [SVE2.1][Clang][LLVM]Int/FP reduce builtin in Clang and LLVM intrinsic (PR #69926)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 2 01:15:33 PDT 2023


================
@@ -0,0 +1,285 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
+#include <arm_neon.h>
----------------
sdesmalen-arm wrote:

You need fixed-length vector types (e.g. `float16x8_t`), but I think having to include `<arm_neon.h>` manually is not right.

There are several things we can do:
* `arm_sve.h` could include `arm_neon.h`. However, given the large size of both header files I'd argue against including another massive header file.
* `arm_sve.h` could define `float16x8_t`. The downside of this is that when someone includes `arm_neon.h` afterwards, there is a duplicate definition of `float16x8_t`, so that means having to update both arm_sve.h and arm_neon.h to guard against this happening (using `#ifndef __ARM_SVE_H typedef __attribute__((neon_vector_type(..))) ....`)
* `arm_sve.h` and `arm_neon.h` could both include a `arm_neon_types.h` which defines the fixed-length vector types in a separate header file, guarded by its own `__ARM_NEON_TYPES_H` macro. I can't think of any downsides.

So the latter approach is probably the way to go.

https://github.com/llvm/llvm-project/pull/69926


More information about the cfe-commits mailing list