[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 169/437: Correct wrong and confusing reverse float compa
From: |
Andy Wingo |
Subject: |
[Guile-commits] 169/437: Correct wrong and confusing reverse float comparison logic |
Date: |
Mon, 2 Jul 2018 05:14:11 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 537c85be274a68a2ecaad92943770ca55739161f
Author: pcpa <address@hidden>
Date: Sat Dec 29 18:55:11 2012 -0200
Correct wrong and confusing reverse float comparison logic
* lib/lightning.c: Correct both, wrong and confusing logic
to compute the reverse of a jump. Now it properly matches
C semantics for "eq" (==) and "ne" (!=) and correct computation
of reverse of "uneq" as "gt".
* check/branch.tst: Update "ne" float branch check that
previously happened to be wrongly tested with a NaN argument.
---
ChangeLog | 10 ++++++++++
TODO | 4 ----
check/branch.tst | 2 +-
lib/lightning.c | 58 +++++++++++++++++++++++++++++++-------------------------
4 files changed, 43 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 052afa6..0211dfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2012-12-29 Paulo Andrade <address@hidden>
+ * lib/lightning.c: Correct both, wrong and confusing logic
+ to compute the reverse of a jump. Now it properly matches
+ C semantics for "eq" (==) and "ne" (!=) and correct computation
+ of reverse of "uneq" as "gt".
+
+ * check/branch.tst: Update "ne" float branch check that
+ previously happened to be wrongly tested with a NaN argument.
+
+2012-12-29 Paulo Andrade <address@hidden>
+
* check/float.ok, check/float.tst: New test cases implementing
extensive validation of float comparison and branch code
generation as well as integer conversion, involving NaN and
diff --git a/TODO b/TODO
index 22d33b4..8cb2657 100644
--- a/TODO
+++ b/TODO
@@ -9,7 +9,3 @@
* Test and correct the ppc and mips ports, after the import and
adaptation of the code to lightning.
-
- * Add new float/double comparison and branch codes:
- unne: proper inverse of eq (nan/nan == 0)
- eqeq: proper inverse of ltgt (nan/nan == 1)
diff --git a/check/branch.tst b/check/branch.tst
index b8ec071..2252dff 100644
--- a/check/branch.tst
+++ b/check/branch.tst
@@ -517,7 +517,7 @@ xnei_f_f0_f1:
BOPF(eq, 3, 3)
BOPF(ge, 3, 3)
BOPF(gt, 4, 3)
- BOPF(ne, 4, 3)
+ UBOPF(ne, 4, 3)
UBOPF(unlt, 1, 2)
UBOPF(unle, 2, 2)
UBOPF(uneq, 3, 3)
diff --git a/lib/lightning.c b/lib/lightning.c
index 4ee202e..853eb22 100644
--- a/lib/lightning.c
+++ b/lib/lightning.c
@@ -1441,12 +1441,6 @@ _thread_jumps(jit_state_t *_jit)
case jit_code_callr: case jit_code_calli:
/* non optimizable jump like code */
break;
- case jit_code_beqr_f: case jit_code_beqi_f:
- case jit_code_beqr_d: case jit_code_beqi_d:
- case jit_code_bltgtr_f: case jit_code_bltgti_f:
- case jit_code_bltgtr_d: case jit_code_bltgti_d:
- /* non optimizable jump code */
- break;
default:
mask = jit_classify(node->code);
if (mask & jit_cc_a0_jmp) {
@@ -1627,30 +1621,34 @@ reverse_jump_code(jit_code_t code)
case jit_code_blti_f: return (jit_code_bungei_f);
case jit_code_bler_f: return (jit_code_bungtr_f);
case jit_code_blei_f: return (jit_code_bungti_f);
-#if 0
- case jit_code_beqr_f: return (jit_code_bltgtr_f);
- case jit_code_beqi_f: return (jit_code_bltgti_f);
-#endif
+
+ case jit_code_beqr_f: return (jit_code_bner_f);
+ case jit_code_beqi_f: return (jit_code_bnei_f);
+
case jit_code_bger_f: return (jit_code_bunltr_f);
case jit_code_bgei_f: return (jit_code_bunlti_f);
case jit_code_bgtr_f: return (jit_code_bunler_f);
case jit_code_bgti_f: return (jit_code_bunlei_f);
- case jit_code_bner_f: return (jit_code_buneqr_f);
- case jit_code_bnei_f: return (jit_code_buneqi_f);
+
+ case jit_code_bner_f: return (jit_code_beqr_f);
+ case jit_code_bnei_f: return (jit_code_beqr_f);
+
case jit_code_bunltr_f: return (jit_code_bger_f);
case jit_code_bunlti_f: return (jit_code_bgei_f);
case jit_code_bunler_f: return (jit_code_bgtr_f);
case jit_code_bunlei_f: return (jit_code_bgti_f);
- case jit_code_buneqr_f: return (jit_code_bgtr_f);
- case jit_code_buneqi_f: return (jit_code_bgti_f);
+
+ case jit_code_buneqr_f: return (jit_code_bltgtr_f);
+ case jit_code_buneqi_f: return (jit_code_bltgti_f);
+
case jit_code_bunger_f: return (jit_code_bltr_f);
case jit_code_bungei_f: return (jit_code_blti_f);
case jit_code_bungtr_f: return (jit_code_bler_f);
case jit_code_bungti_f: return (jit_code_blei_f);
-#if 0
- case jit_code_bltgtr_f: return (jit_code_beqr_f);
- case jit_code_bltgti_f: return (jit_code_beqi_f);
-#endif
+
+ case jit_code_bltgtr_f: return (jit_code_buneqr_f);
+ case jit_code_bltgti_f: return (jit_code_buneqi_f);
+
case jit_code_bordr_f: return (jit_code_bunordr_f);
case jit_code_bordi_f: return (jit_code_bunordi_f);
case jit_code_bunordr_f:return (jit_code_bordr_f);
@@ -1659,26 +1657,34 @@ reverse_jump_code(jit_code_t code)
case jit_code_blti_d: return (jit_code_bungei_d);
case jit_code_bler_d: return (jit_code_bungtr_d);
case jit_code_blei_d: return (jit_code_bungti_d);
- case jit_code_beqr_d: return (jit_code_bltgtr_d);
- case jit_code_beqi_d: return (jit_code_bltgti_d);
+
+ case jit_code_beqr_d: return (jit_code_bner_d);
+ case jit_code_beqi_d: return (jit_code_bner_d);
+
case jit_code_bger_d: return (jit_code_bunltr_d);
case jit_code_bgei_d: return (jit_code_bunlti_d);
case jit_code_bgtr_d: return (jit_code_bunler_d);
case jit_code_bgti_d: return (jit_code_bunlei_d);
- case jit_code_bner_d: return (jit_code_buneqr_d);
- case jit_code_bnei_d: return (jit_code_buneqi_d);
+
+ case jit_code_bner_d: return (jit_code_beqr_d);
+ case jit_code_bnei_d: return (jit_code_beqi_d);
+
case jit_code_bunltr_d: return (jit_code_bger_d);
case jit_code_bunlti_d: return (jit_code_bgei_d);
case jit_code_bunler_d: return (jit_code_bgtr_d);
case jit_code_bunlei_d: return (jit_code_bgti_d);
- case jit_code_buneqr_d: return (jit_code_bgtr_d);
- case jit_code_buneqi_d: return (jit_code_bgti_d);
+
+ case jit_code_buneqr_d: return (jit_code_bltgtr_d);
+ case jit_code_buneqi_d: return (jit_code_bltgti_d);
+
case jit_code_bunger_d: return (jit_code_bltr_d);
case jit_code_bungei_d: return (jit_code_blti_d);
case jit_code_bungtr_d: return (jit_code_bler_d);
case jit_code_bungti_d: return (jit_code_blei_d);
- case jit_code_bltgtr_d: return (jit_code_beqr_d);
- case jit_code_bltgti_d: return (jit_code_beqi_d);
+
+ case jit_code_bltgtr_d: return (jit_code_buneqr_d);
+ case jit_code_bltgti_d: return (jit_code_buneqi_d);
+
case jit_code_bordr_d: return (jit_code_bunordr_d);
case jit_code_bordi_d: return (jit_code_bunordi_d);
case jit_code_bunordr_d:return (jit_code_bordr_d);
- [Guile-commits] 81/437: fix stack alignment for Apple 32-bit ABI, (continued)
- [Guile-commits] 81/437: fix stack alignment for Apple 32-bit ABI, Andy Wingo, 2018/07/02
- [Guile-commits] 98/437: always set and replace lightning_frag, Andy Wingo, 2018/07/02
- [Guile-commits] 166/437: Correct extra regressions found by the call.tst test case., Andy Wingo, 2018/07/02
- [Guile-commits] 165/437: Add simple test case to test argument and return values., Andy Wingo, 2018/07/02
- [Guile-commits] 158/437: Add new test case to check stack integrity on complex stack frames., Andy Wingo, 2018/07/02
- [Guile-commits] 150/437: Add jit_ellipis and remove jit_prepare argument., Andy Wingo, 2018/07/02
- [Guile-commits] 108/437: fix x86_64 jit_bner_{f,d}, Andy Wingo, 2018/07/02
- [Guile-commits] 122/437: Correct ALU add and sub operations with 64 bit immediate operands., Andy Wingo, 2018/07/02
- [Guile-commits] 119/437: Correct branches and several ALU operations with 64 immediates, Andy Wingo, 2018/07/02
- [Guile-commits] 135/437: Correct implementation problems on ix86., Andy Wingo, 2018/07/02
- [Guile-commits] 169/437: Correct wrong and confusing reverse float comparison logic,
Andy Wingo <=
- [Guile-commits] 139/437: Implement sqrt codes in mips., Andy Wingo, 2018/07/02
- [Guile-commits] 134/437: Correct make distcheck., Andy Wingo, 2018/07/02
- [Guile-commits] 156/437: Simplify listing of test cases with alternate jit generation options, Andy Wingo, 2018/07/02
- [Guile-commits] 157/437: Add two extra test cases for float operations., Andy Wingo, 2018/07/02
- [Guile-commits] 161/437: Add new register clobber detection test case., Andy Wingo, 2018/07/02
- [Guile-commits] 164/437: Add new carry test case., Andy Wingo, 2018/07/02
- [Guile-commits] 138/437: Correct mips backend implementation to pass initial tests., Andy Wingo, 2018/07/02
- [Guile-commits] 163/437: Add missing jit_htonr to ppc backend., Andy Wingo, 2018/07/02
- [Guile-commits] 177/437: Correct reference to dangling pointer and better note bounds checking, Andy Wingo, 2018/07/02
- [Guile-commits] 167/437: Change type of return of jit_arg* and argument to jit_getarg*, Andy Wingo, 2018/07/02