diff options
author | Vineet Gupta <vineetg@rivosinc.com> | 2025-08-13 20:20:34 -0700 |
---|---|---|
committer | Vineet Gupta <vineetg@rivosinc.com> | 2025-08-15 10:40:35 -0700 |
commit | f5696e9b1113b0a8e464cabb8cc26c871b1d9289 (patch) | |
tree | 1750ec222534037494849ae56371628b9e82306c /libjava/java/net | |
parent | e905d7ee2bd428a9a31a993053a8da926733fb61 (diff) | |
download | gcc-trunk.zip gcc-trunk.tar.gz gcc-trunk.tar.bz2 |
__builtin_round() fails to save/restore FP exception flags around the FP
compare insn which can potentially clobber the same.
Worth noting that the fflags restore bracketing is slightly different
than the glibc implementation. Both FLT and FCVT can potentially clobber
fflags. gcc generates below where even if branch is not taken and FCVT
is not executed, FLT still executed. Thus FSFLAGS is placed AFTER the
label 'L3'. glibc implementation FLT can't clobber due to early NaN check,
so FSFLAGS can be moved under the branch, before the label.
| convert_float_to_float_round
| ...
| frflags a5
| fabs.s fa5,fa0
| flt.s a4,fa5,fa4 <--- can clobber fflags
| beq a4,zero,.L3
| fcvt.w.s a4,fa0,rmm <--- also
| fcvt.s.w fa5,a4
| fsgnj.s fa0,fa5,fa0
| .L3:
| fsflags a5 <-- both code paths
Fixes: f652a35877e3 ("This is almost exclusively Jivan's work....")
PR target/121534
gcc/ChangeLog:
* config/riscv/riscv.md (round_pattern): save/restore fflags.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vls/math-nearbyint-1.c: Adjust
scan pattern for additional instances of frflags/fsrflags.
Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
Diffstat (limited to 'libjava/java/net')
0 files changed, 0 insertions, 0 deletions