[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 26/30: Better unboxing for logand over s64 values
From: |
Andy Wingo |
Subject: |
[Guile-commits] 26/30: Better unboxing for logand over s64 values |
Date: |
Fri, 24 Nov 2017 09:24:25 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 3ae2a88c15e6d0bc37e2832686c7423fea93a849
Author: Andy Wingo <address@hidden>
Date: Wed Nov 22 11:34:25 2017 +0100
Better unboxing for logand over s64 values
* module/language/cps/specialize-numbers.scm (specialize-operations): Do
a better job unboxing logand if we know the result is a u64, even if
arguments are s64.
---
module/language/cps/specialize-numbers.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/module/language/cps/specialize-numbers.scm
b/module/language/cps/specialize-numbers.scm
index df570bc..a0c4b15 100644
--- a/module/language/cps/specialize-numbers.scm
+++ b/module/language/cps/specialize-numbers.scm
@@ -484,6 +484,26 @@ BITS indicating the significant bits needed for a
variable. BITS may be
(unbox-u64 a) (unbox-u64 b) (box-u64 result)))
(setk label ($kargs names vars ,body)))))
+ (((or 'logand 'logior 'logxor 'logsub)
+ (? u64-result?) #f (? s64-operand? a) (? s64-operand? b))
+ (let ((op (match op
+ ('logand 'ulogand) ('logior 'ulogior)
+ ('logxor 'ulogxor) ('logsub 'ulogsub))))
+ (define (unbox-u64* x)
+ (let ((unbox-s64 (unbox-s64 x)))
+ (lambda (cps k src x)
+ (with-cps cps
+ (letv s64)
+ (letk ks64 ($kargs ('s64) (s64)
+ ($continue k src
+ ($primcall 's64->u64 #f (s64)))))
+ ($ (unbox-s64 k src x))))))
+ (with-cps cps
+ (let$ body (specialize-binop
+ k src op a b
+ (unbox-u64* a) (unbox-u64* b) (box-u64 result)))
+ (setk label ($kargs names vars ,body)))))
+
(((or 'add 'sub 'mul)
(? s64-result?) #f (? s64-operand? a) (? s64-operand? b))
(let ((op (match op
- [Guile-commits] 12/30: Remove effects-analysis exports that were undefined, (continued)
- [Guile-commits] 12/30: Remove effects-analysis exports that were undefined, Andy Wingo, 2017/11/24
- [Guile-commits] 11/30: Specialize fixnum and s64 phis, Andy Wingo, 2017/11/24
- [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 <=
- [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, 2017/11/24
- [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