2014-04-29 23:12:53 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
|
2013-11-18 20:09:47 +00:00
|
|
|
|
|
|
|
|
2014-02-25 21:36:18 +00:00
|
|
|
declare i32 @llvm.r600.read.tidig.x() readnone
|
2013-11-18 20:09:47 +00:00
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}test_i64_vreg:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: v_add_i32
|
|
|
|
; SI: v_addc_u32
|
2013-11-18 20:09:47 +00:00
|
|
|
define void @test_i64_vreg(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %inA, i64 addrspace(1)* noalias %inB) {
|
2014-02-25 21:36:18 +00:00
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() readnone
|
2013-11-18 20:09:47 +00:00
|
|
|
%a_ptr = getelementptr i64 addrspace(1)* %inA, i32 %tid
|
|
|
|
%b_ptr = getelementptr i64 addrspace(1)* %inB, i32 %tid
|
|
|
|
%a = load i64 addrspace(1)* %a_ptr
|
|
|
|
%b = load i64 addrspace(1)* %b_ptr
|
|
|
|
%result = add i64 %a, %b
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-11-18 20:09:55 +00:00
|
|
|
; Check that the SGPR add operand is correctly moved to a VGPR.
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}sgpr_operand:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: v_add_i32
|
|
|
|
; SI: v_addc_u32
|
2013-11-18 20:09:55 +00:00
|
|
|
define void @sgpr_operand(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %in, i64 addrspace(1)* noalias %in_bar, i64 %a) {
|
2013-11-18 20:09:50 +00:00
|
|
|
%foo = load i64 addrspace(1)* %in, align 8
|
|
|
|
%result = add i64 %foo, %a
|
2013-11-18 20:09:47 +00:00
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-11-18 20:09:50 +00:00
|
|
|
; Swap the arguments. Check that the SGPR -> VGPR copy works with the
|
|
|
|
; SGPR as other operand.
|
|
|
|
;
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}sgpr_operand_reversed:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: v_add_i32
|
|
|
|
; SI: v_addc_u32
|
2013-11-18 20:09:55 +00:00
|
|
|
define void @sgpr_operand_reversed(i64 addrspace(1)* noalias %out, i64 addrspace(1)* noalias %in, i64 %a) {
|
|
|
|
%foo = load i64 addrspace(1)* %in, align 8
|
|
|
|
%result = add i64 %a, %foo
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2013-11-18 20:09:50 +00:00
|
|
|
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}test_v2i64_sreg:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: s_add_u32
|
|
|
|
; SI: s_addc_u32
|
|
|
|
; SI: s_add_u32
|
|
|
|
; SI: s_addc_u32
|
2013-11-18 20:09:47 +00:00
|
|
|
define void @test_v2i64_sreg(<2 x i64> addrspace(1)* noalias %out, <2 x i64> %a, <2 x i64> %b) {
|
|
|
|
%result = add <2 x i64> %a, %b
|
|
|
|
store <2 x i64> %result, <2 x i64> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}test_v2i64_vreg:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: v_add_i32
|
|
|
|
; SI: v_addc_u32
|
|
|
|
; SI: v_add_i32
|
|
|
|
; SI: v_addc_u32
|
2013-11-18 20:09:47 +00:00
|
|
|
define void @test_v2i64_vreg(<2 x i64> addrspace(1)* noalias %out, <2 x i64> addrspace(1)* noalias %inA, <2 x i64> addrspace(1)* noalias %inB) {
|
2014-02-25 21:36:18 +00:00
|
|
|
%tid = call i32 @llvm.r600.read.tidig.x() readnone
|
2013-11-18 20:09:47 +00:00
|
|
|
%a_ptr = getelementptr <2 x i64> addrspace(1)* %inA, i32 %tid
|
|
|
|
%b_ptr = getelementptr <2 x i64> addrspace(1)* %inB, i32 %tid
|
|
|
|
%a = load <2 x i64> addrspace(1)* %a_ptr
|
|
|
|
%b = load <2 x i64> addrspace(1)* %b_ptr
|
|
|
|
%result = add <2 x i64> %a, %b
|
|
|
|
store <2 x i64> %result, <2 x i64> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2014-03-27 17:23:31 +00:00
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}trunc_i64_add_to_i32:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: s_load_dword s[[SREG0:[0-9]+]]
|
|
|
|
; SI: s_load_dword s[[SREG1:[0-9]+]]
|
|
|
|
; SI: s_add_i32 [[SRESULT:s[0-9]+]], s[[SREG1]], s[[SREG0]]
|
|
|
|
; SI-NOT: addc
|
|
|
|
; SI: v_mov_b32_e32 [[VRESULT:v[0-9]+]], [[SRESULT]]
|
|
|
|
; SI: buffer_store_dword [[VRESULT]],
|
2014-03-27 17:23:31 +00:00
|
|
|
define void @trunc_i64_add_to_i32(i32 addrspace(1)* %out, i64 %a, i64 %b) {
|
|
|
|
%add = add i64 %b, %a
|
|
|
|
%trunc = trunc i64 %add to i32
|
|
|
|
store i32 %trunc, i32 addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|