• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=mips -relocation-model=pic < %s \
2; RUN:   | FileCheck --check-prefixes=CHECK,EB %s
3; RUN: llc -march=mipsel -relocation-model=pic < %s \
4; RUN:   | FileCheck --check-prefixes=CHECK,EL %s
5
6; Simple memory
7@g1 = external global i32
8
9define i32 @f1(i32 %x) nounwind {
10entry:
11; CHECK-LABEL: f1:
12; CHECK: #APP
13; CHECK: sw $4, [[OFFSET:[0-9]+]]($sp)
14; CHECK: #NO_APP
15; CHECK: lw  $[[T1:[0-9]+]], %got(g1)
16; CHECK: #APP
17; CHECK: lw $[[T3:[0-9]+]], [[OFFSET]]($sp)
18; CHECK: #NO_APP
19; CHECK: sw  $[[T3]], 0($[[T1]])
20
21  %l1 = alloca i32, align 4
22  call void asm "sw $1, $0", "=*m,r"(i32* %l1, i32 %x) nounwind
23  %0 = call i32 asm "lw $0, $1", "=r,*m"(i32* %l1) nounwind
24  store i32 %0, i32* @g1, align 4
25  ret i32 %0
26}
27
28; CHECK-LABEL: main:
29; "D": Second word of a double word. This works for any memory element
30; double or single.
31; CHECK: #APP
32; CHECK: lw ${{[0-9]+}}, 16(${{[0-9]+}})
33; CHECK: #NO_APP
34
35; No "D": First word of a double word. This works for any memory element
36; double or single.
37; CHECK: #APP
38; CHECK: lw ${{[0-9]+}}, 12(${{[0-9]+}})
39; CHECK: #NO_APP
40
41; "M": High-order word of a double word.
42; CHECK: #APP
43; EB:    lw ${{[0-9]+}}, 12(${{[0-9]+}})
44; EL:    lw ${{[0-9]+}}, 16(${{[0-9]+}})
45; CHECK: #NO_APP
46
47; "L": Low-order word of a double word.
48; CHECK: #APP
49; EB:    lw ${{[0-9]+}}, 16(${{[0-9]+}})
50; EL:    lw ${{[0-9]+}}, 12(${{[0-9]+}})
51; CHECK: #NO_APP
52
53@b = common global [20 x i32] zeroinitializer, align 4
54
55define void @main() {
56entry:
57; Second word:
58  tail call void asm sideeffect "    lw    $0, ${1:D}", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32], [20 x i32]* @b, i32 0, i32 3))
59; First word. Notice, no 'D':
60  tail call void asm sideeffect "    lw    $0, ${1}", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32], [20 x i32]* @b, i32 0, i32 3))
61
62; High-order part.
63  tail call void asm sideeffect "    lw    $0, ${1:M}", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32], [20 x i32]* @b, i32 0, i32 3))
64; Low-order part.
65  tail call void asm sideeffect "    lw    $0, ${1:L}", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32], [20 x i32]* @b, i32 0, i32 3))
66  ret void
67}
68