summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--amd64/emit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/amd64/emit.c b/amd64/emit.c
index 29b6bbb..09b90d5 100644
--- a/amd64/emit.c
+++ b/amd64/emit.c
@@ -408,7 +408,7 @@ emitins(Ins i, Fn *fn, FILE *f)
 	case Osub:
 		/* we have to use the negation trick to handle
 		 * some 3-address subtractions */
-		if (req(i.to, i.arg[1])) {
+		if (req(i.to, i.arg[1]) && !req(i.arg[0], i.to)) {
 			if (KBASE(i.cls) == 0)
 				emitf("neg%k %=", &i, fn, f);
 			else