1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
4 // RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
5 
6 // If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
7 // ASM-NOT: warning
8 #include <arm_sve.h>
9 
test_svcnth()10 uint64_t test_svcnth()
11 {
12   // CHECK-LABEL: test_svcnth
13   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 31)
14   // CHECK: ret i64 %[[INTRINSIC]]
15   return svcnth();
16 }
17 
test_svcnth_pat()18 uint64_t test_svcnth_pat()
19 {
20   // CHECK-LABEL: test_svcnth_pat
21   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 0)
22   // CHECK: ret i64 %[[INTRINSIC]]
23   return svcnth_pat(SV_POW2);
24 }
25 
test_svcnth_pat_1()26 uint64_t test_svcnth_pat_1()
27 {
28   // CHECK-LABEL: test_svcnth_pat_1
29   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 1)
30   // CHECK: ret i64 %[[INTRINSIC]]
31   return svcnth_pat(SV_VL1);
32 }
33 
test_svcnth_pat_2()34 uint64_t test_svcnth_pat_2()
35 {
36   // CHECK-LABEL: test_svcnth_pat_2
37   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 2)
38   // CHECK: ret i64 %[[INTRINSIC]]
39   return svcnth_pat(SV_VL2);
40 }
41 
test_svcnth_pat_3()42 uint64_t test_svcnth_pat_3()
43 {
44   // CHECK-LABEL: test_svcnth_pat_3
45   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 3)
46   // CHECK: ret i64 %[[INTRINSIC]]
47   return svcnth_pat(SV_VL3);
48 }
49 
test_svcnth_pat_4()50 uint64_t test_svcnth_pat_4()
51 {
52   // CHECK-LABEL: test_svcnth_pat_4
53   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 4)
54   // CHECK: ret i64 %[[INTRINSIC]]
55   return svcnth_pat(SV_VL4);
56 }
57 
test_svcnth_pat_5()58 uint64_t test_svcnth_pat_5()
59 {
60   // CHECK-LABEL: test_svcnth_pat_5
61   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 5)
62   // CHECK: ret i64 %[[INTRINSIC]]
63   return svcnth_pat(SV_VL5);
64 }
65 
test_svcnth_pat_6()66 uint64_t test_svcnth_pat_6()
67 {
68   // CHECK-LABEL: test_svcnth_pat_6
69   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 6)
70   // CHECK: ret i64 %[[INTRINSIC]]
71   return svcnth_pat(SV_VL6);
72 }
73 
test_svcnth_pat_7()74 uint64_t test_svcnth_pat_7()
75 {
76   // CHECK-LABEL: test_svcnth_pat_7
77   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 7)
78   // CHECK: ret i64 %[[INTRINSIC]]
79   return svcnth_pat(SV_VL7);
80 }
81 
test_svcnth_pat_8()82 uint64_t test_svcnth_pat_8()
83 {
84   // CHECK-LABEL: test_svcnth_pat_8
85   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 8)
86   // CHECK: ret i64 %[[INTRINSIC]]
87   return svcnth_pat(SV_VL8);
88 }
89 
test_svcnth_pat_9()90 uint64_t test_svcnth_pat_9()
91 {
92   // CHECK-LABEL: test_svcnth_pat_9
93   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 9)
94   // CHECK: ret i64 %[[INTRINSIC]]
95   return svcnth_pat(SV_VL16);
96 }
97 
test_svcnth_pat_10()98 uint64_t test_svcnth_pat_10()
99 {
100   // CHECK-LABEL: test_svcnth_pat_10
101   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 10)
102   // CHECK: ret i64 %[[INTRINSIC]]
103   return svcnth_pat(SV_VL32);
104 }
105 
test_svcnth_pat_11()106 uint64_t test_svcnth_pat_11()
107 {
108   // CHECK-LABEL: test_svcnth_pat_11
109   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 11)
110   // CHECK: ret i64 %[[INTRINSIC]]
111   return svcnth_pat(SV_VL64);
112 }
113 
test_svcnth_pat_12()114 uint64_t test_svcnth_pat_12()
115 {
116   // CHECK-LABEL: test_svcnth_pat_12
117   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 12)
118   // CHECK: ret i64 %[[INTRINSIC]]
119   return svcnth_pat(SV_VL128);
120 }
121 
test_svcnth_pat_13()122 uint64_t test_svcnth_pat_13()
123 {
124   // CHECK-LABEL: test_svcnth_pat_13
125   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 13)
126   // CHECK: ret i64 %[[INTRINSIC]]
127   return svcnth_pat(SV_VL256);
128 }
129 
test_svcnth_pat_14()130 uint64_t test_svcnth_pat_14()
131 {
132   // CHECK-LABEL: test_svcnth_pat_14
133   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 29)
134   // CHECK: ret i64 %[[INTRINSIC]]
135   return svcnth_pat(SV_MUL4);
136 }
137 
test_svcnth_pat_15()138 uint64_t test_svcnth_pat_15()
139 {
140   // CHECK-LABEL: test_svcnth_pat_15
141   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 30)
142   // CHECK: ret i64 %[[INTRINSIC]]
143   return svcnth_pat(SV_MUL3);
144 }
145 
test_svcnth_pat_16()146 uint64_t test_svcnth_pat_16()
147 {
148   // CHECK-LABEL: test_svcnth_pat_16
149   // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.cnth(i32 31)
150   // CHECK: ret i64 %[[INTRINSIC]]
151   return svcnth_pat(SV_ALL);
152 }
153