This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, RFC, rs6000, v3] enable early gimple-folding of vec_splat
- From: Bill Schmidt <wschmidt at linux dot ibm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>, Will Schmidt <will_schmidt at vnet dot ibm dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>, David Edelsohn <dje dot gcc at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 12 Sep 2018 08:47:08 -0500
- Subject: Re: [PATCH, RFC, rs6000, v3] enable early gimple-folding of vec_splat
- References: <1533669927.4452.14.camel@brimstone.rchland.ibm.com> <6E9306D6-B8A1-42F6-90E9-0E6CC7AC66FA@linux.ibm.com> <1534434645.18801.8.camel@brimstone.rchland.ibm.com> <20180816205117.GA24439@gate.crashing.org> <1534801470.26070.20.camel@brimstone.rchland.ibm.com> <20180912132339.GK23155@gate.crashing.org>
On 9/12/18 8:23 AM, Segher Boessenkool wrote:
> Hi!
>
> Sorry this is all taking so long.
>
> On Mon, Aug 20, 2018 at 04:44:30PM -0500, Will Schmidt wrote:
>> 2018-08-20 Will Schmidt <will_schmidt@vnet.ibm.com>
>>
>> * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add support for
>> early gimple folding of vec_splat().
> "early" should indent together with the "*" above, not "config".
>
>> * tree-vect-generic.c: Remove static from tree_vec_extract() definition.
>> * gimple-fold.h: Add an extern define for tree_vec_extract().
> One space after : .
>
>> --- a/gcc/config/rs6000/rs6000.c
>> +++ b/gcc/config/rs6000/rs6000.c
>> @@ -15768,10 +15768,52 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
>> tree splat_tree = build_vector_from_val (TREE_TYPE (lhs), splat_value);
>> g = gimple_build_assign (lhs, splat_tree);
>> gimple_set_location (g, gimple_location (stmt));
>> gsi_replace (gsi, g, true);
>> return true;
>> + }
> Something is wrong with the indent here (in the original code already).
>
>> + arg0 = gimple_call_arg (stmt, 0); /* input vector. */
>> + arg1 = gimple_call_arg (stmt, 1); /* index into arg0. */
>> + /* Only fold the vec_splat_*() if arg1 is both a constant value, and a valid
>> + index into the arg0 vector. */
> First comment line wraps, please break it a little earlier?
>
>> + unsigned int n_elts = VECTOR_CST_NELTS (arg0);
>> + if (TREE_CODE (arg1) != INTEGER_CST
>> + || TREE_INT_CST_LOW (arg1) > (n_elts -1))
>> + return false;
> I think you should check lower bound 0 as well. Maybe use IN_RANGE?
And "-1" should be "- 1". Thanks!
Bill
>
> The rest looks fine, thanks! Okay for trunk (with the trivialities fixed).
>
>
> Segher
>