This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/6] Andes nds32: machine description of nds32 porting (2).


Chung-Ju Wu <jasonwucj@gmail.com> writes:
> +  /* If operands[1] is a large constant and cannot be performed
> +     move behavior with single instruction, we need to split it.  */

Suggest "...cannot by performed by a single instruction..."

> +      high20_rtx = GEN_INT ((INTVAL (operands[1]) >> 12) << 12);

Better to use gen_int_mode (..., SImode).  Although GEN_INT will be OK
if the compiler uses an arithmetic shift for >>, that isn't guaranteed
(although I doubt any modern compiler would use anything else).

> +      low12_rtx = GEN_INT (INTVAL (operands[1]) & 0xfff);
> +
> +      emit_move_insn (tmp_rtx, high20_rtx);
> +      emit_move_insn (operands[0], plus_constant (SImode,
> +						  tmp_rtx,
> +						  INTVAL (low12_rtx)));

There's no need to create an rtx and then use INTVAL on it.
low12 can just be a HOST_WIDE_INT.

Looks good to me with those changes, thanks.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]