Use a better NOT; and after remembering that PowerPC bit numbers are all

backwards in the documentation, rewrote IFEQ/IFLT/IFLE to actually work.
Probably. Thanks to the B test suite for spotting this.
This commit is contained in:
David Given 2017-01-07 01:03:15 +01:00
parent 77fc62285d
commit 0da248dced

View file

@ -572,26 +572,26 @@ PATTERNS
out:(int)reg = IFEQ.I(in:(cr)cr) out:(int)reg = IFEQ.I(in:(cr)cr)
emit "mfcr %out" /* get cr0 */ emit "mfcr %out" /* get cr0 */
emit "rlwinm %out, %out, [32-2], 2, 31" /* extract just EQ */ emit "rlwinm %out, %out, 3, 31, 31" /* extract just EQ */
cost 8; cost 8;
#if 0
out:(int)reg = IFEQ.I(in:(int)reg) out:(int)reg = IFEQ.I(in:(int)reg)
emit "cntlzw %out, %in" /* returns 0..32 */ emit "cntlzw %out, %in" /* returns 0..32 */
emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */ emit "rlwinm %out, %out, [32-5], 31, 31" /* if 32, return 1, otherwise 0 */
cost 8; cost 8;
#endif
out:(int)reg = IFLT.I(in:(cr)cr) out:(int)reg = IFLT.I(in:(cr)cr)
emit "mfcr %out" /* get cr0 */ emit "mfcr %out" /* get cr0 */
emit "andi. %out, %out, 1" /* leave just LT */ emit "rlwinm %out, %out, 1, 31, 31" /* leave just LT */
cost 8; cost 8;
out:(int)reg = IFLE.I(in:(cr)cr) out:(int)reg = IFLE.I(in:(cr)cr)
emit "mfcr %out" /* get cr0 */ emit "mfcr %out" /* get cr0 */
emit "andi. %out, %out, 5" /* leave just LT and EQ */ emit "rlwinm %out, %out, 2, 31, 31" /* leave just GT */
emit "cntlzw %out, %out" /* returns 0..32 */
emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */
emit "xori %out, %out, 1" /* negate */ emit "xori %out, %out, 1" /* negate */
cost 8; cost 12;
@ -673,10 +673,9 @@ PATTERNS
emit "neg %out, %left" emit "neg %out, %left"
cost 4; cost 4;
out:(int)reg = NOT.I(left:(int)reg) out:(int)reg = NOT.I(in:(int)reg)
emit "cntlzw %out, %left" emit "nor %out, %in, %in"
emit "rlwinm %out, %out, 32-5, 5, 31" cost 4;
cost 8;
ALUR(AND.I, "and") ALUR(AND.I, "and")
ALUCC(AND.I, "andi.") ALUCC(AND.I, "andi.")