public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/108338] New: use mtvsrws for lowpart DI->SF conversion on P9
@ 2023-01-09  6:35 guojiufu at gcc dot gnu.org
  2023-10-07  7:57 ` [Bug target/108338] " cvs-commit at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2023-01-09  6:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108338

            Bug ID: 108338
           Summary: use mtvsrws for lowpart DI->SF conversion on P9
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guojiufu at gcc dot gnu.org
  Target Milestone: ---

In a mail-list discussion,
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/609054.html, as Segher
points out, we could use 'mtvsrws' for the conversion from lowpart DI to SF on
P9;  and use 'mtvsrd' for the conversion from highpart of DI to SF.

float sf_from_di_off0 (long l)
{
  char buff[16];
  *(long*)buff = l;
  float f = *(float*)(buff);
  return f;
}

float sf_from_di_off4 (long l)
{
  char buff[16];
  *(long*)buff = l;
  float f = *(float*)(buff + 4);
  return f;
}

With trunk, -O2 -mcpu=power9,  the asm code could be optimized.

        sldi 9,3,32
        mtvsrd 1,9
        xscvspdpn 1,1
        blr
==> mtvsrws;xscvspdpn  (p9 LE) lowpart


        srdi 3,3,32
        sldi 9,3,32
        mtvsrd 1,9
        xscvspdpn 1,1
        blr
==> (+ clean lowpart to 0) mtvsrd;xscvspdpn   highpart

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-07  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09  6:35 [Bug target/108338] New: use mtvsrws for lowpart DI->SF conversion on P9 guojiufu at gcc dot gnu.org
2023-10-07  7:57 ` [Bug target/108338] " cvs-commit at gcc dot gnu.org
2023-10-07  7:57 ` cvs-commit at gcc dot gnu.org
2023-10-07  8:03 ` guojiufu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).