summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-07-06 21:31:34 -0700
committerQuentin Carbonneaux <quentin@c9x.me>2021-08-02 11:02:12 +0200
commit2bbfcf61b38edfe3c347cd270380e5117454c0cf (patch)
treec4279513fb8d3a9f1dac903753d210eb7d01779c
parent0437e97a1bb126cfa1974dad7b5479fa4b407f46 (diff)
downloadroux-2bbfcf61b38edfe3c347cd270380e5117454c0cf.tar.gz
copy: consider identity element for more instructions
udiv %x, 1 == %x, and for each of sub, or, xor, sar, shr, and shl,
<op> %x, 0 == %x.
-rw-r--r--copy.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/copy.c b/copy.c
index 053f319..593ce24 100644
--- a/copy.c
+++ b/copy.c
@@ -27,10 +27,16 @@ iscopy(Ins *i, Ref r, Fn *fn)
 	case Ocopy:
 		return 1;
 	case Omul:
-		return iscon(i->arg[1], 1, fn);
 	case Odiv:
+	case Oudiv:
 		return iscon(i->arg[1], 1, fn);
 	case Oadd:
+	case Osub:
+	case Oor:
+	case Oxor:
+	case Osar:
+	case Oshl:
+	case Oshr:
 		return iscon(i->arg[1], 0, fn);
 	default:
 		break;