Recommit r310809 with a fix for the spill problem
[llvm-core.git] / test / CodeGen / AMDGPU / default-fp-mode.ll
blobad9111a28654ed921bb74972fc555ab05249d4d4
1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: {{^}}test_default_si:
4 ; GCN: FloatMode: 192
5 ; GCN: IeeeMode: 1
6 define 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
12 ; GCN-LABEL: {{^}}test_default_vi:
13 ; GCN: FloatMode: 192
14 ; GCN: IeeeMode: 1
15 define 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
21 ; GCN-LABEL: {{^}}test_f64_denormals:
22 ; GCN: FloatMode: 192
23 ; GCN: IeeeMode: 1
24 define 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
30 ; GCN-LABEL: {{^}}test_f32_denormals:
31 ; GCNL: FloatMode: 48
32 ; GCN: IeeeMode: 1
33 define 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
39 ; GCN-LABEL: {{^}}test_f32_f64_denormals:
40 ; GCN: FloatMode: 240
41 ; GCN: IeeeMode: 1
42 define 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
48 ; GCN-LABEL: {{^}}test_no_denormals
49 ; GCN: FloatMode: 0
50 ; GCN: IeeeMode: 1
51 define 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
57 ; GCN-LABEL: {{^}}test_f16_f64_denormals:
58 ; GCN: FloatMode: 192
59 ; GCN: IeeeMode: 1
60 define 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
66 ; GCN-LABEL: {{^}}test_no_f16_f64_denormals:
67 ; GCN: FloatMode: 0
68 ; GCN: IeeeMode: 1
69 define 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
75 ; GCN-LABEL: {{^}}test_f32_f16_f64_denormals:
76 ; GCN: FloatMode: 240
77 ; GCN: IeeeMode: 1
78 define 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
85 ; GCN-LABEL: {{^}}kill_gs_const:
86 ; GCN: IeeeMode: 0
87 define amdgpu_gs void @kill_gs_const() {
88 main_body:
89   %0 = icmp ule i32 0, 3
90   %1 = select i1 %0, float 1.000000e+00, float -1.000000e+00
91   call void @llvm.AMDGPU.kill(float %1)
92   %2 = icmp ule i32 3, 0
93   %3 = select i1 %2, float 1.000000e+00, float -1.000000e+00
94   call void @llvm.AMDGPU.kill(float %3)
95   ret void
98 ; GCN-LABEL: {{^}}kill_vcc_implicit_def:
99 ; GCN: IeeeMode: 0
100 define amdgpu_ps float @kill_vcc_implicit_def([6 x <16 x i8>] addrspace(2)* byval, [17 x <16 x i8>] addrspace(2)* byval, [17 x <4 x i32>] addrspace(2)* byval, [34 x <8 x i32>] addrspace(2)* byval, 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) {
101 entry:
102   %tmp0 = fcmp olt float %13, 0.0
103   call void @llvm.AMDGPU.kill(float %14)
104   %tmp1 = select i1 %tmp0, float 1.0, float 0.0
105   ret float %tmp1
108 declare void @llvm.AMDGPU.kill(float)
110 attributes #0 = { nounwind "target-cpu"="tahiti" }
111 attributes #1 = { nounwind "target-cpu"="fiji" }
112 attributes #2 = { nounwind "target-features"="+fp64-denormals" }
113 attributes #3 = { nounwind "target-features"="+fp32-denormals" }
114 attributes #4 = { nounwind "target-features"="+fp32-denormals,+fp64-denormals" }
115 attributes #5 = { nounwind "target-features"="-fp32-denormals,-fp64-fp16-denormals" }
116 attributes #6 = { nounwind "target-features"="+fp64-fp16-denormals" }
117 attributes #7 = { nounwind "target-features"="-fp64-fp16-denormals" }
118 attributes #8 = { nounwind "target-features"="+fp32-denormals,+fp64-fp16-denormals" }