~mcf/cproc

Use ceqw/l for logical not (!) operator instead of jnz+phi v1 PROPOSED

Roland Paterson-Jones: 1
 Use ceqw/l for logical not (!) operator instead of jnz+phi

 1 files changed, 3 insertions(+), 7 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mcf/cproc/patches/54857/mbox | git am -3
Learn more about email & git

[PATCH] Use ceqw/l for logical not (!) operator instead of jnz+phi Export this patch

This leads to neater code - single instruction, no more
blocks, and facilitates further QBE optimisations.
---
 qbe.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/qbe.c b/qbe.c
index 0d1a499..1791511 100644
--- a/qbe.c
+++ b/qbe.c
@@ -702,12 +702,6 @@ funcbranch(struct func *f, struct expr *e, struct block *bt, struct block *bf)

	/* Maybe we we could do something for EXPRCOND as well. */
	switch (e->kind) {
	case EXPRUNARY:
		if (e->op == TLNOT) {
			funcbranch(f, e->base, bf, bt);
			return;
		}
		break;
	case EXPRBINARY:
		if (e->op == TLOR || e->op == TLAND) {
			if (e->op == TLOR) {
@@ -833,7 +827,9 @@ funcexpr(struct func *f, struct expr *e)
	case EXPRUNARY:
		switch (e->op) {
		case TLNOT:
			return funclogical(f, e);
			r = funcexpr(f, e->base);
			return funcinst(f, (qbetype(e->type).base == 'w' ? ICEQW : ICEQL),
					'w', r, mkintconst(0));
		case TBAND:
			lval = funclval(f, e->base);
			return lval.addr;
-- 
2.34.1