Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect

what it does.  Enhance it to return false to optimizing vector
sign extensions from vector comparisions, which is the idiom used
to get a splatted vector for a vector comparison.

Doing this breaks vector-casts.ll, add some compensating 
transformations to handle the important case they cover without
depending on this canonicalization.

This fixes rdar://7434900 a serious pessimization of vector compares.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95855 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-02-11 06:26:33 +00:00
parent 2e1cdbf92d
commit 8c5ad3a5da
4 changed files with 113 additions and 55 deletions

View File

@@ -51,6 +51,22 @@ entry:
}
; rdar://7434900
define <2 x i64> @test5(<4 x float> %a, <4 x float> %b) nounwind readnone {
entry:
%cmp = fcmp ult <4 x float> %a, zeroinitializer
%sext = sext <4 x i1> %cmp to <4 x i32>
%cmp4 = fcmp ult <4 x float> %b, zeroinitializer
%sext5 = sext <4 x i1> %cmp4 to <4 x i32>
%and = and <4 x i32> %sext, %sext5
%conv = bitcast <4 x i32> %and to <2 x i64>
ret <2 x i64> %conv
; CHECK: @test5
; CHECK: sext <4 x i1> %cmp to <4 x i32>
; CHECK: sext <4 x i1> %cmp4 to <4 x i32>
}
define void @convert(<2 x i32>* %dst.addr, <2 x i64> %src) nounwind {
entry: