Skip to main content

luaur_code_gen/methods/
assembly_builder_x_64_cmp.rs

1use crate::records::assembly_builder_x_64::AssemblyBuilderX64;
2use crate::records::operand_x_64::OperandX64;
3
4impl AssemblyBuilderX64 {
5    pub fn cmp(&mut self, lhs: OperandX64, rhs: OperandX64) {
6        // C++ `placeBinary("cmp", lhs, rhs, 0x80, 0x81, 0x83, 0x38, 0x39, 0x3a, 0x3b, 7)`.
7        // The original port used the imm-only `place_binary_reg_mem_and_imm`, which
8        // DEBUGBREAKs on reg/reg or reg/mem comparisons (asserts rhs is an imm).
9        self.place_binary(
10            c"cmp".as_ptr(),
11            lhs,
12            rhs,
13            0x80,
14            0x81,
15            0x83,
16            0x38,
17            0x39,
18            0x3a,
19            0x3b,
20            7,
21        );
22    }
23}