[Bug target/58623] lack of ldp/stp optimization

ramana at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 11 12:10:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58623

--- Comment #4 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
(In reply to bin.cheng from comment #3)
> Patch sent at https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02209.html
> On latest trunk, the patch generates below assembly for the example:
> 
> 	.cpu generic+fp+simd
> 	.file	"pr58623.c"
> 	.text
> 	.align	2
> 	.global	foo
> 	.type	foo, %function
> foo:
> 	adrp	x0, .LANCHOR0
> 	add	x2, x0, :lo12:.LANCHOR0
> 	ldr	x1, [x0, #:lo12:.LANCHOR0]
> 	ldr	x0, [x2, 8]
> 	add	w0, w1, w0
> 	ret
> 	.size	foo, .-foo
> 	.align	2
> 	.global	bar
> 	.type	bar, %function
> bar:
> 	adrp	x1, .LANCHOR0
> 	add	x1, x1, :lo12:.LANCHOR0
> 	ldp	w2, w0, [x1, 16]
> 	add	w0, w2, w0
> 	ret
> 	.size	bar, .-bar
> 	.global	d
> 	.global	c
> 	.global	b
> 	.global	a
> 	.bss
> 	.align	3
> .LANCHOR0 = . + 0
> 	.type	a, %object
> 	.size	a, 8
> a:
> 	.zero	8
> 	.type	b, %object
> 	.size	b, 8
> b:
> 	.zero	8
> 	.type	c, %object
> 	.size	c, 4
> c:
> 	.zero	4
> 	.type	d, %object
> 	.size	d, 4
> d:
> 	.zero	4
> 	.ident	"GCC: (GNU) 5.0.0 20141118 (experimental)"
> 
> ldp opportunity in bar is captured, but not the one in foo.  Apparently,
> fwprop pass propagates the expression into memory reference, corrupting the
> pair opportunity.  This is another known issue for long time.

So I think we should take the fwprop issue as a separate bug and close this out
for 5.0 as the main work required to generate ldp / stp in the compiler is now
done.


More information about the Gcc-bugs mailing list