Build the pinned termtris branch (be5b323) with this compiler, assemble and link it with the TI 1987 GSPA/GSPLNK and RTS.LIB, and run the proven play_keys board/move/panels/quit paths in MAME with the M4 loader. Add the contiguous-stack varargs MAME probe and the switch-to-lookup driver regression check. The termtris build found the i8/i16 argument, i1/ anyext load, nested-data, MULHS and late-GEP gaps fixed in the compiler.
38 lines
895 B
C
38 lines
895 B
C
/*
|
|
* switch.c -- a dense char switch, used by tests/m4/termtris.sh to pin the
|
|
* driver's late-GEP policy.
|
|
*
|
|
* The optimizer's switch-to-lookup-table transform creates a new i8 GEP after
|
|
* tms-bitaddr --scale; --normalize cannot tell that index apart from an
|
|
* already-scaled bit offset, so the table would be indexed one bit per slot.
|
|
* tms-clang passes -switch-to-lookup=false; this source makes the hazard
|
|
* reachable at -O2 (termtris' init_game and runesc switches are the real
|
|
* cases).
|
|
*/
|
|
int sw_tile(int c)
|
|
{
|
|
switch(c) {
|
|
case '#': return 2;
|
|
case '.': return 1;
|
|
case '{': return 11;
|
|
case '}': return 12;
|
|
case '[': return 13;
|
|
case ']': return 14;
|
|
case '>': return 15;
|
|
case '<': return 16;
|
|
case '-': return 17;
|
|
case '(': return 18;
|
|
case ')': return 19;
|
|
default: return 0;
|
|
}
|
|
}
|
|
|
|
int sw_sum(const char *s)
|
|
{
|
|
int r = 0;
|
|
while(*s) {
|
|
r += sw_tile(*s++);
|
|
}
|
|
return r;
|
|
}
|