public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Matthias Kretz <m.kretz@gsi.de>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH 04/11 v3] libstdc++: Make use of __builtin_bit_cast
Date: Fri, 25 Jun 2021 12:23:46 +0100	[thread overview]
Message-ID: <CACb0b4=x=_4okOWnydfNXp=QS5torF+-fN5Ct7gbu1X7BHzyDg@mail.gmail.com> (raw)
In-Reply-To: <14392010.RDIVbhacDa@minbar>

On Thu, 24 Jun 2021 at 15:02, Matthias Kretz wrote:
>
> For -ffast-math there was a missing using namespace __proposed left. The
> attached patch resolves the issue.

OK for trunk, please push (after adding yourself to the "Write After
Approval" section of MAINTAINERS as per
https://gcc.gnu.org/gitwrite.html as your first commit).

Thanks!


> From: Matthias Kretz <m.kretz@gsi.de>
>
> The __bit_cast function was a hack to achieve what __builtin_bit_cast
> can do, therefore use __builtin_bit_cast if possible. However,
> __builtin_bit_cast cannot be used to cast from/to fixed_size_simd, since
> it isn't trivially copyable (in the language sense — in principle it
> is). Therefore add __proposed::simd_bit_cast to enable the use case
> required in the test framework.
>
> Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
>
> libstdc++-v3/ChangeLog:
>
>         * include/experimental/bits/simd.h (__bit_cast): Implement via
>         __builtin_bit_cast #if available.
>         (__proposed::simd_bit_cast): Add overloads for simd and
>         simd_mask, which use __builtin_bit_cast (or __bit_cast #if not
>         available), which return an object of the requested type with
>         the same bits as the argument.
>         * include/experimental/bits/simd_math.h: Use simd_bit_cast
>         instead of __bit_cast to allow casts to fixed_size_simd.
>         (copysign): Remove branch that was only required if __bit_cast
>         cannot be constexpr.
>         * testsuite/experimental/simd/tests/bits/test_values.h: Switch
>         from __bit_cast to __proposed::simd_bit_cast since the former
>         will not cast fixed_size objects anymore.
> ---
>  libstdc++-v3/include/experimental/bits/simd.h | 57 ++++++++++++++++++-
>  .../include/experimental/bits/simd_math.h     | 37 ++++++------
>  .../simd/tests/bits/test_values.h             |  8 +--
>  3 files changed, 76 insertions(+), 26 deletions(-)
>
>
> --
> ──────────────────────────────────────────────────────────────────────────
>  Dr. Matthias Kretz                           https://mattkretz.github.io
>  GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
>  std::experimental::simd              https://github.com/VcDevel/std-simd
> ──────────────────────────────────────────────────────────────────────────


  parent reply	other threads:[~2021-06-25 11:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 12:10 [PATCH 00/11] stdx::simd optimizations, corrections, and cleanups Matthias Kretz
2021-06-08 12:11 ` [PATCH 01/11] libstdc++: Improve copysign codegen Matthias Kretz
2021-06-08 12:11 ` [PATCH 02/11] libstdc++: Remove dead code Matthias Kretz
2021-06-08 12:11 ` [PATCH 03/11] libstdc++: Improve fixed_size codegen Matthias Kretz
2021-06-08 12:11 ` [PATCH 04/11] libstdc++: Make use of __builtin_bit_cast Matthias Kretz
2021-06-11 10:53   ` [PATCH 04/11 v2] " Matthias Kretz
2021-06-24 14:01     ` [PATCH 04/11 v3] " Matthias Kretz
2021-06-24 14:08       ` Jakub Jelinek
2021-06-24 14:11         ` Jonathan Wakely
2021-06-24 14:12           ` Jonathan Wakely
2021-06-24 14:21           ` Jakub Jelinek
2021-06-24 14:34             ` Jonathan Wakely
2021-06-24 14:40               ` Jonathan Wakely
2021-06-24 14:44                 ` Jakub Jelinek
2021-06-25 11:23       ` Jonathan Wakely [this message]
2021-06-08 12:11 ` [PATCH 05/11] libstdc++: Remove incorrect fabs overload Matthias Kretz
2021-06-08 12:11 ` [PATCH 06/11] libstdc++: Minor simd_math cleanups Matthias Kretz
2021-06-08 12:11 ` [PATCH 07/11] libstdc++: Fix condition when AVX512F ldexp implementation is used Matthias Kretz
2021-06-08 12:11 ` [PATCH 08/11] libstdc++: Avoid raising fp exceptions in trunc, floor, and ceil Matthias Kretz
2021-06-08 12:11 ` [PATCH 09/11] libstdc++: Ensure unrolled loops inline the lambda Matthias Kretz
2021-06-08 12:12 ` [PATCH 10/11] libstdc++: Fix internal names: add missing underscores Matthias Kretz
2021-06-08 12:12 ` [PATCH 11/11] libstdc++: Fix ODR issues with different -m flags Matthias Kretz
2021-06-09 12:22   ` Richard Biener
2021-06-09 12:53     ` Matthias Kretz
2021-06-09 13:22       ` Richard Biener
2021-11-15  8:57   ` Matthias Kretz
2022-01-14 21:30     ` Jonathan Wakely
2022-01-17  0:08       ` Jonathan Wakely
2021-06-24 13:42 ` [PATCH 00/11] stdx::simd optimizations, corrections, and cleanups Jonathan Wakely

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='CACb0b4=x=_4okOWnydfNXp=QS5torF+-fN5Ct7gbu1X7BHzyDg@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=m.kretz@gsi.de \
    /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).