[PATCH 0/7] Sparc atomic optabs errata

David Miller davem@davemloft.net
Tue Nov 22 09:48:00 GMT 2011


From: Richard Henderson <rth@redhat.com>
Date: Thu, 17 Nov 2011 11:22:53 -1000

> Full sparc64-linux testing still underway; I've pushed these two
> patches to the git branch previously mentioned.

Hey Richard, after the ICE fix you made today the only test that
fails is gcc.dg/atomic-flag.c at -O0.  Below is the assembler
generated.

That "xor" with '1' and then test using the 0xff mask looks
suspicious.

	.common	a,1,1
	.section	".text"
	.align 4
	.global main
	.type	main, #function
	.proc	04
main:
	save	%sp, -104, %sp
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g1
	stb	%g0, [%g1]
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g1
	ldub	[%g1], %g1
	and	%g1, 0xff, %g1
	cmp	%g1, 0
	be	%icc, .L2
	 nop
	call	abort, 0
	 nop
.L2:
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g2
	membar	15
	membar	15
	ldstub	[%g2], %g1
	stb	%g1, [%fp-1]
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g1
	ldub	[%g1], %g1
	xor	%g1, 1, %g1
	and	%g1, 0xff, %g1
	cmp	%g1, 0
	bne	%icc, .L3
	 nop
	ldub	[%fp-1], %g1
	and	%g1, 0xff, %g1
	cmp	%g1, 0
	be	%icc, .L4
	 nop
.L3:
	call	abort, 0
	 nop
.L4:
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g2
	membar	15
	membar	15
	ldstub	[%g2], %g1
	stb	%g1, [%fp-1]
	ldub	[%fp-1], %g1
	xor	%g1, 1, %g1
	and	%g1, 0xff, %g1
	cmp	%g1, 0
	bne	%icc, .L5
	 nop
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g1
	ldub	[%g1], %g1
	xor	%g1, 1, %g1
	and	%g1, 0xff, %g1
	cmp	%g1, 0
	be	%icc, .L6
	 nop
.L5:
	call	abort, 0
	 nop
.L6:
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g1
	membar	15
	stb	%g0, [%g1]
	membar	15
	sethi	%hi(a), %g1
	or	%g1, %lo(a), %g1
	ldub	[%g1], %g1
	and	%g1, 0xff, %g1
	cmp	%g1, 0
	be	%icc, .L7
	 nop
	call	abort, 0
	 nop
.L7:
	mov	0, %g1
	mov	%g1, %i0
	return	%i7+8
	 nop
	.size	main, .-main
	.ident	"GCC: (GNU) 4.7.0 20111121 (experimental)"
	.section	.note.GNU-stack,"",@progbits



More information about the Gcc-patches mailing list