xref: /llvm-project/llvm/test/CodeGen/AMDGPU/default-fp-mode.ll (revision 9e9907f1cfa424366fba58d9520f9305b537cec9)
1; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}test_default_si:
4; GCN: FloatMode: 240
5; GCN: IeeeMode: 1
6define amdgpu_kernel void @test_default_si(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #0 {
7  store float 0.0, ptr addrspace(1) %out0
8  store double 0.0, ptr addrspace(1) %out1
9  ret void
10}
11
12; GCN-LABEL: {{^}}test_default_vi:
13; GCN: FloatMode: 240
14; GCN: IeeeMode: 1
15define amdgpu_kernel void @test_default_vi(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #1 {
16  store float 0.0, ptr addrspace(1) %out0
17  store double 0.0, ptr addrspace(1) %out1
18  ret void
19}
20
21; GCN-LABEL: {{^}}test_f64_denormals:
22; GCN: FloatMode: 240
23; GCN: IeeeMode: 1
24define amdgpu_kernel void @test_f64_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #2 {
25  store float 0.0, ptr addrspace(1) %out0
26  store double 0.0, ptr addrspace(1) %out1
27  ret void
28}
29
30; GCN-LABEL: {{^}}test_f32_denormals:
31; GCNL: FloatMode: 48
32; GCN: IeeeMode: 1
33define amdgpu_kernel void @test_f32_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #3 {
34  store float 0.0, ptr addrspace(1) %out0
35  store double 0.0, ptr addrspace(1) %out1
36  ret void
37}
38
39; GCN-LABEL: {{^}}test_f32_f64_denormals:
40; GCN: FloatMode: 240
41; GCN: IeeeMode: 1
42define amdgpu_kernel void @test_f32_f64_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #4 {
43  store float 0.0, ptr addrspace(1) %out0
44  store double 0.0, ptr addrspace(1) %out1
45  ret void
46}
47
48; GCN-LABEL: {{^}}test_no_denormals
49; GCN: FloatMode: 0
50; GCN: IeeeMode: 1
51define amdgpu_kernel void @test_no_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #5 {
52  store float 0.0, ptr addrspace(1) %out0
53  store double 0.0, ptr addrspace(1) %out1
54  ret void
55}
56
57; GCN-LABEL: {{^}}test_f16_f64_denormals:
58; GCN: FloatMode: 240
59; GCN: IeeeMode: 1
60define amdgpu_kernel void @test_f16_f64_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #6 {
61  store half 0.0, ptr addrspace(1) %out0
62  store double 0.0, ptr addrspace(1) %out1
63  ret void
64}
65
66; GCN-LABEL: {{^}}test_no_f16_f64_denormals:
67; GCN: FloatMode: 48
68; GCN: IeeeMode: 1
69define amdgpu_kernel void @test_no_f16_f64_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #7 {
70  store half 0.0, ptr addrspace(1) %out0
71  store double 0.0, ptr addrspace(1) %out1
72  ret void
73}
74
75; GCN-LABEL: {{^}}test_f32_f16_f64_denormals:
76; GCN: FloatMode: 240
77; GCN: IeeeMode: 1
78define amdgpu_kernel void @test_f32_f16_f64_denormals(ptr addrspace(1) %out0, ptr addrspace(1) %out1, ptr addrspace(1) %out2) #8 {
79  store half 0.0, ptr addrspace(1) %out0
80  store float 0.0, ptr addrspace(1) %out1
81  store double 0.0, ptr addrspace(1) %out2
82  ret void
83}
84
85; GCN-LABEL: {{^}}test_just_f32_attr_flush
86; GCN: FloatMode: 192
87; GCN: IeeeMode: 1
88define amdgpu_kernel void @test_just_f32_attr_flush(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #9 {
89  store float 0.0, ptr addrspace(1) %out0
90  store double 0.0, ptr addrspace(1) %out1
91  ret void
92}
93
94; GCN-LABEL: {{^}}test_flush_all_outputs:
95; GCN: FloatMode: 80
96; GCN: IeeeMode: 1
97define amdgpu_kernel void @test_flush_all_outputs(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #10 {
98  store float 0.0, ptr addrspace(1) %out0
99  store double 0.0, ptr addrspace(1) %out1
100  ret void
101}
102
103; GCN-LABEL: {{^}}test_flush_all_inputs:
104; GCN: FloatMode: 160
105; GCN: IeeeMode: 1
106define amdgpu_kernel void @test_flush_all_inputs(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #11 {
107  store float 0.0, ptr addrspace(1) %out0
108  store double 0.0, ptr addrspace(1) %out1
109  ret void
110}
111
112; GCN-LABEL: {{^}}test_flush_f32_inputs:
113; GCN: FloatMode: 224
114; GCN: IeeeMode: 1
115define amdgpu_kernel void @test_flush_f32_inputs(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #12 {
116  store float 0.0, ptr addrspace(1) %out0
117  store double 0.0, ptr addrspace(1) %out1
118  ret void
119}
120
121; GCN-LABEL: {{^}}test_flush_f32_outputs:
122; GCN: FloatMode: 208
123; GCN: IeeeMode: 1
124define amdgpu_kernel void @test_flush_f32_outputs(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #13 {
125  store float 0.0, ptr addrspace(1) %out0
126  store double 0.0, ptr addrspace(1) %out1
127  ret void
128}
129
130; GCN-LABEL: {{^}}test_flush_f64_inputs:
131; GCN: FloatMode: 176
132; GCN: IeeeMode: 1
133define amdgpu_kernel void @test_flush_f64_inputs(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #14 {
134  store float 0.0, ptr addrspace(1) %out0
135  store double 0.0, ptr addrspace(1) %out1
136  ret void
137}
138
139; GCN-LABEL: {{^}}test_flush_f64_outputs:
140; GCN: FloatMode: 112
141; GCN: IeeeMode: 1
142define amdgpu_kernel void @test_flush_f64_outputs(ptr addrspace(1) %out0, ptr addrspace(1) %out1) #15 {
143  store float 0.0, ptr addrspace(1) %out0
144  store double 0.0, ptr addrspace(1) %out1
145  ret void
146}
147
148; GCN-LABEL: {{^}}kill_gs_const:
149; GCN: FloatMode: 240
150; GCN: IeeeMode: 0
151define amdgpu_gs void @kill_gs_const() {
152main_body:
153  %cmp0 = icmp ule i32 0, 3
154  call void @llvm.amdgcn.kill(i1 %cmp0)
155  %cmp1 = icmp ule i32 3, 0
156  call void @llvm.amdgcn.kill(i1 %cmp1)
157  ret void
158}
159
160; GCN-LABEL: {{^}}kill_vcc_implicit_def:
161; GCN: FloatMode: 240
162; GCN: IeeeMode: 0
163define amdgpu_ps float @kill_vcc_implicit_def(ptr addrspace(4) inreg, ptr addrspace(4) inreg, ptr addrspace(4) inreg, ptr addrspace(4) inreg, float inreg, i32 inreg, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, float, i32, float, float) {
164entry:
165  %tmp0 = fcmp olt float %13, 0.0
166  call void @llvm.amdgcn.kill(i1 %tmp0)
167  %tmp1 = select i1 %tmp0, float 1.0, float 0.0
168  ret float %tmp1
169}
170
171declare void @llvm.amdgcn.kill(i1)
172
173attributes #0 = { nounwind "target-cpu"="tahiti" }
174attributes #1 = { nounwind "target-cpu"="fiji" }
175attributes #2 = { nounwind "denormal-fp-math"="ieee,ieee" }
176attributes #3 = { nounwind "denormal-fp-math-f32"="ieee,ieee" }
177attributes #4 = { nounwind "denormal-fp-math"="ieee,ieee" }
178attributes #5 = { nounwind "denormal-fp-math"="preserve-sign,preserve-sign" }
179attributes #6 = { nounwind "denormal-fp-math"="ieee,ieee" }
180attributes #7 = { nounwind "denormal-fp-math-f32"="ieee,ieee" "denormal-fp-math"="preserve-sign,preserve-sign" }
181attributes #8 = { nounwind "denormal-fp-math"="ieee,ieee" }
182attributes #9 = { nounwind "denormal-fp-math-f32"="preserve-sign,preserve-sign" }
183attributes #10 = { nounwind "denormal-fp-math"="preserve-sign,ieee" }
184attributes #11 = { nounwind "denormal-fp-math"="ieee,preserve-sign" }
185attributes #12 = { nounwind "denormal-fp-math-f32"="ieee,preserve-sign" "denormal-fp-math"="ieee,ieee" }
186attributes #13 = { nounwind "denormal-fp-math-f32"="preserve-sign,ieee" "denormal-fp-math"="ieee,ieee" }
187attributes #14 = { nounwind "denormal-fp-math"="ieee,preserve-sign" "denormal-fp-math-f32"="ieee,ieee" }
188attributes #15 = { nounwind "denormal-fp-math"="preserve-sign,ieee" "denormal-fp-math-f32"="ieee,ieee" }
189