1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}test_default_si:
4; GCN: FloatMode: 192
5; GCN: IeeeMode: 1
6define amdgpu_kernel void @test_default_si(float addrspace(1)* %out0, double addrspace(1)* %out1) #0 {
7  store float 0.0, float addrspace(1)* %out0
8  store double 0.0, double addrspace(1)* %out1
9  ret void
10}
11
12; GCN-LABEL: {{^}}test_default_vi:
13; GCN: FloatMode: 192
14; GCN: IeeeMode: 1
15define amdgpu_kernel void @test_default_vi(float addrspace(1)* %out0, double addrspace(1)* %out1) #1 {
16  store float 0.0, float addrspace(1)* %out0
17  store double 0.0, double addrspace(1)* %out1
18  ret void
19}
20
21; GCN-LABEL: {{^}}test_f64_denormals:
22; GCN: FloatMode: 192
23; GCN: IeeeMode: 1
24define amdgpu_kernel void @test_f64_denormals(float addrspace(1)* %out0, double addrspace(1)* %out1) #2 {
25  store float 0.0, float addrspace(1)* %out0
26  store double 0.0, double 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(float addrspace(1)* %out0, double addrspace(1)* %out1) #3 {
34  store float 0.0, float addrspace(1)* %out0
35  store double 0.0, double 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(float addrspace(1)* %out0, double addrspace(1)* %out1) #4 {
43  store float 0.0, float addrspace(1)* %out0
44  store double 0.0, double 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(float addrspace(1)* %out0, double addrspace(1)* %out1) #5 {
52  store float 0.0, float addrspace(1)* %out0
53  store double 0.0, double addrspace(1)* %out1
54  ret void
55}
56
57; GCN-LABEL: {{^}}test_f16_f64_denormals:
58; GCN: FloatMode: 192
59; GCN: IeeeMode: 1
60define amdgpu_kernel void @test_f16_f64_denormals(half addrspace(1)* %out0, double addrspace(1)* %out1) #6 {
61  store half 0.0, half addrspace(1)* %out0
62  store double 0.0, double addrspace(1)* %out1
63  ret void
64}
65
66; GCN-LABEL: {{^}}test_no_f16_f64_denormals:
67; GCN: FloatMode: 0
68; GCN: IeeeMode: 1
69define amdgpu_kernel void @test_no_f16_f64_denormals(half addrspace(1)* %out0, double addrspace(1)* %out1) #7 {
70  store half 0.0, half addrspace(1)* %out0
71  store double 0.0, double 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(half addrspace(1)* %out0, float addrspace(1)* %out1, double addrspace(1)* %out2) #8 {
79  store half 0.0, half addrspace(1)* %out0
80  store float 0.0, float addrspace(1)* %out1
81  store double 0.0, double addrspace(1)* %out2
82  ret void
83}
84
85; GCN-LABEL: {{^}}kill_gs_const:
86; GCN: IeeeMode: 0
87define amdgpu_gs void @kill_gs_const() {
88main_body:
89  %cmp0 = icmp ule i32 0, 3
90  call void @llvm.amdgcn.kill(i1 %cmp0)
91  %cmp1 = icmp ule i32 3, 0
92  call void @llvm.amdgcn.kill(i1 %cmp1)
93  ret void
94}
95
96; GCN-LABEL: {{^}}kill_vcc_implicit_def:
97; GCN: IeeeMode: 0
98define amdgpu_ps float @kill_vcc_implicit_def([6 x <16 x i8>] addrspace(4)* inreg, [17 x <16 x i8>] addrspace(4)* inreg, [17 x <4 x i32>] addrspace(4)* inreg, [34 x <8 x i32>] 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) {
99entry:
100  %tmp0 = fcmp olt float %13, 0.0
101  call void @llvm.amdgcn.kill(i1 %tmp0)
102  %tmp1 = select i1 %tmp0, float 1.0, float 0.0
103  ret float %tmp1
104}
105
106declare void @llvm.amdgcn.kill(i1)
107
108attributes #0 = { nounwind "target-cpu"="tahiti" }
109attributes #1 = { nounwind "target-cpu"="fiji" }
110attributes #2 = { nounwind "target-features"="+fp64-denormals" }
111attributes #3 = { nounwind "target-features"="+fp32-denormals" }
112attributes #4 = { nounwind "target-features"="+fp32-denormals,+fp64-denormals" }
113attributes #5 = { nounwind "target-features"="-fp32-denormals,-fp64-fp16-denormals" }
114attributes #6 = { nounwind "target-features"="+fp64-fp16-denormals" }
115attributes #7 = { nounwind "target-features"="-fp64-fp16-denormals" }
116attributes #8 = { nounwind "target-features"="+fp32-denormals,+fp64-fp16-denormals" }
117