Skip to content

Commit 8e451a5

Browse files
committed
Precommit poison propagation for llvm trig
1 parent e685e4a commit 8e451a5

File tree

1 file changed

+232
-0
lines changed

1 file changed

+232
-0
lines changed

llvm/test/Transforms/InstSimplify/fold-intrinsics.ll

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,235 @@ define void @pow_poison(i16 %arg_int,float %arg_flt, ptr %P) {
8787

8888
ret void
8989
}
90+
91+
define void @sin_poison(ptr %P) {
92+
; CHECK-LABEL: @sin_poison(
93+
; CHECK-NEXT: [[SIN_F32:%.*]] = call float @llvm.sin.f32(float poison)
94+
; CHECK-NEXT: store volatile float [[SIN_F32]], ptr [[P:%.*]], align 4
95+
; CHECK-NEXT: [[SIN_2XF32:%.*]] = call <2 x float> @llvm.sin.v2f32(<2 x float> poison)
96+
; CHECK-NEXT: store volatile <2 x float> [[SIN_2XF32]], ptr [[P]], align 8
97+
; CHECK-NEXT: [[SIN_4XF64:%.*]] = call <4 x double> @llvm.sin.v4f64(<4 x double> poison)
98+
; CHECK-NEXT: store volatile <4 x double> [[SIN_4XF64]], ptr [[P]], align 32
99+
; CHECK-NEXT: [[ASIN_F32:%.*]] = call float @llvm.asin.f32(float poison)
100+
; CHECK-NEXT: store volatile float [[ASIN_F32]], ptr [[P]], align 4
101+
; CHECK-NEXT: [[ASIN_2XF32:%.*]] = call <2 x float> @llvm.asin.v2f32(<2 x float> poison)
102+
; CHECK-NEXT: store volatile <2 x float> [[ASIN_2XF32]], ptr [[P]], align 8
103+
; CHECK-NEXT: [[ASIN_4XF64:%.*]] = call <4 x double> @llvm.asin.v4f64(<4 x double> poison)
104+
; CHECK-NEXT: store volatile <4 x double> [[ASIN_4XF64]], ptr [[P]], align 32
105+
; CHECK-NEXT: ret void
106+
;
107+
%sin_f32 = call float @llvm.sin(float poison)
108+
store volatile float %sin_f32, ptr %P
109+
110+
%sin_2xf32 = call <2 x float> @llvm.sin(<2 x float> poison)
111+
store volatile <2 x float> %sin_2xf32, ptr %P
112+
113+
%sin_4xf64 = call <4 x double> @llvm.sin(<4 x double> poison)
114+
store volatile <4 x double> %sin_4xf64, ptr %P
115+
116+
%asin_f32 = call float @llvm.asin(float poison)
117+
store volatile float %asin_f32, ptr %P
118+
119+
%asin_2xf32 = call <2 x float> @llvm.asin(<2 x float> poison)
120+
store volatile <2 x float> %asin_2xf32, ptr %P
121+
122+
%asin_4xf64 = call <4 x double> @llvm.asin(<4 x double> poison)
123+
store volatile <4 x double> %asin_4xf64, ptr %P
124+
125+
ret void
126+
}
127+
128+
129+
define void @cos_poison(ptr %P) {
130+
; CHECK-LABEL: @cos_poison(
131+
; CHECK-NEXT: store volatile float 0.000000e+00, ptr [[P:%.*]], align 4
132+
; CHECK-NEXT: store volatile <2 x float> zeroinitializer, ptr [[P]], align 8
133+
; CHECK-NEXT: store volatile <4 x double> zeroinitializer, ptr [[P]], align 32
134+
; CHECK-NEXT: [[ACOS_F32:%.*]] = call float @llvm.acos.f32(float poison)
135+
; CHECK-NEXT: store volatile float [[ACOS_F32]], ptr [[P]], align 4
136+
; CHECK-NEXT: [[ACOS_2XF32:%.*]] = call <2 x float> @llvm.acos.v2f32(<2 x float> poison)
137+
; CHECK-NEXT: store volatile <2 x float> [[ACOS_2XF32]], ptr [[P]], align 8
138+
; CHECK-NEXT: [[ACOS_4XF64:%.*]] = call <4 x double> @llvm.acos.v4f64(<4 x double> poison)
139+
; CHECK-NEXT: store volatile <4 x double> [[ACOS_4XF64]], ptr [[P]], align 32
140+
; CHECK-NEXT: ret void
141+
;
142+
%cos_f32 = call float @llvm.cos(float poison)
143+
store volatile float %cos_f32, ptr %P
144+
145+
%cos_2xf32 = call <2 x float> @llvm.cos(<2 x float> poison)
146+
store volatile <2 x float> %cos_2xf32, ptr %P
147+
148+
%cos_4xf64 = call <4 x double> @llvm.cos(<4 x double> poison)
149+
store volatile <4 x double> %cos_4xf64, ptr %P
150+
151+
%acos_f32 = call float @llvm.acos(float poison)
152+
store volatile float %acos_f32, ptr %P
153+
154+
%acos_2xf32 = call <2 x float> @llvm.acos(<2 x float> poison)
155+
store volatile <2 x float> %acos_2xf32, ptr %P
156+
157+
%acos_4xf64 = call <4 x double> @llvm.acos(<4 x double> poison)
158+
store volatile <4 x double> %acos_4xf64, ptr %P
159+
160+
ret void
161+
}
162+
163+
164+
define void @tan_poison(ptr %P) {
165+
; CHECK-LABEL: @tan_poison(
166+
; CHECK-NEXT: [[TAN_F32:%.*]] = call float @llvm.tan.f32(float poison)
167+
; CHECK-NEXT: store volatile float [[TAN_F32]], ptr [[P:%.*]], align 4
168+
; CHECK-NEXT: [[TAN_2XF32:%.*]] = call <2 x float> @llvm.tan.v2f32(<2 x float> poison)
169+
; CHECK-NEXT: store volatile <2 x float> [[TAN_2XF32]], ptr [[P]], align 8
170+
; CHECK-NEXT: [[TAN_4XF64:%.*]] = call <4 x double> @llvm.tan.v4f64(<4 x double> poison)
171+
; CHECK-NEXT: store volatile <4 x double> [[TAN_4XF64]], ptr [[P]], align 32
172+
; CHECK-NEXT: [[ATAN_F32:%.*]] = call float @llvm.atan.f32(float poison)
173+
; CHECK-NEXT: store volatile float [[ATAN_F32]], ptr [[P]], align 4
174+
; CHECK-NEXT: [[ATAN_2XF32:%.*]] = call <2 x float> @llvm.atan.v2f32(<2 x float> poison)
175+
; CHECK-NEXT: store volatile <2 x float> [[ATAN_2XF32]], ptr [[P]], align 8
176+
; CHECK-NEXT: [[ATAN_4XF64:%.*]] = call <4 x double> @llvm.atan.v4f64(<4 x double> poison)
177+
; CHECK-NEXT: store volatile <4 x double> [[ATAN_4XF64]], ptr [[P]], align 32
178+
; CHECK-NEXT: [[ATAN2_F32:%.*]] = call float @llvm.atan2.f32(float poison, float poison)
179+
; CHECK-NEXT: store volatile float [[ATAN2_F32]], ptr [[P]], align 4
180+
; CHECK-NEXT: [[ATAN2_2XF32:%.*]] = call <2 x float> @llvm.atan2.v2f32(<2 x float> poison, <2 x float> poison)
181+
; CHECK-NEXT: store volatile <2 x float> [[ATAN2_2XF32]], ptr [[P]], align 8
182+
; CHECK-NEXT: [[ATAN2_4XF64:%.*]] = call <4 x double> @llvm.atan2.v4f64(<4 x double> poison, <4 x double> poison)
183+
; CHECK-NEXT: store volatile <4 x double> [[ATAN2_4XF64]], ptr [[P]], align 32
184+
; CHECK-NEXT: ret void
185+
;
186+
%tan_f32 = call float @llvm.tan(float poison)
187+
store volatile float %tan_f32, ptr %P
188+
189+
%tan_2xf32 = call <2 x float> @llvm.tan(<2 x float> poison)
190+
store volatile <2 x float> %tan_2xf32, ptr %P
191+
192+
%tan_4xf64 = call <4 x double> @llvm.tan(<4 x double> poison)
193+
store volatile <4 x double> %tan_4xf64, ptr %P
194+
195+
%atan_f32 = call float @llvm.atan(float poison)
196+
store volatile float %atan_f32, ptr %P
197+
198+
%atan_2xf32 = call <2 x float> @llvm.atan(<2 x float> poison)
199+
store volatile <2 x float> %atan_2xf32, ptr %P
200+
201+
%atan_4xf64 = call <4 x double> @llvm.atan(<4 x double> poison)
202+
store volatile <4 x double> %atan_4xf64, ptr %P
203+
204+
%atan2_f32 = call float @llvm.atan2(float poison, float poison)
205+
store volatile float %atan2_f32, ptr %P
206+
207+
%atan2_2xf32 = call <2 x float> @llvm.atan2(<2 x float> poison, <2 x float> poison)
208+
store volatile <2 x float> %atan2_2xf32, ptr %P
209+
210+
%atan2_4xf64 = call <4 x double> @llvm.atan2(<4 x double> poison, <4 x double> poison)
211+
store volatile <4 x double> %atan2_4xf64, ptr %P
212+
213+
ret void
214+
}
215+
216+
217+
define void @sincos_poison(ptr %P) {
218+
; CHECK-LABEL: @sincos_poison(
219+
; CHECK-NEXT: [[SINCOS_F32:%.*]] = call { float, float } @llvm.sincos.f32(float poison)
220+
; CHECK-NEXT: store volatile { float, float } [[SINCOS_F32]], ptr [[P:%.*]], align 4
221+
; CHECK-NEXT: [[SINCOS_2XF32:%.*]] = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> poison)
222+
; CHECK-NEXT: store volatile { <2 x float>, <2 x float> } [[SINCOS_2XF32]], ptr [[P]], align 8
223+
; CHECK-NEXT: [[SINCOS_4XF64:%.*]] = call { <4 x double>, <4 x double> } @llvm.sincos.v4f64(<4 x double> poison)
224+
; CHECK-NEXT: store volatile { <4 x double>, <4 x double> } [[SINCOS_4XF64]], ptr [[P]], align 32
225+
; CHECK-NEXT: [[SINCOSPI_F32:%.*]] = call { float, float } @llvm.sincospi.f32(float poison)
226+
; CHECK-NEXT: store volatile { float, float } [[SINCOSPI_F32]], ptr [[P]], align 4
227+
; CHECK-NEXT: [[SINCOSPI_2XF32:%.*]] = call { <2 x float>, <2 x float> } @llvm.sincospi.v2f32(<2 x float> poison)
228+
; CHECK-NEXT: store volatile { <2 x float>, <2 x float> } [[SINCOSPI_2XF32]], ptr [[P]], align 8
229+
; CHECK-NEXT: [[SINCOSPI_4XF64:%.*]] = call { <4 x double>, <4 x double> } @llvm.sincospi.v4f64(<4 x double> poison)
230+
; CHECK-NEXT: store volatile { <4 x double>, <4 x double> } [[SINCOSPI_4XF64]], ptr [[P]], align 32
231+
; CHECK-NEXT: ret void
232+
;
233+
%sincos_f32 = call { float, float } @llvm.sincos(float poison)
234+
store volatile { float, float } %sincos_f32, ptr %P
235+
236+
%sincos_2xf32 = call { <2 x float>, <2 x float> } @llvm.sincos(<2 x float> poison)
237+
store volatile { <2 x float>, <2 x float> } %sincos_2xf32, ptr %P
238+
239+
%sincos_4xf64 = call { <4 x double>, <4 x double> } @llvm.sincos(<4 x double> poison)
240+
store volatile { <4 x double>, <4 x double> } %sincos_4xf64, ptr %P
241+
242+
%sincospi_f32 = call { float, float } @llvm.sincospi(float poison)
243+
store volatile { float, float } %sincospi_f32, ptr %P
244+
245+
%sincospi_2xf32 = call { <2 x float>, <2 x float> } @llvm.sincospi(<2 x float> poison)
246+
store volatile { <2 x float>, <2 x float> } %sincospi_2xf32, ptr %P
247+
248+
%sincospi_4xf64 = call { <4 x double>, <4 x double> } @llvm.sincospi(<4 x double> poison)
249+
store volatile { <4 x double>, <4 x double> } %sincospi_4xf64, ptr %P
250+
251+
ret void
252+
}
253+
254+
255+
define void @sinh_poison(ptr %P) {
256+
; CHECK-LABEL: @sinh_poison(
257+
; CHECK-NEXT: [[SINH_F32:%.*]] = call float @llvm.sinh.f32(float poison)
258+
; CHECK-NEXT: store volatile float [[SINH_F32]], ptr [[P:%.*]], align 4
259+
; CHECK-NEXT: [[SINH_2XF32:%.*]] = call <2 x float> @llvm.sinh.v2f32(<2 x float> poison)
260+
; CHECK-NEXT: store volatile <2 x float> [[SINH_2XF32]], ptr [[P]], align 8
261+
; CHECK-NEXT: [[SINH_4XF64:%.*]] = call <4 x double> @llvm.sinh.v4f64(<4 x double> poison)
262+
; CHECK-NEXT: store volatile <4 x double> [[SINH_4XF64]], ptr [[P]], align 32
263+
; CHECK-NEXT: ret void
264+
;
265+
%sinh_f32 = call float @llvm.sinh(float poison)
266+
store volatile float %sinh_f32, ptr %P
267+
268+
%sinh_2xf32 = call <2 x float> @llvm.sinh(<2 x float> poison)
269+
store volatile <2 x float> %sinh_2xf32, ptr %P
270+
271+
%sinh_4xf64 = call <4 x double> @llvm.sinh(<4 x double> poison)
272+
store volatile <4 x double> %sinh_4xf64, ptr %P
273+
274+
ret void
275+
}
276+
277+
278+
define void @cosh_poison(ptr %P) {
279+
; CHECK-LABEL: @cosh_poison(
280+
; CHECK-NEXT: [[COSH_F32:%.*]] = call float @llvm.cosh.f32(float poison)
281+
; CHECK-NEXT: store volatile float [[COSH_F32]], ptr [[P:%.*]], align 4
282+
; CHECK-NEXT: [[COSH_2XF32:%.*]] = call <2 x float> @llvm.cosh.v2f32(<2 x float> poison)
283+
; CHECK-NEXT: store volatile <2 x float> [[COSH_2XF32]], ptr [[P]], align 8
284+
; CHECK-NEXT: [[COSH_4XF64:%.*]] = call <4 x double> @llvm.cosh.v4f64(<4 x double> poison)
285+
; CHECK-NEXT: store volatile <4 x double> [[COSH_4XF64]], ptr [[P]], align 32
286+
; CHECK-NEXT: ret void
287+
;
288+
%cosh_f32 = call float @llvm.cosh(float poison)
289+
store volatile float %cosh_f32, ptr %P
290+
291+
%cosh_2xf32 = call <2 x float> @llvm.cosh(<2 x float> poison)
292+
store volatile <2 x float> %cosh_2xf32, ptr %P
293+
294+
%cosh_4xf64 = call <4 x double> @llvm.cosh(<4 x double> poison)
295+
store volatile <4 x double> %cosh_4xf64, ptr %P
296+
297+
ret void
298+
}
299+
300+
301+
define void @tanh_poison(ptr %P) {
302+
; CHECK-LABEL: @tanh_poison(
303+
; CHECK-NEXT: [[TANH_F32:%.*]] = call float @llvm.tanh.f32(float poison)
304+
; CHECK-NEXT: store volatile float [[TANH_F32]], ptr [[P:%.*]], align 4
305+
; CHECK-NEXT: [[TANH_2XF32:%.*]] = call <2 x float> @llvm.tanh.v2f32(<2 x float> poison)
306+
; CHECK-NEXT: store volatile <2 x float> [[TANH_2XF32]], ptr [[P]], align 8
307+
; CHECK-NEXT: [[TANH_4XF64:%.*]] = call <4 x double> @llvm.tanh.v4f64(<4 x double> poison)
308+
; CHECK-NEXT: store volatile <4 x double> [[TANH_4XF64]], ptr [[P]], align 32
309+
; CHECK-NEXT: ret void
310+
;
311+
%tanh_f32 = call float @llvm.tanh(float poison)
312+
store volatile float %tanh_f32, ptr %P
313+
314+
%tanh_2xf32 = call <2 x float> @llvm.tanh(<2 x float> poison)
315+
store volatile <2 x float> %tanh_2xf32, ptr %P
316+
317+
%tanh_4xf64 = call <4 x double> @llvm.tanh(<4 x double> poison)
318+
store volatile <4 x double> %tanh_4xf64, ptr %P
319+
320+
ret void
321+
}

0 commit comments

Comments
 (0)