Fix incorrect check for sign-extended constant BUILD_VECTOR.
authorBob Wilson <bob.wilson@apple.com>
Tue, 18 Oct 2011 17:34:51 +0000 (17:34 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 18 Oct 2011 17:34:51 +0000 (17:34 +0000)
<rdar://problem/10298332>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142371 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/vmul.ll

index 1615f5b140de44123a333f29419f5b9f8fd671b5..775300677481f43bace0aa736623985ad33b798e 100644 (file)
@@ -4527,7 +4527,7 @@ static bool isExtendedBUILD_VECTOR(SDNode *N, SelectionDAG &DAG,
       unsigned HalfSize = EltSize / 2;
       if (isSigned) {
         int64_t SExtVal = C->getSExtValue();
-        if ((SExtVal >> HalfSize) != (SExtVal >> EltSize))
+        if (SExtVal != SExtVal << (64 - HalfSize) >> (64 - HalfSize))
           return false;
       } else {
         if ((C->getZExtValue() >> HalfSize) != 0)
index 1780d6e66be76d4b49734c293abaeb4107d92916..61d89bbae8356eec3502ac76ae8dbc603e34e5cb 100644 (file)
@@ -514,3 +514,14 @@ entry:
   store <8 x i8> %10, <8 x i8>* %11, align 8
   ret void
 }
+
+; If one operand has a zero-extend and the other a sign-extend, vmull
+; cannot be used.
+define i16 @vmullWithInconsistentExtensions(<8 x i8> %vec) {
+; CHECK: vmullWithInconsistentExtensions
+; CHECK-NOT: vmull.s8
+  %1 = sext <8 x i8> %vec to <8 x i16>
+  %2 = mul <8 x i16> %1, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
+  %3 = extractelement <8 x i16> %2, i32 0
+  ret i16 %3
+}