ARM64: remove buggy REV16 pattern.
authorTim Northover <tnorthover@apple.com>
Mon, 14 Apr 2014 12:59:52 +0000 (12:59 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 14 Apr 2014 12:59:52 +0000 (12:59 +0000)
The 32-bit pattern is still valid: 0123 -> 3210 -> 1032.

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

lib/Target/ARM64/ARM64InstrInfo.td
test/CodeGen/ARM64/rev.ll

index 2af217fe91043da891cd33611eaf10da4d55f2e5..6a1154d4369f0e8c53e8e3da607e7868022668ce 100644 (file)
@@ -645,8 +645,7 @@ defm CLZ    : OneOperandData<0b100, "clz", ctlz>;
 defm RBIT   : OneOperandData<0b000, "rbit">;
 def  REV16Wr : OneWRegData<0b001, "rev16",
                                   UnOpFrag<(rotr (bswap node:$LHS), (i64 16))>>;
-def  REV16Xr : OneXRegData<0b001, "rev16",
-                                  UnOpFrag<(rotr (bswap node:$LHS), (i64 16))>>;
+def  REV16Xr : OneXRegData<0b001, "rev16", null_frag>;
 
 def : Pat<(cttz GPR32:$Rn),
           (CLZWr (RBITWr GPR32:$Rn))>;
index 867d5b3c51332d5981156fa47b6b2e03d644f111..0006ea33175aec0c157e46749edaa080cc4d57c5 100644 (file)
@@ -36,10 +36,13 @@ entry:
   ret i32 %tmp14
 }
 
+; 64-bit REV16 is *not* a swap then a 16-bit rotation:
+;   01234567 ->(bswap) 76543210 ->(rotr) 10765432
+;   01234567 ->(rev16) 10325476
 define i64 @test_rev16_x(i64 %a) nounwind {
 entry:
 ; CHECK-LABEL: test_rev16_x:
-; CHECK: rev16 x0, x0
+; CHECK-NOT: rev16 x0, x0
   %0 = tail call i64 @llvm.bswap.i64(i64 %a)
   %1 = lshr i64 %0, 16
   %2 = shl i64 %0, 48