1 ;RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 2 ;RUN: llc -march=r600 -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 3 4 declare i32 @llvm.r600.read.tidig.x() readnone 5 6 ;FUNC-LABEL: @test2 7 ;EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 8 ;EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 9 10 ;SI: V_SUB_I32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 11 ;SI: V_SUB_I32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 12 13 define void @test2(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) { 14 %b_ptr = getelementptr <2 x i32> addrspace(1)* %in, i32 1 15 %a = load <2 x i32> addrspace(1) * %in 16 %b = load <2 x i32> addrspace(1) * %b_ptr 17 %result = sub <2 x i32> %a, %b 18 store <2 x i32> %result, <2 x i32> addrspace(1)* %out 19 ret void 20 } 21 22 ;FUNC-LABEL: @test4 23 ;EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 24 ;EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 25 ;EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 26 ;EG: SUB_INT {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}} 27 28 ;SI: V_SUB_I32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 29 ;SI: V_SUB_I32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 30 ;SI: V_SUB_I32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 31 ;SI: V_SUB_I32_e32 v{{[0-9]+, v[0-9]+, v[0-9]+}} 32 33 define void @test4(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) { 34 %b_ptr = getelementptr <4 x i32> addrspace(1)* %in, i32 1 35 %a = load <4 x i32> addrspace(1) * %in 36 %b = load <4 x i32> addrspace(1) * %b_ptr 37 %result = sub <4 x i32> %a, %b 38 store <4 x i32> %result, <4 x i32> addrspace(1)* %out 39 ret void 40 } 41 42 ; FUNC-LABEL: @s_sub_i64: 43 ; SI: S_SUB_I32 44 ; SI: S_SUBB_U32 45 46 ; EG-DAG: SETGE_UINT 47 ; EG-DAG: CNDE_INT 48 ; EG-DAG: SUB_INT 49 ; EG-DAG: SUB_INT 50 ; EG-DAG: SUB_INT 51 define void @s_sub_i64(i64 addrspace(1)* noalias %out, i64 %a, i64 %b) nounwind { 52 %result = sub i64 %a, %b 53 store i64 %result, i64 addrspace(1)* %out, align 8 54 ret void 55 } 56 57 ; FUNC-LABEL: @v_sub_i64: 58 ; SI: V_SUB_I32_e32 59 ; SI: V_SUBB_U32_e32 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 66 define void @v_sub_i64(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %inA, i64 addrspace(1)* noalias %inB) nounwind { 67 %tid = call i32 @llvm.r600.read.tidig.x() readnone 68 %a_ptr = getelementptr i64 addrspace(1)* %inA, i32 %tid 69 %b_ptr = getelementptr i64 addrspace(1)* %inB, i32 %tid 70 %a = load i64 addrspace(1)* %a_ptr 71 %b = load i64 addrspace(1)* %b_ptr 72 %result = sub i64 %a, %b 73 store i64 %result, i64 addrspace(1)* %out, align 8 74 ret void 75 } 76