Skip to content

Commit 776d918

Browse files
committed
[FMV][AArch64] Unify aes with pmull and sve2-aes with sve2-pmull128.
According to the Arm Architecture Reference Manual for A-profile architecture you can't have one feature without having the other: ID_AA64ZFR0_EL1.AES, bits [7:4] > FEAT_SVE_AES implements the functionality identified by the value 0b0001. > FEAT_SVE_PMULL128 implements the functionality identified by the value 0b0010. > The permitted values are 0b0000 and 0b0010. (The following was removed from the latest release of the specification, but it appears to be a mistake that was not intended to relax the architecture constraints. The discrepancy has been reported) ID_AA64ISAR0_EL1.AES, bits [7:4] > FEAT_AES implements the functionality identified by the value 0b0001. > FEAT_PMULL implements the functionality identified by the value 0b0010. > From Armv8, the permitted values are 0b0000 and 0b0010. Reviewed in ACLE as ARM-software/acle#352
1 parent 01cbbc5 commit 776d918

File tree

12 files changed

+85
-95
lines changed

12 files changed

+85
-95
lines changed

clang/test/CodeGen/aarch64-cpu-supports.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --version 2
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs --global-value-regex ".*" --version 2
22
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s
33

4+
int main(void) {
5+
if (__builtin_cpu_supports("sb"))
6+
return 1;
7+
8+
if (__builtin_cpu_supports("sve2-aes+memtag"))
9+
return 2;
10+
11+
if (__builtin_cpu_supports("sme2+ls64+wfxt"))
12+
return 3;
13+
14+
if (__builtin_cpu_supports("avx2"))
15+
return 4;
16+
17+
return 0;
18+
}
19+
//.
420
// CHECK: @__aarch64_cpu_features = external dso_local global { i64 }
21+
//.
522
// CHECK-LABEL: define dso_local i32 @main
623
// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
724
// CHECK-NEXT: entry:
@@ -45,18 +62,7 @@
4562
// CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[RETVAL]], align 4
4663
// CHECK-NEXT: ret i32 [[TMP12]]
4764
//
48-
int main(void) {
49-
if (__builtin_cpu_supports("sb"))
50-
return 1;
51-
52-
if (__builtin_cpu_supports("sve2-pmull128+memtag"))
53-
return 2;
54-
55-
if (__builtin_cpu_supports("sme2+ls64+wfxt"))
56-
return 3;
57-
58-
if (__builtin_cpu_supports("avx2"))
59-
return 4;
60-
61-
return 0;
62-
}
65+
//.
66+
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
67+
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
68+
//.

clang/test/CodeGen/aarch64-fmv-dependencies.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// RUN: %clang --target=aarch64-linux-gnu --rtlib=compiler-rt -emit-llvm -S -o - %s | FileCheck %s
55

6-
// CHECK: define dso_local i32 @fmv._Maes() #[[ATTR0:[0-9]+]] {
6+
// CHECK: define dso_local i32 @fmv._Maes() #[[aes:[0-9]+]] {
77
__attribute__((target_version("aes"))) int fmv(void) { return 0; }
88

99
// CHECK: define dso_local i32 @fmv._Mbf16() #[[bf16_ebf16:[0-9]+]] {
@@ -84,9 +84,6 @@ __attribute__((target_version("memtag3"))) int fmv(void) { return 0; }
8484
// CHECK: define dso_local i32 @fmv._Mmops() #[[mops:[0-9]+]] {
8585
__attribute__((target_version("mops"))) int fmv(void) { return 0; }
8686

87-
// CHECK: define dso_local i32 @fmv._Mpmull() #[[pmull:[0-9]+]] {
88-
__attribute__((target_version("pmull"))) int fmv(void) { return 0; }
89-
9087
// CHECK: define dso_local i32 @fmv._Mpredres() #[[predres:[0-9]+]] {
9188
__attribute__((target_version("predres"))) int fmv(void) { return 0; }
9289

@@ -153,15 +150,12 @@ __attribute__((target_version("sve-i8mm"))) int fmv(void) { return 0; }
153150
// CHECK: define dso_local i32 @fmv._Msve2() #[[sve2:[0-9]+]] {
154151
__attribute__((target_version("sve2"))) int fmv(void) { return 0; }
155152

156-
// CHECK: define dso_local i32 @fmv._Msve2-aes() #[[sve2_aes_sve2_pmull128:[0-9]+]] {
153+
// CHECK: define dso_local i32 @fmv._Msve2-aes() #[[sve2_aes:[0-9]+]] {
157154
__attribute__((target_version("sve2-aes"))) int fmv(void) { return 0; }
158155

159156
// CHECK: define dso_local i32 @fmv._Msve2-bitperm() #[[sve2_bitperm:[0-9]+]] {
160157
__attribute__((target_version("sve2-bitperm"))) int fmv(void) { return 0; }
161158

162-
// CHECK: define dso_local i32 @fmv._Msve2-pmull128() #[[sve2_aes_sve2_pmull128:[0-9]+]] {
163-
__attribute__((target_version("sve2-pmull128"))) int fmv(void) { return 0; }
164-
165159
// CHECK: define dso_local i32 @fmv._Msve2-sha3() #[[sve2_sha3:[0-9]+]] {
166160
__attribute__((target_version("sve2-sha3"))) int fmv(void) { return 0; }
167161

