@@ -29,6 +29,17 @@ define half @test3(float %a) {
29
29
ret half %c
30
30
}
31
31
32
+ define half @test3_fast (float %a ) {
33
+ ; CHECK-LABEL: @test3_fast(
34
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
35
+ ; CHECK-NEXT: [[C:%.*]] = call half @llvm.fabs.f16(half [[TMP1]])
36
+ ; CHECK-NEXT: ret half [[C]]
37
+ ;
38
+ %b = call float @llvm.fabs.f32 (float %a )
39
+ %c = fptrunc fast float %b to half
40
+ ret half %c
41
+ }
42
+
32
43
define half @fneg_fptrunc (float %a ) {
33
44
; CHECK-LABEL: @fneg_fptrunc(
34
45
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
@@ -78,6 +89,28 @@ define half @test4-fast(float %a) {
78
89
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc fast float [[A:%.*]] to half
79
90
; CHECK-NEXT: [[C:%.*]] = fneg fast half [[TMP1]]
80
91
; CHECK-NEXT: ret half [[C]]
92
+ ;
93
+ %b = fsub fast float -0 .0 , %a
94
+ %c = fptrunc fast float %b to half
95
+ ret half %c
96
+ }
97
+
98
+ define half @test4-mixed-fast-1 (float %a ) {
99
+ ; CHECK-LABEL: @test4-mixed-fast-1(
100
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
101
+ ; CHECK-NEXT: [[C:%.*]] = fneg half [[TMP1]]
102
+ ; CHECK-NEXT: ret half [[C]]
103
+ ;
104
+ %b = fsub float -0 .0 , %a
105
+ %c = fptrunc fast float %b to half
106
+ ret half %c
107
+ }
108
+
109
+ define half @test4-mixed-fast-2 (float %a ) {
110
+ ; CHECK-LABEL: @test4-mixed-fast-2(
111
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
112
+ ; CHECK-NEXT: [[C:%.*]] = fneg half [[TMP1]]
113
+ ; CHECK-NEXT: ret half [[C]]
81
114
;
82
115
%b = fsub fast float -0 .0 , %a
83
116
%c = fptrunc float %b to half
@@ -89,12 +122,67 @@ define half @test4_unary_fneg-fast(float %a) {
89
122
; CHECK-NEXT: [[TMP1:%.*]] = fptrunc fast float [[A:%.*]] to half
90
123
; CHECK-NEXT: [[C:%.*]] = fneg fast half [[TMP1]]
91
124
; CHECK-NEXT: ret half [[C]]
125
+ ;
126
+ %b = fneg fast float %a
127
+ %c = fptrunc fast float %b to half
128
+ ret half %c
129
+ }
130
+
131
+ define half @test4_unary_fneg-mixed-fast-1 (float %a ) {
132
+ ; CHECK-LABEL: @test4_unary_fneg-mixed-fast-1(
133
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
134
+ ; CHECK-NEXT: [[C:%.*]] = fneg half [[TMP1]]
135
+ ; CHECK-NEXT: ret half [[C]]
136
+ ;
137
+ %b = fneg float %a
138
+ %c = fptrunc fast float %b to half
139
+ ret half %c
140
+ }
141
+
142
+ define half @test4_unary_fneg-mixed-fast-2 (float %a ) {
143
+ ; CHECK-LABEL: @test4_unary_fneg-mixed-fast-2(
144
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
145
+ ; CHECK-NEXT: [[C:%.*]] = fneg half [[TMP1]]
146
+ ; CHECK-NEXT: ret half [[C]]
92
147
;
93
148
%b = fneg fast float %a
94
149
%c = fptrunc float %b to half
95
150
ret half %c
96
151
}
97
152
153
+ define <2 x half > @test4_unary_fneg-vec-fast (<2 x float > %a ) {
154
+ ; CHECK-LABEL: @test4_unary_fneg-vec-fast(
155
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc fast <2 x float> [[A:%.*]] to <2 x half>
156
+ ; CHECK-NEXT: [[C:%.*]] = fneg fast <2 x half> [[TMP1]]
157
+ ; CHECK-NEXT: ret <2 x half> [[C]]
158
+ ;
159
+ %b = fneg fast <2 x float > %a
160
+ %c = fptrunc fast <2 x float > %b to <2 x half >
161
+ ret <2 x half > %c
162
+ }
163
+
164
+ define <2 x half > @test4_unary_fneg-vec-mixed-fast-1 (<2 x float > %a ) {
165
+ ; CHECK-LABEL: @test4_unary_fneg-vec-mixed-fast-1(
166
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc <2 x float> [[A:%.*]] to <2 x half>
167
+ ; CHECK-NEXT: [[C:%.*]] = fneg <2 x half> [[TMP1]]
168
+ ; CHECK-NEXT: ret <2 x half> [[C]]
169
+ ;
170
+ %b = fneg <2 x float > %a
171
+ %c = fptrunc fast <2 x float > %b to <2 x half >
172
+ ret <2 x half > %c
173
+ }
174
+
175
+ define <2 x half > @test4_unary_fneg-vec-mixed-fast-2 (<2 x float > %a ) {
176
+ ; CHECK-LABEL: @test4_unary_fneg-vec-mixed-fast-2(
177
+ ; CHECK-NEXT: [[TMP1:%.*]] = fptrunc <2 x float> [[A:%.*]] to <2 x half>
178
+ ; CHECK-NEXT: [[C:%.*]] = fneg <2 x half> [[TMP1]]
179
+ ; CHECK-NEXT: ret <2 x half> [[C]]
180
+ ;
181
+ %b = fneg fast <2 x float > %a
182
+ %c = fptrunc <2 x float > %b to <2 x half >
183
+ ret <2 x half > %c
184
+ }
185
+
98
186
define half @test5 (float %a , float %b , float %c ) {
99
187
; CHECK-LABEL: @test5(
100
188
; CHECK-NEXT: [[D:%.*]] = fcmp ogt float [[A:%.*]], [[B:%.*]]
0 commit comments