From 5cc338da67f1c2725a69c66e9e5f1917176c2587 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Tue, 23 Aug 2011 19:49:10 +0000 Subject: [PATCH] Thumb parsing and encoding for SVC. llvm-svn: 138360 --- llvm/lib/Target/ARM/ARMInstrThumb.td | 2 +- llvm/test/MC/ARM/basic-thumb-instructions.s | 10 ++++++++++ llvm/test/MC/ARM/thumb-diagnostics.s | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/ARM/ARMInstrThumb.td b/llvm/lib/Target/ARM/ARMInstrThumb.td index c54aae0c04f8..419da0217240 100644 --- a/llvm/lib/Target/ARM/ARMInstrThumb.td +++ b/llvm/lib/Target/ARM/ARMInstrThumb.td @@ -534,7 +534,7 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in { } -// A8.6.218 Supervisor Call (Software Interrupt) -- for disassembly only +// A8.6.218 Supervisor Call (Software Interrupt) // A8.6.16 B: Encoding T1 // If Inst{11-8} == 0b1111 then SEE SVC let isCall = 1, Uses = [SP] in diff --git a/llvm/test/MC/ARM/basic-thumb-instructions.s b/llvm/test/MC/ARM/basic-thumb-instructions.s index e72a36321f2a..5766847cca8b 100644 --- a/llvm/test/MC/ARM/basic-thumb-instructions.s +++ b/llvm/test/MC/ARM/basic-thumb-instructions.s @@ -533,3 +533,13 @@ _func: subs r1, r2, r3 @ CHECK: subs r1, r2, r3 @ encoding: [0xd1,0x1a] + + +@------------------------------------------------------------------------------ +@ SVC +@------------------------------------------------------------------------------ + svc #0 + svc #255 + +@ CHECK: svc #0 @ encoding: [0x00,0xdf] +@ CHECK: svc #255 @ encoding: [0xff,0xdf] diff --git a/llvm/test/MC/ARM/thumb-diagnostics.s b/llvm/test/MC/ARM/thumb-diagnostics.s index 9a4ddf1d9c84..650e8cecf309 100644 --- a/llvm/test/MC/ARM/thumb-diagnostics.s +++ b/llvm/test/MC/ARM/thumb-diagnostics.s @@ -108,3 +108,13 @@ error: invalid operand for instruction @ CHECK-ERRORS: error: instruction requires a CPU feature not currently enabled @ CHECK-ERRORS: str r3, [r7, #128] @ CHECK-ERRORS: ^ + +@ Out of range immediate for SVC instruction. + svc #-1 + svc #256 +@ CHECK-ERRORS: error: invalid operand for instruction +@ CHECK-ERRORS: svc #-1 +@ CHECK-ERRORS: ^ +@ CHECK-ERRORS: error: instruction requires a CPU feature not currently enabled +@ CHECK-ERRORS: svc #256 +@ CHECK-ERRORS: ^