summary refs log tree commit diff
path: root/amd64/emit.c
diff options
context:
space:
mode:
Diffstat (limited to 'amd64/emit.c')
-rw-r--r--amd64/emit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/amd64/emit.c b/amd64/emit.c
index cd485bb..4d4d3be 100644
--- a/amd64/emit.c
+++ b/amd64/emit.c
@@ -405,6 +405,16 @@ emitins(Ins i, Fn *fn, FILE *f)
 			break;
 		}
 		goto Table;
+	case Odiv:
+		/* adjust the instruction when the conversion to
+		 * a 2-address division is impossible */
+		if (req(i.to, i.arg[1])) {
+			i.arg[1] = TMP(XMM0+15);
+			emitf("mov%k %=, %1", &i, fn, f);
+			emitf("mov%k %0, %=", &i, fn, f);
+			i.arg[0] = i.to;
+		}
+		goto Table;
 	case Ocopy:
 		/* make sure we don't emit useless copies,
 		 * also, we can use a trick to load 64-bits