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 3 4 5declare i32 @llvm.r600.read.tidig.x() readnone 6 7; FUNC-LABEL: {{^}}test_sub_i32: 8; EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 9 10; SI: v_subrev_i32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 11define void @test_sub_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { 12 %b_ptr = getelementptr i32, i32 addrspace(1)* %in, i32 1 13 %a = load i32, i32 addrspace(1)* %in 14 %b = load i32, i32 addrspace(1)* %b_ptr 15 %result = sub i32 %a, %b 16 store i32 %result, i32 addrspace(1)* %out 17 ret void 18} 19 20 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]}} 24 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]+}} 27 28define void @test_sub_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) { 29 %b_ptr = getelementptr <2 x i32>, <2 x i32> addrspace(1)* %in, i32 1 30 %a = load <2 x i32>, <2 x i32> addrspace(1) * %in 31 %b = load <2 x i32>, <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 34 ret void 35} 36 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]}} 42 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]+}} 47 48define void @test_sub_v4i32(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) { 49 %b_ptr = getelementptr <4 x i32>, <4 x i32> addrspace(1)* %in, i32 1 50 %a = load <4 x i32>, <4 x i32> addrspace(1) * %in 51 %b = load <4 x i32>, <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 54 ret void 55} 56 57; FUNC-LABEL: {{^}}s_sub_i64: 58; SI: s_sub_u32 59; SI: s_subb_u32 60 61; EG-DAG: SETGE_UINT 62; EG-DAG: CNDE_INT 63; EG-DAG: SUB_INT 64; EG-DAG: SUB_INT 65; EG-DAG: SUB_INT 66define 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 69 ret void 70} 71 72; FUNC-LABEL: {{^}}v_sub_i64: 73; SI: v_sub_i32_e32 74; SI: v_subb_u32_e32 75 76; EG-DAG: SETGE_UINT 77; EG-DAG: CNDE_INT 78; EG-DAG: SUB_INT 79; EG-DAG: SUB_INT 80; EG-DAG: SUB_INT 81define 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, i64 addrspace(1)* %inA, i32 %tid 84 %b_ptr = getelementptr i64, i64 addrspace(1)* %inB, i32 %tid 85 %a = load i64, i64 addrspace(1)* %a_ptr 86 %b = load i64, i64 addrspace(1)* %b_ptr 87 %result = sub i64 %a, %b 88 store i64 %result, i64 addrspace(1)* %out, align 8 89 ret void 90} 91 92; FUNC-LABEL: {{^}}v_test_sub_v2i64: 93; SI: v_sub_i32_e32 94; SI: v_subb_u32_e32 95; SI: v_sub_i32_e32 96; SI: v_subb_u32_e32 97define 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>, <2 x i64> addrspace(1)* %inA, i32 %tid 100 %b_ptr = getelementptr <2 x i64>, <2 x i64> addrspace(1)* %inB, i32 %tid 101 %a = load <2 x i64>, <2 x i64> addrspace(1)* %a_ptr 102 %b = load <2 x i64>, <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 105 ret void 106} 107 108; FUNC-LABEL: {{^}}v_test_sub_v4i64: 109; SI: v_sub_i32_e32 110; SI: v_subb_u32_e32 111; SI: v_sub_i32_e32 112; SI: v_subb_u32_e32 113; SI: v_sub_i32_e32 114; SI: v_subb_u32_e32 115; SI: v_sub_i32_e32 116; SI: v_subb_u32_e32 117define 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>, <4 x i64> addrspace(1)* %inA, i32 %tid 120 %b_ptr = getelementptr <4 x i64>, <4 x i64> addrspace(1)* %inB, i32 %tid 121 %a = load <4 x i64>, <4 x i64> addrspace(1)* %a_ptr 122 %b = load <4 x i64>, <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 125 ret void 126} 127