Tweak some tokens in PowerPC ncg.

Remove the GPRINDIRECT token, and use the IND_RC_* tokens as operands
to instructions.  We no longer need to unpack an IND_RC_* token and
repack it as a GPRINDIRECT to use it in an instruction.

Allow storing IND_ALL_B and IND_ALL_H in register variables.  Create a
set ANY_BHW for anything that we can store in a regvar.

Push register variables on the stack without using GPRE, by changing
stwu to accept LOCAL.  Then ncg will replace the string ">>> BUG IN
LOCAL" with the register name.  (I copied ">>> BUG IN LOCAL" from
mach/arm/ncg/table.)

Fix the rule for "pat lil inreg($1)>0" to yield a IND_RC_W token, not
a register.  We might need to kill the token with "kills MEMORY".

Rename CONST_ALL to CONST_STACK, because it only includes constants on
the stack, and excludes CONST tokens.  Instructions still don't allow
CONST_STACK operands, so we still need to repack each CONST_STACK as a
CONST to use it in an instruction.

Rename LABEL_OFFSET_HI to just LABEL_HI, and same for LABEL_HA and
LABEL_HO.
This commit is contained in:
George Koehler 2017-02-08 12:12:28 -05:00
parent 1bf58cf51c
commit 7255ed403f

View file

