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