File: fast-math-flags.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (268 lines) | stat: -rw-r--r-- 10,452 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
; RUN: llvm-as < %s | llvm-dis | FileCheck -strict-whitespace %s
; RUN: opt -S < %s | FileCheck -strict-whitespace %s
; RUN: verify-uselistorder %s

@addr   = external global i64
@select = external global i1
@vec    = external global <3 x float>
@arr    = external global [3 x float]

declare float @foo(float)

define float @none(float %x, float %y) {
entry:
; CHECK:  %vec = load <3 x float>, ptr @vec
  %vec    = load <3 x float>, ptr @vec
; CHECK:  %select = load i1, ptr @select
  %select = load i1, ptr @select
; CHECK:  %arr = load [3 x float], ptr @arr
  %arr    = load [3 x float], ptr @arr
; CHECK:  %scalable = load <vscale x 3 x float>, ptr @vec
  %scalable = load <vscale x 3 x float>, ptr @vec

; CHECK:  %a = fadd float %x, %y
  %a = fadd float %x, %y
; CHECK:  %a_vec = fadd <3 x float> %vec, %vec
  %a_vec = fadd <3 x float> %vec, %vec
; CHECK:  %b = fsub float %x, %y
  %b = fsub float %x, %y
; CHECK:  %b_vec = fsub <3 x float> %vec, %vec
  %b_vec = fsub <3 x float> %vec, %vec
; CHECK:  %c = fmul float %x, %y
  %c = fmul float %x, %y
; CHECK:  %c_vec = fmul <3 x float> %vec, %vec
  %c_vec = fmul <3 x float> %vec, %vec
; CHECK:  %d = fdiv float %x, %y
  %d = fdiv float %x, %y
; CHECK:  %d_vec = fdiv <3 x float> %vec, %vec
  %d_vec = fdiv <3 x float> %vec, %vec
; CHECK:  %e = frem float %x, %y
  %e = frem float %x, %y
; CHECK:  %e_vec = frem <3 x float> %vec, %vec
  %e_vec = frem <3 x float> %vec, %vec
; CHECK:  %f = fneg float %x
  %f = fneg float %x
; CHECK:  %f_vec = fneg <3 x float> %vec
  %f_vec = fneg <3 x float> %vec
; CHECK: %g = fpext float %x to double
  %g = fpext float %x to double
; CHECK: %g_vec = fpext <3 x float> %vec to <3 x double>
  %g_vec = fpext <3 x float> %vec to <3 x double>
; CHECK: %g_scalable = fpext <vscale x 3 x float> %scalable to <vscale x 3 x double>
  %g_scalable = fpext <vscale x 3 x float> %scalable to <vscale x 3 x double>
; CHECK: %h = fptrunc float %x to half
  %h = fptrunc float %x to half
; CHECK: %h_vec = fptrunc <3 x float> %vec to <3 x half>
  %h_vec = fptrunc <3 x float> %vec to <3 x half>
; CHECK: %h_scalable = fptrunc <vscale x 3 x float> %scalable to <vscale x 3 x half>
  %h_scalable = fptrunc <vscale x 3 x float> %scalable to <vscale x 3 x half>
; CHECK:  ret float %f
  ret  float %f
}

; CHECK: no_nan
define float @no_nan(float %x, float %y) {
entry:
; CHECK:  %vec = load <3 x float>, ptr @vec
  %vec    = load <3 x float>, ptr @vec
; CHECK:  %select = load i1, ptr @select
  %select = load i1, ptr @select
; CHECK:  %arr = load [3 x float], ptr @arr
  %arr    = load [3 x float], ptr @arr
; CHECK:  %scalable = load <vscale x 3 x float>, ptr @vec
  %scalable = load <vscale x 3 x float>, ptr @vec

; CHECK:  %a = fadd nnan float %x, %y
  %a = fadd nnan float %x, %y
; CHECK:  %a_vec = fadd nnan <3 x float> %vec, %vec
  %a_vec = fadd nnan <3 x float> %vec, %vec
; CHECK:  %b = fsub nnan float %x, %y
  %b = fsub nnan float %x, %y
; CHECK:  %b_vec = fsub nnan <3 x float> %vec, %vec
  %b_vec = fsub nnan <3 x float> %vec, %vec
; CHECK:  %c = fmul nnan float %x, %y
  %c = fmul nnan float %x, %y
; CHECK:  %c_vec = fmul nnan <3 x float> %vec, %vec
  %c_vec = fmul nnan <3 x float> %vec, %vec
; CHECK:  %d = fdiv nnan float %x, %y
  %d = fdiv nnan float %x, %y
; CHECK:  %d_vec = fdiv nnan <3 x float> %vec, %vec
  %d_vec = fdiv nnan <3 x float> %vec, %vec
; CHECK:  %e = frem nnan float %x, %y
  %e = frem nnan float %x, %y
; CHECK:  %e_vec = frem nnan <3 x float> %vec, %vec
  %e_vec = frem nnan <3 x float> %vec, %vec
; CHECK:  %f = fneg nnan float %x
  %f = fneg nnan float %x
; CHECK:  %f_vec = fneg nnan <3 x float> %vec
  %f_vec = fneg nnan <3 x float> %vec
; CHECK: %g = fpext nnan float %x to double
  %g = fpext nnan float %x to double
; CHECK: %g_vec = fpext nnan <3 x float> %vec to <3 x double>
  %g_vec = fpext nnan <3 x float> %vec to <3 x double>
; CHECK: %g_scalable = fpext nnan <vscale x 3 x float> %scalable to <vscale x 3 x double>
  %g_scalable = fpext nnan <vscale x 3 x float> %scalable to <vscale x 3 x double>
; CHECK: %h = fptrunc nnan float %x to half
  %h = fptrunc nnan float %x to half
; CHECK: %h_vec = fptrunc nnan <3 x float> %vec to <3 x half>
  %h_vec = fptrunc nnan <3 x float> %vec to <3 x half>
; CHECK: %h_scalable = fptrunc nnan <vscale x 3 x float> %scalable to <vscale x 3 x half>
  %h_scalable = fptrunc nnan <vscale x 3 x float> %scalable to <vscale x 3 x half>
; CHECK:  ret float %f
  ret float %f
}

