[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/10: Fix type/range inference for mul
From: |
Andy Wingo |
Subject: |
[Guile-commits] 10/10: Fix type/range inference for mul |
Date: |
Thu, 16 Jul 2015 08:06:32 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 90aabcc56556c09a65e4257630b10589aab2d3dd
Author: Andy Wingo <address@hidden>
Date: Thu Jul 16 09:58:59 2015 +0200
Fix type/range inference for mul
* module/language/cps2/types.scm (mul): Fix nan testing.
---
module/language/cps2/types.scm | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/module/language/cps2/types.scm b/module/language/cps2/types.scm
index 6fca57d..07da3d6 100644
--- a/module/language/cps2/types.scm
+++ b/module/language/cps2/types.scm
@@ -833,16 +833,17 @@ minimum, and maximum."
(define-simple-type-checker (mul &number &number))
(define-type-inferrer (mul a b result)
(let ((min-a (&min a)) (max-a (&max a))
- (min-b (&min b)) (max-b (&max b)))
+ (min-b (&min b)) (max-b (&max b))
+ ;; We only really get +inf.0 at runtime for flonums and
+ ;; compnums. If we have inferred that the arguments are not
+ ;; flonums and not compnums, then the result of (* +inf.0 0) at
+ ;; range inference time is 0 and not +nan.0.
+ (nan-impossible? (not (logtest (logior (&type a) (&type b))
+ (logior &flonum &complex)))))
(define (nan* a b)
- ;; We only really get +inf.0 at runtime for flonums and compnums.
- ;; If we have inferred that the arguments are not flonums and not
- ;; compnums, then the result of (* +inf.0 0) at range inference
- ;; time is 0 and not +nan.0.
(if (and (or (and (inf? a) (zero? b))
(and (zero? a) (inf? b)))
- (not (logtest (logior (&type a) (&type b))
- (logior &flonum &complex))))
+ nan-impossible?)
0
(* a b)))
(let ((-- (nan* min-a min-b))
- [Guile-commits] branch master updated (981802c -> 90aabcc), Andy Wingo, 2015/07/16
- [Guile-commits] 01/10: closure-conversion docstring tweak, Andy Wingo, 2015/07/16
- [Guile-commits] 02/10: CPS2 closure conversion bugfixes, Andy Wingo, 2015/07/16
- [Guile-commits] 03/10: Enable CPS2 closure conversion, Andy Wingo, 2015/07/16
- [Guile-commits] 04/10: Prepare DCE pass for first-order CPS2, Andy Wingo, 2015/07/16
- [Guile-commits] 06/10: DCE works on first-order CPS, Andy Wingo, 2015/07/16
- [Guile-commits] 05/10: compute-reachable-functions refactor, Andy Wingo, 2015/07/16
- [Guile-commits] 10/10: Fix type/range inference for mul,
Andy Wingo <=
- [Guile-commits] 07/10: Beta reduction over first-order CPS, Andy Wingo, 2015/07/16
- [Guile-commits] 08/10: Optimize first-order CPS, Andy Wingo, 2015/07/16
- [Guile-commits] 09/10: Remove CPS optimization passes and closure conversion, Andy Wingo, 2015/07/16