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: addiu $[[T0:[0-9]+]], $sp
      9 ; CHECK: #APP
     10 ; CHECK: sw $4, 0($[[T0]])
     11 ; CHECK: #NO_APP
     12 ; CHECK: #APP
     13 ; CHECK: lw $[[T3:[0-9]+]], 0($[[T0]])
     14 ; CHECK: #NO_APP
     15 ; CHECK: lw  $[[T1:[0-9]+]], %got(g1)
     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 ; "D": Second word of double word. This works for any memory element
     26 ; double or single.
     27 ; CHECK: #APP
     28 ; CHECK-NEXT: lw ${{[0-9]+}},4(${{[0-9]+}});
     29 ; CHECK-NEXT: #NO_APP
     30 
     31 ; No "D": First word of double word. This works for any memory element 
     32 ; double or single.
     33 ; CHECK: #APP
     34 ; CHECK-NEXT: lw ${{[0-9]+}},0(${{[0-9]+}});
     35 ; CHECK-NEXT: #NO_APP
     36 
     37 ;int b[8] = {0,1,2,3,4,5,6,7};
     38 ;int main()
     39 ;{
     40 ;  int i;
     41 ; 
     42 ;  // The first word. Notice, no 'D'
     43 ;  { asm (
     44 ;    "lw    %0,%1;\n"
     45 ;    : "=r" (i) : "m" (*(b+4)));}
     46 ; 
     47 ;  // The second word
     48 ;  { asm (
     49 ;    "lw    %0,%D1;\n"
     50 ;    : "=r" (i) "m" (*(b+4)));}
     51 ;}
     52 
     53 @b = common global [20 x i32] zeroinitializer, align 4
     54 
     55 define void @main() {
     56 entry:
     57   tail call void asm sideeffect "    lw    $0,${1:D};", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32]* @b, i32 0, i32 3))
     58   tail call void asm sideeffect "    lw    $0,${1};", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32]* @b, i32 0, i32 3))
     59   ret void
     60 }
     61 
     62 attributes #0 = { nounwind }
     63 
     64