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: wide-int, rs6000


On Nov 26, 2013, at 3:58 AM, Richard Sandiford <rsandifo@linux.vnet.ibm.com> wrote:
> 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.

I agree, here is what I'm including to David for review…  Thanks.

Index: gcc/config/rs6000/rs6000-c.c
===================================================================
--- gcc/config/rs6000/rs6000-c.c	(revision 205414)
+++ 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_fits_uhwi_p (arg2)
+	  && TREE_CODE (arg2) == INTEGER_CST
 	  && wi::ltu_p (arg2, 2))
 	{
 	  tree call = NULL_TREE;
@@ -4293,7 +4293,7 @@ altivec_resolve_overloaded_builtin (loca
       /* If we can use the VSX xxpermdi instruction, use that for insert.  */
       mode = TYPE_MODE (arg1_type);
       if ((mode == V2DFmode || mode == V2DImode) && VECTOR_UNIT_VSX_P (mode)
-	  && tree_fits_uhwi_p (arg2)
+	  && TREE_CODE (arg2) == INTEGER_CST
 	  && wi::ltu_p (arg2, 2))
 	{
 	  tree call = NULL_TREE;


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