relax-arith.s
6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-objdump -d - | FileCheck %s
// Test that we correctly relax these instructions into versions that use
// 16 or 32 bit immediate values.
bar:
// CHECK: Disassembly of section imul:
// CHECK-EMPTY:
// CHECK-NEXT: imul:
// CHECK-NEXT: 0: 66 69 db 00 00 imulw $0, %bx, %bx
// CHECK-NEXT: 5: 66 69 1c 25 00 00 00 00 00 00 imulw $0, 0, %bx
// CHECK-NEXT: f: 69 db 00 00 00 00 imull $0, %ebx, %ebx
// CHECK-NEXT: 15: 69 1c 25 00 00 00 00 00 00 00 00 imull $0, 0, %ebx
// CHECK-NEXT: 20: 48 69 db 00 00 00 00 imulq $0, %rbx, %rbx
// CHECK-NEXT: 27: 48 69 1c 25 00 00 00 00 00 00 00 00 imulq $0, 0, %rbx
.section imul,"x"
imul $foo, %bx, %bx
imul $foo, bar, %bx
imul $foo, %ebx, %ebx
imul $foo, bar, %ebx
imul $foo, %rbx, %rbx
imul $foo, bar, %rbx
// CHECK: Disassembly of section and:
// CHECK-EMPTY:
// CHECK-NEXT: and:
// CHECK-NEXT: 0: 66 81 e3 00 00 andw $0, %bx
// CHECK-NEXT: 5: 66 81 24 25 00 00 00 00 00 00 andw $0, 0
// CHECK-NEXT: f: 81 e3 00 00 00 00 andl $0, %ebx
// CHECK-NEXT: 15: 81 24 25 00 00 00 00 00 00 00 00 andl $0, 0
// CHECK-NEXT: 20: 48 81 e3 00 00 00 00 andq $0, %rbx
// CHECK-NEXT: 27: 48 81 24 25 00 00 00 00 00 00 00 00 andq $0, 0
.section and,"x"
and $foo, %bx
andw $foo, bar
and $foo, %ebx
andl $foo, bar
and $foo, %rbx
andq $foo, bar
// CHECK: Disassembly of section or:
// CHECK-EMPTY:
// CHECK-NEXT: or:
// CHECK-NEXT: 0: 66 81 cb 00 00 orw $0, %bx
// CHECK-NEXT: 5: 66 81 0c 25 00 00 00 00 00 00 orw $0, 0
// CHECK-NEXT: f: 81 cb 00 00 00 00 orl $0, %ebx
// CHECK-NEXT: 15: 81 0c 25 00 00 00 00 00 00 00 00 orl $0, 0
// CHECK-NEXT: 20: 48 81 cb 00 00 00 00 orq $0, %rbx
// CHECK-NEXT: 27: 48 81 0c 25 00 00 00 00 00 00 00 00 orq $0, 0
.section or,"x"
or $foo, %bx
orw $foo, bar
or $foo, %ebx
orl $foo, bar
or $foo, %rbx
orq $foo, bar
// CHECK: Disassembly of section xor:
// CHECK-EMPTY:
// CHECK-NEXT: xor:
// CHECK-NEXT: 0: 66 81 f3 00 00 xorw $0, %bx
// CHECK-NEXT: 5: 66 81 34 25 00 00 00 00 00 00 xorw $0, 0
// CHECK-NEXT: f: 81 f3 00 00 00 00 xorl $0, %ebx
// CHECK-NEXT: 15: 81 34 25 00 00 00 00 00 00 00 00 xorl $0, 0
// CHECK-NEXT: 20: 48 81 f3 00 00 00 00 xorq $0, %rbx
// CHECK-NEXT: 27: 48 81 34 25 00 00 00 00 00 00 00 00 xorq $0, 0
.section xor,"x"
xor $foo, %bx
xorw $foo, bar
xor $foo, %ebx
xorl $foo, bar
xor $foo, %rbx
xorq $foo, bar
// CHECK: Disassembly of section add:
// CHECK-EMPTY:
// CHECK-NEXT: add:
// CHECK-NEXT: 0: 66 81 c3 00 00 addw $0, %bx
// CHECK-NEXT: 5: 66 81 04 25 00 00 00 00 00 00 addw $0, 0
// CHECK-NEXT: f: 81 c3 00 00 00 00 addl $0, %ebx
// CHECK-NEXT: 15: 81 04 25 00 00 00 00 00 00 00 00 addl $0, 0
// CHECK-NEXT: 20: 48 81 c3 00 00 00 00 addq $0, %rbx
// CHECK-NEXT: 27: 48 81 04 25 00 00 00 00 00 00 00 00 addq $0, 0
.section add,"x"
add $foo, %bx
addw $foo, bar
add $foo, %ebx
addl $foo, bar
add $foo, %rbx
addq $foo, bar
// CHECK: Disassembly of section sub:
// CHECK-EMPTY:
// CHECK-NEXT: sub:
// CHECK-NEXT: 0: 66 81 eb 00 00 subw $0, %bx
// CHECK-NEXT: 5: 66 81 2c 25 00 00 00 00 00 00 subw $0, 0
// CHECK-NEXT: f: 81 eb 00 00 00 00 subl $0, %ebx
// CHECK-NEXT: 15: 81 2c 25 00 00 00 00 00 00 00 00 subl $0, 0
// CHECK-NEXT: 20: 48 81 eb 00 00 00 00 subq $0, %rbx
// CHECK-NEXT: 27: 48 81 2c 25 00 00 00 00 00 00 00 00 subq $0, 0
.section sub,"x"
sub $foo, %bx
subw $foo, bar
sub $foo, %ebx
subl $foo, bar
sub $foo, %rbx
subq $foo, bar
// CHECK: Disassembly of section cmp:
// CHECK-EMPTY:
// CHECK-NEXT: cmp:
// CHECK-NEXT: 0: 66 81 fb 00 00 cmpw $0, %bx
// CHECK-NEXT: 5: 66 81 3c 25 00 00 00 00 00 00 cmpw $0, 0
// CHECK-NEXT: f: 81 fb 00 00 00 00 cmpl $0, %ebx
// CHECK-NEXT: 15: 81 3c 25 00 00 00 00 00 00 00 00 cmpl $0, 0
// CHECK-NEXT: 20: 48 81 fb 00 00 00 00 cmpq $0, %rbx
// CHECK-NEXT: 27: 48 81 3c 25 00 00 00 00 00 00 00 00 cmpq $0, 0
.section cmp,"x"
cmp $foo, %bx
cmpw $foo, bar
cmp $foo, %ebx
cmpl $foo, bar
cmp $foo, %rbx
cmpq $foo, bar
// CHECK: Disassembly of section push:
// CHECK-EMPTY:
// CHECK-NEXT: push:
// CHECK-NEXT: 0: 66 68 00 00 pushw $0
// CHECK-NEXT: 4: 68 00 00 00 00 pushq $0
.section push,"x"
pushw $foo
push $foo
// CHECK: Disassembly of section adc:
// CHECK-EMPTY:
// CHECK-NEXT: adc:
// CHECK-NEXT: 0: 66 81 d3 00 00 adcw $0, %bx
// CHECK-NEXT: 5: 66 81 14 25 00 00 00 00 00 00 adcw $0, 0
// CHECK-NEXT: f: 81 d3 00 00 00 00 adcl $0, %ebx
// CHECK-NEXT: 15: 81 14 25 00 00 00 00 00 00 00 00 adcl $0, 0
// CHECK-NEXT: 20: 48 81 d3 00 00 00 00 adcq $0, %rbx
// CHECK-NEXT: 27: 48 81 14 25 00 00 00 00 00 00 00 00 adcq $0, 0
.section adc,"x"
adc $foo, %bx
adcw $foo, bar
adc $foo, %ebx
adcl $foo, bar
adc $foo, %rbx
adcq $foo, bar
// CHECK: Disassembly of section sbb:
// CHECK-EMPTY:
// CHECK-NEXT: sbb:
// CHECK-NEXT: 0: 66 81 db 00 00 sbbw $0, %bx
// CHECK-NEXT: 5: 66 81 1c 25 00 00 00 00 00 00 sbbw $0, 0
// CHECK-NEXT: f: 81 db 00 00 00 00 sbbl $0, %ebx
// CHECK-NEXT: 15: 81 1c 25 00 00 00 00 00 00 00 00 sbbl $0, 0
// CHECK-NEXT: 20: 48 81 db 00 00 00 00 sbbq $0, %rbx
// CHECK-NEXT: 27: 48 81 1c 25 00 00 00 00 00 00 00 00 sbbq $0, 0
.section sbb,"x"
sbb $foo, %bx
sbbw $foo, bar
sbb $foo, %ebx
sbbl $foo, bar
sbb $foo, %rbx
sbbq $foo, bar