This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Canonicalize compares in combine [3/3] ARM backend part
On 18/07/11 14:10, Chung-Lin Tang wrote:
> On 2011/7/18 04:46 PM, Richard Earnshaw wrote:
>> The patch to arm.c is ok, but the change to the test is not as it will cause problems with multilib testing. A better fix is to skip the test if the target is thumb1.
>>
>> The other test needs a similar check as it seems to expect a movs instruction.
>>
>> R.
>
> Yes it seems more logical to skip for thumb1, at least for the movs one.
> For the uxtb test, I think probably using "dg-require-effective-target
> arm_thumb2_ok" would be more suitable wrt multilib testing.
>
> Updated patch for the testcase parts, is this okay?
>
> Thanks,
> Chung-Lin
>
OK.
R.
>
> testcase.diff
>
>
> Index: combine-movs.c
> ===================================================================
> --- combine-movs.c (revision 0)
> +++ combine-movs.c (revision 0)
> @@ -0,0 +1,12 @@
> +/* { dg-do compile } */
> +/* { dg-skip-if "" { arm_thumb1 } } */
> +/* { dg-options "-O" } */
> +
> +void foo (unsigned long r[], unsigned int d)
> +{
> + int i, n = d / 32;
> + for (i = 0; i < n; ++i)
> + r[i] = 0;
> +}
> +
> +/* { dg-final { scan-assembler "movs\tr\[0-9\]" } } */
> Index: unsigned-extend-2.c
> ===================================================================
> --- unsigned-extend-2.c (revision 0)
> +++ unsigned-extend-2.c (revision 0)
> @@ -0,0 +1,18 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target arm_thumb2_ok } */
> +/* { dg-options "-O" } */
> +
> +unsigned short foo (unsigned short x)
> +{
> + unsigned char i = 0;
> + for (i = 0; i < 8; i++)
> + {
> + x >>= 1;
> + x &= 0x7fff;
> + }
> + return x;
> +}
> +
> +/* { dg-final { scan-assembler "ands" } } */
> +/* { dg-final { scan-assembler-not "uxtb" } } */
> +/* { dg-final { scan-assembler-not "cmp" } } */