1 ; RUN: opt < %s -constprop -S | FileCheck %s
2 ; RUN: opt < %s -constprop -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN
4 declare double @cos(double)
6 declare double @sin(double)
8 declare double @tan(double)
10 declare double @sqrt(double)
11 declare double @exp2(double)
17 %A = call double @cos(double 0.000000e+00)
18 %B = call double @sin(double 0.000000e+00)
19 %a = fadd double %A, %B
20 %C = call double @tan(double 0.000000e+00)
21 %b = fadd double %a, %C
22 %D = call double @sqrt(double 4.000000e+00)
23 %c = fadd double %b, %D
26 %E = call double @exp2(double 4.0)
27 %d = fadd double %c, %E
31 define i1 @test_sse_cvt() nounwind readnone {
32 ; CHECK-LABEL: @test_sse_cvt(
36 %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
37 %i1 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
38 %i2 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
39 %i3 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
40 %i4 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 1.75, double undef>) nounwind
41 %i5 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 1.75, double undef>) nounwind
42 %i6 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 1.75, double undef>) nounwind
43 %i7 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 1.75, double undef>) nounwind
44 %sum11 = add i32 %i0, %i1
45 %sum12 = add i32 %i4, %i5
46 %sum1 = add i32 %sum11, %sum12
47 %sum21 = add i64 %i2, %i3
48 %sum22 = add i64 %i6, %i7
49 %sum2 = add i64 %sum21, %sum22
50 %sum1.sext = sext i32 %sum1 to i64
51 %b = icmp eq i64 %sum1.sext, %sum2
55 declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) nounwind readnone
56 declare i32 @llvm.x86.sse.cvttss2si(<4 x float>) nounwind readnone
57 declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) nounwind readnone
58 declare i64 @llvm.x86.sse.cvttss2si64(<4 x float>) nounwind readnone
59 declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone
60 declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>) nounwind readnone
61 declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>) nounwind readnone
62 declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) nounwind readnone
64 define double @test_intrinsic_pow() nounwind uwtable ssp {
66 ; CHECK-LABEL: @test_intrinsic_pow(
68 %0 = call double @llvm.pow.f64(double 1.500000e+00, double 3.000000e+00)
71 declare double @llvm.pow.f64(double, double) nounwind readonly
73 ; Shouldn't fold because of -fno-builtin
74 define double @sin_() nounwind uwtable ssp {
75 ; FNOBUILTIN-LABEL: @sin_(
76 ; FNOBUILTIN: %1 = call double @sin(double 3.000000e+00)
77 %1 = call double @sin(double 3.000000e+00)
81 ; Shouldn't fold because of -fno-builtin
82 define double @sqrt_() nounwind uwtable ssp {
83 ; FNOBUILTIN-LABEL: @sqrt_(
84 ; FNOBUILTIN: %1 = call double @sqrt(double 3.000000e+00)
85 %1 = call double @sqrt(double 3.000000e+00)
89 ; Shouldn't fold because of -fno-builtin
90 define float @sqrtf_() nounwind uwtable ssp {
91 ; FNOBUILTIN-LABEL: @sqrtf_(
92 ; FNOBUILTIN: %1 = call float @sqrtf(float 3.000000e+00)
93 %1 = call float @sqrtf(float 3.000000e+00)
96 declare float @sqrtf(float)
98 ; Shouldn't fold because of -fno-builtin
99 define float @sinf_() nounwind uwtable ssp {
100 ; FNOBUILTIN-LABEL: @sinf_(
101 ; FNOBUILTIN: %1 = call float @sinf(float 3.000000e+00)
102 %1 = call float @sinf(float 3.000000e+00)
105 declare float @sinf(float)
107 ; Shouldn't fold because of -fno-builtin
108 define double @tan_() nounwind uwtable ssp {
109 ; FNOBUILTIN-LABEL: @tan_(
110 ; FNOBUILTIN: %1 = call double @tan(double 3.000000e+00)
111 %1 = call double @tan(double 3.000000e+00)
115 ; Shouldn't fold because of -fno-builtin
116 define double @tanh_() nounwind uwtable ssp {
117 ; FNOBUILTIN-LABEL: @tanh_(
118 ; FNOBUILTIN: %1 = call double @tanh(double 3.000000e+00)
119 %1 = call double @tanh(double 3.000000e+00)
122 declare double @tanh(double)
124 ; Shouldn't fold because of -fno-builtin
125 define double @pow_() nounwind uwtable ssp {
126 ; FNOBUILTIN-LABEL: @pow_(
127 ; FNOBUILTIN: %1 = call double @pow(double 3.000000e+00, double 3.000000e+00)
128 %1 = call double @pow(double 3.000000e+00, double 3.000000e+00)
131 declare double @pow(double, double)
133 ; Shouldn't fold because of -fno-builtin
134 define double @fmod_() nounwind uwtable ssp {
135 ; FNOBUILTIN-LABEL: @fmod_(
136 ; FNOBUILTIN: %1 = call double @fmod(double 3.000000e+00, double 3.000000e+00)
137 %1 = call double @fmod(double 3.000000e+00, double 3.000000e+00)
140 declare double @fmod(double, double)
142 ; Shouldn't fold because of -fno-builtin
143 define double @atan2_() nounwind uwtable ssp {
144 ; FNOBUILTIN-LABEL: @atan2_(
145 ; FNOBUILTIN: %1 = call double @atan2(double 3.000000e+00, double 3.000000e+00)
146 %1 = call double @atan2(double 3.000000e+00, double 3.000000e+00)
149 declare double @atan2(double, double)