Home | History | Annotate | Download | only in Mips
      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: #APP
     10 ; CHECK: sw $4, [[OFFSET:[0-9]+]]($sp)
     11 ; CHECK: #NO_APP
     12 ; CHECK: lw  $[[T1:[0-9]+]], %got(g1)
     13 ; CHECK: #APP
     14 ; CHECK: lw $[[T3:[0-9]+]], [[OFFSET]]($sp)
     15 ; CHECK: #NO_APP
     16 ; CHECK: sw  $[[T3]], 0($[[T1]])
     17 
     18   %l1 = alloca i32, align 4
     19   call void asm "sw $1, $0", "=*m,r"(i32* %l1, i32 %x) nounwind
     20   %0 = call i32 asm "lw $0, $1", "=r,*m"(i32* %l1) nounwind
     21   store i32 %0, i32* @g1, align 4
     22   ret i32 %0
     23 }
     24 
     25 ; CHECK-LABEL: main:
     26 ; "D": Second word of a double word. This works for any memory element
     27 ; double or single.
     28 ; CHECK: #APP
     29 ; CHECK: lw ${{[0-9]+}}, 16(${{[0-9]+}})
     30 ; CHECK: #NO_APP
     31 
     32 ; No "D": First word of a double word. This works for any memory element
     33 ; double or single.
     34 ; CHECK: #APP
     35 ; CHECK: lw ${{[0-9]+}}, 12(${{[0-9]+}})
     36 ; CHECK: #NO_APP
     37 
     38 @b = common global [20 x i32] zeroinitializer, align 4
     39 
     40 define void @main() {
     41 entry:
     42 ; Second word:
     43   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))
     44 ; First word. Notice, no 'D':
     45   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))
     46   ret void
     47 }
     48