-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64] Alter arm_neon_sve_bridge.h to be target-based, not preproc…
…essor based. Similar to D131064, this alters the arm_neon_sve_bridge.h header to use target-based intrinsics that give an error if used in a function that does not have the sve features, but are not preprocessed out. This header is simpler than the arm_sve.h and other headers, not including any tablegen'd content. The main change is altering the builtin definitions from using BUILTIN to TARGET_BUILTIN. Differential Revision: https://reviews.llvm.org/D132639
- Loading branch information
1 parent
d106707
commit 9978529
Showing
3 changed files
with
68 additions
and
38 deletions.
There are no files selected for viewing
72 changes: 36 additions & 36 deletions
72
clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
#ifdef GET_SVE_BUILTINS | ||
BUILTIN(__builtin_sve_svget_neonq_s8, "V16Scq16Sc", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_s16, "V8sq8s", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_s32, "V4iq4i", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_s64, "V2Wiq2Wi", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_u8, "V16Ucq16Uc", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_u16, "V16Usq16Us", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_u32, "V4Uiq4Ui", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_u64, "V2UWiq2UWi", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_f16, "V8hq8h", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_f32, "V4fq4f", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_f64, "V2dq2d", "n") | ||
BUILTIN(__builtin_sve_svget_neonq_bf16, "V8yq8y", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_s8, "q16Scq16ScV16Sc", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_s16, "q8sq8sV8s", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_s32, "q4iq4iV4i", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_s64, "q2Wiq2WiV2Wi", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_u8, "q16Ucq16UcV16Uc", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_u16, "q8Usq8UsV8s", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_u32, "q4Uiq4UiV4Ui", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_u64, "q2UWiq2UWiV2UWi", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_f16, "q8hq8hV8h", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_f32, "q4fq4fV4f", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_f64, "q2dq2dV2d", "n") | ||
BUILTIN(__builtin_sve_svset_neonq_bf16, "q8yq8yV8y", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_s8, "q16ScV16Sc", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_s16, "q8sV8s", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_s32, "q4iV4i", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_s64, "q4iV4i", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_u8, "q16UcV16Uc", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_u16, "q8UsV8Us", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_u32, "q4UiV4Ui", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_u64, "q2UWiV2UWi", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_f16, "q8hV8h", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_f32, "q4fV4f", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_f64, "q2dV2d", "n") | ||
BUILTIN(__builtin_sve_svdup_neonq_bf16, "q8yV8y", "n") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_s8, "V16Scq16Sc", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_s16, "V8sq8s", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_s32, "V4iq4i", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_s64, "V2Wiq2Wi", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_u8, "V16Ucq16Uc", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_u16, "V16Usq16Us", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_u32, "V4Uiq4Ui", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_u64, "V2UWiq2UWi", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_f16, "V8hq8h", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_f32, "V4fq4f", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_f64, "V2dq2d", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svget_neonq_bf16, "V8yq8y", "n", "sve,bf16") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_s8, "q16Scq16ScV16Sc", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_s16, "q8sq8sV8s", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_s32, "q4iq4iV4i", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_s64, "q2Wiq2WiV2Wi", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_u8, "q16Ucq16UcV16Uc", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_u16, "q8Usq8UsV8s", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_u32, "q4Uiq4UiV4Ui", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_u64, "q2UWiq2UWiV2UWi", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_f16, "q8hq8hV8h", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_f32, "q4fq4fV4f", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_f64, "q2dq2dV2d", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svset_neonq_bf16, "q8yq8yV8y", "n", "sve,bf16") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_s8, "q16ScV16Sc", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_s16, "q8sV8s", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_s32, "q4iV4i", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_s64, "q4iV4i", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_u8, "q16UcV16Uc", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_u16, "q8UsV8Us", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_u32, "q4UiV4Ui", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_u64, "q2UWiV2UWi", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_f16, "q8hV8h", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_f32, "q4fV4f", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_f64, "q2dV2d", "n", "sve") | ||
TARGET_BUILTIN(__builtin_sve_svdup_neonq_bf16, "q8yV8y", "n", "sve,bf16") | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/target.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// REQUIRES: aarch64-registered-target | ||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon -S -verify -emit-llvm -o - %s | ||
|
||
#include <arm_neon_sve_bridge.h> | ||
|
||
__attribute__((target("sve"))) | ||
void target_sve(svint8_t s, int8x16_t n) { | ||
svset_neonq_s8(s, n); | ||
svget_neonq_s8(s); | ||
svdup_neonq_s8(n); | ||
} | ||
|
||
__attribute__((target("sve,bf16"))) | ||
void target_svebf16(svbfloat16_t t, bfloat16x8_t m) { | ||
svset_neonq_bf16(t, m); | ||
svget_neonq_bf16(t); | ||
svdup_neonq_bf16(m); | ||
} | ||
|
||
void base(int8x16_t n, bfloat16x8_t m) { | ||
// expected-error@+1 {{'svundef_s8' needs target feature sve}} | ||
svset_neonq_s8(svundef_s8(), n); // expected-error {{'svset_neonq_s8' needs target feature sve}} | ||
// expected-error@+1 {{'svundef_s8' needs target feature sve}} | ||
svget_neonq_s8(svundef_s8()); // expected-error {{'svget_neonq_s8' needs target feature sve}} | ||
svdup_neonq_s8(n); // expected-error {{'svdup_neonq_s8' needs target feature sve}} | ||
|
||
// expected-error@+1 {{'svundef_bf16' needs target feature sve}} | ||
svset_neonq_bf16(svundef_bf16(), m); // expected-error {{'svset_neonq_bf16' needs target feature sve,bf16}} | ||
// expected-error@+1 {{'svundef_bf16' needs target feature sve}} | ||
svget_neonq_bf16(svundef_bf16()); // expected-error {{'svget_neonq_bf16' needs target feature sve,bf16}} | ||
svdup_neonq_bf16(m); // expected-error {{'svdup_neonq_bf16' needs target feature sve,bf16}} | ||
} |