* [Bug target/110303] Without -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile
2023-06-19 0:03 [Bug c++/110303] New: In debug mode, gcc does not force compile time evaluation for immediate arguments denis.yaroshevskij at gmail dot com
@ 2023-06-19 0:17 ` pinskia at gcc dot gnu.org
2023-06-19 0:19 ` [Bug target/110303] With " pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-19 0:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110303
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|In debug mode, gcc does not |Without -O0,
|force compile time |_mm_shuffle_epi32 with a
|evaluation for immediate |constexpr function argument
|arguments |does not compile
Component|c++ |target
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is correct behavior really.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/110303] With -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile
2023-06-19 0:03 [Bug c++/110303] New: In debug mode, gcc does not force compile time evaluation for immediate arguments denis.yaroshevskij at gmail dot com
2023-06-19 0:17 ` [Bug target/110303] Without -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile pinskia at gcc dot gnu.org
@ 2023-06-19 0:19 ` pinskia at gcc dot gnu.org
2023-06-19 0:25 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-19 0:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110303
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
so _mm_shuffle_epi32 requires a constant but since it is an argument, the
argument, it is not a constant expression requirement.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/110303] With -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile
2023-06-19 0:03 [Bug c++/110303] New: In debug mode, gcc does not force compile time evaluation for immediate arguments denis.yaroshevskij at gmail dot com
2023-06-19 0:17 ` [Bug target/110303] Without -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile pinskia at gcc dot gnu.org
2023-06-19 0:19 ` [Bug target/110303] With " pinskia at gcc dot gnu.org
@ 2023-06-19 0:25 ` pinskia at gcc dot gnu.org
2023-06-19 7:40 ` denis.yaroshevskij at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-19 0:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110303
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 80353. constexpr function does not have to be a full constexpression
in many cases.
*** This bug has been marked as a duplicate of bug 80353 ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/110303] With -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile
2023-06-19 0:03 [Bug c++/110303] New: In debug mode, gcc does not force compile time evaluation for immediate arguments denis.yaroshevskij at gmail dot com
` (2 preceding siblings ...)
2023-06-19 0:25 ` pinskia at gcc dot gnu.org
@ 2023-06-19 7:40 ` denis.yaroshevskij at gmail dot com
2023-06-19 12:30 ` xry111 at gcc dot gnu.org
2023-06-19 12:51 ` m.cencora at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: denis.yaroshevskij at gmail dot com @ 2023-06-19 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110303
--- Comment #4 from Denis Yaroshevskiy <denis.yaroshevskij at gmail dot com> ---
> so _mm_shuffle_epi32 requires a constant but since it is an argument, the argument, it is not a constant expression requirement.
The function is marked constexpr. So it can be a constant if you ask it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/110303] With -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile
2023-06-19 0:03 [Bug c++/110303] New: In debug mode, gcc does not force compile time evaluation for immediate arguments denis.yaroshevskij at gmail dot com
` (3 preceding siblings ...)
2023-06-19 7:40 ` denis.yaroshevskij at gmail dot com
@ 2023-06-19 12:30 ` xry111 at gcc dot gnu.org
2023-06-19 12:51 ` m.cencora at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-06-19 12:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110303
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
--- Comment #5 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Denis Yaroshevskiy from comment #4)
> > so _mm_shuffle_epi32 requires a constant but since it is an argument, the argument, it is not a constant expression requirement.
>
> The function is marked constexpr. So it can be a constant if you ask it.
The problem is -O0 means "don't ask it". Constant propagation is an
optimization, but -O0 means don't do optimization.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/110303] With -O0, _mm_shuffle_epi32 with a constexpr function argument does not compile
2023-06-19 0:03 [Bug c++/110303] New: In debug mode, gcc does not force compile time evaluation for immediate arguments denis.yaroshevskij at gmail dot com
` (4 preceding siblings ...)
2023-06-19 12:30 ` xry111 at gcc dot gnu.org
@ 2023-06-19 12:51 ` m.cencora at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: m.cencora at gmail dot com @ 2023-06-19 12:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110303
m.cencora at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |m.cencora at gmail dot com
--- Comment #6 from m.cencora at gmail dot com ---
(In reply to Denis Yaroshevskiy from comment #4)
> > so _mm_shuffle_epi32 requires a constant but since it is an argument, the argument, it is not a constant expression requirement.
>
> The function is marked constexpr. So it can be a constant if you ask it.
constexpr at function declaration means that it COULD be evaluated in compile
time, but doesn't force it.
To force it either invoke it in a context that requires a compile-time
evaluation (e.g. static_assert, or initializer of constexpr variable), or mark
it as consteval instead.
^ permalink raw reply [flat|nested] 7+ messages in thread