[02/42] i386: Add mmx_nonimmediate_operand

Message ID 20190215135812.32306-3-hjl.tools@gmail.com
State New
Headers show
Series
  • V6: Emulate MMX intrinsics with SSE
Related show

Commit Message

H.J. Lu Feb. 15, 2019, 1:57 p.m.
True if the operand is a register or an nonimmediate operand when
TARGET_MMX_WITH_SSE is false.

	PR target/89021
	* config/i386/predicates.md (mmx_nonimmediate_operand): New.
---
 gcc/config/i386/predicates.md | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.20.1

Comments

Uros Bizjak Feb. 15, 2019, 4:49 p.m. | #1
On Fri, Feb 15, 2019 at 2:58 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> True if the operand is a register or an nonimmediate operand when

> TARGET_MMX_WITH_SSE is false.

>

>         PR target/89021

>         * config/i386/predicates.md (mmx_nonimmediate_operand): New.

> ---

>  gcc/config/i386/predicates.md | 7 +++++++

>  1 file changed, 7 insertions(+)

>

> diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md

> index 99226e86436..bd1f07a28fb 100644

> --- a/gcc/config/i386/predicates.md

> +++ b/gcc/config/i386/predicates.md

> @@ -49,6 +49,13 @@

>    (and (match_code "reg")

>         (match_test "MMX_REGNO_P (REGNO (op))")))

>

> +;; True if the operand is a register or an nonimmediate operand when

> +;; TARGET_MMX_WITH_SSE is false.

> +(define_predicate "mmx_nonimmediate_operand"

> +  (ior (match_operand 0 "register_operand")

> +       (and (not (match_test "TARGET_MMX_WITH_SSE"))

> +           (match_operand 0 "nonimmediate_operand"))))


Here you can use "memory_operand".

I'd expect you use this new predicate universally throughout the
patchset in e.g.

+  (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym,x,Yv")))]
+  "(TARGET_MMX || TARGET_MMX_WITH_SSE)
+   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
+  "@
+   ...
+   ...
+   v...
+  [(set_attr "mmx_isa" "native,x64_noavx,x64_avx")

When TARGET_MMX_WITH_SSE is true, then only the last two constraints
are enabled, so we are sure that only register operand is allowed.
While RA can fixup mem->reg by itself, It is beneficial to pass this
information to the compiler via predicate, and
mmx_nonimmediate_operand fits there perfectly.

Uros.

Patch

diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 99226e86436..bd1f07a28fb 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -49,6 +49,13 @@ 
   (and (match_code "reg")
        (match_test "MMX_REGNO_P (REGNO (op))")))
 
+;; True if the operand is a register or an nonimmediate operand when
+;; TARGET_MMX_WITH_SSE is false.
+(define_predicate "mmx_nonimmediate_operand"
+  (ior (match_operand 0 "register_operand")
+       (and (not (match_test "TARGET_MMX_WITH_SSE"))
+	    (match_operand 0 "nonimmediate_operand"))))
+
 ;; True if the operand is an SSE register.
 (define_predicate "sse_reg_operand"
   (and (match_code "reg")