altivec.h (vec_step_help): Support const vector types.
authorJanis Johnson <janis187@us.ibm.com>
Tue, 30 Nov 2004 19:15:38 +0000 (19:15 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Tue, 30 Nov 2004 19:15:38 +0000 (19:15 +0000)
* config/rs6000/altivec.h (vec_step_help): Support const vector types.
* g++.dg/ext/altivec-13.C: New test.

From-SVN: r91533

gcc/ChangeLog
gcc/config/rs6000/altivec.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/altivec-13.C [new file with mode: 0644]

index 98e8238932770d9a4fb20be91611ae129aeaec93..302ba113349a5f90fc9d5ecacf3d7490f594dda3 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-30  Janis Johnson  <janis187@us.ibm.com>
+
+       * config/rs6000/altivec.h (vec_step_help): Support const vector types.
+
 2004-11-30  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR tree-opt/18298
index b708d28defd4a6125a8b3e103a21e53e149db35d..0447d9e1fc4c4e787322cd9bc35b47e991dad6a2 100644 (file)
@@ -246,67 +246,133 @@ struct __vec_step_help
 };
 
 template<>
-struct __vec_step_help<vector signed short>
+struct __vec_step_help<__vector signed short>
 {
   static const int _S_elem = 8;
 };
 
 template<>
-struct __vec_step_help<vector unsigned short>
+struct __vec_step_help<const __vector signed short>
 {
   static const int _S_elem = 8;
 };
 
 template<>
-struct __vec_step_help<vector bool short>
+struct __vec_step_help<__vector unsigned short>
 {
   static const int _S_elem = 8;
 };
 
 template<>
-struct __vec_step_help<vector pixel>
+struct __vec_step_help<const __vector unsigned short>
 {
   static const int _S_elem = 8;
 };
 
 template<>
-struct __vec_step_help<vector signed int>
+struct __vec_step_help<__vector bool short>
+{
+  static const int _S_elem = 8;
+};
+
+template<>
+struct __vec_step_help<const __vector bool short>
+{
+  static const int _S_elem = 8;
+};
+
+template<>
+struct __vec_step_help<__vector pixel>
+{
+  static const int _S_elem = 8;
+};
+
+template<>
+struct __vec_step_help<const __vector pixel>
+{
+  static const int _S_elem = 8;
+};
+
+template<>
+struct __vec_step_help<__vector signed int>
+{
+  static const int _S_elem = 4;
+};
+
+template<>
+struct __vec_step_help<const __vector signed int>
 {
   static const int _S_elem = 4;
 };
 
 template<>
-struct __vec_step_help<vector unsigned int>
+struct __vec_step_help<__vector unsigned int>
 {
   static const int _S_elem = 4;
 };
 
 template<>
-struct __vec_step_help<vector bool int>
+struct __vec_step_help<const __vector unsigned int>
 {
   static const int _S_elem = 4;
 };
 
 template<>
-struct __vec_step_help<vector unsigned char>
+struct __vec_step_help<__vector bool int>
+{
+  static const int _S_elem = 4;
+};
+
+template<>
+struct __vec_step_help<const __vector bool int>
+{
+  static const int _S_elem = 4;
+};
+
+template<>
+struct __vec_step_help<__vector unsigned char>
 {
   static const int _S_elem = 16;
 };
 
 template<>
-struct __vec_step_help<vector signed char>
+struct __vec_step_help<const __vector unsigned char>
 {
   static const int _S_elem = 16;
 };
 
 template<>
-struct __vec_step_help<vector bool char>
+struct __vec_step_help<__vector signed char>
 {
   static const int _S_elem = 16;
 };
 
 template<>
-struct __vec_step_help<vector float>
+struct __vec_step_help<const __vector signed char>
+{
+  static const int _S_elem = 16;
+};
+
+template<>
+struct __vec_step_help<__vector bool char>
+{
+  static const int _S_elem = 16;
+};
+
+template<>
+struct __vec_step_help<const __vector bool char>
+{
+  static const int _S_elem = 16;
+};
+
+template<>
+struct __vec_step_help<__vector float>
+{
+  static const int _S_elem = 4;
+};
+
+template<>
+struct __vec_step_help<const __vector float>
 {
   static const int _S_elem = 4;
 };
index 8d561ad5c84a6180a77e3d7e58cbed2fa1a8bf93..1d12628ebf09783b6a8a5324fe201ec6b3b96ea8 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-30  Janis Johnson  <janis187@us.ibm.com>
+
+       * g++.dg/ext/altivec-13.C: New test.
+
 2004-11-30  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR tree-opt/18298
diff --git a/gcc/testsuite/g++.dg/ext/altivec-13.C b/gcc/testsuite/g++.dg/ext/altivec-13.C
new file mode 100644 (file)
index 0000000..15ca5cc
--- /dev/null
@@ -0,0 +1,59 @@
+/* Check that vec_step can be used with const vector types.   This
+   test is derived from parts of gcc.dg/vmx/8-02.c from Motorola's
+   AltiVec testsuite.  */
+
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
+/* { dg-options "-maltivec" } */
+                                                                                
+#include <altivec.h>
+
+extern vector unsigned char vuc;
+extern vector signed char vsc;
+extern vector bool char vbc;
+extern vector unsigned short vus;
+extern vector signed short vss;
+extern vector bool short vbs;
+extern vector unsigned int vui;
+extern vector signed int vsi;
+extern vector bool int vbi;
+extern vector pixel vp;
+extern vector float vf;
+extern const vector unsigned char cvuc;
+extern const vector signed char cvsc;
+extern const vector bool char cvbc;
+extern const vector unsigned short cvus;
+extern const vector signed short cvss;
+extern const vector bool short cvbs;
+extern const vector unsigned int cvui;
+extern const vector signed int cvsi;
+extern const vector bool int cvbi;
+extern const vector pixel cvp;
+extern const vector float cvf;
+
+void
+foo (void)
+{
+  int i_vuc = vec_step (vuc);
+  int i_vsc = vec_step (vsc);
+  int i_vbc = vec_step (vbc);
+  int i_vus = vec_step (vus);
+  int i_vss = vec_step (vss);
+  int i_vbs = vec_step (vbs);
+  int i_vui = vec_step (vui);
+  int i_vsi = vec_step (vsi);
+  int i_vbi = vec_step (vbi);
+  int i_vp = vec_step (vp);
+  int i_vf = vec_step (vf);
+  int i_cvuc = vec_step (cvuc);
+  int i_cvsc = vec_step (cvsc);
+  int i_cvbc = vec_step (cvbc);
+  int i_cvus = vec_step (cvus);
+  int i_cvss = vec_step (cvss);
+  int i_cvbs = vec_step (cvbs);
+  int i_cvui = vec_step (cvui);
+  int i_cvsi = vec_step (cvsi);
+  int i_cvbi = vec_step (cvbi);
+  int i_cvp = vec_step (cvp);
+  int i_cvf = vec_step (cvf);
+}