[01/10] x86: "prefix_extra" tidying

Message ID 7e28ba70-d18d-13ad-78bc-6e97ea6796a3@suse.com
State Accepted
Headers
Series x86: (mainly) "prefix_extra" adjustments |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jan Beulich Aug. 3, 2023, 8:09 a.m. UTC
  Drop SSE5 leftovers from both its comment and its default calculation.
A value of 2 simply cannot occur anymore. Instead extend the comment to
mention the use of the attribute in "length_vex", clarifying why
"prefix_extra" can actually be meaningful on VEX-encoded insns despite
those not having any real prefixes except possibly segment overrides.

gcc/

	* config/i386/i386.md (prefix_extra): Correct comment. Fold
	cases yielding 2 into ones yielding 1.
---
I question the 3DNow! aspect here: There's no extra prefix there. It's
an immediate instead which "sub-divides" major opcode 0f0f.
  

Comments

Hongtao Liu Aug. 4, 2023, 1:50 a.m. UTC | #1
On Thu, Aug 3, 2023 at 4:10 PM Jan Beulich via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Drop SSE5 leftovers from both its comment and its default calculation.
> A value of 2 simply cannot occur anymore. Instead extend the comment to
> mention the use of the attribute in "length_vex", clarifying why
> "prefix_extra" can actually be meaningful on VEX-encoded insns despite
> those not having any real prefixes except possibly segment overrides.
>
Ok.
> gcc/
>
>         * config/i386/i386.md (prefix_extra): Correct comment. Fold
>         cases yielding 2 into ones yielding 1.
> ---
> I question the 3DNow! aspect here: There's no extra prefix there. It's
> an immediate instead which "sub-divides" major opcode 0f0f.
>
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -620,13 +620,11 @@
>         (const_int 0)))
>
>  ;; There are also additional prefixes in 3DNOW, SSSE3.
> -;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
> -;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
>  ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
> +;; While generally inapplicable to VEX/XOP/EVEX encodings, "length_vex" uses
> +;; the attribute evaluating to zero to know that VEX2 encoding may be usable.
>  (define_attr "prefix_extra" ""
> -  (cond [(eq_attr "type" "ssemuladd,sse4arg")
> -          (const_int 2)
> -        (eq_attr "type" "sseiadd1,ssecvt1")
> +  (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
>            (const_int 1)
>         ]
>         (const_int 0)))
>
  

Patch

--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -620,13 +620,11 @@ 
 	(const_int 0)))
 
 ;; There are also additional prefixes in 3DNOW, SSSE3.
-;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
-;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
 ;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
+;; While generally inapplicable to VEX/XOP/EVEX encodings, "length_vex" uses
+;; the attribute evaluating to zero to know that VEX2 encoding may be usable.
 (define_attr "prefix_extra" ""
-  (cond [(eq_attr "type" "ssemuladd,sse4arg")
-	   (const_int 2)
-	 (eq_attr "type" "sseiadd1,ssecvt1")
+  (cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1")
 	   (const_int 1)
 	]
 	(const_int 0)))