1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 int check_all_feature() {
4 if (__builtin_cpu_supports("rng+flagm+flagm2+fp16fml+dotprod+sm4"))
6 else if (__builtin_cpu_supports("rdm+lse+fp+simd+crc+sha1+sha2+sha3"))
8 else if (__builtin_cpu_supports("aes+pmull+fp16+dit+dpb+dpb2+jscvt"))
10 else if (__builtin_cpu_supports("fcma+rcpc+rcpc2+rcpc3+frintts"))
12 else if (__builtin_cpu_supports("i8mm+bf16+sve"))
14 else if (__builtin_cpu_supports("sve+ebf16+i8mm+f32mm+f64mm"))
16 else if (__builtin_cpu_supports("sve2+sve2-aes+sve2-pmull128"))
18 else if (__builtin_cpu_supports("sve2-bitperm+sve2-sha3+sve2-sm4"))
20 else if (__builtin_cpu_supports("sme+memtag+sb"))
22 else if (__builtin_cpu_supports("predres+ssbs+ssbs2+bti+ls64+ls64_v"))
24 else if (__builtin_cpu_supports("ls64_accdata+wfxt+sme-f64f64"))
26 else if (__builtin_cpu_supports("sme-i16i64+sme2"))
32 // CHECK-LABEL: define dso_local i32 @neon_code() #1
33 int __attribute__((target("simd"))) neon_code() { return 1; }
35 // CHECK-LABEL: define dso_local i32 @sve_code() #2
36 int __attribute__((target("sve"))) sve_code() { return 2; }
38 // CHECK-LABEL: define dso_local i32 @code() #0
39 int code() { return 3; }
41 // CHECK-LABEL: define dso_local i32 @test_versions() #0
43 if (__builtin_cpu_supports("sve"))
45 else if (__builtin_cpu_supports("simd"))
50 // CHECK: attributes #0 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
51 // CHECK: attributes #1 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
52 // CHECK: attributes #2 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" }