public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109028] New: fcmov will not be generated
@ 2023-03-05 11:11 g.peterhoff@t-online.de
2023-03-05 11:24 ` [Bug target/109028] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: g.peterhoff@t-online.de @ 2023-03-05 11:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109028
Bug ID: 109028
Summary: fcmov will not be generated
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: g.peterhoff@t-online.de
Target Milestone: ---
Hello,
very rarely fcmov instructions are generated (https://godbolt.org/z/qE6f76Gda)
thx
Gero
#include <cmath>
#include <array>
#include <numbers>
static constexpr size_t Size = 1024;
using float80_t = long double;
using float64_t = double;
using float32_t = float;
template <typename Type>
inline constexpr Type foo(const Type x) noexcept
{
return (x > 42) ? std::numbers::pi_v<Type> : std::numbers::e_v<Type>;
}
template <typename Type>
inline constexpr Type bar(const Type x) noexcept
{
return std::signbit(x) ? std::numbers::pi_v<Type> : 0;
}
template <typename Type>
inline constexpr Type baz(const Type x) noexcept
{
return std::copysign(std::numbers::pi_v<Type>, x);
}
template <typename Container, typename Function>
inline constexpr void for_all(Container& cnt, Function&& f) noexcept
{
for (auto& val : cnt)
{
val = f(val);
}
}
float80_t foo80(const float80_t x) noexcept { return foo(x); }
float80_t bar80(const float80_t x) noexcept { return bar(x); }
float80_t baz80(const float80_t x) noexcept { return baz(x); }
void foos80(std::array<float80_t, Size>& cnt) noexcept { for_all(cnt,
foo<float80_t>); }
void bars80(std::array<float80_t, Size>& cnt) noexcept { for_all(cnt,
bar<float80_t>); }
void bazs80(std::array<float80_t, Size>& cnt) noexcept { for_all(cnt,
baz<float80_t>); }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/109028] fcmov will not be generated
2023-03-05 11:11 [Bug target/109028] New: fcmov will not be generated g.peterhoff@t-online.de
@ 2023-03-05 11:24 ` pinskia at gcc dot gnu.org
2023-03-05 11:37 ` g.peterhoff@t-online.de
2023-03-05 11:38 ` ubizjak at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-05 11:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109028
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
X87 code generation is definitely not as optimized as other code really.
Also fcmov is newish.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/109028] fcmov will not be generated
2023-03-05 11:11 [Bug target/109028] New: fcmov will not be generated g.peterhoff@t-online.de
2023-03-05 11:24 ` [Bug target/109028] " pinskia at gcc dot gnu.org
@ 2023-03-05 11:37 ` g.peterhoff@t-online.de
2023-03-05 11:38 ` ubizjak at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: g.peterhoff@t-online.de @ 2023-03-05 11:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109028
--- Comment #2 from g.peterhoff@t-online.de ---
> X87 code generation is definitely not as optimized as other code really.
Ok
> Also fcmov is newish.
New?
fcmov was introduced with the PentiumPro (1995) - that's 27 years ago. :-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/109028] fcmov will not be generated
2023-03-05 11:11 [Bug target/109028] New: fcmov will not be generated g.peterhoff@t-online.de
2023-03-05 11:24 ` [Bug target/109028] " pinskia at gcc dot gnu.org
2023-03-05 11:37 ` g.peterhoff@t-online.de
@ 2023-03-05 11:38 ` ubizjak at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2023-03-05 11:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109028
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> X87 code generation is definitely not as optimized as other code really.
You are wrong here.
> Also fcmov is newish.
It is because fcmov would require two memory loads in front of fcmov.
And because conditional moves on x86 are real PITA performance wise.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-05 11:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-05 11:11 [Bug target/109028] New: fcmov will not be generated g.peterhoff@t-online.de
2023-03-05 11:24 ` [Bug target/109028] " pinskia at gcc dot gnu.org
2023-03-05 11:37 ` g.peterhoff@t-online.de
2023-03-05 11:38 ` ubizjak at gmail dot com
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).