emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature/native-comp 5bc0855 2/2: Don't treat '=' as simple equality


From: Pip Cet
Subject: Re: feature/native-comp 5bc0855 2/2: Don't treat '=' as simple equality emitting constraints (bug#46812)
Date: Tue, 2 Mar 2021 05:20:10 +0000

On Sun, Feb 28, 2021 at 11:02 PM Andrea Corallo <akrl@savannah.gnu.org> wrote:
> branch: feature/native-comp
> commit 5bc08559e8f171eafc3c034232f8cfd9eaf89862
> Author: Andrea Corallo <akrl@sdf.org>
> Commit: Andrea Corallo <akrl@sdf.org>
>
>     Don't treat '=' as simple equality emitting constraints (bug#46812)
>
>     Extend assumes allowing the following form
>
>     (assume dst (= src1 src2))
>
>     to caputure '=' semanting during fwprop handling float integer
>     conversions.
>
>         * lisp/emacs-lisp/comp.el (comp-equality-fun-p): Don't treat '=' as
>         simple equality.
>         (comp-arithm-cmp-fun-p, comp-negate-arithm-cmp-fun)
>         (comp-reverse-arithm-fun): Rename and add '=' '!='.
>         (comp-emit-assume, comp-add-cond-cstrs, comp-fwprop-insn): Update
>         for new function nameing and to handle '='.
>         * lisp/emacs-lisp/comp-cstr.el (comp-cstr-=): New function.
>         * test/src/comp-tests.el (comp-tests-type-spec-tests): Add a bunch
>         of '=' specific tests.
> ---
>  lisp/emacs-lisp/comp-cstr.el | 12 +++++++++++
>  lisp/emacs-lisp/comp.el      | 37 ++++++++++++++++++++--------------
>  test/src/comp-tests.el       | 47 
> ++++++++++++++++++++++++++++++++++++++------
>  3 files changed, 75 insertions(+), 21 deletions(-)
>
> diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
> index 89815f0..bd1e04f 100644
> --- a/lisp/emacs-lisp/comp-cstr.el
> +++ b/lisp/emacs-lisp/comp-cstr.el
> @@ -859,6 +859,18 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
>           (null (neg cstr))
>           (equal (typeset cstr) '(cons)))))
>
> +(defun comp-cstr-= (dst old-dst src)
> +  "Constraint DST being = SRC."
> +  (with-comp-cstr-accessors
> +    (comp-cstr-intersection dst old-dst src)
> +    (cl-loop for v in (valset dst)
> +             when (and (floatp v)
> +                       (= v (truncate v)))
> +               do (push (cons (truncate v) (truncate v)) (range dst)))
> +    (cl-loop for (l . h) in (range dst)
> +             when (eql l h)
> +               do (push (float l) (valset dst)))))

I'm not sure what this is supposed to do: first you form the
intersection of OLD-DST and SRC [often, empty]. Then you iterate over
the values and ranges of the [empty] intersection [leaving it empty].

It's not working either, as far as I can tell: (lambda (x) (and
(floatp x) (= x 0) x)) always returns nil when compiled.

Pip



reply via email to

[Prev in Thread] Current Thread [Next in Thread]