1 ;RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck --check-prefix=SI --check-prefix=GCN --check-prefix=FUNC %s
2 ;RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefix=VI --check-prefix=GCN --check-prefix=FUNC %s
3 ;RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefix=VI --check-prefix=GCN --check-prefix=FUNC %s
4 ;RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck --check-prefix=EG --check-prefix=FUNC %s
6 ;FUNC-LABEL: {{^}}test_udiv:
40 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0x4f800000,
42 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x5f7ffffc
43 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x2f800000
45 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0xcf800000
47 define amdgpu_kernel void @test_udiv(i64 addrspace(1)* %out, i64 %x, i64 %y) {
48 %result = udiv i64 %x, %y
49 store i64 %result, i64 addrspace(1)* %out
53 ;FUNC-LABEL: {{^}}test_urem:
85 ;EG: AND_INT {{.*}}, 1,
87 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0x4f800000,
89 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x5f7ffffc
90 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x2f800000
92 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0xcf800000
94 define amdgpu_kernel void @test_urem(i64 addrspace(1)* %out, i64 %x, i64 %y) {
95 %result = urem i64 %x, %y
96 store i64 %result, i64 addrspace(1)* %out
100 ;FUNC-LABEL: {{^}}test_udiv3264:
107 ;VI-NOT: v_lshrrev_b64
109 define amdgpu_kernel void @test_udiv3264(i64 addrspace(1)* %out, i64 %x, i64 %y) {
112 %result = udiv i64 %1, %2
113 store i64 %result, i64 addrspace(1)* %out
117 ;FUNC-LABEL: {{^}}test_urem3264:
124 ;VI-NOT: v_lshrrev_b64
126 define amdgpu_kernel void @test_urem3264(i64 addrspace(1)* %out, i64 %x, i64 %y) {
129 %result = urem i64 %1, %2
130 store i64 %result, i64 addrspace(1)* %out
134 ;FUNC-LABEL: {{^}}test_udiv2364:
142 ;VI-NOT: v_lshrrev_b64
145 define amdgpu_kernel void @test_udiv2364(i64 addrspace(1)* %out, i64 %x, i64 %y) {
148 %result = udiv i64 %1, %2
149 store i64 %result, i64 addrspace(1)* %out
153 ;FUNC-LABEL: {{^}}test_urem2364:
161 ;VI-NOT: v_lshrrev_b64
164 define amdgpu_kernel void @test_urem2364(i64 addrspace(1)* %out, i64 %x, i64 %y) {
167 %result = urem i64 %1, %2
168 store i64 %result, i64 addrspace(1)* %out
172 ;FUNC-LABEL: {{^}}test_udiv_k:
173 ;GCN: v_mul{{.+}} v{{[0-9]+}}, v{{[0-9]+}}, 24
174 ;GCN: v_mul{{.+}} v{{[0-9]+}}, v{{[0-9]+}}, 24
175 ;GCN: v_mul{{.+}} v{{[0-9]+}}, v{{[0-9]+}}, 24
180 define amdgpu_kernel void @test_udiv_k(i64 addrspace(1)* %out, i64 %x) {
181 %result = udiv i64 24, %x
182 store i64 %result, i64 addrspace(1)* %out