c4x.md (udivqi3, divqi3): Delete.
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>
Wed, 5 Jan 2000 22:38:12 +0000 (22:38 +0000)
committerMichael Hayes <m.hayes@gcc.gnu.org>
Wed, 5 Jan 2000 22:38:12 +0000 (22:38 +0000)
* config/c4x/c4x.md(udivqi3, divqi3): Delete.
(umodqi3, modqi3, udivhi3, divhi3, umodhi3, modhi3, ffsqi2): Likewise.
(*smulqi3_highpart_noclobber, *umulqi3_highpart_noclobber): New.
(*lshrqi3_const_noclobber, *lshrqi3_nonconst_noclobber): Likewise.
(*ashrqi3_const_noclobber, *ashrqi3_nonconst_noclobber): Likewise.

* c4x.h (INIT_TARGET_OPTABS): Define to init libcalls.

From-SVN: r31247

gcc/ChangeLog
gcc/config/c4x/c4x.h
gcc/config/c4x/c4x.md

index 4f8b02fcd2009b6db3986299b42a369b39757de1..5d6ea645d870b332135f14587ffed66b2a16b8bb 100644 (file)
@@ -1,3 +1,13 @@
+2000-01-06  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
+
+       * config/c4x/c4x.md(udivqi3, divqi3): Delete.
+       (umodqi3, modqi3, udivhi3, divhi3, umodhi3, modhi3, ffsqi2): Likewise.
+       (*smulqi3_highpart_noclobber, *umulqi3_highpart_noclobber): New.
+       (*lshrqi3_const_noclobber, *lshrqi3_nonconst_noclobber): Likewise.
+       (*ashrqi3_const_noclobber, *ashrqi3_nonconst_noclobber): Likewise.
+
+       * c4x.h (INIT_TARGET_OPTABS): Define to init libcalls.
+
 2000-01-05 11:25 -0800  Zack Weinberg  <zack@rabi.columbia.edu>
 
        * c-decl.c (finish_enum): Simplify code to determine minimum and
index d0e876bc4f129327dc165ede8b3e48d573dbb5c8..b8d11fde5a4044abf52274d4c12a8e7e06e47549 100644 (file)
 
 extern int target_flags;
 
-#define TARGET_INLINE          1 /* Inline MPYI.  */
+#define TARGET_INLINE          (! optimize_size) /* Inline MPYI.  */
 #define TARGET_PARALLEL                1 /* Enable parallel insns in MD.  */
 #define TARGET_SMALL_REG_CLASS 0
 
@@ -1445,6 +1445,39 @@ CUMULATIVE_ARGS;
 
 #define FFS_LIBCALL        "__ffs"
 
