https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110748
--- Comment #15 from Vineet Gupta <vineetg at gcc dot gnu.org> --- (In reply to Vineet Gupta from comment #12) > > void znd(double *d) { *d = -0.0; } > > void znf(float *f) { *f = -0.0; } We need 3 set of changes to get const -0.0 working: 1. Allow expand to generate set mem const_couble -0.0 - rtx cost adj so compress_float_constant () doesn't force_const_mem () - riscv_legitimize_move to allow -0.0 and not force a reg 2. Allow subsequent passes to recog() this set mem const_double -0.0 - Beef up "*movdf_hardfloat_rv64" with additional condition check for -0.0 - Add a new constraint for -0.0 3. Add a splitter (for split1, not combine) to generate the int reg On the branch devel/vineetg/optim-double-const-m0 I have double -0.0 working. znd: li a5,-1 slli a5,a5,63 sd a5,0(a0) ret There's currently an ICE for zbs IRA is undoing the split so the insn with const_int 0x80000000_00000000 doesn't exist for final pass. expand ------ (insn 6 3 0 2 (set (mem:DF (reg:DI 135) (const_double:DF -0.0 [-0x0.0p+0])) {*movdf_hardfloat_rv64} split1 ----- (insn 10 3 11 2 (set (reg:DI 136) (const_int [0x8000000000000000])) (insn 11 10 0 2 (set (mem:DF (reg:DI 135) (subreg:DF (reg:DI 136) 0)) ira ---- (insn 11 9 12 2 (set (mem:DF (reg:DI 135) (const_double:DF -0.0 [-0x0.0p+0])) {*movdf_hardfloat_rv64}