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 -sroa | 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 -sroa | FileCheck %s
4 
5 #include <arm_mve.h>
6 
7 // CHECK-LABEL: @test_vsubq_u32(
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = sub <4 x i32> [[A:%.*]], [[B:%.*]]
10 // CHECK-NEXT:    ret <4 x i32> [[TMP0]]
11 //
test_vsubq_u32(uint32x4_t a,uint32x4_t b)12 uint32x4_t test_vsubq_u32(uint32x4_t a, uint32x4_t b)
13 {
14 #ifdef POLYMORPHIC
15     return vsubq(a, b);
16 #else /* POLYMORPHIC */
17     return vsubq_u32(a, b);
18 #endif /* POLYMORPHIC */
19 }
20 
21 // CHECK-LABEL: @test_vsubq_f16(
22 // CHECK-NEXT:  entry:
23 // CHECK-NEXT:    [[TMP0:%.*]] = fsub <8 x half> [[A:%.*]], [[B:%.*]]
24 // CHECK-NEXT:    ret <8 x half> [[TMP0]]
25 //
test_vsubq_f16(float16x8_t a,float16x8_t b)26 float16x8_t test_vsubq_f16(float16x8_t a, float16x8_t b)
27 {
28 #ifdef POLYMORPHIC
29     return vsubq(a, b);
30 #else /* POLYMORPHIC */
31     return vsubq_f16(a, b);
32 #endif /* POLYMORPHIC */
33 }
34 
35 // CHECK-LABEL: @test_vsubq_m_s8(
36 // CHECK-NEXT:  entry:
37 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
38 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
39 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.sub.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> [[INACTIVE:%.*]])
40 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
41 //
test_vsubq_m_s8(int8x16_t inactive,int8x16_t a,int8x16_t b,mve_pred16_t p)42 int8x16_t test_vsubq_m_s8(int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
43 {
44 #ifdef POLYMORPHIC
45     return vsubq_m(inactive, a, b, p);
46 #else /* POLYMORPHIC */
47     return vsubq_m_s8(inactive, a, b, p);
48 #endif /* POLYMORPHIC */
49 }
50 
51 // CHECK-LABEL: @test_vsubq_m_f32(
52 // CHECK-NEXT:  entry:
53 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
54 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
55 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.sub.predicated.v4f32.v4i1(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]], <4 x i1> [[TMP1]], <4 x float> [[INACTIVE:%.*]])
56 // CHECK-NEXT:    ret <4 x float> [[TMP2]]
57 //
test_vsubq_m_f32(float32x4_t inactive,float32x4_t a,float32x4_t b,mve_pred16_t p)58 float32x4_t test_vsubq_m_f32(float32x4_t inactive, float32x4_t a, float32x4_t b, mve_pred16_t p)
59 {
60 #ifdef POLYMORPHIC
61     return vsubq_m(inactive, a, b, p);
62 #else /* POLYMORPHIC */
63     return vsubq_m_f32(inactive, a, b, p);
64 #endif /* POLYMORPHIC */
65 }
66 
67 // CHECK-LABEL: @test_vsubq_x_u16(
68 // CHECK-NEXT:  entry:
69 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
70 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
71 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.sub.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> undef)
72 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
73 //
test_vsubq_x_u16(uint16x8_t a,uint16x8_t b,mve_pred16_t p)74 uint16x8_t test_vsubq_x_u16(uint16x8_t a, uint16x8_t b, mve_pred16_t p)
75 {
76 #ifdef POLYMORPHIC
77     return vsubq_x(a, b, p);
78 #else /* POLYMORPHIC */
79     return vsubq_x_u16(a, b, p);
80 #endif /* POLYMORPHIC */
81 }
82 
83 // CHECK-LABEL: @test_vsubq_x_f16(
84 // CHECK-NEXT:  entry:
85 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
86 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
87 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x half> @llvm.arm.mve.sub.predicated.v8f16.v8i1(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], <8 x i1> [[TMP1]], <8 x half> undef)
88 // CHECK-NEXT:    ret <8 x half> [[TMP2]]
89 //
test_vsubq_x_f16(float16x8_t a,float16x8_t b,mve_pred16_t p)90 float16x8_t test_vsubq_x_f16(float16x8_t a, float16x8_t b, mve_pred16_t p)
91 {
92 #ifdef POLYMORPHIC
93     return vsubq_x(a, b, p);
94 #else /* POLYMORPHIC */
95     return vsubq_x_f16(a, b, p);
96 #endif /* POLYMORPHIC */
97 }
98 
99 // CHECK-LABEL: @test_vsubq_n_u32(
100 // CHECK-NEXT:  entry:
101 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[B:%.*]], i32 0
102 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
103 // CHECK-NEXT:    [[TMP0:%.*]] = sub <4 x i32> [[A:%.*]], [[DOTSPLAT]]
104 // CHECK-NEXT:    ret <4 x i32> [[TMP0]]
105 //
test_vsubq_n_u32(uint32x4_t a,uint32_t b)106 uint32x4_t test_vsubq_n_u32(uint32x4_t a, uint32_t b)
107 {
108 #ifdef POLYMORPHIC
109     return vsubq(a, b);
110 #else /* POLYMORPHIC */
111     return vsubq_n_u32(a, b);
112 #endif /* POLYMORPHIC */
113 }
114 
115 // CHECK-LABEL: @test_vsubq_n_f16(
116 // CHECK-NEXT:  entry:
117 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[B:%.*]], i32 0
118 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer
119 // CHECK-NEXT:    [[TMP0:%.*]] = fsub <8 x half> [[A:%.*]], [[DOTSPLAT]]
120 // CHECK-NEXT:    ret <8 x half> [[TMP0]]
121 //
test_vsubq_n_f16(float16x8_t a,float16_t b)122 float16x8_t test_vsubq_n_f16(float16x8_t a, float16_t b)
123 {
124 #ifdef POLYMORPHIC
125     return vsubq(a, b);
126 #else /* POLYMORPHIC */
127     return vsubq_n_f16(a, b);
128 #endif /* POLYMORPHIC */
129 }
130 
131 // CHECK-LABEL: @test_vsubq_m_n_s8(
132 // CHECK-NEXT:  entry:
133 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <16 x i8> undef, i8 [[B:%.*]], i32 0
134 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <16 x i8> [[DOTSPLATINSERT]], <16 x i8> undef, <16 x i32> zeroinitializer
135 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
136 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
137 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.sub.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[DOTSPLAT]], <16 x i1> [[TMP1]], <16 x i8> [[INACTIVE:%.*]])
138 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
139 //
test_vsubq_m_n_s8(int8x16_t inactive,int8x16_t a,int8_t b,mve_pred16_t p)140 int8x16_t test_vsubq_m_n_s8(int8x16_t inactive, int8x16_t a, int8_t b, mve_pred16_t p)
141 {
142 #ifdef POLYMORPHIC
143     return vsubq_m(inactive, a, b, p);
144 #else /* POLYMORPHIC */
145     return vsubq_m_n_s8(inactive, a, b, p);
146 #endif /* POLYMORPHIC */
147 }
148 
149 // CHECK-LABEL: @test_vsubq_m_n_f32(
150 // CHECK-NEXT:  entry:
151 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[B:%.*]], i32 0
152 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
153 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
154 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
155 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.sub.predicated.v4f32.v4i1(<4 x float> [[A:%.*]], <4 x float> [[DOTSPLAT]], <4 x i1> [[TMP1]], <4 x float> [[INACTIVE:%.*]])
156 // CHECK-NEXT:    ret <4 x float> [[TMP2]]
157 //
test_vsubq_m_n_f32(float32x4_t inactive,float32x4_t a,float32_t b,mve_pred16_t p)158 float32x4_t test_vsubq_m_n_f32(float32x4_t inactive, float32x4_t a, float32_t b, mve_pred16_t p)
159 {
160 #ifdef POLYMORPHIC
161     return vsubq_m(inactive, a, b, p);
162 #else /* POLYMORPHIC */
163     return vsubq_m_n_f32(inactive, a, b, p);
164 #endif /* POLYMORPHIC */
165 }
166 
167 // CHECK-LABEL: @test_vsubq_x_n_u16(
168 // CHECK-NEXT:  entry:
169 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <8 x i16> undef, i16 [[B:%.*]], i32 0
170 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <8 x i16> [[DOTSPLATINSERT]], <8 x i16> undef, <8 x i32> zeroinitializer
171 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
172 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
173 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.sub.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[DOTSPLAT]], <8 x i1> [[TMP1]], <8 x i16> undef)
174 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
175 //
test_vsubq_x_n_u16(uint16x8_t a,uint16_t b,mve_pred16_t p)176 uint16x8_t test_vsubq_x_n_u16(uint16x8_t a, uint16_t b, mve_pred16_t p)
177 {
178 #ifdef POLYMORPHIC
179     return vsubq_x(a, b, p);
180 #else /* POLYMORPHIC */
181     return vsubq_x_n_u16(a, b, p);
182 #endif /* POLYMORPHIC */
183 }
184 
185 // CHECK-LABEL: @test_vsubq_x_n_f16(
186 // CHECK-NEXT:  entry:
187 // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[B:%.*]], i32 0
188 // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer
189 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
190 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
191 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x half> @llvm.arm.mve.sub.predicated.v8f16.v8i1(<8 x half> [[A:%.*]], <8 x half> [[DOTSPLAT]], <8 x i1> [[TMP1]], <8 x half> undef)
192 // CHECK-NEXT:    ret <8 x half> [[TMP2]]
193 //
test_vsubq_x_n_f16(float16x8_t a,float16_t b,mve_pred16_t p)194 float16x8_t test_vsubq_x_n_f16(float16x8_t a, float16_t b, mve_pred16_t p)
195 {
196 #ifdef POLYMORPHIC
197     return vsubq_x(a, b, p);
198 #else /* POLYMORPHIC */
199     return vsubq_x_n_f16(a, b, p);
200 #endif /* POLYMORPHIC */
201 }
202