This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCHv5] Fix not 8-byte aligned ldrd/strd on ARMv5 (PR 89544)
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>, Richard Biener <rguenther at suse dot de>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>, Eric Botcazou <ebotcazou at adacore dot com>, Jeff Law <law at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 4 Sep 2019 13:28:56 +0000
- Subject: Re: [PATCHv5] Fix not 8-byte aligned ldrd/strd on ARMv5 (PR 89544)
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1vHH+8TQWn3DmYLEJfJtFSdy/5fwdyzYutq1Hc6r8rc=; b=kGkc8CbRMEJ9FHhLguo6TrX29EJ+A5CzknQAZcbgGUMSu8HK38OYVp6tNgY8AvTa6+hF/SvS7b3jli9JDjt08XlZaOfNKrUTpKMMHwhmE1C5yxrnNJ9jU7puKdmLiIMFR9w0jSAJr/D4IkkXuxcXKkz46rDG0Tjq/wrHqtXu2FnMI4VvXjdFJZAA2b5JlmrEF3bJ+qdVCUdvmbY5ttEjvldkOhdPNNp+YgkEKmCLpuakA/dZEWMp6XKcBhocJFUIob15dZJIaojidHKEfG1B1uZKReyG19AQSTH61F5T8rNyFEOk1qydCkZsL6SJI13MtgBMQWLMl4FvCZ/xQ7O7rg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQQtWC35GuHifEz1hVLlHDdaa15WI6A43ejXigm9bB7/bDshUAyxV/N/vBQUKJT3vHnP2opLV+Q9p/uFXcsMlfYdH8zbxxXEKZv60APGS3gxT5QVxJJQXC4oWsgB4hDONbCBcxXz/tVyUlwj7aDr2ud0dQX6Tp8p9e4XbgmZylw+isJNsQ+po+l7bpa5SJexVDZosHraLvu0xAsUDC82Kv8aHY+KrfPl/gY28uMRrQz0+ZB6A5IASWE/igNuX6qPIntlJ7GN7SgTu2uTUZTww4XRS1Pj9ticW3tkcMpPiHOY4zxvp+8YQHBxU96Qszr2IQl/4xgj4B9xTc1HOmT5Hw==
- References: <AM6PR07MB4037775DF79E0229DCCA425AE44F0@AM6PR07MB4037.eurprd07.prod.outlook.com> <AM6PR10MB256664D731C3CC92F2FBEDC5E4DC0@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> <alpine.LSU.2.20.1908021451300.19626@zhemvz.fhfr.qr> <AM6PR10MB2566A6E51DC500187D9EC6CFE4D90@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> <DB8PR10MB2569255E3191B5C7FA70D338E4D70@DB8PR10MB2569.EURPRD10.PROD.OUTLOOK.COM> <alpine.LSU.2.20.1908141319050.11741@zhemvz.fhfr.qr> <AM6PR10MB256602B22A8F0DA91782D76DE4AD0@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> <alpine.LSU.2.20.1908151032040.32458@zhemvz.fhfr.qr> <AM6PR10MB2566EF4119F45406B60B3972E4AC0@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> <alpine.LSU.2.20.1908151437430.32458@zhemvz.fhfr.qr> <AM6PR10MB2566B60823F40D98F4F2D55DE4AC0@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> <A61C6A2B-A22F-475B-A150-5065DB4686CC@suse.de> <AM6PR10MB2566627D2A92173775D78936E4AC0@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> <c4e0d051-5b17-2bfa-d0c9-383fa65f8ae2@arm.com>
On 9/4/19 2:53 PM, Richard Earnshaw (lists) wrote:
> On 15/08/2019 20:47, Bernd Edlinger wrote:
>> On 8/15/19 6:29 PM, Richard Biener wrote:
>>>>>
>>>>> Please split it into the parts for the PR and parts making the
>>>>> asserts not trigger.
>>>>>
>>>>
>>>> Yes, will do.
>>>>
>>
>> Okay, here is the rest of the PR 89544 fix,
>> actually just an optimization, making the larger stack alignment
>> known to the middle-end, and the test cases.
>>
>>
>> Boot-strapped and reg-tested on x86_64-pc-linux-gnu and arm-linux-gnueabihf.
>> Is it OK for trunk?
>>
>>
>> Thanks
>> Bernd.
>>
>
> Index: gcc/testsuite/gcc.target/arm/unaligned-argument-2.c
> ===================================================================
> --- gcc/testsuite/gcc.target/arm/unaligned-argument-2.c (Revision 0)
> +++ gcc/testsuite/gcc.target/arm/unaligned-argument-2.c (Arbeitskopie)
> @@ -0,0 +1,19 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target arm_arm_ok } */
> +/* { dg-require-effective-target arm_ldrd_strd_ok } */
> +/* { dg-options "-marm -mno-unaligned-access -O3" } */
> +
> +struct s {
> + int a, b;
> +} __attribute__((aligned(8)));
> +
> +struct s f0;
> +
> +void f(int a, int b, int c, int d, int e, struct s f)
> +{
> + f0 = f;
> +}
> +
> +/* { dg-final { scan-assembler-times "ldrd" 0 } } */
> +/* { dg-final { scan-assembler-times "strd" 0 } } */
> +/* { dg-final { scan-assembler-times "stm" 1 } } */
>
> I don't think this test is right. While we can't use an LDRD to load the argument off the stack, there's nothing wrong with using an STRD to then store the value to f0 (as that is 8-byte aligned). So the second and third scan-assembler tests are meaningless.
>
Ah, that is very similar to the unaligned-memcpy-2/3.c,
see https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00157.html
initially that is a movdi,
then in subreg1 it is split in two movsi
which is then re-assembled as ldm
Not sure if that is intended in that way.
Bernd.