diff mbox series

i386: Fix memory constraint for APX NF

Message ID DM4PR11MB548778EDBD8349B81F055301ECB22@DM4PR11MB5487.namprd11.prod.outlook.com
State New
Headers show
Series i386: Fix memory constraint for APX NF | expand

Commit Message

Kong, Lingling Aug. 1, 2024, 1:30 a.m. UTC
The je constraint should be used for APX NDD ADD with register source
operand. The jM is for APX NDD patterns with immediate operand.

Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
Ok for trunk?

gcc/ChangeLog:

        * config/i386/i386.md (nf_mem_constraint): Fixed the constraint
        for the define_subst_attr.
        (nf_mem_constraint): Added new define_subst_attr.
        (*add<mode>_1<nf_name>): Fixed the constraint.
---
 gcc/config/i386/i386.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.31.1

Comments

Liu, Hongtao Aug. 1, 2024, 1:34 a.m. UTC | #1
> -----Original Message-----
> From: Kong, Lingling <lingling.kong@intel.com>
> Sent: Thursday, August 1, 2024 9:30 AM
> To: gcc-patches@gcc.gnu.org
> Cc: Liu, Hongtao <hongtao.liu@intel.com>; Wang, Hongyu
> <hongyu.wang@intel.com>
> Subject: [PATCH] i386: Fix memory constraint for APX NF
> 
> The je constraint should be used for APX NDD ADD with register source
> operand. The jM is for APX NDD patterns with immediate operand.
But these 2 alternatives is for Non-NDD.
> 
> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> Ok for trunk?
> 
> gcc/ChangeLog:
> 
>         * config/i386/i386.md (nf_mem_constraint): Fixed the constraint
>         for the define_subst_attr.
>         (nf_mem_constraint): Added new define_subst_attr.
>         (*add<mode>_1<nf_name>): Fixed the constraint.
> ---
>  gcc/config/i386/i386.md | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index
> fb10fdc9f96..aa7220ee17c 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -6500,7 +6500,8 @@
>  (define_subst_attr "nf_name" "nf_subst" "_nf" "")  (define_subst_attr
> "nf_prefix" "nf_subst" "%{nf%} " "")  (define_subst_attr "nf_condition"
> "nf_subst" "TARGET_APX_NF" "true") -(define_subst_attr
> "nf_mem_constraint" "nf_subst" "je" "m")
> +(define_subst_attr "nf_add_mem_constraint" "nf_subst" "je" "m")
> +(define_subst_attr "nf_mem_constraint" "nf_subst" "jM" "m")
>  (define_subst_attr "nf_applied" "nf_subst" "true" "false")  (define_subst_attr
> "nf_nonf_attr" "nf_subst"  "noapx_nf" "*")  (define_subst_attr
> "nf_nonf_x64_attr" "nf_subst" "noapx_nf" "x64") @@ -6514,7 +6515,7 @@
>         (clobber (reg:CC FLAGS_REG))])
> 
>  (define_insn "*add<mode>_1<nf_name>"
> -  [(set (match_operand:SWI48 0 "nonimmediate_operand"
> "=rm,r<nf_mem_constraint>,r,r,r,r,r,r")
> +  [(set (match_operand:SWI48 0 "nonimmediate_operand"
> + "=r<nf_add_mem_constraint>,r<nf_mem_constraint>,r,r,r,r,r,r")
>         (plus:SWI48
>           (match_operand:SWI48 1 "nonimmediate_operand"
> "%0,0,0,r,r,rje,jM,r")
>           (match_operand:SWI48 2 "x86_64_general_operand"
> "r,e,BM,0,le,r,e,BM")))]
> --
> 2.31.1
Kong, Lingling Aug. 1, 2024, 2:03 a.m. UTC | #2
> -----Original Message-----
> From: Liu, Hongtao <hongtao.liu@intel.com>
> Sent: Thursday, August 1, 2024 9:35 AM
> To: Kong, Lingling <lingling.kong@intel.com>; gcc-patches@gcc.gnu.org
> Cc: Wang, Hongyu <hongyu.wang@intel.com>
> Subject: RE: [PATCH] i386: Fix memory constraint for APX NF
> 
> 
> 
> > -----Original Message-----
> > From: Kong, Lingling <lingling.kong@intel.com>
> > Sent: Thursday, August 1, 2024 9:30 AM
> > To: gcc-patches@gcc.gnu.org
> > Cc: Liu, Hongtao <hongtao.liu@intel.com>; Wang, Hongyu
> > <hongyu.wang@intel.com>
> > Subject: [PATCH] i386: Fix memory constraint for APX NF
> >
> > The je constraint should be used for APX NDD ADD with register source
> > operand. The jM is for APX NDD patterns with immediate operand.
> But these 2 alternatives is for Non-NDD.  
The jM constraint is for the size limit of 15 byes when non-default address space,
It also work to APX NF. The je is for TLS code with EVEX prefix for ADD, and APX NF
also has the EVEX prefix.
> >
> > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> > Ok for trunk?
> >
> > gcc/ChangeLog:
> >
> >         * config/i386/i386.md (nf_mem_constraint): Fixed the constraint
> >         for the define_subst_attr.
> >         (nf_mem_constraint): Added new define_subst_attr.
> >         (*add<mode>_1<nf_name>): Fixed the constraint.
> > ---
> >  gcc/config/i386/i386.md | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index
> > fb10fdc9f96..aa7220ee17c 100644
> > --- a/gcc/config/i386/i386.md
> > +++ b/gcc/config/i386/i386.md
> > @@ -6500,7 +6500,8 @@
> >  (define_subst_attr "nf_name" "nf_subst" "_nf" "")  (define_subst_attr
> > "nf_prefix" "nf_subst" "%{nf%} " "")  (define_subst_attr "nf_condition"
> > "nf_subst" "TARGET_APX_NF" "true") -(define_subst_attr
> > "nf_mem_constraint" "nf_subst" "je" "m")
> > +(define_subst_attr "nf_add_mem_constraint" "nf_subst" "je" "m")
> > +(define_subst_attr "nf_mem_constraint" "nf_subst" "jM" "m")
> >  (define_subst_attr "nf_applied" "nf_subst" "true" "false")
> > (define_subst_attr "nf_nonf_attr" "nf_subst"  "noapx_nf" "*")
> > (define_subst_attr "nf_nonf_x64_attr" "nf_subst" "noapx_nf" "x64") @@ -
> 6514,7 +6515,7 @@
> >         (clobber (reg:CC FLAGS_REG))])
> >
> >  (define_insn "*add<mode>_1<nf_name>"
> > -  [(set (match_operand:SWI48 0 "nonimmediate_operand"
> > "=rm,r<nf_mem_constraint>,r,r,r,r,r,r")
> > +  [(set (match_operand:SWI48 0 "nonimmediate_operand"
> > + "=r<nf_add_mem_constraint>,r<nf_mem_constraint>,r,r,r,r,r,r")
> >         (plus:SWI48
> >           (match_operand:SWI48 1 "nonimmediate_operand"
> > "%0,0,0,r,r,rje,jM,r")
> >           (match_operand:SWI48 2 "x86_64_general_operand"
> > "r,e,BM,0,le,r,e,BM")))]
> > --
> > 2.31.1
Hongtao Liu Aug. 1, 2024, 3:49 a.m. UTC | #3
On Thu, Aug 1, 2024 at 10:03 AM Kong, Lingling <lingling.kong@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Liu, Hongtao <hongtao.liu@intel.com>
> > Sent: Thursday, August 1, 2024 9:35 AM
> > To: Kong, Lingling <lingling.kong@intel.com>; gcc-patches@gcc.gnu.org
> > Cc: Wang, Hongyu <hongyu.wang@intel.com>
> > Subject: RE: [PATCH] i386: Fix memory constraint for APX NF
> >
> >
> >
> > > -----Original Message-----
> > > From: Kong, Lingling <lingling.kong@intel.com>
> > > Sent: Thursday, August 1, 2024 9:30 AM
> > > To: gcc-patches@gcc.gnu.org
> > > Cc: Liu, Hongtao <hongtao.liu@intel.com>; Wang, Hongyu
> > > <hongyu.wang@intel.com>
> > > Subject: [PATCH] i386: Fix memory constraint for APX NF
> > >
> > > The je constraint should be used for APX NDD ADD with register source
> > > operand. The jM is for APX NDD patterns with immediate operand.
> > But these 2 alternatives is for Non-NDD.
> The jM constraint is for the size limit of 15 byes when non-default address space,
> It also work to APX NF. The je is for TLS code with EVEX prefix for ADD, and APX NF
> also has the EVEX prefix.
I see, could you also adjust apx_ndd_add_memory_operand and
apx_ndd_memory_operand to apx_evex_add_memory_operand and
apx_evex_memory_operand, and change the comments, but it can be a
separate patch.
The patch LGTM.
> > >
> > > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> > > Ok for trunk?
> > >
> > > gcc/ChangeLog:
> > >
> > >         * config/i386/i386.md (nf_mem_constraint): Fixed the constraint
> > >         for the define_subst_attr.
> > >         (nf_mem_constraint): Added new define_subst_attr.
> > >         (*add<mode>_1<nf_name>): Fixed the constraint.
> > > ---
> > >  gcc/config/i386/i386.md | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index
> > > fb10fdc9f96..aa7220ee17c 100644
> > > --- a/gcc/config/i386/i386.md
> > > +++ b/gcc/config/i386/i386.md
> > > @@ -6500,7 +6500,8 @@
> > >  (define_subst_attr "nf_name" "nf_subst" "_nf" "")  (define_subst_attr
> > > "nf_prefix" "nf_subst" "%{nf%} " "")  (define_subst_attr "nf_condition"
> > > "nf_subst" "TARGET_APX_NF" "true") -(define_subst_attr
> > > "nf_mem_constraint" "nf_subst" "je" "m")
> > > +(define_subst_attr "nf_add_mem_constraint" "nf_subst" "je" "m")
> > > +(define_subst_attr "nf_mem_constraint" "nf_subst" "jM" "m")
> > >  (define_subst_attr "nf_applied" "nf_subst" "true" "false")
> > > (define_subst_attr "nf_nonf_attr" "nf_subst"  "noapx_nf" "*")
> > > (define_subst_attr "nf_nonf_x64_attr" "nf_subst" "noapx_nf" "x64") @@ -
> > 6514,7 +6515,7 @@
> > >         (clobber (reg:CC FLAGS_REG))])
> > >
> > >  (define_insn "*add<mode>_1<nf_name>"
> > > -  [(set (match_operand:SWI48 0 "nonimmediate_operand"
> > > "=rm,r<nf_mem_constraint>,r,r,r,r,r,r")
> > > +  [(set (match_operand:SWI48 0 "nonimmediate_operand"
> > > + "=r<nf_add_mem_constraint>,r<nf_mem_constraint>,r,r,r,r,r,r")
> > >         (plus:SWI48
> > >           (match_operand:SWI48 1 "nonimmediate_operand"
> > > "%0,0,0,r,r,rje,jM,r")
> > >           (match_operand:SWI48 2 "x86_64_general_operand"
> > > "r,e,BM,0,le,r,e,BM")))]
> > > --
> > > 2.31.1
diff mbox series

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index fb10fdc9f96..aa7220ee17c 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -6500,7 +6500,8 @@ 
 (define_subst_attr "nf_name" "nf_subst" "_nf" "")
 (define_subst_attr "nf_prefix" "nf_subst" "%{nf%} " "")
 (define_subst_attr "nf_condition" "nf_subst" "TARGET_APX_NF" "true")
-(define_subst_attr "nf_mem_constraint" "nf_subst" "je" "m")
+(define_subst_attr "nf_add_mem_constraint" "nf_subst" "je" "m")
+(define_subst_attr "nf_mem_constraint" "nf_subst" "jM" "m")
 (define_subst_attr "nf_applied" "nf_subst" "true" "false")
 (define_subst_attr "nf_nonf_attr" "nf_subst"  "noapx_nf" "*")
 (define_subst_attr "nf_nonf_x64_attr" "nf_subst" "noapx_nf" "x64")
@@ -6514,7 +6515,7 @@ 
        (clobber (reg:CC FLAGS_REG))])

 (define_insn "*add<mode>_1<nf_name>"
-  [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r<nf_mem_constraint>,r,r,r,r,r,r")
+  [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r<nf_add_mem_constraint>,r<nf_mem_constraint>,r,r,r,r,r,r")
        (plus:SWI48
          (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,0,r,r,rje,jM,r")
          (match_operand:SWI48 2 "x86_64_general_operand" "r,e,BM,0,le,r,e,BM")))]