[PATCH 1/2] simplify-rtx: The truncation of an IOR can have all bits set (PR81423)

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Tue Jul 25 11:31:00 GMT 2017


On 24/07/17 09:50, Segher Boessenkool wrote:
> On Wed, Jul 19, 2017 at 12:19:32AM -0600, Jeff Law wrote:
>> On 07/18/2017 01:36 PM, Segher Boessenkool wrote:
>>> 	* simplify-rtx.c (simplify_truncation): Handle truncating an IOR
>>> 	with a constant that is -1 in the truncated to mode.
>> OK.  A testcase would be advisable :-)
>>
>> jeff
> Like this.  Is this okay for trunk?  (Is int32plus the correct test
> to use here?)

We sometimes use the __mode__ attribute to force certain sizes in C types.
For example: typedef int ditype __attribute__ ((mode (DI)));
Maybe you can do this to force the right sizes. I don't know if there are any targets
that don't support DImode ops though :)

Kyrill

>
> Segher
>
>
> 2017-07-24  Segher Boessenkool  <segher@kernel.crashing.org>
>
> gcc/testsuite/
> 	PR rtl-optimization/81423
> 	* gcc.c-torture/execute/pr81423.c: New testcase.
>
> ---
>   gcc/testsuite/gcc.c-torture/execute/pr81423.c | 30 +++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
>   create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr81423.c
>
> diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81423.c b/gcc/testsuite/gcc.c-torture/execute/pr81423.c
> new file mode 100644
> index 0000000..75c3518
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/execute/pr81423.c
> @@ -0,0 +1,30 @@
> +/* { dg-require-effective-target int32plus } */
> +
> +extern void abort (void);
> +
> +unsigned long long int ll = 0;
> +unsigned long long int ull1 = 1ULL;
> +unsigned long long int ull2 = 12008284144813806346ULL;
> +unsigned long long int ull3;
> +
> +void
> +foo (void)
> +{
> +  ll = -5597998501375493990LL;
> +
> +  ll = (5677365550390624949L - ll) - (ull1 > 0);
> +  ull3 = (unsigned int)
> +    (2067854353L <<
> +     (((ll + -2129105131L) ^ 10280750144413668236ULL) -
> +      10280750143997242009ULL)) >> ((2873442921854271231ULL | ull2)
> +				    - 12098357307243495419ULL);
> +}
> +
> +int
> +main (void)
> +{
> +  foo ();
> +  if (ull3 != 3998784)
> +    abort ();
> +  return 0;
> +}



More information about the Gcc-patches mailing list