This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/6] Andes nds32: machine description of nds32 porting (2).
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Chung-Ju Wu <jasonwucj at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, cltang at codesourcery dot com
- Date: Sun, 13 Oct 2013 17:36:14 +0100
- Subject: Re: [PATCH 2/6] Andes nds32: machine description of nds32 porting (2).
- Authentication-results: sourceware.org; auth=none
- References: <CADj25HOO04tn85ZfL2adeHUo8EL7mGwFf8yB4CadofGCNVszVQ at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1307092324060 dot 29921 at digraph dot polyomino dot org dot uk> <51EFF7CA dot 6050601 at gmail dot com> <51F0F2F5 dot 6040905 at gmail dot com> <522CA258 dot 2010403 at gmail dot com> <87six7k4x5 dot fsf at talisman dot default> <5245CAF2 dot 2020106 at gmail dot com> <87had0lwyg dot fsf at talisman dot default> <525058A5 dot 4020504 at gmail dot com> <87li26sowi dot fsf at talisman dot default> <525A924F dot 8040005 at gmail dot com>
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