From: Roger Sayle Date: Fri, 10 Sep 2004 02:32:19 +0000 (+0000) Subject: i386.c (ix86_expand_ashlsi3_const): New function to expand a left shift by an immedia... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1b83d20963c6db039c6530949db4da9581f86ce9;p=gcc.git i386.c (ix86_expand_ashlsi3_const): New function to expand a left shift by an immediate constant as either an ashl... * config/i386/i386.c (ix86_expand_ashlsi3_const): New function to expand a left shift by an immediate constant as either an ashl or a sequence of additions. (ix86_split_ashldi): Use new ix86_expand_ashlsi3_const function instead of calling gen_ashlsi3 with a constant directly. From-SVN: r87271 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06bef510120..90ca63fd3ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-09 Roger Sayle + + * config/i386/i386.c (ix86_expand_ashlsi3_const): New function to + expand a left shift by an immediate constant as either an ashl or + a sequence of additions. + (ix86_split_ashldi): Use new ix86_expand_ashlsi3_const function + instead of calling gen_ashlsi3 with a constant directly. + 2004-09-09 Roger Sayle * config/i386/i386.c (ix86_split_long_move): When optimizing for diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 2a175452a19..e034fa9ef4e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9973,6 +9973,26 @@ ix86_split_long_move (rtx operands[]) return; } +/* Helper function of ix86_split_ashldi used to generate an SImode + left shift by a constant, either using a single shift or + a sequence of add instructions. */ + +static void +ix86_expand_ashlsi3_const (rtx operand, int count) +{ + if (count == 1) + emit_insn (gen_addsi3 (operand, operand, operand)); + else if (!optimize_size + && count * ix86_cost->add <= ix86_cost->shift_const) + { + int i; + for (i=0; i 32) - emit_insn (gen_ashlsi3 (high[0], high[0], GEN_INT (count - 32))); + ix86_expand_ashlsi3_const (high[0], count - 32); } else { if (!rtx_equal_p (operands[0], operands[1])) emit_move_insn (operands[0], operands[1]); emit_insn (gen_x86_shld_1 (high[0], low[0], GEN_INT (count))); - emit_insn (gen_ashlsi3 (low[0], low[0], GEN_INT (count))); + ix86_expand_ashlsi3_const (low[0], count); } } else