This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: wide-int, rs6000
- From: Richard Sandiford <rsandifo at linux dot vnet dot ibm dot com>
- To: Mike Stump <mikestump at comcast dot net>
- Cc: David Edelsohn <dje dot gcc at gmail dot com>, Kenneth Zadeck <zadeck at naturalbridge dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 Nov 2013 11:58:58 +0000
- Subject: Re: wide-int, rs6000
- Authentication-results: sourceware.org; auth=none
- References: <42DC4C50-3430-4A2E-914C-FEC7A0DB7DEB at comcast dot net> <CAGWvny=BikM8xtDoRbKqL3sQQt+4-h2ZbL_F0zv+ZJmbAXOs9A at mail dot gmail dot com> <7CA46FBB-DFDB-40FB-B130-81621A22EC39 at comcast dot net>
Mike Stump <mikestump@comcast.net> writes:
> On Nov 25, 2013, at 12:03 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
>> 3) altivec_resolve_overloaded_builtin, both hunks should be converted
>> the same way, using tree_fits_uhwi_p
>>
>> - && TREE_CODE (arg2) == INTEGER_CST
>> - && TREE_INT_CST_HIGH (arg2) == 0
>> - && (TREE_INT_CST_LOW (arg2) == 0 || TREE_INT_CST_LOW (arg2) == 1))
>> + && tree_fits_uhwi_p (arg2)
>> + && wi::ltu_p (arg2, 2))
>
> Index: gcc/config/rs6000/rs6000-c.c
> ===================================================================
> --- gcc/config/rs6000/rs6000-c.c (revision 205364)
> +++ gcc/config/rs6000/rs6000-c.c (working copy)
> @@ -4208,7 +4208,7 @@ altivec_resolve_overloaded_builtin (loca
> /* If we can use the VSX xxpermdi instruction, use that for extract. */
> mode = TYPE_MODE (arg1_type);
> if ((mode == V2DFmode || mode == V2DImode) && VECTOR_MEM_VSX_P (mode)
> - && TREE_CODE (arg2) == INTEGER_CST
> + && tree_fits_uhwi_p (arg2)
> && wi::ltu_p (arg2, 2))
> {
> tree call = NULL_TREE;
Hmm, I think the original was correct here, since there's no reason to rely
on HWIness for an unsigned comparison with 2. It also ought to be more
efficient.
I'd rather change the other case to have an INTEGER_CST test too.
Thanks,
Richard