sparc.c (INIT_TARGET_OPTABS): If ARCH64, set the 32-bit ABI libfuncs to NULL.
authorDavid S. Miller <davem@redhat.com>
Mon, 24 Jun 2002 10:08:38 +0000 (03:08 -0700)
committerDavid S. Miller <davem@gcc.gnu.org>
Mon, 24 Jun 2002 10:08:38 +0000 (03:08 -0700)
2002-06-24  David S. Miller  <davem@redhat.com>

* config/sparc/sparc.c (INIT_TARGET_OPTABS): If ARCH64, set the
32-bit ABI libfuncs to NULL.

* expmed.c (expand_divmod): Do not set optab1/optab2 to the shift
optabs if op1 is const0_rtx.

From-SVN: r54950

gcc/ChangeLog
gcc/config/sparc/sparc.h
gcc/expmed.c

index 717dcb0858109a8565871f42fecc32244b27afc5..f3cdecc9a9e4a39fbe2ce5e36e85c6654e01974b 100644 (file)
@@ -1,3 +1,11 @@
+2002-06-24  David S. Miller  <davem@redhat.com>
+
+       * config/sparc/sparc.c (INIT_TARGET_OPTABS): If ARCH64, set the
+       32-bit ABI libfuncs to NULL.
+
+       * expmed.c (expand_divmod): Do not set optab1/optab2 to the shift
+       optabs if op1 is const0_rtx.
+
 2002-06-24  Neil Booth  <neil@daikokuya.co.uk>
 
        * cpptrad.c (scan_out_logical_line): Check recursing only when
index cb556a31ac7d2cf8a4b0b8476cda3e938085f5cc..97f1a2d260679c3659f923209777c5ae5b71796f 100644 (file)
@@ -2585,6 +2585,17 @@ do {                                                                    \
          sqrt_optab->handlers[(int) TFmode].libfunc                    \
            = init_one_libfunc ("_Q_sqrt");                             \
       }                                                                        \
+    if (TARGET_ARCH64)                                                 \
+      {                                                                        \
+        /* In the SPARC 64bit ABI, these libfuncs do not exist in the  \
+           library.  Make sure the compiler does not emit calls to them        \
+          by accident.  */                                             \
+       sdiv_optab->handlers[(int) SImode].libfunc = NULL;              \
+       udiv_optab->handlers[(int) SImode].libfunc = NULL;              \
+       smod_optab->handlers[(int) SImode].libfunc = NULL;              \
+       umod_optab->handlers[(int) SImode].libfunc = NULL;              \
+        smul_optab->handlers[(int) SImode].libfunc = NULL;             \
+      }                                                                        \
     INIT_SUBTARGET_OPTABS;                                             \
   } while (0)
 
index 8ef4fca585f96dcce5ac9e6d195088268bcf6d51..317dcc4ab540499e8b0f2526377a8b0c5ec1bb61 100644 (file)
@@ -3049,9 +3049,12 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
      not straightforward to generalize this.  Maybe we should make an array
      of possible modes in init_expmed?  Save this for GCC 2.7.  */
 
-  optab1 = (op1_is_pow2 ? (unsignedp ? lshr_optab : ashr_optab)
+  optab1 = ((op1_is_pow2 && op1 != const0_rtx)
+           ? (unsignedp ? lshr_optab : ashr_optab)
            : (unsignedp ? udiv_optab : sdiv_optab));
-  optab2 = (op1_is_pow2 ? optab1 : (unsignedp ? udivmod_optab : sdivmod_optab));
+  optab2 = ((op1_is_pow2 && op1 != const0_rtx)
+           ? optab1
+           : (unsignedp ? udivmod_optab : sdivmod_optab));
 
   for (compute_mode = mode; compute_mode != VOIDmode;
        compute_mode = GET_MODE_WIDER_MODE (compute_mode))