summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2023-08-28 22:45:41 +0200
committerQuentin Carbonneaux <quentin@c9x.me>2023-08-28 22:45:41 +0200
commitc5aca682a20d8cf55c345b7e07be51230693fd84 (patch)
tree5dcf5a64a848de81b8ad68e4d0f299fe12fe2486
parentd6c9669c3c83ce9f570a9c3528110b666aba88f2 (diff)
downloadroux-c5aca682a20d8cf55c345b7e07be51230693fd84.tar.gz
comments in amd64 isel
-rw-r--r--amd64/isel.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index d1e4d3b..e29c8bf 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -316,15 +316,15 @@ sel(Ins i, ANum *an, Fn *fn)
 		break;
 	case Oultof:
 		/* %mask =l and %arg.0, 1
-		   %isbig =l shr %arg.0, 63
-		   %divided =l shr %arg.0, %isbig
-		   %or =l or %mask, %divided
-		   %float =d sltof %or
-		   %cast =l cast %float
-		   %addend =l shl %isbig, 52
-		   %sum =l add %cast, %addend
-		   %result =d cast %sum
-		*/
+		 * %isbig =l shr %arg.0, 63
+		 * %divided =l shr %arg.0, %isbig
+		 * %or =l or %mask, %divided
+		 * %float =d sltof %or
+		 * %cast =l cast %float
+		 * %addend =l shl %isbig, 52
+		 * %sum =l add %cast, %addend
+		 * %result =d cast %sum
+		 */
 		r0 = newtmp("utof", k, fn);
 		if (k == Ks)
 			kc = Kw, sh = 23;
@@ -364,6 +364,18 @@ sel(Ins i, ANum *an, Fn *fn)
 			i.to = r0;
 			goto Emit;
 		}
+		/* %try0 =l {s,d}tosi %fp
+		 * %mask =l sar %try0, 63
+		 *
+		 *    mask is all ones if the first
+		 *    try was oob, all zeroes o.w.
+		 *
+		 * %fps ={s,d} sub %fp, (1<<63)
+		 * %try1 =l {s,d}tosi %fps
+		 *
+		 * %tmp =l and %mask, %try1
+		 * %res =l or %tmp, %try0
+		 */
 		r0 = newtmp("ftou", kc, fn);
 		for (j=0; j<4; j++)
 			tmp[j] = newtmp("ftou", Kl, fn);