1 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
5 ; The code generated by urem is long and complex and may frequently
6 ; change. The goal of this test is to make sure the ISel doesn't fail
7 ; when it gets a v2i32/v4i32 urem
9 ; FUNC-LABEL: {{^}}test_urem_i32:
12 define amdgpu_kernel void @test_urem_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
13 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
14 %a = load i32, i32 addrspace(1)* %in
15 %b = load i32, i32 addrspace(1)* %b_ptr
16 %result = urem i32 %a, %b
17 store i32 %result, i32 addrspace(1)* %out
21 ; FUNC-LABEL: {{^}}test_urem_i32_7:
22 ; SI: s_mov_b32 [[MAGIC:s[0-9]+]], 0x24924925
23 ; SI: v_mul_hi_u32 {{v[0-9]+}}, {{v[0-9]+}}, [[MAGIC]]
24 ; SI: v_subrev_{{[iu]}}32
26 ; SI: v_sub_{{[iu]}}32
27 ; SI: buffer_store_dword
29 define amdgpu_kernel void @test_urem_i32_7(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
30 %num = load i32, i32 addrspace(1) * %in
31 %result = urem i32 %num, 7
32 store i32 %result, i32 addrspace(1)* %out
36 ; FUNC-LABEL: {{^}}test_urem_v2i32:
39 define amdgpu_kernel void @test_urem_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) {
40 %b_ptr = getelementptr <2 x i32>, <2 x i32> addrspace(1)* %in, i32 1
41 %a = load <2 x i32>, <2 x i32> addrspace(1)* %in
42 %b = load <2 x i32>, <2 x i32> addrspace(1)* %b_ptr
43 %result = urem <2 x i32> %a, %b
44 store <2 x i32> %result, <2 x i32> addrspace(1)* %out
48 ; FUNC-LABEL: {{^}}test_urem_v4i32:
51 define amdgpu_kernel void @test_urem_v4i32(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
52 %b_ptr = getelementptr <4 x i32>, <4 x i32> addrspace(1)* %in, i32 1
53 %a = load <4 x i32>, <4 x i32> addrspace(1)* %in
54 %b = load <4 x i32>, <4 x i32> addrspace(1)* %b_ptr
55 %result = urem <4 x i32> %a, %b
56 store <4 x i32> %result, <4 x i32> addrspace(1)* %out
60 ; FUNC-LABEL: {{^}}test_urem_i64:
63 define amdgpu_kernel void @test_urem_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %in) {
64 %b_ptr = getelementptr i64, i64 addrspace(1)* %in, i64 1
65 %a = load i64, i64 addrspace(1)* %in
66 %b = load i64, i64 addrspace(1)* %b_ptr
67 %result = urem i64 %a, %b
68 store i64 %result, i64 addrspace(1)* %out
72 ; FUNC-LABEL: {{^}}test_urem_v2i64:
75 define amdgpu_kernel void @test_urem_v2i64(<2 x i64> addrspace(1)* %out, <2 x i64> addrspace(1)* %in) {
76 %b_ptr = getelementptr <2 x i64>, <2 x i64> addrspace(1)* %in, i64 1
77 %a = load <2 x i64>, <2 x i64> addrspace(1)* %in
78 %b = load <2 x i64>, <2 x i64> addrspace(1)* %b_ptr
79 %result = urem <2 x i64> %a, %b
80 store <2 x i64> %result, <2 x i64> addrspace(1)* %out
84 ; FUNC-LABEL: {{^}}test_urem_v4i64:
87 define amdgpu_kernel void @test_urem_v4i64(<4 x i64> addrspace(1)* %out, <4 x i64> addrspace(1)* %in) {
88 %b_ptr = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %in, i64 1
89 %a = load <4 x i64>, <4 x i64> addrspace(1)* %in
90 %b = load <4 x i64>, <4 x i64> addrspace(1)* %b_ptr
91 %result = urem <4 x i64> %a, %b
92 store <4 x i64> %result, <4 x i64> addrspace(1)* %out