Dan Gohman | fce288f | 2009-09-09 00:09:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=thumb |
Bob Wilson | bf6396b | 2009-04-01 17:58:54 +0000 | [diff] [blame] | 2 | |
| 3 | ; Test Thumb-mode "I" constraint, for ADD immediate. |
| 4 | define i32 @testI(i32 %x) { |
| 5 | %y = call i32 asm "add $0, $1, $2", "=r,r,I"( i32 %x, i32 255 ) nounwind |
| 6 | ret i32 %y |
| 7 | } |
| 8 | |
| 9 | ; Test Thumb-mode "J" constraint, for negated ADD immediates. |
| 10 | define void @testJ() { |
| 11 | tail call void asm sideeffect ".word $0", "J"( i32 -255 ) nounwind |
| 12 | ret void |
| 13 | } |
| 14 | |
| 15 | ; Test Thumb-mode "K" constraint, for compatibility with GCC's internal use. |
| 16 | define void @testK() { |
| 17 | tail call void asm sideeffect ".word $0", "K"( i32 65280 ) nounwind |
| 18 | ret void |
| 19 | } |
| 20 | |
| 21 | ; Test Thumb-mode "L" constraint, for 3-operand ADD immediates. |
| 22 | define i32 @testL(i32 %x) { |
| 23 | %y = call i32 asm "add $0, $1, $2", "=r,r,L"( i32 %x, i32 -7 ) nounwind |
| 24 | ret i32 %y |
| 25 | } |
| 26 | |
| 27 | ; Test Thumb-mode "M" constraint, for "ADD r = sp + imm". |
| 28 | define i32 @testM() { |
| 29 | %y = call i32 asm "add $0, sp, $1", "=r,M"( i32 1020 ) nounwind |
| 30 | ret i32 %y |
| 31 | } |
| 32 | |
| 33 | ; Test Thumb-mode "N" constraint, for values between 0 and 31. |
| 34 | define i32 @testN(i32 %x) { |
| 35 | %y = call i32 asm "lsl $0, $1, $2", "=r,r,N"( i32 %x, i32 31 ) nounwind |
| 36 | ret i32 %y |
| 37 | } |
| 38 | |
| 39 | ; Test Thumb-mode "O" constraint, for "ADD sp = sp + imm". |
| 40 | define void @testO() { |
| 41 | tail call void asm sideeffect "add sp, sp, $0; add sp, sp, $1", "O,O"( i32 -508, i32 508 ) nounwind |
| 42 | ret void |
| 43 | } |