1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
3 ; These tests check that floating point comparisons which are used by select
4 ; to store integer true (-1) and false (0) values are lowered to one of the
5 ; SET*DX10 instructions.
7 ; CHECK: {{^}}fcmp_une_select_fptosi:
9 ; CHECK-NEXT: SETNE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
10 ; CHECK-NEXT: 1084227584(5.000000e+00)
11 define amdgpu_kernel void @fcmp_une_select_fptosi(i32 addrspace(1)* %out, float %in) {
13 %0 = fcmp une float %in, 5.0
14 %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
15 %2 = fsub float -0.000000e+00, %1
16 %3 = fptosi float %2 to i32
17 store i32 %3, i32 addrspace(1)* %out
21 ; CHECK: {{^}}fcmp_une_select_i32:
23 ; CHECK-NEXT: SETNE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
24 ; CHECK-NEXT: 1084227584(5.000000e+00)
25 define amdgpu_kernel void @fcmp_une_select_i32(i32 addrspace(1)* %out, float %in) {
27 %0 = fcmp une float %in, 5.0
28 %1 = select i1 %0, i32 -1, i32 0
29 store i32 %1, i32 addrspace(1)* %out
33 ; CHECK: {{^}}fcmp_oeq_select_fptosi:
35 ; CHECK-NEXT: SETE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
36 ; CHECK-NEXT: 1084227584(5.000000e+00)
37 define amdgpu_kernel void @fcmp_oeq_select_fptosi(i32 addrspace(1)* %out, float %in) {
39 %0 = fcmp oeq float %in, 5.0
40 %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
41 %2 = fsub float -0.000000e+00, %1
42 %3 = fptosi float %2 to i32
43 store i32 %3, i32 addrspace(1)* %out
47 ; CHECK: {{^}}fcmp_oeq_select_i32:
49 ; CHECK-NEXT: SETE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
50 ; CHECK-NEXT: 1084227584(5.000000e+00)
51 define amdgpu_kernel void @fcmp_oeq_select_i32(i32 addrspace(1)* %out, float %in) {
53 %0 = fcmp oeq float %in, 5.0
54 %1 = select i1 %0, i32 -1, i32 0
55 store i32 %1, i32 addrspace(1)* %out
59 ; CHECK: {{^}}fcmp_ogt_select_fptosi:
61 ; CHECK-NEXT: SETGT_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
62 ; CHECK-NEXT: 1084227584(5.000000e+00)
63 define amdgpu_kernel void @fcmp_ogt_select_fptosi(i32 addrspace(1)* %out, float %in) {
65 %0 = fcmp ogt float %in, 5.0
66 %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
67 %2 = fsub float -0.000000e+00, %1
68 %3 = fptosi float %2 to i32
69 store i32 %3, i32 addrspace(1)* %out
73 ; CHECK: {{^}}fcmp_ogt_select_i32:
75 ; CHECK-NEXT: SETGT_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
76 ; CHECK-NEXT: 1084227584(5.000000e+00)
77 define amdgpu_kernel void @fcmp_ogt_select_i32(i32 addrspace(1)* %out, float %in) {
79 %0 = fcmp ogt float %in, 5.0
80 %1 = select i1 %0, i32 -1, i32 0
81 store i32 %1, i32 addrspace(1)* %out
85 ; CHECK: {{^}}fcmp_oge_select_fptosi:
87 ; CHECK-NEXT: SETGE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
88 ; CHECK-NEXT: 1084227584(5.000000e+00)
89 define amdgpu_kernel void @fcmp_oge_select_fptosi(i32 addrspace(1)* %out, float %in) {
91 %0 = fcmp oge float %in, 5.0
92 %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
93 %2 = fsub float -0.000000e+00, %1
94 %3 = fptosi float %2 to i32
95 store i32 %3, i32 addrspace(1)* %out
99 ; CHECK: {{^}}fcmp_oge_select_i32:
101 ; CHECK-NEXT: SETGE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, literal.y,
102 ; CHECK-NEXT: 1084227584(5.000000e+00)
103 define amdgpu_kernel void @fcmp_oge_select_i32(i32 addrspace(1)* %out, float %in) {
105 %0 = fcmp oge float %in, 5.0
106 %1 = select i1 %0, i32 -1, i32 0
107 store i32 %1, i32 addrspace(1)* %out
111 ; CHECK: {{^}}fcmp_ole_select_fptosi:
113 ; CHECK-NEXT: SETGE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, literal.y, KC0[2].Z,
114 ; CHECK-NEXT: 1084227584(5.000000e+00)
115 define amdgpu_kernel void @fcmp_ole_select_fptosi(i32 addrspace(1)* %out, float %in) {
117 %0 = fcmp ole float %in, 5.0
118 %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
119 %2 = fsub float -0.000000e+00, %1
120 %3 = fptosi float %2 to i32
121 store i32 %3, i32 addrspace(1)* %out
125 ; CHECK: {{^}}fcmp_ole_select_i32:
127 ; CHECK-NEXT: SETGE_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, literal.y, KC0[2].Z,
128 ; CHECK-NEXT: 1084227584(5.000000e+00)
129 define amdgpu_kernel void @fcmp_ole_select_i32(i32 addrspace(1)* %out, float %in) {
131 %0 = fcmp ole float %in, 5.0
132 %1 = select i1 %0, i32 -1, i32 0
133 store i32 %1, i32 addrspace(1)* %out
137 ; CHECK: {{^}}fcmp_olt_select_fptosi:
139 ; CHECK-NEXT: SETGT_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, literal.y, KC0[2].Z,
140 ; CHECK-NEXT: 1084227584(5.000000e+00)
141 define amdgpu_kernel void @fcmp_olt_select_fptosi(i32 addrspace(1)* %out, float %in) {
143 %0 = fcmp olt float %in, 5.0
144 %1 = select i1 %0, float 1.000000e+00, float 0.000000e+00
145 %2 = fsub float -0.000000e+00, %1
146 %3 = fptosi float %2 to i32
147 store i32 %3, i32 addrspace(1)* %out
151 ; CHECK: {{^}}fcmp_olt_select_i32:
153 ; CHECK-NEXT: SETGT_DX10 * {{\** *}}T{{[0-9]+\.[XYZW]}}, literal.y, KC0[2].Z,
154 ; CHECK-NEXT: 1084227584(5.000000e+00)
155 define amdgpu_kernel void @fcmp_olt_select_i32(i32 addrspace(1)* %out, float %in) {
157 %0 = fcmp olt float %in, 5.0
158 %1 = select i1 %0, i32 -1, i32 0
159 store i32 %1, i32 addrspace(1)* %out