diff mbox series

i386: Fix comment/naming for APX NDD constraints

Message ID DM4PR11MB54876F8D789DD2093428FD57ECB32@DM4PR11MB5487.namprd11.prod.outlook.com
State New
Headers show
Series i386: Fix comment/naming for APX NDD constraints | expand

Commit Message

Kong, Lingling Aug. 2, 2024, 6:42 a.m. UTC
Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
Ok for trunk?

gcc/ChangeLog:

        * config/i386/constraints.md: Fixed the comment/naming
        for je/jM/jO.
        * config/i386/predicates.md (apx_ndd_memory_operand):
        Renamed and fixed the comment.
        (apx_evex_memory_operand): New name.
        (apx_ndd_add_memory_operand): Ditto.
        (apx_evex_add_memory_operand): Ditto.
---
 gcc/config/i386/constraints.md | 12 ++++++------
 gcc/config/i386/predicates.md  | 21 +++++++++++----------
 2 files changed, 17 insertions(+), 16 deletions(-)

--
2.31.1

Comments

liuhongt Aug. 2, 2024, 7:45 a.m. UTC | #1
> -----Original Message-----
> From: Kong, Lingling <lingling.kong@intel.com>
> Sent: Friday, August 2, 2024 2:43 PM
> To: gcc-patches@gcc.gnu.org
> Cc: Liu, Hongtao <hongtao.liu@intel.com>; H. J. Lu <hjl.tools@gmail.com>
> Subject: [PATCH] i386: Fix comment/naming for APX NDD constraints
> 
> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> Ok for trunk?
> 
> gcc/ChangeLog:
> 
>         * config/i386/constraints.md: Fixed the comment/naming
>         for je/jM/jO.
>         * config/i386/predicates.md (apx_ndd_memory_operand):
>         Renamed and fixed the comment.
>         (apx_evex_memory_operand): New name.
>         (apx_ndd_add_memory_operand): Ditto.
>         (apx_evex_add_memory_operand): Ditto.
> ---
>  gcc/config/i386/constraints.md | 12 ++++++------
> gcc/config/i386/predicates.md  | 21 +++++++++++----------
>  2 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
> index 18389c47800..e03d0e1b45b 100644
> --- a/gcc/config/i386/constraints.md
> +++ b/gcc/config/i386/constraints.md
> @@ -463,14 +463,14 @@
>   "TARGET_APX_EGPR && !TARGET_AVX ? GENERAL_GPR16 : GENERAL_REGS")
> 
>  (define_memory_constraint "je"
> -  "@internal Memory operand for APX NDD ADD."
> -  (match_operand 0 "apx_ndd_add_memory_operand"))
> +  "@internal Memory operand for APX EVEX ADD for NDD or NF."
> +  (match_operand 0 "apx_evex_add_memory_operand"))
> 
>  (define_memory_constraint "jM"
> -  "@internal Memory operand, with APX NDD check."
> -  (match_operand 0 "apx_ndd_memory_operand"))
> +  "@internal Memory operand, with APX EVEX check for NDD or NF."
> +  (match_operand 0 "apx_evex_memory_operand"))
> 
>  (define_memory_constraint "jO"
> -  "@internal Offsettable memory operand, with APX NDD check."
> -  (and (match_operand 0 "apx_ndd_memory_operand")
> +  "@internal Offsettable memory operand, with APX EVEX check for NDD or
> NF."
> +  (and (match_operand 0 "apx_evex_memory_operand")
>            (match_test "offsettable_nonstrict_memref_p (op)"))) diff --git
> a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index
> 680594871de..8cab10550e8 100644
> --- a/gcc/config/i386/predicates.md
> +++ b/gcc/config/i386/predicates.md
> @@ -2264,11 +2264,11 @@
>    return true;
>  })
> 
> -;; Return true if OP is a memory operand that can be also used in APX -;; NDD
> patterns with immediate operand.  With non-default address space, -;;
> segment register or address size prefix, APX NDD instruction length
> +;; Return true if OP is a memory operand that can be also used in APX
> +EVEX for ;; NDD or NF patterns with immediate operand.  With
APX EVEX-encoded patterns(i.e. APX NDD/NF) with ...
> +non-default address space, ;; segment register or address size prefix,
> +APX EVEX instruction length
>  ;; can exceed the 15 byte size limit.
> -(define_predicate "apx_ndd_memory_operand"
> +(define_predicate "apx_evex_memory_operand"
>    (match_operand 0 "memory_operand")
>  {
>    /* OK if immediate operand size < 4 bytes.  */ @@ -2312,19 +2312,20 @@
>    return true;
>  })
> 
> -;; Return true if OP is a memory operand which can be used in APX NDD -;;
> ADD with register source operand.  UNSPEC_GOTNTPOFF memory operand -;;
> is allowed with APX NDD ADD only if R_X86_64_CODE_6_GOTTPOFF works.
> -(define_predicate "apx_ndd_add_memory_operand"
> +;; Return true if OP is a memory operand which can be used in APX EVEX
EVEX-encoded ADD patterns(.i.e APX NDD/NF) with ...
> +ADD for ;; NDD or NF with register source operand.  UNSPEC_GOTNTPOFF
> +memory operand is ;; allowed with APX EVEX ADD only if
> R_X86_64_CODE_6_GOTTPOFF works.
> +(define_predicate "apx_evex_add_memory_operand"
>    (match_operand 0 "memory_operand")
>  {
> -  /* OK if "add %reg1, name@gottpoff(%rip), %reg2" is supported.  */
> +  /* OK if "add %reg1, name@gottpoff(%rip), %reg2" or
> +   "{nf} add name@gottpoff(%rip), %reg1" are supported.  */
>    if (HAVE_AS_R_X86_64_CODE_6_GOTTPOFF)
>      return true;
> 
>    op = XEXP (op, 0);
> 
> -  /* Disallow APX NDD ADD with UNSPEC_GOTNTPOFF.  */
> +  /* Disallow APX EVEX ADD with UNSPEC_GOTNTPOFF.  */
APX EVEX-encoded ADD, others LGTM.
>    if (GET_CODE (op) == CONST
>        && GET_CODE (XEXP (op, 0)) == UNSPEC
>        && XINT (XEXP (op, 0), 1) == UNSPEC_GOTNTPOFF)
> --
> 2.31.1
diff mbox series

Patch

diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
index 18389c47800..e03d0e1b45b 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -463,14 +463,14 @@ 
  "TARGET_APX_EGPR && !TARGET_AVX ? GENERAL_GPR16 : GENERAL_REGS")

 (define_memory_constraint "je"
-  "@internal Memory operand for APX NDD ADD."
-  (match_operand 0 "apx_ndd_add_memory_operand"))
+  "@internal Memory operand for APX EVEX ADD for NDD or NF."
+  (match_operand 0 "apx_evex_add_memory_operand"))

 (define_memory_constraint "jM"
-  "@internal Memory operand, with APX NDD check."
-  (match_operand 0 "apx_ndd_memory_operand"))
+  "@internal Memory operand, with APX EVEX check for NDD or NF."
+  (match_operand 0 "apx_evex_memory_operand"))

 (define_memory_constraint "jO"
-  "@internal Offsettable memory operand, with APX NDD check."
-  (and (match_operand 0 "apx_ndd_memory_operand")
+  "@internal Offsettable memory operand, with APX EVEX check for NDD or NF."
+  (and (match_operand 0 "apx_evex_memory_operand")
           (match_test "offsettable_nonstrict_memref_p (op)")))
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 680594871de..8cab10550e8 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -2264,11 +2264,11 @@ 
   return true;
 })