+
+#define INIT_TARGET_OPTABS \
+  do { \
+    smul_optab->handlers[(int) QImode].libfunc         \
+      = init_one_libfunc (MULQI3_LIBCALL);             \
+    sdiv_optab->handlers[(int) QImode].libfunc         \
+      = init_one_libfunc (DIVQI3_LIBCALL);             \
+    udiv_optab->handlers[(int) QImode].libfunc         \
+      = init_one_libfunc (UDIVQI3_LIBCALL);            \
+    smod_optab->handlers[(int) QImode].libfunc         \
+      = init_one_libfunc (MODQI3_LIBCALL);             \
+    umod_optab->handlers[(int) QImode].libfunc         \
+      = init_one_libfunc (UMODQI3_LIBCALL);            \
+    flodiv_optab->handlers[(int) QFmode].libfunc       \
+      = init_one_libfunc (DIVQF3_LIBCALL);             \
+    smul_optab->handlers[(int) HFmode].libfunc         \
+      = init_one_libfunc (MULHF3_LIBCALL);             \
+    flodiv_optab->handlers[(int) HFmode].libfunc       \
+      = init_one_libfunc (DIVHF3_LIBCALL);             \
+    smul_optab->handlers[(int) HImode].libfunc         \
+      = init_one_libfunc (MULHI3_LIBCALL);             \
+    sdiv_optab->handlers[(int) HImode].libfunc         \
+      = init_one_libfunc (DIVHI3_LIBCALL);             \
+    udiv_optab->handlers[(int) HImode].libfunc         \
+      = init_one_libfunc (UDIVHI3_LIBCALL);            \
+    smod_optab->handlers[(int) HImode].libfunc         \
+      = init_one_libfunc (MODHI3_LIBCALL);             \
+    umod_optab->handlers[(int) HImode].libfunc         \
+      = init_one_libfunc (UMODHI3_LIBCALL);            \
+    ffs_optab->handlers[(int) QImode].libfunc          \
+      = init_one_libfunc (FFS_LIBCALL);                        \
+  } while (0)
+
 #define TARGET_MEM_FUNCTIONS
 
 /* Add any extra modes needed to represent the condition code.
index 8a3189eafdec7845ecdaef8fb7a938639447fc96..7d32cc6994f26e737fb12972692fcd315408d5fe 100644 (file)
   "*
    if (IS_STD_REG (operands[0]))
      {
-       if (which_alternative == 0)
+       if (which_alternative == 0 || which_alternative == 3)
         return \"addi\\t%2,%0\";
        else
         return \"addi3\\t%2,%1,%0\";
      }
    else
      {
-       if (which_alternative == 0)
+       if (which_alternative == 0 || which_alternative == 3)
         return \"push\\tst\\n\\taddi\\t%2,%0\\n\\tpop\\tst\";
        else
         return \"push\\tst\\n\\taddi3\\t%2,%1,%0\\n\\tpop\\tst\";
   [(set_attr "type" "binarycc,binarycc,binarycc,binary,binary,binary")
    (set_attr "data" "int16,int16,int16,int16,int16,int16")])
 
+(define_insn "*smulqi3_highpart_noclobber"
+  [(set (match_operand:QI 0 "std_reg_operand" "=c,c,?c")
+        (truncate:QI 
+         (lshiftrt:HI
+          (mult:HI
+           (sign_extend:HI (match_operand:QI 1 "src_operand" "0,rR,rS<>"))
+           (sign_extend:HI (match_operand:QI 2 "src_operand" "rIm,JR,rS<>")))
+      (const_int 32))))]
+  "! TARGET_C3X && valid_operands (MULT, operands, QImode)"
+  "@
+   mpyshi\\t%2,%0
+   mpyshi3\\t%2,%1,%0
+   mpyshi3\\t%2,%1,%0"
+  [(set_attr "type" "binary,binary,binary")
+   (set_attr "data" "int16,int16,int16")])
+
 ;
 ; MPYUHI (C4x only)
 ;
   [(set_attr "type" "binarycc,binarycc,binarycc,binary,binary,binary")
    (set_attr "data" "uint16,uint16,uint16,uint16,uint16,uint16")])
 
+(define_insn "*umulqi3_highpart_noclobber"
+  [(set (match_operand:QI 0 "std_reg_operand" "=c,c,?c")
+        (truncate:QI
+         (lshiftrt:HI
+          (mult:HI 
+           (zero_extend:HI (match_operand:QI 1 "src_operand" "0,rR,rS<>"))
+           (zero_extend:HI (match_operand:QI 2 "lsrc_operand" "rLm,JR,rS<>")))
+          (const_int 32))))]
+  "! TARGET_C3X && valid_operands (MULT, operands, QImode)"
+  "@
+   mpyuhi\\t%2,%0
+   mpyuhi3\\t%2,%1,%0
+   mpyuhi3\\t%2,%1,%0"
+  [(set_attr "type" "binary,binary,binary")
+   (set_attr "data" "uint16,uint16,uint16")])
+
 ;
 ; AND
 ;
    lsh\\t%n2,%0
    lsh3\\t%n2,%1,%0
    lsh3\\t%n2,%1,%0"
-  [(set_attr "type" "binarycc,binarycc,binarycc,binarycc")])
+  [(set_attr "type" "binarycc,binary,binarycc,binary")])
+
+(define_insn "*lshrqi3_const_noclobber"
+  [(set (match_operand:QI 0 "std_reg_operand" "=c,?c")
+        (lshiftrt:QI (match_operand:QI 1 "src_operand" "0,r")
+                     (match_operand:QI 2 "const_int_operand" "n,J")))]
+  "valid_operands (LSHIFTRT, operands, QImode)"
+  "@
+   lsh\\t%n2,%0
+   lsh3\\t%n2,%1,%0"
+  [(set_attr "type" "binary,binary")])
 
 ; When the shift count is greater than the size of the word
 ; the result can be implementation specific
   [(set_attr "type" "binarycc,binarycc,binarycc,binary,binary,binary")])
 ; Default to int16 data attr.
 
+(define_insn "*lshrqi3_nonconst_noclobber"
+  [(set (match_operand:QI 0 "std_reg_operand" "=c,c,?c")
+        (lshiftrt:QI (match_operand:QI 1 "src_operand" "0,rR,rS<>")
+                     (neg:QI (match_operand:QI 2 "src_operand" "rm,R,rS<>"))))]
+  "valid_operands (LSHIFTRT, operands, QImode)"
+  "@
+   lsh\\t%2,%0
+   lsh3\\t%2,%1,%0
+   lsh3\\t%2,%1,%0"
+  [(set_attr "type" "binary,binary,binary")])
+; Default to int16 data attr.
+
 ;
 ; ASH (right)
 ;
    ash\\t%n2,%0
    ash3\\t%n2,%1,%0
    ash3\\t%n2,%1,%0"
-  [(set_attr "type" "binarycc,binarycc,binarycc,binarycc")])
+  [(set_attr "type" "binarycc,binary,binarycc,binary")])
+
+(define_insn "*ashrqi3_const_noclobber"
+  [(set (match_operand:QI 0 "std_reg_operand" "=c,?c")
+        (ashiftrt:QI (match_operand:QI 1 "src_operand" "0,r")
+                     (match_operand:QI 2 "const_int_operand" "n,J")))]
+  "valid_operands (ASHIFTRT, operands, QImode)"
+  "@
+   ash\\t%n2,%0
+   ash3\\t%n2,%1,%0"
+  [(set_attr "type" "binarycc,binarycc")])
 
 ; When the shift count is greater than the size of the word
 ; the result can be implementation specific
   [(set_attr "type" "binarycc,binarycc,binarycc,binary,binary,binary")])
 ; Default to int16 data attr.
 
+(define_insn "*ashrqi3_nonconst_noclobber"
+  [(set (match_operand:QI 0 "std_reg_operand" "=c,c,?c")
+        (ashiftrt:QI (match_operand:QI 1 "src_operand" "0,rR,rS<>")
+                     (neg:QI (match_operand:QI 2 "src_operand" "rm,R,rS<>"))))]
+  "valid_operands (ASHIFTRT, operands, QImode)"
+  "@
+   ash\\t%2,%0
+   ash3\\t%2,%1,%0
+   ash3\\t%2,%1,%0"
+  [(set_attr "type" "binary,binary,binary")])
+; Default to int16 data attr.
+
 ;
 ; CMPI
 ;
    cmpi3\\t%1,%0"
   [(set_attr "type" "compare,compare,compare")])
 
-(define_expand "udivqi3"
-  [(parallel [(set (match_operand:QI 0 "reg_operand" "")
-                   (udiv:QI (match_operand:QI 1 "src_operand" "")
-                            (match_operand:QI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (UDIVQI3_LIBCALL, UDIV, QImode, operands);
-   DONE;")
-
-(define_expand "divqi3"
-  [(parallel [(set (match_operand:QI 0 "reg_operand" "")
-                   (div:QI (match_operand:QI 1 "src_operand" "")
-                            (match_operand:QI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (DIVQI3_LIBCALL, DIV, QImode, operands);
-   DONE;")
-
-(define_expand "umodqi3"
-  [(parallel [(set (match_operand:QI 0 "reg_operand" "")
-                   (umod:QI (match_operand:QI 1 "src_operand" "")
-                            (match_operand:QI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (UMODQI3_LIBCALL, UMOD, QImode, operands);
-   DONE;")
-
-(define_expand "modqi3"
-  [(parallel [(set (match_operand:QI 0 "reg_operand" "")
-                   (mod:QI (match_operand:QI 1 "src_operand" "")
-                           (match_operand:QI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (MODQI3_LIBCALL, MOD, QImode, operands);
-   DONE;")
-
-(define_expand "ffsqi2"
-  [(parallel [(set (match_operand:QI 0 "reg_operand" "")
-                   (ffs:QI (match_operand:QI 1 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall (FFS_LIBCALL, FFS, QImode, QImode, 2, operands);
-   DONE;")
 
 ;
 ; BIT-FIELD INSTRUCTIONS
   [(parallel [(set (match_operand:QF 0 "reg_operand" "")
                    (sqrt:QF (match_operand:QF 1 "src_operand" "")))
               (clobber (reg:CC 21))])]
-  ""
-  "if (TARGET_C3X || ! TARGET_INLINE)
-     FAIL;
-   else
-     {
-       emit_insn (gen_sqrtqf2_inline (operands[0], operands[1]));
-       DONE;
-     }
-  ")
+  "! TARGET_C3X && TARGET_INLINE"
+  "emit_insn (gen_sqrtqf2_inline (operands[0], operands[1]));
+   DONE;")
 
 ;
 ; THREE OPERAND FLOAT INSTRUCTIONS
                    (div:QF (match_operand:QF 1 "src_operand" "")
                             (match_operand:QF 2 "src_operand" "")))
               (clobber (reg:CC 21))])]
-  ""
-  "if (TARGET_C3X || ! TARGET_INLINE)
-     {
-       c4x_emit_libcall3 (DIVQF3_LIBCALL, DIV, QFmode, operands);
-       DONE;
-     }
-   else
-     {
-       emit_insn (gen_divqf3_inline (operands[0], operands[1], operands[2]));
-       DONE;
-     }
-  ")
+  "! TARGET_C3X && TARGET_INLINE"
+  "emit_insn (gen_divqf3_inline (operands[0], operands[1], operands[2]));
+   DONE;")
 
 ;
 ; CONDITIONAL MOVES
   [(parallel [(set (match_operand:HF 0 "reg_operand" "")
                    (sqrt:HF (match_operand:HF 1 "reg_operand" "")))
               (clobber (reg:CC 21))])]
-  ""
-  "if (TARGET_C3X || ! TARGET_INLINE)
-     FAIL;
-   else
-     {
-       emit_insn (gen_sqrthf2_inline (operands[0], operands[1]));
-       DONE;
-     }
-  ")
+  "! TARGET_C3X && TARGET_INLINE"
+  "emit_insn (gen_sqrthf2_inline (operands[0], operands[1]));
+   DONE;")
+
 
 (define_expand "fix_trunchfhi2"
   [(parallel [(set (match_operand:HI 0 "reg_operand" "")
                    (mult:HF (match_operand:HF 1 "reg_operand" "h")
                             (match_operand:HF 2 "reg_operand" "h")))
               (clobber (reg:CC_NOOV 21))])]
-  ""
-  "if (TARGET_C3X)
-     {
-       c4x_emit_libcall3 (MULHF3_LIBCALL, MULT, HFmode, operands);
-       DONE;
-     }
-  ")
+  "! TARGET_C3X"
+  "")
 
 (define_insn "*mulhf3_c40"
   [(set (match_operand:HF 0 "reg_operand" "=h,?h")
                    (div:HF (match_operand:HF 1 "reg_operand" "")
                            (match_operand:HF 2 "reg_operand" "")))
               (clobber (reg:CC 21))])]
-  ""
-  "if (TARGET_C3X || ! TARGET_INLINE)
-     {
-       c4x_emit_libcall3 (DIVHF3_LIBCALL, DIV, HFmode, operands);
-       DONE;
-     }
-   else
-     {
-       emit_insn (gen_divhf3_inline (operands[0], operands[1], operands[2]));
-       DONE;
-     }
-  ")
+  "! TARGET_C3X && TARGET_INLINE"
+  "emit_insn (gen_divhf3_inline (operands[0], operands[1], operands[2]));
+   DONE;")
 
 
 ;
   "c4x_emit_libcall3 (MULHI3_LIBCALL, MULT, HImode, operands);
    DONE;")
 
-(define_expand "udivhi3"
-  [(parallel [(set (match_operand:HI 0 "reg_operand" "")
-                   (udiv:HI (match_operand:HI 1 "src_operand" "")
-                            (match_operand:HI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (UDIVHI3_LIBCALL, UDIV, HImode, operands);
-   DONE;")
-
-(define_expand "divhi3"
-  [(parallel [(set (match_operand:HI 0 "reg_operand" "")
-                   (div:HI (match_operand:HI 1 "src_operand" "")
-                            (match_operand:HI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (DIVHI3_LIBCALL, DIV, HImode, operands);
-   DONE;")
-
-(define_expand "umodhi3"
-  [(parallel [(set (match_operand:HI 0 "reg_operand" "")
-                   (umod:HI (match_operand:HI 1 "src_operand" "")
-                            (match_operand:HI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (UMODHI3_LIBCALL, UMOD, HImode, operands);
-   DONE;")
-
-(define_expand "modhi3"
-  [(parallel [(set (match_operand:HI 0 "reg_operand" "")
-                   (mod:HI (match_operand:HI 1 "src_operand" "")
-                            (match_operand:HI 2 "src_operand" "")))
-              (clobber (reg:CC 21))])]
-  ""
-  "c4x_emit_libcall3 (MODHI3_LIBCALL, MOD, HImode, operands);
-   DONE;")
 
 ;
 ; PEEPHOLES