diff --git a/core/rexcode/x86/tests/test.odin b/core/rexcode/x86/tests/test.odin index 6fe3c702c..c97e6e9da 100644 --- a/core/rexcode/x86/tests/test.odin +++ b/core/rexcode/x86/tests/test.odin @@ -3047,24 +3047,30 @@ run_label_map_tests :: proc() { run_benchmarks :: proc() { ITERATIONS :: 10000 - bench_insts := []x86.Instruction{ - x86.inst_r(.PUSH, x86.RBP), - x86.inst_r_r(.MOV, x86.RBP, x86.RSP), - x86.inst_r_i(.SUB, x86.RSP, 0x20, 1), - x86.inst_r_r(.MOV, x86.RAX, x86.RDI), - x86.inst_r_r(.ADD, x86.RAX, x86.RSI), - x86.inst_r_r(.XOR, x86.ECX, x86.ECX), - x86.inst_r_r(.IMUL, x86.RAX, x86.RDX), - x86.inst_r_i(.ADD, x86.RSP, 0x20, 1), - x86.inst_r(.POP, x86.RBP), - x86.inst_none(.RET), - x86.inst_r_r(.MOVAPS, x86.XMM0, x86.XMM1), - x86.inst_r_r(.ADDPS, x86.XMM0, x86.XMM2), - x86.inst_r_r(.VMOVAPS, x86.YMM0, x86.YMM1), - x86.inst_r_r_r(.VADDPS, x86.YMM0, x86.YMM1, x86.YMM2), + bench_insts := make([dynamic]x86.Instruction) + defer delete(bench_insts) + + for _ in 0..<1000 { + insts := []x86.Instruction{ + x86.inst_r(.PUSH, x86.RBP), + x86.inst_r_r(.MOV, x86.RBP, x86.RSP), + x86.inst_r_i(.SUB, x86.RSP, 0x20, 1), + x86.inst_r_r(.MOV, x86.RAX, x86.RDI), + x86.inst_r_r(.ADD, x86.RAX, x86.RSI), + x86.inst_r_r(.XOR, x86.ECX, x86.ECX), + x86.inst_r_r(.IMUL, x86.RAX, x86.RDX), + x86.inst_r_i(.ADD, x86.RSP, 0x20, 1), + x86.inst_r(.POP, x86.RBP), + x86.inst_none(.RET), + x86.inst_r_r(.MOVAPS, x86.XMM0, x86.XMM1), + x86.inst_r_r(.ADDPS, x86.XMM0, x86.XMM2), + x86.inst_r_r(.VMOVAPS, x86.YMM0, x86.YMM1), + x86.inst_r_r_r(.VADDPS, x86.YMM0, x86.YMM1, x86.YMM2), + } + append(&bench_insts, ..insts) } - code_buf: [4096]u8 + code_buf: [16 * 1024]u8 labels: [4]x86.Label_Definition // Encode @@ -3073,7 +3079,7 @@ run_benchmarks :: proc() { for _ in 0..