i386.c (ix86_expand_store_builtin): Always force op1 to register.
authorJan Hubicka <jh@suse.cz>
Mon, 3 Feb 2003 20:20:36 +0000 (21:20 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 3 Feb 2003 20:20:36 +0000 (20:20 +0000)
* i386.c (ix86_expand_store_builtin):  Always force op1 to register.
(mov*_internal): Fix predicates; require one of operands to not be
memory.
(SSE?MMX move expanders):  Fix predicates; force one of operands to
register.
(SSE/MMX push patterns): Reorganize; fix x86-64 code generation.
(movups/movupd/movdqu patterns): Force one of operands to not be
memory.

From-SVN: r62339

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index d89b2153e9c82ff51d30cbf3408ede2ed37a851d..8deaf03973b057238b3484efa53185801e83f47b 100644 (file)
@@ -1,3 +1,14 @@
+Mon Feb  3 21:19:11 CET 2003  Jan Hubicka  <jh@suse.cz>
+
+       * i386.c (ix86_expand_store_builtin):  Always force op1 to register.
+       (mov*_internal): Fix predicates; require one of operands to not be
+       memory.
+       (SSE?MMX move expanders):  Fix predicates; force one of operands to
+       register.
+       (SSE/MMX push patterns): Reorganize; fix x86-64 code generation.
+       (movups/movupd/movdqu patterns): Force one of operands to not be
+       memory.
+
 2002-02-03  Roger Sayle  <roger@eyesopen.com>
 
        * hooks.c (hook_rtx_rtx_identity): Generic hook function that
index 2f7a300f8ecd26b03cdbc6e53b61abc37cf7d428..2d799bb653ce5c36745479a619c3bdef7baafcd6 100644 (file)
@@ -13469,9 +13469,7 @@ ix86_expand_store_builtin (icode, arglist)
     op1 = safe_vector_operand (op1, mode1);
 
   op0 = gen_rtx_MEM (mode0, copy_to_mode_reg (Pmode, op0));
-
-  if (! (*insn_data[icode].operand[1].predicate) (op1, mode1))
-    op1 = copy_to_mode_reg (mode1, op1);
+  op1 = copy_to_mode_reg (mode1, op1);
 
   pat = GEN_FCN (icode) (op0, op1);
   if (pat)
index 4c8211356ee82a5650fdf07514df08e841130693..292ddf371baabd3ae33af9db02d70661f0a2cc84 100644 (file)
 (define_insn "movv8qi_internal"
   [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
        (match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
-  "TARGET_MMX"
+  "TARGET_MMX
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
   "movq\t{%1, %0|%0, %1}"
   [(set_attr "type" "mmxmov")
    (set_attr "mode" "DI")])
 (define_insn "movv4hi_internal"
   [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
        (match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
-  "TARGET_MMX"
+  "TARGET_MMX
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
   "movq\t{%1, %0|%0, %1}"
   [(set_attr "type" "mmxmov")
    (set_attr "mode" "DI")])
 (define_insn "movv2si_internal"
   [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
        (match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
-  "TARGET_MMX"
+  "TARGET_MMX
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
   "movq\t{%1, %0|%0, %1}"
   [(set_attr "type" "mmxcvt")
    (set_attr "mode" "DI")])
 (define_insn "movv2sf_internal"
   [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
         (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
-  "TARGET_3DNOW"
+  "TARGET_3DNOW
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
   "movq\\t{%1, %0|%0, %1}"
   [(set_attr "type" "mmxcvt")
    (set_attr "mode" "DI")])
 
 (define_expand "movti"
-  [(set (match_operand:TI 0 "general_operand" "")
-       (match_operand:TI 1 "general_operand" ""))]
+  [(set (match_operand:TI 0 "nonimmediate_operand" "")
+       (match_operand:TI 1 "nonimmediate_operand" ""))]
   "TARGET_SSE || TARGET_64BIT"
 {
   if (TARGET_64BIT)
 (define_insn "movv2df_internal"
   [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
        (match_operand:V2DF 1 "nonimmediate_operand" "xm,x"))]
-  "TARGET_SSE2"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
 {
   if (get_attr_mode (insn) == MODE_V4SF)
     return "movaps\t{%1, %0|%0, %1}";
 (define_insn "movv8hi_internal"
   [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
        (match_operand:V8HI 1 "nonimmediate_operand" "xm,x"))]
-  "TARGET_SSE2"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
 {
   if (get_attr_mode (insn) == MODE_V4SF)
     return "movaps\t{%1, %0|%0, %1}";
 (define_insn "movv16qi_internal"
   [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
        (match_operand:V16QI 1 "nonimmediate_operand" "xm,x"))]
-  "TARGET_SSE2"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
 {
   if (get_attr_mode (insn) == MODE_V4SF)
     return "movaps\t{%1, %0|%0, %1}";
               (const_string "TI")))])
 
 (define_expand "movv2df"
-  [(set (match_operand:V2DF 0 "general_operand" "")
-       (match_operand:V2DF 1 "general_operand" ""))]
+  [(set (match_operand:V2DF 0 "nonimmediate_operand" "")
+       (match_operand:V2DF 1 "nonimmediate_operand" ""))]
   "TARGET_SSE2"
 {
   ix86_expand_vector_move (V2DFmode, operands);
 })
 
 (define_expand "movv8hi"
-  [(set (match_operand:V8HI 0 "general_operand" "")
-       (match_operand:V8HI 1 "general_operand" ""))]
+  [(set (match_operand:V8HI 0 "nonimmediate_operand" "")
+       (match_operand:V8HI 1 "nonimmediate_operand" ""))]
   "TARGET_SSE2"
 {
   ix86_expand_vector_move (V8HImode, operands);
 })
 
 (define_expand "movv16qi"
-  [(set (match_operand:V16QI 0 "general_operand" "")
-       (match_operand:V16QI 1 "general_operand" ""))]
+  [(set (match_operand:V16QI 0 "nonimmediate_operand" "")
+       (match_operand:V16QI 1 "nonimmediate_operand" ""))]
   "TARGET_SSE2"
 {
   ix86_expand_vector_move (V16QImode, operands);
 })
 
 (define_expand "movv4sf"
-  [(set (match_operand:V4SF 0 "general_operand" "")
-       (match_operand:V4SF 1 "general_operand" ""))]
+  [(set (match_operand:V4SF 0 "nonimmediate_operand" "")
+       (match_operand:V4SF 1 "nonimmediate_operand" ""))]
   "TARGET_SSE"
 {
   ix86_expand_vector_move (V4SFmode, operands);
 })
 
 (define_expand "movv4si"
-  [(set (match_operand:V4SI 0 "general_operand" "")
-       (match_operand:V4SI 1 "general_operand" ""))]
+  [(set (match_operand:V4SI 0 "nonimmediate_operand" "")
+       (match_operand:V4SI 1 "nonimmediate_operand" ""))]
   "TARGET_SSE"
 {
   ix86_expand_vector_move (V4SImode, operands);
 })
 
 (define_expand "movv2di"
-  [(set (match_operand:V2DI 0 "general_operand" "")
-       (match_operand:V2DI 1 "general_operand" ""))]
+  [(set (match_operand:V2DI 0 "nonimmediate_operand" "")
+       (match_operand:V2DI 1 "nonimmediate_operand" ""))]
   "TARGET_SSE"
 {
   ix86_expand_vector_move (V2DImode, operands);
 })
 
 (define_expand "movv2si"
-  [(set (match_operand:V2SI 0 "general_operand" "")
-       (match_operand:V2SI 1 "general_operand" ""))]
+  [(set (match_operand:V2SI 0 "nonimmediate_operand" "")
+       (match_operand:V2SI 1 "nonimmediate_operand" ""))]
   "TARGET_MMX"
 {
   ix86_expand_vector_move (V2SImode, operands);
 })
 
 (define_expand "movv4hi"
-  [(set (match_operand:V4HI 0 "general_operand" "")
-       (match_operand:V4HI 1 "general_operand" ""))]
+  [(set (match_operand:V4HI 0 "nonimmediate_operand" "")
+       (match_operand:V4HI 1 "nonimmediate_operand" ""))]
   "TARGET_MMX"
 {
   ix86_expand_vector_move (V4HImode, operands);
 })
 
 (define_expand "movv8qi"
-  [(set (match_operand:V8QI 0 "general_operand" "")
-       (match_operand:V8QI 1 "general_operand" ""))]
+  [(set (match_operand:V8QI 0 "nonimmediate_operand" "")
+       (match_operand:V8QI 1 "nonimmediate_operand" ""))]
   "TARGET_MMX"
 {
   ix86_expand_vector_move (V8QImode, operands);
 })
 
 (define_expand "movv2sf"
-  [(set (match_operand:V2SF 0 "general_operand" "")
-       (match_operand:V2SF 1 "general_operand" ""))]
+  [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
+       (match_operand:V2SF 1 "nonimmediate_operand" ""))]
    "TARGET_3DNOW"
 {
   ix86_expand_vector_move (V2SFmode, operands);
   DONE;
 })
 
-(define_insn_and_split "*pushti"
+(define_insn "*pushti"
   [(set (match_operand:TI 0 "push_operand" "=<")
-       (match_operand:TI 1 "nonmemory_operand" "x"))]
+       (match_operand:TI 1 "register_operand" "x"))]
   "TARGET_SSE"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:TI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+  "#")
 
-(define_insn_and_split "*pushv2df"
+(define_insn "*pushv2df"
   [(set (match_operand:V2DF 0 "push_operand" "=<")
-       (match_operand:V2DF 1 "nonmemory_operand" "x"))]
-  "TARGET_SSE2"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:V2DF (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+       (match_operand:V2DF 1 "register_operand" "x"))]
+  "TARGET_SSE"
+  "#")
 
-(define_insn_and_split "*pushv2di"
+(define_insn "*pushv2di"
   [(set (match_operand:V2DI 0 "push_operand" "=<")
-       (match_operand:V2DI 1 "nonmemory_operand" "x"))]
+       (match_operand:V2DI 1 "register_operand" "x"))]
   "TARGET_SSE2"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:V2DI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+  "#")
 
-(define_insn_and_split "*pushv8hi"
+(define_insn "*pushv8hi"
   [(set (match_operand:V8HI 0 "push_operand" "=<")
-       (match_operand:V8HI 1 "nonmemory_operand" "x"))]
+       (match_operand:V8HI 1 "register_operand" "x"))]
   "TARGET_SSE2"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:V8HI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+  "#")
 
-(define_insn_and_split "*pushv16qi"
+(define_insn "*pushv16qi"
   [(set (match_operand:V16QI 0 "push_operand" "=<")
-       (match_operand:V16QI 1 "nonmemory_operand" "x"))]
+       (match_operand:V16QI 1 "register_operand" "x"))]
   "TARGET_SSE2"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:V16QI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+  "#")
 
-(define_insn_and_split "*pushv4sf"
+(define_insn "*pushv4sf"
   [(set (match_operand:V4SF 0 "push_operand" "=<")
-       (match_operand:V4SF 1 "nonmemory_operand" "x"))]
+       (match_operand:V4SF 1 "register_operand" "x"))]
   "TARGET_SSE"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:V4SF (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+  "#")
 
-(define_insn_and_split "*pushv4si"
+(define_insn "*pushv4si"
   [(set (match_operand:V4SI 0 "push_operand" "=<")
-       (match_operand:V4SI 1 "nonmemory_operand" "x"))]
-  "TARGET_SSE"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
-   (set (mem:V4SI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "multi")])
+       (match_operand:V4SI 1 "register_operand" "x"))]
+  "TARGET_SSE2"
+  "#")
 
-(define_insn_and_split "*pushv2si"
+(define_insn "*pushv2si"
   [(set (match_operand:V2SI 0 "push_operand" "=<")
-       (match_operand:V2SI 1 "nonmemory_operand" "y"))]
+       (match_operand:V2SI 1 "register_operand" "y"))]
   "TARGET_MMX"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
-   (set (mem:V2SI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "mmx")])
+  "#")
 
-(define_insn_and_split "*pushv4hi"
+(define_insn "*pushv4hi"
   [(set (match_operand:V4HI 0 "push_operand" "=<")
-       (match_operand:V4HI 1 "nonmemory_operand" "y"))]
+       (match_operand:V4HI 1 "register_operand" "y"))]
   "TARGET_MMX"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
-   (set (mem:V4HI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "mmx")])
+  "#")
 
