From 52338af5695e48bfd74fdb8e253b32ba82b016f5 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Thu, 1 Apr 2021 10:32:28 -0700 Subject: [PATCH] [MC][ARM] add .w suffixes for RSB/RSBS T1 See also: F5.1.167 RSB, RSBS (register) T1 shift or rotate by value variant of the Arm ARM. Link: https://github.com/ClangBuiltLinux/linux/issues/1309 Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D99542 --- llvm/lib/Target/ARM/ARMInstrThumb2.td | 11 +++++++++-- llvm/test/MC/ARM/basic-thumb2-instructions.s | 12 ++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/ARM/ARMInstrThumb2.td b/llvm/lib/Target/ARM/ARMInstrThumb2.td index bc772f35b5b3..794b666a568b 100644 --- a/llvm/lib/Target/ARM/ARMInstrThumb2.td +++ b/llvm/lib/Target/ARM/ARMInstrThumb2.td @@ -5064,8 +5064,8 @@ def : t2InstAlias<"rev16${p} $Rd, $Rm", (t2REV16 rGPR:$Rd, rGPR:$Rm, pred:$p)>; def : t2InstAlias<"revsh${p} $Rd, $Rm", (t2REVSH rGPR:$Rd, rGPR:$Rm, pred:$p)>; -// Alias for RSB without the ".w" optional width specifier, and with optional -// implied destination register. +// Alias for RSB with and without the ".w" optional width specifier, with and +// without explicit destination register. def : t2InstAlias<"rsb${s}${p} $Rd, $Rn, $imm", (t2RSBri rGPR:$Rd, rGPR:$Rn, t2_so_imm:$imm, pred:$p, cc_out:$s)>; def : t2InstAlias<"rsb${s}${p} $Rdn, $imm", @@ -5075,6 +5075,13 @@ def : t2InstAlias<"rsb${s}${p} $Rdn, $Rm", def : t2InstAlias<"rsb${s}${p} $Rdn, $ShiftedRm", (t2RSBrs rGPR:$Rdn, rGPR:$Rdn, t2_so_reg:$ShiftedRm, pred:$p, cc_out:$s)>; +def : t2InstAlias<"rsb${s}${p}.w $Rdn, $Rm", + (t2RSBrr rGPR:$Rdn, rGPR:$Rdn, rGPR:$Rm, pred:$p, cc_out:$s)>; +def : t2InstAlias<"rsb${s}${p}.w $Rd, $Rn, $Rm", + (t2RSBrr rGPR:$Rd, rGPR:$Rn, rGPR:$Rm, pred:$p, cc_out:$s)>; +def : t2InstAlias<"rsb${s}${p}.w $Rd, $Rn, $ShiftedRm", + (t2RSBrs rGPR:$Rd, rGPR:$Rn, t2_so_reg:$ShiftedRm, pred:$p, + cc_out:$s)>; // SSAT/USAT optional shift operand. def : t2InstAlias<"ssat${p} $Rd, $sat_imm, $Rn", diff --git a/llvm/test/MC/ARM/basic-thumb2-instructions.s b/llvm/test/MC/ARM/basic-thumb2-instructions.s index 636067a6f37b..b8afd2917fd0 100644 --- a/llvm/test/MC/ARM/basic-thumb2-instructions.s +++ b/llvm/test/MC/ARM/basic-thumb2-instructions.s @@ -2278,14 +2278,26 @@ adds sp, #-4096 @ RSB (register) @------------------------------------------------------------------------------ rsb r4, r8 + rsb.w r4, r8 rsb r4, r9, r8 + rsb.w r4, r9, r8 rsb r1, r4, r8, asr #3 + rsb.w r1, r4, r8, asr #3 rsbs r2, r1, r7, lsl #1 + rsbs.w r2, r1, r7, lsl #1 + rsbs r0, r1, r2 + rsbs.w r0, r1, r2 @ CHECK: rsb r4, r4, r8 @ encoding: [0xc4,0xeb,0x08,0x04] +@ CHECK: rsb r4, r4, r8 @ encoding: [0xc4,0xeb,0x08,0x04] +@ CHECK: rsb r4, r9, r8 @ encoding: [0xc9,0xeb,0x08,0x04] @ CHECK: rsb r4, r9, r8 @ encoding: [0xc9,0xeb,0x08,0x04] @ CHECK: rsb r1, r4, r8, asr #3 @ encoding: [0xc4,0xeb,0xe8,0x01] +@ CHECK: rsb r1, r4, r8, asr #3 @ encoding: [0xc4,0xeb,0xe8,0x01] @ CHECK: rsbs r2, r1, r7, lsl #1 @ encoding: [0xd1,0xeb,0x47,0x02] +@ CHECK: rsbs r2, r1, r7, lsl #1 @ encoding: [0xd1,0xeb,0x47,0x02] +@ CHECK: rsbs r0, r1, r2 @ encoding: [0xd1,0xeb,0x02,0x00] +@ CHECK: rsbs r0, r1, r2 @ encoding: [0xd1,0xeb,0x02,0x00] @------------------------------------------------------------------------------