Re: Rename xmm-tn-p to float-register-tn-p

arthur miller <[email protected]>
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <VI1PR09MB249667CEBE2DDEC341A285CD96A42@VI1PR09MB2496.eurprd09.prod.outlook.com>
Ha! I just produced new one and was about to send it πŸ™‚ πŸ‘

I also wrote a less verbose commit message in the new one,
Without unnecessary deatils, but it is ok; I'll rebase mine branch.

Thanks.

________________________________
FrΓ₯n: Stas Boukarev <[email protected]>
Skickat: den 20 augusti 2026 19:44
Till: arthur miller <[email protected]>
Kopia: sbcl-devel <[email protected]>
Γ„mne: Re: Rename xmm-tn-p to float-register-tn-p

I modified your patch to float-tn-p and applied it.

On Thu, Aug 20, 2026 at 8:37β€―PM Stas Boukarev <[email protected]> wrote:
>
> I think float-tn-p is a better name.
>
> > Another question: do you prefer patches, pull requests on GH, or just to
> > notify you when I have something? πŸ™‚ I see you have applied
> > the GH branch, not the patch I send yesterday.
>
> That was just a diff, not a proper patch.
>
> On Thu, Aug 20, 2026 at 8:34β€―PM arthur miller <[email protected]> wrote:
> >
> > I would like to refactor an older function for Intel simd support.
> > Is that OK please? The reason:
> >
> > The name xmm-tn-p is a misnomer. The code checks whether a register is in
> > storage base for float registers which can be xmm, ymm, zmm, float, double,
> > complex float and complex double registers. While it is true xmm-tn-p asks if a
> > TN is in float registers SB, it also suggests we are differentiating between
> > ymm-tn-p, zmm-tn-p etc, which is not really the case here. It caused me a bug
> > and some investigation while working on mask registers support.
> >
> > Another question: do you prefer patches, pull requests on GH, or just to
> > notify you when I have something? πŸ™‚ I see you have applied
> > the GH branch, not the patch I send yesterday.

_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel
0001-Rename-xmm-tn-p-to-float-register-tn-p.patch (text/x-patch, 4.6 KB)
From 47a5cef6c01cfc6541b58e6635075113086ffc93 Mon Sep 17 00:00:00 2001
From: arthur <[email protected]>
Date: Thu, 20 Aug 2026 19:53:53 +0200
Subject: [PATCH] Rename xmm-tn-p to float-register-tn-p

Updated all call-sites to new name.

Removed zmm-tn-p

The name xmm-tn-p is a misnomer. The code checks whether a register is in
storage base for float registers which can be xmm, ymm, zmm, float, double,
complex float and complex double registers. While it is true xmm-tn-p asks if a
TN is in float registers SB, it also suggests we are differentiating between
ymm-tn-p, zmm-tn-p etc, which is not really the case here.

zmm-tn-p was implemented inneficiently, but more importantly does not have any
caller, and thus is not needed for avx512 support.
---
 src/compiler/x86-64/float.lisp  |  4 ++--
 src/compiler/x86-64/insts.lisp  |  2 +-
 src/compiler/x86-64/macros.lisp | 16 ++++++++--------
 src/compiler/x86-64/vm.lisp     | 11 +++++------
 4 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/compiler/x86-64/float.lisp b/src/compiler/x86-64/float.lisp
index 5e8b507ec..e9a8247d9 100644
--- a/src/compiler/x86-64/float.lisp
+++ b/src/compiler/x86-64/float.lisp
@@ -941,7 +941,7 @@
   (:variant nil)
   (:generator 3
     (when (or (location= y xmm)
-              (and (not (xmm-tn-p x)) (xmm-tn-p y)))
+              (and (not (float-tn-p x)) (float-tn-p y)))
       (rotatef x y))
     (sc-case x
       (single-reg (setf xmm x))
@@ -975,7 +975,7 @@
   (:vop-var vop)
   (:generator 3
     (when (or (location= y xmm)
-              (and (not (xmm-tn-p x)) (xmm-tn-p y)))
+              (and (not (float-tn-p x)) (float-tn-p y)))
       (rotatef x y))
     (sc-case x
       (double-reg
diff --git a/src/compiler/x86-64/insts.lisp b/src/compiler/x86-64/insts.lisp
index c0b9786a6..40ff45d5f 100644
--- a/src/compiler/x86-64/insts.lisp
+++ b/src/compiler/x86-64/insts.lisp
@@ -1021,7 +1021,7 @@
   (ldb (byte 5 3) reg-id))
 
 ;;; Note that SB-VM has its own variation on these predicates
-;;; operating on TNs: GPR-TN-P, XMM-TN-P
+;;; operating on TNs: GPR-TN-P, FLOAT-TN-P
 
 ;;; Return true if THING is a general-purpose register.
 (defun gpr-p (thing)
diff --git a/src/compiler/x86-64/macros.lisp b/src/compiler/x86-64/macros.lisp
index 24ce5c509..ddde225eb 100644
--- a/src/compiler/x86-64/macros.lisp
+++ b/src/compiler/x86-64/macros.lisp
@@ -22,34 +22,34 @@
   (unless (location= dst src)
     (sc-case dst
       ((single-reg complex-single-reg)
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst movaps dst src))
       ((double-reg complex-double-reg)
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst movapd dst src))
       #+sb-simd-pack
       ((int-sse-reg sse-reg)
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst movdqa dst src))
       #+sb-simd-pack
       ((single-sse-reg double-sse-reg)
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst movaps dst src))
       #+sb-simd-pack-256
       (int-avx2-reg
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst vmovdqa dst src))
       #+sb-simd-pack-256
       ((single-avx2-reg double-avx2-reg)
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst vmovaps dst src))
       #+sb-simd-pack-512
       (int-avx512-reg
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst vmovdqu64 dst src))
       #+sb-simd-pack-512
       ((single-avx512-reg double-avx512-reg)
-       (aver (xmm-tn-p src))
+       (aver (float-tn-p src))
        (inst vmovups dst src))
       (t
        (if size
diff --git a/src/compiler/x86-64/vm.lisp b/src/compiler/x86-64/vm.lisp
index e8a73b96b..eee24ae31 100644
--- a/src/compiler/x86-64/vm.lisp
+++ b/src/compiler/x86-64/vm.lisp
@@ -464,15 +464,14 @@
 (defun gpr-tn-p (thing)
   (and (tn-p thing)
        (eq (sb-name (sc-sb (tn-sc thing))) 'registers)))
-;;; Return true if THING is an XMM register TN.
-(defun xmm-tn-p (thing)
+
+;;; Return true if THING is a TN in the FLOAT-REGISTERS storage base.  This
+;;; includes XMM, YMM, ZMM SIMD registers, scalar float/double, and complex
+;;; float/double, but does not include mask registers.
+(defun float-tn-p (thing)
   (and (tn-p thing)
        (eq (sb-name (sc-sb (tn-sc thing))) 'float-registers)))
 
-(defun zmm-tn-p (tn)
-  (member (tn-sc tn) (list (sc-or-lose 'single-avx512-reg)
-                           (sc-or-lose 'double-avx512-reg)
-                           (sc-or-lose 'int-avx512-reg))))
 ;;; Return true if THING is on the stack (in whatever storage class).
 (defun stack-tn-p (thing)
   (and (tn-p thing)
-- 
2.55.0
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.