Skip to content

Commit b163238

Browse files
committed
[Transforms] Add pre-commit tests
Merge tan-nofastmath.ll and tan.ll into trig.ll
1 parent d9dd5f0 commit b163238

File tree

3 files changed

+144
-40
lines changed

3 files changed

+144
-40
lines changed

llvm/test/Transforms/InstCombine/tan-nofastmath.ll

Lines changed: 0 additions & 17 deletions
This file was deleted.

llvm/test/Transforms/InstCombine/tan.ll

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3+
4+
define float @tanAtanInverseFast(float %x) {
5+
; CHECK-LABEL: define float @tanAtanInverseFast(
6+
; CHECK-SAME: float [[X:%.*]]) {
7+
; CHECK-NEXT: [[CALL:%.*]] = call fast float @atanf(float [[X]])
8+
; CHECK-NEXT: ret float [[X]]
9+
;
10+
%call = call fast float @atanf(float %x)
11+
%call1 = call fast float @tanf(float %call)
12+
ret float %call1
13+
}
14+
15+
define float @atanhTanhInverseFast(float %x) {
16+
; CHECK-LABEL: define float @atanhTanhInverseFast(
17+
; CHECK-SAME: float [[X:%.*]]) {
18+
; CHECK-NEXT: [[CALL:%.*]] = call fast float @tanhf(float [[X]])
19+
; CHECK-NEXT: [[CALL1:%.*]] = call fast float @atanhf(float [[CALL]])
20+
; CHECK-NEXT: ret float [[CALL1]]
21+
;
22+
%call = call fast float @tanhf(float %x)
23+
%call1 = call fast float @atanhf(float %call)
24+
ret float %call1
25+
}
26+
27+
define float @sinhAsinhInverseFast(float %x) {
28+
; CHECK-LABEL: define float @sinhAsinhInverseFast(
29+
; CHECK-SAME: float [[X:%.*]]) {
30+
; CHECK-NEXT: [[CALL:%.*]] = call fast float @asinhf(float [[X]])
31+
; CHECK-NEXT: [[CALL1:%.*]] = call fast float @sinhf(float [[CALL]])
32+
; CHECK-NEXT: ret float [[CALL1]]
33+
;
34+
%call = call fast float @asinhf(float %x)
35+
%call1 = call fast float @sinhf(float %call)
36+
ret float %call1
37+
}
38+
39+
define float @asinhSinhInverseFast(float %x) {
40+
; CHECK-LABEL: define float @asinhSinhInverseFast(
41+
; CHECK-SAME: float [[X:%.*]]) {
42+
; CHECK-NEXT: [[CALL:%.*]] = call fast float @sinhf(float [[X]])
43+
; CHECK-NEXT: [[CALL1:%.*]] = call fast float @asinhf(float [[CALL]])
44+
; CHECK-NEXT: ret float [[CALL1]]
45+
;
46+
%call = call fast float @sinhf(float %x)
47+
%call1 = call fast float @asinhf(float %call)
48+
ret float %call1
49+
}
50+
51+
define float @coshAcoshInverseFast(float %x) {
52+
; CHECK-LABEL: define float @coshAcoshInverseFast(
53+
; CHECK-SAME: float [[X:%.*]]) {
54+
; CHECK-NEXT: [[CALL:%.*]] = call fast float @acoshf(float [[X]])
55+
; CHECK-NEXT: [[CALL1:%.*]] = call fast float @coshf(float [[CALL]])
56+
; CHECK-NEXT: ret float [[CALL1]]
57+
;
58+
%call = call fast float @acoshf(float %x)
59+
%call1 = call fast float @coshf(float %call)
60+
ret float %call1
61+
}
62+
63+
define float @indirectTanCall(ptr %fptr) {
64+
; CHECK-LABEL: define float @indirectTanCall(
65+
; CHECK-SAME: ptr [[FPTR:%.*]]) {
66+
; CHECK-NEXT: [[CALL1:%.*]] = call fast float [[FPTR]]()
67+
; CHECK-NEXT: [[TAN:%.*]] = call fast float @tanf(float [[CALL1]])
68+
; CHECK-NEXT: ret float [[TAN]]
69+
;
70+
%call1 = call fast float %fptr()
71+
%tan = call fast float @tanf(float %call1)
72+
ret float %tan
73+
}
74+
75+
; No fast-math.
76+
77+
define float @tanAtanInverse(float %x) {
78+
; CHECK-LABEL: define float @tanAtanInverse(
79+
; CHECK-SAME: float [[X:%.*]]) {
80+
; CHECK-NEXT: [[CALL:%.*]] = call float @atanf(float [[X]])
81+
; CHECK-NEXT: [[CALL1:%.*]] = call float @tanf(float [[CALL]])
82+
; CHECK-NEXT: ret float [[CALL1]]
83+
;
84+
%call = call float @atanf(float %x)
85+
%call1 = call float @tanf(float %call)
86+
ret float %call1
87+
}
88+
89+
define float @atanhTanhInverse(float %x) {
90+
; CHECK-LABEL: define float @atanhTanhInverse(
91+
; CHECK-SAME: float [[X:%.*]]) {
92+
; CHECK-NEXT: [[CALL:%.*]] = call float @tanhf(float [[X]])
93+
; CHECK-NEXT: [[CALL1:%.*]] = call float @atanhf(float [[CALL]])
94+
; CHECK-NEXT: ret float [[CALL1]]
95+
;
96+
%call = call float @tanhf(float %x)
97+
%call1 = call float @atanhf(float %call)
98+
ret float %call1
99+
}
100+
101+
define float @sinhAsinhInverse(float %x) {
102+
; CHECK-LABEL: define float @sinhAsinhInverse(
103+
; CHECK-SAME: float [[X:%.*]]) {
104+
; CHECK-NEXT: [[CALL:%.*]] = call float @asinhf(float [[X]])
105+
; CHECK-NEXT: [[CALL1:%.*]] = call float @sinhf(float [[CALL]])
106+
; CHECK-NEXT: ret float [[CALL1]]
107+
;
108+
%call = call float @asinhf(float %x)
109+
%call1 = call float @sinhf(float %call)
110+
ret float %call1
111+
}
112+
113+
define float @asinhSinhInverse(float %x) {
114+
; CHECK-LABEL: define float @asinhSinhInverse(
115+
; CHECK-SAME: float [[X:%.*]]) {
116+
; CHECK-NEXT: [[CALL:%.*]] = call float @sinhf(float [[X]])
117+
; CHECK-NEXT: [[CALL1:%.*]] = call float @asinhf(float [[CALL]])
118+
; CHECK-NEXT: ret float [[CALL1]]
119+
;
120+
%call = call float @sinhf(float %x)
121+
%call1 = call float @asinhf(float %call)
122+
ret float %call1
123+
}
124+
125+
define float @coshAcoshInverse(float %x) {
126+
; CHECK-LABEL: define float @coshAcoshInverse(
127+
; CHECK-SAME: float [[X:%.*]]) {
128+
; CHECK-NEXT: [[CALL:%.*]] = call float @acoshf(float [[X]])
129+
; CHECK-NEXT: [[CALL1:%.*]] = call float @coshf(float [[CALL]])
130+
; CHECK-NEXT: ret float [[CALL1]]
131+
;
132+
%call = call float @acoshf(float %x)
133+
%call1 = call float @coshf(float %call)
134+
ret float %call1
135+
}
136+
137+
declare float @asinhf(float)
138+
declare float @sinhf(float)
139+
declare float @acoshf(float)
140+
declare float @coshf(float)
141+
declare float @tanhf(float)
142+
declare float @atanhf(float)
143+
declare float @tanf(float)
144+
declare float @atanf(float)

0 commit comments

Comments
 (0)