1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -DPOLYMORPHIC -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
4 
5 #include <arm_mve.h>
6 
7 // CHECK-LABEL: @test_vandq_u8(
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = and <16 x i8> [[A:%.*]], [[B:%.*]]
10 // CHECK-NEXT:    ret <16 x i8> [[TMP0]]
11 //
test_vandq_u8(uint8x16_t a,uint8x16_t b)12 uint8x16_t test_vandq_u8(uint8x16_t a, uint8x16_t b)
13 {
14 #ifdef POLYMORPHIC
15     return vandq(a, b);
16 #else /* POLYMORPHIC */
17     return vandq_u8(a, b);
18 #endif /* POLYMORPHIC */
19 }
20 
21 // CHECK-LABEL: @test_vandq_s16(
22 // CHECK-NEXT:  entry:
23 // CHECK-NEXT:    [[TMP0:%.*]] = and <8 x i16> [[A:%.*]], [[B:%.*]]
24 // CHECK-NEXT:    ret <8 x i16> [[TMP0]]
25 //
test_vandq_s16(int16x8_t a,int16x8_t b)26 int16x8_t test_vandq_s16(int16x8_t a, int16x8_t b)
27 {
28 #ifdef POLYMORPHIC
29     return vandq(a, b);
30 #else /* POLYMORPHIC */
31     return vandq_s16(a, b);
32 #endif /* POLYMORPHIC */
33 }
34 
35 // CHECK-LABEL: @test_vandq_u32(
36 // CHECK-NEXT:  entry:
37 // CHECK-NEXT:    [[TMP0:%.*]] = and <4 x i32> [[A:%.*]], [[B:%.*]]
38 // CHECK-NEXT:    ret <4 x i32> [[TMP0]]
39 //
test_vandq_u32(uint32x4_t a,uint32x4_t b)40 uint32x4_t test_vandq_u32(uint32x4_t a, uint32x4_t b)
41 {
42 #ifdef POLYMORPHIC
43     return vandq(a, b);
44 #else /* POLYMORPHIC */
45     return vandq_u32(a, b);
46 #endif /* POLYMORPHIC */
47 }
48 
49 // CHECK-LABEL: @test_vandq_f32(
50 // CHECK-NEXT:  entry:
51 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
52 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
53 // CHECK-NEXT:    [[TMP2:%.*]] = and <4 x i32> [[TMP0]], [[TMP1]]
54 // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <4 x float>
55 // CHECK-NEXT:    ret <4 x float> [[TMP3]]
56 //
test_vandq_f32(float32x4_t a,float32x4_t b)57 float32x4_t test_vandq_f32(float32x4_t a, float32x4_t b)
58 {
59 #ifdef POLYMORPHIC
60     return vandq(a, b);
61 #else /* POLYMORPHIC */
62     return vandq_f32(a, b);
63 #endif /* POLYMORPHIC */
64 }
65 
66 // CHECK-LABEL: @test_vandq_m_s8(
67 // CHECK-NEXT:  entry:
68 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
69 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
70 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.and.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> [[INACTIVE:%.*]])
71 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
72 //
test_vandq_m_s8(int8x16_t inactive,int8x16_t a,int8x16_t b,mve_pred16_t p)73 int8x16_t test_vandq_m_s8(int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
74 {
75 #ifdef POLYMORPHIC
76     return vandq_m(inactive, a, b, p);
77 #else /* POLYMORPHIC */
78     return vandq_m_s8(inactive, a, b, p);
79 #endif /* POLYMORPHIC */
80 }
81 
82 // CHECK-LABEL: @test_vandq_m_u16(
83 // CHECK-NEXT:  entry:
84 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
85 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
86 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.and.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> [[INACTIVE:%.*]])
87 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
88 //
test_vandq_m_u16(uint16x8_t inactive,uint16x8_t a,uint16x8_t b,mve_pred16_t p)89 uint16x8_t test_vandq_m_u16(uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p)
90 {
91 #ifdef POLYMORPHIC
92     return vandq_m(inactive, a, b, p);
93 #else /* POLYMORPHIC */
94     return vandq_m_u16(inactive, a, b, p);
95 #endif /* POLYMORPHIC */
96 }
97 
98 // CHECK-LABEL: @test_vandq_m_s32(
99 // CHECK-NEXT:  entry:
100 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
101 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
102 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.and.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> [[INACTIVE:%.*]])
103 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
104 //
test_vandq_m_s32(int32x4_t inactive,int32x4_t a,int32x4_t b,mve_pred16_t p)105 int32x4_t test_vandq_m_s32(int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p)
106 {
107 #ifdef POLYMORPHIC
108     return vandq_m(inactive, a, b, p);
109 #else /* POLYMORPHIC */
110     return vandq_m_s32(inactive, a, b, p);
111 #endif /* POLYMORPHIC */
112 }
113 
114 // CHECK-LABEL: @test_vandq_m_f16(
115 // CHECK-NEXT:  entry:
116 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x half> [[A:%.*]] to <8 x i16>
117 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <8 x half> [[B:%.*]] to <8 x i16>
118 // CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
119 // CHECK-NEXT:    [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]])
120 // CHECK-NEXT:    [[TMP4:%.*]] = bitcast <8 x half> [[INACTIVE:%.*]] to <8 x i16>
121 // CHECK-NEXT:    [[TMP5:%.*]] = call <8 x i16> @llvm.arm.mve.and.predicated.v8i16.v8i1(<8 x i16> [[TMP0]], <8 x i16> [[TMP1]], <8 x i1> [[TMP3]], <8 x i16> [[TMP4]])
122 // CHECK-NEXT:    [[TMP6:%.*]] = bitcast <8 x i16> [[TMP5]] to <8 x half>
123 // CHECK-NEXT:    ret <8 x half> [[TMP6]]
124 //
test_vandq_m_f16(float16x8_t inactive,float16x8_t a,float16x8_t b,mve_pred16_t p)125 float16x8_t test_vandq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)
126 {
127 #ifdef POLYMORPHIC
128     return vandq_m(inactive, a, b, p);
129 #else /* POLYMORPHIC */
130     return vandq_m_f16(inactive, a, b, p);
131 #endif /* POLYMORPHIC */
132 }
133 
134 // CHECK-LABEL: @test_vandq_x_u8(
135 // CHECK-NEXT:  entry:
136 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
137 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
138 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.and.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> undef)
139 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
140 //
test_vandq_x_u8(uint8x16_t a,uint8x16_t b,mve_pred16_t p)141 uint8x16_t test_vandq_x_u8(uint8x16_t a, uint8x16_t b, mve_pred16_t p)
142 {
143 #ifdef POLYMORPHIC
144     return vandq_x(a, b, p);
145 #else /* POLYMORPHIC */
146     return vandq_x_u8(a, b, p);
147 #endif /* POLYMORPHIC */
148 }
149 
150 // CHECK-LABEL: @test_vandq_x_s16(
151 // CHECK-NEXT:  entry:
152 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
153 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
154 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.and.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> undef)
155 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
156 //
test_vandq_x_s16(int16x8_t a,int16x8_t b,mve_pred16_t p)157 int16x8_t test_vandq_x_s16(int16x8_t a, int16x8_t b, mve_pred16_t p)
158 {
159 #ifdef POLYMORPHIC
160     return vandq_x(a, b, p);
161 #else /* POLYMORPHIC */
162     return vandq_x_s16(a, b, p);
163 #endif /* POLYMORPHIC */
164 }
165 
166 // CHECK-LABEL: @test_vandq_x_u32(
167 // CHECK-NEXT:  entry:
168 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
169 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
170 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.and.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> undef)
171 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
172 //
test_vandq_x_u32(uint32x4_t a,uint32x4_t b,mve_pred16_t p)173 uint32x4_t test_vandq_x_u32(uint32x4_t a, uint32x4_t b, mve_pred16_t p)
174 {
175 #ifdef POLYMORPHIC
176     return vandq_x(a, b, p);
177 #else /* POLYMORPHIC */
178     return vandq_x_u32(a, b, p);
179 #endif /* POLYMORPHIC */
180 }
181 
182 // CHECK-LABEL: @test_vandq_m_f32(
183 // CHECK-NEXT:  entry:
184 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
185 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
186 // CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
187 // CHECK-NEXT:    [[TMP3:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP2]])
188 // CHECK-NEXT:    [[TMP4:%.*]] = call <4 x i32> @llvm.arm.mve.and.predicated.v4i32.v4i1(<4 x i32> [[TMP0]], <4 x i32> [[TMP1]], <4 x i1> [[TMP3]], <4 x i32> undef)
189 // CHECK-NEXT:    [[TMP5:%.*]] = bitcast <4 x i32> [[TMP4]] to <4 x float>
190 // CHECK-NEXT:    ret <4 x float> [[TMP5]]
191 //
test_vandq_m_f32(float32x4_t a,float32x4_t b,mve_pred16_t p)192 float32x4_t test_vandq_m_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)
193 {
194 #ifdef POLYMORPHIC
195     return vandq_x(a, b, p);
196 #else /* POLYMORPHIC */
197     return vandq_x_f32(a, b, p);
198 #endif /* POLYMORPHIC */
199 }
200