public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "munroesj at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/100085] Bad code for union transfer from __float128 to vector types
Date: Fri, 16 Apr 2021 20:30:08 +0000	[thread overview]
Message-ID: <bug-100085-4-1KIHR9yeDz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100085-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Steven Munroe <munroesj at gcc dot gnu.org> ---
I am seeing this a similar problem with union transfers from __float128 to
__int128.


     static inline unsigned __int128
     vec_xfer_bin128_2_int128t (__binary128 f128)
     {
       __VF_128 vunion;

       vunion.vf1 = f128;

       return (vunion.ui1);
     }

and 

unsigned __int128
test_xfer_bin128_2_int128 (__binary128 f128)
{
  return vec_xfer_bin128_2_int128t (f128);
}

generates:

0000000000000030 <test_xfer_bin128_2_int128>:
  30:   57 12 42 f0     xxswapd vs34,vs34
  34:   20 00 20 39     li      r9,32
  38:   d0 ff 41 39     addi    r10,r1,-48
  3c:   99 4f 4a 7c     stxvd2x vs34,r10,r9
  40:   f0 ff 61 e8     ld      r3,-16(r1)
  44:   f8 ff 81 e8     ld      r4,-8(r1)
  48:   20 00 80 4e     blr

For POWER8 should use mfvsrd/xxpermdi/mfvsrd.

This looks like the root cause of poor performance for __float128 soft-float on
POWER8. A simple benchmark using __float128 in C code calling libgcc for
-mcpu=power8 and then hardware instructions for -mcpu=power9.

P8 target P8AT14, Uses libgcc __addkf3_sw and __mulkf3_sw:
test_time_f128 f128 CC  tb delta = 52589, sec = 0.000102713

P9 Target P8AT14, Uses libgcc __addkf3_hw and __mulkf3_hw:
test_time_f128 f128 CC  tb delta = 18762, sec = 3.66445e-05

P9 Target P9AT14, inline hardware binary128 float:
test_time_f128 f128 CC  tb delta = 3809, sec = 7.43945e-06

I used Valgrind Itrace and Sim-ppc and perfstat analysis. Every call to libgcc
__add/sub/mul/divkf3 takes a load-hit-store flush every call. This explains why
__float128 is so 13.8 X slower on P8 then P9.

  parent reply	other threads:[~2021-04-16 20:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 18:19 [Bug rtl-optimization/100085] New: " munroesj at gcc dot gnu.org
2021-04-14 18:22 ` [Bug rtl-optimization/100085] " munroesj at gcc dot gnu.org
2021-04-15  6:59 ` [Bug target/100085] " rguenth at gcc dot gnu.org
2021-04-15 18:41 ` segher at gcc dot gnu.org
2021-04-16 20:30 ` munroesj at gcc dot gnu.org [this message]
2021-04-29 15:04 ` munroesj at gcc dot gnu.org
2021-04-30 19:52 ` bergner at gcc dot gnu.org
2021-05-24  6:41 ` luoxhu at gcc dot gnu.org
2021-05-24 21:49 ` segher at gcc dot gnu.org
2021-06-02  8:27 ` luoxhu at gcc dot gnu.org
2021-06-09  5:13 ` luoxhu at gcc dot gnu.org
2021-06-09 21:35 ` bergner at gcc dot gnu.org
2021-06-09 22:08 ` segher at gcc dot gnu.org
2021-06-10 15:00 ` munroesj at gcc dot gnu.org
2021-06-11 20:28 ` segher at gcc dot gnu.org
2022-01-14 17:17 ` wschmidt at gcc dot gnu.org
2022-02-24 20:48 ` munroesj at gcc dot gnu.org
2022-02-24 20:53 ` munroesj at gcc dot gnu.org
2022-02-24 21:17 ` segher at gcc dot gnu.org
2022-02-24 21:22 ` segher at gcc dot gnu.org
2022-02-24 21:26 ` segher at gcc dot gnu.org
2022-02-25 15:31 ` munroesj at gcc dot gnu.org
2022-02-25 22:57 ` segher at gcc dot gnu.org
2022-02-26 16:22 ` munroesj at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100085-4-1KIHR9yeDz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).