1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-objdump -d - | FileCheck %s 2 3// Test that we avoid relaxing these instructions and instead generate versions 4// that use 8-bit immediate values. 5 6bar: 7// CHECK: Disassembly of section imul: 8// CHECK-NEXT: imul: 9// CHECK-NEXT: 0: 66 6b db 80 imulw $-128, %bx, %bx 10// CHECK-NEXT: 4: 66 6b 1c 25 00 00 00 00 7f imulw $127, 0, %bx 11// CHECK-NEXT: d: 6b db 00 imull $0, %ebx, %ebx 12// CHECK-NEXT: 10: 6b 1c 25 00 00 00 00 01 imull $1, 0, %ebx 13// CHECK-NEXT: 18: 48 6b db ff imulq $-1, %rbx, %rbx 14// CHECK-NEXT: 1c: 48 6b 1c 25 00 00 00 00 2a imulq $42, 0, %rbx 15 .section imul,"x" 16 imul $-128, %bx, %bx 17 imul $127, bar, %bx 18 imul $0, %ebx, %ebx 19 imul $1, bar, %ebx 20 imul $-1, %rbx, %rbx 21 imul $42, bar, %rbx 22 23 24// CHECK: Disassembly of section and: 25// CHECK-NEXT: and: 26// CHECK-NEXT: 0: 66 83 e3 7f andw $127, %bx 27// CHECK-NEXT: 4: 66 83 24 25 00 00 00 00 00 andw $0, 0 28// CHECK-NEXT: d: 83 e3 01 andl $1, %ebx 29// CHECK-NEXT: 10: 83 24 25 00 00 00 00 ff andl $-1, 0 30// CHECK-NEXT: 18: 48 83 e3 2a andq $42, %rbx 31// CHECK-NEXT: 1c: 48 83 24 25 00 00 00 00 80 andq $-128, 0 32 .section and,"x" 33 and $127, %bx 34 andw $0, bar 35 and $1, %ebx 36 andl $-1, bar 37 and $42, %rbx 38 andq $-128, bar 39 40// CHECK: Disassembly of section or: 41// CHECK-NEXT: or: 42// CHECK-NEXT: 0: 66 83 cb 00 orw $0, %bx 43// CHECK-NEXT: 4: 66 83 0c 25 00 00 00 00 01 orw $1, 0 44// CHECK-NEXT: d: 83 cb ff orl $-1, %ebx 45// CHECK-NEXT: 10: 83 0c 25 00 00 00 00 2a orl $42, 0 46// CHECK-NEXT: 18: 48 83 cb 80 orq $-128, %rbx 47// CHECK-NEXT: 1c: 48 83 0c 25 00 00 00 00 7f orq $127, 0 48 .section or,"x" 49 or $0, %bx 50 orw $1, bar 51 or $-1, %ebx 52 orl $42, bar 53 or $-128, %rbx 54 orq $127, bar 55 56// CHECK: Disassembly of section xor: 57// CHECK-NEXT: xor: 58// CHECK-NEXT: 0: 66 83 f3 01 xorw $1, %bx 59// CHECK-NEXT: 4: 66 83 34 25 00 00 00 00 ff xorw $-1, 0 60// CHECK-NEXT: d: 83 f3 2a xorl $42, %ebx 61// CHECK-NEXT: 10: 83 34 25 00 00 00 00 80 xorl $-128, 0 62// CHECK-NEXT: 18: 48 83 f3 7f xorq $127, %rbx 63// CHECK-NEXT: 1c: 48 83 34 25 00 00 00 00 00 xorq $0, 0 64 .section xor,"x" 65 xor $1, %bx 66 xorw $-1, bar 67 xor $42, %ebx 68 xorl $-128, bar 69 xor $127, %rbx 70 xorq $0, bar 71 72// CHECK: Disassembly of section add: 73// CHECK-NEXT: add: 74// CHECK-NEXT: 0: 66 83 c3 ff addw $-1, %bx 75// CHECK-NEXT: 4: 66 83 04 25 00 00 00 00 2a addw $42, 0 76// CHECK-NEXT: d: 83 c3 80 addl $-128, %ebx 77// CHECK-NEXT: 10: 83 04 25 00 00 00 00 7f addl $127, 0 78// CHECK-NEXT: 18: 48 83 c3 00 addq $0, %rbx 79// CHECK-NEXT: 1c: 48 83 04 25 00 00 00 00 01 addq $1, 0 80 .section add,"x" 81 add $-1, %bx 82 addw $42, bar 83 add $-128, %ebx 84 addl $127, bar 85 add $0, %rbx 86 addq $1, bar 87 88// CHECK: Disassembly of section sub: 89// CHECK-NEXT: sub: 90// CHECK-NEXT: 0: 66 83 eb 2a subw $42, %bx 91// CHECK-NEXT: 4: 66 83 2c 25 00 00 00 00 80 subw $-128, 0 92// CHECK-NEXT: d: 83 eb 7f subl $127, %ebx 93// CHECK-NEXT: 10: 83 2c 25 00 00 00 00 00 subl $0, 0 94// CHECK-NEXT: 18: 48 83 eb 01 subq $1, %rbx 95// CHECK-NEXT: 1c: 48 83 2c 25 00 00 00 00 ff subq $-1, 0 96 .section sub,"x" 97 sub $42, %bx 98 subw $-128, bar 99 sub $127, %ebx 100 subl $0, bar 101 sub $1, %rbx 102 subq $-1, bar 103 104// CHECK: Disassembly of section cmp: 105// CHECK-NEXT: cmp: 106// CHECK-NEXT: 0: 66 83 fb 80 cmpw $-128, %bx 107// CHECK-NEXT: 4: 66 83 3c 25 00 00 00 00 7f cmpw $127, 0 108// CHECK-NEXT: d: 83 fb 00 cmpl $0, %ebx 109// CHECK-NEXT: 10: 83 3c 25 00 00 00 00 01 cmpl $1, 0 110// CHECK-NEXT: 18: 48 83 fb ff cmpq $-1, %rbx 111// CHECK-NEXT: 1c: 48 83 3c 25 00 00 00 00 2a cmpq $42, 0 112 .section cmp,"x" 113 cmp $-128, %bx 114 cmpw $127, bar 115 cmp $0, %ebx 116 cmpl $1, bar 117 cmp $-1, %rbx 118 cmpq $42, bar 119 120// CHECK: Disassembly of section push: 121// CHECK-NEXT: push: 122// CHECK-NEXT: 0: 66 6a 80 pushw $-128 123// CHECK-NEXT: 3: 66 6a 7f pushw $127 124// CHECK-NEXT: 6: 6a 80 pushq $-128 125// CHECK-NEXT: 8: 6a 7f pushq $127 126 .section push,"x" 127 pushw $-128 128 pushw $127 129 push $-128 130 push $127 131