public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/104045] New: [AArch64] combine related to insn fmaxnm
@ 2022-01-16 1:40 zhongyunde at huawei dot com
2022-01-16 1:49 ` [Bug target/104045] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: zhongyunde at huawei dot com @ 2022-01-16 1:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
Bug ID: 104045
Summary: [AArch64] combine related to insn fmaxnm
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zhongyunde at huawei dot com
Target Milestone: ---
test case, see detail https://gcc.godbolt.org/z/95osxxjx5
float foo(float a)
{
float x = 1.0f;
float y = 0.0f;
float z = x / y;
return fmax (a, z);
}
as the z is Inf, so above fmax need be combined as clang ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/104045] [AArch64] combine related to insn fmaxnm
2022-01-16 1:40 [Bug c/104045] New: [AArch64] combine related to insn fmaxnm zhongyunde at huawei dot com
@ 2022-01-16 1:49 ` pinskia at gcc dot gnu.org
2022-01-16 2:00 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-16 1:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think gcc is correct and clang is wrong. Fmax treats Nan as missing data so
fmax<Nana, a> is really just a.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/104045] [AArch64] combine related to insn fmaxnm
2022-01-16 1:40 [Bug c/104045] New: [AArch64] combine related to insn fmaxnm zhongyunde at huawei dot com
2022-01-16 1:49 ` [Bug target/104045] " pinskia at gcc dot gnu.org
@ 2022-01-16 2:00 ` pinskia at gcc dot gnu.org
2022-01-16 2:02 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-16 2:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I read that wrong. We have
Max<inf, a>. I suspect the issue is gcc has -ftrapping-math turned on by
default while clang does not.
Does -fno-trapping-math fix the issue?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/104045] [AArch64] combine related to insn fmaxnm
2022-01-16 1:40 [Bug c/104045] New: [AArch64] combine related to insn fmaxnm zhongyunde at huawei dot com
2022-01-16 1:49 ` [Bug target/104045] " pinskia at gcc dot gnu.org
2022-01-16 2:00 ` pinskia at gcc dot gnu.org
@ 2022-01-16 2:02 ` pinskia at gcc dot gnu.org
2022-01-16 2:03 ` pinskia at gcc dot gnu.org
2022-01-17 21:16 ` joseph at codesourcery dot com
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-16 2:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes I just checked and we get the constant folding as expected with
-fno-trappimg-math.
So the defaults are different between the two.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/104045] [AArch64] combine related to insn fmaxnm
2022-01-16 1:40 [Bug c/104045] New: [AArch64] combine related to insn fmaxnm zhongyunde at huawei dot com
` (2 preceding siblings ...)
2022-01-16 2:02 ` pinskia at gcc dot gnu.org
@ 2022-01-16 2:03 ` pinskia at gcc dot gnu.org
2022-01-17 21:16 ` joseph at codesourcery dot com
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-16 2:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I don't even think llvm implements-ftrapping-math . Still not a gcc bug.
There is a bug request on changing the default already opened for gcc.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/104045] [AArch64] combine related to insn fmaxnm
2022-01-16 1:40 [Bug c/104045] New: [AArch64] combine related to insn fmaxnm zhongyunde at huawei dot com
` (3 preceding siblings ...)
2022-01-16 2:03 ` pinskia at gcc dot gnu.org
@ 2022-01-17 21:16 ` joseph at codesourcery dot com
4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2022-01-17 21:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104045
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Folding the fmax operation should be valid in the absence of
-fsignaling-nans (fmax (a, +Inf) should return +Inf without raising any
exceptions, for any x not a signaling NaN). However, replacing the
division with the constant +Inf is only valid with -fno-trapping-math
(though it would be OK by default to use the fact that the result is +Inf
in optimizing the fmax call, as long as the division itself doesn't get
removed so the divide-by-zero exception is preserved).
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-01-17 21:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 1:40 [Bug c/104045] New: [AArch64] combine related to insn fmaxnm zhongyunde at huawei dot com
2022-01-16 1:49 ` [Bug target/104045] " pinskia at gcc dot gnu.org
2022-01-16 2:00 ` pinskia at gcc dot gnu.org
2022-01-16 2:02 ` pinskia at gcc dot gnu.org
2022-01-16 2:03 ` pinskia at gcc dot gnu.org
2022-01-17 21:16 ` joseph at codesourcery 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).