1 ; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
5 declare i32 @llvm.r600.read.tidig.x() readnone
7 ; FUNC-LABEL: {{^}}test_sub_i32:
8 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
10 ; SI: v_subrev_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
11 define void @test_sub_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) {
12 %b_ptr = getelementptr i32 addrspace(1)* %in, i32 1
13 %a = load i32 addrspace(1)* %in
14 %b = load i32 addrspace(1)* %b_ptr
15 %result = sub i32 %a, %b
16 store i32 %result, i32 addrspace(1)* %out
21 ; FUNC-LABEL: {{^}}test_sub_v2i32:
22 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
23 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
25 ; SI: v_sub_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
26 ; SI: v_sub_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
28 define void @test_sub_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) {
29 %b_ptr = getelementptr <2 x i32> addrspace(1)* %in, i32 1
30 %a = load <2 x i32> addrspace(1) * %in
31 %b = load <2 x i32> addrspace(1) * %b_ptr
32 %result = sub <2 x i32> %a, %b
33 store <2 x i32> %result, <2 x i32> addrspace(1)* %out
37 ; FUNC-LABEL: {{^}}test_sub_v4i32:
38 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
39 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
40 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
41 ; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
43 ; SI: v_sub_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
44 ; SI: v_sub_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
45 ; SI: v_sub_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
46 ; SI: v_sub_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
48 define void @test_sub_v4i32(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
49 %b_ptr = getelementptr <4 x i32> addrspace(1)* %in, i32 1
50 %a = load <4 x i32> addrspace(1) * %in
51 %b = load <4 x i32> addrspace(1) * %b_ptr
52 %result = sub <4 x i32> %a, %b
53 store <4 x i32> %result, <4 x i32> addrspace(1)* %out
57 ; FUNC-LABEL: {{^}}s_sub_i64:
66 define void @s_sub_i64(i64 addrspace(1)* noalias %out, i64 %a, i64 %b) nounwind {
67 %result = sub i64 %a, %b
68 store i64 %result, i64 addrspace(1)* %out, align 8
72 ; FUNC-LABEL: {{^}}v_sub_i64:
81 define void @v_sub_i64(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %inA, i64 addrspace(1)* noalias %inB) nounwind {
82 %tid = call i32 @llvm.r600.read.tidig.x() readnone
83 %a_ptr = getelementptr i64 addrspace(1)* %inA, i32 %tid
84 %b_ptr = getelementptr i64 addrspace(1)* %inB, i32 %tid
85 %a = load i64 addrspace(1)* %a_ptr
86 %b = load i64 addrspace(1)* %b_ptr
87 %result = sub i64 %a, %b
88 store i64 %result, i64 addrspace(1)* %out, align 8
92 ; FUNC-LABEL: {{^}}v_test_sub_v2i64:
97 define void @v_test_sub_v2i64(<2 x i64> addrspace(1)* %out, <2 x i64> addrspace(1)* noalias %inA, <2 x i64> addrspace(1)* noalias %inB) {
98 %tid = call i32 @llvm.r600.read.tidig.x() readnone
99 %a_ptr = getelementptr <2 x i64> addrspace(1)* %inA, i32 %tid
100 %b_ptr = getelementptr <2 x i64> addrspace(1)* %inB, i32 %tid
101 %a = load <2 x i64> addrspace(1)* %a_ptr
102 %b = load <2 x i64> addrspace(1)* %b_ptr
103 %result = sub <2 x i64> %a, %b
104 store <2 x i64> %result, <2 x i64> addrspace(1)* %out
108 ; FUNC-LABEL: {{^}}v_test_sub_v4i64:
117 define void @v_test_sub_v4i64(<4 x i64> addrspace(1)* %out, <4 x i64> addrspace(1)* noalias %inA, <4 x i64> addrspace(1)* noalias %inB) {
118 %tid = call i32 @llvm.r600.read.tidig.x() readnone
119 %a_ptr = getelementptr <4 x i64> addrspace(1)* %inA, i32 %tid
120 %b_ptr = getelementptr <4 x i64> addrspace(1)* %inB, i32 %tid
121 %a = load <4 x i64> addrspace(1)* %a_ptr
122 %b = load <4 x i64> addrspace(1)* %b_ptr
123 %result = sub <4 x i64> %a, %b
124 store <4 x i64> %result, <4 x i64> addrspace(1)* %out