de22a22e50290a8e5c58c735e236b10cc66b7f41
[oota-llvm.git] / test / CodeGen / AMDGPU / udiv.ll
1 ;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=EG %s
2 ;RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck --check-prefix=SI %s
3 ;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck --check-prefix=SI %s
4
5 ;EG-LABEL: {{^}}test:
6 ;EG-NOT: SETGE_INT
7 ;EG: CF_END
8
9 define void @test(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
10   %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1
11   %a = load i32, i32 addrspace(1) * %in
12   %b = load i32, i32 addrspace(1) * %b_ptr
13   %result = udiv i32 %a, %b
14   store i32 %result, i32 addrspace(1)* %out
15   ret void
16 }
17
18 ;The code generated by udiv is long and complex and may frequently change.
19 ;The goal of this test is to make sure the ISel doesn't fail when it gets
20 ;a v4i32 udiv
21
22 ;EG-LABEL: {{^}}test2:
23 ;EG: CF_END
24 ;SI-LABEL: {{^}}test2:
25 ;SI: s_endpgm
26
27 define void @test2(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) {
28   %b_ptr = getelementptr <2 x i32>, <2 x i32> addrspace(1)* %in, i32 1
29   %a = load <2 x i32>, <2 x i32> addrspace(1) * %in
30   %b = load <2 x i32>, <2 x i32> addrspace(1) * %b_ptr
31   %result = udiv <2 x i32> %a, %b
32   store <2 x i32> %result, <2 x i32> addrspace(1)* %out
33   ret void
34 }
35
36 ;EG-LABEL: {{^}}test4:
37 ;EG: CF_END
38 ;SI-LABEL: {{^}}test4:
39 ;SI: s_endpgm
40
41 define void @test4(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
42   %b_ptr = getelementptr <4 x i32>, <4 x i32> addrspace(1)* %in, i32 1
43   %a = load <4 x i32>, <4 x i32> addrspace(1) * %in
44   %b = load <4 x i32>, <4 x i32> addrspace(1) * %b_ptr
45   %result = udiv <4 x i32> %a, %b
46   store <4 x i32> %result, <4 x i32> addrspace(1)* %out
47   ret void
48 }