From: Jim Grosbach Date: Fri, 19 Aug 2011 19:29:25 +0000 (+0000) Subject: Thumb assembly parsing and encoding for LSL(immediate). X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1b7b68f08776dc9553399dc3b4e7ab54e5e596c0;p=oota-llvm.git Thumb assembly parsing and encoding for LSL(immediate). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138063 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMInstrThumb.td b/lib/Target/ARM/ARMInstrThumb.td index 63d8b48734e..b19cccbd992 100644 --- a/lib/Target/ARM/ARMInstrThumb.td +++ b/lib/Target/ARM/ARMInstrThumb.td @@ -970,7 +970,7 @@ def tEOR : // A8.6.45 // LSL immediate def tLSLri : // A8.6.88 - T1sIGenEncodeImm<{0,0,0,?,?}, (outs tGPR:$Rd), (ins tGPR:$Rm, i32imm:$imm5), + T1sIGenEncodeImm<{0,0,0,?,?}, (outs tGPR:$Rd), (ins tGPR:$Rm, imm0_31:$imm5), IIC_iMOVsi, "lsl", "\t$Rd, $Rm, $imm5", [(set tGPR:$Rd, (shl tGPR:$Rm, (i32 imm:$imm5)))]> { diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 60f16f83625..7197b99b25b 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -2728,7 +2728,7 @@ StringRef ARMAsmParser::splitMnemonic(StringRef Mnemonic, // predicated but do have a carry-set and so weren't caught above. if (Mnemonic != "adcs" && Mnemonic != "bics" && Mnemonic != "movs" && Mnemonic != "muls" && Mnemonic != "smlals" && Mnemonic != "smulls" && - Mnemonic != "umlals" && Mnemonic != "umulls") { + Mnemonic != "umlals" && Mnemonic != "umulls" && Mnemonic != "lsls") { unsigned CC = StringSwitch(Mnemonic.substr(Mnemonic.size()-2)) .Case("eq", ARMCC::EQ) .Case("ne", ARMCC::NE) diff --git a/test/MC/ARM/basic-thumb-instructions.s b/test/MC/ARM/basic-thumb-instructions.s index 50554326ca8..7ed665c2413 100644 --- a/test/MC/ARM/basic-thumb-instructions.s +++ b/test/MC/ARM/basic-thumb-instructions.s @@ -260,3 +260,13 @@ _func: @ CHECK: ldrsb r6, [r2, r6] @ encoding: [0x96,0x57] @ CHECK: ldrsh r3, [r7, r1] @ encoding: [0x7b,0x5e] + + +@------------------------------------------------------------------------------ +@ LSL (immediate) +@------------------------------------------------------------------------------ + lsls r4, r5, #0 + lsls r4, r5, #4 + +@ CHECK: lsls r4, r5, #0 @ encoding: [0x2c,0x00] +@ CHECK: lsls r4, r5, #4 @ encoding: [0x2c,0x01] diff --git a/test/MC/ARM/thumb-diagnostics.s b/test/MC/ARM/thumb-diagnostics.s index d067b2be6c6..df8f2262caa 100644 --- a/test/MC/ARM/thumb-diagnostics.s +++ b/test/MC/ARM/thumb-diagnostics.s @@ -49,3 +49,14 @@ error: invalid operand for instruction @ CHECK-ERRORS: error: writeback operator '!' expected @ CHECK-ERRORS: ldm r2, {r5, r7} @ CHECK-ERRORS: ^ + + +@ Out of range immediates for LSL instruction. + lsls r4, r5, #-1 + lsls r4, r5, #32 +@ CHECK-ERRORS: error: invalid operand for instruction +@ CHECK-ERRORS: lsls r4, r5, #-1 +@ CHECK-ERRORS: ^ +@ CHECK-ERRORS: error: invalid operand for instruction +@ CHECK-ERRORS: lsls r4, r5, #32 +@ CHECK-ERRORS: ^