This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Typos in altivec.h (cmple, vec_all_numeric)
- From: "Hartmut Penner" <HPENNER at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 15 Dec 2003 12:02:31 +0100
- Subject: [PATCH] Typos in altivec.h (cmple, vec_all_numeric)
Found typos in altivec.h.
OK to commit ? Also for 3.3 ?
regards, Hartmut Penner
ChangeLog:
2003-12-15 Hartmut Penner <hpenner@de.ibm.com>
* altivec.h (vec_cmple, vec_all_numeric): Fix typo.
* testsuite/gcc.dg/altivec-10.c: Test for above.
Index: gcc/config/rs6000/altivec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/altivec.h,v
retrieving revision 1.24
diff -u -r1.24 altivec.h
--- gcc/config/rs6000/altivec.h 15 Sep 2003 04:52:56 -0000 1.24
+++ gcc/config/rs6000/altivec.h 15 Dec 2003 08:34:12 -0000
@@ -1094,7 +1094,7 @@
inline vector signed int
vec_cmple (vector float a1, vector float a2)
{
- return (vector signed int) __builtin_altivec_vcmpgefp ((vector float)
a1, (vector float) a2);
+ return (vector signed int) __builtin_altivec_vcmpgefp ((vector float) a2, (vector float) a1);
}
/* vec_cmplt */
@@ -5526,7 +5526,7 @@
inline int
vec_all_numeric (vector float a1)
{
- return __builtin_altivec_vcmpeqfp_p (__CR6_EQ, a1, a1);
+ return __builtin_altivec_vcmpeqfp_p (__CR6_LT, a1, a1);
}
/* vec_any_eq */
@@ -6521,7 +6521,7 @@
((vector signed char) __builtin_altivec_vcmpgtub ((vector signed char) (a1), (vector signed char) (a2))), \
__altivec_link_error_invalid_argument ())
-#define vec_cmple(a1, a2) __builtin_altivec_vcmpgefp ((a1), (a2))
+#define vec_cmple(a1, a2) __builtin_altivec_vcmpgefp ((a2), (a1))
#define vec_cmplt(a2, a1) \
__ch (__bin_args_eq (vector unsigned char, (a1), vector unsigned char, (a2)), \
@@ -8343,7 +8343,7 @@
#define vec_all_nlt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_EQ, (a2), (a1))
-#define vec_all_numeric(a1) __builtin_altivec_vcmpeqfp_p (__CR6_EQ, (a1), (a1))
+#define vec_all_numeric(a1) __builtin_altivec_vcmpeqfp_p (__CR6_LT, (a1), (a1))
#define vec_any_eq(a1, a2) \
__ch (__bin_args_eq (vector signed char, (a1), vector unsigned char, (a2)), \
Testcase altivec-10.c:
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */
#include <altivec.h>
#include <signal.h>
void
sig_ill_handler (int sig)
{
exit(0);
}
typedef union
{
float f[4];
unsigned int i[4];
vector float v;
} vec_float_t;
void
check_vec_all_num ()
{
vec_float_t a, b, c;
a.i[0] = 0xfffa5a5a;
a.f[1] = 1.0;
a.f[2] = 1.0;
a.f[3] = 1.0;
b.f[0] = 1.0;
b.f[1] = 1.0;
b.f[2] = 1.0;
b.f[3] = 1.0;
c.i[0] = 0xfffa5a5a;
c.i[1] = 0xfffa5a5a;
c.i[2] = 0xfffa5a5a;
c.i[3] = 0xfffa5a5a;
if (vec_all_numeric (a.v))
abort ();
if (vec_all_nan (a.v))
abort ();
if (!vec_all_numeric (b.v))
abort ();
if (vec_all_nan (b.v))
abort ();
if (vec_all_numeric (c.v))
abort ();
if (!vec_all_nan (c.v))
abort ();
}
void
check_cmple()
{
vector float a = {1.0, 2.0, 3.0, 4.0};
vector float b = {1.0, 3.0, 2.0, 5.0};
vector signed int aux;
vector signed int le = {-1, -1, 0, -1};
aux = vec_cmple (a, b);
if (!vec_all_eq (aux, le))
abort ();
}
int
main()
{
/* Exit on systems without altivec. */
signal (SIGILL, sig_ill_handler);
asm volatile ("vor 0,0,0");
signal (SIGILL, SIG_DFL);
check_cmple ();
check_vec_all_num ();
exit (0);
}