1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

Convert "ash" to "lsh"/"rsh" when lowering to CPS

* module/language/cps/effects-analysis.scm: Remove case for "ash".
* module/language/cps/types.scm (ash): Remove.
* module/language/tree-il/compile-cps.scm (convert, canonicalize):
  Convert "ash" to "lsh"/"rsh" early on.
* module/system/base/target.scm (target-fixnum?): New procedure.
This commit is contained in:
Andy Wingo 2017-11-11 21:10:28 +01:00
parent a268c02fa0
commit b331ea3193
4 changed files with 52 additions and 15 deletions

View file

@ -458,7 +458,6 @@ is or might be a read or a write to the same location as A."
((inexact? _) &type-check)
((even? _) &type-check)
((odd? _) &type-check)
((ash n m) &type-check)
((rsh n m) &type-check)
((lsh n m) &type-check)
((rsh/immediate n) &type-check)

View file

@ -1300,7 +1300,6 @@ minimum, and maximum."
(define-type-aliases even? odd?)
;; Bit operations.
(define-simple-type-checker (ash &exact-integer &exact-integer))
(define-simple-type-checker (lsh &exact-integer &u64))
(define-simple-type-checker (rsh &exact-integer &u64))
(define (compute-ash-range min-val max-val min-shift max-shift)
@ -1318,14 +1317,6 @@ minimum, and maximum."
(++ (ash* max-val max-shift))
(+- (ash* max-val min-shift)))
(values (min -- -+ ++ +-) (max -- -+ ++ +-))))
(define-type-inferrer (ash val count result)
(restrict! val &exact-integer -inf.0 +inf.0)
(restrict! count &exact-integer -inf.0 +inf.0)
(let-values (((min max) (compute-ash-range (&min val)
(&max val)
(&min count)
(&max count))))
(define-exact-integer! result min max)))
(define-type-inferrer (lsh val count result)
(restrict! val &exact-integer -inf.0 +inf.0)
(let-values (((min max) (compute-ash-range (&min val)