public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/8553: AltiVec vec_abs broken at -O0 with register keyword
@ 2002-11-19 18:06 hartwood
  0 siblings, 0 replies; 2+ messages in thread
From: hartwood @ 2002-11-19 18:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8553
>Category:       other
>Synopsis:       AltiVec vec_abs broken at -O0 with register keyword
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 12 11:36:05 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Rick Cellucci
>Release:        gcc version 3.3 20021104 (experimental)
>Organization:
>Environment:
Configured with: ../gcc3.3/configure --prefix=/usr/local/darwin --enable-altivec --enable-languages=c --with-cpu=7400 --target=powerpc-apple-darwin6.1
>Description:
With no optimization, specifying a register vector variable will stomp on the temporary registers used by the vec_abs function, which actually generates 3 vector instructions.
>How-To-Repeat:
void VecAbsIsBroken (short *image)
/* gcc3.3 broken at -O0, works at -O1 and above, remove register keyword to fix */
{
	short *p;
	register vector signed short v;
	
	p = image;
	v = vec_ld (0, p);
	v = vec_abs (v);
	
	printf ("%p %hd: ", p, *p);
	PrintShortVector (v); printf ("\n");
}
/*

_VecAbsIsBroken:
L_VecAbsIsBroken$stub: 
        mfspr r12,256
        stw r12,-12(r1)
        oris r12,r12,0xdfff
        ori r12,r12,61440
        mtspr 256,r12
        mflr r0
        stw r30,-8(r1)
        stw r31,-4(r1)
        stw r0,8(r1)
        stwu r1,-96(r1)
        mr r30,r1      
        bcl 20,31,L4$pb 
L4$pb:
        mflr r31      
        stw r3,120(r30)
        lwz r0,120(r30)
        stw r0,56(r30)
        li r11,0       
        lwz r9,56(r30)
        lvx v0,r11,r9
        addi r9,r30,64
        stvx v0,0,r9
        addi r9,r30,64
        lvx v1,0,r9             By loading v1 with the input to vec_abs, we doom it to fail
        
        vspltisb v1,0           v1 should NOT be used as a temporary register here
        vsubuhm v13,v1,v1       This just zeroed out v13, not good!
        vmaxsh v0,v1,v13        So we end up with 0s!
        
        addi r9,r30,64
        stvx v0,0,r9
*/
>Fix:
Workaround: Use higher optimization levels. Still, without optimization the code should be generated correctly.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: other/8553: AltiVec vec_abs broken at -O0 with register keyword
@ 2002-12-19 12:02 aldyh
  0 siblings, 0 replies; 2+ messages in thread
From: aldyh @ 2002-12-19 12:02 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, hartwood, nobody

Synopsis: AltiVec vec_abs broken at -O0 with register keyword

State-Changed-From-To: open->closed
State-Changed-By: aldyh
State-Changed-When: Thu Dec 19 12:02:37 2002
State-Changed-Why:
    fixed

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8553


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-19 20:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-19 18:06 other/8553: AltiVec vec_abs broken at -O0 with register keyword hartwood
2002-12-19 12:02 aldyh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).