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 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
5 ; FUNC-LABEL: {{^}}sdiv24_i8:
15 define void @sdiv24_i8(i8 addrspace(1)* %out, i8 addrspace(1)* %in) {
16 %den_ptr = getelementptr i8, i8 addrspace(1)* %in, i8 1
17 %num = load i8, i8 addrspace(1) * %in
18 %den = load i8, i8 addrspace(1) * %den_ptr
19 %result = sdiv i8 %num, %den
20 store i8 %result, i8 addrspace(1)* %out
24 ; FUNC-LABEL: {{^}}sdiv24_i16:
34 define void @sdiv24_i16(i16 addrspace(1)* %out, i16 addrspace(1)* %in) {
35 %den_ptr = getelementptr i16, i16 addrspace(1)* %in, i16 1
36 %num = load i16, i16 addrspace(1) * %in, align 2
37 %den = load i16, i16 addrspace(1) * %den_ptr, align 2
38 %result = sdiv i16 %num, %den
39 store i16 %result, i16 addrspace(1)* %out, align 2
43 ; FUNC-LABEL: {{^}}sdiv24_i32:
53 define void @sdiv24_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
54 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
55 %num = load i32, i32 addrspace(1) * %in, align 4
56 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
57 %num.i24.0 = shl i32 %num, 8
58 %den.i24.0 = shl i32 %den, 8
59 %num.i24 = ashr i32 %num.i24.0, 8
60 %den.i24 = ashr i32 %den.i24.0, 8
61 %result = sdiv i32 %num.i24, %den.i24
62 store i32 %result, i32 addrspace(1)* %out, align 4
66 ; FUNC-LABEL: {{^}}sdiv25_i32:
67 ; SI-NOT: v_cvt_f32_i32
72 define void @sdiv25_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
73 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
74 %num = load i32, i32 addrspace(1) * %in, align 4
75 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
76 %num.i24.0 = shl i32 %num, 7
77 %den.i24.0 = shl i32 %den, 7
78 %num.i24 = ashr i32 %num.i24.0, 7
79 %den.i24 = ashr i32 %den.i24.0, 7
80 %result = sdiv i32 %num.i24, %den.i24
81 store i32 %result, i32 addrspace(1)* %out, align 4
85 ; FUNC-LABEL: {{^}}test_no_sdiv24_i32_1:
86 ; SI-NOT: v_cvt_f32_i32
91 define void @test_no_sdiv24_i32_1(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
92 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
93 %num = load i32, i32 addrspace(1) * %in, align 4
94 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
95 %num.i24.0 = shl i32 %num, 8
96 %den.i24.0 = shl i32 %den, 7
97 %num.i24 = ashr i32 %num.i24.0, 8
98 %den.i24 = ashr i32 %den.i24.0, 7
99 %result = sdiv i32 %num.i24, %den.i24
100 store i32 %result, i32 addrspace(1)* %out, align 4
104 ; FUNC-LABEL: {{^}}test_no_sdiv24_i32_2:
105 ; SI-NOT: v_cvt_f32_i32
110 define void @test_no_sdiv24_i32_2(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
111 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
112 %num = load i32, i32 addrspace(1) * %in, align 4
113 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
114 %num.i24.0 = shl i32 %num, 7
115 %den.i24.0 = shl i32 %den, 8
116 %num.i24 = ashr i32 %num.i24.0, 7
117 %den.i24 = ashr i32 %den.i24.0, 8
118 %result = sdiv i32 %num.i24, %den.i24
119 store i32 %result, i32 addrspace(1)* %out, align 4
123 ; FUNC-LABEL: {{^}}srem24_i8:
133 define void @srem24_i8(i8 addrspace(1)* %out, i8 addrspace(1)* %in) {
134 %den_ptr = getelementptr i8, i8 addrspace(1)* %in, i8 1
135 %num = load i8, i8 addrspace(1) * %in
136 %den = load i8, i8 addrspace(1) * %den_ptr
137 %result = srem i8 %num, %den
138 store i8 %result, i8 addrspace(1)* %out
142 ; FUNC-LABEL: {{^}}srem24_i16:
152 define void @srem24_i16(i16 addrspace(1)* %out, i16 addrspace(1)* %in) {
153 %den_ptr = getelementptr i16, i16 addrspace(1)* %in, i16 1
154 %num = load i16, i16 addrspace(1) * %in, align 2
155 %den = load i16, i16 addrspace(1) * %den_ptr, align 2
156 %result = srem i16 %num, %den
157 store i16 %result, i16 addrspace(1)* %out, align 2
161 ; FUNC-LABEL: {{^}}srem24_i32:
171 define void @srem24_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
172 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
173 %num = load i32, i32 addrspace(1) * %in, align 4
174 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
175 %num.i24.0 = shl i32 %num, 8
176 %den.i24.0 = shl i32 %den, 8
177 %num.i24 = ashr i32 %num.i24.0, 8
178 %den.i24 = ashr i32 %den.i24.0, 8
179 %result = srem i32 %num.i24, %den.i24
180 store i32 %result, i32 addrspace(1)* %out, align 4
184 ; FUNC-LABEL: {{^}}srem25_i32:
185 ; SI-NOT: v_cvt_f32_i32
190 define void @srem25_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
191 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
192 %num = load i32, i32 addrspace(1) * %in, align 4
193 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
194 %num.i24.0 = shl i32 %num, 7
195 %den.i24.0 = shl i32 %den, 7
196 %num.i24 = ashr i32 %num.i24.0, 7
197 %den.i24 = ashr i32 %den.i24.0, 7
198 %result = srem i32 %num.i24, %den.i24
199 store i32 %result, i32 addrspace(1)* %out, align 4
203 ; FUNC-LABEL: {{^}}test_no_srem24_i32_1:
204 ; SI-NOT: v_cvt_f32_i32
209 define void @test_no_srem24_i32_1(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
210 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
211 %num = load i32, i32 addrspace(1) * %in, align 4
212 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
213 %num.i24.0 = shl i32 %num, 8
214 %den.i24.0 = shl i32 %den, 7
215 %num.i24 = ashr i32 %num.i24.0, 8
216 %den.i24 = ashr i32 %den.i24.0, 7
217 %result = srem i32 %num.i24, %den.i24
218 store i32 %result, i32 addrspace(1)* %out, align 4
222 ; FUNC-LABEL: {{^}}test_no_srem24_i32_2:
223 ; SI-NOT: v_cvt_f32_i32
228 define void @test_no_srem24_i32_2(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
229 %den_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
230 %num = load i32, i32 addrspace(1) * %in, align 4
231 %den = load i32, i32 addrspace(1) * %den_ptr, align 4
232 %num.i24.0 = shl i32 %num, 7
233 %den.i24.0 = shl i32 %den, 8
234 %num.i24 = ashr i32 %num.i24.0, 7
235 %den.i24 = ashr i32 %den.i24.0, 8
236 %result = srem i32 %num.i24, %den.i24
237 store i32 %result, i32 addrspace(1)* %out, align 4