Skip to main content

luaur_code_gen/methods/
assembly_builder_x_64_vroundsd.rs

1use crate::enums::rounding_mode_x_64::RoundingModeX64;
2use crate::records::assembly_builder_x_64::AssemblyBuilderX64;
3use crate::records::operand_x_64::OperandX64;
4
5impl AssemblyBuilderX64 {
6    pub fn vroundsd(
7        &mut self,
8        dst: OperandX64,
9        src1: OperandX64,
10        src2: OperandX64,
11        rounding_mode: RoundingModeX64,
12    ) {
13        // C++: placeAvx("vroundsd", dst, src1, src2,
14        //               uint8_t(roundingMode) | kRoundingPrecisionInexact,
15        //               0x0b, false, AVX_0F3A, AVX_66);
16        // kRoundingPrecisionInexact is 0b1000 (0x08), and the opcode map is
17        // AVX_0F3A (normalized from 0x3A), NOT 0.
18        const K_ROUNDING_PRECISION_INEXACT: u8 = 0x08;
19        const CODE: u8 = 0x0b;
20        const AVX_0F3A: u8 = 0x3A;
21        const AVX_66: u8 = 0x66;
22
23        self.place_avx_c_char_operand_x_64_operand_x_64_operand_x_64_u8_u8_bool_u8_u8(
24            b"vroundsd\0".as_ptr() as *const core::ffi::c_char,
25            dst,
26            src1,
27            src2,
28            (rounding_mode as u8) | K_ROUNDING_PRECISION_INEXACT,
29            CODE,
30            false,
31            AVX_0F3A,
32            AVX_66,
33        );
34    }
35}