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 1d 00 00 00 00 00 00 imulw $0, (%rip), %bx 10// CHECK-NEXT: 9: 69 1d 00 00 00 00 00 00 00 00 imull $0, (%rip), %ebx 11// CHECK-NEXT: 13: 48 69 1d 00 00 00 00 00 00 00 00 imulq $0, (%rip), %rbx 12 .section imul,"x" 13 imul $foo, bar(%rip), %bx 14 imul $foo, bar(%rip), %ebx 15 imul $foo, bar(%rip), %rbx 16 17 18// CHECK: Disassembly of section and: 19// CHECK-NEXT: and: 20// CHECK-NEXT: 0: 66 81 25 00 00 00 00 00 00 andw $0, (%rip) 21// CHECK-NEXT: 9: 81 25 00 00 00 00 00 00 00 00 andl $0, (%rip) 22// CHECK-NEXT: 13: 48 81 25 00 00 00 00 00 00 00 00 andq $0, (%rip) 23 .section and,"x" 24 andw $foo, bar(%rip) 25 andl $foo, bar(%rip) 26 andq $foo, bar(%rip) 27 28// CHECK: Disassembly of section or: 29// CHECK-NEXT: or: 30// CHECK-NEXT: 0: 66 81 0d 00 00 00 00 00 00 orw $0, (%rip) 31// CHECK-NEXT: 9: 81 0d 00 00 00 00 00 00 00 00 orl $0, (%rip) 32// CHECK-NEXT: 13: 48 81 0d 00 00 00 00 00 00 00 00 orq $0, (%rip) 33 .section or,"x" 34 orw $foo, bar(%rip) 35 orl $foo, bar(%rip) 36 orq $foo, bar(%rip) 37 38// CHECK: Disassembly of section xor: 39// CHECK-NEXT: xor: 40// CHECK-NEXT: 0: 66 81 35 00 00 00 00 00 00 xorw $0, (%rip) 41// CHECK-NEXT: 9: 81 35 00 00 00 00 00 00 00 00 xorl $0, (%rip) 42// CHECK-NEXT: 13: 48 81 35 00 00 00 00 00 00 00 00 xorq $0, (%rip) 43 .section xor,"x" 44 xorw $foo, bar(%rip) 45 xorl $foo, bar(%rip) 46 xorq $foo, bar(%rip) 47 48// CHECK: Disassembly of section add: 49// CHECK-NEXT: add: 50// CHECK-NEXT: 0: 66 81 05 00 00 00 00 00 00 addw $0, (%rip) 51// CHECK-NEXT: 9: 81 05 00 00 00 00 00 00 00 00 addl $0, (%rip) 52// CHECK-NEXT: 13: 48 81 05 00 00 00 00 00 00 00 00 addq $0, (%rip) 53 .section add,"x" 54 addw $foo, bar(%rip) 55 addl $foo, bar(%rip) 56 addq $foo, bar(%rip) 57 58// CHECK: Disassembly of section sub: 59// CHECK-NEXT: sub: 60// CHECK-NEXT: 0: 66 81 2d 00 00 00 00 00 00 subw $0, (%rip) 61// CHECK-NEXT: 9: 81 2d 00 00 00 00 00 00 00 00 subl $0, (%rip) 62// CHECK-NEXT: 13: 48 81 2d 00 00 00 00 00 00 00 00 subq $0, (%rip) 63 .section sub,"x" 64 subw $foo, bar(%rip) 65 subl $foo, bar(%rip) 66 subq $foo, bar(%rip) 67 68// CHECK: Disassembly of section cmp: 69// CHECK-NEXT: cmp: 70// CHECK-NEXT: 0: 66 81 3d 00 00 00 00 00 00 cmpw $0, (%rip) 71// CHECK-NEXT: 9: 81 3d 00 00 00 00 00 00 00 00 cmpl $0, (%rip) 72// CHECK-NEXT: 13: 48 81 3d 00 00 00 00 00 00 00 00 cmpq $0, (%rip) 73 .section cmp,"x" 74 cmpw $foo, bar(%rip) 75 cmpl $foo, bar(%rip) 76 cmpq $foo, bar(%rip) 77