[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / arm-mve-intrinsics / vandq.c
blob4f769505be91363bdf1b8f7de9e96b73b6f4fbd3
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 -O0 -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -O0 -disable-O0-optnone -DPOLYMORPHIC -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s
5 // REQUIRES: aarch64-registered-target || arm-registered-target
7 #include <arm_mve.h>
9 // CHECK-LABEL: @test_vandq_u8(
10 // CHECK-NEXT: entry:
11 // CHECK-NEXT: [[TMP0:%.*]] = and <16 x i8> [[A:%.*]], [[B:%.*]]
12 // CHECK-NEXT: ret <16 x i8> [[TMP0]]
14 uint8x16_t test_vandq_u8(uint8x16_t a, uint8x16_t b)
16 #ifdef POLYMORPHIC
17 return vandq(a, b);
18 #else /* POLYMORPHIC */
19 return vandq_u8(a, b);
20 #endif /* POLYMORPHIC */
23 // CHECK-LABEL: @test_vandq_s16(
24 // CHECK-NEXT: entry:
25 // CHECK-NEXT: [[TMP0:%.*]] = and <8 x i16> [[A:%.*]], [[B:%.*]]
26 // CHECK-NEXT: ret <8 x i16> [[TMP0]]
28 int16x8_t test_vandq_s16(int16x8_t a, int16x8_t b)
30 #ifdef POLYMORPHIC
31 return vandq(a, b);
32 #else /* POLYMORPHIC */
33 return vandq_s16(a, b);
34 #endif /* POLYMORPHIC */
37 // CHECK-LABEL: @test_vandq_u32(
38 // CHECK-NEXT: entry:
39 // CHECK-NEXT: [[TMP0:%.*]] = and <4 x i32> [[A:%.*]], [[B:%.*]]
40 // CHECK-NEXT: ret <4 x i32> [[TMP0]]
42 uint32x4_t test_vandq_u32(uint32x4_t a, uint32x4_t b)
44 #ifdef POLYMORPHIC
45 return vandq(a, b);
46 #else /* POLYMORPHIC */
47 return vandq_u32(a, b);
48 #endif /* POLYMORPHIC */
51 // CHECK-LABEL: @test_vandq_f32(
52 // CHECK-NEXT: entry:
53 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
54 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
55 // CHECK-NEXT: [[TMP2:%.*]] = and <4 x i32> [[TMP0]], [[TMP1]]
56 // CHECK-NEXT: [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <4 x float>
57 // CHECK-NEXT: ret <4 x float> [[TMP3]]
59 float32x4_t test_vandq_f32(float32x4_t a, float32x4_t b)
61 #ifdef POLYMORPHIC
62 return vandq(a, b);
63 #else /* POLYMORPHIC */
64 return vandq_f32(a, b);
65 #endif /* POLYMORPHIC */
68 // CHECK-LABEL: @test_vandq_m_s8(
69 // CHECK-NEXT: entry:
70 // CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
71 // CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
72 // 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:%.*]])
73 // CHECK-NEXT: ret <16 x i8> [[TMP2]]
75 int8x16_t test_vandq_m_s8(int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
77 #ifdef POLYMORPHIC
78 return vandq_m(inactive, a, b, p);
79 #else /* POLYMORPHIC */
80 return vandq_m_s8(inactive, a, b, p);
81 #endif /* POLYMORPHIC */
84 // CHECK-LABEL: @test_vandq_m_u16(
85 // CHECK-NEXT: entry:
86 // CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
87 // CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
88 // 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:%.*]])
89 // CHECK-NEXT: ret <8 x i16> [[TMP2]]
91 uint16x8_t test_vandq_m_u16(uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p)
93 #ifdef POLYMORPHIC
94 return vandq_m(inactive, a, b, p);
95 #else /* POLYMORPHIC */
96 return vandq_m_u16(inactive, a, b, p);
97 #endif /* POLYMORPHIC */
100 // CHECK-LABEL: @test_vandq_m_s32(
101 // CHECK-NEXT: entry:
102 // CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
103 // CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
104 // 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:%.*]])
105 // CHECK-NEXT: ret <4 x i32> [[TMP2]]
107 int32x4_t test_vandq_m_s32(int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p)
109 #ifdef POLYMORPHIC
110 return vandq_m(inactive, a, b, p);
111 #else /* POLYMORPHIC */
112 return vandq_m_s32(inactive, a, b, p);
113 #endif /* POLYMORPHIC */
116 // CHECK-LABEL: @test_vandq_m_f16(
117 // CHECK-NEXT: entry:
118 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x half> [[A:%.*]] to <8 x i16>
119 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x half> [[B:%.*]] to <8 x i16>
120 // CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
121 // CHECK-NEXT: [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]])
122 // CHECK-NEXT: [[TMP4:%.*]] = bitcast <8 x half> [[INACTIVE:%.*]] to <8 x i16>
123 // 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]])
124 // CHECK-NEXT: [[TMP6:%.*]] = bitcast <8 x i16> [[TMP5]] to <8 x half>
125 // CHECK-NEXT: ret <8 x half> [[TMP6]]
127 float16x8_t test_vandq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)
129 #ifdef POLYMORPHIC
130 return vandq_m(inactive, a, b, p);
131 #else /* POLYMORPHIC */
132 return vandq_m_f16(inactive, a, b, p);
133 #endif /* POLYMORPHIC */
136 // CHECK-LABEL: @test_vandq_x_u8(
137 // CHECK-NEXT: entry:
138 // CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
139 // CHECK-NEXT: [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
140 // 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)
141 // CHECK-NEXT: ret <16 x i8> [[TMP2]]
143 uint8x16_t test_vandq_x_u8(uint8x16_t a, uint8x16_t b, mve_pred16_t p)
145 #ifdef POLYMORPHIC
146 return vandq_x(a, b, p);
147 #else /* POLYMORPHIC */
148 return vandq_x_u8(a, b, p);
149 #endif /* POLYMORPHIC */
152 // CHECK-LABEL: @test_vandq_x_s16(
153 // CHECK-NEXT: entry:
154 // CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
155 // CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
156 // 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)
157 // CHECK-NEXT: ret <8 x i16> [[TMP2]]
159 int16x8_t test_vandq_x_s16(int16x8_t a, int16x8_t b, mve_pred16_t p)
161 #ifdef POLYMORPHIC
162 return vandq_x(a, b, p);
163 #else /* POLYMORPHIC */
164 return vandq_x_s16(a, b, p);
165 #endif /* POLYMORPHIC */
168 // CHECK-LABEL: @test_vandq_x_u32(
169 // CHECK-NEXT: entry:
170 // CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
171 // CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
172 // 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)
173 // CHECK-NEXT: ret <4 x i32> [[TMP2]]
175 uint32x4_t test_vandq_x_u32(uint32x4_t a, uint32x4_t b, mve_pred16_t p)
177 #ifdef POLYMORPHIC
178 return vandq_x(a, b, p);
179 #else /* POLYMORPHIC */
180 return vandq_x_u32(a, b, p);
181 #endif /* POLYMORPHIC */
184 // CHECK-LABEL: @test_vandq_m_f32(
185 // CHECK-NEXT: entry:
186 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
187 // CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
188 // CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
189 // CHECK-NEXT: [[TMP3:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP2]])
190 // 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)
191 // CHECK-NEXT: [[TMP5:%.*]] = bitcast <4 x i32> [[TMP4]] to <4 x float>
192 // CHECK-NEXT: ret <4 x float> [[TMP5]]
194 float32x4_t test_vandq_m_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)
196 #ifdef POLYMORPHIC
197 return vandq_x(a, b, p);
198 #else /* POLYMORPHIC */
199 return vandq_x_f32(a, b, p);
200 #endif /* POLYMORPHIC */