summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-10-29 18:01:54 +0000
committerChad Rosier <mcrosier@apple.com>2012-10-29 18:01:54 +0000
commit2fbc239e4fbdd12c24fb2cf9e3e915861fc12030 (patch)
tree1c0b3dc46b83959f48b23b7a9464f3105775faaa /test
parent2459bf24274bf039a72db650ebf38cd66911eafc (diff)
downloadllvm-2fbc239e4fbdd12c24fb2cf9e3e915861fc12030.tar.gz
llvm-2fbc239e4fbdd12c24fb2cf9e3e915861fc12030.tar.bz2
llvm-2fbc239e4fbdd12c24fb2cf9e3e915861fc12030.tar.xz
[ms-inline asm] Add support for the [] operator. Essentially, [expr1][expr2] is
equivalent to [expr1 + expr2]. See test cases for more examples. rdar://12470392 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/ms-inline-asm.ll107
-rw-r--r--test/MC/X86/x86-32-ms-inline-asm.s50
2 files changed, 157 insertions, 0 deletions
diff --git a/test/CodeGen/X86/ms-inline-asm.ll b/test/CodeGen/X86/ms-inline-asm.ll
index 24d28adda8..403da3f34e 100644
--- a/test/CodeGen/X86/ms-inline-asm.ll
+++ b/test/CodeGen/X86/ms-inline-asm.ll
@@ -61,3 +61,110 @@ entry:
; CHECK: .att_syntax
; CHECK: {{## InlineAsm End|#NO_APP}}
}
+
+define void @t21() nounwind {
+; CHECK: t21
+entry:
+ br label %foo
+
+foo: ; preds = %entry
+ call void asm sideeffect inteldialect "mov eax, [4*eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [4*eax + 4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [4*eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [4*eax][4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi + eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi + eax]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi][eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi][eax]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi + 4*eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi + 4*eax]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi][4*eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi][4*eax]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi + eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi + eax + 4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi][eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi][eax + 4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi + eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi + eax][4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi][eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi][eax][4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi + 2*eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi + 2*eax + 4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi][2*eax + 4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi][2*eax + 4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi + 2*eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi + 2*eax][4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ call void asm sideeffect inteldialect "mov eax, [esi][2*eax][4]", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
+; CHECK: {{## InlineAsm Start|#APP}}
+; CHECK: .intel_syntax
+; CHECK: mov eax, [esi][2*eax][4]
+; CHECK: .att_syntax
+; CHECK: {{## InlineAsm End|#NO_APP}}
+
+ ret void
+}
diff --git a/test/MC/X86/x86-32-ms-inline-asm.s b/test/MC/X86/x86-32-ms-inline-asm.s
index a5e80b2c93..73d5878b41 100644
--- a/test/MC/X86/x86-32-ms-inline-asm.s
+++ b/test/MC/X86/x86-32-ms-inline-asm.s
@@ -8,3 +8,53 @@ mov [ebx].4, ecx
// CHECK: movl %ecx, 4(%ebx)
// CHECK: encoding: [0x89,0x4b,0x04]
+_t21: ## @t21
+// CHECK: t21
+ mov eax, [4*eax + 4]
+// CHECK: movl 4(,%eax,4), %eax
+// CHECK: # encoding: [0x8b,0x04,0x85,0x04,0x00,0x00,0x00]
+ mov eax, [4*eax][4]
+// CHECK: movl 4(,%eax,4), %eax
+// CHECK: # encoding: [0x8b,0x04,0x85,0x04,0x00,0x00,0x00]
+
+ mov eax, [esi + eax]
+// CHECK: movl (%esi,%eax), %eax
+// CHECK: # encoding: [0x8b,0x04,0x06]
+ mov eax, [esi][eax]
+// CHECK: movl (%esi,%eax), %eax
+// CHECK: # encoding: [0x8b,0x04,0x06]
+
+ mov eax, [esi + 4*eax]
+// CHECK: movl (%esi,%eax,4), %eax
+// CHECK: # encoding: [0x8b,0x04,0x86]
+ mov eax, [esi][4*eax]
+// CHECK: movl (%esi,%eax,4), %eax
+// CHECK: # encoding: [0x8b,0x04,0x86]
+
+ mov eax, [esi + eax + 4]
+// CHECK: movl 4(%esi,%eax), %eax
+// CHECK: # encoding: [0x8b,0x44,0x06,0x04]
+ mov eax, [esi][eax + 4]
+// CHECK: movl 4(%esi,%eax), %eax
+// CHECK: # encoding: [0x8b,0x44,0x06,0x04]
+ mov eax, [esi + eax][4]
+// CHECK: movl 4(%esi,%eax), %eax
+// CHECK: # encoding: [0x8b,0x44,0x06,0x04]
+ mov eax, [esi][eax][4]
+// CHECK: movl 4(%esi,%eax), %eax
+// CHECK: # encoding: [0x8b,0x44,0x06,0x04]
+
+ mov eax, [esi + 2*eax + 4]
+// CHECK: movl 4(%esi,%eax,2), %eax
+// CHECK: # encoding: [0x8b,0x44,0x46,0x04]
+ mov eax, [esi][2*eax + 4]
+// CHECK: movl 4(%esi,%eax,2), %eax
+// CHECK: # encoding: [0x8b,0x44,0x46,0x04]
+ mov eax, [esi + 2*eax][4]
+// CHECK: movl 4(%esi,%eax,2), %eax
+// CHECK: # encoding: [0x8b,0x44,0x46,0x04]
+ mov eax, [esi][2*eax][4]
+// CHECK: movl 4(%esi,%eax,2), %eax
+// CHECK: # encoding: [0x8b,0x44,0x46,0x04]
+
+ ret