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
7 @g1 = external global i32
9 define i32 @f1(i32 %x) nounwind {
13 ; CHECK: sw $4, [[OFFSET:[0-9]+]]($sp)
15 ; CHECK: lw $[[T1:[0-9]+]], %got(g1)
17 ; CHECK: lw $[[T3:[0-9]+]], [[OFFSET]]($sp)
19 ; CHECK: sw $[[T3]], 0($[[T1]])
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
29 ; "D": Second word of a double word. This works for any memory element
32 ; CHECK: lw ${{[0-9]+}}, 16(${{[0-9]+}})
35 ; No "D": First word of a double word. This works for any memory element
38 ; CHECK: lw ${{[0-9]+}}, 12(${{[0-9]+}})
41 ; "M": High-order word of a double word.
43 ; EB: lw ${{[0-9]+}}, 12(${{[0-9]+}})
44 ; EL: lw ${{[0-9]+}}, 16(${{[0-9]+}})
47 ; "L": Low-order word of a double word.
49 ; EB: lw ${{[0-9]+}}, 16(${{[0-9]+}})
50 ; EL: lw ${{[0-9]+}}, 12(${{[0-9]+}})
53 @b = common global [20 x i32] zeroinitializer, align 4
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))
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))
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))