[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 25/30: Better type folding for = on exact numbers
From: |
Andy Wingo |
Subject: |
[Guile-commits] 25/30: Better type folding for = on exact numbers |
Date: |
Fri, 24 Nov 2017 09:24:24 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 695362a83035b1727a243e54fa28c4c0dad8e635
Author: Andy Wingo <address@hidden>
Date: Wed Nov 22 11:13:55 2017 +0100
Better type folding for = on exact numbers
* module/language/cps/type-fold.scm (=): Fold to #f if values are exact
but of different types.
(s64-=): Add missing alias.
---
module/language/cps/type-fold.scm | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/module/language/cps/type-fold.scm
b/module/language/cps/type-fold.scm
index 0557533..cd928e7 100644
--- a/module/language/cps/type-fold.scm
+++ b/module/language/cps/type-fold.scm
@@ -178,11 +178,18 @@
(define-branch-folder-alias imm-s64-< imm-u64-<)
(define-binary-branch-folder (= type0 min0 max0 type1 min1 max1)
- (case (compare-integer-ranges type0 min0 max0 type1 min1 max1)
- ((=) (values #t #t))
- ((< >) (values #t #f))
- (else (values #f #f))))
+ (if (and (type<=? (logior type0 type1)
+ (logior &exact-integer &fraction))
+ (zero? (logand type0 type1)))
+ ;; If both values are exact but of different types, they are not
+ ;; equal.
+ (values #t #f)
+ (case (compare-integer-ranges type0 min0 max0 type1 min1 max1)
+ ((=) (values #t #t))
+ ((< >) (values #t #f))
+ (else (values #f #f)))))
(define-branch-folder-alias u64-= =)
+(define-branch-folder-alias s64-= =)
- [Guile-commits] 19/30: Add exact-integer? as interesting Tree-IL effect-free primitive, (continued)
- [Guile-commits] 19/30: Add exact-integer? as interesting Tree-IL effect-free primitive, Andy Wingo, 2017/11/24
- [Guile-commits] 24/30: Declare bignum? as effect-free, Andy Wingo, 2017/11/24
- [Guile-commits] 13/30: Minor compile-cps refactor, Andy Wingo, 2017/11/24
- [Guile-commits] 15/30: DCE eliminates effect-free branches to the same continuation, Andy Wingo, 2017/11/24
- [Guile-commits] 29/30: DCE of branches punches through dead terms, Andy Wingo, 2017/11/24
- [Guile-commits] 21/30: Improve type and range inference on bignums, Andy Wingo, 2017/11/24
- [Guile-commits] 10/30: Fix unboxed immediate range comparison type inference, Andy Wingo, 2017/11/24
- [Guile-commits] 04/30: Specialize-numbers reifies instructions that type-check, Andy Wingo, 2017/11/24
- [Guile-commits] 26/30: Better unboxing for logand over s64 values, Andy Wingo, 2017/11/24
- [Guile-commits] 16/30: intmap-remove returns empty-intmap if appropriate, Andy Wingo, 2017/11/24
- [Guile-commits] 25/30: Better type folding for = on exact numbers,
Andy Wingo <=
- [Guile-commits] 28/30: Refactor to finish the primcalls-take-parameters work, Andy Wingo, 2017/11/24
- [Guile-commits] 23/30: Minor refactoring to type inference on < and =, Andy Wingo, 2017/11/24