On Mon, Oct 20, 2025 at 4:14 PM Matthias Kretz <[email protected]> wrote:

> Tomasz Kaminski [Monday, 20 October 2025, 15:56:35 CEST]:
> > > On -O0 builds __builtin_constant_p(whatever) is unconditionally false,
> > > AFAIK.
> > > And yes, my main workflow is to verify asm output (while having unit
> test
> > > compiling in the background).
> >
> > That touches with my major concern, the user will be debugining (with
> > optimization disabled) a different code than one that will be used by
> > optimized
> > builds, and was having an issue.
> > That's why I prefer to have this localized in one place.
>
> If the bug is in libstdc++ or a wrong-code bug in GCC, then yes, this is a
> problem. If the bug is in the user's code, then what difference does it
> make?
>
I assume there is a possibility of situations when builtins will fail, but
element-wise
code will work. For example  when someone uses misaligned simd object, that
was
reinterpret casted from chunk of memory.
In that case, the problem will disappear for non-optimized code.

Anyway, I am not asking you to remove it completely, just centralize the
checks
to one place.

>
> But yes, testing the simd code requires us to test
> 1. constexpr
> 2. const-prop inputs
> 3. unknown inputs
>
> And for some binary operations it could make a difference whether one or
> both
> operands are const-prop.
>
> My test suite tries to cover all of these tests.
>
> --
> ──────────────────────────────────────────────────────────────────────────
>  Dr. Matthias Kretz                           https://mattkretz.github.io
>  GSI Helmholtz Center for Heavy Ion Research               https://gsi.de
>  std::simd
> ──────────────────────────────────────────────────────────────────────────
>

Reply via email to