This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/12299] New: altivec vec_cmple generates wrong instruction
- From: "darren at nasoftware dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Sep 2003 13:00:22 -0000
- Subject: [Bug other/12299] New: altivec vec_cmple generates wrong instruction
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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