summaryrefslogtreecommitdiff
path: root/test/CodeGen/Mips/inlineasmmemop.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/Mips/inlineasmmemop.ll')
-rw-r--r--test/CodeGen/Mips/inlineasmmemop.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/inlineasmmemop.ll b/test/CodeGen/Mips/inlineasmmemop.ll
index 1c7c4437b892c..a08a0243b8b91 100644
--- a/test/CodeGen/Mips/inlineasmmemop.ll
+++ b/test/CodeGen/Mips/inlineasmmemop.ll
@@ -1,5 +1,6 @@
; RUN: llc -march=mipsel < %s | FileCheck %s
+; Simple memory
@g1 = external global i32
define i32 @f1(i32 %x) nounwind {
@@ -21,3 +22,42 @@ entry:
ret i32 %0
}
+; "D": Second word of double word. This works for any memory element
+; double or single.
+; CHECK: #APP
+; CHECK-NEXT: lw ${{[0-9]+}},4(${{[0-9]+}});
+; CHECK-NEXT: #NO_APP
+
+; No "D": First word of double word. This works for any memory element
+; double or single.
+; CHECK: #APP
+; CHECK-NEXT: lw ${{[0-9]+}},0(${{[0-9]+}});
+; CHECK-NEXT: #NO_APP
+
+;int b[8] = {0,1,2,3,4,5,6,7};
+;int main()
+;{
+; int i;
+;
+; // The first word. Notice, no 'D'
+; { asm (
+; "lw %0,%1;\n"
+; : "=r" (i) : "m" (*(b+4)));}
+;
+; // The second word
+; { asm (
+; "lw %0,%D1;\n"
+; : "=r" (i) "m" (*(b+4)));}
+;}
+
+@b = common global [20 x i32] zeroinitializer, align 4
+
+define void @main() {
+entry:
+ 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))
+ tail call void asm sideeffect " lw $0,${1};", "r,*m,~{$11}"(i32 undef, i32* getelementptr inbounds ([20 x i32]* @b, i32 0, i32 3))
+ ret void
+}
+
+attributes #0 = { nounwind }
+