# RUN: llvm-mc -triple x86_64 -show-encoding -x86-asm-syntax=intel -output-asm-variant=1 %s | FileCheck %s
## R bit
# CHECK: lea r16d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x00]
lea r16d, [rax]
# CHECK: lea r17d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x08]
lea r17d, [rax]
# CHECK: lea r18d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x10]
lea r18d, [rax]
# CHECK: lea r19d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x18]
lea r19d, [rax]
# CHECK: lea r20d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x20]
lea r20d, [rax]
# CHECK: lea r21d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x28]
lea r21d, [rax]
# CHECK: lea r22d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x30]
lea r22d, [rax]
# CHECK: lea r23d, [rax]
# CHECK: encoding: [0xd5,0x40,0x8d,0x38]
lea r23d, [rax]
# CHECK: lea r24d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x00]
lea r24d, [rax]
# CHECK: lea r25d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x08]
lea r25d, [rax]
# CHECK: lea r26d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x10]
lea r26d, [rax]
# CHECK: lea r27d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x18]
lea r27d, [rax]
# CHECK: lea r28d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x20]
lea r28d, [rax]
# CHECK: lea r29d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x28]
lea r29d, [rax]
# CHECK: lea r30d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x30]
lea r30d, [rax]
# CHECK: lea r31d, [rax]
# CHECK: encoding: [0xd5,0x44,0x8d,0x38]
lea r31d, [rax]
## X bit
# CHECK: lea eax, [1*r16]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x05,0x00,0x00,0x00,0x00]
lea eax, [1*r16]
# CHECK: lea eax, [1*r17]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x0d,0x00,0x00,0x00,0x00]
lea eax, [1*r17]
# CHECK: lea eax, [1*r18]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x15,0x00,0x00,0x00,0x00]
lea eax, [1*r18]
# CHECK: lea eax, [1*r19]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x1d,0x00,0x00,0x00,0x00]
lea eax, [1*r19]
# CHECK: lea eax, [1*r20]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x25,0x00,0x00,0x00,0x00]
lea eax, [1*r20]
# CHECK: lea eax, [1*r21]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x2d,0x00,0x00,0x00,0x00]
lea eax, [1*r21]
# CHECK: lea eax, [1*r22]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x35,0x00,0x00,0x00,0x00]
lea eax, [1*r22]
# CHECK: lea eax, [1*r23]
# CHECK: encoding: [0xd5,0x20,0x8d,0x04,0x3d,0x00,0x00,0x00,0x00]
lea eax, [1*r23]
# CHECK: lea eax, [1*r24]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x05,0x00,0x00,0x00,0x00]
lea eax, [1*r24]
# CHECK: lea eax, [1*r25]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x0d,0x00,0x00,0x00,0x00]
lea eax, [1*r25]
# CHECK: lea eax, [1*r26]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x15,0x00,0x00,0x00,0x00]
lea eax, [1*r26]
# CHECK: lea eax, [1*r27]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x1d,0x00,0x00,0x00,0x00]
lea eax, [1*r27]
# CHECK: lea eax, [1*r28]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x25,0x00,0x00,0x00,0x00]
lea eax, [1*r28]
# CHECK: lea eax, [1*r29]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x2d,0x00,0x00,0x00,0x00]
lea eax, [1*r29]
# CHECK: lea eax, [1*r30]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x35,0x00,0x00,0x00,0x00]
lea eax, [1*r30]
# CHECK: lea eax, [1*r31]
# CHECK: encoding: [0xd5,0x22,0x8d,0x04,0x3d,0x00,0x00,0x00,0x00]
lea eax, [1*r31]
## B bit
# CHECK: lea eax, [r16]
# CHECK: encoding: [0xd5,0x10,0x8d,0x00]
lea eax, [r16]
# CHECK: lea eax, [r17]
# CHECK: encoding: [0xd5,0x10,0x8d,0x01]
lea eax, [r17]
# CHECK: lea eax, [r18]
# CHECK: encoding: [0xd5,0x10,0x8d,0x02]
lea eax, [r18]
# CHECK: lea eax, [r19]
# CHECK: encoding: [0xd5,0x10,0x8d,0x03]
lea eax, [r19]
# CHECK: lea eax, [r20]
# CHECK: encoding: [0xd5,0x10,0x8d,0x04,0x24]
lea eax, [r20]
# CHECK: lea eax, [r21]
# CHECK: encoding: [0xd5,0x10,0x8d,0x45,0x00]
lea eax, [r21]
# CHECK: lea eax, [r22]
# CHECK: encoding: [0xd5,0x10,0x8d,0x06]
lea eax, [r22]
# CHECK: lea eax, [r23]
# CHECK: encoding: [0xd5,0x10,0x8d,0x07]
lea eax, [r23]
# CHECK: lea eax, [r24]
# CHECK: encoding: [0xd5,0x11,0x8d,0x00]
lea eax, [r24]
# CHECK: lea eax, [r25]
# CHECK: encoding: [0xd5,0x11,0x8d,0x01]
lea eax, [r25]
# CHECK: lea eax, [r26]
# CHECK: encoding: [0xd5,0x11,0x8d,0x02]
lea eax, [r26]
# CHECK: lea eax, [r27]
# CHECK: encoding: [0xd5,0x11,0x8d,0x03]
lea eax, [r27]
# CHECK: lea eax, [r28]
# CHECK: encoding: [0xd5,0x11,0x8d,0x04,0x24]
lea eax, [r28]
# CHECK: lea eax, [r29]
# CHECK: encoding: [0xd5,0x11,0x8d,0x45,0x00]
lea eax, [r29]
# CHECK: lea eax, [r30]
# CHECK: encoding: [0xd5,0x11,0x8d,0x06]
lea eax, [r30]
# CHECK: lea eax, [r31]
# CHECK: encoding: [0xd5,0x11,0x8d,0x07]
lea eax, [r31]
## SIB
# CHECK: lea eax, [r20 + 1]
# CHECK: encoding: [0xd5,0x10,0x8d,0x44,0x24,0x01]
lea eax, [r20 + 1]
# CHECK: lea eax, [r28 + 1]
# CHECK: encoding: [0xd5,0x11,0x8d,0x44,0x24,0x01]
lea eax, [r28 + 1]
# CHECK: lea eax, [r20 + 129]
# CHECK: encoding: [0xd5,0x10,0x8d,0x84,0x24,0x81,0x00,0x00,0x00]
lea eax, [r20 + 129]
# CHECK: lea eax, [r28 + 129]
# CHECK: encoding: [0xd5,0x11,0x8d,0x84,0x24,0x81,0x00,0x00,0x00]
lea eax, [r28 + 129]
## W bit
# CHECK: lea r16, [rax]
# CHECK: encoding: [0xd5,0x48,0x8d,0x00]
lea r16, [rax]
# CHECK: lea rax, [r16]
# CHECK: encoding: [0xd5,0x18,0x8d,0x00]
lea rax, [r16]
# CHECK: lea rax, [1*r16]
# CHECK: encoding: [0xd5,0x28,0x8d,0x04,0x05,0x00,0x00,0x00,0x00]
lea rax, [1*r16]
## M bit
# CHECK: imul r16d, eax
# CHECK: encoding: [0xd5,0xc0,0xaf,0xc0]
imul r16d, eax