[SPARC] Wrong mappings from target switches to names

Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Fri Jul 2 12:02:00 GMT 1999


When looking into a couple of testsuite failures on Solaris 7/64-bit SPARC

gcc.c-torture/execute/960512-1.c: In function `f':
gcc.c-torture/execute/960512-1.c:10: internal error--insn does not satisfy its constraints:
(insn 67 35 58 (set (reg:DF 10 %o2)
        (reg:DF 36 %f4)) 163 {*movdf_insn_sp64} (nil)
    (nil))

I noticed that the -mfpu switch (which is on in TARGET_CPU_DEFAULT) doesn't
show up in the listing of enabled options printed by toplev.c
(print_switch_values):

./xgcc -B./ -v -Q -c test.i
Reading specs from ./specs
gcc version gcc-2.95 19990623 (prerelease)
 ./cc1 test.i -version -o /var/tmp/ccTBjnM9.s
GNU C version gcc-2.95 19990623 (prerelease) (sparc-sun-solaris2.7) compiled by GNU C version gcc-2.95 19990623 (prerelease).
options passed: 
options enabled:  -fpeephole -ffunction-cse -fkeep-static-consts
 -fpcc-struct-return -fsched-interblock -fsched-spec -fcommon -fgnu-linker
 -fargument-alias -fident -mepilogue -mapp-regs

On the other hand, if some option sets MASK_FPU explicitly (and thus
MASK_FPU_SET), the reverse mapping from option values to names is broken:

./xgcc -B./ -v -Q -mfpu -c test.i
Reading specs from ./specs
gcc version gcc-2.95 19990623 (prerelease)
 ./cc1 test.i -mfpu -version -o /var/tmp/ccm6CHJQ.s
GNU C version gcc-2.95 19990623 (prerelease) (sparc-sun-solaris2.7) compiled by GNU C version gcc-2.95 19990623 (prerelease).
options passed:  -mfpu
options enabled:  -fpeephole -ffunction-cse -fkeep-static-consts
 -fpcc-struct-return -fsched-interblock -fsched-spec -fcommon -fgnu-linker
 -fargument-alias -fident -mfpu -mno-fpu -mhard-float -msoft-float
 -mepilogue -mapp-regs

i.e. both -mfpu/-mno-fpu and -mhard-float/-msoft-float are shown as
enabled.  This is clearly wrong and is fixed by the following patch.  The
same problem exists in rs6000.[ch], the only other port which seems to use
such a MASK_*_SET construct.

	Rainer


Fri Jul  2 20:00:58 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* sparc/sparc.c (sparc_override_options): Clear MASK_FPU_SET.
	* sparc/sparc.h (TARGET_SWITCHES): Add "fpu" entry for reverse
	mapping from MASK_FPU.
	
Index: sparc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/sparc/sparc.c,v
retrieving revision 1.69.4.1
diff -u -p -r1.69.4.1 sparc.c
--- sparc.c	1999/06/21 17:48:47	1.69.4.1
+++ sparc.c	1999/07/02 18:42:25
@@ -298,9 +298,13 @@ sparc_override_options ()
     }
 
   /* If -mfpu or -mno-fpu was explicitly used, don't override with
-     the processor default.  */
+     the processor default.  Clear MASK_FPU_SET to avoid confusing
+     the reverse mapping from switch values to names.  */
   if (TARGET_FPU_SET)
-    target_flags = (target_flags & ~MASK_FPU) | fpu;
+    {
+      target_flags = (target_flags & ~MASK_FPU) | fpu;
+      target_flags &= ~MASK_FPU_SET;
+    }
 
   /* Use the deprecated v8 insns for sparc64 in 32 bit mode.  */
   if (TARGET_V9 && TARGET_ARCH32)
Index: sparc.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/sparc/sparc.h,v
retrieving revision 1.64.4.3
diff -u -p -r1.64.4.3 sparc.h
--- sparc.h	1999/06/21 17:48:49	1.64.4.3
+++ sparc.h	1999/07/02 18:42:26
@@ -569,7 +569,8 @@ extern int target_flags;
    An empty string NAME is used to identify the default VALUE.  */
 
 #define TARGET_SWITCHES  \
-  { {"fpu", MASK_FPU | MASK_FPU_SET,			"Use hardware fp" },		\
+  { {"fpu", MASK_FPU,					"Use hardware fp" },		\
+    {"fpu", MASK_FPU | MASK_FPU_SET,			"Use hardware fp" },		\
     {"no-fpu", -MASK_FPU,				"Do not use hardware fp" },	\
     {"no-fpu", MASK_FPU_SET,				"Do not use hardware fp" },	\
     {"hard-float", MASK_FPU | MASK_FPU_SET,		"Use hardware fp" },		\


More information about the Gcc-patches mailing list