[Bug optimization/15016] New: '-mcpu=ultrasparc3' doesn't create US-III code
gcc-bugzilla at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Apr 20 01:17:00 GMT 2004
The new "ultrasparc3" compiler flag doesn't actually build 'us3' code.
Rather, it just builds generic SPARCV8PLUS or SPARCV9.
As seen above, this was built with the Sun assembler, /usr/ccs/bin/as,
rather than the GNU assembler.
When building code with the flag '-mcpu=ultrasparc', gcc 3.3.3 sends
a flag to the assembler, '-xarch=v8plusa' or '-xarch=v9a', that tells
the assmebler to build code requiring the UltraSPARC extensions.
Similarly, the relatively new '-mcpu=ultrasparc3' flag SHOULD send
the '-xarch=v8plusb' or '-xarch=v9b' flag. It doesn't. Instead,
it sends the '-xarch=v8plus' or '-xarch=v9' flag.
This results in generic SPARCV9 code, rather than UltraSPARC III code.
Environment:
System: SunOS jplis-jmp-001 5.10 s10_54 sun4u sparc SUNW,Sun-Fire-V240
Architecture: sun4
host: sparc-sun-solaris2.10
build: sparc-sun-solaris2.10
target: sparc-sun-solaris2.10
configured with: /usr/local/build/gnu/gcc-3.3.3/configure --with-ld=/usr/ccs/bin/ld --with-as=/usr/ccs/bin/as --disable-shared --disable-nls --enable-threads=posix --with-system-zlib
How-To-Repeat:
E.g.:
# Ultrasparc:
% gcc -v -m64 -mcpu=ultrasparc -o hw hw.c |& grep /usr/ccs/bin/as
/usr/ccs/bin/as -V -Qy -s -xarch=v9a -o /tmp/cc0tc2ad.o /tmp/cc7UNxCC.s
# Ultrasparc III:
% gcc -v -m64 -mcpu=ultrasparc3 -o hw hw.c |& grep /usr/ccs/bin/as
/usr/ccs/bin/as -V -Qy -s -xarch=v9 -o /tmp/ccgc16C7.o /tmp/ccH9daQ4.s
^^^^^^^^^
That SHOULD be '-xarch=v9b'.
------- Additional Comments From root at jplis-jmp-001 dot jpl dot nasa dot gov 2004-04-20 00:07 -------
Fix:
The diffs below add US-III definitions like the standard UltraSPARC
definitions. If you really don't want to rebuild the compiler, it's
also possible (but probably not advised) to edit:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.x/3.3.3/specs
and add the proper entries for US-III.
gcc/config/sparc/sol2-bi.h:
--- sparc/sol2-bi.h Thu Dec 18 12:12:49 2003
+++ sparc/sol2-bi.h.new Mon Apr 19 15:50:56 2004
@@ -26,6 +26,14 @@
#undef ASM_CPU64_DEFAULT_SPEC
#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "a"
#endif
+#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
+#undef CPP_CPU64_DEFAULT_SPEC
+#define CPP_CPU64_DEFAULT_SPEC ""
+#undef ASM_CPU32_DEFAULT_SPEC
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
+#endif
#if DEFAULT_ARCH32_P
#define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
@@ -51,6 +59,7 @@
#undef ASM_CPU_SPEC
#define ASM_CPU_SPEC "\
+%{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}} \
gcc/config/sparc/sol2.h:
--- sparc/sol2.h Sun Sep 15 05:03:42 2002
+++ sparc/sol2.h.new Mon Apr 19 15:51:44 2004
@@ -39,11 +39,17 @@
#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa"
#endif
+#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
+#undef ASM_CPU_DEFAULT_SPEC
+#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
+#endif
+
#undef ASM_CPU_SPEC
#define ASM_CPU_SPEC "\
%{mcpu=v8plus:-xarch=v8plus} \
%{mcpu=v9:-xarch=v8plus} \
%{mcpu=ultrasparc:-xarch=v8plusa} \
+%{mcpu=ultrasparc3:-xarch=v8plusb} \
%{!mcpu*:%(asm_cpu_default)} \
"
--
Summary: '-mcpu=ultrasparc3' doesn't create US-III code
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: root at jplis-jmp-001 dot jpl dot nasa dot gov
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: sparc-sun-solaris2.10
GCC host triplet: sparc-sun-solaris2.10
GCC target triplet: sparc-sun-solaris2.10
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15016
More information about the Gcc-bugs
mailing list