i386.md (all HI and QI mode non-move patterns): Conditionize by TARGET_[HQ]IMODE_MATH.
authorJan Hubicka <jh@suse.cz>
Thu, 16 Mar 2000 16:08:35 +0000 (17:08 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 16 Mar 2000 16:08:35 +0000 (16:08 +0000)
* i386.md (all HI and QI mode non-move patterns):  Conditionize
by TARGET_[HQ]IMODE_MATH.
* i386.h (x86_himode_math, x86_qimode_math, x86_promote_hi_regs,
x86_promote_qi_regs): Declare.
(TARGET_HIMODE_MATH, TARGET_QIMODE_MATH, TARGET_PROMOTE_HI_REGS,
TARGET_PROMOTE_QI_REGS): New macros.
(PROMOTE_MODE): New macro.
* i386.c (x86_himode_math, x86_qimode_math, x86_promote_hi_regs,
x86_promote_qi_regs): New global variables.

From-SVN: r32588

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

index d781ebc663b2f76f5605f306db188202ce605c04..37dc67e4c4d3c2631485bf824d671296214a8c37 100644 (file)
@@ -1,3 +1,15 @@
+Thu Mar 16 17:03:10 MET 2000  Jan Hubicka  <jh@suse.cz>
+
+       * i386.md (all HI and QI mode non-move patterns):  Conditionize
+       by TARGET_[HQ]IMODE_MATH.
+       * i386.h (x86_himode_math, x86_qimode_math, x86_promote_hi_regs,
+       x86_promote_qi_regs): Declare.
+       (TARGET_HIMODE_MATH, TARGET_QIMODE_MATH, TARGET_PROMOTE_HI_REGS,
+       TARGET_PROMOTE_QI_REGS): New macros.
+       (PROMOTE_MODE): New macro.
+       * i386.c (x86_himode_math, x86_qimode_math, x86_promote_hi_regs,
+       x86_promote_qi_regs): New global variables.
+
 Thu Mar 16 16:50:44 MET 2000  Jan Hubicka  <jh@suse.cz>
 
        * calls.c (emit_library_call_value_1): Break out from ...; handle
index c2eadf13bd228610367d57535c94fb87cfc0e01e..e78809fbdf2581429f5c734d059520703d18b8f6 100644 (file)
@@ -214,6 +214,10 @@ const int x86_read_modify = ~(m_PENT | m_PPRO);
 const int x86_split_long_moves = m_PPRO;
 const int x86_promote_QImode = m_K6 | m_PENT | m_386 | m_486;
 const int x86_single_stringop = m_386;
+const int x86_qimode_math = ~(0);
+const int x86_promote_qi_regs = 0;
+const int x86_himode_math = ~(m_PPRO);
+const int x86_promote_hi_regs = m_PPRO;
 
 #define AT_BP(mode) (gen_rtx_MEM ((mode), hard_frame_pointer_rtx))
 
index e6c13abf6d0ef112edc67b7c05d7fdd2ad1b9f50..afaa80d36b6bc0007b7a0d0d642472204042bb66 100644 (file)
@@ -163,6 +163,8 @@ extern const int x86_use_loop, x86_use_fiop, x86_use_mov0;
 extern const int x86_use_cltd, x86_read_modify_write;
 extern const int x86_read_modify, x86_split_long_moves;
 extern const int x86_promote_QImode, x86_single_stringop;
+extern const int x86_himode_math, x86_qimode_math, x86_promote_qi_regs;
+extern const int x86_promote_hi_regs;
 
 #define TARGET_USE_LEAVE (x86_use_leave & CPUMASK)
 #define TARGET_PUSH_MEMORY (x86_push_memory & CPUMASK)
@@ -186,6 +188,10 @@ extern const int x86_promote_QImode, x86_single_stringop;
 #define TARGET_READ_MODIFY (x86_read_modify & CPUMASK)
 #define TARGET_PROMOTE_QImode (x86_promote_QImode & CPUMASK)
 #define TARGET_SINGLE_STRINGOP (x86_single_stringop & CPUMASK)
+#define TARGET_QIMODE_MATH (x86_qimode_math & CPUMASK)
+#define TARGET_HIMODE_MATH (x86_himode_math & CPUMASK)
+#define TARGET_PROMOTE_QI_REGS (x86_promote_qi_regs & CPUMASK)
+#define TARGET_PROMOTE_HI_REGS (x86_promote_hi_regs & CPUMASK)
 
 #define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
 
@@ -1740,6 +1746,19 @@ while (0)
 
 #define PROMOTE_PROTOTYPES 1
 
+/* A macro to update M and UNSIGNEDP when an object whose type is
+   TYPE and which has the specified mode and signedness is to be
+   stored in a register.  This macro is only called when TYPE is a
+   scalar type.
+
+   On i386 it is sometimes usefull to promote HImode and QImode
+   quantities to SImode.  The choice depends on target type.  */
+
+#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE)            \
+  if (((MODE) == HImode && TARGET_PROMOTE_HI_REGS)     \
+      || ((MODE) == QImode && TARGET_PROMOTE_QI_REGS)) \
+    (MODE) = SImode;
+
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
    between pointers and any other objects of this machine mode.  */
index 925473952ac99e2618013af5121e4653570a815a..7bac8ac0f36a51298b400b0dff9266149336cfbe 100644 (file)
   [(set (reg:CC 17)
        (compare:CC (match_operand:QI 0 "general_operand" "")
                    (match_operand:QI 1 "general_operand" "")))]
-  ""
+  "TARGET_QIMODE_MATH"
   "
 {
   if ((GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
   [(set (attr "type")
      (cond [(and (eq_attr "alternative" "0")
                 (eq (symbol_ref "TARGET_PARTIAL_REG_STALL")
-                       (const_int 0)))
+                    (const_int 0)))
              (const_string "imov")
            (and (eq_attr "alternative" "1,2")
                 (match_operand:HI 1 "aligned_operand" ""))
                   (plus:HI (match_operand:HI 1 "nonimmediate_operand" "")
                            (match_operand:HI 2 "general_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (PLUS, HImode, operands); DONE;")
 
 ;; %%% After Dave's SUBREG_BYTE stuff goes in, re-enable incb %ah
                   (plus:QI (match_operand:QI 1 "nonimmediate_operand" "")
                            (match_operand:QI 2 "general_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (PLUS, QImode, operands); DONE;")
 
 ;; %%% Potential partial reg stall on alternative 2.  What to do?
                   (minus:HI (match_operand:HI 1 "nonimmediate_operand" "")
                             (match_operand:HI 2 "general_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (MINUS, HImode, operands); DONE;")
 
 (define_insn "*subhi_1"
                   (minus:QI (match_operand:QI 1 "nonimmediate_operand" "")
                             (match_operand:QI 2 "general_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (MINUS, QImode, operands); DONE;")
 
 (define_insn "*subqi_1"
                   (mult:HI (match_operand:HI 1 "register_operand" "")
                            (match_operand:HI 2 "general_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_HIMODE_MATH"
   "")
 
 (define_insn "*mulhi3_1"
        (mult:QI (match_operand:QI 1 "register_operand" "%0")
                 (match_operand:QI 2 "nonimmediate_operand" "qm")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "mul{b}\\t%2"
   [(set_attr "type" "imul")])
 
        (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%0"))
                 (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "mul{b}\\t%2"
   [(set_attr "type" "imul")])
 
        (mult:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "%0"))
                 (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "imul{b}\\t%2"
   [(set_attr "type" "imul")])
 
        (div:QI (match_operand:HI 1 "register_operand" "0")
                (match_operand:QI 2 "nonimmediate_operand" "qm")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "idiv{b}\\t%2"
   [(set_attr "type" "idiv")
    (set_attr "ppro_uops" "few")])
        (udiv:QI (match_operand:HI 1 "register_operand" "0")
                 (match_operand:QI 2 "nonimmediate_operand" "qm")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "div{b}\\t%2"
   [(set_attr "type" "idiv")
    (set_attr "ppro_uops" "few")])
    (set (match_operand:HI 3 "register_operand" "=&d")
        (mod:HI (match_dup 1) (match_dup 2)))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "cwtd\;idiv{w}\\t%2"
   [(set_attr "type" "multi")])
 
                   (umod:HI (match_dup 1) (match_dup 2)))
              (use (match_dup 4))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_HIMODE_MATH"
   "operands[4] = gen_reg_rtx (HImode);")
 
 (define_insn "*udivmodhi_noext"
        (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
                (match_operand:HI 2 "general_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (AND, HImode, operands); DONE;")
 
 (define_insn "*andhi_1"
        (and:QI (match_operand:QI 1 "nonimmediate_operand" "")
                (match_operand:QI 2 "general_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (AND, QImode, operands); DONE;")
 
 ;; %%% Potential partial reg stall on alternative 2.  What to do?
        (ior:HI (match_operand:HI 1 "nonimmediate_operand" "")
                (match_operand:HI 2 "general_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (IOR, HImode, operands); DONE;")
 
 (define_insn "*iorhi_1"
        (ior:QI (match_operand:QI 1 "nonimmediate_operand" "")
                (match_operand:QI 2 "general_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (IOR, QImode, operands); DONE;")
 
 ;; %%% Potential partial reg stall on alternative 2.  What to do?
        (xor:HI (match_operand:HI 1 "nonimmediate_operand" "")
                (match_operand:HI 2 "general_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (XOR, HImode, operands); DONE;")
 
 (define_insn "*xorhi_1"
        (xor:QI (match_operand:QI 1 "nonimmediate_operand" "")
                (match_operand:QI 2 "general_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (XOR, QImode, operands); DONE;")
 
 ;; %%% Potential partial reg stall on alternative 2.  What to do?
   [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
                   (neg:HI (match_operand:HI 1 "nonimmediate_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_unary_operator (NEG, HImode, operands); DONE;")
 
 (define_insn "*neghi2_1"
   [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "")
                   (neg:QI (match_operand:QI 1 "nonimmediate_operand" "")))
              (clobber (reg:CC 17))])]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_unary_operator (NEG, QImode, operands); DONE;")
 
 (define_insn "*negqi2_1"
 (define_expand "one_cmplhi2"
   [(set (match_operand:HI 0 "nonimmediate_operand" "")
        (not:HI (match_operand:HI 1 "nonimmediate_operand" "")))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_unary_operator (NOT, HImode, operands); DONE;")
 
 (define_insn "*one_cmplhi2_1"
 (define_expand "one_cmplqi2"
   [(set (match_operand:QI 0 "nonimmediate_operand" "")
        (not:QI (match_operand:QI 1 "nonimmediate_operand" "")))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_unary_operator (NOT, QImode, operands); DONE;")
 
 (define_insn "*one_cmplqi2_1"
        (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "")
                   (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (ASHIFT, HImode, operands); DONE;")
 
 (define_insn "*ashlhi3_1"
        (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "")
                   (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (ASHIFT, QImode, operands); DONE;")
 
 ;; %%% Potential partial reg stall on alternative 2.  What to do?
        (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
                     (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (ASHIFTRT, HImode, operands); DONE;")
 
 (define_insn "*ashrhi3_1"
        (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
                     (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (ASHIFTRT, QImode, operands); DONE;")
 
 (define_insn "*ashrqi3_1"
        (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "")
                     (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (LSHIFTRT, HImode, operands); DONE;")
 
 (define_insn "*lshrhi3_1"
        (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "")
                     (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (LSHIFTRT, QImode, operands); DONE;")
 
 (define_insn "*lshrqi3_1"
        (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "")
                   (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (ROTATE, HImode, operands); DONE;")
 
 (define_insn "*rotlhi3_1"
        (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "")
                   (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (ROTATE, QImode, operands); DONE;")
 
 (define_insn "*rotlqi3_1"
        (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "")
                     (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_HIMODE_MATH"
   "ix86_expand_binary_operator (ROTATERT, HImode, operands); DONE;")
 
 (define_insn "*rotrhi3"
        (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "")
                     (match_operand:QI 2 "nonmemory_operand" "")))
    (clobber (reg:CC 17))]
-  ""
+  "TARGET_QIMODE_MATH"
   "ix86_expand_binary_operator (ROTATERT, QImode, operands); DONE;")
 
 (define_insn "*rotrqi3_1"
      expanding unless TARGET_INLINE_ALL_STRINGOPS.  */
 
   if (TARGET_UNROLL_STRLEN && eoschar == const0_rtx && optimize > 1
+      && !TARGET_INLINE_ALL_STRINGOPS
       && !optimize_size
       && (GET_CODE (align) != CONST_INT || INTVAL (align) < 4))
     FAIL;
        (if_then_else:HI (match_operand 1 "comparison_operator" "")
                         (match_operand:HI 2 "nonimmediate_operand" "")
                         (match_operand:HI 3 "nonimmediate_operand" "")))]
-  "TARGET_CMOVE"
+  "TARGET_CMOVE && TARGET_HIMODE_MATH"
   "if (!ix86_expand_int_movcc (operands)) FAIL; DONE;")
 
 (define_insn "*movhicc_noc"