aboutsummaryrefslogtreecommitdiff
path: root/test/Assembler/fast-math-flags.ll
blob: 3a116c507f48c1a792856818a1216737939bbbb6 (plain)
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
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: opt -S < %s | FileCheck %s

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

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

; 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:  ret  float %e
  ret  float %e
}

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

; 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:  ret float %e
  ret float %e
}

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

; 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:  ret  float %e
  ret  float %e
}

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

; 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 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:  ret  float %e
  ret  float %e
}