Remove INT32 and such. Adjust indentation.

I understand `loi 4` more easily than `loi INT32`, because `loi 4`
appears in .e files.  So remove INT8, INT16, INT32, INT64.

Add a comment to explain r3 during unconditional jumps.
This commit is contained in:
George Koehler 2017-12-22 21:18:58 -05:00
parent f96f918a29
commit c964eeddba

View file

@ -2,18 +2,12 @@ EM_WSIZE = 4
EM_PSIZE = 4 EM_PSIZE = 4
EM_BSIZE = 8 /* two words saved in call frame */ EM_BSIZE = 8 /* two words saved in call frame */
INT8 = 1 /* Size of values */
INT16 = 2
INT32 = 4
INT64 = 8
FP_OFFSET = 0 /* Offset of saved FP relative to our FP */ FP_OFFSET = 0 /* Offset of saved FP relative to our FP */
PC_OFFSET = 4 /* Offset of saved PC relative to our FP */ PC_OFFSET = 4 /* Offset of saved PC relative to our FP */
#define COMMENT(n) /* comment {LABEL, n} */ #define COMMENT(n) /* comment {LABEL, n} */
#define nicesize(x) ((x)==1 || (x)==2 || (x)==4 || (x)==8)
#define nicesize(x) ((x)==INT8 || (x)==INT16 || (x)==INT32 || (x)==INT64)
#define smalls(n) sfit(n, 16) #define smalls(n) sfit(n, 16)
#define smallu(n) ufit(n, 16) #define smallu(n) ufit(n, 16)
@ -1176,22 +1170,22 @@ PATTERNS
pat loe /* Load word external */ pat loe /* Load word external */
leaving leaving
lae $1 lae $1
loi INT32 loi 4
pat ste /* Store word external */ pat ste /* Store word external */
leaving leaving
lae $1 lae $1
sti INT32 sti 4
pat lde /* Load double-word external */ pat lde /* Load double-word external */
leaving leaving
lae $1 lae $1
loi INT64 loi 8
pat sde /* Store double-word external */ pat sde /* Store double-word external */
leaving leaving
lae $1 lae $1
sti INT64 sti 8
pat zre /* Zero external */ pat zre /* Zero external */
leaving leaving
@ -1216,27 +1210,27 @@ PATTERNS
pat lof /* Load word offsetted */ pat lof /* Load word offsetted */
leaving leaving
adp $1 adp $1
loi INT32 loi 4
pat ldf /* Load double-word offsetted */ pat ldf /* Load double-word offsetted */
leaving leaving
adp $1 adp $1
loi INT64 loi 8
pat stf /* Store word offsetted */ pat stf /* Store word offsetted */
leaving leaving
adp $1 adp $1
sti INT32 sti 4
pat sdf /* Store double-word offsetted */ pat sdf /* Store double-word offsetted */
leaving leaving
adp $1 adp $1
sti INT64 sti 8
/* Loads and stores */ /* Loads and stores */
pat loi $1==INT8 /* Load byte indirect */ pat loi $1==1 /* Load byte indirect */
with REG with REG
yields {IND_RC_B, %1, 0} yields {IND_RC_B, %1, 0}
with exact SUM_RC with exact SUM_RC
@ -1246,8 +1240,8 @@ PATTERNS
with exact SUM_RR with exact SUM_RR
yields {IND_RR_B, %1.reg1, %1.reg2} yields {IND_RR_B, %1.reg1, %1.reg2}
pat loi loc loc cii $1==INT16 && $2==INT16 && $3==INT32 /* Load half-word indirect and sign-extend */
/* Load half-word indirect and sign extend */ pat loi loc loc cii $1==2 && $2==2 && $3==4
with REG with REG
yields {IND_RC_H_S, %1, 0} yields {IND_RC_H_S, %1, 0}
with exact SUM_RC with exact SUM_RC
@ -1257,7 +1251,7 @@ PATTERNS
with exact SUM_RR with exact SUM_RR
yields {IND_RR_H_S, %1.reg1, %1.reg2} yields {IND_RR_H_S, %1.reg1, %1.reg2}
pat loi $1==INT16 /* Load half-word indirect */ pat loi $1==2 /* Load half-word indirect */
with REG with REG
yields {IND_RC_H, %1, 0} yields {IND_RC_H, %1, 0}
with exact SUM_RC with exact SUM_RC
@ -1267,7 +1261,7 @@ PATTERNS
with exact SUM_RR with exact SUM_RR
yields {IND_RR_H, %1.reg1, %1.reg2} yields {IND_RR_H, %1.reg1, %1.reg2}
pat loi $1==INT32 /* Load word indirect */ pat loi $1==4 /* Load word indirect */
with REG with REG
yields {IND_RC_W, %1, 0} yields {IND_RC_W, %1, 0}
with exact SUM_RC with exact SUM_RC
@ -1277,7 +1271,7 @@ PATTERNS
with exact SUM_RR with exact SUM_RR
yields {IND_RR_W, %1.reg1, %1.reg2} yields {IND_RR_W, %1.reg1, %1.reg2}
pat loi $1==INT64 /* Load double-word indirect */ pat loi $1==8 /* Load double-word indirect */
with REG with REG
yields {IND_RC_D, %1, 0} yields {IND_RC_D, %1, 0}
with exact SUM_RC with exact SUM_RC
@ -1295,10 +1289,9 @@ PATTERNS
pat los $1==4 /* Load arbitrary size */ pat los $1==4 /* Load arbitrary size */
with REG3 STACK with REG3 STACK
kills ALL kills ALL
gen gen bl {LABEL, ".los4"}
bl {LABEL, ".los4"}
pat sti $1==INT8 /* Store byte indirect */ pat sti $1==1 /* Store byte indirect */
with REG REG with REG REG
kills MEMORY kills MEMORY
gen move %2, {IND_RC_B, %1, 0} gen move %2, {IND_RC_B, %1, 0}
@ -1312,7 +1305,7 @@ PATTERNS
kills MEMORY kills MEMORY
gen move %2, {IND_RR_B, %1.reg1, %1.reg2} gen move %2, {IND_RR_B, %1.reg1, %1.reg2}
pat sti $1==INT16 /* Store half-word indirect */ pat sti $1==2 /* Store half-word indirect */
with REG REG with REG REG
kills MEMORY kills MEMORY
gen move %2, {IND_RC_H, %1, 0} gen move %2, {IND_RC_H, %1, 0}
@ -1326,7 +1319,7 @@ PATTERNS
kills MEMORY kills MEMORY
gen move %2, {IND_RR_H, %1.reg1, %1.reg2} gen move %2, {IND_RR_H, %1.reg1, %1.reg2}
pat sti $1==INT32 /* Store word indirect */ pat sti $1==4 /* Store word indirect */
with REG REG+FSREG with REG REG+FSREG
kills MEMORY kills MEMORY
gen move %2, {IND_RC_W, %1, 0} gen move %2, {IND_RC_W, %1, 0}
@ -1340,7 +1333,7 @@ PATTERNS
kills MEMORY kills MEMORY
gen move %2, {IND_RR_W, %1.reg1, %1.reg2} gen move %2, {IND_RR_W, %1.reg1, %1.reg2}
pat sti $1==INT64 /* Store double-word indirect */ pat sti $1==8 /* Store double-word indirect */
with REG FREG with REG FREG
kills MEMORY kills MEMORY
gen move %2, {IND_RC_D, %1, 0} gen move %2, {IND_RC_D, %1, 0}
@ -1367,8 +1360,7 @@ PATTERNS
pat sts $1==4 /* Store arbitrary size */ pat sts $1==4 /* Store arbitrary size */
with REG3 STACK with REG3 STACK
kills ALL kills ALL
gen gen bl {LABEL, ".sts4"}
bl {LABEL, ".sts4"}
/* Arithmetic wrappers */ /* Arithmetic wrappers */
@ -1560,7 +1552,7 @@ PATTERNS
leaving leaving
cal ".xor" cal ".xor"
pat com $1==INT32 /* NOT word */ pat com $1==4 /* NOT word */
with exact AND_RR with exact AND_RR
yields {NAND_RR, %1.reg1, %1.reg2} yields {NAND_RR, %1.reg1, %1.reg2}
with exact OR_RR with exact OR_RR
@ -1680,8 +1672,7 @@ PATTERNS
/* Arrays */ /* Arrays */
pat aar $1==4 /* Address of array element */ pat aar $1==4 /* Address of array element */
leaving leaving cal ".aar4"
cal ".aar4"
pat lar $1==4 /* Load from array */ pat lar $1==4 /* Load from array */
with STACK with STACK
@ -1993,7 +1984,7 @@ PATTERNS
* puts gt in the sign bit, to reverse the comparison. * puts gt in the sign bit, to reverse the comparison.
*/ */
pat cmi $1==INT32 /* Signed tristate compare */ pat cmi $1==4 /* Signed tristate compare */
with REG CONST2 with REG CONST2
uses reusing %1, REG={COND_RC, %1, %2.val} uses reusing %1, REG={COND_RC, %1, %2.val}
gen rlwinm %a, %a, {C, 1}, {C, 31}, {C, 0} gen rlwinm %a, %a, {C, 1}, {C, 31}, {C, 0}
@ -2007,7 +1998,7 @@ PATTERNS
gen extlwi %a, %a, {C, 2}, {C, 0} gen extlwi %a, %a, {C, 2}, {C, 0}
yields %a yields %a
pat cmu $1==INT32 /* Unsigned tristate compare */ pat cmu $1==4 /* Unsigned tristate compare */
with REG UCONST2 with REG UCONST2
uses reusing %1, REG={CONDL_RC, %1, %2.val} uses reusing %1, REG={CONDL_RC, %1, %2.val}
gen rlwinm %a, %a, {C, 1}, {C, 31}, {C, 0} gen rlwinm %a, %a, {C, 1}, {C, 31}, {C, 0}
@ -2023,11 +2014,11 @@ PATTERNS
pat cmp /* Compare pointers */ pat cmp /* Compare pointers */
leaving leaving
cmu INT32 cmu 4
pat cms $1==INT32 /* Compare blocks (word sized) */ pat cms $1==4 /* Compare blocks (word sized) */
leaving leaving
cmi INT32 cmi 4
pat cms defined($1) pat cms defined($1)
leaving leaving
@ -2041,34 +2032,32 @@ PATTERNS
/* Other branching and labelling */ /* Other branching and labelling */
/* During an unconditional jump, if the top element on the
* stack has 4 bytes, then we hold it in register r3.
*/
pat lab topeltsize($1)==4 && !fallthrough($1) pat lab topeltsize($1)==4 && !fallthrough($1)
kills ALL kills ALL
gen gen labeldef $1
labeldef $1
yields r3 yields r3
pat lab topeltsize($1)==4 && fallthrough($1) pat lab topeltsize($1)==4 && fallthrough($1)
with REG3 STACK with REG3 STACK
kills ALL kills ALL
gen gen labeldef $1
labeldef $1
yields r3 yields r3
pat lab topeltsize($1)!=4 pat lab topeltsize($1)!=4 /* Label without r3 */
with STACK with STACK
kills ALL kills ALL
gen gen labeldef $1
labeldef $1
pat bra topeltsize($1)==4 /* Unconditional jump with TOS GPRister */ pat bra topeltsize($1)==4 /* Branch with r3 */
with REG3 STACK with REG3 STACK
gen gen b {LABEL, $1}
b {LABEL, $1}
pat bra topeltsize($1)!=4 /* Unconditional jump without TOS GPRister */ pat bra topeltsize($1)!=4 /* Branch without r3 */
with STACK with STACK
gen gen b {LABEL, $1}
b {LABEL, $1}
/* Miscellaneous */ /* Miscellaneous */
@ -2076,8 +2065,7 @@ PATTERNS
pat cal /* Call procedure */ pat cal /* Call procedure */
with STACK with STACK
kills ALL kills ALL
gen gen bl {LABEL, $1}
bl {LABEL, $1}
pat cai /* Call procedure indirect */ pat cai /* Call procedure indirect */
with REG STACK with REG STACK
@ -2086,10 +2074,10 @@ PATTERNS
mtspr ctr, %1 mtspr ctr, %1
bctrl. bctrl.
pat lfr $1==INT32 /* Load function result, word */ pat lfr $1==4 /* Load function result, word */
yields r3 yields r3
pat lfr $1==INT64 /* Load function result, double-word */ pat lfr $1==8 /* Load function result, double-word */
yields r4 r3 yields r4 r3
pat ret $1==0 /* Return from procedure */ pat ret $1==0 /* Return from procedure */
@ -2151,14 +2139,12 @@ PATTERNS
pat csa /* Array-lookup switch */ pat csa /* Array-lookup switch */
with STACK with STACK
kills ALL kills ALL
gen gen b {LABEL, ".csa"}
b {LABEL, ".csa"}
pat csb /* Table-lookup switch */ pat csb /* Table-lookup switch */
with STACK with STACK
kills ALL kills ALL
gen gen b {LABEL, ".csb"}
b {LABEL, ".csb"}
/* EM specials */ /* EM specials */
@ -2174,30 +2160,24 @@ PATTERNS
ste "hol0" ste "hol0"
pat lni /* Increment line number */ pat lni /* Increment line number */
leaving leaving ine "hol0"
ine "hol0"
pat lim /* Load EM trap ignore mask */ pat lim /* Load EM trap ignore mask */
leaving leaving lde ".ignmask"
lde ".ignmask"
pat sim /* Store EM trap ignore mask */ pat sim /* Store EM trap ignore mask */
leaving leaving ste ".ignmask"
ste ".ignmask"
pat trp /* Raise EM trap */ pat trp /* Raise EM trap */
with REG3 with REG3
kills ALL kills ALL
gen gen bl {LABEL, ".trap"}
bl {LABEL, ".trap"}
pat sig /* Set trap handler */ pat sig /* Set trap handler */
leaving leaving ste ".trppc"
ste ".trppc"
pat rtt /* Return from trap */ pat rtt /* Return from trap */
leaving leaving ret 0
ret 0
/* Our caller's local base, "lxl 0 dch", appears in /* Our caller's local base, "lxl 0 dch", appears in
* lang/cem/libcc.ansi/setjmp/setjmp.e, lang/m2/libm2/par_misc.e * lang/cem/libcc.ansi/setjmp/setjmp.e, lang/m2/libm2/par_misc.e
@ -2210,8 +2190,7 @@ PATTERNS
yields {IND_RC_W, %1, FP_OFFSET} yields {IND_RC_W, %1, FP_OFFSET}
pat lpb /* LB -> argument base */ pat lpb /* LB -> argument base */
leaving leaving adp EM_BSIZE
adp EM_BSIZE
pat gto /* longjmp */ pat gto /* longjmp */
with STACK with STACK
@ -2253,15 +2232,14 @@ PATTERNS
/* Single-precision floating-point */ /* Single-precision floating-point */
pat zrf $1==INT32 /* Push zero */ pat zrf $1==4 /* Push zero */
leaving leaving
loe ".fs_00000000" loe ".fs_00000000"
pat adf $1==4 /* Add single */ pat adf $1==4 /* Add single */
with FSREG FSREG with FSREG FSREG
uses reusing %1, FSREG uses reusing %1, FSREG
gen gen fadds %a, %2, %1
fadds %a, %2, %1
yields %a yields %a
pat adf stl $1==4 && inreg($2)==reg_float pat adf stl $1==4 && inreg($2)==reg_float
with FSREG FSREG with FSREG FSREG
@ -2270,8 +2248,7 @@ PATTERNS
pat sbf $1==4 /* Subtract single */ pat sbf $1==4 /* Subtract single */
with FSREG FSREG with FSREG FSREG
uses reusing %1, FSREG uses reusing %1, FSREG
gen gen fsubs %a, %2, %1
fsubs %a, %2, %1
yields %a yields %a
pat sbf stl $1==4 && inreg($2)==reg_float pat sbf stl $1==4 && inreg($2)==reg_float
with FSREG FSREG with FSREG FSREG
@ -2280,34 +2257,31 @@ PATTERNS
pat mlf $1==4 /* Multiply single */ pat mlf $1==4 /* Multiply single */
with FSREG FSREG with FSREG FSREG
uses reusing %1, FSREG uses reusing %1, FSREG
gen gen fmuls %a, %2, %1
fmuls %a, %2, %1
yields %a yields %a
pat mlf stl $1==4 && inreg($2)==reg_float pat mlf stl $1==4 && inreg($2)==reg_float
with FSREG FSREG with FSREG FSREG
gen fmuls {LOCAL, $2}, %2, %1 gen fmuls {LOCAL, $2}, %2, %1
pat dvf $1==INT32 /* Divide single */ pat dvf $1==4 /* Divide single */
with FSREG FSREG with FSREG FSREG
uses reusing %1, FSREG uses reusing %1, FSREG
gen gen fdivs %a, %2, %1
fdivs %a, %2, %1
yields %a yields %a
pat dvf stl $1==4 && inreg($2)==reg_float pat dvf stl $1==4 && inreg($2)==reg_float
with FSREG FSREG with FSREG FSREG
gen fdivs {LOCAL, $2}, %2, %1 gen fdivs {LOCAL, $2}, %2, %1
pat ngf $1==INT32 /* Negate single */ pat ngf $1==4 /* Negate single */
with FSREG with FSREG
uses reusing %1, FSREG uses reusing %1, FSREG
gen gen fneg %a, %1
fneg %a, %1
yields %a yields %a
pat ngf stl $1==4 && inreg($2)==reg_float pat ngf stl $1==4 && inreg($2)==reg_float
with FSREG with FSREG
gen fneg {LOCAL, $2}, %1 gen fneg {LOCAL, $2}, %1
pat cmf $1==INT32 /* Compare single */ pat cmf $1==4 /* Compare single */
with FSREG FSREG with FSREG FSREG
uses REG={COND_FS, %2, %1} uses REG={COND_FS, %2, %1}
gen extlwi %a, %a, {C, 2}, {C, 0} gen extlwi %a, %a, {C, 2}, {C, 0}
@ -2358,12 +2332,11 @@ PATTERNS
pat cmf zlt $1==4 call cmf4zxx("blt") pat cmf zlt $1==4 call cmf4zxx("blt")
pat cmf zle $1==4 call cmf4zxx("ble") pat cmf zle $1==4 call cmf4zxx("ble")
pat loc loc cff $1==INT32 && $2==INT64 /* Convert single to double */ pat loc loc cff $1==4 && $2==8 /* Convert single to double */
with FSREG with FSREG
yields %1.1 yields %1.1
/* Convert single to signed int */ pat loc loc cfi $1==4 && $2==4 /* Single to signed int */
pat loc loc cfi $1==4 && $2==4
leaving leaving
loc 4 loc 4
loc 8 loc 8
@ -2372,8 +2345,7 @@ PATTERNS
loc 4 loc 4
cfi cfi
/* Convert single to unsigned int */ pat loc loc cfu $1==4 && $2==4 /* Single to unsigned int */
pat loc loc cfu $1==4 && $2==4
leaving leaving
loc 4 loc 4
loc 8 loc 8
@ -2382,8 +2354,7 @@ PATTERNS
loc 4 loc 4
cfu cfu
/* Convert signed int to single */ pat loc loc cif $1==4 && $2==4 /* Signed int to single */
pat loc loc cif $1==4 && $2==4
leaving leaving
loc 4 loc 4
loc 8 loc 8
@ -2392,8 +2363,7 @@ PATTERNS
loc 4 loc 4
cff cff
/* Convert unsigned int to single */ pat loc loc cuf $1==4 && $2==4 /* Unsigned int to single */
pat loc loc cuf $1==4 && $2==4
leaving leaving
loc 4 loc 4
loc 8 loc 8
@ -2405,15 +2375,13 @@ PATTERNS
/* Double-precision floating-point */ /* Double-precision floating-point */
pat zrf $1==INT64 /* Push zero */ pat zrf $1==8 /* Push zero */
leaving leaving lde ".fd_00000000"
lde ".fd_00000000"
pat adf $1==8 /* Add double */ pat adf $1==8 /* Add double */
with FREG FREG with FREG FREG
uses reusing %1, FREG uses reusing %1, FREG
gen gen fadd %a, %2, %1
fadd %a, %2, %1
yields %a yields %a
pat adf sdl $1==8 && inreg($2)==reg_float pat adf sdl $1==8 && inreg($2)==reg_float
with FREG FREG with FREG FREG
@ -2422,8 +2390,7 @@ PATTERNS
pat sbf $1==8 /* Subtract double */ pat sbf $1==8 /* Subtract double */
with FREG FREG with FREG FREG
uses reusing %1, FREG uses reusing %1, FREG
gen gen fsub %a, %2, %1
fsub %a, %2, %1
yields %a yields %a
pat sbf sdl $1==8 && inreg($2)==reg_float pat sbf sdl $1==8 && inreg($2)==reg_float
with FREG FREG with FREG FREG
@ -2432,8 +2399,7 @@ PATTERNS
pat mlf $1==8 /* Multiply double */ pat mlf $1==8 /* Multiply double */
with FREG FREG with FREG FREG
uses reusing %1, FREG uses reusing %1, FREG
gen gen fmul %a, %2, %1
fmul %a, %2, %1
yields %a yields %a
pat mlf sdl $1==8 && inreg($2)==reg_float pat mlf sdl $1==8 && inreg($2)==reg_float
with FREG FREG with FREG FREG
@ -2442,8 +2408,7 @@ PATTERNS
pat dvf $1==8 /* Divide double */ pat dvf $1==8 /* Divide double */
with FREG FREG with FREG FREG
uses reusing %1, FREG uses reusing %1, FREG
gen gen fdiv %a, %2, %1
fdiv %a, %2, %1
yields %a yields %a
pat dvf sdl $1==8 && inreg($2)==reg_float pat dvf sdl $1==8 && inreg($2)==reg_float
with FREG FREG with FREG FREG
@ -2452,14 +2417,13 @@ PATTERNS
pat ngf $1==8 /* Negate double */ pat ngf $1==8 /* Negate double */
with FREG with FREG
uses reusing %1, FREG uses reusing %1, FREG
gen gen fneg %a, %1
fneg %a, %1
yields %a yields %a
pat ngf sdl $1==8 && inreg($2)==reg_float pat ngf sdl $1==8 && inreg($2)==reg_float
with FREG with FREG
gen fneg {DLOCAL, $2}, %1 gen fneg {DLOCAL, $2}, %1
pat cmf $1==INT64 /* Compare double */ pat cmf $1==8 /* Compare double */
with FREG FREG with FREG FREG
uses REG={COND_FD, %2, %1} uses REG={COND_FD, %2, %1}
gen extlwi %a, %a, {C, 2}, {C, 0} gen extlwi %a, %a, {C, 2}, {C, 0}
@ -2521,8 +2485,7 @@ PATTERNS
gen frsp %a, %1 gen frsp %a, %1
yields %a yields %a
/* Convert double to signed int */ pat loc loc cfi $1==8 && $2==4 /* Double to signed int */
pat loc loc cfi $1==8 && $2==4
with FREG STACK with FREG STACK
uses reusing %1, FREG uses reusing %1, FREG
gen gen
@ -2530,26 +2493,18 @@ PATTERNS
stfdu %a, {IND_RC_D, sp, 0-8} stfdu %a, {IND_RC_D, sp, 0-8}
addi sp, sp, {C, 4} addi sp, sp, {C, 4}
/* Convert double to unsigned int */ pat loc loc cfu $1==8 && $2==4 /* Double to unsigned int */
pat loc loc cfu $1==8 && $2==4 leaving cal ".cfu8"
leaving
cal ".cfu8"
/* Convert signed int to double */ pat loc loc cif $1==4 && $2==8 /* Signed int to double */
pat loc loc cif $1==4 && $2==8 leaving cal ".cif8"
leaving
cal ".cif8"
/* Convert unsigned int to double */ pat loc loc cuf $1==4 && $2==8 /* Unsigned int to double */
pat loc loc cuf $1==4 && $2==8 leaving cal ".cuf8"
leaving
cal ".cuf8"
pat fef $1==8 /* Split fraction, exponent */ pat fef $1==8 /* Split fraction, exponent */
leaving leaving cal ".fef8"
cal ".fef8"
/* Multiply two doubles, then split fraction, integer */ /* Multiply two doubles, then split fraction, integer */
pat fif $1==8 pat fif $1==8
leaving leaving cal ".fif8"
cal ".fif8"