[cfe-commits] r101281 - in /cfe/trunk: lib/Headers/altivec.h test/CodeGen/builtins-ppc-altivec.c test/Parser/cxx-altivec.cpp

Chris Lattner sabre at nondot.org
Wed Apr 14 13:35:40 PDT 2010


Author: lattner
Date: Wed Apr 14 15:35:39 2010
New Revision: 101281

URL: http://llvm.org/viewvc/llvm-project?rev=101281&view=rev
Log:
improve altivec c++ support by adding casts, patch by
Anton Yartsev!

Modified:
    cfe/trunk/lib/Headers/altivec.h
    cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
    cfe/trunk/test/Parser/cxx-altivec.cpp

Modified: cfe/trunk/lib/Headers/altivec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=101281&r1=101280&r2=101281&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/altivec.h (original)
+++ cfe/trunk/lib/Headers/altivec.h Wed Apr 14 15:35:39 2010
@@ -64,8 +64,9 @@
 static vector float _ATTRS_o_ai
 vec_abs(vector float a)
 {
-  return (vector unsigned int)a &
-         (vector unsigned int)(0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF);
+  vector unsigned int res = (vector unsigned int)a &
+                            (vector unsigned int)(0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF);
+  return (vector float)res;
 }
 
 /* vec_abss */
@@ -111,12 +112,6 @@
 #define vec_vadduwm vec_add
 #define vec_vaddfp  vec_add
 
