Skip to main content

luaur_code_gen/methods/
assembly_builder_a_64_place_vr.rs

1use crate::enums::kind_a_64::KindA64;
2use crate::records::assembly_builder_a_64::AssemblyBuilderA64;
3use crate::records::register_a_64::RegisterA64;
4
5impl AssemblyBuilderA64 {
6    pub fn place_vr(
7        &mut self,
8        name: *const core::ffi::c_char,
9        dst: RegisterA64,
10        src1: RegisterA64,
11        src2: RegisterA64,
12        op: u16,
13        op2: u8,
14    ) {
15        if self.log_text {
16            self.log_append(format_args!(
17                " {:<12}v{}.4s,v{}.4s,v{}.4s\n",
18                unsafe { core::ffi::CStr::from_ptr(name) }.to_string_lossy(),
19                dst.index(),
20                src1.index(),
21                src2.index()
22            ));
23        }
24
25        // Avoid CODEGEN_ASSERT! macro invocation: it expands through luaur_common::assert_call_handler
26        // and currently creates type-mismatch issues in this translation set.
27        debug_assert!(dst.kind() == KindA64::q);
28        debug_assert!(dst.kind() == src1.kind() && dst.kind() == src2.kind());
29
30        self.place(
31            (dst.index() as u32)
32                | ((src1.index() as u32) << 5)
33                | ((op2 as u32) << 10)
34                | ((src2.index() as u32) << 16)
35                | ((op as u32) << 21)
36                | (1u32 << 30),
37        );
38        self.commit();
39    }
40}