From: Chris Lattner Date: Wed, 14 Apr 2010 20:35:39 +0000 (+0000) Subject: improve altivec c++ support by adding casts, patch by X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab866b46f3f626ac2da42d2b16ec3b5c04105e38;p=clang improve altivec c++ support by adding casts, patch by Anton Yartsev! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101281 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/altivec.h b/lib/Headers/altivec.h index d252920ccb..1cd0db8e4b 100644 --- a/lib/Headers/altivec.h +++ b/lib/Headers/altivec.h @@ -64,8 +64,9 @@ vec_abs(vector signed int a) 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 @@ vec_abss(vector signed int a) #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 @@ vec_add(vector float a, vector float b) #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 @@ vec_adds(vector unsigned int a, vector unsigned int b) #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 @@ vec_sub(vector float a, vector float b) #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 @@ vec_subs(vector unsigned int a, vector unsigned int b) #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) { @@ -404,12 +375,6 @@ vec_avg(vector unsigned int a, vector unsigned int b) #define __builtin_vec_st vec_st #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) { @@ -457,12 +422,6 @@ vec_st(vector float a, int b, vector float *c) #define __builtin_vec_stl vec_stl #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) { @@ -514,34 +473,28 @@ vec_stl(vector float a, int b, vector float *c) #define vec_stvehx __builtin_altivec_stvehx #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 @@ vec_ste(vector float a, int b, vector float *c) #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 @@ vec_cmpeq(vector float a, vector float b) #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 @@ vec_cmpgt(vector float a, vector float b) #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 @@ vec_cmple(vector float a, vector float b) #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 @@ vec_cmplt(vector float a, vector float b) #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 @@ vec_max(vector float a, vector float b) #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) { @@ -917,22 +840,16 @@ __builtin_vec_vcmpgt_p(char CR6_param, vector float a, vector float b) /* 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 @@ vec_all_eq(vector short a, vector short b) 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 @@ vec_all_eq(vector int a, vector int b) 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 @@ -967,12 +884,6 @@ vec_all_eq(vector float a, vector float b) /* 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) { @@ -1017,12 +928,6 @@ vec_all_ge(vector float a, vector float b) /* 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) { @@ -1075,12 +980,6 @@ vec_all_in(vector float a, vector float b) /* 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) { @@ -1125,12 +1024,6 @@ vec_all_le(vector float a, vector float b) /* 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) { @@ -1183,22 +1076,16 @@ vec_all_nan(vector float a) /* 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 @@ vec_all_ne(vector short a, vector short b) 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 @@ vec_all_ne(vector int a, vector int b) 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 @@ -1273,22 +1160,16 @@ vec_all_numeric(vector float a) /* 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 @@ vec_any_eq(vector short a, vector short b) 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 @@ vec_any_eq(vector int a, vector int b) 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 @@ -1323,12 +1204,6 @@ vec_any_eq(vector float a, vector float b) /* 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) { @@ -1373,12 +1248,6 @@ vec_any_ge(vector float a, vector float b) /* 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) { @@ -1423,12 +1292,6 @@ vec_any_gt(vector float a, vector float b) /* 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) { @@ -1473,12 +1336,6 @@ vec_any_le(vector float a, vector float b) /* 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) { @@ -1531,22 +1388,16 @@ vec_any_nan(vector float a) /* 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 @@ vec_any_ne(vector short a, vector short b) 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 @@ vec_any_ne(vector int a, vector int b) 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 diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c index 32693be714..04249cc1ee 100644 --- a/test/CodeGen/builtins-ppc-altivec.c +++ b/test/CodeGen/builtins-ppc-altivec.c @@ -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 @@ int main () 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 @@ int main () // 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () /* 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 @@ int main () /* 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 @@ int main () /* 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 @@ int main () 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 diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp index 61ccecec22..7f7a9d2df6 100644 --- a/test/Parser/cxx-altivec.cpp +++ b/test/Parser/cxx-altivec.cpp @@ -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;