From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by sourceware.org (Postfix) with ESMTPS id 47DC93858CD1 for ; Tue, 9 Apr 2024 00:45:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47DC93858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47DC93858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::f29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712623521; cv=none; b=A5Godn39R1x83tb09cYdWFPFIpHtW03+g3WO8fsKzCm3CEOigOnjKcuoDicbedDu0JIsZ7+3UwGmGAgTe32qHYaY96N2zOILZ3l1fjvCDWwhIqGmnANjWulN8sYC26WGzx1hzkFF2JOC1tnXiyT07gLYSKeSyQVKJBDBHcKqHRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712623521; c=relaxed/simple; bh=/NAK6fPjg+tZIiA8TipGGw5deDONXvPC38L0ocegAuE=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=UK8WtBQLrPm7QGs2J5iFL4sARWACQEuxQ3PTHrCc9CXk/ZyGzs5jTDpx+6FxOJKKq68G6T9dFrGi8bjtYQn4ljSBJs2T1fI71Szqj34GopDr6c/lMjax4NGXog32Aq01dc+c9GYf6Nve9vq4G6mds8L/wYNkELE0QzesbKJGuvw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-69b0f08a877so12491576d6.0 for ; Mon, 08 Apr 2024 17:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712623518; x=1713228318; darn=gcc.gnu.org; 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=PQSRhosaJ4UFby/RlO79SUzGQfCsx3d0y9r447SoCzo=; b=hD1vnmKMkeIc/JPhSoKGaBUbiN/GjKqN4rFw/pUFqmPiQX906ljs/DJMccFMPH6cEk fspg+FkqeZe7/mUSI42ZVW2p3HdUpZ2m2gj1YiR2o3hnYuqpdS6TkQc6BGO4zLU/wW7d 4AAUZzyTY0CiJQrC+MDQCrekwRZxoITGBjr2DaoH2EgiBuZGJDJ48W7VW7ZImmTygMxq k09a5p20FBkguuwfzZLwMkw1fTVfkG7m9UhXYB+BFQzM1WJyLMvLIIZU0XAb2JzxsGAy exSyLKyyc3HmocO1RcnT9k96Pzyxsng8S/y0MxZLgyXiZaM/Sk2Y7dU5s6CqbssTXF6l eurg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712623518; x=1713228318; 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=PQSRhosaJ4UFby/RlO79SUzGQfCsx3d0y9r447SoCzo=; b=muFFWsDNnr4KKE7/BhRwqPpXMyksEyUPqnF83Ejyg4i0ZxalDZ9Z+VEvLKqcGYDONm i05lPBeqAgyVf+4Xt4Kow9ovHlHAAH4G8tdbTrCo6NoZQpWCCZIHzDhd4vzZdv3tEhAt 9J3hATx0ro+//1oEm55lGOMd/6Fyu2ePSfvirQhDF5lqZ6us+ueuX754is6W2oVYeJEu pvXIWZhZ7EbhF9rVJnYPiCSLbl/al5jiUt21X6q1MAMa2cMb3OAZAxY1U/4SL52G6pkz PfjYNGNQ0gbbX+i1IrPXGOQkpdaMp/HlfWbH8sGlC8sN4J1H+Ui8Y70pAmiYEfOeYuv7 3L8w== X-Gm-Message-State: AOJu0Yw/HXRZavzsOWLPP9/QnUNN4uNHrXkAW66o1IoVUzMLcmlvHwbC Vbq825ODAZYIpMft3tw1FOVPIyq2iBy1h3bELztuNl7YcbSe7aXSI4agao4x8yaWMSnRSrkvUjv 6HDPop3YHIq2NPP/zEApIgn2cNbQ= X-Google-Smtp-Source: AGHT+IEgrs+Pp/R4cKy5xe1xwYm3bemJoaa/FKoS/7afksEtlP+rbDmKEXI1lgnYyIIA5E7l0pjPVQ1BQNUiED717gE= X-Received: by 2002:a05:6214:405:b0:699:2ef3:3ef2 with SMTP id z5-20020a056214040500b006992ef33ef2mr9375324qvx.14.1712623518492; Mon, 08 Apr 2024 17:45:18 -0700 (PDT) MIME-Version: 1.0 References: <20240408154350.1182471-1-hjl.tools@gmail.com> In-Reply-To: <20240408154350.1182471-1-hjl.tools@gmail.com> From: Hongtao Liu Date: Tue, 9 Apr 2024 08:55:54 +0800 Message-ID: Subject: Re: [PATCH] x86: Define macros for APX options To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org, hongtao.liu@intel.com, ubizjak@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,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 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: On Mon, Apr 8, 2024 at 11:44=E2=80=AFPM H.J. Lu wrote= : > > Define following macros for APX options: > > 1. __APX_EGPR__: -mapx-features=3Degpr. > 2. __APX_PUSH2POP2__: -mapx-features=3Dpush2pop2. > 3. __APX_NDD__: -mapx-features=3Dndd. > 4. __APX_PPX__: -mapx-features=3Dppx. For -mapx-features=3D, we haven't decided to expose this option to users yet, we want users to just use -mapxf, so I think __APXF__ should be enough? > 5. __APX_INLINE_ASM_USE_GPR32__: -mapx-inline-asm-use-gpr32. I'm ok for this one. > > They can be used to make assembly codes compatible with APX options. > Some use cases are: > > 1. When __APX_PUSH2POP2__ is defined, assembly codes should always align > the outgoing stack to 16 bytes. > 2. When __APX_INLINE_ASM_USE_GPR32__ is defined, inline asm statements > should contain only instructions compatible with r16-r31. > > gcc/ > > PR target/114587 > * config/i386/i386-c.cc (ix86_target_macros_internal): Define > __APX_XXX__ for APX options. > > gcc/testsuite/ > > PR target/114587 > * gcc.target/i386/apx-3a.c: New test. > * gcc.target/i386/apx-3b.c: Likewise. > * gcc.target/i386/apx-3c.c: Likewise. > * gcc.target/i386/apx-3d.c: Likewise. > * gcc.target/i386/apx-3e.c: Likewise. > * gcc.target/i386/apx-4.c: Likewise. > --- > gcc/config/i386/i386-c.cc | 10 ++++++++++ > gcc/testsuite/gcc.target/i386/apx-3a.c | 6 ++++++ > gcc/testsuite/gcc.target/i386/apx-3b.c | 6 ++++++ > gcc/testsuite/gcc.target/i386/apx-3c.c | 6 ++++++ > gcc/testsuite/gcc.target/i386/apx-3d.c | 6 ++++++ > gcc/testsuite/gcc.target/i386/apx-3e.c | 18 ++++++++++++++++++ > gcc/testsuite/gcc.target/i386/apx-4.c | 6 ++++++ > 7 files changed, 58 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/i386/apx-3a.c > create mode 100644 gcc/testsuite/gcc.target/i386/apx-3b.c > create mode 100644 gcc/testsuite/gcc.target/i386/apx-3c.c > create mode 100644 gcc/testsuite/gcc.target/i386/apx-3d.c > create mode 100644 gcc/testsuite/gcc.target/i386/apx-3e.c > create mode 100644 gcc/testsuite/gcc.target/i386/apx-4.c > > diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc > index 226d277676c..b8cfba90fdc 100644 > --- a/gcc/config/i386/i386-c.cc > +++ b/gcc/config/i386/i386-c.cc > @@ -751,6 +751,16 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, > def_or_undef (parse_in, "__AVX10_1_512__"); > if (isa_flag2 & OPTION_MASK_ISA2_APX_F) > def_or_undef (parse_in, "__APX_F__"); > + if (TARGET_APX_EGPR) > + def_or_undef (parse_in, "__APX_EGPR__"); > + if (TARGET_APX_PUSH2POP2) > + def_or_undef (parse_in, "__APX_PUSH2POP2__"); > + if (TARGET_APX_NDD) > + def_or_undef (parse_in, "__APX_NDD__"); > + if (TARGET_APX_PPX) > + def_or_undef (parse_in, "__APX_PPX__"); > + if (ix86_apx_inline_asm_use_gpr32) > + def_or_undef (parse_in, "__APX_INLINE_ASM_USE_GPR32__"); > if (TARGET_IAMCU) > { > def_or_undef (parse_in, "__iamcu"); > diff --git a/gcc/testsuite/gcc.target/i386/apx-3a.c b/gcc/testsuite/gcc.t= arget/i386/apx-3a.c > new file mode 100644 > index 00000000000..86d3ef2061d > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/apx-3a.c > @@ -0,0 +1,6 @@ > +/* { dg-do compile { target { ! ia32 } } } */ > +/* { dg-options "-mapx-features=3Degpr" } */ > + > +#ifndef __APX_EGPR__ > +# error __APX_EGPR__ not defined > +#endif > diff --git a/gcc/testsuite/gcc.target/i386/apx-3b.c b/gcc/testsuite/gcc.t= arget/i386/apx-3b.c > new file mode 100644 > index 00000000000..611727a389a > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/apx-3b.c > @@ -0,0 +1,6 @@ > +/* { dg-do compile { target { ! ia32 } } } */ > +/* { dg-options "-mapx-features=3Dpush2pop2" } */ > + > +#ifndef __APX_PUSH2POP2__ > +# error __APX_PUSH2POP2__ not defined > +#endif > diff --git a/gcc/testsuite/gcc.target/i386/apx-3c.c b/gcc/testsuite/gcc.t= arget/i386/apx-3c.c > new file mode 100644 > index 00000000000..52655b6cfa5 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/apx-3c.c > @@ -0,0 +1,6 @@ > +/* { dg-do compile { target { ! ia32 } } } */ > +/* { dg-options "-mapx-features=3Dndd" } */ > + > +#ifndef __APX_NDD__ > +# error __APX_NDD__ not defined > +#endif > diff --git a/gcc/testsuite/gcc.target/i386/apx-3d.c b/gcc/testsuite/gcc.t= arget/i386/apx-3d.c > new file mode 100644 > index 00000000000..9b91af1d377 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/apx-3d.c > @@ -0,0 +1,6 @@ > +/* { dg-do compile { target { ! ia32 } } } */ > +/* { dg-options "-mapx-features=3Dppx" } */ > + > +#ifndef __APX_PPX__ > +# error __APX_PPX__ not defined > +#endif > diff --git a/gcc/testsuite/gcc.target/i386/apx-3e.c b/gcc/testsuite/gcc.t= arget/i386/apx-3e.c > new file mode 100644 > index 00000000000..7278428e5c4 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/apx-3e.c > @@ -0,0 +1,18 @@ > +/* { dg-do compile { target { ! ia32 } } } */ > +/* { dg-options "-mapx-features=3Degpr,push2pop2,ndd,ppx" } */ > + > +#ifndef __APX_EGPR__ > +# error __APX_EGPR__ not defined > +#endif > + > +#ifndef __APX_PUSH2POP2__ > +# error __APX_PUSH2POP2__ not defined > +#endif > + > +#ifndef __APX_NDD__ > +# error __APX_NDD__ not defined > +#endif > + > +#ifndef __APX_PPX__ > +# error __APX_PPX__ not defined > +#endif > diff --git a/gcc/testsuite/gcc.target/i386/apx-4.c b/gcc/testsuite/gcc.ta= rget/i386/apx-4.c > new file mode 100644 > index 00000000000..1ba4ac036fc > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/apx-4.c > @@ -0,0 +1,6 @@ > +/* { dg-do compile { target { ! ia32 } } } */ > +/* { dg-options "-mapx-inline-asm-use-gpr32" } */ > + > +#ifndef __APX_INLINE_ASM_USE_GPR32__ > +# error __APX_INLINE_ASM_USE_GPR32__ not defined > +#endif > -- > 2.44.0 > --=20 BR, Hongtao