diff --git a/clang/test/CodeGen/X86/x86-inline-asm-v-constraint.c b/clang/test/CodeGen/X86/inline-asm-constraints.c similarity index 100% rename from clang/test/CodeGen/X86/x86-inline-asm-v-constraint.c rename to clang/test/CodeGen/X86/inline-asm-constraints.c diff --git a/llvm/test/CodeGen/X86/2007-10-28-inlineasm-q-modifier.ll b/llvm/test/CodeGen/X86/2007-10-28-inlineasm-q-modifier.ll deleted file mode 100644 index 335c0bcd5e411..0000000000000 --- a/llvm/test/CodeGen/X86/2007-10-28-inlineasm-q-modifier.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: llc -no-integrated-as < %s -; PR1748 -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @kernel_init(ptr %unused) { -entry: - call void asm sideeffect "foo ${0:q}", "=*imr"( ptr elementtype( i64) null ) - ret i32 0 -} - diff --git a/llvm/test/CodeGen/X86/inline-asm-modifier-q.ll b/llvm/test/CodeGen/X86/asm-modifier-32.ll similarity index 100% rename from llvm/test/CodeGen/X86/inline-asm-modifier-q.ll rename to llvm/test/CodeGen/X86/asm-modifier-32.ll diff --git a/llvm/test/CodeGen/X86/asm-modifier-error.ll b/llvm/test/CodeGen/X86/asm-modifier-error.ll index d16ef65c7dc04..2d942c01fe0de 100644 --- a/llvm/test/CodeGen/X86/asm-modifier-error.ll +++ b/llvm/test/CodeGen/X86/asm-modifier-error.ll @@ -7,3 +7,9 @@ entry: ret void } +;CHECK: error: invalid operand in inline asm: 'vmovd ${1:k}, $0' +define i32 @foo() { +entry: + %0 = tail call i32 asm sideeffect "vmovd ${1:k}, $0", "=r,x,~{dirflag},~{fpsr},~{flags}"(<2 x i64> ) + ret i32 %0 +} diff --git a/llvm/test/CodeGen/X86/asm-modifier-macho.ll b/llvm/test/CodeGen/X86/asm-modifier-macho.ll new file mode 100644 index 0000000000000..4f9124d8e225f --- /dev/null +++ b/llvm/test/CodeGen/X86/asm-modifier-macho.ll @@ -0,0 +1,41 @@ +; RUN: llc < %s | FileCheck %s +; ModuleID = 'asm.c' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9.6" + +define i32 @test1() nounwind { +entry: +; CHECK-LABEL: test1: +; CHECK: movw %gs:6, %ax + %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; [#uses=1] + %0 = zext i16 %asmtmp.i to i32 ; [#uses=1] + ret i32 %0 +} + +define zeroext i16 @test2(i32 %address) nounwind { +entry: +; CHECK-LABEL: test2: +; CHECK: movw %gs:(%eax), %ax + %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; [#uses=1] + ret i16 %asmtmp +} + +@n = global i32 42 ; [#uses=3] +@y = common global i32 0 ; [#uses=3] + +define void @test3() nounwind { +entry: +; CHECK-LABEL: test3: +; CHECK: movl _n, %eax + call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(ptr @n) nounwind + ret void +} + +define void @test4() nounwind { +entry: +; CHECK-LABEL: test4: +; CHECK: movl L_y$non_lazy_ptr, %ecx +; CHECK: movl (%ecx), %eax + call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(ptr @y) nounwind + ret void +} diff --git a/llvm/test/CodeGen/X86/asm-modifier.ll b/llvm/test/CodeGen/X86/asm-modifier.ll index 4f9124d8e225f..c121b46f84506 100644 --- a/llvm/test/CodeGen/X86/asm-modifier.ll +++ b/llvm/test/CodeGen/X86/asm-modifier.ll @@ -1,41 +1,64 @@ -; RUN: llc < %s | FileCheck %s -; ModuleID = 'asm.c' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9.6" +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; RUN: llc -mtriple=i686 < %s | FileCheck %s --check-prefixes=CHECK,32 +; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefixes=CHECK,64 -define i32 @test1() nounwind { -entry: -; CHECK-LABEL: test1: -; CHECK: movw %gs:6, %ax - %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; [#uses=1] - %0 = zext i16 %asmtmp.i to i32 ; [#uses=1] - ret i32 %0 -} +@var = internal global i32 0, align 4 -define zeroext i16 @test2(i32 %address) nounwind { -entry: -; CHECK-LABEL: test2: -; CHECK: movw %gs:(%eax), %ax - %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; [#uses=1] - ret i16 %asmtmp +define dso_local void @test_c() nounwind { +; CHECK-LABEL: test_c: +; CHECK: # %bb.0: +; CHECK-NEXT: #APP +; CHECK-NEXT: #TEST 42 +; CHECK-NEXT: #NO_APP +; CHECK-NEXT: #APP +; CHECK-NEXT: #TEST var +; CHECK-NEXT: #NO_APP +; CHECK-NEXT: ret{{[l|q]}} + tail call void asm sideeffect "#TEST ${0:c}", "i"(i32 42) + tail call void asm sideeffect "#TEST ${0:c}", "i"(ptr nonnull @var) + ret void } -@n = global i32 42 ; [#uses=3] -@y = common global i32 0 ; [#uses=3] +define dso_local void @test_n() nounwind { +; CHECK-LABEL: test_n: +; CHECK: # %bb.0: +; CHECK-NEXT: #APP +; CHECK-NEXT: #TEST 37 +; CHECK-NEXT: #NO_APP +; CHECK-NEXT: ret{{[l|q]}} + tail call void asm sideeffect "#TEST ${0:n}", "i"(i32 -37) + ret void +} -define void @test3() nounwind { +define void @test_q() { +; CHECK-LABEL: test_q: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: #APP +; CHECK-NEXT: #TEST 0 +; CHECK-NEXT: #NO_APP +; CHECK-NEXT: ret{{[l|q]}} entry: -; CHECK-LABEL: test3: -; CHECK: movl _n, %eax - call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(ptr @n) nounwind + call void asm sideeffect "#TEST ${0:q}", "=*imr"( ptr elementtype( i64) null ) ret void } -define void @test4() nounwind { +define void @test_V(ptr %p) { +; 32-LABEL: test_V: +; 32: # %bb.0: # %entry +; 32-NEXT: movl {{[0-9]+}}(%esp), %eax +; 32-NEXT: #APP +; 32-NEXT: calll __x86_indirect_thunk_eax +; 32-NEXT: #NO_APP +; 32-NEXT: retl +; +; 64-LABEL: test_V: +; 64: # %bb.0: # %entry +; 64-NEXT: #APP +; 64-NEXT: callq __x86_indirect_thunk_rdi +; 64-NEXT: #NO_APP +; 64-NEXT: retq entry: -; CHECK-LABEL: test4: -; CHECK: movl L_y$non_lazy_ptr, %ecx -; CHECK: movl (%ecx), %eax - call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(ptr @y) nounwind + tail call void asm sideeffect "call __x86_indirect_thunk_${0:V}", "r,~{dirflag},~{fpsr},~{flags}"(ptr %p) ret void } + diff --git a/llvm/test/CodeGen/X86/inline-asm-bad-modifier.ll b/llvm/test/CodeGen/X86/inline-asm-bad-modifier.ll deleted file mode 100644 index 9f6e84f2f89c6..0000000000000 --- a/llvm/test/CodeGen/X86/inline-asm-bad-modifier.ll +++ /dev/null @@ -1,8 +0,0 @@ -; RUN: not llc -mtriple=x86_64-- < %s 2>&1 | FileCheck %s - -;CHECK: error: invalid operand in inline asm: 'vmovd ${1:k}, $0' -define i32 @foo() { -entry: - %0 = tail call i32 asm sideeffect "vmovd ${1:k}, $0", "=r,x,~{dirflag},~{fpsr},~{flags}"(<2 x i64> ) - ret i32 %0 -} diff --git a/llvm/test/CodeGen/X86/inline-asm-modifier-V.ll b/llvm/test/CodeGen/X86/inline-asm-modifier-V.ll deleted file mode 100644 index 25adc2e3b01a1..0000000000000 --- a/llvm/test/CodeGen/X86/inline-asm-modifier-V.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: llc < %s -mtriple=i686-- -no-integrated-as | FileCheck -check-prefix=X86 %s -; RUN: llc < %s -mtriple=x86_64-- -no-integrated-as | FileCheck -check-prefix=X64 %s - -; If the target does not have 64-bit integer registers, emit 32-bit register -; names. - -; X86: call __x86_indirect_thunk_e{{[abcd]}}x -; X64: call __x86_indirect_thunk_r - -define void @q_modifier(ptr %p) { -entry: - tail call void asm sideeffect "call __x86_indirect_thunk_${0:V}", "r,~{dirflag},~{fpsr},~{flags}"(ptr %p) - ret void -} diff --git a/llvm/test/CodeGen/X86/inline-asm-modifier-c.ll b/llvm/test/CodeGen/X86/inline-asm-modifier-c.ll deleted file mode 100644 index 95f62658483f1..0000000000000 --- a/llvm/test/CodeGen/X86/inline-asm-modifier-c.ll +++ /dev/null @@ -1,18 +0,0 @@ -; RUN: llc -mtriple=x86_64-linux-gnu < %s | FileCheck %s - -; Test that %c works with immediates -; CHECK-LABEL: test_inlineasm_c_output_template0 -; CHECK: #TEST 42 -define dso_local i32 @test_inlineasm_c_output_template0() { - tail call void asm sideeffect "#TEST ${0:c}", "i"(i32 42) - ret i32 42 -} - -; Test that %c works with global address -; CHECK-LABEL: test_inlineasm_c_output_template1 -; CHECK: #TEST baz -@baz = internal global i32 0, align 4 -define dso_local i32 @test_inlineasm_c_output_template1() { - tail call void asm sideeffect "#TEST ${0:c}", "i"(ptr nonnull @baz) - ret i32 42 -} diff --git a/llvm/test/CodeGen/X86/inline-asm-modifier-n.ll b/llvm/test/CodeGen/X86/inline-asm-modifier-n.ll deleted file mode 100644 index 3df7112c8bc59..0000000000000 --- a/llvm/test/CodeGen/X86/inline-asm-modifier-n.ll +++ /dev/null @@ -1,15 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=i686-- -no-integrated-as | FileCheck %s -; rdar://7008959 - -define void @bork() nounwind { -; CHECK-LABEL: bork: -; CHECK: # %bb.0: # %entry -; CHECK-NEXT: #APP -; CHECK-NEXT: BORK 37 -; CHECK-NEXT: #NO_APP -; CHECK-NEXT: retl -entry: - tail call void asm sideeffect "BORK ${0:n}", "i,~{dirflag},~{fpsr},~{flags}"(i32 -37) nounwind - ret void -}