llvm.org GIT mirror llvm / 37947c6
test/CodeGen/X86: Add a pattern for Win64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127733 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 8 years ago
7 changed file(s) with 141 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llc < %s -o - -march=x86-64 | FileCheck %s
0 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
1 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
12 ; PR8573
23
34 ; CHECK: foo:
45 ; CHECK: leaq (%rdi), %rax
56 ; CHECK-NEXT: movl %esi, %ecx
67 ; CHECK-NEXT: monitor
8 ; WIN64: foo:
9 ; WIN64: leaq (%rcx), %rax
10 ; WIN64-NEXT: movl %edx, %ecx
11 ; WIN64-NEXT: movl %r8d, %edx
12 ; WIN64-NEXT: monitor
713 define void @foo(i8* %P, i32 %E, i32 %H) nounwind {
814 entry:
915 tail call void @llvm.x86.sse3.monitor(i8* %P, i32 %E, i32 %H)
1622 ; CHECK: movl %edi, %ecx
1723 ; CHECK-NEXT: movl %esi, %eax
1824 ; CHECK-NEXT: mwait
25 ; WIN64: bar:
26 ; WIN64: movl %edx, %eax
27 ; WIN64-NEXT: mwait
1928 define void @bar(i32 %E, i32 %H) nounwind {
2029 entry:
2130 tail call void @llvm.x86.sse3.mwait(i32 %E, i32 %H)
None ; RUN: llc < %s -march=x86-64 > %t
1 ; RUN: grep mov %t | count 6
2 ; RUN: grep {movb %ah, (%rsi)} %t | count 3
3 ; RUN: llc < %s -march=x86 > %t
4 ; RUN: grep mov %t | count 3
5 ; RUN: grep {movb %ah, (%e} %t | count 3
0 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64
1 ; X64: mov
2 ; X64-NEXT: movb %ah, (%rsi)
3 ; X64: mov
4 ; X64-NEXT: movb %ah, (%rsi)
5 ; X64: mov
6 ; X64-NEXT: movb %ah, (%rsi)
7 ; X64-NOT: mov
8
9 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64
10 ; W64-NOT: mov
11 ; W64: movb %ch, (%rdx)
12 ; W64-NOT: mov
13 ; W64: movb %ch, (%rdx)
14 ; W64-NOT: mov
15 ; W64: movb %ch, (%rdx)
16 ; W64-NOT: mov
17
18 ; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32
19 ; X32-NOT: mov
20 ; X32: movb %ah, (%e
21 ; X32-NOT: mov
22 ; X32: movb %ah, (%e
23 ; X32-NOT: mov
24 ; X32: movb %ah, (%e
25 ; X32-NOT: mov
626
727 ; Use h-register extract and store.
828
None ; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X86-64
0 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X86-64
1 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
12 ; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X86-32
23
34 ; Use h registers. On x86-64, codegen doesn't support general allocation
78 ; X86-64: bar64:
89 ; X86-64: shrq $8, %rdi
910 ; X86-64: incb %dil
11
12 ; See FIXME: on regclass GR8.
13 ; It could be optimally transformed like; incb %ch; movb %ch, (%rdx)
14 ; WIN64: bar64:
15 ; WIN64: shrq $8, %rcx
16 ; WIN64: incb %cl
1017
1118 ; X86-32: bar64:
1219 ; X86-32: incb %ah
2229 ; X86-64: shrl $8, %edi
2330 ; X86-64: incb %dil
2431
32 ; WIN64: bar32:
33 ; WIN64: shrl $8, %ecx
34 ; WIN64: incb %cl
35
2536 ; X86-32: bar32:
2637 ; X86-32: incb %ah
2738 %t0 = lshr i32 %x, 8
3546 ; X86-64: bar16:
3647 ; X86-64: shrl $8, %edi
3748 ; X86-64: incb %dil
49
50 ; WIN64: bar16:
51 ; WIN64: shrl $8, %ecx
52 ; WIN64: incb %cl
3853
3954 ; X86-32: bar16:
4055 ; X86-32: incb %ah
5065 ; X86-64: movq %rdi, %rax
5166 ; X86-64: movzbl %ah, %eax
5267
68 ; WIN64: qux64:
69 ; WIN64: movzbl %ch, %eax
70
5371 ; X86-32: qux64:
5472 ; X86-32: movzbl %ah, %eax
5573 %t0 = lshr i64 %x, 8
6179 ; X86-64: qux32:
6280 ; X86-64: movl %edi, %eax
6381 ; X86-64: movzbl %ah, %eax
82
83 ; WIN64: qux32:
84 ; WIN64: movzbl %ch, %eax
6485
6586 ; X86-32: qux32:
6687 ; X86-32: movzbl %ah, %eax
7495 ; X86-64: movl %edi, %eax
7596 ; X86-64: movzbl %ah, %eax
7697
98 ; WIN64: qux16:
99 ; WIN64: movzbl %ch, %eax
100
77101 ; X86-32: qux16:
78102 ; X86-32: movzbl %ah, %eax
79103 %t0 = lshr i16 %x, 8
None ; RUN: llc < %s -march=x86-64 -mattr=+sse2,-sse41 | grep {pshufd \$3, %xmm0, %xmm0}
0 ; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2,-sse41 | FileCheck %s
1 ; CHECK: pshufd $3, %xmm0, %xmm0
2
3 ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2,-sse41 | FileCheck %s -check-prefix=WIN64
4 ; %a is passed indirectly on Win64.
5 ; WIN64: movss 12(%rcx), %xmm0
16
27 define float @foo(<8 x float> %a) nounwind {
38 %c = extractelement <8 x float> %a, i32 3
None ; RUN: llc < %s -march=x86-64 -mattr=+sse41 -asm-verbose=0 | FileCheck %s
0 ; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse41 -asm-verbose=0 | FileCheck %s
1 ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse41 -asm-verbose=0 | FileCheck %s -check-prefix=WIN64
12
23 define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) nounwind {
34 ; CHECK: test1:
45 ; CHECK-NEXT: pmulld
6
7 ; WIN64: test1:
8 ; WIN64-NEXT: movdqa (%rcx), %xmm0
9 ; WIN64-NEXT: pmulld (%rdx), %xmm0
510 %C = mul <4 x i32> %A, %B
611 ret <4 x i32> %C
712 }
914 define <4 x i32> @test1a(<4 x i32> %A, <4 x i32> *%Bp) nounwind {
1015 ; CHECK: test1a:
1116 ; CHECK-NEXT: pmulld
17
18 ; WIN64: test1a:
19 ; WIN64-NEXT: movdqa (%rcx), %xmm0
20 ; WIN64-NEXT: pmulld (%rdx), %xmm0
21
1222 %B = load <4 x i32>* %Bp
1323 %C = mul <4 x i32> %A, %B
1424 ret <4 x i32> %C
None ; RUN: llc < %s -march=x86-64 -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=X64
0 ; RUN: llc < %s -mtriple=x86_64-linux -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=X64
1 ; RUN: llc < %s -mtriple=x86_64-win32 -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=W64
12 ; RUN: llc < %s -mcpu=yonah -march=x86 -asm-verbose=0 -o - | FileCheck %s -check-prefix=X32
23
34 ; PR7518
1314 ; X64-NEXT: addss %xmm0, %xmm1
1415 ; X64-NEXT: movss %xmm1, (%rdi)
1516 ; X64-NEXT: ret
17
18 ; W64: test1:
19 ; W64-NEXT: movdqa (%rcx), %xmm0
20 ; W64-NEXT: pshufd $1, %xmm0, %xmm1
21 ; W64-NEXT: addss %xmm0, %xmm1
22 ; W64-NEXT: movss %xmm1, (%rdx)
23 ; W64-NEXT: ret
1624
1725 ; X32: test1:
1826 ; X32-NEXT: pshufd $1, %xmm0, %xmm1
3038 ; X64: test2:
3139 ; X64-NEXT: addps %xmm1, %xmm0
3240 ; X64-NEXT: ret
41
42 ; W64: test2:
43 ; W64-NEXT: movaps (%rcx), %xmm0
44 ; W64-NEXT: addps (%rdx), %xmm0
45 ; W64-NEXT: ret
46
47 ; X32: test2:
48 ; X32: addps %xmm1, %xmm0
3349 }
3450
3551
3753 %B = shufflevector <4 x float> %A, <4 x float> undef, <2 x i32>
3854 %C = fadd <2 x float> %B, %B
3955 ret <2 x float> %C
40 ; CHECK: test3:
41 ; CHECK-NEXT: addps %xmm0, %xmm0
42 ; CHECK-NEXT: ret
56 ; X64: test3:
57 ; X64-NEXT: addps %xmm0, %xmm0
58 ; X64-NEXT: ret
59
60 ; W64: test3:
61 ; W64-NEXT: movaps (%rcx), %xmm0
62 ; W64-NEXT: addps %xmm0, %xmm0
63 ; W64-NEXT: ret
64
65 ; X32: test3:
66 ; X32-NEXT: addps %xmm0, %xmm0
67 ; X32-NEXT: ret
4368 }
4469
4570 define <2 x float> @test4(<2 x float> %A) nounwind {
4671 %C = fadd <2 x float> %A, %A
4772 ret <2 x float> %C
48 ; CHECK: test4:
49 ; CHECK-NEXT: addps %xmm0, %xmm0
50 ; CHECK-NEXT: ret
73 ; X64: test4:
74 ; X64-NEXT: addps %xmm0, %xmm0
75 ; X64-NEXT: ret
76
77 ; W64: test4:
78 ; W64-NEXT: movaps (%rcx), %xmm0
79 ; W64-NEXT: addps %xmm0, %xmm0
80 ; W64-NEXT: ret
81
82 ; X32: test4:
83 ; X32-NEXT: addps %xmm0, %xmm0
84 ; X32-NEXT: ret
5185 }
5286
5387 define <4 x float> @test5(<4 x float> %A) nounwind {
6094 %E = shufflevector <2 x float> %D, <2 x float> undef, <4 x i32>
6195 ret <4 x float> %E
6296
63 ; CHECK: _test5:
64 ; CHECK-NEXT: addps %xmm0, %xmm0
65 ; CHECK-NEXT: addps %xmm0, %xmm0
66 ; CHECK-NEXT: ret
97 ; X64: test5:
98 ; X64-NEXT: addps %xmm0, %xmm0
99 ; X64-NEXT: addps %xmm0, %xmm0
100 ; X64-NEXT: ret
101
102 ; W64: test5:
103 ; W64-NEXT: movaps (%rcx), %xmm0
104 ; W64-NEXT: addps %xmm0, %xmm0
105 ; W64-NEXT: addps %xmm0, %xmm0
106 ; W64-NEXT: ret
107
108 ; X32: test5:
109 ; X32-NEXT: addps %xmm0, %xmm0
110 ; X32-NEXT: addps %xmm0, %xmm0
111 ; X32-NEXT: ret
67112 }
68113
69114
None ; RUN: llc < %s -o - -march=x86-64 | FileCheck %s
0 ; RUN: llc < %s -o - -mtriple=x86_64-linux | FileCheck %s
1 ; RUN: llc < %s -o - -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
12 ; PR4891
23
34 ; Both loads should happen before either store.
67 ; CHECK: movl (%rsi), %ecx
78 ; CHECK: movl %ecx, (%rdi)
89 ; CHECK: movl %eax, (%rsi)
10
11 ; WIN64: movl (%rcx), %eax
12 ; WIN64: movl (%rdx), %esi
13 ; WIN64: movl %esi, (%rcx)
14 ; WIN64: movl %eax, (%rdx)
915
1016 define void @short2_int_swap(<2 x i16>* nocapture %b, i32* nocapture %c) nounwind {
1117 entry: