------- Comment #4 from mikpe at it dot uu dot se  2010-06-11 21:27 -------
The bug is easily observed with a cross to sparc64-linux, using e.g. the
task-2.c test case in libgomp's libgomp.c test suite.

Diffing the -S output of 4.6-20100605 vanilla (bad) with the same where r160260
has been reverted (ok), we see:

--- task-2.s-bad        2010-06-11 22:45:02.000000000 +0200
+++ task-2.s-ok 2010-06-11 22:51:56.000000000 +0200
@@ -5,20 +5,21 @@
        .proc   020
 f2._omp_fn.1:
        .register       %g2, #scratch
+       .register       %g3, #scratch
        add     %sp, -192, %sp
        lduw    [%o0+12], %g1
        st      %g1, [%sp+2235]
        lduw    [%o0+8], %g2
        cmp     %g2, 10
        bne,pt  %icc, .LL7
-        nop
+        add    %sp, 2235, %g3
        ba,pt   %xcc, .LL9
         sub    %sp, -192, %sp
 .LL5:
 .LL7:
        membar  15
        add     %g1, 1, %g2
-       cas     [%sp+2235], %g1, %g2
+       cas     [%g3], %g1, %g2
        cmp     %g1, %g2
        bne,pt  %icc, .LL5
         mov    %g2, %g1

So what r160260 did was to replace [%g3] in the cas instruction with
[%sp+2235], which doesn't work because cas cannot use [reg+offset] addressing
modes, it only accepts [reg] addressing modes.

Attempting to assemble these files confirms:
> sparc64-unknown-linux-as task-2.s-ok
> sparc64-unknown-linux-as task-2.s-bad 
task-2.s-bad: Assembler messages:
task-2.s-bad:21: Error: Illegal operands
task-2.s-bad:48: Error: Illegal operands

To compile task-2.c I used sparc64-unknown-linux-gcc -mcpu=v9
-fmessage-length=0 -fopenmp -O2 -S task-2.c (the -mcpu=v9 may be redundant, but
that's what the libgomp test suite did on the actual sparc64 box).

My sparc64 cross is configured simply with --target=sparc64-unknown-linux
--enable-languages=c.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44484

Reply via email to