-;; Return true if OP is a memory operand that can be also used in APX
-;; NDD patterns with immediate operand.  With non-default address space,
-;; segment register or address size prefix, APX NDD instruction length
+;; Return true if OP is a memory operand that can be also used in APX EVEX for
+;; NDD or NF patterns with immediate operand.  With non-default address space,
+;; segment register or address size prefix, APX EVEX instruction length
 ;; can exceed the 15 byte size limit.
-(define_predicate "apx_ndd_memory_operand"
+(define_predicate "apx_evex_memory_operand"
   (match_operand 0 "memory_operand")
 {
   /* OK if immediate operand size < 4 bytes.  */
@@ -2312,19 +2312,20 @@ 
   return true;
 })

-;; Return true if OP is a memory operand which can be used in APX NDD
-;; ADD with register source operand.  UNSPEC_GOTNTPOFF memory operand
-;; is allowed with APX NDD ADD only if R_X86_64_CODE_6_GOTTPOFF works.
-(define_predicate "apx_ndd_add_memory_operand"
+;; Return true if OP is a memory operand which can be used in APX EVEX ADD for
+;; NDD or NF with register source operand.  UNSPEC_GOTNTPOFF memory operand is
+;; allowed with APX EVEX ADD only if R_X86_64_CODE_6_GOTTPOFF works.
+(define_predicate "apx_evex_add_memory_operand"
   (match_operand 0 "memory_operand")
 {
-  /* OK if "add %reg1, name@gottpoff(%rip), %reg2" is supported.  */
+  /* OK if "add %reg1, name@gottpoff(%rip), %reg2" or
+   "{nf} add name@gottpoff(%rip), %reg1" are supported.  */
   if (HAVE_AS_R_X86_64_CODE_6_GOTTPOFF)
     return true;

   op = XEXP (op, 0);

-  /* Disallow APX NDD ADD with UNSPEC_GOTNTPOFF.  */
+  /* Disallow APX EVEX ADD with UNSPEC_GOTNTPOFF.  */
   if (GET_CODE (op) == CONST
       && GET_CODE (XEXP (op, 0)) == UNSPEC
       && XINT (XEXP (op, 0), 1) == UNSPEC_GOTNTPOFF)