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

* [Bug target/108338] use mtvsrws for lowpart DI->SF conversion on P9
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-07  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jiu Fu Guo <guojiufu@gcc.gnu.org>:

https://gcc.gnu.org/g:5f56b76ff1c15118200204569389f85cca4e32d3

commit r14-4444-g5f56b76ff1c15118200204569389f85cca4e32d3
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Thu Sep 28 17:00:04 2023 +0800

    rs6000: optimize moving to sf from highpart di

    Currently, we have the pattern "movsf_from_si2" which was trying
    to support moving high part DI to SF.

    But current pattern only accepts "ashiftrt":
    XX:SF=bitcast:SF(subreg(YY:DI>>32),0), but actually "lshiftrt" should
    also be ok.
    And current pattern only supports BE.

    Here, updating the pattern to support BE and "lshiftrt".

            PR target/108338

    gcc/ChangeLog:

            * config/rs6000/predicates.md (lowpart_subreg_operator): New
            define_predicate.
            * config/rs6000/rs6000.md (any_rshift): New code_iterator.
            (movsf_from_si2): Rename to ...
            (movsf_from_si2_<code>): ... this.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr108338.c: New test.

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

* [Bug target/108338] use mtvsrws for lowpart DI->SF conversion on P9
  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
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-07  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jiu Fu Guo <guojiufu@gcc.gnu.org>:

https://gcc.gnu.org/g:537d7a445ca0ed677751afd3cdcf8465ccd5fb7e

commit r14-4445-g537d7a445ca0ed677751afd3cdcf8465ccd5fb7e
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Thu Sep 28 17:34:45 2023 +0800

    rs6000: use mtvsrws to move sf from si p9

    As mentioned in PR108338, on p9, we could use mtvsrws to implement
    the bitcast from SI to SF (or lowpart DI to SF).

    For example:
      *(long long*)buff = di;
      float f = *(float*)(buff);

    "sldi 9,3,32 ; mtvsrd 1,9 ; xscvspdpn 1,1" is generated.
    A better one would be "mtvsrws 1,3 ; xscvspdpn 1,1".

            PR target/108338

    gcc/ChangeLog:

            * config/rs6000/rs6000.md (movsf_from_si): Update to generate
mtvsrws
            for P9.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr108338.c: Updated to check mtvsrws for p9.

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

* [Bug target/108338] use mtvsrws for lowpart DI->SF conversion on P9
  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
  2 siblings, 0 replies; 4+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2023-10-07  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jiu Fu Guo <guojiufu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
Fixed.

^ 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).