This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] altivec.h fixes, 1 of 4
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Jul 2004 13:54:29 -0700
- Subject: [PATCH] altivec.h fixes, 1 of 4
Fix some typos and minor bugs in altivec.h. Later patches in this set
of altivec.h changes depend on this patch.
Tested with the other 3 altivec.h patches I'm submitting today by
running tests from the GCC testsuite that include <altivec.h>, using
biarch powerpc64-unknown-linux-gnu C and C++ compilers for -m32 and
-m64. I've also run various other tests that include altivec.h.
The set of patches allows gcc.dg/vmx/ops.c (with submitted patch for
that test) to compile.
OK for mainline?
2004-07-02 Janis Johnson <janis187@us.ibm.com>
* config/rs6000/altivec.h (vec_vcmpgtsh): Fix C++ function name.
(vec_vmulesb): Add missing C++ function.
(vec_perm): Fix type of third argument in C++ function.
(vec_vsum4shs): Fix C++ function name.
(vec_any_ge): Remove C++ functions for unsupported arg combinations.
(vec_vcmpgtsw, vec_vcmpgtuw, vec_minsb, vec_vmsummbm): Fix the
argument passed to the error handler in C macro.
(vec_nmsub): Remove extra parens around argument names in C macro.
(vec_packpx): Add missing parens in C macro.
--- config/rs6000/altivec.h.orig 2004-07-01 20:14:39.049153936 -0500
+++ config/rs6000/altivec.h 2004-07-01 20:23:07.064266200 -0500
@@ -1325,7 +1325,7 @@ vec_vcmpgtuw (vector unsigned int a1, ve
/* vec_vcmpgtsh */
inline vector signed short
-vec_cmpgtsh (vector signed short a1, vector signed short a2)
+vec_vcmpgtsh (vector signed short a1, vector signed short a2)
{
return (vector signed short) __builtin_altivec_vcmpgtsh ((vector signed short) a1, (vector signed short) a2);
}
@@ -3350,6 +3350,14 @@ vec_vmuleuh (vector unsigned short a1, v
return (vector unsigned int) __builtin_altivec_vmuleuh ((vector signed short) a1, (vector signed short) a2);
}
+/* vec_vmulesb */
+
+inline vector signed short
+vec_vmulesb (vector signed char a1, vector signed char a2)
+{
+ return (vector signed short) __builtin_altivec_vmuleub ((vector signed char) a1, (vector signed char) a2);
+}
+
/* vec_vmuleub */
inline vector unsigned short
vec_vmuleub (vector unsigned char a1, vector unsigned char a2)
@@ -3868,7 +3876,7 @@ vec_perm (vector unsigned char a1, vecto
}
inline vector bool char
-vec_perm (vector bool char a1, vector bool char a2, vector bool char a3)
+vec_perm (vector bool char a1, vector bool char a2, vector unsigned char a3)
{
return (vector bool char) __builtin_altivec_vperm_4si ((vector signed int) a1, (vector signed int) a2, (vector signed char) a3);
}
@@ -5978,7 +5986,7 @@ vec_sum4s (vector signed short a1, vecto
/* vec_vsum4shs */
inline vector signed int
-vec_vsum4shss (vector signed short a1, vector signed int a2)
+vec_vsum4shs (vector signed short a1, vector signed int a2)
{
return (vector signed int) __builtin_altivec_vsum4shs ((vector signed short) a1, (vector signed int) a2);
}
@@ -7242,12 +7250,6 @@ vec_any_ge (vector signed char a1, vecto
}
inline int
-vec_any_ge (vector bool char a1, vector bool char a2)
-{
- return __builtin_altivec_vcmpgtub_p (__CR6_LT_REV, (vector signed char) a2, (vector signed char) a1);
-}
-
-inline int
vec_any_ge (vector bool char a1, vector unsigned char a2)
{
return __builtin_altivec_vcmpgtub_p (__CR6_LT_REV, (vector signed char) a2, (vector signed char) a1);
@@ -7284,12 +7286,6 @@ vec_any_ge (vector signed short a1, vect
}
inline int
-vec_any_ge (vector bool short a1, vector bool short a2)
-{
- return __builtin_altivec_vcmpgtuh_p (__CR6_LT_REV, (vector signed short) a2, (vector signed short) a1);
-}
-
-inline int
vec_any_ge (vector bool short a1, vector unsigned short a2)
{
return __builtin_altivec_vcmpgtuh_p (__CR6_LT_REV, (vector signed short) a2, (vector signed short) a1);
@@ -7326,12 +7322,6 @@ vec_any_ge (vector signed int a1, vector
}
inline int
-vec_any_ge (vector bool int a1, vector bool int a2)
-{
- return __builtin_altivec_vcmpgtuw_p (__CR6_LT_REV, (vector signed int) a2, (vector signed int) a1);
-}
-
-inline int
vec_any_ge (vector bool int a1, vector unsigned int a2)
{
return __builtin_altivec_vcmpgtuw_p (__CR6_LT_REV, (vector signed int) a2, (vector signed int) a1);
@@ -8345,12 +8335,12 @@ __ch (__bin_args_eq (vector float, (a1),
#define vec_vcmpgtsw(a1, a2) \
__ch (__bin_args_eq (vector signed int, (a1), vector signed int, (a2)), \
((vector signed int) __builtin_altivec_vcmpgtsw ((vector signed int) (a1), (vector signed int) (a2))), \
- __builtin_altivec_compiletime_error ("vec_abs"))
+ __builtin_altivec_compiletime_error ("vec_vcmpgtsw"))
#define vec_vcmpgtuw(a1, a2) \
__ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \
((vector signed int) __builtin_altivec_vcmpgtuw ((vector signed int) (a1), (vector signed int) (a2))), \
- __builtin_altivec_compiletime_error ("vec_abs"))
+ __builtin_altivec_compiletime_error ("vec_vcmpgtuw"))
#define vec_vcmpgtsh(a1, a2) \
__ch (__bin_args_eq (vector signed short, (a1), vector signed short, (a2)), \
@@ -9061,7 +9051,7 @@ __builtin_altivec_compiletime_error ("ve
#define vec_vminsb(a1, a2) \
__ch (__bin_args_eq (vector signed char, (a1), vector signed char, (a2)), \
((vector signed char) __builtin_altivec_vminsb ((vector signed char) (a1), (vector signed char) (a2))), \
-__builtin_altivec_compiletime_error ("vec_abs"))
+__builtin_altivec_compiletime_error ("vec_vminsb"))
#define vec_vminub(a1, a2) \
__ch (__bin_args_eq (vector signed char, (a1), vector unsigned char, (a2)), \
@@ -9112,7 +9102,7 @@ __builtin_altivec_compiletime_error ("ve
#define vec_vmsummbm(a1, a2, a3) \
__ch (__tern_args_eq (vector signed char, (a1), vector unsigned char, (a2), vector signed int, (a3)), \
((vector signed int) __builtin_altivec_vmsummbm ((vector signed char) (a1), (vector signed char) (a2), (vector signed int) (a3))), \
-__builtin_altivec_compiletime_error ("vec_abs"))
+__builtin_altivec_compiletime_error ("vec_vmsummbm"))
#define vec_vmsumubm(a1, a2, a3) \
__ch (__tern_args_eq (vector unsigned char, (a1), vector unsigned char, (a2), vector unsigned int, (a3)), \
@@ -9222,8 +9212,8 @@ __ch (__bin_args_eq (vector unsigned cha
__builtin_altivec_compiletime_error ("vec_vmuloub"))
#define vec_nmsub(a1, a2, a3) \
-__ch (__tern_args_eq (vector float, ((a1)), vector float, ((a2)) , vector float, ((a3))), \
- ((vector float) __builtin_altivec_vnmsubfp ((vector float) ((a1)), (vector float) ((a2)), (vector float)((a3)))), \
+__ch (__tern_args_eq (vector float, (a1), vector float, (a2), vector float, (a3)), \
+ ((vector float) __builtin_altivec_vnmsubfp ((vector float) (a1), (vector float) (a2), (vector float) (a3))), \
__builtin_altivec_compiletime_error ("vec_nmsub"))
#define vec_nor(a1, a2) \
@@ -9331,7 +9321,7 @@ __builtin_altivec_compiletime_error ("ve
#define vec_packpx(a1, a2) \
__ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \
- (vector pixel) __builtin_altivec_vpkpx ((vector signed int) (a1), (vector signed int) (a2)), \
+ ((vector pixel) __builtin_altivec_vpkpx ((vector signed int) (a1), (vector signed int) (a2))), \
__builtin_altivec_compiletime_error ("vec_packpx"))
#define vec_packs(a1, a2) \