Minimize x86.Instruction size to be 64-bytes rather than 72-bytes

This commit is contained in:
gingerBill
2026-06-15 14:13:56 +01:00
parent b733f7d7a4
commit 61c869833e
2 changed files with 8 additions and 9 deletions

View File

@@ -30,14 +30,14 @@ Rep :: enum u8 {
// -----------------------------------------------------------------------------
Instruction :: struct #packed {
ops: [4]Operand `fmt:"v,operand_count`, // 64 bytes
mnemonic: Mnemonic, // 2 bytes
operand_count: u8, // 1 byte
flags: Instruction_Flags, // 1 byte
length: u8, // 1 byte (filled by decoder, used for iteration)
_pad: [3]u8, // 3 bytes
ops: [4]Operand `fmt:"v,operand_count`, // 48 bytes
mnemonic: Mnemonic, // 2 bytes
operand_count: u8, // 1 byte
flags: Instruction_Flags, // 1 byte
length: u8, // 1 byte (filled by decoder, used for iteration)
_: [11]u8, // 11 bytes
}
#assert(size_of(Instruction) == 72)
#assert(size_of(Instruction) == 64)
// -----------------------------------------------------------------------------
// SECTION: 7.9 Instruction Builder Helpers

View File

@@ -165,9 +165,8 @@ Operand :: struct #packed {
kind: Operand_Kind,
size: u8, // operand size in bytes (1, 2, 4, 8, 16, 32, 64)
flags: Operand_Flags,
_: [4]u8,
}
#assert(size_of(Operand) == 16)
#assert(size_of(Operand) == 12)
// EVEX broadcast mode values for Operand_Flags.broadcast
// Used for EVEX instructions to broadcast a scalar element to all lanes