This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[m68k,committed] implement with-cpu for m68k-linux, make longlong.h68060 clean
- From: Bernardo Innocenti <bernie at develer dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Zidlicky <rz at linux-m68k dot org>, Gunther Nikl <gni at gecko dot de>, Jim Wilson <wilson at specifixinc dot com>
- Date: Tue, 16 Mar 2004 05:16:33 +0100
- Subject: [m68k,committed] implement with-cpu for m68k-linux, make longlong.h68060 clean
- Organization: Develer S.r.l.
Hello,
I've installed this patch approved off-list by Jim Wilson.
The longlong.h bits needed some tweaks to apply cleanly on
mainline. This is what I've finally committed:
2004-03-16 Richard Zidlicky <rz@linux-m68k.org>
* config.gcc, config/m68k/linux.h: Implement with-cpu for m68k-linux.
* longlong.h: Make code 68060 clean when compiling for m68060.
diff -u -p -u -p -r1.41 linux.h
--- gcc/config/m68k/linux.h 9 Feb 2004 00:48:13 -0000 1.41
+++ gcc/config/m68k/linux.h 16 Mar 2004 04:08:15 -0000
@@ -23,8 +23,14 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (68k GNU/Linux with ELF)");
-/* 68020 with 68881 */
+/* Default target comes from config.gcc. */
+
+#undef TARGET_DEFAULT
+#ifdef TARGET_CPU_DEFAULT
+#define TARGET_DEFAULT TARGET_CPU_DEFAULT
+#else
#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
+#endif
/* for 68k machines this only needs to be TRUE for the 68000 */
diff -u -p -u -p -r1.440 config.gcc
--- gcc/config.gcc 10 Mar 2004 17:23:33 -0000 1.440
+++ gcc/config.gcc 16 Mar 2004 04:08:21 -0000
@@ -2302,6 +2302,20 @@ fi
esac
;;
+ m68k*-linux*)
+ supported_defaults="cpu"
+ case "$with_cpu" in
+ "" | "m68020" | "m68030" | "m68040" | "m68060" | "m68020-40" | "m68020-60")
+ # OK
+ ;;
+ *)
+ echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
+ echo "m68020 m68030 m68040 m68060 m68020-40 m68020-60" 1>&2
+ exit 1
+ ;;
+ esac
+ ;;
+
hppa*-*-* | parisc*-*-*)
supported_defaults="arch schedule"
@@ -2490,6 +2504,37 @@ fi
*)
target_cpu_default2="TARGET_CPU_$with_cpu"
+ ;;
+ esac
+ ;;
+
+ m68k*-linux*)
+ case "x$with_cpu" in
+ x)
+ # The most generic
+ target_cpu_default2="(MASK_68020|MASK_68881|MASK_BITFIELD)"
+ ;;
+ xm68020)
+ target_cpu_default2="(MASK_68020|MASK_68881|MASK_BITFIELD)"
+ ;;
+ xm68030)
+ target_cpu_default2="(MASK_68030|MASK_68020|MASK_68881|MASK_BITFIELD)"
+ ;;
+ xm68040)
+ target_cpu_default2="(MASK_68040|MASK_68040_ONLY|MASK_68020|MASK_68881|MASK_BITFIELD)"
+ ;;
+ xm68060)
+ target_cpu_default2="(MASK_68060|MASK_68040_ONLY|MASK_68020|MASK_68881|MASK_BITFIELD)"
+ ;;
+ xm68020-40)
+ target_cpu_default2="(MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040)"
+ ;;
+ xm68020-60)
+ target_cpu_default2="(MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040|MASK_68060)"
+ ;;
+ *)
+ echo "Unknown CPU used in --with-cpu=$with_cpu" 1>&2
+ exit 1
;;
esac
;;
diff -u -p -u -p -r1.42 longlong.h
--- gcc/longlong.h 3 Feb 2004 14:44:09 -0000 1.42
+++ gcc/longlong.h 16 Mar 2004 04:08:25 -0000
@@ -415,7 +415,7 @@ UDItype __umulsidi3 (USItype, USItype);
"g" ((USItype) (bl)))
/* The '020, '030, '040, '060 and CPU32 have 32x32->64 and 64/32->32q-32r. */
-#if defined (__mc68020__)
+#if (defined (__mc68020__) && !defined (__mc68060__))
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("mulu%.l %3,%1:%0" \
: "=d" ((USItype) (w0)), \
@@ -439,8 +439,8 @@ UDItype __umulsidi3 (USItype, USItype);
"1" ((USItype) (n1)), \
"dmi" ((USItype) (d)))
-#else /* not mc68020 */
-#if defined(__mcoldfire__)
+#elif defined (__mcoldfire__) /* not mc68020 */
+
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("| Inlined umul_ppmm\n" \
" move%.l %2,%/d0\n" \
@@ -511,12 +511,12 @@ UDItype __umulsidi3 (USItype, USItype);
: "d0", "d1", "d2", "d3", "d4")
#define UMUL_TIME 100
#define UDIV_TIME 400
-#endif /* not ColdFire */
+
#endif /* not mc68020 */
/* The '020, '030, '040 and '060 have bitfield insns.
cpu32 disguises as a 68020, but lacks them. */
-#if defined (__mc68020__) && !defined(__mcpu32__)
+#if defined (__mc68020__) && !defined (__mcpu32__)
#define count_leading_zeros(count, x) \
__asm__ ("bfffo %1{%b2:%b2},%0" \
: "=d" ((USItype) (count)) \
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/