[opaque pointer type] Add textual IR support for explicit type parameter to gep operator
[oota-llvm.git] / test / CodeGen / Mips / inlineasmmemop.ll
1 ; RUN: llc -march=mipsel < %s | FileCheck %s
2
3 ; Simple memory
4 @g1 = external global i32
5
6 define i32 @f1(i32 %x) nounwind {
7 entry:
8 ; CHECK-LABEL: f1:
9 ; CHECK: addiu $[[T0:[0-9]+]], $sp
10 ; CHECK: #APP
11 ; CHECK: sw $4, 0($[[T0]])
12 ; CHECK: #NO_APP
13 ; CHECK: #APP
14 ; CHECK: lw $[[T3:[0-9]+]], 0($[[T0]])
15 ; CHECK: #NO_APP
16 ; CHECK: lw  $[[T1:[0-9]+]], %got(g1)
17 ; CHECK: sw  $[[T3]], 0($[[T1]])
18
19   %l1 = alloca i32, align 4
20   call void asm "sw $1, $0", "=*m,r"(i32* %l1, i32 %x) nounwind
21   %0 = call i32 asm "lw $0, $1", "=r,*m"(i32* %l1) nounwind
22   store i32 %0, i32* @g1, align 4
23   ret i32 %0
24 }
25
26 ; CHECK-LABEL: main:
27 ; "D": Second word of a double word. This works for any memory element
28 ; double or single.
29 ; CHECK: #APP
30 ; CHECK: lw ${{[0-9]+}},4(${{[0-9]+}});
31 ; CHECK: #NO_APP
32
33 ; No "D": First word of a double word. This works for any memory element
34 ; double or single.
35 ; CHECK: #APP
36 ; CHECK: lw ${{[0-9]+}},0(${{[0-9]+}});
37 ; CHECK: #NO_APP
38
39 @b = common global [20 x i32] zeroinitializer, align 4
40
41 define void @main() {
42 entry:
43 ; Second word:
44   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))
45 ; First word. Notice, no 'D':
46   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))
47   ret void
48 }