xref: /llvm-project/llvm/test/Transforms/DCE/calls-errno.ll (revision 3f8027fb67bc4efae9959a4d75f8f37ecf0c3985)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=dce -S | FileCheck %s
3
4declare double @acos(double) nounwind willreturn
5declare double @asin(double) nounwind willreturn
6declare double @atan(double) nounwind willreturn
7declare double @atan2(double, double) nounwind willreturn
8declare double @ceil(double) nounwind willreturn
9declare double @cos(double) nounwind willreturn
10declare double @cosh(double) nounwind willreturn
11declare double @exp(double) nounwind willreturn
12declare double @exp2(double) nounwind willreturn
13declare double @fabs(double) nounwind willreturn
14declare double @floor(double) nounwind willreturn
15declare double @fmod(double, double) nounwind willreturn
16declare double @log(double) nounwind willreturn
17declare double @log10(double) nounwind willreturn
18declare double @pow(double, double) nounwind willreturn
19declare double @sin(double) nounwind willreturn
20declare double @sinh(double) nounwind willreturn
21declare double @sqrt(double) nounwind willreturn
22declare double @tan(double) nounwind willreturn
23declare double @tanh(double) nounwind willreturn
24
25declare float @acosf(float) nounwind willreturn
26declare float @asinf(float) nounwind willreturn
27declare float @atanf(float) nounwind willreturn
28declare float @atan2f(float, float) nounwind willreturn
29declare float @ceilf(float) nounwind willreturn
30declare float @cosf(float) nounwind willreturn
31declare float @coshf(float) nounwind willreturn
32declare float @expf(float) nounwind willreturn
33declare float @exp2f(float) nounwind willreturn
34declare float @fabsf(float) nounwind willreturn
35declare float @floorf(float) nounwind willreturn
36declare float @fmodf(float, float) nounwind willreturn
37declare float @logf(float) nounwind willreturn
38declare float @log10f(float) nounwind willreturn willreturn
39declare float @powf(float, float) nounwind willreturn
40declare float @sinf(float) nounwind willreturn
41declare float @sinhf(float) nounwind willreturn
42declare float @sqrtf(float) nounwind willreturn
43declare float @tanf(float) nounwind willreturn
44declare float @tanhf(float) nounwind willreturn
45
46define void @T() {
47; CHECK-LABEL: @T(
48; CHECK-NEXT:  entry:
49; CHECK-NEXT:    [[LOG1:%.*]] = call double @log(double 0.000000e+00)
50; CHECK-NEXT:    [[LOG2:%.*]] = call double @log(double -1.000000e+00)
51; CHECK-NEXT:    [[EXP2:%.*]] = call double @exp(double 1.000000e+03)
52; CHECK-NEXT:    [[COS2:%.*]] = call double @cos(double 0x7FF0000000000000)
53; CHECK-NEXT:    [[COS3:%.*]] = call double @cos(double 0.000000e+00) [[ATTR2:#.*]]
54; CHECK-NEXT:    [[FMOD2:%.*]] = call double @fmod(double 0x7FF0000000000000, double 1.000000e+00)
55; CHECK-NEXT:    ret void
56;
57entry:
58
59; log(0) produces a pole error
60  %log1 = call double @log(double 0.000000e+00)
61
62; log(-1) produces a domain error
63  %log2 = call double @log(double -1.000000e+00)
64
65; log(1) is 0
66  %log3 = call double @log(double 1.000000e+00)
67
68; exp(100) is roughly 2.6e+43
69  %exp1 = call double @exp(double 1.000000e+02)
70
71; exp(1000) is a range error
72  %exp2 = call double @exp(double 1.000000e+03)
73
74; cos(0) is 1
75  %cos1 = call double @cos(double 0.000000e+00)
76
77; cos(inf) is a domain error
78  %cos2 = call double @cos(double 0x7FF0000000000000)
79
80; cos(0) nobuiltin may have side effects
81  %cos3 = call double @cos(double 0.000000e+00) nobuiltin
82
83; pow(0, 1) is 0
84  %pow1 = call double @pow(double 0x7FF0000000000000, double 1.000000e+00)
85
86; pow(0, -1) is a pole error
87; FIXME: It fails on mingw host. Suppress checking.
88; %pow2 = call double @pow(double 0.000000e+00, double -1.000000e+00)
89
90; fmod(inf, nan) is nan
91  %fmod1 = call double @fmod(double 0x7FF0000000000000, double 0x7FF0000000000001)
92
93; fmod(inf, 1) is a domain error
94  %fmod2 = call double @fmod(double 0x7FF0000000000000, double 1.000000e+00)
95
96  ret void
97}
98
99define void @Tstrict() strictfp {
100; CHECK-LABEL: @Tstrict(
101; CHECK-NEXT:  entry:
102; CHECK-NEXT:    [[COS4:%.*]] = call double @cos(double 1.000000e+00) [[ATTR1:#.*]]
103; CHECK-NEXT:    ret void
104;
105entry:
106
107; cos(1) strictfp sets FP status flags
108  %cos4 = call double @cos(double 1.000000e+00) strictfp
109
110  ret void
111}
112