Skip to content

Commit

Permalink
[ARM] Operands for PKHTB alias should be swapped
Browse files Browse the repository at this point in the history
When the shift immediate is zero, PKHTB is an alias for PKHBT, but the order of
the input operands needs to be swapped.

Differential Revision: http://reviews.llvm.org/D16288



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258044 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ostannard committed Jan 18, 2016
1 parent c2d5ba1 commit daaca8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/Target/ARM/ARMInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -5595,13 +5595,13 @@ def : MnemonicAlias<"stmfd", "stmdb">;
def : MnemonicAlias<"stmia", "stm">;
def : MnemonicAlias<"stmea", "stm">;

// PKHBT/PKHTB with default shift amount. PKHTB is equivalent to PKHBT when the
// shift amount is zero (i.e., unspecified).
// PKHBT/PKHTB with default shift amount. PKHTB is equivalent to PKHBT with the
// input operands swapped when the shift amount is zero (i.e., unspecified).
def : InstAlias<"pkhbt${p} $Rd, $Rn, $Rm",
(PKHBT GPRnopc:$Rd, GPRnopc:$Rn, GPRnopc:$Rm, 0, pred:$p)>,
Requires<[IsARM, HasV6]>;
def : InstAlias<"pkhtb${p} $Rd, $Rn, $Rm",
(PKHBT GPRnopc:$Rd, GPRnopc:$Rn, GPRnopc:$Rm, 0, pred:$p)>,
(PKHBT GPRnopc:$Rd, GPRnopc:$Rm, GPRnopc:$Rn, 0, pred:$p)>,
Requires<[IsARM, HasV6]>;

// PUSH/POP aliases for STM/LDM
Expand Down
6 changes: 3 additions & 3 deletions lib/Target/ARM/ARMInstrThumb2.td
Original file line number Diff line number Diff line change
Expand Up @@ -4557,13 +4557,13 @@ def : t2InstAlias<"mvn${s}${p} $Rd, $Rm",
def : t2InstAlias<"mvn${s}${p} $Rd, $ShiftedRm",
(t2MVNs rGPR:$Rd, t2_so_reg:$ShiftedRm, pred:$p, cc_out:$s)>;

// PKHBT/PKHTB with default shift amount. PKHTB is equivalent to PKHBT when the
// shift amount is zero (i.e., unspecified).
// PKHBT/PKHTB with default shift amount. PKHTB is equivalent to PKHBT with the
// input operands swapped when the shift amount is zero (i.e., unspecified).
def : InstAlias<"pkhbt${p} $Rd, $Rn, $Rm",
(t2PKHBT rGPR:$Rd, rGPR:$Rn, rGPR:$Rm, 0, pred:$p)>,
Requires<[HasT2ExtractPack, IsThumb2]>;
def : InstAlias<"pkhtb${p} $Rd, $Rn, $Rm",
(t2PKHBT rGPR:$Rd, rGPR:$Rn, rGPR:$Rm, 0, pred:$p)>,
(t2PKHBT rGPR:$Rd, rGPR:$Rm, rGPR:$Rn, 0, pred:$p)>,
Requires<[HasT2ExtractPack, IsThumb2]>;

// PUSH/POP aliases for STM/LDM
Expand Down
2 changes: 1 addition & 1 deletion test/MC/ARM/basic-arm-instructions.s
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ Lforward:
@ CHECK: pkhbt r2, r2, r3 @ encoding: [0x13,0x20,0x82,0xe6]
@ CHECK: pkhbt r2, r2, r3, lsl #15 @ encoding: [0x93,0x27,0x82,0xe6]

@ CHECK: pkhbt r2, r2, r3 @ encoding: [0x13,0x20,0x82,0xe6]
@ CHECK: pkhbt r2, r3, r2 @ encoding: [0x12,0x20,0x83,0xe6]
@ CHECK: pkhtb r2, r2, r3, asr #31 @ encoding: [0xd3,0x2f,0x82,0xe6]
@ CHECK: pkhtb r2, r2, r3, asr #15 @ encoding: [0xd3,0x27,0x82,0xe6]

Expand Down
2 changes: 1 addition & 1 deletion test/MC/ARM/basic-thumb2-instructions.s
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ _func:
@ CHECK: pkhbt r2, r2, r3 @ encoding: [0xc2,0xea,0x03,0x02]
@ CHECK: pkhbt r2, r2, r3, lsl #15 @ encoding: [0xc2,0xea,0xc3,0x32]

@ CHECK: pkhbt r2, r2, r3 @ encoding: [0xc2,0xea,0x03,0x02]
@ CHECK: pkhbt r2, r3, r2 @ encoding: [0xc3,0xea,0x02,0x02]
@ CHECK: pkhtb r2, r2, r3, asr #31 @ encoding: [0xc2,0xea,0xe3,0x72]
@ CHECK: pkhtb r2, r2, r3, asr #15 @ encoding: [0xc2,0xea,0xe3,0x32]

Expand Down

0 comments on commit daaca8c

Please sign in to comment.