File: inlineasm-constraint-m-2.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (67 lines) | stat: -rw-r--r-- 2,243 bytes parent folder | download | duplicates (8)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
; RUN: llc -march=mips -relocation-model=pic < %s \
; RUN:   | FileCheck --check-prefixes=CHECK,EB %s
; RUN: llc -march=mipsel -relocation-model=pic < %s \
; RUN:   | FileCheck --check-prefixes=CHECK,EL %s

; Simple memory
@g1 = external global i32

define i32 @f1(i32 %x) nounwind {
entry:
; CHECK-LABEL: f1:
; CHECK: #APP
; CHECK: sw $4, [[OFFSET:[0-9]+]]($sp)
; CHECK: #NO_APP
; CHECK: lw  $[[T1:[0-9]+]], %got(g1)
; CHECK: #APP
; CHECK: lw $[[T3:[0-9]+]], [[OFFSET]]($sp)
; CHECK: #NO_APP
; CHECK: sw  $[[T3]], 0($[[T1]])

  %l1 = alloca i32, align 4
  call void asm "sw $1, $0", "=*m,r"(ptr elementtype(i32) %l1, i32 %x) nounwind
  %0 = call i32 asm "lw $0, $1", "=r,*m"(ptr elementtype(i32) %l1) nounwind
  store i32 %0, ptr @g1, align 4
  ret i32 %0
}

; CHECK-LABEL: main:
; "D": Second word of a double word. This works for any memory element
; double or single.
; CHECK: #APP
; CHECK: lw ${{[0-9]+}}, 16(${{[0-9]+}})
; CHECK: #NO_APP

; No "D": First word of a double word. This works for any memory element
; double or single.
; CHECK: #APP
; CHECK: lw ${{[0-9]+}}, 12(${{[0-9]+}})
; CHECK: #NO_APP

; "M": High-order word of a double word.
; CHECK: #APP
; EB:    lw ${{[0-9]+}}, 12(${{[0-9]+}})
; EL:    lw ${{[0-9]+}}, 16(${{[0-9]+}})
; CHECK: #NO_APP

; "L": Low-order word of a double word.
; CHECK: #APP
; EB:    lw ${{[0-9]+}}, 16(${{[0-9]+}})
; EL:    lw ${{[0-9]+}}, 12(${{[0-9]+}})
; CHECK: #NO_APP

@b = common global [20 x i32] zeroinitializer, align 4

define void @main() {
entry:
; Second word:
  tail call void asm sideeffect "    lw    $0, ${1:D}", "r,*m,~{$11}"(i32 undef, ptr elementtype(i32) getelementptr inbounds ([20 x i32], ptr @b, i32 0, i32 3))
; First word. Notice, no 'D':
  tail call void asm sideeffect "    lw    $0, ${1}", "r,*m,~{$11}"(i32 undef, ptr elementtype(i32) getelementptr inbounds ([20 x i32], ptr @b, i32 0, i32 3))

; High-order part.
  tail call void asm sideeffect "    lw    $0, ${1:M}", "r,*m,~{$11}"(i32 undef, ptr elementtype(i32) getelementptr inbounds ([20 x i32], ptr @b, i32 0, i32 3))
; Low-order part.
  tail call void asm sideeffect "    lw    $0, ${1:L}", "r,*m,~{$11}"(i32 undef, ptr elementtype(i32) getelementptr inbounds ([20 x i32], ptr @b, i32 0, i32 3))
  ret void
}