public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26398]  New: Wrong code generated with SPE-Extensions on PowerPC
@ 2006-02-21 16:23 christian dot metzler at bmw-carit dot de
  2006-02-21 16:32 ` [Bug target/26398] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: christian dot metzler at bmw-carit dot de @ 2006-02-21 16:23 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug target/26398] Wrong code generated with SPE-Extensions on PowerPC
  2006-02-21 16:23 [Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC christian dot metzler at bmw-carit dot de
@ 2006-02-21 16:32 ` pinskia at gcc dot gnu dot org
  2006-02-22  5:47 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-21 16:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
 GCC target triplet|powerpc-unknown-eabi        |powerpc-unknown-eabispe


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


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

* [Bug target/26398] Wrong code generated with SPE-Extensions on PowerPC
  2006-02-21 16:23 [Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC christian dot metzler at bmw-carit dot de
  2006-02-21 16:32 ` [Bug target/26398] " pinskia at gcc dot gnu dot org
@ 2006-02-22  5:47 ` pinskia at gcc dot gnu dot org
  2006-02-22  8:11 ` christian dot metzler at bmw-carit dot de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-22  5:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-02-22 05:47 -------
Do you have a simple example that actually compiles?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug target/26398] Wrong code generated with SPE-Extensions on PowerPC
  2006-02-21 16:23 [Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC christian dot metzler at bmw-carit dot de
  2006-02-21 16:32 ` [Bug target/26398] " pinskia at gcc dot gnu dot org
  2006-02-22  5:47 ` pinskia at gcc dot gnu dot org
@ 2006-02-22  8:11 ` christian dot metzler at bmw-carit dot de
  2006-02-23 12:25 ` christian dot metzler at bmw-carit dot de
  2006-02-27  3:42 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: christian dot metzler at bmw-carit dot de @ 2006-02-22  8:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from christian dot metzler at bmw-carit dot de  2006-02-22 08:11 -------
Simple test case:

int main(int argc, char **argv) {
        float t;
        char u;

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

        return (int)u;
}

Compiles e.g. on i386 and returns 1. Compiled with given C-Flags and executed
on a MPC5553 it stores 0 in u. Debugged with a Lauterbach Debugger over JTAG.


-- 


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


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

* [Bug target/26398] Wrong code generated with SPE-Extensions on PowerPC
  2006-02-21 16:23 [Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC christian dot metzler at bmw-carit dot de
                   ` (2 preceding siblings ...)
  2006-02-22  8:11 ` christian dot metzler at bmw-carit dot de
@ 2006-02-23 12:25 ` christian dot metzler at bmw-carit dot de
  2006-02-27  3:42 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: christian dot metzler at bmw-carit dot de @ 2006-02-23 12:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from christian dot metzler at bmw-carit dot de  2006-02-23 12:25 -------
Seems to be fixed in 4.0.2


-- 

christian dot metzler at bmw-carit dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug target/26398] Wrong code generated with SPE-Extensions on PowerPC
  2006-02-21 16:23 [Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC christian dot metzler at bmw-carit dot de
                   ` (3 preceding siblings ...)
  2006-02-23 12:25 ` christian dot metzler at bmw-carit dot de
@ 2006-02-27  3:42 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-27  3:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.2


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


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

end of thread, other threads:[~2006-02-27  3:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-21 16:23 [Bug c/26398] New: Wrong code generated with SPE-Extensions on PowerPC christian dot metzler at bmw-carit dot de
2006-02-21 16:32 ` [Bug target/26398] " pinskia at gcc dot gnu dot org
2006-02-22  5:47 ` pinskia at gcc dot gnu dot org
2006-02-22  8:11 ` christian dot metzler at bmw-carit dot de
2006-02-23 12:25 ` christian dot metzler at bmw-carit dot de
2006-02-27  3:42 ` pinskia at gcc dot gnu dot org

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).