This is the mail archive of the gcc-bugs@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]

[Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC


Hello,

I got some problems with the SPE-extensions. Quite a severe as I think.

For
        float t;
        char u;

        t = 1.0;
        u = ( ( t<0.0)?-1:((t>0.0)?1:0));

with the following compiler flags

-mcpu=8540 -meabi -mspe=yes -mabi=spe -mfloat-gprs=yes
-fsingle-precision-constant -fshort-double -mno-sdata -c -g -D__EMB_RPE__

the result for u is either -1 if t < 0.0 or 0 else. The case if t > 0.0 is
never taken. My diab shows correct results. 

Generated assembler:

        t = 1.0;

lis       r0,0x3F80 
stw       r0,0x1EC(r31)

        u = ( ( t<0.0)?-1:((t>0.0)?1:0));

lwz       r9,0x1EC(r31)
li        r0,0x0
efscmplt  cr7,r9,r0 
bgt       cr7,0x39F04
b         0x39F10
li        r0,-0x1
stb       r0,0x1F1(r31)
b         0x39F28
lwz       r9,0x1EC(r31)
li        r0,0x0 
efscmpgt  cr7,r9,r0
mfcr      r0
extrwi    r0,r0,0x1,0x1E ; r0,r0,1,30
stb       r0,0x1F1(r31)
lbz       r0,0x1F1(r31)
stb       r0,0x1F0(r31)

Looking in the e500-core-manual it shows that the GT-compare-result is stored
in bit 61 of CR. I suppose in this case the extrwi (or rlwinm-Instruction in
case of objdump) should check for bit 29 (=61-32), which is not the case.

Sincery yours,
Christian Metzler.


-- 
           Summary: Wrong code generated with SPE-Extensions on PowerPC
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: christian dot metzler at bmw-carit dot de
  GCC host triplet: i686-pc-cygwin
GCC target triplet: powerpc-unknown-eabi


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


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