From: Ziemowit Laski Date: Thu, 4 Mar 2004 23:19:29 +0000 (+0000) Subject: PR c++/14425, c++/14426 X-Git-Tag: releases/gcc-4.0.0~9618 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9e4e5d1c051b8e1316aae6a85d146804fa36df6;p=thirdparty%2Fgcc.git PR c++/14425, c++/14426 [gcc/ChangeLog] 2004-03-04 Ziemowit Laski PR c++/14425, c++/14426 * config/rs6000/altivec.h (vec_splat_s8, vec_splat_s16, vec_splat_s32, vec_splat_u8, vec_splat_u16, vec_splat_u32): Change C++ definitions to accept a 'const int' argument; the prototypes already do. * config/rs6000/rs6000.c (rs6000_common_init_builtins): Rename v4si_ftype_char, v8hi_ftype_char, v16qi_ftype_char, v4sf_ftype_v4si_char, v4si_ftype_v4sf_char, v4si_ftype_v4si_char, v8hi_ftype_v8hi_char, v16qi_ftype_v16qi_char, v16qi_ftype_v16qi_v16qi_char, v8hi_ftype_v8hi_v8hi_char, v4si_ftype_v4si_v4si_char and v4sf_ftype_v4sf_v4sf_char to end in ..._int; change them to accept an int instead of a char as the last parameter. [gcc/testsuite/ChangeLog] 2004-03-04 Ziemowit Laski PR c++/14425, c++/14426 * g++.dg/ext/altivec-4.C: New test. * g++.dg/ext/altivec-5.C: New test. From-SVN: r78940 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d72dbf6899dc..2495b339f077 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2004-03-04 Ziemowit Laski + + PR c++/14425, c++/14426 + * config/rs6000/altivec.h (vec_splat_s8, vec_splat_s16, + vec_splat_s32, vec_splat_u8, vec_splat_u16, vec_splat_u32): + Change C++ definitions to accept a 'const int' argument; + the prototypes already do. + * config/rs6000/rs6000.c (rs6000_common_init_builtins): + Rename v4si_ftype_char, v8hi_ftype_char, v16qi_ftype_char, + v4sf_ftype_v4si_char, v4si_ftype_v4sf_char, v4si_ftype_v4si_char, + v8hi_ftype_v8hi_char, v16qi_ftype_v16qi_char, + v16qi_ftype_v16qi_v16qi_char, v8hi_ftype_v8hi_v8hi_char, + v4si_ftype_v4si_v4si_char and v4sf_ftype_v4sf_v4sf_char to + end in ..._int; change them to accept an int instead of a char + as the last parameter. + 2004-03-04 Phil Edwards * genmultilib: Change '=' to '-' when translating option names diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h index 42779c591fdf..2ae567ef3d4a 100644 --- a/gcc/config/rs6000/altivec.h +++ b/gcc/config/rs6000/altivec.h @@ -4613,7 +4613,7 @@ vec_vspltb (vector unsigned char a1, const int a2) /* vec_splat_s8 */ inline vector signed char -vec_splat_s8 (const signed char a1) +vec_splat_s8 (const int a1) { return (vector signed char) __builtin_altivec_vspltisb (a1); } @@ -4621,7 +4621,7 @@ vec_splat_s8 (const signed char a1) /* vec_splat_s16 */ inline vector signed short -vec_splat_s16 (const signed char a1) +vec_splat_s16 (const int a1) { return (vector signed short) __builtin_altivec_vspltish (a1); } @@ -4629,7 +4629,7 @@ vec_splat_s16 (const signed char a1) /* vec_splat_s32 */ inline vector signed int -vec_splat_s32 (const signed char a1) +vec_splat_s32 (const int a1) { return (vector signed int) __builtin_altivec_vspltisw (a1); } @@ -4637,7 +4637,7 @@ vec_splat_s32 (const signed char a1) /* vec_splat_u8 */ inline vector unsigned char -vec_splat_u8 (const signed char a1) +vec_splat_u8 (const int a1) { return (vector unsigned char) __builtin_altivec_vspltisb (a1); } @@ -4645,7 +4645,7 @@ vec_splat_u8 (const signed char a1) /* vec_splat_u16 */ inline vector unsigned short -vec_splat_u16 (const signed char a1) +vec_splat_u16 (const int a1) { return (vector unsigned short) __builtin_altivec_vspltish (a1); } @@ -4653,7 +4653,7 @@ vec_splat_u16 (const signed char a1) /* vec_splat_u32 */ inline vector unsigned int -vec_splat_u32 (const signed char a1) +vec_splat_u32 (const int a1) { return (vector unsigned int) __builtin_altivec_vspltisw (a1); } diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 3466590fd570..b9d9ff4fa0cd 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7015,12 +7015,12 @@ rs6000_common_init_builtins (void) = build_function_type_list (V16QI_type_node, V16QI_type_node, V16QI_type_node, V16QI_type_node, NULL_TREE); - tree v4si_ftype_char - = build_function_type_list (V4SI_type_node, char_type_node, NULL_TREE); - tree v8hi_ftype_char - = build_function_type_list (V8HI_type_node, char_type_node, NULL_TREE); - tree v16qi_ftype_char - = build_function_type_list (V16QI_type_node, char_type_node, NULL_TREE); + tree v4si_ftype_int + = build_function_type_list (V4SI_type_node, integer_type_node, NULL_TREE); + tree v8hi_ftype_int + = build_function_type_list (V8HI_type_node, integer_type_node, NULL_TREE); + tree v16qi_ftype_int + = build_function_type_list (V16QI_type_node, integer_type_node, NULL_TREE); tree v8hi_ftype_v16qi = build_function_type_list (V8HI_type_node, V16QI_type_node, NULL_TREE); tree v4sf_ftype_v4sf @@ -7078,37 +7078,37 @@ rs6000_common_init_builtins (void) tree v4si_ftype_v4si_v4si = build_function_type_list (V4SI_type_node, V4SI_type_node, V4SI_type_node, NULL_TREE); - tree v4sf_ftype_v4si_char + tree v4sf_ftype_v4si_int = build_function_type_list (V4SF_type_node, - V4SI_type_node, char_type_node, NULL_TREE); - tree v4si_ftype_v4sf_char + V4SI_type_node, integer_type_node, NULL_TREE); + tree v4si_ftype_v4sf_int = build_function_type_list (V4SI_type_node, - V4SF_type_node, char_type_node, NULL_TREE); - tree v4si_ftype_v4si_char + V4SF_type_node, integer_type_node, NULL_TREE); + tree v4si_ftype_v4si_int = build_function_type_list (V4SI_type_node, - V4SI_type_node, char_type_node, NULL_TREE); - tree v8hi_ftype_v8hi_char + V4SI_type_node, integer_type_node, NULL_TREE); + tree v8hi_ftype_v8hi_int = build_function_type_list (V8HI_type_node, - V8HI_type_node, char_type_node, NULL_TREE); - tree v16qi_ftype_v16qi_char + V8HI_type_node, integer_type_node, NULL_TREE); + tree v16qi_ftype_v16qi_int = build_function_type_list (V16QI_type_node, - V16QI_type_node, char_type_node, NULL_TREE); - tree v16qi_ftype_v16qi_v16qi_char + V16QI_type_node, integer_type_node, NULL_TREE); + tree v16qi_ftype_v16qi_v16qi_int = build_function_type_list (V16QI_type_node, V16QI_type_node, V16QI_type_node, - char_type_node, NULL_TREE); - tree v8hi_ftype_v8hi_v8hi_char + integer_type_node, NULL_TREE); + tree v8hi_ftype_v8hi_v8hi_int = build_function_type_list (V8HI_type_node, V8HI_type_node, V8HI_type_node, - char_type_node, NULL_TREE); - tree v4si_ftype_v4si_v4si_char + integer_type_node, NULL_TREE); + tree v4si_ftype_v4si_v4si_int = build_function_type_list (V4SI_type_node, V4SI_type_node, V4SI_type_node, - char_type_node, NULL_TREE); - tree v4sf_ftype_v4sf_v4sf_char + integer_type_node, NULL_TREE); + tree v4sf_ftype_v4sf_v4sf_int = build_function_type_list (V4SF_type_node, V4SF_type_node, V4SF_type_node, - char_type_node, NULL_TREE); + integer_type_node, NULL_TREE); tree v4sf_ftype_v4sf_v4sf = build_function_type_list (V4SF_type_node, V4SF_type_node, V4SF_type_node, NULL_TREE); @@ -7251,22 +7251,22 @@ rs6000_common_init_builtins (void) /* vchar, vchar, vchar, 4 bit literal. */ else if (mode0 == V16QImode && mode1 == mode0 && mode2 == mode0 && mode3 == QImode) - type = v16qi_ftype_v16qi_v16qi_char; + type = v16qi_ftype_v16qi_v16qi_int; /* vshort, vshort, vshort, 4 bit literal. */ else if (mode0 == V8HImode && mode1 == mode0 && mode2 == mode0 && mode3 == QImode) - type = v8hi_ftype_v8hi_v8hi_char; + type = v8hi_ftype_v8hi_v8hi_int; /* vint, vint, vint, 4 bit literal. */ else if (mode0 == V4SImode && mode1 == mode0 && mode2 == mode0 && mode3 == QImode) - type = v4si_ftype_v4si_v4si_char; + type = v4si_ftype_v4si_v4si_int; /* vfloat, vfloat, vfloat, 4 bit literal. */ else if (mode0 == V4SFmode && mode1 == mode0 && mode2 == mode0 && mode3 == QImode) - type = v4sf_ftype_v4sf_v4sf_char; + type = v4sf_ftype_v4sf_v4sf_int; else abort (); @@ -7355,23 +7355,23 @@ rs6000_common_init_builtins (void) /* vint, vint, 5 bit literal. */ else if (mode0 == V4SImode && mode1 == V4SImode && mode2 == QImode) - type = v4si_ftype_v4si_char; + type = v4si_ftype_v4si_int; /* vshort, vshort, 5 bit literal. */ else if (mode0 == V8HImode && mode1 == V8HImode && mode2 == QImode) - type = v8hi_ftype_v8hi_char; + type = v8hi_ftype_v8hi_int; /* vchar, vchar, 5 bit literal. */ else if (mode0 == V16QImode && mode1 == V16QImode && mode2 == QImode) - type = v16qi_ftype_v16qi_char; + type = v16qi_ftype_v16qi_int; /* vfloat, vint, 5 bit literal. */ else if (mode0 == V4SFmode && mode1 == V4SImode && mode2 == QImode) - type = v4sf_ftype_v4si_char; + type = v4sf_ftype_v4si_int; /* vint, vfloat, 5 bit literal. */ else if (mode0 == V4SImode && mode1 == V4SFmode && mode2 == QImode) - type = v4si_ftype_v4sf_char; + type = v4si_ftype_v4sf_int; else if (mode0 == V2SImode && mode1 == SImode && mode2 == SImode) type = v2si_ftype_int_int; @@ -7424,11 +7424,11 @@ rs6000_common_init_builtins (void) mode1 = insn_data[d->icode].operand[1].mode; if (mode0 == V4SImode && mode1 == QImode) - type = v4si_ftype_char; + type = v4si_ftype_int; else if (mode0 == V8HImode && mode1 == QImode) - type = v8hi_ftype_char; + type = v8hi_ftype_int; else if (mode0 == V16QImode && mode1 == QImode) - type = v16qi_ftype_char; + type = v16qi_ftype_int; else if (mode0 == V4SFmode && mode1 == V4SFmode) type = v4sf_ftype_v4sf; else if (mode0 == V8HImode && mode1 == V16QImode) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b730c64f0df..bd7dfe54716c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-03-04 Ziemowit Laski + + PR c++/14425, c++/14426 + * g++.dg/ext/altivec-4.C: New test. + * g++.dg/ext/altivec-5.C: New test. + 2004-03-04 Geoffrey Keating * g++.old-deja/g++.other/linkage1.C: Expect errors about diff --git a/gcc/testsuite/g++.dg/ext/altivec-4.C b/gcc/testsuite/g++.dg/ext/altivec-4.C new file mode 100644 index 000000000000..f6d84620810f --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-4.C @@ -0,0 +1,11 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +/* PR c++/14425 */ + +#include + +vector unsigned int splat0(vector unsigned int x) +{ + return vec_splat(x, 0); +} diff --git a/gcc/testsuite/g++.dg/ext/altivec-5.C b/gcc/testsuite/g++.dg/ext/altivec-5.C new file mode 100644 index 000000000000..213bde00a8e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-5.C @@ -0,0 +1,15 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-maltivec" } */ + +/* PR c++/14426 */ + +#include + +vector unsigned int splat0u() +{ + return vec_splat_u32(0); +} +vector int splat0s() +{ + return vec_splat_s32(0); +}