1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-18 16:37:23 +00:00

Add optimization for multiply by 3

This commit is contained in:
David Schmenk 2025-01-02 07:25:21 -08:00
parent e1f0cf9164
commit 5883fc8fae
3 changed files with 9 additions and 0 deletions

Binary file not shown.

View File

@ -1469,6 +1469,11 @@ int crunch_seq(t_opseq **seq, int pass)
op->code = DUP_CODE;
opnext->code = BINARY_CODE(ADD_TOKEN);
}
else if (op->val == 3)
{
op->code = DUP_CODE;
opnext->code = BINARY_CODE(INDEXW_CODE);
}
else
{
//

View File

@ -278,6 +278,10 @@ def crunch_seq(seq, pass)
op->opcode = DUP_CODE
op->opgroup = STACK_GROUP
nextop->opcode = ADD_CODE
elsif op=>opval == 3
op->opcode = DUP_CODE
op->opgroup = STACK_GROUP
nextop->opcode = INDEXW_CODE
else
for shiftcnt = 2 to 15
if op=>opval == 1 << shiftcnt