[ARM64] Tighten up the special casing in emitting arithmetic extends. UXTW should only be translated when the instruction uses WSP, not SP. Vice versa for UXTX and 64-bit instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205886 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bradley Smith 2014-04-09 14:44:03 +00:00
parent 5a09ce9ad1
commit 86c067813c
2 changed files with 10 additions and 8 deletions

View File

@ -1097,8 +1097,10 @@ void ARM64InstPrinter::printExtend(const MCInst *MI, unsigned OpNum,
if (ExtType == ARM64_AM::UXTW || ExtType == ARM64_AM::UXTX) {
unsigned Dest = MI->getOperand(0).getReg();
unsigned Src1 = MI->getOperand(1).getReg();
if (Dest == ARM64::SP || Dest == ARM64::WSP || Src1 == ARM64::SP ||
Src1 == ARM64::WSP) {
if ( ((Dest == ARM64::SP || Src1 == ARM64::SP) &&
ExtType == ARM64_AM::UXTX) ||
((Dest == ARM64::WSP || Src1 == ARM64::WSP) &&
ExtType == ARM64_AM::UXTW) ) {
if (ShiftVal != 0)
O << ", lsl #" << ShiftVal;
return;

View File

@ -368,8 +368,8 @@ foo:
; CHECK: subs x3, sp, x9, lsl #2 ; encoding: [0xe3,0x6b,0x29,0xeb]
; CHECK: cmp wsp, w8 ; encoding: [0xff,0x43,0x28,0x6b]
; CHECK: cmp wsp, w8 ; encoding: [0xff,0x43,0x28,0x6b]
; CHECK: cmp sp, w8 ; encoding: [0xff,0x43,0x28,0xeb]
; CHECK: cmp sp, w8 ; encoding: [0xff,0x43,0x28,0xeb]
; CHECK: cmp sp, w8, uxtw ; encoding: [0xff,0x43,0x28,0xeb]
; CHECK: cmp sp, w8, uxtw ; encoding: [0xff,0x43,0x28,0xeb]
sub wsp, w9, w8, uxtw
sub w1, wsp, w8, uxtw
@ -383,11 +383,11 @@ foo:
; CHECK: sub wsp, w9, w8 ; encoding: [0x3f,0x41,0x28,0x4b]
; CHECK: sub w1, wsp, w8 ; encoding: [0xe1,0x43,0x28,0x4b]
; CHECK: sub wsp, wsp, w8 ; encoding: [0xff,0x43,0x28,0x4b]
; CHECK: sub sp, x9, w8 ; encoding: [0x3f,0x41,0x28,0xcb]
; CHECK: sub x1, sp, w8 ; encoding: [0xe1,0x43,0x28,0xcb]
; CHECK: sub sp, sp, w8 ; encoding: [0xff,0x43,0x28,0xcb]
; CHECK: sub sp, x9, w8, uxtw ; encoding: [0x3f,0x41,0x28,0xcb]
; CHECK: sub x1, sp, w8, uxtw ; encoding: [0xe1,0x43,0x28,0xcb]
; CHECK: sub sp, sp, w8, uxtw ; encoding: [0xff,0x43,0x28,0xcb]
; CHECK: subs w1, wsp, w8 ; encoding: [0xe1,0x43,0x28,0x6b]
; CHECK: subs x1, sp, w8 ; encoding: [0xe1,0x43,0x28,0xeb]
; CHECK: subs x1, sp, w8, uxtw ; encoding: [0xe1,0x43,0x28,0xeb]
;==---------------------------------------------------------------------------==
; Signed/Unsigned divide