public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/113234] New: missing folding to builtin_isunordered if manual nan comparison is used
@ 2024-01-04 14:52 denis.campredon at gmail dot com
2024-01-04 15:38 ` [Bug rtl-optimization/113234] " jsm28 at gcc dot gnu.org
2024-01-04 15:44 ` [Bug tree-optimization/113234] " pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: denis.campredon at gmail dot com @ 2024-01-04 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113234
Bug ID: 113234
Summary: missing folding to builtin_isunordered if manual nan
comparison is used
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: denis.campredon at gmail dot com
Target Milestone: ---
Compiled with -O1, on x86-64, f1 and f2 should produce the same code than f3
and f4, but f1 and f2 use two comparisons whereas f3 and f4 only use 1.
-------------------
bool f1(float i, float j)
{
return i !=i || j != j;
}
bool f2(float i, float j)
{
return i == i && j == j;
}
bool f3(float i, float j)
{
return __builtin_isnan(i) || __builtin_isnan(j);
}
bool f4(float i, float j)
{
return !__builtin_isnan(i) && !__builtin_isnan(j);
}
-------------------------------
It seems that gcc does not fold "f != f" to __builtin_isnan, or too late,
leading to the missed optimisation.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-04 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04 14:52 [Bug rtl-optimization/113234] New: missing folding to builtin_isunordered if manual nan comparison is used denis.campredon at gmail dot com
2024-01-04 15:38 ` [Bug rtl-optimization/113234] " jsm28 at gcc dot gnu.org
2024-01-04 15:44 ` [Bug tree-optimization/113234] " pinskia at gcc dot gnu.org
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).