OSDN Git Service

Backport from mainline
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / i386.md
index a3c0d3e..f1b53a0 100644 (file)
 {
   rtx addr = operands[1];
 
-  if (GET_CODE (addr) == SUBREG)
+  if (SImode_address_operand (addr, VOIDmode))
     {
       gcc_assert (TARGET_64BIT);
-      gcc_assert (<MODE>mode == SImode);
-      gcc_assert (GET_MODE (SUBREG_REG (addr)) == DImode);
-      return "lea{l}\t{%E1, %0|%0, %E1}";
-    }
-  else if (GET_CODE (addr) == ZERO_EXTEND
-          || GET_CODE (addr) == AND)
-    {
-      gcc_assert (TARGET_64BIT);
-      gcc_assert (<MODE>mode == DImode);
       return "lea{l}\t{%E1, %k0|%k0, %E1}";
     }
   else 
   DONE;
 }
   [(set_attr "type" "lea")
-   (set_attr "mode" "<MODE>")])
+   (set (attr "mode")
+     (if_then_else
+       (match_operand 1 "SImode_address_operand")
+       (const_string "SI")
+       (const_string "<MODE>")))])
 \f
 ;; Add instructions
 
   int locality = INTVAL (operands[2]);
 
   gcc_assert (rw == 0 || rw == 1);
-  gcc_assert (locality >= 0 && locality <= 3);
-  gcc_assert (GET_MODE (operands[0]) == Pmode
-             || GET_MODE (operands[0]) == VOIDmode);
+  gcc_assert (IN_RANGE (locality, 0, 3));
 
+  if (TARGET_PREFETCHW && rw)
+    operands[2] = GEN_INT (3);
   /* Use 3dNOW prefetch in case we are asking for write prefetch not
      supported by SSE counterpart or the SSE prefetch is not available
      (K6 machines).  Otherwise use SSE prefetch as it allows specifying
      of locality.  */
-  if (TARGET_3DNOW && (!TARGET_PREFETCH_SSE || rw))
+  else if (TARGET_3DNOW && (!TARGET_PREFETCH_SSE || rw))
     operands[2] = GEN_INT (3);
   else
     operands[1] = const0_rtx;
 })
 
-(define_insn "*prefetch_sse_<mode>"
-  [(prefetch (match_operand:P 0 "address_operand" "p")
+(define_insn "*prefetch_sse"
+  [(prefetch (match_operand 0 "address_operand" "p")
             (const_int 0)
             (match_operand:SI 1 "const_int_operand" ""))]
   "TARGET_PREFETCH_SSE"
   };
 
   int locality = INTVAL (operands[1]);
-  gcc_assert (locality >= 0 && locality <= 3);
+  gcc_assert (IN_RANGE (locality, 0, 3));
 
   return patterns[locality];
 }
   [(set_attr "type" "sse")
    (set_attr "atom_sse_attr" "prefetch")
    (set (attr "length_address")
-       (symbol_ref "memory_address_length (operands[0])"))
+       (symbol_ref "memory_address_length (operands[0], false)"))
    (set_attr "memory" "none")])
 
-(define_insn "*prefetch_3dnow_<mode>"
-  [(prefetch (match_operand:P 0 "address_operand" "p")
+(define_insn "*prefetch_3dnow"
+  [(prefetch (match_operand 0 "address_operand" "p")
             (match_operand:SI 1 "const_int_operand" "n")
             (const_int 3))]
-  "TARGET_3DNOW"
+  "TARGET_3DNOW || TARGET_PREFETCHW"
 {
   if (INTVAL (operands[1]) == 0)
     return "prefetch\t%a0";
 }
   [(set_attr "type" "mmx")
    (set (attr "length_address")
-       (symbol_ref "memory_address_length (operands[0])"))
+       (symbol_ref "memory_address_length (operands[0], false)"))
    (set_attr "memory" "none")])
 
 (define_expand "stack_protect_set"