@ -157,17 +157,16 @@ TOKENS
/* Used only in instruction descriptions (to generate the correct syntax). */ /* Used only in instruction descriptions (to generate the correct syntax). */
GPRINDIRECT = { GPR reg; INT off; } 4 off "(" reg ")".
GPRINDIRECT_OFFSET_LO = { GPR reg; ADDR adr; } 4 "lo16[" adr "](" reg ")". GPRINDIRECT_OFFSET_LO = { GPR reg; ADDR adr; } 4 "lo16[" adr "](" reg ")".
CONST = { INT val; } 4 val. CONST = { INT val; } 4 val.
/* Primitives */ /* Primitives */
LABEL = { ADDR adr; } 4 adr. LABEL = { ADDR adr; } 4 adr.
LABEL_OFFSET_HI = { ADDR adr; } 4 "hi16[" adr "]". LABEL_HI = { ADDR adr; } 4 "hi16[" adr "]".
LABEL_OFFSET_HA = { ADDR adr; } 4 "ha16[" adr "]". LABEL_HA = { ADDR adr; } 4 "ha16[" adr "]".
LABEL_OFFSET_LO = { ADDR adr; } 4 "lo16[" adr "]". LABEL_LO = { ADDR adr; } 4 "lo16[" adr "]".
LOCAL = { INT off; } 4. LOCAL = { INT off; } 4 ">>> BUG IN LOCAL".
/* Allows us to use regvar() to refer to registers */ /* Allows us to use regvar() to refer to registers */
@ -192,15 +191,15 @@ TOKENS
SEX_B = { GPR reg; } 4. SEX_B = { GPR reg; } 4.
SEX_H = { GPR reg; } 4. SEX_H = { GPR reg; } 4.
IND_RC_B = { GPR reg; INT off; } 4. IND_RC_B = { GPR reg; INT off; } 4 off "(" reg ")".
IND_RR_B = { GPR reg1; GPR reg2; } 4. IND_RR_B = { GPR reg1; GPR reg2; } 4.
IND_RC_H = { GPR reg; INT off; } 4. IND_RC_H = { GPR reg; INT off; } 4 off "(" reg ")".
IND_RR_H = { GPR reg1; GPR reg2; } 4. IND_RR_H = { GPR reg1; GPR reg2; } 4.
IND_RC_H_S = { GPR reg; INT off; } 4. IND_RC_H_S = { GPR reg; INT off; } 4 off "(" reg ")".
IND_RR_H_S = { GPR reg1; GPR reg2; } 4. IND_RR_H_S = { GPR reg1; GPR reg2; } 4.
IND_RC_W = { GPR reg; INT off; } 4. IND_RC_W = { GPR reg; INT off; } 4 off "(" reg ")".
IND_RR_W = { GPR reg1; GPR reg2; } 4. IND_RR_W = { GPR reg1; GPR reg2; } 4.
IND_RC_D = { GPR reg; INT off; } 8. IND_RC_D = { GPR reg; INT off; } 8 off "(" reg ")".
IND_RR_D = { GPR reg1; GPR reg2; } 8. IND_RR_D = { GPR reg1; GPR reg2; } 8.
NOT_R = { GPR reg; } 4. NOT_R = { GPR reg; } 4.
@ -237,7 +236,7 @@ SETS
/* unsigned 16-bit integer */ /* unsigned 16-bit integer */
UCONST2 = CONST_0000_7FFF + CONST_8000 + CONST_8001_FFFF. UCONST2 = CONST_0000_7FFF + CONST_8000 + CONST_8001_FFFF.
/* any constant on stack */ /* any constant on stack */
CONST_ALL = CONST_N8000 + CONST_N7FFF_N0001 + CONST_0000_7FFF + CONST_STACK = CONST_N8000 + CONST_N7FFF_N0001 + CONST_0000_7FFF +
CONST_8000 + CONST_8001_FFFF + CONST_HZ + CONST_HL. CONST_8000 + CONST_8001_FFFF + CONST_HZ + CONST_HL.
SUM_ALL = SUM_RC + SUM_RR. SUM_ALL = SUM_RC + SUM_RR.
@ -247,18 +246,19 @@ SETS
LOGICAL_ALL = NOT_R + AND_RR + OR_RR + OR_RC + XOR_RR + LOGICAL_ALL = NOT_R + AND_RR + OR_RR + OR_RC + XOR_RR +
XOR_RC. XOR_RC.
/* indirect 4-byte value */ /* indirect values */
IND_ALL_B = IND_RC_B + IND_RR_B.
IND_ALL_H = IND_RC_H + IND_RR_H + IND_RC_H_S + IND_RR_H_S.
IND_ALL_W = IND_RC_W + IND_RR_W. IND_ALL_W = IND_RC_W + IND_RR_W.
/* indirect 8-byte value */
IND_ALL_D = IND_RC_D + IND_RR_D. IND_ALL_D = IND_RC_D + IND_RR_D.
/* any indirect value that fits in a GPR */ IND_ALL_BHW = IND_ALL_B + IND_ALL_H + IND_ALL_W.
IND_ALL_BHW = IND_RC_B + IND_RR_B + IND_RC_H + IND_RR_H +
IND_RC_H_S + IND_RR_H_S + IND_ALL_W.
/* anything killed by sti (store indirect) */ /* anything killed by sti (store indirect) */
MEMORY = IND_ALL_BHW + IND_ALL_D. MEMORY = IND_ALL_BHW + IND_ALL_D.
OP_ALL_W = SUM_ALL + SEX_ALL + LOGICAL_ALL + IND_ALL_W. /* any stack token that we can easily move to GPR */
ANY_BHW = REG + CONST_STACK + LABEL + SEX_ALL +
SUM_ALL + IND_ALL_BHW + LOGICAL_ALL.
INSTRUCTIONS INSTRUCTIONS
@ -278,7 +278,9 @@ INSTRUCTIONS
add GPR:wo, GPR:ro, GPR:ro. add GPR:wo, GPR:ro, GPR:ro.
addX "add." GPR:wo, GPR:ro, GPR:ro. addX "add." GPR:wo, GPR:ro, GPR:ro.
addi GPR:wo, GPR:ro, CONST:ro. addi GPR:wo, GPR:ro, CONST:ro.
addis GPR:wo, GPR:ro, CONST+LABEL_OFFSET_HI+LABEL_OFFSET_HA:ro. li GPR:wo, CONST:ro.
addis GPR:wo, GPR:ro, CONST+LABEL_HI+LABEL_HA:ro.
lis GPR:wo, CONST+LABEL_HI+LABEL_HA:ro.
and GPR:wo, GPR:ro, GPR:ro. and GPR:wo, GPR:ro, GPR:ro.
andc GPR:wo, GPR:ro, GPR:ro. andc GPR:wo, GPR:ro, GPR:ro.
andiX "andi." GPR:wo:cc, GPR:ro, CONST:ro. andiX "andi." GPR:wo:cc, GPR:ro, CONST:ro.
@ -326,22 +328,22 @@ INSTRUCTIONS
frsp FSREG:wo, FREG:ro cost(4, 5). frsp FSREG:wo, FREG:ro cost(4, 5).
fsub FREG:wo, FREG:ro, FREG:ro cost(4, 5). fsub FREG:wo, FREG:ro, FREG:ro cost(4, 5).
fsubs FSREG:wo, FSREG:ro, FSREG:ro cost(4, 5). fsubs FSREG:wo, FSREG:ro, FSREG:ro cost(4, 5).
lbz GPR:wo, GPRINDIRECT:ro cost(4, 3). lbz GPR:wo, IND_RC_B:ro cost(4, 3).
lbzx GPR:wo, GPR:ro, GPR:ro cost(4, 3). lbzx GPR:wo, GPR:ro, GPR:ro cost(4, 3).
lfd FPR:wo, GPRINDIRECT:ro cost(4, 5). lfd FPR:wo, IND_RC_D:ro cost(4, 5).
lfdu FPR:wo, GPRINDIRECT:ro cost(4, 5). lfdu FPR:wo, IND_RC_D:ro cost(4, 5).
lfdx FPR:wo, GPR:ro, GPR:ro cost(4, 5). lfdx FPR:wo, GPR:ro, GPR:ro cost(4, 5).
lfs FSREG:wo, GPRINDIRECT:ro cost(4, 4). lfs FSREG:wo, IND_RC_W:ro cost(4, 4).
lfsu FSREG:wo, GPRINDIRECT:rw cost(4, 4). lfsu FSREG:wo, IND_RC_W:rw cost(4, 4).
lfsx FSREG:wo, GPR:ro, GPR:ro cost(4, 4). lfsx FSREG:wo, GPR:ro, GPR:ro cost(4, 4).
lha GPR:wo, GPRINDIRECT:ro cost(4, 3). lha GPR:wo, IND_RC_H_S:ro cost(4, 3).
lhax GPR:wo, GPR:ro, GPR:ro cost(4, 3). lhax GPR:wo, GPR:ro, GPR:ro cost(4, 3).
lhz GPR:wo, GPRINDIRECT:ro cost(4, 3). lhz GPR:wo, IND_RC_H:ro cost(4, 3).
lhzx GPR:wo, GPR:ro, GPR:ro cost(4, 3). lhzx GPR:wo, GPR:ro, GPR:ro cost(4, 3).
li32 GPR:wo, CONST:ro cost(8, 2). li32 GPR:wo, CONST:ro cost(8, 2).
lwzu GPR:wo, GPRINDIRECT:ro cost(4, 3). lwzu GPR:wo, IND_RC_W:ro cost(4, 3).
lwzx GPR:wo, GPR:ro, GPR:ro cost(4, 3). lwzx GPR:wo, GPR:ro, GPR:ro cost(4, 3).
lwz GPR:wo, GPRINDIRECT+GPRINDIRECT_OFFSET_LO:ro cost(4, 3). lwz GPR:wo, IND_RC_W+GPRINDIRECT_OFFSET_LO:ro cost(4, 3).
nand GPR:wo, GPR:ro, GPR:ro. nand GPR:wo, GPR:ro, GPR:ro.
neg GPR:wo, GPR:ro. neg GPR:wo, GPR:ro.
nor GPR:wo, GPR:ro, GPR:ro. nor GPR:wo, GPR:ro, GPR:ro.
@ -351,7 +353,7 @@ INSTRUCTIONS
mtspr SPR:wo, GPR:ro cost(4, 2). mtspr SPR:wo, GPR:ro cost(4, 2).
or GPR:wo, GPR:ro, GPR:ro. or GPR:wo, GPR:ro, GPR:ro.
orc GPR:wo, GPR:ro, GPR:ro. orc GPR:wo, GPR:ro, GPR:ro.
ori GPR:wo, GPR:ro, CONST+LABEL_OFFSET_LO:ro. ori GPR:wo, GPR:ro, CONST+LABEL_LO:ro.
oris GPR:wo, GPR:ro, CONST:ro. oris GPR:wo, GPR:ro, CONST:ro.
orX "or." GPR:wo:cc, GPR:ro, GPR:ro. orX "or." GPR:wo:cc, GPR:ro, GPR:ro.
rlwinm GPR:wo, GPR:ro, CONST:ro, CONST:ro, CONST:ro. rlwinm GPR:wo, GPR:ro, CONST:ro, CONST:ro, CONST:ro.
@ -362,19 +364,19 @@ INSTRUCTIONS
sraw GPR:wo, GPR:ro, GPR:ro cost(4, 2). sraw GPR:wo, GPR:ro, GPR:ro cost(4, 2).
srawi GPR:wo, GPR:ro, CONST:ro cost(4, 2). srawi GPR:wo, GPR:ro, CONST:ro cost(4, 2).
srw GPR:wo, GPR:ro, GPR:ro. srw GPR:wo, GPR:ro, GPR:ro.
stb GPR:ro, GPRINDIRECT:rw cost(4, 3). stb GPR:ro, IND_RC_B:rw cost(4, 3).
stbx GPR:ro, GPR:ro, GPR:ro cost(4, 3). stbx GPR:ro, GPR:ro, GPR:ro cost(4, 3).
stfd FPR:ro, GPRINDIRECT:rw cost(4, 4). stfd FPR:ro, IND_RC_D:rw cost(4, 4).
stfdu FPR:ro, GPRINDIRECT:rw cost(4, 4). stfdu FPR:ro, IND_RC_D:rw cost(4, 4).
stfdx FPR:ro, GPR:ro, GPR:ro cost(4, 4). stfdx FPR:ro, GPR:ro, GPR:ro cost(4, 4).
stfs FSREG:ro, GPRINDIRECT:rw cost(4, 3). stfs FSREG:ro, IND_RC_W:rw cost(4, 3).
stfsu FSREG:ro, GPRINDIRECT:rw cost(4, 3). stfsu FSREG:ro, IND_RC_W:rw cost(4, 3).
stfsx FSREG:ro, GPR:ro, GPR:ro cost(4, 3). stfsx FSREG:ro, GPR:ro, GPR:ro cost(4, 3).
sth GPR:ro, GPRINDIRECT:rw cost(4, 3). sth GPR:ro, IND_RC_H:rw cost(4, 3).
sthx GPR:ro, GPR:ro, GPR:ro cost(4, 3). sthx GPR:ro, GPR:ro, GPR:ro cost(4, 3).
stw GPR:ro, GPRINDIRECT:rw cost(4, 3). stw GPR:ro, IND_RC_W:rw cost(4, 3).
stwx GPR:ro, GPR:ro, GPR:ro cost(4, 3). stwx GPR:ro, GPR:ro, GPR:ro cost(4, 3).
stwu GPR+GPRE:ro, GPRINDIRECT:rw cost(4, 3). stwu GPR+LOCAL:ro, IND_RC_W:rw cost(4, 3).
xor GPR:wo, GPR:ro, GPR:ro. xor GPR:wo, GPR:ro, GPR:ro.
xori GPR:wo, GPR:ro, CONST:ro. xori GPR:wo, GPR:ro, CONST:ro.
xoris GPR:wo, GPR:ro, CONST:ro. xoris GPR:wo, GPR:ro, CONST:ro.
@ -390,25 +392,22 @@ MOVES
COMMENT("move GPR->GPR") COMMENT("move GPR->GPR")
or %2, %1, %1 or %2, %1, %1
/* GPRE exists solely to allow us to use regvar() (which can only be used in
an expression) as a register constant. */
from GPR to GPRE
gen
COMMENT("move GPR->GPRE")
or %2.reg, %1, %1
/* Constants */ /* Constants */
from CONST_ALL + CONST smalls(%val) to GPR from CONST + CONST_STACK smalls(%val) to GPR
gen gen
COMMENT("move CONST_ALL->GPR smalls") COMMENT("move CONST->GPR smalls")
addi %2, R0, {CONST, %1.val} li %2, {CONST, %1.val}
from CONST_ALL + CONST to GPR from CONST + CONST_STACK lo(%val)==0 to GPR
gen gen
COMMENT("move CONST_ALL->GPR") COMMENT("move CONST->GPR shifted")
addis %2, R0, {CONST, hi(%1.val)} lis %2, {CONST, hi(%1.val)}
from CONST + CONST_STACK to GPR
gen
COMMENT("move CONST->GPR")
lis %2, {CONST, hi(%1.val)}
ori %2, %2, {CONST, lo(%1.val)} ori %2, %2, {CONST, lo(%1.val)}
/* Can't use addi %2, %2, {CONST, los(%1.val)} /* Can't use addi %2, %2, {CONST, los(%1.val)}
* because %2 might be R0. */ * because %2 might be R0. */
@ -416,8 +415,8 @@ MOVES
from LABEL to GPR from LABEL to GPR
gen gen
COMMENT("move LABEL->GPR") COMMENT("move LABEL->GPR")
addis %2, R0, {LABEL_OFFSET_HI, %1.adr} lis %2, {LABEL_HI, %1.adr}
ori %2, %2, {LABEL_OFFSET_LO, %1.adr} ori %2, %2, {LABEL_LO, %1.adr}
/* Sign extension */ /* Sign extension */
@ -453,7 +452,7 @@ MOVES
from IND_RC_B to GPR from IND_RC_B to GPR
gen gen
COMMENT("move IND_RC_B->GPR") COMMENT("move IND_RC_B->GPR")
lbz %2, {GPRINDIRECT, %1.reg, %1.off} lbz %2, %1
from IND_RR_B to GPR from IND_RR_B to GPR
gen gen
@ -465,7 +464,7 @@ MOVES
from GPR to IND_RC_B from GPR to IND_RC_B
gen gen
COMMENT("move GPR->IND_RC_B") COMMENT("move GPR->IND_RC_B")
stb %1, {GPRINDIRECT, %2.reg, %2.off} stb %1, %2
from GPR to IND_RR_B from GPR to IND_RR_B
gen gen
@ -477,7 +476,7 @@ MOVES
from IND_RC_H to GPR from IND_RC_H to GPR
gen gen
COMMENT("move IND_RC_H->GPR") COMMENT("move IND_RC_H->GPR")
lhz %2, {GPRINDIRECT, %1.reg, %1.off} lhz %2, %1
from IND_RR_H to GPR from IND_RR_H to GPR
gen gen
@ -487,7 +486,7 @@ MOVES
from IND_RC_H_S to GPR from IND_RC_H_S to GPR
gen gen
COMMENT("move IND_RC_H_S->GPR") COMMENT("move IND_RC_H_S->GPR")
lha %2, {GPRINDIRECT, %1.reg, %1.off} lha %2, %1
from IND_RR_H_S to GPR from IND_RR_H_S to GPR
gen gen
@ -499,7 +498,7 @@ MOVES
from GPR to IND_RC_H from GPR to IND_RC_H
gen gen
COMMENT("move GPR->IND_RC_H") COMMENT("move GPR->IND_RC_H")
sth %1, {GPRINDIRECT, %2.reg, %2.off} sth %1, %2
from GPR to IND_RR_H from GPR to IND_RR_H
gen gen
@ -511,7 +510,7 @@ MOVES
from IND_RC_W to GPR from IND_RC_W to GPR
gen gen
COMMENT("move IND_RC_W->GPR") COMMENT("move IND_RC_W->GPR")
lwz %2, {GPRINDIRECT, %1.reg, %1.off} lwz %2, %1
from IND_RR_W to GPR from IND_RR_W to GPR
gen gen
@ -521,7 +520,7 @@ MOVES
from IND_RC_W to FSREG from IND_RC_W to FSREG
gen gen
COMMENT("move IND_RC_W->FSREG") COMMENT("move IND_RC_W->FSREG")
lfs %2, {GPRINDIRECT, %1.reg, %1.off} lfs %2, %1
from IND_RR_W to FSREG from IND_RR_W to FSREG
gen gen
@ -533,7 +532,7 @@ MOVES
from GPR to IND_RC_W from GPR to IND_RC_W
gen gen
COMMENT("move GPR->IND_RC_W") COMMENT("move GPR->IND_RC_W")
stw %1, {GPRINDIRECT, %2.reg, %2.off} stw %1, %2
from GPR to IND_RR_W from GPR to IND_RR_W
gen gen
@ -543,7 +542,7 @@ MOVES
from FSREG to IND_RC_W from FSREG to IND_RC_W
gen gen
COMMENT("move FSREG->IND_RC_W") COMMENT("move FSREG->IND_RC_W")
stfs %1, {GPRINDIRECT, %2.reg, %2.off} stfs %1, %2
from FSREG to IND_RR_W from FSREG to IND_RR_W
gen gen
@ -555,7 +554,7 @@ MOVES
from IND_RC_D to FPR from IND_RC_D to FPR
gen gen
COMMENT("move IND_RC_D->FPR") COMMENT("move IND_RC_D->FPR")
lfd %2, {GPRINDIRECT, %1.reg, %1.off} lfd %2, {IND_RC_D, %1.reg, %1.off}
from IND_RR_D to FPR from IND_RR_D to FPR
gen gen
@ -567,7 +566,7 @@ MOVES
from FPR to IND_RC_D from FPR to IND_RC_D
gen gen
COMMENT("move FPR->IND_RC_D") COMMENT("move FPR->IND_RC_D")
stfd %1, {GPRINDIRECT, %2.reg, %2.off} stfd %1, {IND_RC_D, %2.reg, %2.off}
from FPR to IND_RR_D from FPR to IND_RR_D
gen gen
@ -681,9 +680,10 @@ MOVES
extrwi %2, %1.reg, {CONST, 1}, {CONST, 1} extrwi %2, %1.reg, {CONST, 1}, {CONST, 1}
xori %2, %2, {CONST, 1} xori %2, %2, {CONST, 1}
/* Miscellaneous */ /* GPRE exists solely to allow us to use regvar() (which can only be used in
an expression) as a register constant. */
from OP_ALL_W + LABEL + CONST_ALL to GPRE from ANY_BHW to GPRE
gen gen
move %1, %2.reg move %1, %2.reg
@ -701,64 +701,64 @@ STACKINGRULES
from LOCAL to STACK from LOCAL to STACK
gen gen
COMMENT("stack LOCAL") COMMENT("stack LOCAL")
stwu {GPRE, regvar(%1.off)}, {GPRINDIRECT, SP, 0-4} stwu %1, {IND_RC_W, SP, 0-4}
from REG to STACK from REG to STACK
gen gen
COMMENT("stack REG") COMMENT("stack REG")
stwu %1, {GPRINDIRECT, SP, 0-4} stwu %1, {IND_RC_W, SP, 0-4}
from REG_PAIR to STACK from REG_PAIR to STACK
gen gen
COMMENT("stack REG_PAIR") COMMENT("stack REG_PAIR")
stwu %1.2, {GPRINDIRECT, SP, 0-4} stwu %1.2, {IND_RC_W, SP, 0-4}
stwu %1.1, {GPRINDIRECT, SP, 0-4} stwu %1.1, {IND_RC_W, SP, 0-4}
from CONST_ALL + LABEL to STACK from CONST_STACK + LABEL to STACK
gen gen
COMMENT("stack CONST_ALL + LABEL") COMMENT("stack CONST_STACK + LABEL")
move %1, RSCRATCH move %1, RSCRATCH
stwu RSCRATCH, {GPRINDIRECT, SP, 0-4} stwu RSCRATCH, {IND_RC_W, SP, 0-4}
from SEX_B to STACK from SEX_B to STACK
gen gen
COMMENT("stack SEX_B") COMMENT("stack SEX_B")
extsb RSCRATCH, %1.reg extsb RSCRATCH, %1.reg
stwu RSCRATCH, {GPRINDIRECT, SP, 0-4} stwu RSCRATCH, {IND_RC_W, SP, 0-4}
from SEX_H to STACK from SEX_H to STACK
gen gen
COMMENT("stack SEX_H") COMMENT("stack SEX_H")
extsh RSCRATCH, %1.reg extsh RSCRATCH, %1.reg
stwu RSCRATCH, {GPRINDIRECT, SP, 0-4} stwu RSCRATCH, {IND_RC_W, SP, 0-4}
from SUM_ALL + LOGICAL_ALL to STACK from SUM_ALL + LOGICAL_ALL to STACK
gen gen
COMMENT("stack SUM_ALL + LOGICAL_ALL") COMMENT("stack SUM_ALL + LOGICAL_ALL")
move %1, RSCRATCH move %1, RSCRATCH
stwu RSCRATCH, {GPRINDIRECT, SP, 0-4} stwu RSCRATCH, {IND_RC_W, SP, 0-4}
from IND_ALL_BHW to STACK from IND_ALL_BHW to STACK
gen gen
COMMENT("stack IND_ALL_BHW") COMMENT("stack IND_ALL_BHW")
move %1, RSCRATCH move %1, RSCRATCH
stwu RSCRATCH, {GPRINDIRECT, SP, 0-4} stwu RSCRATCH, {IND_RC_W, SP, 0-4}
from IND_ALL_D to STACK from IND_ALL_D to STACK
gen gen
COMMENT("stack IND_ALL_D") COMMENT("stack IND_ALL_D")
move %1, FSCRATCH move %1, FSCRATCH
stfdu FSCRATCH, {GPRINDIRECT, SP, 0-8} stfdu FSCRATCH, {IND_RC_D, SP, 0-8}
from FREG to STACK from FREG to STACK
gen gen
COMMENT("stack FPR") COMMENT("stack FPR")
stfdu %1, {GPRINDIRECT, SP, 0-8} stfdu %1, {IND_RC_D, SP, 0-8}
from FSREG to STACK from FSREG to STACK
gen gen
COMMENT("stack FSREG") COMMENT("stack FSREG")
stfsu %1, {GPRINDIRECT, SP, 0-4} stfsu %1, {IND_RC_W, SP, 0-4}
@ -771,10 +771,10 @@ COERCIONS
move %1, %a move %1, %a
yields %a yields %a
from CONST_ALL from CONST + CONST_STACK
uses REG uses REG
gen gen
COMMENT("coerce CONST_ALL->REG") COMMENT("coerce CONST->REG")
move %1, %a move %1, %a
yields %a yields %a
@ -789,7 +789,7 @@ COERCIONS
uses REG uses REG
gen gen
COMMENT("coerce STACK->REG") COMMENT("coerce STACK->REG")
lwz %a, {GPRINDIRECT, SP, 0} lwz %a, {IND_RC_W, SP, 0}
addi SP, SP, {CONST, 4} addi SP, SP, {CONST, 4}
yields %a yields %a
@ -797,8 +797,8 @@ COERCIONS
uses REG_PAIR uses REG_PAIR
gen gen
COMMENT("coerce STACK->REG_PAIR") COMMENT("coerce STACK->REG_PAIR")
lwz %a.1, {GPRINDIRECT, SP, 0} lwz %a.1, {IND_RC_W, SP, 0}
lwz %a.2, {GPRINDIRECT, SP, 4} lwz %a.2, {IND_RC_W, SP, 4}
addi SP, SP, {CONST, 8} addi SP, SP, {CONST, 8}
yields %a yields %a
@ -838,7 +838,7 @@ COERCIONS
uses FREG uses FREG
gen gen
COMMENT("coerce STACK->FREG") COMMENT("coerce STACK->FREG")
lfd %a, {GPRINDIRECT, SP, 0} lfd %a, {IND_RC_D, SP, 0}
addi SP, SP, {CONST, 8} addi SP, SP, {CONST, 8}
yields %a yields %a
@ -846,7 +846,7 @@ COERCIONS
uses FSREG uses FSREG
gen gen
COMMENT("coerce STACK->FSREG") COMMENT("coerce STACK->FSREG")
lfs %a, {GPRINDIRECT, SP, 0} lfs %a, {IND_RC_W, SP, 0}
addi SP, SP, {CONST, 4} addi SP, SP, {CONST, 4}
yields %a yields %a
@ -1003,7 +1003,7 @@ PATTERNS
loi INT32*2 loi INT32*2
pat stl inreg($1)>0 /* Store to local */ pat stl inreg($1)>0 /* Store to local */
with CONST_ALL + LABEL + GPR + OP_ALL_W with ANY_BHW
kills regvar($1), LOCAL %off==$1 kills regvar($1), LOCAL %off==$1
gen gen
move %1, {GPRE, regvar($1)} move %1, {GPRE, regvar($1)}
@ -1019,10 +1019,7 @@ PATTERNS
sti INT32*2 sti INT32*2
pat lil inreg($1)>0 /* Load from indirected local */ pat lil inreg($1)>0 /* Load from indirected local */
uses REG yields {IND_RC_W, regvar($1), 0}
gen
lwz %a, {GPRINDIRECT, regvar($1), 0}
yields %a
pat lil /* Load from indirected local */ pat lil /* Load from indirected local */
leaving leaving
@ -1092,17 +1089,17 @@ PATTERNS
kills MEMORY kills MEMORY
uses REG={LABEL, $1}, REG uses REG={LABEL, $1}, REG
gen gen
lwz %b, {GPRINDIRECT, %a, 0} lwz %b, {IND_RC_W, %a, 0}
addi %b, %b, {CONST, 1} addi %b, %b, {CONST, 1}
stw %b, {GPRINDIRECT, %a, 0} stw %b, {IND_RC_W, %a, 0}
pat dee /* Decrement external */ pat dee /* Decrement external */
kills MEMORY kills MEMORY
uses REG={LABEL, $1}, REG uses REG={LABEL, $1}, REG
gen gen
lwz %b, {GPRINDIRECT, %a, 0} lwz %b, {IND_RC_W, %a, 0}
addi %b, %b, {CONST, 0-1} addi %b, %b, {CONST, 0-1}
stw %b, {GPRINDIRECT, %a, 0} stw %b, {IND_RC_W, %a, 0}
@ -1161,7 +1158,7 @@ PATTERNS
with LABEL with LABEL
uses REG uses REG
gen gen
addis %a, R0, {LABEL_OFFSET_HA, %1.adr} lis %a, {LABEL_HA, %1.adr}
lwz %a, {GPRINDIRECT_OFFSET_LO, %a, %1.adr} lwz %a, {GPRINDIRECT_OFFSET_LO, %a, %1.adr}
yields %a yields %a
with GPR with GPR
@ -1194,7 +1191,7 @@ PATTERNS
with GPR GPR with GPR GPR
kills MEMORY kills MEMORY
gen gen
stb %2, {GPRINDIRECT, %1, 0} stb %2, {IND_RC_B, %1, 0}
with SUM_RR GPR with SUM_RR GPR
kills MEMORY kills MEMORY
gen gen
@ -1206,7 +1203,7 @@ PATTERNS
with GPR SEX_B with GPR SEX_B
kills MEMORY kills MEMORY
gen gen
stb %2.reg, {GPRINDIRECT, %1, 0} stb %2.reg, {IND_RC_B, %1, 0}
with SUM_RR SEX_B with SUM_RR SEX_B
kills MEMORY kills MEMORY
gen gen
@ -1220,7 +1217,7 @@ PATTERNS
with GPR GPR with GPR GPR
kills MEMORY kills MEMORY
gen gen
sth %2, {GPRINDIRECT, %1, 0} sth %2, {IND_RC_H, %1, 0}
with SUM_RR GPR with SUM_RR GPR
kills MEMORY kills MEMORY
gen gen
@ -1232,7 +1229,7 @@ PATTERNS
with GPR SEX_H with GPR SEX_H
kills MEMORY kills MEMORY
gen gen
sth %2.reg, {GPRINDIRECT, %1, 0} sth %2.reg, {IND_RC_H, %1, 0}
with SUM_RR SEX_H with SUM_RR SEX_H
kills MEMORY kills MEMORY
gen gen
@ -1381,13 +1378,13 @@ PATTERNS
with REG CONST_HZ with REG CONST_HZ
uses reusing %1, REG={SUM_RIS, %1, his(%2.val)} uses reusing %1, REG={SUM_RIS, %1, his(%2.val)}
yields %a yields %a
with CONST_ALL-CONST2-CONST_HZ REG with CONST_STACK-CONST2-CONST_HZ REG
uses reusing %2, REG={SUM_RIS, %2, his(%1.val)} uses reusing %2, REG={SUM_RIS, %2, his(%1.val)}
yields {SUM_RC, %a, los(%1.val)} yields {SUM_RC, %a, los(%1.val)}
with REG CONST_ALL-CONST2-CONST_HZ with REG CONST_STACK-CONST2-CONST_HZ
uses reusing %1, REG={SUM_RIS, %1, his(%2.val)} uses reusing %1, REG={SUM_RIS, %1, his(%2.val)}
yields {SUM_RC, %a, los(%2.val)} yields {SUM_RC, %a, los(%2.val)}
with CONST_ALL LABEL with CONST_STACK LABEL
yields {LABEL, %2.adr+%1.val} yields {LABEL, %2.adr+%1.val}
pat sbi $1==4 /* Subtract word (second - top) */ pat sbi $1==4 /* Subtract word (second - top) */
@ -1401,10 +1398,10 @@ PATTERNS
with CONST_HZ REG with CONST_HZ REG
uses reusing %2, REG={SUM_RIS, %2, his(0-%1.val)} uses reusing %2, REG={SUM_RIS, %2, his(0-%1.val)}
yields %a yields %a
with CONST_ALL-CONST2_WHEN_NEG-CONST_HZ REG with CONST_STACK-CONST2_WHEN_NEG-CONST_HZ REG
uses reusing %2, REG={SUM_RIS, %2, his(0-%1.val)} uses reusing %2, REG={SUM_RIS, %2, his(0-%1.val)}
yields {SUM_RC, %a, los(0-%1.val)} yields {SUM_RC, %a, los(0-%1.val)}
with CONST_ALL LABEL with CONST_STACK LABEL
yields {LABEL, %2.adr+(0-%1.val)} yields {LABEL, %2.adr+(0-%1.val)}
pat ngi $1==4 /* Negate word */ pat ngi $1==4 /* Negate word */
@ -1519,10 +1516,10 @@ PATTERNS
with CONST_HZ REG with CONST_HZ REG
uses reusing %2, REG={OR_RIS, %2, hi(%1.val)} uses reusing %2, REG={OR_RIS, %2, hi(%1.val)}
yields %a yields %a
with REG CONST_ALL-UCONST2-CONST_HZ with REG CONST_STACK-UCONST2-CONST_HZ
uses reusing %1, REG={OR_RIS, %1, hi(%2.val)} uses reusing %1, REG={OR_RIS, %1, hi(%2.val)}
yields {OR_RC, %1, lo(%2.val)} yields {OR_RC, %1, lo(%2.val)}
with CONST_ALL-UCONST2-CONST_HZ REG with CONST_STACK-UCONST2-CONST_HZ REG
uses reusing %2, REG={OR_RIS, %2, hi(%1.val)} uses reusing %2, REG={OR_RIS, %2, hi(%1.val)}
yields {OR_RC, %2, lo(%1.val)} yields {OR_RC, %2, lo(%1.val)}
@ -1549,10 +1546,10 @@ PATTERNS
with CONST_HZ REG with CONST_HZ REG
uses reusing %2, REG={XOR_RIS, %2, hi(%1.val)} uses reusing %2, REG={XOR_RIS, %2, hi(%1.val)}
yields %a yields %a
with REG CONST_ALL-UCONST2-CONST_HZ with REG CONST_STACK-UCONST2-CONST_HZ
uses reusing %1, REG={XOR_RIS, %1, hi(%2.val)} uses reusing %1, REG={XOR_RIS, %1, hi(%2.val)}
yields {XOR_RC, %1, lo(%2.val)} yields {XOR_RC, %1, lo(%2.val)}
with CONST_ALL-UCONST2-CONST_HZ REG with CONST_STACK-UCONST2-CONST_HZ REG
uses reusing %2, REG={XOR_RIS, %2, hi(%1.val)} uses reusing %2, REG={XOR_RIS, %2, hi(%1.val)}
yields {XOR_RC, %2, lo(%1.val)} yields {XOR_RC, %2, lo(%1.val)}
@ -1601,7 +1598,7 @@ PATTERNS
cal ".zer" cal ".zer"
pat sli $1==4 /* Shift left (second << top) */ pat sli $1==4 /* Shift left (second << top) */
with CONST_ALL GPR with CONST_STACK GPR
uses reusing %2, REG uses reusing %2, REG
gen gen
rlwinm %a, %2, {CONST, (%1.val & 0x1F)}, {CONST, 0}, {CONST, 31-(%1.val & 0x1F)} rlwinm %a, %2, {CONST, (%1.val & 0x1F)}, {CONST, 0}, {CONST, 31-(%1.val & 0x1F)}
@ -1613,7 +1610,7 @@ PATTERNS
yields %a yields %a
pat sri $1==4 /* Shift right signed (second >> top) */ pat sri $1==4 /* Shift right signed (second >> top) */
with CONST_ALL GPR with CONST_STACK GPR
uses reusing %2, REG uses reusing %2, REG
gen gen
srawi %a, %2, {CONST, %1.val & 0x1F} srawi %a, %2, {CONST, %1.val & 0x1F}
@ -1625,7 +1622,7 @@ PATTERNS
yields %a yields %a
pat sru $1==4 /* Shift right unsigned (second >> top) */ pat sru $1==4 /* Shift right unsigned (second >> top) */
with CONST_ALL GPR with CONST_STACK GPR
uses reusing %2, REG uses reusing %2, REG
gen gen
rlwinm %a, %2, {CONST, 32-(%1.val & 0x1F)}, {CONST, (%1.val & 0x1F)}, {CONST, 31} rlwinm %a, %2, {CONST, 32-(%1.val & 0x1F)}, {CONST, (%1.val & 0x1F)}, {CONST, 31}
@ -2121,18 +2118,18 @@ PATTERNS
uses REG uses REG
gen gen
move {CONST, $1}, %a move {CONST, $1}, %a
stwu %a, {GPRINDIRECT, SP, 0-4} stwu %a, {IND_RC_W, SP, 0-4}
stwu %2, {GPRINDIRECT, SP, 0-4} stwu %2, {IND_RC_W, SP, 0-4}
stwu %1, {GPRINDIRECT, SP, 0-4} stwu %1, {IND_RC_W, SP, 0-4}
bl {LABEL, "_memmove"} bl {LABEL, "_memmove"}
addi SP, SP, {CONST, 12} addi SP, SP, {CONST, 12}
pat bls /* Block move variable length */ pat bls /* Block move variable length */
with GPR GPR GPR STACK with GPR GPR GPR STACK
gen gen
stwu %1, {GPRINDIRECT, SP, 0-4} stwu %1, {IND_RC_W, SP, 0-4}
stwu %3, {GPRINDIRECT, SP, 0-4} stwu %3, {IND_RC_W, SP, 0-4}
stwu %2, {GPRINDIRECT, SP, 0-4} stwu %2, {IND_RC_W, SP, 0-4}
bl {LABEL, "_memmove"} bl {LABEL, "_memmove"}
addi SP, SP, {CONST, 12} addi SP, SP, {CONST, 12}
@ -2198,7 +2195,7 @@ PATTERNS
with GPR with GPR
uses reusing %1, REG uses reusing %1, REG
gen gen
lwz %a, {GPRINDIRECT, %1, FP_OFFSET} lwz %a, {IND_RC_W, %1, FP_OFFSET}
yields %a yields %a
pat lpb /* Convert FP to argument address */ pat lpb /* Convert FP to argument address */
@ -2256,7 +2253,7 @@ PATTERNS
with CONST_HZ STACK with CONST_HZ STACK
gen gen
move {SUM_RC, SP, his(%1.val)}, SP move {SUM_RC, SP, his(%1.val)}, SP
with CONST_ALL-CONST2-CONST_HZ STACK with CONST_STACK-CONST2-CONST_HZ STACK
gen gen
move {SUM_RC, SP, his(%1.val)}, SP move {SUM_RC, SP, his(%1.val)}, SP
move {SUM_RC, SP, los(%1.val)}, SP move {SUM_RC, SP, los(%1.val)}, SP