From: Ziemowit Laski Date: Mon, 10 May 2004 22:21:44 +0000 (+0000) Subject: altivec.h (vec_sld): Add overloads for argument/return types of 'vector bool int'... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16cfa3dc57a18490554abf3d1c02fa5e26c4c669;p=gcc.git altivec.h (vec_sld): Add overloads for argument/return types of 'vector bool int'... [gcc/ChangeLog] 2004-05-10 Ziemowit Laski * config/rs6000/altivec.h (vec_sld): Add overloads for argument/return types of 'vector bool int', 'vector bool short' and 'vector bool char'. [gcc/testsuite/ChangeLog] 2004-05-10 Ziemowit Laski * g++.dg/ext/altivec-8.C: New test case. * gcc.dg/altivec-13.c: New test case. From-SVN: r81681 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43f568264f4..59ac6a1f76a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-05-10 Ziemowit Laski + + * config/rs6000/altivec.h (vec_sld): Add overloads for + argument/return types of 'vector bool int', 'vector bool short' + and 'vector bool char'. + 2004-05-10 Zack Weinberg * c-decl.c (store_parm_decls_newstyle): Correct test for a diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h index 8e07778bb12..8b7edb0ece3 100644 --- a/gcc/config/rs6000/altivec.h +++ b/gcc/config/rs6000/altivec.h @@ -200,11 +200,14 @@ inline void vec_dstt (const float *, int, const int) __attribute__ ((always_inli inline vector float vec_sld (vector float, vector float, const int) __attribute__ ((always_inline)); inline vector signed int vec_sld (vector signed int, vector signed int, const int) __attribute__ ((always_inline)); inline vector unsigned int vec_sld (vector unsigned int, vector unsigned int, const int) __attribute__ ((always_inline)); +inline vector bool int vec_sld (vector bool int, vector bool int, const int) __attribute__ ((always_inline)); inline vector signed short vec_sld (vector signed short, vector signed short, const int) __attribute__ ((always_inline)); inline vector unsigned short vec_sld (vector unsigned short, vector unsigned short, const int) __attribute__ ((always_inline)); +inline vector bool short vec_sld (vector bool short, vector bool short, const int) __attribute__ ((always_inline)); inline vector pixel vec_sld (vector pixel, vector pixel, const int) __attribute__ ((always_inline)); inline vector signed char vec_sld (vector signed char, vector signed char, const int) __attribute__ ((always_inline)); inline vector unsigned char vec_sld (vector unsigned char, vector unsigned char, const int) __attribute__ ((always_inline)); +inline vector bool char vec_sld (vector bool char, vector bool char, const int) __attribute__ ((always_inline)); inline vector signed char vec_splat (vector signed char, const int) __attribute__ ((always_inline)); inline vector unsigned char vec_splat (vector unsigned char, const int) __attribute__ ((always_inline)); inline vector bool char vec_splat (vector bool char, const int) __attribute__ ((always_inline)); @@ -4196,6 +4199,12 @@ vec_sld (vector unsigned int a1, vector unsigned int a2, const int a3) return (vector unsigned int) __builtin_altivec_vsldoi_4si ((vector signed int) a1, (vector signed int) a2, a3); } +inline vector bool int +vec_sld (vector bool int a1, vector bool int a2, const int a3) +{ + return (vector bool int) __builtin_altivec_vsldoi_4si ((vector signed int) a1, (vector signed int) a2, a3); +} + inline vector signed short vec_sld (vector signed short a1, vector signed short a2, const int a3) { @@ -4208,6 +4217,12 @@ vec_sld (vector unsigned short a1, vector unsigned short a2, const int a3) return (vector unsigned short) __builtin_altivec_vsldoi_4si ((vector signed int) a1, (vector signed int) a2, a3); } +inline vector bool short +vec_sld (vector bool short a1, vector bool short a2, const int a3) +{ + return (vector bool short) __builtin_altivec_vsldoi_4si ((vector signed int) a1, (vector signed int) a2, a3); +} + inline vector pixel vec_sld (vector pixel a1, vector pixel a2, const int a3) { @@ -4226,6 +4241,12 @@ vec_sld (vector unsigned char a1, vector unsigned char a2, const int a3) return (vector unsigned char) __builtin_altivec_vsldoi_4si ((vector signed int) a1, (vector signed int) a2, a3); } +inline vector bool char +vec_sld (vector bool char a1, vector bool char a2, const int a3) +{ + return (vector bool char) __builtin_altivec_vsldoi_4si ((vector signed int) a1, (vector signed int) a2, a3); +} + /* vec_sll */ inline vector signed int @@ -9534,17 +9555,23 @@ __ch (__tern_args_eq (vector signed int, (a1), vector signed int, (a2), int, (a3 ((vector signed int) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ __ch (__tern_args_eq (vector unsigned int, (a1), vector unsigned int, (a2), int, (a3)), \ ((vector unsigned int) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ +__ch (__tern_args_eq (vector bool int, (a1), vector bool int, (a2), int, (a3)), \ + ((vector bool int) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ __ch (__tern_args_eq (vector signed short, (a1), vector signed short, (a2), int, (a3)), \ ((vector signed short) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ __ch (__tern_args_eq (vector unsigned short, (a1), vector unsigned short, (a2), int, (a3)), \ ((vector unsigned short) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ +__ch (__tern_args_eq (vector bool short, (a1), vector bool short, (a2), int, (a3)), \ + ((vector bool short) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ __ch (__tern_args_eq (vector pixel, (a1), vector pixel, (a2), int, (a3)), \ ((vector pixel) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ __ch (__tern_args_eq (vector signed char, (a1), vector signed char, (a2), int, (a3)), \ ((vector signed char) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ __ch (__tern_args_eq (vector unsigned char, (a1), vector unsigned char, (a2), int, (a3)), \ ((vector unsigned char) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ - __builtin_altivec_compiletime_error ("vec_sld"))))))))) +__ch (__tern_args_eq (vector bool char, (a1), vector bool char, (a2), int, (a3)), \ + ((vector bool char) __builtin_altivec_vsldoi_4si ((vector signed int) (a1), (vector signed int) (a2), (const int) (a3))), \ + __builtin_altivec_compiletime_error ("vec_sld")))))))))))) #define vec_sll(a1, a2) \ __ch (__bin_args_eq (vector signed int, (a1), vector unsigned int, (a2)), \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 09ca29ab2a7..43dfa3b1e9c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-05-10 Ziemowit Laski + + * g++.dg/ext/altivec-8.C: New test case. + * gcc.dg/altivec-13.c: New test case. + 2004-05-08 Roger Sayle * gcc.c-torture/execute/divcmp-1.c: New test case. diff --git a/gcc/testsuite/g++.dg/ext/altivec-8.C b/gcc/testsuite/g++.dg/ext/altivec-8.C new file mode 100644 index 00000000000..298e6100559 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-8.C @@ -0,0 +1,16 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ +/* Author: Ziemowit Laski */ + +/* This test case exercises intrinsic/argument combinations that, + while not in the Motorola AltiVec PIM, have nevertheless crept + into the AltiVec vernacular over the years. */ + +void foo() { + vector bool int boolVec1 = (vector bool int) vec_splat_u32(3); + vector bool short boolVec2 = (vector bool short) vec_splat_u16(3); + vector bool char boolVec3 = (vector bool char) vec_splat_u8(3); + boolVec1 = vec_sld( boolVec1, boolVec1, 4 ); + boolVec2 = vec_sld( boolVec2, boolVec2, 2 ); + boolVec3 = vec_sld( boolVec3, boolVec3, 1 ); +} diff --git a/gcc/testsuite/gcc.dg/altivec-13.c b/gcc/testsuite/gcc.dg/altivec-13.c new file mode 100644 index 00000000000..298e6100559 --- /dev/null +++ b/gcc/testsuite/gcc.dg/altivec-13.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-options "-faltivec" } */ +/* Author: Ziemowit Laski */ + +/* This test case exercises intrinsic/argument combinations that, + while not in the Motorola AltiVec PIM, have nevertheless crept + into the AltiVec vernacular over the years. */ + +void foo() { + vector bool int boolVec1 = (vector bool int) vec_splat_u32(3); + vector bool short boolVec2 = (vector bool short) vec_splat_u16(3); + vector bool char boolVec3 = (vector bool char) vec_splat_u8(3); + boolVec1 = vec_sld( boolVec1, boolVec1, 4 ); + boolVec2 = vec_sld( boolVec2, boolVec2, 2 ); + boolVec3 = vec_sld( boolVec3, boolVec3, 1 ); +}