[Bug target/98140] Reused register by xsmincdp leads to wrong NaN propagation on Power9

2024-05-14 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98140

--- Comment #3 from Jiu Fu Guo  ---
(In reply to Jiu Fu Guo from comment #2)
> (In reply to Alexander Grund from comment #1)
> > It looks like this was fixed in 10.1 by this commit
> > https://github.com/gcc-mirror/gcc/commit/
> > 37e0df8a9be5a8232f4ccb73cdadb02121ba523f
> ...
> > `HONOR_NANS (compare_mode)` case. However it still ignores signed zeros.
> 
> 'xsmincdp' may be fine for zeros, it seems '!HONOR_SIGNED_ZEROS' is not
> needed.
> 
> > Maybe xsmindp would be a better fit as it preserves the signed zeros. Only
> > downside I see is that it converts sNan to qNan which may be an issue.
Oh, sorry. for -0 and +0, xsmincdp returns the 2nd operand,  xsmindp returns
-0.

[Bug target/98140] Reused register by xsmincdp leads to wrong NaN propagation on Power9

2024-04-24 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98140

Jiu Fu Guo  changed:

   What|Removed |Added

 CC||guojiufu at gcc dot gnu.org

--- Comment #2 from Jiu Fu Guo  ---
(In reply to Alexander Grund from comment #1)
> It looks like this was fixed in 10.1 by this commit
> https://github.com/gcc-mirror/gcc/commit/
> 37e0df8a9be5a8232f4ccb73cdadb02121ba523f
...
> `HONOR_NANS (compare_mode)` case. However it still ignores signed zeros.

'xsmincdp' may be fine for zeros, it seems '!HONOR_SIGNED_ZEROS' is not needed.

> Maybe xsmindp would be a better fit as it preserves the signed zeros. Only
> downside I see is that it converts sNan to qNan which may be an issue.

[Bug target/98140] Reused register by xsmincdp leads to wrong NaN propagation on Power9

2020-12-04 Thread alexander.grund--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98140

--- Comment #1 from Alexander Grund  ---
It looks like this was fixed in 10.1 by this commit
https://github.com/gcc-mirror/gcc/commit/37e0df8a9be5a8232f4ccb73cdadb02121ba523f

However the codegen looks worse:

 390:   20 00 9e c3 lfs f28,32(r30)
 394:   00 e0 9e ff fcmpu   cr7,f30,f28
 398:   10 00 9c 41 blt cr7,3a8
 39c:   40 00 9e c3 lfs f28,64(r30)
 3a0:   58 e0 1e f0 xscmpgtdp vs0,vs30,vs28
 3a4:   30 e0 9e f3 xxsel   vs28,vs30,vs28,vs0

When switching an (a > b) ? b : a to an xsmincdp, the arguments must be swapped
to honor the NaN rules. This would allow this to be used for the `HONOR_NANS
(compare_mode)` case. However it still ignores signed zeros. Maybe xsmindp
would be a better fit as it preserves the signed zeros. Only downside I see is
that it converts sNan to qNan which may be an issue.