[all-commits] [llvm/llvm-project] 96b2c3: [X86][MC] Report error when the instruction length...

Shengchen Kan via All-commits all-commits at lists.llvm.org
Mon Mar 4 00:12:52 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 96b2c3bde72ec6b681b03370f9650cfd03e66753
      https://github.com/llvm/llvm-project/commit/96b2c3bde72ec6b681b03370f9650cfd03e66753
  Author: Shengchen Kan <shengchen.kan at intel.com>
  Date:   2024-03-04 (Mon, 04 Mar 2024)

  Changed paths:
    M llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
    A llvm/test/MC/X86/apx/long-instruction-err.s

  Log Message:
  -----------
  [X86][MC] Report error when the instruction length exceeds 15 bytes (#83708)

The instruction-size limit of 15 bytes still applies to APX
instructions.

Note that it is possible for an EVEX-encoded legacy instruction to reach
the 15-byte instruction length limit: 4
bytes of EVEX prefix + 1 byte of opcode + 1 byte of ModRM + 1 byte of
SIB + 4 bytes of displacement + 4 bytes of immediate = 15 bytes in
total, e.g.

```
addq    $184, -96, %rax   # encoding:
[0x62,0xf4,0xfc,0x18,0x81,0x04,0x25,0xa0,0xff,0xff,0xff,0xb8,0x00,0x00,0x00]
```

If we added a segment prefix like fs, the length would be 16.

In such a case, no additional (ASIZE or segment override) prefix can be
used.

To help users find this issue earlier, especially for assembler users,
we change
the internal compiler error to error in this patch.

Diagnostic is aligned with GAS
https://sourceware.org/bugzilla/show_bug.cgi?id=31323



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list