-(define_insn_and_split "*pushv8qi"
+(define_insn "*pushv8qi"
   [(set (match_operand:V8QI 0 "push_operand" "=<")
-       (match_operand:V8QI 1 "nonmemory_operand" "y"))]
+       (match_operand:V8QI 1 "register_operand" "y"))]
   "TARGET_MMX"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
-   (set (mem:V8QI (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "mmx")])
+  "#")
 
-(define_insn_and_split "*pushv2sf"
+(define_insn "*pushv2sf"
   [(set (match_operand:V2SF 0 "push_operand" "=<")
-       (match_operand:V2SF 1 "nonmemory_operand" "y"))]
+       (match_operand:V2SF 1 "register_operand" "y"))]
   "TARGET_3DNOW"
-  "#"
-  ""
-  [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -8)))
-   (set (mem:V2SF (reg:SI 7)) (match_dup 1))]
-  ""
-  [(set_attr "type" "mmx")])
+  "#")
+
+(define_split
+  [(set (match_operand 0 "push_operand" "")
+       (match_operand 1 "register_operand" ""))]
+  "!TARGET_64BIT && reload_completed
+   && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
+  [(set (reg:SI 7) (plus:SI (reg:SI 7) (match_dup 3)))
+   (set (match_dup 2) (match_dup 1))]
+  "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
+                                stack_pointer_rtx);
+   operands[3] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));")
+
+(define_split
+  [(set (match_operand 0 "push_operand" "")
+       (match_operand 1 "register_operand" ""))]
+  "TARGET_64BIT && reload_completed
+   && (SSE_REG_P (operands[1]) || MMX_REG_P (operands[1]))"
+  [(set (reg:DI 7) (plus:DI (reg:DI 7) (match_dup 3)))
+   (set (match_dup 2) (match_dup 1))]
+  "operands[2] = change_address (operands[0], GET_MODE (operands[0]),
+                                stack_pointer_rtx);
+   operands[3] = GEN_INT (GET_MODE_SIZE (GET_MODE (operands[0])));")
+
 
 (define_insn "movti_internal"
   [(set (match_operand:TI 0 "nonimmediate_operand" "=x,x,m")
        (match_operand:TI 1 "general_operand" "C,xm,x"))]
-  "TARGET_SSE && !TARGET_64BIT"
+  "TARGET_SSE && !TARGET_64BIT
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
 {
   switch (which_alternative)
     {
   [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
        (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
                     UNSPEC_MOVA))]
-  "TARGET_SSE"
-  "@
-   movaps\t{%1, %0|%0, %1}
-   movaps\t{%1, %0|%0, %1}"
+  "TARGET_SSE
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+  "movaps\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov,ssemov")
    (set_attr "mode" "V4SF")])
 
   [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
        (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,x")]
                     UNSPEC_MOVU))]
