From b105b997a49c809bfd464ae7691d5ee45d34f446 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Fri, 16 Sep 2011 18:32:30 +0000 Subject: [PATCH] Thumb2 assembly parsing and encoding for SSAT. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139926 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrThumb2.td | 11 +++++++++-- test/MC/ARM/basic-thumb2-instructions.s | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 21e70fa83e6..1d86a2a80b8 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -2019,7 +2019,7 @@ def t2SSAT16: T2SatI< } def t2USAT: T2SatI< - (outs rGPR:$Rd), (ins i32imm:$sat_imm, rGPR:$Rn, shift_imm:$sh), + (outs rGPR:$Rd), (ins imm0_31:$sat_imm, rGPR:$Rn, shift_imm:$sh), NoItinerary, "usat", "\t$Rd, $sat_imm, $Rn$sh", [/* For disassembly only; pattern left blank */]> { let Inst{31-27} = 0b11110; @@ -2028,7 +2028,7 @@ def t2USAT: T2SatI< let Inst{15} = 0; } -def t2USAT16: T2SatI<(outs rGPR:$Rd), (ins i32imm:$sat_imm, rGPR:$Rn), +def t2USAT16: T2SatI<(outs rGPR:$Rd), (ins imm0_15:$sat_imm, rGPR:$Rn), NoItinerary, "usat16", "\t$Rd, $sat_imm, $Rn", [/* For disassembly only; pattern left blank */]>, @@ -3854,3 +3854,10 @@ 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)>; + +// SSAT/USAT optional shift operand. +def : t2InstAlias<"ssat${p} $Rd, $sat_imm, $Rn", + (t2SSAT rGPR:$Rd, imm1_32:$sat_imm, rGPR:$Rn, 0, pred:$p)>; +def : t2InstAlias<"usat${p} $Rd, $sat_imm, $Rn", + (t2USAT rGPR:$Rd, imm0_31:$sat_imm, rGPR:$Rn, 0, pred:$p)>; + diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s index e5441aea794..3b25feb899e 100644 --- a/test/MC/ARM/basic-thumb2-instructions.s +++ b/test/MC/ARM/basic-thumb2-instructions.s @@ -2048,6 +2048,22 @@ _func: @ CHECK: srsia sp!, #5 @ encoding: [0xad,0xe9,0x05,0xc0] +@------------------------------------------------------------------------------ +@ SSAT +@------------------------------------------------------------------------------ + ssat r8, #1, r10 + ssat r8, #1, r10, lsl #0 + ssat r8, #1, r10, lsl #31 + ssat r8, #1, r10, asr #32 + ssat r8, #1, r10, asr #1 + +@ CHECK: ssat r8, #1, r10 @ encoding: [0x0a,0xf3,0x00,0x08] +@ CHECK: ssat r8, #1, r10 @ encoding: [0x0a,0xf3,0x00,0x08] +@ CHECK: ssat r8, #1, r10, lsl #31 @ encoding: [0x0a,0xf3,0xc0,0x78] +@ CHECK: ssat r8, #1, r10, asr #32 @ encoding: [0x2a,0xf3,0x00,0x08] +@ CHECK: ssat r8, #1, r10, asr #1 @ encoding: [0x2a,0xf3,0x40,0x08] + + @------------------------------------------------------------------------------ @ SUB (register) @------------------------------------------------------------------------------