[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: Fold (logior 0 INT) to INT
From: |
Andy Wingo |
Subject: |
[Guile-commits] branch master updated: Fold (logior 0 INT) to INT |
Date: |
Wed, 12 Feb 2020 09:47:51 -0500 |
This is an automated email from the git hooks/post-receive script.
wingo pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new a706b7e Fold (logior 0 INT) to INT
a706b7e is described below
commit a706b7e465f1dee3ef6c95655d8e9f43575ec732
Author: Andy Wingo <address@hidden>
AuthorDate: Wed Feb 12 15:40:14 2020 +0100
Fold (logior 0 INT) to INT
* module/language/cps/type-fold.scm (logior): Integer-valued operands
to (logior 0 EXPR) should fold to EXPR.
---
module/language/cps/type-fold.scm | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/module/language/cps/type-fold.scm
b/module/language/cps/type-fold.scm
index 5cb7447..7cefbd2 100644
--- a/module/language/cps/type-fold.scm
+++ b/module/language/cps/type-fold.scm
@@ -1,5 +1,5 @@
;;; Abstract constant folding on CPS
-;;; Copyright (C) 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
;;;
;;; This library is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Lesser General Public License as
@@ -427,6 +427,25 @@
(else
(with-cps cps #f))))
+(define-binary-primcall-reducer (logior cps k src param
+ arg0 type0 min0 max0
+ arg1 type1 min1 max1)
+ (cond
+ ((type<=? (logior type0 type1) &exact-integer)
+ (cond
+ ((= 0 min0 max0)
+ (with-cps cps
+ (build-term
+ ($continue k src ($values (arg1))))))
+ ((= 0 min1 max1)
+ (with-cps cps
+ (build-term
+ ($continue k src ($values (arg0))))))
+ (else
+ (with-cps cps #f))))
+ (else
+ (with-cps cps #f))))
+
(define-unary-primcall-reducer (u64->scm cps k src constant arg type min max)
(cond
((<= max (target-most-positive-fixnum))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch master updated: Fold (logior 0 INT) to INT,
Andy Wingo <=