-  "TARGET_SSE"
-  "@
-   movups\t{%1, %0|%0, %1}
-   movups\t{%1, %0|%0, %1}"
+  "TARGET_SSE
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+  "movups\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssecvt,ssecvt")
    (set_attr "mode" "V4SF")])
 
 
 (define_insn "sse2_movapd"
   [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
-       (unspec:V2DF [(match_operand:V2DF 1 "general_operand" "xm,x")]
+       (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
                     UNSPEC_MOVA))]
-  "TARGET_SSE2"
-  "@
-   movapd\t{%1, %0|%0, %1}
-   movapd\t{%1, %0|%0, %1}"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+  "movapd\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov")
    (set_attr "mode" "V2DF")])
 
 (define_insn "sse2_movupd"
   [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
-       (unspec:V2DF [(match_operand:V2DF 1 "general_operand" "xm,x")]
+       (unspec:V2DF [(match_operand:V2DF 1 "nonimmediate_operand" "xm,x")]
                     UNSPEC_MOVU))]
-  "TARGET_SSE2"
-  "@
-   movupd\t{%1, %0|%0, %1}
-   movupd\t{%1, %0|%0, %1}"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+  "movupd\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssecvt")
    (set_attr "mode" "V2DF")])
 
 (define_insn "sse2_movdqa"
   [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
-       (unspec:V16QI [(match_operand:V16QI 1 "general_operand" "xm,x")]
+       (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
                       UNSPEC_MOVA))]
-  "TARGET_SSE2"
-  "@
-   movdqa\t{%1, %0|%0, %1}
-   movdqa\t{%1, %0|%0, %1}"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+  "movdqa\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov")
    (set_attr "mode" "TI")])
 
 (define_insn "sse2_movdqu"
   [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
-       (unspec:V16QI [(match_operand:V16QI 1 "general_operand" "xm,x")]
+       (unspec:V16QI [(match_operand:V16QI 1 "nonimmediate_operand" "xm,x")]
                       UNSPEC_MOVU))]
-  "TARGET_SSE2"
-  "@
-   movdqu\t{%1, %0|%0, %1}
-   movdqu\t{%1, %0|%0, %1}"
+  "TARGET_SSE2
+   && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
+  "movdqu\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssecvt")
    (set_attr "mode" "TI")])