mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-27 05:12:50 +00:00
load_imm_64 emitted MOVZ for halfword 0 and then MOVK for zero halfwords it could skip, and never used MOVN, so a small negative constant took four instructions. It now starts from MOVZ or MOVN, whichever leaves more halfwords already correct, at the first halfword that differs, and adds MOVK only for the remaining differing halfwords. On Apple M5 the DBT benchmark emits 245,168 instead of 290,184 native bytes for its 626 blocks (-15.5%) and the 1,048 integer fixture instructions 128,724 instead of 145,732 (-11.7%). Benchmark run times did not change measurably. Tests check the sequences against llvm-mc encodings and execute the edge values plus 512 seeded values, in X0 and X9, on the host through the JIT, checking both the loaded value and the instruction count. Signed-off-by: Bartosz Szczepański <bartosz.szczepanski@hotmail.com>