1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-11-02 13:08:13 +00:00

more low hanging opts (and fix previous cross compiler opt)

This commit is contained in:
Dave Schmenk 2019-12-17 14:52:35 -08:00
parent b81e911857
commit 60e556cc63
7 changed files with 41 additions and 19 deletions

View File

@ -1233,7 +1233,7 @@ int crunch_seq(t_opseq **seq, int pass)
if (opnext->code == BINARY_CODE(SHL_TOKEN))
{
op->code = DUP_CODE;
opnext->code == BINARY_CODE(ADD_TOKEN);
opnext->code = BINARY_CODE(ADD_TOKEN);
break;
}
if (opnext->code == BINARY_CODE(MUL_TOKEN) || opnext->code == BINARY_CODE(DIV_TOKEN))
@ -1465,7 +1465,10 @@ int crunch_seq(t_opseq **seq, int pass)
}
else
{
for (shiftcnt = 0; shiftcnt < 16; shiftcnt++)
//
// Constants 0, 1 and 2 handled above
//
for (shiftcnt = 2; shiftcnt < 16; shiftcnt++)
{
if (op->val == (1 << shiftcnt))
{
@ -1477,7 +1480,10 @@ int crunch_seq(t_opseq **seq, int pass)
}
break;
case BINARY_CODE(DIV_TOKEN):
for (shiftcnt = 0; shiftcnt < 16; shiftcnt++)
//
// Constant 1 handled above
//
for (shiftcnt = 1; shiftcnt < 16; shiftcnt++)
{
if (op->val == (1 << shiftcnt))
{

View File

@ -288,7 +288,7 @@ def crunch_seq(seq, pass)
fin
break
is DIV_CODE
for shiftcnt = 0 to 15
for shiftcnt = 1 to 15
if op=>opval == 1 << shiftcnt
op=>opval = shiftcnt
nextop->opcode = SHR_CODE

View File

@ -109,7 +109,7 @@ COMP LDA #$FF
;* OPCODE TABLE
;*
!ALIGN 255,0
OPTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -388,13 +388,17 @@ LNOT LDA ESTKL,X
STA ESTKH,X
JMP NEXTOP
;*
;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;* CONSTANT -1, ZERO, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;*
MINUS1 DEX
+ LDA #$FF
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CN DEX
LSR ; A = CONST * 2
STA ESTKL,X

View File

@ -132,7 +132,7 @@ VMCORE = *
;* *
;****************
!ALIGN 255,0
OPTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -633,13 +633,17 @@ LNOT LDA ESTKL,X
STA ESTKH,X
JMP NEXTOP
;*
;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;* CONSTANT -1, ZERO, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;*
MINUS1 DEX
+ LDA #$FF
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CN DEX
LSR ; A = CONST * 2
STA ESTKL,X

View File

@ -143,7 +143,7 @@ JENTRY !WORD JITINTRP ; $A0FA
;* OPCODE TABLE
;*
!ALIGN 255,0
OPTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -551,13 +551,17 @@ LNOT LDA ESTKL,X
STA ESTKH,X
JMP NEXTOP
;*
;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;* CONSTANT -1, ZERO, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;*
MINUS1 DEX
+ LDA #$FF
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CN DEX
LSR ; A = CONST * 2
STA ESTKL,X

View File

@ -258,7 +258,7 @@ VMCORE = *
;* *
;****************
!ALIGN 255,0
OPTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -491,7 +491,7 @@ LCDEFCMD = *-28 ; DEFCMD IN LC MEMORY
;* *
;*****************
!ALIGN 255,0
OPXTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPXTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CSX ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -849,14 +849,14 @@ ORI INY ;+INC_IP
;* LOGICAL NOT
;*
LNOT PLA
BEQ MINUS1
PEA $0000
JMP NEXTOP
BNE ZERO
;*
;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;* CONSTANT -1, ZERO, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;*
MINUS1 PEA $FFFF
JMP NEXTOP
ZERO PEA $0000
JMP NEXTOP
CN TXA
LSR ; A = CONST * 2
PHA

View File

@ -206,7 +206,7 @@ VMCORE = *
;* *
;****************
!ALIGN 255,0
OPTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -397,7 +397,7 @@ LCDEFCMD = * ;*-28 ; DEFCMD IN LC MEMORY
;* *
;*****************
!ALIGN 255,0
OPXTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
OPXTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
!WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CSX ; 20 22 24 26 28 2A 2C 2E
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
@ -797,13 +797,17 @@ LNOT LDA ESTKL,X
STA ESTKH,X
JMP NEXTOP
;*
;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;* CONSTANT -1, ZERO, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
;*
MINUS1 DEX
+ LDA #$FF
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CN DEX
LSR ; A = CONST * 2
STA ESTKL,X