1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump  --dump-section-data | 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: 'imul'
8// CHECK: ('_section_data', '6669db00 0066691c 25000000 00000069 db000000 00691c25 00000000 00000000 4869db00 00000048 691c2500 00000000 000000')
9        .section imul
10        imul $foo, %bx,  %bx
11        imul $foo, bar,  %bx
12        imul $foo, %ebx, %ebx
13        imul $foo, bar,  %ebx
14        imul $foo, %rbx, %rbx
15        imul $foo, bar,  %rbx
16
17// CHECK: and'
18// CHECK:('_section_data', '6681e300 00668124 25000000 00000081 e3000000 00812425 00000000 00000000 4881e300 00000048 81242500 00000000 000000')
19        .section and
20        and  $foo, %bx
21        andw $foo, bar
22        and  $foo, %ebx
23        andl $foo, bar
24        and  $foo, %rbx
25        andq $foo, bar
26
27// CHECK: 'or'
28// CHECK: ('_section_data', '6681cb00 0066810c 25000000 00000081 cb000000 00810c25 00000000 00000000 4881cb00 00000048 810c2500 00000000 000000')
29        .section or
30        or  $foo, %bx
31        orw $foo, bar
32        or  $foo, %ebx
33        orl $foo, bar
34        or  $foo, %rbx
35        orq $foo, bar
36
37// CHECK: 'xor'
38// CHECK: ('_section_data', '6681f300 00668134 25000000 00000081 f3000000 00813425 00000000 00000000 4881f300 00000048 81342500 00000000 000000')
39        .section xor
40        xor  $foo, %bx
41        xorw $foo, bar
42        xor  $foo, %ebx
43        xorl $foo, bar
44        xor  $foo, %rbx
45        xorq $foo, bar
46
47// CHECK: 'add'
48// CHECK: ('_section_data', '6681c300 00668104 25000000 00000081 c3000000 00810425 00000000 00000000 4881c300 00000048 81042500 00000000 000000')
49        .section add
50        add  $foo, %bx
51        addw $foo, bar
52        add  $foo, %ebx
53        addl $foo, bar
54        add  $foo, %rbx
55        addq $foo, bar
56
57// CHECK: 'sub'
58// CHECK: ('_section_data', '6681eb00 0066812c 25000000 00000081 eb000000 00812c25 00000000 00000000 4881eb00 00000048 812c2500 00000000 000000')
59        .section sub
60        sub  $foo, %bx
61        subw $foo, bar
62        sub  $foo, %ebx
63        subl $foo, bar
64        sub  $foo, %rbx
65        subq $foo, bar
66
67// CHECK: 'cmp'
68// CHECK: ('_section_data', '6681fb00 0066813c 25000000 00000081 fb000000 00813c25 00000000 00000000 4881fb00 00000048 813c2500 00000000 000000')
69        .section cmp
70        cmp  $foo, %bx
71        cmpw $foo, bar
72        cmp  $foo, %ebx
73        cmpl $foo, bar
74        cmp  $foo, %rbx
75        cmpq $foo, bar
76