public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/12299] New: altivec vec_cmple generates wrong instruction
@ 2003-09-16 14:07 darren at nasoftware dot co dot uk
  2003-09-16 15:27 ` [Bug target/12299] " bangerth at dealii dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: darren at nasoftware dot co dot uk @ 2003-09-16 14:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: altivec vec_cmple generates wrong instruction
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: darren at nasoftware dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu

The altivec instruction vec_cmple currently does the same as the vec_cmpge
instruction.  The error seems to be in the altivec.h include file, the vec_cmple
arguments should probably be swapped around.

How to repeat:

#include <altivec.h>
#include <stdio.h>
#include <stdlib.h>

void PrintVectorFloat(FILE *out, const vector float *vec)
{
  const float *ptr = (float *)vec;
  int i, end = vec_step(vector float);
  fprintf(out, "( ");
  for(i=0; i<end-1; i++) {
    fprintf(out, "%f", *ptr++);
    fprintf(out, ", ");
  }
  fprintf(out, "%f", *ptr++);
  fprintf(out, " )");
  return;
}

int main(void)
{
  vector float zero    = (vector float) {0.0, 0.0, 0.0, 0.0};
  vector float smaller = (vector float) {1.0, 2.0, 3.0, 4.0};
  vector float bigger  = (vector float) {5.0, 6.0, 7.0, 4.0};
  vector bool int cmp;
  
  cmp = vec_cmple (bigger, smaller);
  bigger = vec_sel (bigger, zero, cmp);
  PrintVectorFloat (stdout, &bigger); printf ("\n");
  
  cmp = vec_cmpge (bigger, smaller);
  bigger = vec_sel (bigger, zero, cmp);
  PrintVectorFloat (stdout, &bigger); printf ("\n");
  return 0;
}

compiled with gcc -maltivec -mabi=altivec

gcc -v:
Reading specs from
/usr/local/gcc-3.3.1/lib/gcc-lib/powerpc-unknown-linux-gnu/3.3.1/specs
Configured with: ../gcc-3.3.1/configure --prefix=/usr/local/gcc-3.3.1
--enable-altivec --enable-languages=c++,f77,c
Thread model: posix
gcc version 3.3.1


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

end of thread, other threads:[~2004-01-01 21:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-16 14:07 [Bug other/12299] New: altivec vec_cmple generates wrong instruction darren at nasoftware dot co dot uk
2003-09-16 15:27 ` [Bug target/12299] " bangerth at dealii dot org
2003-09-16 18:48 ` pinskia at gcc dot gnu dot org
2003-10-16 14:11 ` aldyh at gcc dot gnu dot org
2004-01-01 21:21 ` 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).