-static vector char _ATTRS_o_ai
-vec_add(vector char a, vector char b)
-{
-  return a + b;
-}
-
 static vector signed char _ATTRS_o_ai
 vec_add(vector signed char a, vector signed char b)
 {
@@ -180,12 +175,6 @@
 #define vec_vaddsws __builtin_altivec_vaddsws
 #define vec_vadduws __builtin_altivec_vadduws
 
-static vector char _ATTRS_o_ai
-vec_adds(vector char a, vector char b)
-{
-  return __builtin_altivec_vaddsbs(a, b);
-}
-
 static vector signed char _ATTRS_o_ai
 vec_adds(vector signed char a, vector signed char b)
 {
@@ -237,12 +226,6 @@
 #define vec_vsubuwm vec_sub
 #define vec_vsubfp  vec_sub
 
-static vector char _ATTRS_o_ai
-vec_sub(vector char a, vector char b)
-{
-  return a - b;
-}
-
 static vector signed char _ATTRS_o_ai
 vec_sub(vector signed char a, vector signed char b)
 {
@@ -300,12 +283,6 @@
 #define vec_vsubsws __builtin_altivec_vsubsws
 #define vec_vsubuws __builtin_altivec_vsubuws
 
-static vector char _ATTRS_o_ai
-vec_subs(vector char a, vector char b)
-{
-  return __builtin_altivec_vsubsbs(a, b);
-}
-
 static vector signed char _ATTRS_o_ai
 vec_subs(vector signed char a, vector signed char b)
 {
@@ -357,12 +334,6 @@
 #define vec_vavgsw __builtin_altivec_vavgsw
 #define vec_vavguw __builtin_altivec_vavguw
 
-static vector char _ATTRS_o_ai
-vec_avg(vector char a, vector char b)
-{
-  return __builtin_altivec_vavgsb(a, b);
-}
-
 static vector signed char _ATTRS_o_ai
 vec_avg(vector signed char a, vector signed char b)
 {
@@ -405,12 +376,6 @@
 #define vec_stvx         vec_st
 
 static void _ATTRS_o_ai
-vec_st(vector char a, int b, vector char *c)
-{
-  __builtin_altivec_stvx((vector int)a, b, (void *)c);
-}
-
-static void _ATTRS_o_ai
 vec_st(vector signed char a, int b, vector signed char *c)
 {
   __builtin_altivec_stvx((vector int)a, b, (void *)c);
@@ -458,12 +423,6 @@
 #define vec_stvxl         vec_stl
 
 static void _ATTRS_o_ai
-vec_stl(vector char a, int b, vector char *c)
-{
-  __builtin_altivec_stvxl((vector int)a, b, (void *)c);
-}
-
-static void _ATTRS_o_ai
 vec_stl(vector signed char a, int b, vector signed char *c)
 {
   __builtin_altivec_stvxl((vector int)a, b, (void *)c);
@@ -515,33 +474,27 @@
 #define vec_stvewx __builtin_altivec_stvewx
 
 static void _ATTRS_o_ai
-vec_ste(vector char a, int b, vector char *c)
-{
-  __builtin_altivec_stvebx((vector int)a, b, (void *)c);
-}
-
-static void _ATTRS_o_ai
 vec_ste(vector signed char a, int b, vector signed char *c)
 {
-  __builtin_altivec_stvebx((vector int)a, b, (void *)c);
+  __builtin_altivec_stvebx((vector char)a, b, (void *)c);
 }
 
 static void _ATTRS_o_ai
 vec_ste(vector unsigned char a, int b, vector unsigned char *c)
 {
-  __builtin_altivec_stvebx((vector int)a, b, (void *)c);
+  __builtin_altivec_stvebx((vector char)a, b, (void *)c);
 }
 
 static void _ATTRS_o_ai
 vec_ste(vector short a, int b, vector short *c)
 {
-  __builtin_altivec_stvehx((vector int)a, b, (void *)c);
+  __builtin_altivec_stvehx(a, b, (void *)c);
 }
 
 static void _ATTRS_o_ai
 vec_ste(vector unsigned short a, int b, vector unsigned short *c)
 {
-  __builtin_altivec_stvehx((vector int)a, b, (void *)c);
+  __builtin_altivec_stvehx((vector short)a, b, (void *)c);
 }
 
 static void _ATTRS_o_ai
@@ -572,49 +525,43 @@
 
 #define __builtin_vec_cmpeq vec_cmpeq
 
-static vector char _ATTRS_o_ai
-vec_cmpeq(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpequb(a, b);
-}
-
-static vector char _ATTRS_o_ai
+static vector /*bool*/ char _ATTRS_o_ai
 vec_cmpeq(vector signed char a, vector signed char b)
 {
-  return __builtin_altivec_vcmpequb(a, b);
+  return __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
 }
 
-static vector char _ATTRS_o_ai
+static vector /*bool*/ char _ATTRS_o_ai
 vec_cmpeq(vector unsigned char a, vector unsigned char b)
 {
-  return __builtin_altivec_vcmpequb(a, b);
+  return __builtin_altivec_vcmpequb((vector char)a, (vector char)b);
 }
 
-static vector short _ATTRS_o_ai
+static vector /*bool*/ short _ATTRS_o_ai
 vec_cmpeq(vector short a, vector short b)
 {
   return __builtin_altivec_vcmpequh(a, b);
 }
 
-static vector short _ATTRS_o_ai
+static vector /*bool*/ short _ATTRS_o_ai
 vec_cmpeq(vector unsigned short a, vector unsigned short b)
 {
-  return __builtin_altivec_vcmpequh(a, b);
+  return __builtin_altivec_vcmpequh((vector short)a, (vector short)b);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmpeq(vector int a, vector int b)
 {
   return __builtin_altivec_vcmpequw(a, b);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmpeq(vector unsigned int a, vector unsigned int b)
 {
-  return __builtin_altivec_vcmpequw(a, b);
+  return __builtin_altivec_vcmpequw((vector int)a, (vector int)b);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmpeq(vector float a, vector float b)
 {
   return __builtin_altivec_vcmpeqfp(a, b);
@@ -643,49 +590,43 @@
 #define __builtin_vec_vcmpgtuw __builtin_altivec_vcmpgtuw
 #define __builtin_vec_vcmpgtfp __builtin_altivec_vcmpgtfp
 
-static vector char _ATTRS_o_ai
-vec_cmpgt(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb(a, b);
-}
-
-static vector char _ATTRS_o_ai
+static vector /*bool*/ char _ATTRS_o_ai
 vec_cmpgt(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb(a, b);
 }
 
-static vector char _ATTRS_o_ai
+static vector /*bool*/ char _ATTRS_o_ai
 vec_cmpgt(vector unsigned char a, vector unsigned char b)
 {
   return __builtin_altivec_vcmpgtub(a, b);
 }
 
-static vector short _ATTRS_o_ai
+static vector /*bool*/ short _ATTRS_o_ai
 vec_cmpgt(vector short a, vector short b)
 {
   return __builtin_altivec_vcmpgtsh(a, b);
 }
 
-static vector short _ATTRS_o_ai
+static vector /*bool*/ short _ATTRS_o_ai
 vec_cmpgt(vector unsigned short a, vector unsigned short b)
 {
   return __builtin_altivec_vcmpgtuh(a, b);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmpgt(vector int a, vector int b)
 {
   return __builtin_altivec_vcmpgtsw(a, b);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmpgt(vector unsigned int a, vector unsigned int b)
 {
   return __builtin_altivec_vcmpgtuw(a, b);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmpgt(vector float a, vector float b)
 {
   return __builtin_altivec_vcmpgtfp(a, b);
@@ -695,7 +636,7 @@
 
 #define __builtin_vec_cmple vec_cmple
 
-static vector int __attribute__((__always_inline__))
+static vector /*bool*/ int __attribute__((__always_inline__))
 vec_cmple(vector float a, vector float b)
 {
   return __builtin_altivec_vcmpgefp(b, a);
@@ -705,49 +646,43 @@
 
 #define __builtin_vec_cmplt vec_cmplt
 
-static vector char _ATTRS_o_ai
-vec_cmplt(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb(b, a);
-}
-
-static vector char _ATTRS_o_ai
+static vector /*bool*/ char _ATTRS_o_ai
 vec_cmplt(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb(b, a);
 }
 
-static vector char _ATTRS_o_ai
+static vector /*bool*/ char _ATTRS_o_ai
 vec_cmplt(vector unsigned char a, vector unsigned char b)
 {
   return __builtin_altivec_vcmpgtub(b, a);
 }
 
-static vector short _ATTRS_o_ai
+static vector /*bool*/ short _ATTRS_o_ai
 vec_cmplt(vector short a, vector short b)
 {
   return __builtin_altivec_vcmpgtsh(b, a);
 }
 
-static vector short _ATTRS_o_ai
+static vector /*bool*/ short _ATTRS_o_ai
 vec_cmplt(vector unsigned short a, vector unsigned short b)
 {
   return __builtin_altivec_vcmpgtuh(b, a);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmplt(vector int a, vector int b)
 {
   return __builtin_altivec_vcmpgtsw(b, a);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmplt(vector unsigned int a, vector unsigned int b)
 {
   return __builtin_altivec_vcmpgtuw(b, a);
 }
 
-static vector int _ATTRS_o_ai
+static vector /*bool*/ int _ATTRS_o_ai
 vec_cmplt(vector float a, vector float b)
 {
   return __builtin_altivec_vcmpgtfp(b, a);
@@ -771,12 +706,6 @@
 #define vec_vmaxfp __builtin_altivec_vmaxfp
 #define __builtin_vec_max vec_max
 
-static vector char _ATTRS_o_ai
-vec_max(vector char a, vector char b)
-{
-  return __builtin_altivec_vmaxsb(a, b);
-}
-
 static vector signed char _ATTRS_o_ai
 vec_max(vector signed  char a, vector signed char b)
 {
@@ -842,12 +771,6 @@
 #define vec_vminfp __builtin_altivec_vminfp
 #define __builtin_vec_min vec_min
 
-static vector char _ATTRS_o_ai
-vec_min(vector char a, vector char b)
-{
-  return __builtin_altivec_vminsb(a, b);
-}
-
 static vector signed char _ATTRS_o_ai
 vec_min(vector signed  char a, vector signed char b)
 {
@@ -918,21 +841,15 @@
 /* vec_all_eq */
 
 static int _ATTRS_o_ai
-vec_all_eq(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpequb_p(__CR6_LT, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_all_eq(vector signed char a, vector signed char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_LT, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
 vec_all_eq(vector unsigned char a, vector unsigned char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_LT, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
@@ -944,7 +861,7 @@
 static int _ATTRS_o_ai
 vec_all_eq(vector unsigned short a, vector unsigned short b)
 {
-  return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);
+  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);
 }
 
 static int _ATTRS_o_ai
@@ -956,7 +873,7 @@
 static int _ATTRS_o_ai
 vec_all_eq(vector unsigned int a, vector unsigned int b)
 {
-  return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);
+  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);
 }
 
 static int _ATTRS_o_ai
@@ -968,12 +885,6 @@
 /* vec_all_ge */
 
 static int _ATTRS_o_ai
-vec_all_ge(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
-}
-
-static int _ATTRS_o_ai
 vec_all_ge(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
@@ -1018,12 +929,6 @@
 /* vec_all_gt */
 
 static int _ATTRS_o_ai
-vec_all_gt(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_all_gt(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
@@ -1076,12 +981,6 @@
 /* vec_all_le */
 
 static int _ATTRS_o_ai
-vec_all_le(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_all_le(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
@@ -1126,12 +1025,6 @@
 /* vec_all_lt */
 
 static int _ATTRS_o_ai
-vec_all_lt(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
-}
-
-static int _ATTRS_o_ai
 vec_all_lt(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
@@ -1184,21 +1077,15 @@
 /* vec_all_ne */
 
 static int _ATTRS_o_ai
-vec_all_ne(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpequb_p(__CR6_EQ, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_all_ne(vector signed char a, vector signed char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_EQ, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
 vec_all_ne(vector unsigned char a, vector unsigned char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_EQ, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
@@ -1210,7 +1097,7 @@
 static int _ATTRS_o_ai
 vec_all_ne(vector unsigned short a, vector unsigned short b)
 {
-  return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);
+  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);
 }
 
 static int _ATTRS_o_ai
@@ -1222,7 +1109,7 @@
 static int _ATTRS_o_ai
 vec_all_ne(vector unsigned int a, vector unsigned int b)
 {
-  return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);
+  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);
 }
 
 static int _ATTRS_o_ai
@@ -1274,21 +1161,15 @@
 /* vec_any_eq */
 
 static int _ATTRS_o_ai
-vec_any_eq(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_any_eq(vector signed char a, vector signed char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
 vec_any_eq(vector unsigned char a, vector unsigned char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
@@ -1300,7 +1181,7 @@
 static int _ATTRS_o_ai
 vec_any_eq(vector unsigned short a, vector unsigned short b)
 {
-  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);
+  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)a, (vector short)b);
 }
 
 static int _ATTRS_o_ai
@@ -1312,7 +1193,7 @@
 static int _ATTRS_o_ai
 vec_any_eq(vector unsigned int a, vector unsigned int b)
 {
-  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);
+  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);
 }
 
 static int _ATTRS_o_ai
@@ -1324,12 +1205,6 @@
 /* vec_any_ge */
 
 static int _ATTRS_o_ai
-vec_any_ge(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
-}
-
-static int _ATTRS_o_ai
 vec_any_ge(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
@@ -1374,12 +1249,6 @@
 /* vec_any_gt */
 
 static int _ATTRS_o_ai
-vec_any_gt(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_any_gt(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
@@ -1424,12 +1293,6 @@
 /* vec_any_le */
 
 static int _ATTRS_o_ai
-vec_any_le(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_any_le(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
@@ -1474,12 +1337,6 @@
 /* vec_any_lt */
 
 static int _ATTRS_o_ai
-vec_any_lt(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
-}
-
-static int _ATTRS_o_ai
 vec_any_lt(vector signed char a, vector signed char b)
 {
   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
@@ -1532,21 +1389,15 @@
 /* vec_any_ne */
 
 static int _ATTRS_o_ai
-vec_any_ne(vector char a, vector char b)
-{
-  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, a, b);
-}
-
-static int _ATTRS_o_ai
 vec_any_ne(vector signed char a, vector signed char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
 vec_any_ne(vector unsigned char a, vector unsigned char b)
 {
-  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, a, b);
+  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);
 }
 
 static int _ATTRS_o_ai
@@ -1558,7 +1409,7 @@
 static int _ATTRS_o_ai
 vec_any_ne(vector unsigned short a, vector unsigned short b)
 {
-  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);
+  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)a, (vector short)b);
 }
 
 static int _ATTRS_o_ai
@@ -1570,7 +1421,7 @@
 static int _ATTRS_o_ai
 vec_any_ne(vector unsigned int a, vector unsigned int b)
 {
-  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);
+  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);
 }
 
 static int _ATTRS_o_ai

Modified: cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-altivec.c?rev=101281&r1=101280&r2=101281&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-ppc-altivec.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-altivec.c Wed Apr 14 15:35:39 2010
@@ -4,7 +4,6 @@
 
 int main ()
 {
-  vector char vc = { -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16 };
   vector signed char vsc = { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16 };
   vector unsigned char vuc = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
   vector short vs = { -1, 2, -3, 4, -5, 6, -7, 8 };
@@ -13,7 +12,7 @@
   vector unsigned int vui = { 1, 2, 3, 4 };
   vector float vf = { -1.5, 2.5, -3.5, 4.5 };
 
-  vector char res_vc;
+  vector signed char res_vsc;
   vector unsigned char res_vuc;
   vector short res_vs;
   vector unsigned short res_vus;
@@ -48,7 +47,7 @@
                                    // CHECK: @llvm.ppc.altivec.vmaxsw
 
   /*  vec_add */
-  res_vc  = vec_add(vc, vc);                    // CHECK: add nsw <16 x i8>
+  res_vsc  = vec_add(vsc, vsc);                 // CHECK: add nsw <16 x i8>
   res_vuc = vec_vaddubm(vuc, vuc);              // CHECK: add <16 x i8>
   res_vs  = __builtin_altivec_vadduhm(vs, vs);  // CHECK: add nsw <8 x i16>
   res_vus = vec_vadduhm(vus, vus);              // CHECK: add <8 x i16>
@@ -60,7 +59,7 @@
   res_vui = vec_vaddcuw(vui, vui);              // HECK: @llvm.ppc.altivec.vaddcuw
 
   /* vec_adds */
-  res_vc  = vec_adds(vc, vc);                   // CHECK: @llvm.ppc.altivec.vaddsbs
+  res_vsc  = vec_adds(vsc, vsc);                // CHECK: @llvm.ppc.altivec.vaddsbs
   res_vuc = vec_vaddubs(vuc, vuc);              // CHECK: @llvm.ppc.altivec.vaddubs
   res_vs  = __builtin_vec_vaddshs(vs, vs);      // CHECK: @llvm.ppc.altivec.vaddshs
   res_vus = vec_vadduhs(vus, vus);              // CHECK: @llvm.ppc.altivec.vadduhs
@@ -68,7 +67,7 @@
   res_vui = vec_vadduws(vui, vui);              // CHECK: @llvm.ppc.altivec.vadduws
 
   /* vec_sub */
-  res_vc  = vec_sub(vsc, vsc);                  // CHECK: sub nsw <16 x i8>
+  res_vsc  = vec_sub(vsc, vsc);                 // CHECK: sub nsw <16 x i8>
   res_vuc = vec_vsububm(vuc, vuc);              // CHECK: sub <16 x i8>
   res_vs  = __builtin_altivec_vsubuhm(vs, vs);  // CHECK: sub nsw <8 x i16>
   res_vus = vec_vsubuhm(vus, vus);              // CHECK: sub <8 x i16>
@@ -77,7 +76,7 @@
   res_vf  = __builtin_vec_vsubfp(vf, vf);       // CHECK: fsub <4 x float>
 
   /* vec_subs */
-  res_vc  = vec_subs(vc, vc);                   // CHECK: @llvm.ppc.altivec.vsubsbs
+  res_vsc  = vec_subs(vsc, vsc);                // CHECK: @llvm.ppc.altivec.vsubsbs
   res_vuc = vec_vsububs(vuc, vuc);              // CHECK: @llvm.ppc.altivec.vsububs
   res_vs  = __builtin_vec_vsubshs(vs, vs);      // CHECK: @llvm.ppc.altivec.vsubshs
   res_vus = vec_vsubuhs(vus, vus);              // CHECK: @llvm.ppc.altivec.vsubuhs
@@ -85,7 +84,7 @@
   res_vui = vec_vsubuws(vui, vui);              // CHECK: @llvm.ppc.altivec.vsubuws
 
   /* vec_avg */
-  res_vc  = vec_avg(vsc, vsc);                  // CHECK: @llvm.ppc.altivec.vavgsb
+  res_vsc  = vec_avg(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vavgsb
   res_vuc = __builtin_vec_vavgub(vuc, vuc);     // CHECK: @llvm.ppc.altivec.vavgub
   res_vs  = vec_vavgsh(vs, vs);                 // CHECK: @llvm.ppc.altivec.vavgsh
   res_vus = __builtin_vec_vavguh(vus, vus);     // CHECK: @llvm.ppc.altivec.vavguh
@@ -94,7 +93,7 @@
 
   /* vec_st */
   param_i = 5;
-  vec_st(vc, 0, &res_vc);                       // CHECK: @llvm.ppc.altivec.stvx
+  vec_st(vsc, 0, &res_vsc);                     // CHECK: @llvm.ppc.altivec.stvx
   __builtin_vec_st(vuc, param_i, &res_vuc);     // CHECK: @llvm.ppc.altivec.stvx
   vec_stvx(vs, 1, &res_vs);                     // CHECK: @llvm.ppc.altivec.stvx
   vec_st(vus, 1000, &res_vus);                  // CHECK: @llvm.ppc.altivec.stvx
@@ -104,7 +103,7 @@
 
   /* vec_stl */
   param_i = 10000;
-  vec_stl(vc, param_i, &res_vc);                // CHECK: @llvm.ppc.altivec.stvxl
+  vec_stl(vsc, param_i, &res_vsc);              // CHECK: @llvm.ppc.altivec.stvxl
   __builtin_vec_stl(vuc, 1, &res_vuc);          // CHECK: @llvm.ppc.altivec.stvxl
   vec_stvxl(vs, 0, &res_vs);                    // CHECK: @llvm.ppc.altivec.stvxl
   vec_stl(vus, 0, &res_vus);                    // CHECK: @llvm.ppc.altivec.stvxl
@@ -114,7 +113,7 @@
 
   /* vec_ste */
   param_i = 10000;
-  vec_ste(vc, param_i, &res_vc);                // CHECK: @llvm.ppc.altivec.stvebx
+  vec_ste(vsc, param_i, &res_vsc);              // CHECK: @llvm.ppc.altivec.stvebx
   vec_stvebx(vuc, 1, &res_vuc);                 // CHECK: @llvm.ppc.altivec.stvebx
   __builtin_vec_stvehx(vs, 0, &res_vs);         // CHECK: @llvm.ppc.altivec.stvehx
   vec_stvehx(vus, 0, &res_vus);                 // CHECK: @llvm.ppc.altivec.stvehx
@@ -126,7 +125,7 @@
   res_vi = vec_vcmpbfp(vf, vf);                 // CHECK: @llvm.ppc.altivec.vcmpbfp
 
   /* vec_cmpeq */
-  res_vi = vec_cmpeq(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpequb
+  res_vi = vec_cmpeq(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpequb
   res_vi = __builtin_vec_cmpeq(vuc, vuc);       // CHECK: @llvm.ppc.altivec.vcmpequb
   res_vi = vec_cmpeq(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpequh
   res_vi = vec_cmpeq(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpequh
@@ -138,7 +137,7 @@
   res_vi = __builtin_vec_cmpge(vf, vf);         // CHECK: @llvm.ppc.altivec.vcmpgefp
 
   /* vec_cmpgt */
-  res_vi = vec_cmpgt(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb
+  res_vi = vec_cmpgt(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb
   res_vi = vec_vcmpgtub(vuc, vuc);              // CHECK: @llvm.ppc.altivec.vcmpgtub
   res_vi = __builtin_vec_vcmpgtsh(vs, vs);      // CHECK: @llvm.ppc.altivec.vcmpgtsh
   res_vi = vec_cmpgt(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh
@@ -150,7 +149,7 @@
   res_vi = __builtin_vec_cmple(vf, vf);         // CHECK: @llvm.ppc.altivec.vcmpgefp
 
   /* vec_cmplt */
-  res_vi = vec_cmplt(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb
+  res_vi = vec_cmplt(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb
   res_vi = __builtin_vec_cmplt(vuc, vuc);       // CHECK: @llvm.ppc.altivec.vcmpgtub
   res_vi = vec_cmplt(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh
   res_vi = vec_cmplt(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh
@@ -159,7 +158,7 @@
   res_vi = vec_cmplt(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpgtfp
 
   /* vec_max */
-  res_vc  = vec_max(vc, vc);                    // CHECK: @llvm.ppc.altivec.vmaxsb
+  res_vsc  = vec_max(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vmaxsb
   res_vuc = __builtin_vec_vmaxub(vuc, vuc);     // CHECK: @llvm.ppc.altivec.vmaxub
   res_vs  = vec_vmaxsh(vs, vs);                 // CHECK: @llvm.ppc.altivec.vmaxsh
   res_vus = vec_max(vus, vus);                  // CHECK: @llvm.ppc.altivec.vmaxuh
@@ -171,7 +170,7 @@
   vf = vec_mfvscr();                            // CHECK: @llvm.ppc.altivec.mfvscr
 
   /* vec_min */
-  res_vc  = vec_min(vc, vc);                    // CHECK: @llvm.ppc.altivec.vminsb
+  res_vsc  = vec_min(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vminsb
   res_vuc = __builtin_vec_vminub(vuc, vuc);     // CHECK: @llvm.ppc.altivec.vminub
   res_vs  = vec_vminsh(vs, vs);                 // CHECK: @llvm.ppc.altivec.vminsh
   res_vus = vec_min(vus, vus);                  // CHECK: @llvm.ppc.altivec.vminuh
@@ -180,16 +179,16 @@
   res_vf  = __builtin_vec_min(vf, vf);          // CHECK: @llvm.ppc.altivec.vminfp
 
   /* vec_mtvscr */
-  vec_mtvscr(vc);                               // CHECK: @llvm.ppc.altivec.mtvscr
+  vec_mtvscr(vsc);                              // CHECK: @llvm.ppc.altivec.mtvscr
 
   /* ------------------------------ predicates -------------------------------------- */
 
-  res_i = __builtin_vec_vcmpeq_p(__CR6_EQ, vc, vui); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
-  res_i = __builtin_vec_vcmpge_p(__CR6_EQ, vs, vi);  // CHECK: @llvm.ppc.altivec.vcmpgefp.p
-  res_i = __builtin_vec_vcmpgt_p(__CR6_EQ, vuc, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+  res_i = __builtin_vec_vcmpeq_p(__CR6_EQ, vsc, vui); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+  res_i = __builtin_vec_vcmpge_p(__CR6_EQ, vs, vi);   // CHECK: @llvm.ppc.altivec.vcmpgefp.p
+  res_i = __builtin_vec_vcmpgt_p(__CR6_EQ, vuc, vf);  // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
 
   /*  vec_all_eq */
-  res_i = vec_all_eq(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpequb.p
+  res_i = vec_all_eq(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_all_eq(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_all_eq(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpequh.p
   res_i = vec_all_eq(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpequh.p
@@ -198,7 +197,7 @@
   res_i = vec_all_eq(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
 
   /* vec_all_ge */
-  res_i = vec_all_ge(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_all_ge(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_all_ge(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_all_ge(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_all_ge(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -207,7 +206,7 @@
   res_i = vec_all_ge(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
 
   /* vec_all_gt */
-  res_i = vec_all_gt(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_all_gt(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_all_gt(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_all_gt(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_all_gt(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -219,7 +218,7 @@
   res_i = vec_all_in(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpbfp.p
 
   /* vec_all_le */
-  res_i = vec_all_le(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_all_le(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_all_le(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_all_le(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_all_le(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -231,7 +230,7 @@
   res_i = vec_all_nan(vf);                      // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
 
   /*  vec_all_ne */
-  res_i = vec_all_ne(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpequb.p
+  res_i = vec_all_ne(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_all_ne(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_all_ne(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpequh.p
   res_i = vec_all_ne(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpequh.p
@@ -255,7 +254,7 @@
   res_i = vec_all_numeric(vf);                  // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
 
   /*  vec_any_eq */
-  res_i = vec_any_eq(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpequb.p
+  res_i = vec_any_eq(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_any_eq(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_any_eq(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpequh.p
   res_i = vec_any_eq(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpequh.p
@@ -264,7 +263,7 @@
   res_i = vec_any_eq(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
 
   /* vec_any_ge */
-  res_i = vec_any_ge(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_any_ge(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_any_ge(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_any_ge(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_any_ge(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -273,7 +272,7 @@
   res_i = vec_any_ge(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
 
   /* vec_any_gt */
-  res_i = vec_any_gt(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_any_gt(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_any_gt(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_any_gt(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_any_gt(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -282,7 +281,7 @@
   res_i = vec_any_gt(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
 
   /* vec_any_le */
-  res_i = vec_any_le(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_any_le(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_any_le(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_any_le(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_any_le(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -291,7 +290,7 @@
   res_i = vec_any_le(vf, vf);                   // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
 
   /* vec_any_lt */
-  res_i = vec_any_lt(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+  res_i = vec_any_lt(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
   res_i = vec_any_lt(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpgtub.p
   res_i = vec_any_lt(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
   res_i = vec_any_lt(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
@@ -303,7 +302,7 @@
   res_i = vec_any_nan(vf);                      // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
 
   /* vec_any_ne */
-  res_i = vec_any_ne(vc, vc);                   // CHECK: @llvm.ppc.altivec.vcmpequb.p
+  res_i = vec_any_ne(vsc, vsc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_any_ne(vuc, vuc);                 // CHECK: @llvm.ppc.altivec.vcmpequb.p
   res_i = vec_any_ne(vs, vs);                   // CHECK: @llvm.ppc.altivec.vcmpequh.p
   res_i = vec_any_ne(vus, vus);                 // CHECK: @llvm.ppc.altivec.vcmpequh.p

Modified: cfe/trunk/test/Parser/cxx-altivec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-altivec.cpp?rev=101281&r1=101280&r2=101281&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-altivec.cpp (original)
+++ cfe/trunk/test/Parser/cxx-altivec.cpp Wed Apr 14 15:35:39 2010
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
-// XFAIL: *
 // This is the same as the C version:
 
 __vector char vv_c;





More information about the cfe-commits mailing list