Re: master: x86-64: TRUNCATE using the Lemire, Kaser, Kurz transform

Stas Boukarev <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs,gmane.lisp.steel-bank.devel
Message-ID <CAF63=10wY+gYANcRMDR50ag4C7KjA2tNKxzYjnp=y=9+12fcmw@mail.gmail.com>
Maybe that transform can just do all that.
But you can override transforms with a... vop-transform!
e.g.

(deftransform %ldb ((size posn integer) (:or (((constant-arg (integer
1 #.(1- n-word-bits)))
                                               (constant-arg integer)
                                               word) unsigned-byte)
                                             (((constant-arg (integer
1 #.(1- n-word-bits)))
                                               (constant-arg integer)
                                               signed-word) unsigned-byte)) *
                    :vop t)
  (and (plusp (lvar-value posn))
       (or (= (lvar-value size) 1)
           (<= (+ (lvar-value size)
                  (lvar-value posn))
               n-word-bits))))

On Sun, Apr 19, 2026 at 5:52 AM Douglas Katzman <[email protected]> wrote:
>
>
>
> On Sat, Apr 18, 2026 at 10:40 PM Stas Boukarev <[email protected]> wrote:
>>
>> The VOP gets defeated by one of the 23 transforms, when (speed 3):
>> https://github.com/sbcl/sbcl/blob/master/src/compiler/srctran.lisp#L5135
>>
> Good catch.
> Can we make that transform give-up if it knows that the quotient isn't used, and that the backend supports fastrem and that the argument types would be acceptable ?  Or should we try to just add a 24th transform that (miraculously) is squeezed in between two other transforms?


_______________________________________________
Sbcl-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.