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=r600 -mcpu=redwood < %s | FileCheck --check-prefix=EG --check-prefix=FUNC %s
5 ;FUNC-LABEL: {{^}}s_test_sdiv:
39 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0x4f800000,
41 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x5f7ffffc
42 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x2f800000
44 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0xcf800000
46 define amdgpu_kernel void @s_test_sdiv(i64 addrspace(1)* %out, i64 %x, i64 %y) {
47 %result = sdiv i64 %x, %y
48 store i64 %result, i64 addrspace(1)* %out
52 ;FUNC-LABEL: {{^}}s_test_srem:
84 ;EG: AND_INT {{.*}}, 1,
86 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0x4f800000,
88 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x5f7ffffc
89 ;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x2f800000
91 ;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0xcf800000
93 define amdgpu_kernel void @s_test_srem(i64 addrspace(1)* %out, i64 %x, i64 %y) {
94 %result = urem i64 %x, %y
95 store i64 %result, i64 addrspace(1)* %out
99 ;FUNC-LABEL: {{^}}test_sdiv3264:
106 ;VI-NOT: v_lshrrev_b64
108 define amdgpu_kernel void @test_sdiv3264(i64 addrspace(1)* %out, i64 %x, i64 %y) {
111 %result = sdiv i64 %1, %2
112 store i64 %result, i64 addrspace(1)* %out
116 ;FUNC-LABEL: {{^}}test_srem3264:
123 ;VI-NOT: v_lshrrev_b64
125 define amdgpu_kernel void @test_srem3264(i64 addrspace(1)* %out, i64 %x, i64 %y) {
128 %result = srem i64 %1, %2
129 store i64 %result, i64 addrspace(1)* %out
133 ;FUNC-LABEL: {{^}}test_sdiv2464:
143 ;VI-NOT: v_lshrrev_b64
145 define amdgpu_kernel void @test_sdiv2464(i64 addrspace(1)* %out, i64 %x, i64 %y) {
148 %result = sdiv i64 %1, %2
149 store i64 %result, i64 addrspace(1)* %out
153 ;FUNC-LABEL: {{^}}test_srem2464:
163 ;VI-NOT: v_lshrrev_b64
165 define amdgpu_kernel void @test_srem2464(i64 addrspace(1)* %out, i64 %x, i64 %y) {
168 %result = srem i64 %1, %2
169 store i64 %result, i64 addrspace(1)* %out