Skip to content

Commit 09984be

Browse files
committed
X86,test: Improve asm modifier tests
1 parent c099caa commit 09984be

File tree

4 files changed

+75
-49
lines changed

4 files changed

+75
-49
lines changed

llvm/test/CodeGen/X86/2010-07-06-asm-RIP.ll

-21
This file was deleted.
+54-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1-
; RUN: llc < %s | FileCheck %s
2-
; ModuleID = 'asm.c'
3-
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"
4-
target triple = "i386-apple-darwin9.6"
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=i386-apple-darwin9.6 < %s | FileCheck %s --check-prefixes=CHECK,X86
3+
; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s --check-prefixes=CHECK,X64
54

65
define i32 @test1() nounwind {
7-
entry:
86
; CHECK-LABEL: test1:
9-
; CHECK: movw %gs:6, %ax
7+
; CHECK: ## %bb.0: ## %entry
8+
; CHECK-NEXT: ## InlineAsm Start
9+
; CHECK-NEXT: movw %gs:6, %ax
10+
; CHECK-NEXT: ## InlineAsm End
11+
; CHECK-NEXT: movzwl %ax, %eax
12+
; CHECK-NEXT: ret{{[l|q]}}
13+
entry:
1014
%asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; <i16> [#uses=1]
1115
%0 = zext i16 %asmtmp.i to i32 ; <i32> [#uses=1]
1216
ret i32 %0
1317
}
1418

1519
define zeroext i16 @test2(i32 %address) nounwind {
20+
; X86-LABEL: test2:
21+
; X86: ## %bb.0: ## %entry
22+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
23+
; X86-NEXT: ## InlineAsm Start
24+
; X86-NEXT: movw %gs:(%eax), %ax
25+
; X86-NEXT: ## InlineAsm End
26+
; X86-NEXT: movzwl %ax, %eax
27+
; X86-NEXT: retl
28+
;
29+
; X64-LABEL: test2:
30+
; X64: ## %bb.0: ## %entry
31+
; X64-NEXT: ## InlineAsm Start
32+
; X64-NEXT: movw %gs:(%edi), %ax
33+
; X64-NEXT: ## InlineAsm End
34+
; X64-NEXT: movzwl %ax, %eax
35+
; X64-NEXT: retq
1636
entry:
17-
; CHECK-LABEL: test2:
18-
; CHECK: movw %gs:(%eax), %ax
1937
%asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; <i16> [#uses=1]
2038
ret i16 %asmtmp
2139
}
@@ -24,18 +42,41 @@ entry:
2442
@y = common global i32 0 ; <ptr> [#uses=3]
2543

2644
define void @test3() nounwind {
45+
; X86-LABEL: test3:
46+
; X86: ## %bb.0: ## %entry
47+
; X86-NEXT: ## InlineAsm Start
48+
; X86-NEXT: movl _n, %eax
49+
; X86-NEXT: ## InlineAsm End
50+
; X86-NEXT: retl
51+
;
52+
; X64-LABEL: test3:
53+
; X64: ## %bb.0: ## %entry
54+
; X64-NEXT: ## InlineAsm Start
55+
; X64-NEXT: movl _n(%rip), %eax
56+
; X64-NEXT: ## InlineAsm End
57+
; X64-NEXT: retq
2758
entry:
28-
; CHECK-LABEL: test3:
29-
; CHECK: movl _n, %eax
3059
call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(ptr @n) nounwind
3160
ret void
3261
}
3362

3463
define void @test4() nounwind {
64+
; X86-LABEL: test4:
65+
; X86: ## %bb.0: ## %entry
66+
; X86-NEXT: movl L_y$non_lazy_ptr, %ecx
67+
; X86-NEXT: ## InlineAsm Start
68+
; X86-NEXT: movl (%ecx), %eax
69+
; X86-NEXT: ## InlineAsm End
70+
; X86-NEXT: retl
71+
;
72+
; X64-LABEL: test4:
73+
; X64: ## %bb.0: ## %entry
74+
; X64-NEXT: movq _y@GOTPCREL(%rip), %rcx
75+
; X64-NEXT: ## InlineAsm Start
76+
; X64-NEXT: movl (%rcx), %eax
77+
; X64-NEXT: ## InlineAsm End
78+
; X64-NEXT: retq
3579
entry:
36-
; CHECK-LABEL: test4:
37-
; CHECK: movl L_y$non_lazy_ptr, %ecx
38-
; CHECK: movl (%ecx), %eax
3980
call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(ptr @y) nounwind
4081
ret void
4182
}

llvm/test/CodeGen/X86/asm-modifier.ll

+21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
@var = internal global i32 0, align 4
66

7+
define dso_local void @test_a() nounwind {
8+
; CHECK-LABEL: test_a:
9+
; CHECK: # %bb.0:
10+
; CHECK-NEXT: #APP
11+
; CHECK-NEXT: #TEST var#
12+
; CHECK-NEXT: #NO_APP
13+
; CHECK-NEXT: ret{{[l|q]}}
14+
tail call void asm sideeffect "#TEST ${0:c}#", "i"(ptr nonnull @var)
15+
ret void
16+
}
17+
718
define dso_local void @test_c() nounwind {
819
; CHECK-LABEL: test_c:
920
; CHECK: # %bb.0:
@@ -19,6 +30,16 @@ define dso_local void @test_c() nounwind {
1930
ret void
2031
}
2132

33+
define dso_local void @test_k() nounwind {
34+
; CHECK-LABEL: test_k:
35+
; CHECK: # %bb.0:
36+
; CHECK-NEXT: #APP
37+
; CHECK-NEXT: movl %fs:0, %eax
38+
; CHECK-NEXT: #NO_APP
39+
%tmp = tail call i64 asm "movl %fs:${1:a}, ${0:k}", "=q,irm,~{dirflag},~{fpsr},~{flags}"(i64 0)
40+
unreachable
41+
}
42+
2243
define dso_local void @test_n() nounwind {
2344
; CHECK-LABEL: test_n:
2445
; CHECK: # %bb.0:

llvm/test/CodeGen/X86/pr19752.ll

-15
This file was deleted.

0 commit comments

Comments
 (0)