Add a test for the MachineCopyPropagation change landed in r238518.

llvm-svn: 238537
This commit is contained in:
Quentin Colombet 2015-05-29 01:40:00 +00:00
parent eb4dbd8552
commit 5f834c2260
1 changed files with 55 additions and 0 deletions

View File

@ -58,3 +58,58 @@ while.end: ; preds = %while.body, %entry
%t = trunc i64 %a.addr.0.lcssa to i32
ret i32 %t
}
; Check that copy propagation does not kill thing like:
; dst = copy src <-- do not kill that.
; ... = op1 dst<undef>
; ... = op2 dst <-- this is used here.
;
; CHECK-LABEL: foo:
; CHECK: psllw $7,
; CHECK: psllw $7,
; CHECK-NEXT: pand
; CHECK-NEXT: pcmpgtb
; CHECK-NEXT: pand %xmm{{[0-9]+}}, [[SRC:%xmm[0-9]+]]
; Machine propagation used to delete the first copy as the
; first few uses were <undef>.
; CHECK-NEXT: movdqa [[SRC]], [[CPY1:%xmm[0-9]+]]
; CHECK-NEXT: movdqa [[SRC]], [[CPY2:%xmm[0-9]+]]
; CHECK-NEXT: punpckhbw [[SRC]],
; Check that CPY1 is not redefined.
; CHECK-NOT: , [[CPY1]]
; undef use, we do not care.
; CHECK: punpcklwd [[CPY1]],
; Check that CPY1 is not redefined.
; CHECK-NOT: , [[CPY1]]
; CHECK: punpcklbw [[CPY2]], [[CPY2]]
; CHECK-NEXT: punpckhwd [[CPY2]], [[CPY2]]
; CHECK-NEXT pslld $31, [[CPY2]]
; Check that CPY1 is not redefined.
; CHECK-NOT: , [[CPY1]]
; CHECK: punpcklbw [[CPY1]], [[CPY1]]
; CHECK-NEXT: punpcklwd [[CPY1]], [[CPY1]]
; CHECK-NEXT pslld $31, [[CPY1]]
define <16 x float> @foo(<16 x float> %x) {
bb:
%v3 = icmp slt <16 x i32> undef, zeroinitializer
%v14 = zext <16 x i1> %v3 to <16 x i32>
%v16 = fcmp olt <16 x float> %x, zeroinitializer
%v17 = sext <16 x i1> %v16 to <16 x i32>
%v18 = zext <16 x i1> %v16 to <16 x i32>
%v19 = xor <16 x i32> %v14, %v18
%v20 = or <16 x i32> %v17, undef
%v21 = fptosi <16 x float> %x to <16 x i32>
%v22 = sitofp <16 x i32> %v21 to <16 x float>
%v69 = fcmp ogt <16 x float> %v22, zeroinitializer
%v75 = and <16 x i1> %v69, %v3
%v77 = bitcast <16 x float> %v22 to <16 x i32>
%v79 = sext <16 x i1> %v75 to <16 x i32>
%v80 = and <16 x i32> undef, %v79
%v81 = xor <16 x i32> %v77, %v80
%v82 = and <16 x i32> undef, %v81
%v83 = xor <16 x i32> %v19, %v82
%v84 = and <16 x i32> %v83, %v20
%v85 = xor <16 x i32> %v19, %v84
%v86 = bitcast <16 x i32> %v85 to <16 x float>
ret <16 x float> %v86
}