diff --git a/src/arch/x86_64/bits.zig b/src/arch/x86_64/bits.zig index 16361acb4d..f7686fc9f3 100644 --- a/src/arch/x86_64/bits.zig +++ b/src/arch/x86_64/bits.zig @@ -178,25 +178,27 @@ pub const Condition = enum(u5) { } }; -/// The immediate operand of vcvtps2ph. -pub const RoundMode = packed struct(u5) { +/// The immediate operand of vroundss/vroundps/vcvtps2ph. +/// Intel SDM layout: bits 1:0 = rounding mode, bit 2 = use MXCSR.RC, +/// bit 3 = precision exception suppress. +pub const RoundMode = packed struct(u4) { direction: Direction = .mxcsr, precision: enum(u1) { normal = 0b0, inexact = 0b1, } = .normal, - pub const Direction = enum(u4) { + pub const Direction = enum(u3) { /// Round to nearest (even) - nearest = 0b0_00, + nearest = 0b000, /// Round down (toward -∞) - down = 0b0_01, + down = 0b001, /// Round up (toward +∞) - up = 0b0_10, + up = 0b010, /// Round toward zero (truncate) - zero = 0b0_11, + zero = 0b011, /// Use current rounding mode of MXCSR.RC - mxcsr = 0b1_00, + mxcsr = 0b100, }; pub fn imm(mode: RoundMode) Immediate {