This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR target/10067 (Sparc)


Hi,

GCC emits incorrect assembly on all active branches for the attached 
testcase:

poog% gcc -c -O2 -m64 -mtune=supersparc ultrasp8.c
/usr/ccs/bin/as: "/var/tmp//ccPqXbAb.s", line 24: error: missing branch 
conditional code
/usr/ccs/bin/as: "/var/tmp//ccPqXbAb.s", line 24: error: statement syntax
/usr/ccs/bin/as: "/var/tmp//ccPqXbAb.s", line 46: error: missing branch 
conditional code
/usr/ccs/bin/as: "/var/tmp//ccPqXbAb.s", line 46: error: statement syntax

The problem is that GCC emits

	ba,pt,a	%xcc, .LL1

which is incorrect, the correct form being

	ba,a,pt	%xcc, .LL1

(GCC emits the correct form for the same testcase in other places, for 
example

	be,a,pn	%icc, .LL10

thanks for another code generation path, sparc.c:output_cbranch).


The bug didn't show up earlier because it triggers only in a corner case: 
when generating code for v9 using v8 scheduling.

The fix is trivial: swapping "%*" and ",pt" given that "%*" represents either 
"" or ",a". I compiled the patch on sparc-sun-solaris2.9 native, verified 
that the testcase assembles now fine and visually inspected the assembly 
file, which contains both the short form "ba,pt" and the long form 
"ba,a,pt'. Ok everywhere?

-- 
Eric Botcazou


2003-03-27  Eric Botcazou  <ebotcazou at libertysurf dot fr>

        PR target/10067
        * config/sparc/sparc.md (jump insn): Correct order
	when issuing the annuling marker.

2003-03-27  Eric Botcazou  <ebotcazou at libertysurf dot fr>

        * gcc.dg/ultrasp8.c: New test.
Index: config/sparc/sparc.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.md,v
retrieving revision 1.148.2.15.4.2
diff -u -r1.148.2.15.4.2 sparc.md
--- config/sparc/sparc.md	24 Mar 2003 10:29:48 -0000	1.148.2.15.4.2
+++ config/sparc/sparc.md	27 Mar 2003 09:20:58 -0000
@@ -7951,7 +7951,7 @@
 	  == INSN_ADDRESSES (INSN_UID (insn))))
     return \"b\\t%l0%#\";
   else
-    return TARGET_V9 ? \"ba,pt%*\\t%%xcc, %l0%(\" : \"b%*\\t%l0%(\";
+    return TARGET_V9 ? \"ba%*,pt\\t%%xcc, %l0%(\" : \"b%*\\t%l0%(\";
 }"
   [(set_attr "type" "uncond_branch")])
 
/* PR target/10067 */
/* Originator: <dat94ali at ludat dot lth dot se> */
/* { dg-do compile { target sparc-*-* } } */
/* { dg-options "-O2 -m64 -mtune=supersparc" } */

struct _reent;

extern unsigned long __malloc_trim_threshold;
extern unsigned long __malloc_top_pad;

int _mallopt_r(struct _reent *reent_ptr, int param_number, int value)
{
  __malloc_lock(reent_ptr);

  switch(param_number)
  {
    case -1:
      __malloc_trim_threshold = value;
      __malloc_unlock(reent_ptr);
      return 1;

    case -2:
      __malloc_top_pad = value;
      __malloc_unlock(reent_ptr);
      return 1;

    case -3:
      __malloc_unlock(reent_ptr);
      return 1;

    case -4:
      __malloc_unlock(reent_ptr);
      return value == 0;

    default:
      __malloc_unlock(reent_ptr);
      return 0;
  }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]