From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id E4D2B3858004 for ; Thu, 29 Jun 2023 10:04:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E4D2B3858004 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b80512a7f2so2976105ad.3 for ; Thu, 29 Jun 2023 03:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688033065; x=1690625065; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Qp8HEUkv6/C/Q2xMlQrATOYLfXyF1An5VbKb1izWMqw=; b=mqtAdo4iiDL+J3Q8bo1WrjCam+knkvhekwjVloD7QuLBg9Xbn5du1zYW4dlmxIuBfU 28LWbI9F9GgoJvIZ5FeZLehigoRFV1lakoxi++ixB37fpzKXIn/H3ks/+8sDq+9tQcBA +2/MfiLufqhVpZtEIlFCayKjfI5VabYKYYVcf1CUuwZNH9bQqbsQJKyP2kDMthhI9vHN cmWzQiJXco0nF+cppWVfYUxcht14SSY/BT0v3obBjmURx3l236/0UZTnJwE7+mh4IBoW qKT00ZNw7mRnGNv6uBN3pHusMCy5VtfxNRq1bmGQoaKeysBLnuVb3+GNXkP+ND31yLNw 68kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688033065; x=1690625065; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qp8HEUkv6/C/Q2xMlQrATOYLfXyF1An5VbKb1izWMqw=; b=WDGDlsewPPQpzezgIZXKIVls0Bbm2qm3TzXayLJULfaYhOFHBwgdYVdEbAKcbuiWXQ g8CqtWRECysqeE52orQfQVuSdfXbO4kbsEsRVY0F1V6wgs/bmicHZKw8+q8pZqQXwuKX dpxeKBy6xB1ktR4iymSYLDY3WMbRQICxMBz0qU4eBwjx4mb8TpvRluzHUWDwKhPlsJU2 FKH3dcNyrXhm3Qx33hn+uYBBa+BFV9N7R5muxLJJazKcfiS3i3mhUdChas333qXgYpFR gsQoh6bdrLifC56fuWsttWZzVxrNE0cyDbSzT/FiGd8UcgufDnEXa93yIdjpIV90cgb1 HyMg== X-Gm-Message-State: AC+VfDw85J7Ppvu70/VY0bnlitjU5kpOMc1coShehySRZB0ScRmkH82o H6R9KVSfuS8+F5NL0gcJjhnDzl4Pq+OET613FpU= X-Google-Smtp-Source: ACHHUZ7N7gDDHtLge2aWIc1cRwbaK1LrOfkEg7eA9302X1aDIPIhXXrKFIoIRyDdlsyPqb5+gELM7L4WvFtfoQeUKX0= X-Received: by 2002:a17:902:f541:b0:1b7:c166:f197 with SMTP id h1-20020a170902f54100b001b7c166f197mr14294273plf.29.1688033064757; Thu, 29 Jun 2023 03:04:24 -0700 (PDT) MIME-Version: 1.0 References: <20230529103254.2753472-1-Jovan.Dmitrovic@Syrmia.com> In-Reply-To: From: YunQiang Su Date: Thu, 29 Jun 2023 18:04:13 +0800 Message-ID: Subject: Re: [PATCH v2] mips: Fix overaligned function arguments [PR109435] To: Jovan Dmitrovic Cc: "gcc-patches@gcc.gnu.org" , Djordje Todorovic Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: YunQiang Su =E4=BA=8E2023=E5=B9=B46=E6=9C=8829=E6=97=A5= =E5=91=A8=E5=9B=9B 14:04=E5=86=99=E9=81=93=EF=BC=9A > > Jovan Dmitrovic =E4=BA=8E2023=E5=B9=B46=E6= =9C=8827=E6=97=A5=E5=91=A8=E4=BA=8C 16:54=E5=86=99=E9=81=93=EF=BC=9A > > > > Hi, > > I am sending a revised patch, now with different tests for N64/N32 and = O32 ABIs. > > For the O32 ABI, I've skipped the -O0 and -Os pipelines, considering th= ere is a > > difference between exact offsets for store instructions (the registers = used remain > > the same). > > > > Skipping -flto isn't really necessary, so I've removed that part. > > > > I've fixed the Changelog, hopefully I've corrected the mistakes I made. > > > > Looks good. > I will submit this patch with some format improvement. > Ohh, my fault: the `-flto` option should always be skipped, when run test. And you skipped -O0 test on O32, while this bug effects O0 only, it should not be expected. The below is my modification to your patch. Is it OK for you? --- xx.patch 2023-06-29 14:32:59.805474033 +0800 +++ build/0001-mips-Fix-overaligned-function-arguments-PR109435.patch 2023-06-29 18:01:19.245478275 +0800 @@ -1,4 +1,4 @@ -From 05e4ff4d2fbb91ea8040fb10d8d6a130ad24bba7 Mon Sep 17 00:00:00 2001 +From 7b5af22bb7c8fadce27e94c37c96101a06acd286 Mon Sep 17 00:00:00 2001 From: Jovan Dmitrovic Date: Mon, 26 Jun 2023 17:00:20 +0200 Subject: [PATCH] mips: Fix overaligned function arguments [PR109435] @@ -16,12 +16,13 @@ 2023-06-27 Jovan Dmitrovi=C4=87 gcc/ChangeLog: - PR target/109435 + + PR target/109435 * config/mips/mips.cc (mips_function_arg_alignment): Returns - the alignment of function argument. In case of typedef type, - it returns the aligment of the aliased type. + the alignment of function argument. In case of typedef type, + it returns the aligment of the aliased type. (mips_function_arg_boundary): Relocated calculation of the - aligment of function arguments. + aligment of function arguments. gcc/testsuite/ChangeLog: @@ -29,9 +30,9 @@ * gcc.target/mips/align-1-o32.c: New test. --- gcc/config/mips/mips.cc | 19 ++++++++++++++++++- - gcc/testsuite/gcc.target/mips/align-1-n64.c | 19 +++++++++++++++++++ + gcc/testsuite/gcc.target/mips/align-1-n64.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.target/mips/align-1-o32.c | 20 ++++++++++++++++++++ - 3 files changed, 57 insertions(+), 1 deletion(-) + 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/mips/align-1-n64.c create mode 100644 gcc/testsuite/gcc.target/mips/align-1-o32.c @@ -75,14 +76,15 @@ if (alignment > STACK_BOUNDARY) diff --git a/gcc/testsuite/gcc.target/mips/align-1-n64.c b/gcc/testsuite/gcc.target/mips/align-1-n64.c new file mode 100644 -index 00000000000..46e718d548d +index 00000000000..3ede539c3a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/align-1-n64.c -@@ -0,0 +1,19 @@ +@@ -0,0 +1,20 @@ +/* Check that typedef alignment does not affect passing of function + parameters for N64/N32 ABIs. */ +/* { dg-do compile { target { "mips*-*-*" } } } */ +/* { dg-options "-mabi=3D64" } */ ++/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +typedef struct ui8 +{ @@ -100,7 +102,7 @@ +/* { dg-final { scan-assembler "\tsd\t\\\$7,16\\(\\\$\[0-9\]\\)" } } */ diff --git a/gcc/testsuite/gcc.target/mips/align-1-o32.c b/gcc/testsuite/gcc.target/mips/align-1-o32.c new file mode 100644 -index 00000000000..a548632b7f6 +index 00000000000..e043d6a3eca --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/align-1-o32.c @@ -0,0 +1,20 @@ @@ -108,7 +110,7 @@ + parameters for O32 ABI. */ +/* { dg-do compile { target { "mips*-*-*" } } } */ +/* { dg-options "-mabi=3D32" } */ -+/* { dg-skip-if "" { *-*-* } { "-O0" "-Os" } { "" } } */ ++/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +typedef struct ui8 +{ @@ -121,10 +123,9 @@ + return a.v[0]; +} + -+/* { dg-final { scan-assembler "\tsw\t\\\$5,100\\(\\\$sp\\)" } } */ -+/* { dg-final { scan-assembler "\tsw\t\\\$6,104\\(\\\$sp\\)" } } */ -+/* { dg-final { scan-assembler "\tsw\t\\\$7,108\\(\\\$sp\\)" } } */ ++/* { dg-final { scan-assembler "\tsw\t\\\$5,1\\d\\d\\(\\\$(sp|fp)\\)" } }= */ ++/* { dg-final { scan-assembler "\tsw\t\\\$6,1\\d\\d\\(\\\$(sp|fp)\\)" } }= */ ++/* { dg-final { scan-assembler "\tsw\t\\\$7,1\\d\\d\\(\\\$(sp|fp)\\)" } }= */ -- -2.34.1 - +2.30.2 > > Regards, > > Jovan > > > > -- > YunQiang Su --=20 YunQiang Su