ARM64: fix assertion in ISelDAGToDAG
authorTim Northover <tnorthover@apple.com>
Fri, 25 Apr 2014 10:48:47 +0000 (10:48 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 25 Apr 2014 10:48:47 +0000 (10:48 +0000)
Also an unused variable, so double bonus!

This should deal with PR19548.

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

lib/Target/ARM64/ARM64ISelDAGToDAG.cpp
test/CodeGen/ARM64/bitfield-extract.ll

index 986c2ad049f777f56ac0220436d1d9a26ca68aab..ad1c64526c3cbfde201d09f818d0f5d74f077739 100644 (file)
@@ -1403,8 +1403,6 @@ static bool isBitfieldDstMask(uint64_t DstMask, APInt BitsToBeInserted,
   assert((VT == MVT::i32 || VT == MVT::i64) &&
          "i32 or i64 mask type expected!");
   unsigned BitWidth = VT.getSizeInBits() - NumberOfIgnoredHighBits;
-  APInt SignificantBits =
-      ~APInt::getHighBitsSet(BitWidth, NumberOfIgnoredHighBits);
 
   APInt SignificantDstMask = APInt(BitWidth, DstMask);
   APInt SignificantBitsToBeInserted = BitsToBeInserted.zextOrTrunc(BitWidth);
index c33e57e1782e43facb0d2cb3489d3f964a5b2b4f..143aebc57793fc066aa2071ee2a0dd3829221601 100644 (file)
@@ -500,3 +500,20 @@ end:
   %conv3 = phi i80 [%conv, %entry], [%conv2, %then] 
   ret i80 %conv3
 }
+
+define i16 @test_ignored_rightbits(i32 %dst, i32 %in) {
+; CHECK-LABEL: test_ignored_rightbits:
+
+  %positioned_field = shl i32 %in, 3
+  %positioned_masked_field = and i32 %positioned_field, 120
+  %masked_dst = and i32 %dst, 7
+  %insertion = or i32 %masked_dst, %positioned_masked_field
+; CHECK: {{bfm|bfi}}
+
+  %shl16 = shl i32 %insertion, 8
+  %or18 = or i32 %shl16, %insertion
+  %conv19 = trunc i32 %or18 to i16
+; CHECK: {{bfm w[0-9]+, w[0-9]+, #24, #6|bfi w[0-9]+, w[0-9]+, #8, #7}}
+
+  ret i16 %conv19
+}