Skip to content

Commit c489020

Browse files
committed
ZJIT: Restore some A64 backend tests to fix unused warning
1 parent 0bc2435 commit c489020

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

zjit/src/backend/arm64/mod.rs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,14 +1345,30 @@ impl Assembler
13451345
}
13461346
}
13471347

1348-
/*
13491348
#[cfg(test)]
13501349
mod tests {
13511350
use super::*;
1352-
use crate::disasm::*;
1351+
use crate::assertions::assert_disasm;
1352+
1353+
static TEMP_REGS: [Reg; 5] = [X1_REG, X9_REG, X10_REG, X14_REG, X15_REG];
13531354

13541355
fn setup_asm() -> (Assembler, CodeBlock) {
1355-
(Assembler::new(0), CodeBlock::new_dummy(1024))
1356+
(Assembler::new(), CodeBlock::new_dummy())
1357+
}
1358+
1359+
#[test]
1360+
fn test_mul_with_immediate() {
1361+
let (mut asm, mut cb) = setup_asm();
1362+
1363+
let out = asm.mul(Opnd::Reg(TEMP_REGS[1]), 3.into());
1364+
asm.mov(Opnd::Reg(TEMP_REGS[0]), out);
1365+
asm.compile_with_num_regs(&mut cb, 2);
1366+
1367+
assert_disasm!(cb, "600080d2207d009be10300aa", {"
1368+
0x0: mov x0, #3
1369+
0x4: mul x0, x9, x0
1370+
0x8: mov x1, x0
1371+
"});
13561372
}
13571373

13581374
#[test]
@@ -1361,7 +1377,7 @@ mod tests {
13611377

13621378
let opnd = asm.add(Opnd::Reg(X0_REG), Opnd::Reg(X1_REG));
13631379
asm.store(Opnd::mem(64, Opnd::Reg(X2_REG), 0), opnd);
1364-
asm.compile_with_regs(&mut cb, None, vec![X3_REG]);
1380+
asm.compile_with_regs(&mut cb, vec![X3_REG]);
13651381

13661382
// Assert that only 2 instructions were written.
13671383
assert_eq!(8, cb.get_write_pos());
@@ -1425,6 +1441,7 @@ mod tests {
14251441
asm.compile_with_num_regs(&mut cb, 0);
14261442
}
14271443

1444+
/*
14281445
#[test]
14291446
fn test_emit_lea_label() {
14301447
let (mut asm, mut cb) = setup_asm();
@@ -1438,6 +1455,7 @@ mod tests {
14381455
14391456
asm.compile_with_num_regs(&mut cb, 1);
14401457
}
1458+
*/
14411459

14421460
#[test]
14431461
fn test_emit_load_mem_disp_fits_into_load() {
@@ -1648,6 +1666,7 @@ mod tests {
16481666
asm.compile_with_num_regs(&mut cb, 2);
16491667
}
16501668

1669+
/*
16511670
#[test]
16521671
fn test_bcond_straddling_code_pages() {
16531672
const LANDING_PAGE: usize = 65;
@@ -1784,20 +1803,5 @@ mod tests {
17841803
0x8: mov x1, x11
17851804
"});
17861805
}
1787-
1788-
#[test]
1789-
fn test_mul_with_immediate() {
1790-
let (mut asm, mut cb) = setup_asm();
1791-
1792-
let out = asm.mul(Opnd::Reg(TEMP_REGS[1]), 3.into());
1793-
asm.mov(Opnd::Reg(TEMP_REGS[0]), out);
1794-
asm.compile_with_num_regs(&mut cb, 2);
1795-
1796-
assert_disasm!(cb, "6b0080d22b7d0b9be1030baa", {"
1797-
0x0: mov x11, #3
1798-
0x4: mul x11, x9, x11
1799-
0x8: mov x1, x11
1800-
"});
1801-
}
1806+
*/
18021807
}
1803-
*/

0 commit comments

Comments
 (0)