From: Pan Li <pan2...@intel.com> The Pmode is designed for pointer, thus leverage the Xmode instead for the expanding of the ussub.
gcc/ChangeLog: * config/riscv/riscv.cc (riscv_expand_ussub): Promote to Xmode instead of Pmode. Signed-off-by: Pan Li <pan2...@intel.com> --- gcc/config/riscv/riscv.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index a490b9598b0..8ece7859945 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -11620,26 +11620,26 @@ void riscv_expand_ussub (rtx dest, rtx x, rtx y) { machine_mode mode = GET_MODE (dest); - rtx pmode_x = gen_lowpart (Pmode, x); - rtx pmode_y = gen_lowpart (Pmode, y); - rtx pmode_lt = gen_reg_rtx (Pmode); - rtx pmode_minus = gen_reg_rtx (Pmode); - rtx pmode_dest = gen_reg_rtx (Pmode); + rtx xmode_x = gen_lowpart (Xmode, x); + rtx xmode_y = gen_lowpart (Xmode, y); + rtx xmode_lt = gen_reg_rtx (Xmode); + rtx xmode_minus = gen_reg_rtx (Xmode); + rtx xmode_dest = gen_reg_rtx (Xmode); /* Step-1: minus = x - y */ - riscv_emit_binary (MINUS, pmode_minus, pmode_x, pmode_y); + riscv_emit_binary (MINUS, xmode_minus, xmode_x, xmode_y); /* Step-2: lt = x < y */ - riscv_emit_binary (LTU, pmode_lt, pmode_x, pmode_y); + riscv_emit_binary (LTU, xmode_lt, xmode_x, xmode_y); /* Step-3: lt = lt - 1 (lt + (-1)) */ - riscv_emit_binary (PLUS, pmode_lt, pmode_lt, CONSTM1_RTX (Pmode)); + riscv_emit_binary (PLUS, xmode_lt, xmode_lt, CONSTM1_RTX (Xmode)); - /* Step-4: pmode_dest = minus & lt */ - riscv_emit_binary (AND, pmode_dest, pmode_lt, pmode_minus); + /* Step-4: xmode_dest = minus & lt */ + riscv_emit_binary (AND, xmode_dest, xmode_lt, xmode_minus); - /* Step-5: dest = pmode_dest */ - emit_move_insn (dest, gen_lowpart (mode, pmode_dest)); + /* Step-5: dest = xmode_dest */ + emit_move_insn (dest, gen_lowpart (mode, xmode_dest)); } /* Implement the unsigned saturation truncation for int mode. -- 2.34.1