@@ -180,10 +174,11 @@ int caller() {
180174
return fmv();
181175
}
182176

183-
// CHECK: attributes #[[ATTR0]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a"
177+
// CHECK: attributes #[[aes]] = { {{.*}} "target-features"="+aes,+fp-armv8,+neon,+outline-atomics,+v8a"
184178
// CHECK: attributes #[[bf16_ebf16]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+v8a"
185179
// CHECK: attributes #[[bti]] = { {{.*}} "target-features"="+bti,+fp-armv8,+neon,+outline-atomics,+v8a"
186180
// CHECK: attributes #[[crc]] = { {{.*}} "target-features"="+crc,+fp-armv8,+neon,+outline-atomics,+v8a"
181+
// CHECK: attributes #[[ATTR0]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a"
187182
// CHECK: attributes #[[dit]] = { {{.*}} "target-features"="+dit,+fp-armv8,+neon,+outline-atomics,+v8a"
188183
// CHECK: attributes #[[dotprod]] = { {{.*}} "target-features"="+dotprod,+fp-armv8,+neon,+outline-atomics,+v8a"
189184
// CHECK: attributes #[[dpb]] = { {{.*}} "target-features"="+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a"
@@ -202,7 +197,6 @@ int caller() {
202197
// CHECK: attributes #[[lse]] = { {{.*}} "target-features"="+fp-armv8,+lse,+neon,+outline-atomics,+v8a"
203198
// CHECK: attributes #[[memtag2]] = { {{.*}} "target-features"="+fp-armv8,+mte,+neon,+outline-atomics,+v8a"
204199
// CHECK: attributes #[[mops]] = { {{.*}} "target-features"="+fp-armv8,+mops,+neon,+outline-atomics,+v8a"
205-
// CHECK: attributes #[[pmull]] = { {{.*}} "target-features"="+aes,+fp-armv8,+neon,+outline-atomics,+v8a"
206200
// CHECK: attributes #[[predres]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+predres,+v8a"
207201
// CHECK: attributes #[[rcpc]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+v8a"
208202
// CHECK: attributes #[[rcpc3]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc3,+v8a"
@@ -221,7 +215,7 @@ int caller() {
221215
// CHECK: attributes #[[sve_bf16_ebf16]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
222216
// CHECK: attributes #[[sve_i8mm]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+i8mm,+neon,+outline-atomics,+sve,+v8a"
223217
// CHECK: attributes #[[sve2]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+v8a"
224-
// CHECK: attributes #[[sve2_aes_sve2_pmull128]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-aes,+v8a"
218+
// CHECK: attributes #[[sve2_aes]] = { {{.*}} "target-features"="+aes,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-aes,+v8a"
225219
// CHECK: attributes #[[sve2_bitperm]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-bitperm,+v8a"
226220
// CHECK: attributes #[[sve2_sha3]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-sha3,+v8a"
227221
// CHECK: attributes #[[sve2_sm4]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-sm4,+v8a"

clang/test/CodeGen/attr-target-clones-aarch64.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default"))
6464
// CHECK-NEXT: resolver_entry:
6565
// CHECK-NEXT: call void @__init_cpu_features_resolver()
6666
// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8
67-
// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 16512
68-
// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 16512
67+
// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 32896
68+
// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 32896
6969
// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]]
7070
// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]]
7171
// CHECK: resolver_return:
@@ -360,8 +360,8 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default"))
360360
// CHECK-NEXT: resolver_entry:
361361
// CHECK-NEXT: call void @__init_cpu_features_resolver()
362362
// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8
363-
// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 18014535948435456
364-
// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 18014535948435456
363+
// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 18014673387388928
364+
// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 18014673387388928
365365
// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]]
366366
// CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]]
367367
// CHECK: resolver_return:
@@ -521,8 +521,8 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default"))
521521
// CHECK-MTE-BTI-NEXT: resolver_entry:
522522
// CHECK-MTE-BTI-NEXT: call void @__init_cpu_features_resolver()
523523
// CHECK-MTE-BTI-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8
524-
// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 16512
525-
// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 16512
524+
// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 32896
525+
// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 32896
526526
// CHECK-MTE-BTI-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]]
527527
// CHECK-MTE-BTI-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]]
528528
// CHECK-MTE-BTI: resolver_return:
@@ -817,8 +817,8 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default"))
817817
// CHECK-MTE-BTI-NEXT: resolver_entry:
818818
// CHECK-MTE-BTI-NEXT: call void @__init_cpu_features_resolver()
819819
// CHECK-MTE-BTI-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8
820-
// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 18014535948435456
821-
// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 18014535948435456
820+
// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 18014673387388928
821+
// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 18014673387388928
822822
// CHECK-MTE-BTI-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]]
823823
// CHECK-MTE-BTI-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]]
824824
// CHECK-MTE-BTI: resolver_return:

0 commit comments

Comments
 (0)