File: inlineasm-imm-thumb.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (43 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download | duplicates (35)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
; RUN: llc -mtriple=thumb-eabi -no-integrated-as %s -o /dev/null

; Test Thumb-mode "I" constraint, for ADD immediate.
define i32 @testI(i32 %x) {
	%y = call i32 asm "add $0, $1, $2", "=r,r,I"( i32 %x, i32 255 ) nounwind
	ret i32 %y
}

; Test Thumb-mode "J" constraint, for negated ADD immediates.
define void @testJ() {
	tail call void asm sideeffect ".word $0", "J"( i32 -255 ) nounwind
	ret void
}

; Test Thumb-mode "K" constraint, for compatibility with GCC's internal use.
define void @testK() {
	tail call void asm sideeffect ".word $0", "K"( i32 65280 ) nounwind
	ret void
}

; Test Thumb-mode "L" constraint, for 3-operand ADD immediates.
define i32 @testL(i32 %x) {
	%y = call i32 asm "add $0, $1, $2", "=r,r,L"( i32 %x, i32 -7 ) nounwind
	ret i32 %y
}

; Test Thumb-mode "M" constraint, for "ADD r = sp + imm".
define i32 @testM() {
	%y = call i32 asm "add $0, sp, $1", "=r,M"( i32 1020 ) nounwind
	ret i32 %y
}

; Test Thumb-mode "N" constraint, for values between 0 and 31.
define i32 @testN(i32 %x) {
	%y = call i32 asm "lsl $0, $1, $2", "=r,r,N"( i32 %x, i32 31 ) nounwind
	ret i32 %y
}

; Test Thumb-mode "O" constraint, for "ADD sp = sp + imm".
define void @testO() {
	tail call void asm sideeffect "add sp, sp, $0; add sp, sp, $1", "O,O"( i32 -508, i32 508 ) nounwind
        ret void
}