source: icGREP/icgrep-devel/llvm-3.6.1.src/test/CodeGen/R600/fmaxnum.ll @ 4664

Last change on this file since 4664 was 4664, checked in by cameron, 4 years ago

Upgrade LLVM to 3.6.1

File size: 6.7 KB
Line 
1; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3
4declare float @llvm.maxnum.f32(float, float) #0
5declare <2 x float> @llvm.maxnum.v2f32(<2 x float>, <2 x float>) #0
6declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>) #0
7declare <8 x float> @llvm.maxnum.v8f32(<8 x float>, <8 x float>) #0
8declare <16 x float> @llvm.maxnum.v16f32(<16 x float>, <16 x float>) #0
9
10declare double @llvm.maxnum.f64(double, double)
11
12; FUNC-LABEL: @test_fmax_f32
13; SI: v_max_f32_e32
14define void @test_fmax_f32(float addrspace(1)* %out, float %a, float %b) nounwind {
15  %val = call float @llvm.maxnum.f32(float %a, float %b) #0
16  store float %val, float addrspace(1)* %out, align 4
17  ret void
18}
19
20; FUNC-LABEL: @test_fmax_v2f32
21; SI: v_max_f32_e32
22; SI: v_max_f32_e32
23define void @test_fmax_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %a, <2 x float> %b) nounwind {
24  %val = call <2 x float> @llvm.maxnum.v2f32(<2 x float> %a, <2 x float> %b) #0
25  store <2 x float> %val, <2 x float> addrspace(1)* %out, align 8
26  ret void
27}
28
29; FUNC-LABEL: @test_fmax_v4f32
30; SI: v_max_f32_e32
31; SI: v_max_f32_e32
32; SI: v_max_f32_e32
33; SI: v_max_f32_e32
34define void @test_fmax_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %a, <4 x float> %b) nounwind {
35  %val = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %a, <4 x float> %b) #0
36  store <4 x float> %val, <4 x float> addrspace(1)* %out, align 16
37  ret void
38}
39
40; FUNC-LABEL: @test_fmax_v8f32
41; SI: v_max_f32_e32
42; SI: v_max_f32_e32
43; SI: v_max_f32_e32
44; SI: v_max_f32_e32
45; SI: v_max_f32_e32
46; SI: v_max_f32_e32
47; SI: v_max_f32_e32
48; SI: v_max_f32_e32
49define void @test_fmax_v8f32(<8 x float> addrspace(1)* %out, <8 x float> %a, <8 x float> %b) nounwind {
50  %val = call <8 x float> @llvm.maxnum.v8f32(<8 x float> %a, <8 x float> %b) #0
51  store <8 x float> %val, <8 x float> addrspace(1)* %out, align 32
52  ret void
53}
54
55; FUNC-LABEL: @test_fmax_v16f32
56; SI: v_max_f32_e32
57; SI: v_max_f32_e32
58; SI: v_max_f32_e32
59; SI: v_max_f32_e32
60; SI: v_max_f32_e32
61; SI: v_max_f32_e32
62; SI: v_max_f32_e32
63; SI: v_max_f32_e32
64; SI: v_max_f32_e32
65; SI: v_max_f32_e32
66; SI: v_max_f32_e32
67; SI: v_max_f32_e32
68; SI: v_max_f32_e32
69; SI: v_max_f32_e32
70; SI: v_max_f32_e32
71; SI: v_max_f32_e32
72define void @test_fmax_v16f32(<16 x float> addrspace(1)* %out, <16 x float> %a, <16 x float> %b) nounwind {
73  %val = call <16 x float> @llvm.maxnum.v16f32(<16 x float> %a, <16 x float> %b) #0
74  store <16 x float> %val, <16 x float> addrspace(1)* %out, align 64
75  ret void
76}
77
78; FUNC-LABEL: @constant_fold_fmax_f32
79; SI-NOT: v_max_f32_e32
80; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 2.0
81; SI: buffer_store_dword [[REG]]
82define void @constant_fold_fmax_f32(float addrspace(1)* %out) nounwind {
83  %val = call float @llvm.maxnum.f32(float 1.0, float 2.0) #0
84  store float %val, float addrspace(1)* %out, align 4
85  ret void
86}
87
88; FUNC-LABEL: @constant_fold_fmax_f32_nan_nan
89; SI-NOT: v_max_f32_e32
90; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0x7fc00000
91; SI: buffer_store_dword [[REG]]
92define void @constant_fold_fmax_f32_nan_nan(float addrspace(1)* %out) nounwind {
93  %val = call float @llvm.maxnum.f32(float 0x7FF8000000000000, float 0x7FF8000000000000) #0
94  store float %val, float addrspace(1)* %out, align 4
95  ret void
96}
97
98; FUNC-LABEL: @constant_fold_fmax_f32_val_nan
99; SI-NOT: v_max_f32_e32
100; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 1.0
101; SI: buffer_store_dword [[REG]]
102define void @constant_fold_fmax_f32_val_nan(float addrspace(1)* %out) nounwind {
103  %val = call float @llvm.maxnum.f32(float 1.0, float 0x7FF8000000000000) #0
104  store float %val, float addrspace(1)* %out, align 4
105  ret void
106}
107
108; FUNC-LABEL: @constant_fold_fmax_f32_nan_val
109; SI-NOT: v_max_f32_e32
110; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 1.0
111; SI: buffer_store_dword [[REG]]
112define void @constant_fold_fmax_f32_nan_val(float addrspace(1)* %out) nounwind {
113  %val = call float @llvm.maxnum.f32(float 0x7FF8000000000000, float 1.0) #0
114  store float %val, float addrspace(1)* %out, align 4
115  ret void
116}
117
118; FUNC-LABEL: @constant_fold_fmax_f32_p0_p0
119; SI-NOT: v_max_f32_e32
120; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0
121; SI: buffer_store_dword [[REG]]
122define void @constant_fold_fmax_f32_p0_p0(float addrspace(1)* %out) nounwind {
123  %val = call float @llvm.maxnum.f32(float 0.0, float 0.0) #0
124  store float %val, float addrspace(1)* %out, align 4
125  ret void
126}
127
128; FUNC-LABEL: @constant_fold_fmax_f32_p0_n0
129; SI-NOT: v_max_f32_e32
130; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0
131; SI: buffer_store_dword [[REG]]
132define void @constant_fold_fmax_f32_p0_n0(float addrspace(1)* %out) nounwind {
133  %val = call float @llvm.maxnum.f32(float 0.0, float -0.0) #0
134  store float %val, float addrspace(1)* %out, align 4
135  ret void
136}
137
138; FUNC-LABEL: @constant_fold_fmax_f32_n0_p0
139; SI-NOT: v_max_f32_e32
140; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0x80000000
141; SI: buffer_store_dword [[REG]]
142define void @constant_fold_fmax_f32_n0_p0(float addrspace(1)* %out) nounwind {
143  %val = call float @llvm.maxnum.f32(float -0.0, float 0.0) #0
144  store float %val, float addrspace(1)* %out, align 4
145  ret void
146}
147
148; FUNC-LABEL: @constant_fold_fmax_f32_n0_n0
149; SI-NOT: v_max_f32_e32
150; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0x80000000
151; SI: buffer_store_dword [[REG]]
152define void @constant_fold_fmax_f32_n0_n0(float addrspace(1)* %out) nounwind {
153  %val = call float @llvm.maxnum.f32(float -0.0, float -0.0) #0
154  store float %val, float addrspace(1)* %out, align 4
155  ret void
156}
157
158; FUNC-LABEL: @fmax_var_immediate_f32
159; SI: v_max_f32_e64 {{v[0-9]+}}, 2.0, {{s[0-9]+}}
160define void @fmax_var_immediate_f32(float addrspace(1)* %out, float %a) nounwind {
161  %val = call float @llvm.maxnum.f32(float %a, float 2.0) #0
162  store float %val, float addrspace(1)* %out, align 4
163  ret void
164}
165
166; FUNC-LABEL: @fmax_immediate_var_f32
167; SI: v_max_f32_e64 {{v[0-9]+}}, 2.0, {{s[0-9]+}}
168define void @fmax_immediate_var_f32(float addrspace(1)* %out, float %a) nounwind {
169  %val = call float @llvm.maxnum.f32(float 2.0, float %a) #0
170  store float %val, float addrspace(1)* %out, align 4
171  ret void
172}
173
174; FUNC-LABEL: @fmax_var_literal_f32
175; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0x42c60000
176; SI: v_max_f32_e32 {{v[0-9]+}}, {{s[0-9]+}}, [[REG]]
177define void @fmax_var_literal_f32(float addrspace(1)* %out, float %a) nounwind {
178  %val = call float @llvm.maxnum.f32(float %a, float 99.0) #0
179  store float %val, float addrspace(1)* %out, align 4
180  ret void
181}
182
183; FUNC-LABEL: @fmax_literal_var_f32
184; SI: v_mov_b32_e32 [[REG:v[0-9]+]], 0x42c60000
185; SI: v_max_f32_e32 {{v[0-9]+}}, {{s[0-9]+}}, [[REG]]
186define void @fmax_literal_var_f32(float addrspace(1)* %out, float %a) nounwind {
187  %val = call float @llvm.maxnum.f32(float 99.0, float %a) #0
188  store float %val, float addrspace(1)* %out, align 4
189  ret void
190}
191
192attributes #0 = { nounwind readnone }
Note: See TracBrowser for help on using the repository browser.