From 12e22bb1b4a687def2f36f281456da28ee3a4d95 Mon Sep 17 00:00:00 2001
From: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Fri, 18 Mar 2016 15:03:25 -0400
Subject: [PATCH] lamely handle swap of sse registers

---
 lisc/emit.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisc/emit.c b/lisc/emit.c
index dcda556..ee0318f 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -424,6 +424,16 @@ emitins(Ins i, Fn *fn, FILE *f)
 		if (!req(i.to, R))
 			emitcopy(i.to, TMP(RSP), Kl, fn, f);
 		break;
+	case OSwap:
+		if (KBASE(i.cls) == 0)
+			goto Table;
+		/* for floats, there is no swap instruction
+		 * so we use xmm15 as a temporary
+		 */
+		emitcopy(TMP(XMM0+15), i.arg[0], i.cls, fn, f);
+		emitcopy(i.arg[0], i.arg[1], i.cls, fn, f);
+		emitcopy(i.arg[1], TMP(XMM0+15), i.cls, fn, f);
+		break;
 	}
 }