; CHECK: @contract(
define float @contract(float %x, float %y) {
entry:
; CHECK: %a = fsub contract float %x, %y
  %a = fsub contract float %x, %y
; CHECK: %b = fadd contract float %x, %y
  %b = fadd contract float %x, %y
; CHECK: %c = fmul contract float %a, %b
  %c = fmul contract float %a, %b
; CHECK: %d = fpext contract float %x to double
  %d = fpext contract float %x to double
; CHECK: %e = fptrunc contract float %x to half
  %e = fptrunc contract float %x to half
  ret float %c
}

; CHECK: @reassoc(
define float @reassoc(float %x, float %y) {
; CHECK: %a = fsub reassoc float %x, %y
  %a = fsub reassoc float %x, %y
; CHECK: %b = fmul reassoc float %x, %y
  %b = fmul reassoc float %x, %y
; CHECK: %c = call reassoc float @foo(float %b)
  %c = call reassoc float @foo(float %b)
; CHECK: %d = fpext reassoc float %x to double
  %d = fpext reassoc float %x to double
; CHECK: %e = fptrunc reassoc float %x to half
  %e = fptrunc reassoc float %x to half
  ret float %c
}

; CHECK: @afn(
define float @afn(float %x, float %y) {
; CHECK: %a = fdiv afn float %x, %y
  %a = fdiv afn float %x, %y
; CHECK: %b = frem afn float %x, %y
  %b = frem afn float %x, %y
; CHECK: %c = call afn float @foo(float %b)
  %c = call afn float @foo(float %b)
  ret float %c
}

; CHECK: no_nan_inf
define float @no_nan_inf(float %x, float %y) {
entry:
; CHECK:  %vec = load <3 x float>, ptr @vec
  %vec    = load <3 x float>, ptr @vec
; CHECK:  %select = load i1, ptr @select
  %select = load i1, ptr @select
; CHECK:  %arr = load [3 x float], ptr @arr
  %arr    = load [3 x float], ptr @arr
; CHECK:  %scalable = load <vscale x 3 x float>, ptr @vec
  %scalable = load <vscale x 3 x float>, ptr @vec

; CHECK:  %a = fadd nnan ninf float %x, %y
  %a = fadd ninf nnan float %x, %y
; CHECK:  %a_vec = fadd nnan <3 x float> %vec, %vec
  %a_vec = fadd nnan <3 x float> %vec, %vec
; CHECK:  %b = fsub nnan float %x, %y
  %b = fsub nnan float %x, %y
; CHECK:  %b_vec = fsub nnan ninf <3 x float> %vec, %vec
  %b_vec = fsub ninf nnan <3 x float> %vec, %vec
; CHECK:  %c = fmul nnan float %x, %y
  %c = fmul nnan float %x, %y
; CHECK:  %c_vec = fmul nnan <3 x float> %vec, %vec
  %c_vec = fmul nnan <3 x float> %vec, %vec
; CHECK:  %d = fdiv nnan ninf float %x, %y
  %d = fdiv ninf nnan float %x, %y
; CHECK:  %d_vec = fdiv nnan <3 x float> %vec, %vec
  %d_vec = fdiv nnan <3 x float> %vec, %vec
; CHECK:  %e = frem nnan float %x, %y
  %e = frem nnan float %x, %y
; CHECK:  %e_vec = frem nnan ninf <3 x float> %vec, %vec
  %e_vec = frem ninf nnan <3 x float> %vec, %vec
; CHECK: %f = fpext nnan ninf float %x to double
  %f = fpext ninf nnan float %x to double
; CHECK: %f_vec = fpext nnan ninf <3 x float> %vec to <3 x double>
  %f_vec = fpext ninf nnan <3 x float> %vec to <3 x double>
; CHECK: %f_scalable = fpext nnan ninf <vscale x 3 x float> %scalable to <vscale x 3 x double>
  %f_scalable = fpext ninf nnan <vscale x 3 x float> %scalable to <vscale x 3 x double>
; CHECK: %g = fptrunc nnan ninf float %x to half
  %g = fptrunc ninf nnan float %x to half
; CHECK: %g_vec = fptrunc nnan ninf <3 x float> %vec to <3 x half>
  %g_vec = fptrunc ninf nnan <3 x float> %vec to <3 x half>
; CHECK: %g_scalable = fptrunc nnan ninf <vscale x 3 x float> %scalable to <vscale x 3 x half>
  %g_scalable = fptrunc ninf nnan <vscale x 3 x float> %scalable to <vscale x 3 x half>
; CHECK:  ret float %e
  ret float %e
}

; CHECK: mixed_flags
define float @mixed_flags(float %x, float %y) {
entry:
; CHECK:  %vec = load <3 x float>, ptr @vec
  %vec    = load <3 x float>, ptr @vec
; CHECK:  %select = load i1, ptr @select
  %select = load i1, ptr @select
; CHECK:  %arr = load [3 x float], ptr @arr
  %arr    = load [3 x float], ptr @arr

; CHECK:  %a = fadd nnan ninf afn float %x, %y
  %a = fadd ninf nnan afn float %x, %y
; CHECK:  %a_vec = fadd reassoc nnan <3 x float> %vec, %vec
  %a_vec = fadd reassoc nnan <3 x float> %vec, %vec
; CHECK:  %b = fsub fast float %x, %y
  %b = fsub nnan nsz fast float %x, %y
; CHECK:  %b_vec = fsub nnan <3 x float> %vec, %vec
  %b_vec = fsub nnan <3 x float> %vec, %vec
; CHECK:  %c = fmul fast float %x, %y
  %c = fmul nsz fast arcp float %x, %y
; CHECK:  %c_vec = fmul nsz <3 x float> %vec, %vec
  %c_vec = fmul nsz <3 x float> %vec, %vec
; CHECK:  %d = fdiv nnan ninf arcp float %x, %y
  %d = fdiv arcp ninf nnan float %x, %y
; CHECK:  %d_vec = fdiv fast <3 x float> %vec, %vec
  %d_vec = fdiv fast nnan arcp <3 x float> %vec, %vec
; CHECK:  %e = frem nnan nsz float %x, %y
  %e = frem nnan nsz float %x, %y
; CHECK:  %e_vec = frem nnan <3 x float> %vec, %vec
  %e_vec = frem nnan <3 x float> %vec, %vec
; CHECK:  %f = fneg nnan nsz float %x
  %f = fneg nnan nsz float %x
; CHECK:  %f_vec = fneg fast <3 x float> %vec
  %f_vec = fneg fast <3 x float> %vec
; CHECK:  ret float %f
  ret float %f
}

; CHECK: @fmf_calls(
define float @fmf_calls(float %x, float %y) {
entry:
; CHECK:  %vec = load <3 x float>, ptr @vec
  %vec    = load <3 x float>, ptr @vec
; CHECK:  %select = load i1, ptr @select
  %select = load i1, ptr @select
; CHECK:  %arr = load [3 x float], ptr @arr
  %arr    = load [3 x float], ptr @arr

; CHECK:  %a = call nnan ninf afn float @extfunc(float %x, float %y)
  %a = call ninf nnan afn float @extfunc(float %x, float %y)
; CHECK:  %a_vec = call reassoc nnan <3 x float> @extfunc_vec(<3 x float> %vec, <3 x float> %vec)
  %a_vec = call reassoc nnan <3 x float> @extfunc_vec(<3 x float> %vec, <3 x float> %vec)
; CHECK:  %b = call nnan ninf afn float (...) @var_extfunc(float %x, float %y)
  %b = call ninf nnan afn float (...) @var_extfunc(float %x, float %y)
; CHECK:  %b_vec = call reassoc nnan <3 x float> (...) @var_extfunc_vec(<3 x float> %vec, <3 x float> %vec)
  %b_vec = call reassoc nnan <3 x float> (...) @var_extfunc_vec(<3 x float> %vec, <3 x float> %vec)
; CHECK:  ret float %a
  ret float %a
}

declare float @extfunc(float, float)
declare <3 x float> @extfunc_vec(<3 x float>, <3 x float>)
declare float @var_extfunc(...)
declare <3 x float> @var_extfunc_vec(...)