1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=i386-unknown-linux-gnu -o - %s | FileCheck %s
4 ; To match GCC's behavior in assigning 64-bit values to a 32-bit
5 ; register, we bind the a subsequence of 2 registers starting with the
6 ; explicitly given register from the following sequence: EAX, EDX,
7 ; ECX, EBX, ESI, EDI, EBP, ESP, to the value. There is no wrapping
8 ; from the sequence, so this will fail given ESP.
10 define dso_local i64 @test_eax(i64 %in) local_unnamed_addr nounwind {
11 ; CHECK-LABEL: test_eax:
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: movl $-1985229329, %eax # imm = 0x89ABCDEF
14 ; CHECK-NEXT: movl $19088743, %edx # imm = 0x1234567
16 ; CHECK-NEXT: movl %eax, %eax
18 ; CHECK-NEXT: addl $3, %eax
19 ; CHECK-NEXT: movl %eax, %edx
20 ; CHECK-NEXT: sarl $31, %edx
23 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{eax},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
24 %conv = trunc i64 %0 to i32
25 %add = add nsw i32 %conv, 3
26 %conv1 = sext i32 %add to i64
30 define dso_local i64 @test_edx(i64 %in) local_unnamed_addr nounwind {
31 ; CHECK-LABEL: test_edx:
32 ; CHECK: # %bb.0: # %entry
33 ; CHECK-NEXT: movl $-1985229329, %edx # imm = 0x89ABCDEF
34 ; CHECK-NEXT: movl $19088743, %ecx # imm = 0x1234567
36 ; CHECK-NEXT: movl %edx, %eax
38 ; CHECK-NEXT: addl $3, %eax
39 ; CHECK-NEXT: movl %eax, %edx
40 ; CHECK-NEXT: sarl $31, %edx
43 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{edx},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
44 %conv = trunc i64 %0 to i32
45 %add = add nsw i32 %conv, 3
46 %conv1 = sext i32 %add to i64
50 define dso_local i64 @test_ecx(i64 %in) local_unnamed_addr nounwind {
51 ; CHECK-LABEL: test_ecx:
52 ; CHECK: # %bb.0: # %entry
53 ; CHECK-NEXT: pushl %ebx
54 ; CHECK-NEXT: movl $-1985229329, %ecx # imm = 0x89ABCDEF
55 ; CHECK-NEXT: movl $19088743, %ebx # imm = 0x1234567
57 ; CHECK-NEXT: movl %ecx, %eax
59 ; CHECK-NEXT: addl $3, %eax
60 ; CHECK-NEXT: movl %eax, %edx
61 ; CHECK-NEXT: sarl $31, %edx
62 ; CHECK-NEXT: popl %ebx
65 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{ecx},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
66 %conv = trunc i64 %0 to i32
67 %add = add nsw i32 %conv, 3
68 %conv1 = sext i32 %add to i64
72 define dso_local i64 @test_ebx(i64 %in) local_unnamed_addr nounwind {
73 ; CHECK-LABEL: test_ebx:
74 ; CHECK: # %bb.0: # %entry
75 ; CHECK-NEXT: pushl %ebx
76 ; CHECK-NEXT: pushl %esi
77 ; CHECK-NEXT: movl $-1985229329, %ebx # imm = 0x89ABCDEF
78 ; CHECK-NEXT: movl $19088743, %esi # imm = 0x1234567
80 ; CHECK-NEXT: movl %ebx, %eax
82 ; CHECK-NEXT: addl $3, %eax
83 ; CHECK-NEXT: movl %eax, %edx
84 ; CHECK-NEXT: sarl $31, %edx
85 ; CHECK-NEXT: popl %esi
86 ; CHECK-NEXT: popl %ebx
89 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{ebx},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
90 %conv = trunc i64 %0 to i32
91 %add = add nsw i32 %conv, 3
92 %conv1 = sext i32 %add to i64
96 define dso_local i64 @test_esi(i64 %in) local_unnamed_addr nounwind {
97 ; CHECK-LABEL: test_esi:
98 ; CHECK: # %bb.0: # %entry
99 ; CHECK-NEXT: pushl %edi
100 ; CHECK-NEXT: pushl %esi
101 ; CHECK-NEXT: movl $-1985229329, %esi # imm = 0x89ABCDEF
102 ; CHECK-NEXT: movl $19088743, %edi # imm = 0x1234567
104 ; CHECK-NEXT: movl %esi, %eax
105 ; CHECK-NEXT: #NO_APP
106 ; CHECK-NEXT: addl $3, %eax
107 ; CHECK-NEXT: movl %eax, %edx
108 ; CHECK-NEXT: sarl $31, %edx
109 ; CHECK-NEXT: popl %esi
110 ; CHECK-NEXT: popl %edi
113 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{esi},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
114 %conv = trunc i64 %0 to i32
115 %add = add nsw i32 %conv, 3
116 %conv1 = sext i32 %add to i64
120 define dso_local i64 @test_edi(i64 %in) local_unnamed_addr nounwind {
121 ; CHECK-LABEL: test_edi:
122 ; CHECK: # %bb.0: # %entry
123 ; CHECK-NEXT: pushl %ebp
124 ; CHECK-NEXT: pushl %edi
125 ; CHECK-NEXT: movl $-1985229329, %edi # imm = 0x89ABCDEF
126 ; CHECK-NEXT: movl $19088743, %ebp # imm = 0x1234567
128 ; CHECK-NEXT: movl %edi, %eax
129 ; CHECK-NEXT: #NO_APP
130 ; CHECK-NEXT: addl $3, %eax
131 ; CHECK-NEXT: movl %eax, %edx
132 ; CHECK-NEXT: sarl $31, %edx
133 ; CHECK-NEXT: popl %edi
134 ; CHECK-NEXT: popl %ebp
137 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{edi},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
138 %conv = trunc i64 %0 to i32
139 %add = add nsw i32 %conv, 3
140 %conv1 = sext i32 %add to i64
144 define dso_local i64 @test_ebp(i64 %in) local_unnamed_addr nounwind {
145 ; CHECK-LABEL: test_ebp:
146 ; CHECK: # %bb.0: # %entry
147 ; CHECK-NEXT: pushl %ebp
148 ; CHECK-NEXT: movl $19088743, %esp # imm = 0x1234567
149 ; CHECK-NEXT: movl $-1985229329, %ebp # imm = 0x89ABCDEF
151 ; CHECK-NEXT: movl %ebp, %eax
152 ; CHECK-NEXT: #NO_APP
153 ; CHECK-NEXT: addl $3, %eax
154 ; CHECK-NEXT: movl %eax, %edx
155 ; CHECK-NEXT: sarl $31, %edx
156 ; CHECK-NEXT: popl %ebp
159 %0 = tail call i64 asm sideeffect "mov $1, $0", "=r,{ebp},~{dirflag},~{fpsr},~{flags}"(i64 81985529216486895)
160 %conv = trunc i64 %0 to i32
161 %add = add nsw i32 %conv, 3
162 %conv1 = sext i32 %add to i64