[cfe-commits] r111509 - in /cfe/trunk: lib/Headers/altivec.h test/CodeGen/builtins-ppc-altivec.c

Anton Yartsev anton.yartsev at gmail.com
Wed Aug 18 20:00:09 PDT 2010


Author: ayartsev
Date: Wed Aug 18 22:00:09 2010
New Revision: 111509

URL: http://llvm.org/viewvc/llvm-project?rev=111509&view=rev
Log:
support for vec_perm and all dependent functions (vec_mergeh, vec_mergel, vec_pack, vec_sld, vec_splat) with bool/pixel arguments and return values

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

Modified: cfe/trunk/lib/Headers/altivec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=111509&r1=111508&r2=111509&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/altivec.h (original)
+++ cfe/trunk/lib/Headers/altivec.h Wed Aug 18 22:00:09 2010
@@ -45,18 +45,30 @@
 static vector unsigned char __ATTRS_o_ai
 vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c);
 
+static vector bool char __ATTRS_o_ai
+vec_perm(vector bool char a, vector bool char b, vector unsigned char c);
+
 static vector short __ATTRS_o_ai
 vec_perm(vector short a, vector short b, vector unsigned char c);
 
 static vector unsigned short __ATTRS_o_ai
 vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c);
 
+static vector bool short __ATTRS_o_ai
+vec_perm(vector bool short a, vector bool short b, vector unsigned char c);
+
+static vector pixel __ATTRS_o_ai
+vec_perm(vector pixel a, vector pixel b, vector unsigned char c);
+
 static vector int __ATTRS_o_ai
 vec_perm(vector int a, vector int b, vector unsigned char c);
 
 static vector unsigned int __ATTRS_o_ai
 vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c);
 
+static vector bool int __ATTRS_o_ai
+vec_perm(vector bool int a, vector bool int b, vector unsigned char c);
+
 static vector float __ATTRS_o_ai
 vec_perm(vector float a, vector float b, vector unsigned char c);
 
@@ -2368,6 +2380,14 @@
      0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
 }
 
+static vector bool char __ATTRS_o_ai
+vec_mergeh(vector bool char a, vector bool char b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, 
+     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
+}
+
 static vector short __ATTRS_o_ai
 vec_mergeh(vector short a, vector short b)
 {
@@ -2384,6 +2404,22 @@
      0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
 }
 
+static vector bool short __ATTRS_o_ai
+vec_mergeh(vector bool short a, vector bool short b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
+     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_mergeh(vector pixel a, vector pixel b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
+     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
+}
+
 static vector int __ATTRS_o_ai
 vec_mergeh(vector int a, vector int b)
 {
@@ -2400,6 +2436,14 @@
      0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
 }
 
+static vector bool int __ATTRS_o_ai
+vec_mergeh(vector bool int a, vector bool int b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
+     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
+}
+
 static vector float __ATTRS_o_ai
 vec_mergeh(vector float a, vector float b)
 {
@@ -2428,6 +2472,14 @@
      0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
 }
 
+static vector bool char __ATTRS_o_ai
+vec_vmrghb(vector bool char a, vector bool char b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, 
+     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
+}
+
 /* vec_vmrghh */
 
 #define __builtin_altivec_vmrghh vec_vmrghh
@@ -2448,6 +2500,22 @@
      0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
 }
 
+static vector bool short __ATTRS_o_ai
+vec_vmrghh(vector bool short a, vector bool short b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
+     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_vmrghh(vector pixel a, vector pixel b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
+     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
+}
+
 /* vec_vmrghw */
 
 #define __builtin_altivec_vmrghw vec_vmrghw
@@ -2468,6 +2536,14 @@
      0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
 }
 
+static vector bool int __ATTRS_o_ai
+vec_vmrghw(vector bool int a, vector bool int b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
+     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
+}
+
 static vector float __ATTRS_o_ai
 vec_vmrghw(vector float a, vector float b)
 {
@@ -2494,6 +2570,14 @@
      0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
 }
 
+static vector bool char __ATTRS_o_ai
+vec_mergel(vector bool char a, vector bool char b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, 
+     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
+}
+
 static vector short __ATTRS_o_ai
 vec_mergel(vector short a, vector short b)
 {
@@ -2510,6 +2594,22 @@
      0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
 }
 
+static vector bool short __ATTRS_o_ai
+vec_mergel(vector bool short a, vector bool short b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
+     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_mergel(vector pixel a, vector pixel b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
+     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
+}
+
 static vector int __ATTRS_o_ai
 vec_mergel(vector int a, vector int b)
 {
@@ -2526,6 +2626,14 @@
      0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
 }
 
+static vector bool int __ATTRS_o_ai
+vec_mergel(vector bool int a, vector bool int b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
+     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
+}
+
 static vector float __ATTRS_o_ai
 vec_mergel(vector float a, vector float b)
 {
@@ -2554,6 +2662,14 @@
      0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
 }
 
+static vector bool char __ATTRS_o_ai
+vec_vmrglb(vector bool char a, vector bool char b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, 
+     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
+}
+
 /* vec_vmrglh */
 
 #define __builtin_altivec_vmrglh vec_vmrglh
@@ -2574,6 +2690,22 @@
      0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
 }
 
+static vector bool short __ATTRS_o_ai
+vec_vmrglh(vector bool short a, vector bool short b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
+     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_vmrglh(vector pixel a, vector pixel b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
+     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
+}
+
 /* vec_vmrglw */
 
 #define __builtin_altivec_vmrglw vec_vmrglw
@@ -2594,6 +2726,14 @@
      0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
 }
 
+static vector bool int __ATTRS_o_ai
+vec_vmrglw(vector bool int a, vector bool int b)
+{
+  return vec_perm(a, b, (vector unsigned char)
+    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
+     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
+}
+
 static vector float __ATTRS_o_ai
 vec_vmrglw(vector float a, vector float b)
 {
@@ -3246,6 +3386,14 @@
      0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
 }
 
+static vector bool char __ATTRS_o_ai
+vec_pack(vector bool short a, vector bool short b)
+{
+  return (vector bool char)vec_perm(a, b, (vector unsigned char)
+    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
+     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
+}
+
 static vector short __ATTRS_o_ai
 vec_pack(vector int a, vector int b)
 {
@@ -3262,6 +3410,14 @@
      0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
 }
 
+static vector bool short __ATTRS_o_ai
+vec_pack(vector bool int a, vector bool int b)
+{
+  return (vector bool short)vec_perm(a, b, (vector unsigned char)
+    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
+     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
+}
+
 /* vec_vpkuhum */
 
 #define __builtin_altivec_vpkuhum vec_vpkuhum
@@ -3282,6 +3438,14 @@
      0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
 }
 
+static vector bool char __ATTRS_o_ai
+vec_vpkuhum(vector bool short a, vector bool short b)
+{
+  return (vector bool char)vec_perm(a, b, (vector unsigned char)
+    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
+     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
+}
+
 /* vec_vpkuwum */
 
 #define __builtin_altivec_vpkuwum vec_vpkuwum
@@ -3302,6 +3466,14 @@
      0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
 }
 
+static vector bool short __ATTRS_o_ai
+vec_vpkuwum(vector bool int a, vector bool int b)
+{
+  return (vector bool short)vec_perm(a, b, (vector unsigned char)
+    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
+     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
+}
+
 /* vec_packpx */
 
 static vector pixel __attribute__((__always_inline__))
@@ -3444,6 +3616,12 @@
   return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
 }
 
+vector bool char __ATTRS_o_ai
+vec_perm(vector bool char a, vector bool char b, vector unsigned char c)
+{
+  return (vector bool char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
 vector short __ATTRS_o_ai
 vec_perm(vector short a, vector short b, vector unsigned char c)
 {
@@ -3456,6 +3634,18 @@
   return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
 }
 
+vector bool short __ATTRS_o_ai
+vec_perm(vector bool short a, vector bool short b, vector unsigned char c)
+{
+  return (vector bool short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
+vector pixel __ATTRS_o_ai
+vec_perm(vector pixel a, vector pixel b, vector unsigned char c)
+{
+  return (vector pixel)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
 vector int __ATTRS_o_ai
 vec_perm(vector int a, vector int b, vector unsigned char c)
 {
@@ -3468,6 +3658,12 @@
   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
 }
 
+vector bool int __ATTRS_o_ai
+vec_perm(vector bool int a, vector bool int b, vector unsigned char c)
+{
+  return (vector bool int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
 vector float __ATTRS_o_ai
 vec_perm(vector float a, vector float b, vector unsigned char c)
 {
@@ -3488,6 +3684,12 @@
   return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
 }
 
+vector bool char __ATTRS_o_ai
+vec_vperm(vector bool char a, vector bool char b, vector unsigned char c)
+{
+  return (vector bool char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
 vector short __ATTRS_o_ai
 vec_vperm(vector short a, vector short b, vector unsigned char c)
 {
@@ -3500,6 +3702,18 @@
   return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
 }
 
+vector bool short __ATTRS_o_ai
+vec_vperm(vector bool short a, vector bool short b, vector unsigned char c)
+{
+  return (vector bool short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
+vector pixel __ATTRS_o_ai
+vec_vperm(vector pixel a, vector pixel b, vector unsigned char c)
+{
+  return (vector pixel)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
 vector int __ATTRS_o_ai
 vec_vperm(vector int a, vector int b, vector unsigned char c)
 {
@@ -3512,6 +3726,12 @@
   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
 }
 
+vector bool int __ATTRS_o_ai
+vec_vperm(vector bool int a, vector bool int b, vector unsigned char c)
+{
+  return (vector bool int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);
+}
+
 vector float __ATTRS_o_ai
 vec_vperm(vector float a, vector float b, vector unsigned char c)
 {
@@ -3831,7 +4051,7 @@
 static vector signed char __ATTRS_o_ai
 vec_sld(vector signed char a, vector signed char b, unsigned char c)
 {
-  return (vector signed char)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3839,7 +4059,7 @@
 static vector unsigned char __ATTRS_o_ai
 vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c)
 {
-  return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3847,7 +4067,7 @@
 static vector short __ATTRS_o_ai
 vec_sld(vector short a, vector short b, unsigned char c)
 {
-  return (vector short)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3855,7 +4075,15 @@
 static vector unsigned short __ATTRS_o_ai
 vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c)
 {
-  return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
+    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
+     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_sld(vector pixel a, vector pixel b, unsigned char c)
+{
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3871,7 +4099,7 @@
 static vector unsigned int __ATTRS_o_ai
 vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c)
 {
-  return (vector unsigned int)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3879,7 +4107,7 @@
 static vector float __ATTRS_o_ai
 vec_sld(vector float a, vector float b, unsigned char c)
 {
-  return (vector float)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3889,7 +4117,7 @@
 static vector signed char __ATTRS_o_ai
 vec_vsldoi(vector signed char a, vector signed char b, unsigned char c)
 {
-  return (vector signed char)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3897,7 +4125,7 @@
 static vector unsigned char __ATTRS_o_ai
 vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c)
 {
-  return (vector unsigned char)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3905,7 +4133,7 @@
 static vector short __ATTRS_o_ai
 vec_vsldoi(vector short a, vector short b, unsigned char c)
 {
-  return (vector short)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3913,7 +4141,15 @@
 static vector unsigned short __ATTRS_o_ai
 vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c)
 {
-  return (vector unsigned short)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
+    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
+     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_vsldoi(vector pixel a, vector pixel b, unsigned char c)
+{
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3929,7 +4165,7 @@
 static vector unsigned int __ATTRS_o_ai
 vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c)
 {
-  return (vector unsigned int)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -3937,7 +4173,7 @@
 static vector float __ATTRS_o_ai
 vec_vsldoi(vector float a, vector float b, unsigned char c)
 {
-  return (vector float)vec_perm(a, b, (vector unsigned char)
+  return vec_perm(a, b, (vector unsigned char)
     (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, 
      c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));
 }
@@ -4339,20 +4575,26 @@
 static vector signed char __ATTRS_o_ai
 vec_splat(vector signed char a, unsigned char b)
 {
-  return (vector signed char)vec_perm(a, a, (vector unsigned char)(b));
+  return vec_perm(a, a, (vector unsigned char)(b));
 }
 
 static vector unsigned char __ATTRS_o_ai
 vec_splat(vector unsigned char a, unsigned char b)
 {
-  return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b));
+  return vec_perm(a, a, (vector unsigned char)(b));
+}
+
+static vector bool char __ATTRS_o_ai
+vec_splat(vector bool char a, unsigned char b)
+{
+  return vec_perm(a, a, (vector unsigned char)(b));
 }
 
 static vector short __ATTRS_o_ai
 vec_splat(vector short a, unsigned char b)
 { 
   b *= 2;
-  return (vector short)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
 }
 
@@ -4360,7 +4602,23 @@
 vec_splat(vector unsigned short a, unsigned char b)
 { 
   b *= 2;
-  return (vector unsigned short)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
+    (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
+}
+
+static vector bool short __ATTRS_o_ai
+vec_splat(vector bool short a, unsigned char b)
+{ 
+  b *= 2;
+  return vec_perm(a, a, (vector unsigned char)
+    (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_splat(vector pixel a, unsigned char b)
+{ 
+  b *= 2;
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
 }
 
@@ -4376,7 +4634,15 @@
 vec_splat(vector unsigned int a, unsigned char b)
 { 
   b *= 4;
-  return (vector unsigned int)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
+    (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
+}
+
+static vector bool int __ATTRS_o_ai
+vec_splat(vector bool int a, unsigned char b)
+{ 
+  b *= 4;
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
 }
 
@@ -4384,7 +4650,7 @@
 vec_splat(vector float a, unsigned char b)
 { 
   b *= 4;
-  return (vector float)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
 }
 
@@ -4395,13 +4661,19 @@
 static vector signed char __ATTRS_o_ai
 vec_vspltb(vector signed char a, unsigned char b)
 {
-  return (vector signed char)vec_perm(a, a, (vector unsigned char)(b));
+  return vec_perm(a, a, (vector unsigned char)(b));
 }
 
 static vector unsigned char __ATTRS_o_ai
 vec_vspltb(vector unsigned char a, unsigned char b)
 {
-  return (vector unsigned char)vec_perm(a, a, (vector unsigned char)(b));
+  return vec_perm(a, a, (vector unsigned char)(b));
+}
+
+static vector bool char __ATTRS_o_ai
+vec_vspltb(vector bool char a, unsigned char b)
+{
+  return vec_perm(a, a, (vector unsigned char)(b));
 }
 
 /* vec_vsplth */
@@ -4412,7 +4684,7 @@
 vec_vsplth(vector short a, unsigned char b)
 {
   b *= 2;
-  return (vector short)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
 }
 
@@ -4420,7 +4692,23 @@
 vec_vsplth(vector unsigned short a, unsigned char b)
 {
   b *= 2;
-  return (vector unsigned short)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
+    (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
+}
+
+static vector bool short __ATTRS_o_ai
+vec_vsplth(vector bool short a, unsigned char b)
+{
+  b *= 2;
+  return vec_perm(a, a, (vector unsigned char)
+    (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
+}
+
+static vector pixel __ATTRS_o_ai
+vec_vsplth(vector pixel a, unsigned char b)
+{
+  b *= 2;
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1));
 }
 
@@ -4432,7 +4720,7 @@
 vec_vspltw(vector int a, unsigned char b)
 {
   b *= 4;
-  return (vector int)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
 }
 
@@ -4440,7 +4728,15 @@
 vec_vspltw(vector unsigned int a, unsigned char b)
 {
   b *= 4;
-  return (vector unsigned int)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
+    (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
+}
+
+static vector bool int __ATTRS_o_ai
+vec_vspltw(vector bool int a, unsigned char b)
+{
+  b *= 4;
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
 }
 
@@ -4448,7 +4744,7 @@
 vec_vspltw(vector float a, unsigned char b)
 {
   b *= 4;
-  return (vector float)vec_perm(a, a, (vector unsigned char)
+  return vec_perm(a, a, (vector unsigned char)
     (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3));
 }
 

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=111509&r1=111508&r2=111509&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-ppc-altivec.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-altivec.c Wed Aug 18 22:00:09 2010
@@ -6,6 +6,7 @@
 vector bool short vbs = { 1, 0, 1, 0, 1, 0, 1, 0 };
 vector short vs = { -1, 2, -3, 4, -5, 6, -7, 8 };
 vector unsigned short vus = { 1, 2, 3, 4, 5, 6, 7, 8 };
+vector pixel vp = { 1, 2, 3, 4, 5, 6, 7, 8 };
 vector bool int vbi = { 1, 0, 1, 0 };
 vector int vi = { -1, 2, -3, 4 };
 vector unsigned int vui = { 1, 2, 3, 4 };
@@ -550,33 +551,49 @@
   /* vec_mergeh */
   res_vsc = vec_mergeh(vsc, vsc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_mergeh(vuc, vuc);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_mergeh(vbc, vbc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_mergeh(vs, vs);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_mergeh(vp, vp);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_mergeh(vus, vus);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_mergeh(vbs, vbs);               // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_mergeh(vi, vi);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_mergeh(vui, vui);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_mergeh(vbi, vbi);               // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_mergeh(vf, vf);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vsc = vec_vmrghb(vsc, vsc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_vmrghb(vuc, vuc);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_vmrghb(vbc, vbc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_vmrghh(vs, vs);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_vmrghh(vp, vp);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_vmrghh(vus, vus);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_vmrghh(vbs, vbs);               // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_vmrghw(vi, vi);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_vmrghw(vui, vui);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_vmrghw(vbi, vbi);               // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_vmrghw(vf, vf);                 // CHECK: @llvm.ppc.altivec.vperm
 
   /* vec_mergel */
   res_vsc = vec_mergel(vsc, vsc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_mergel(vuc, vuc);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_mergel(vbc, vbc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_mergel(vs, vs);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_mergeh(vp, vp);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_mergel(vus, vus);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_mergel(vbs, vbs);               // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_mergel(vi, vi);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_mergel(vui, vui);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_mergel(vbi, vbi);               // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_mergel(vf, vf);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vsc = vec_vmrglb(vsc, vsc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_vmrglb(vuc, vuc);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_vmrglb(vbc, vbc);               // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_vmrglh(vs, vs);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_vmrglh(vp, vp);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_vmrglh(vus, vus);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_vmrglh(vbs, vbs);               // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_vmrglw(vi, vi);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_vmrglw(vui, vui);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_vmrglw(vbi, vbi);               // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_vmrglw(vf, vf);                 // CHECK: @llvm.ppc.altivec.vperm
 
   /* vec_mfvscr */
@@ -720,12 +737,16 @@
   /* vec_pack */
   res_vsc = vec_pack(vs, vs);                   // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_pack(vus, vus);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_pack(vbs, vbs);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_pack(vi, vi);                   // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_pack(vui, vui);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_pack(vbi, vbi);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vsc = vec_vpkuhum(vs, vs);                // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_vpkuhum(vus, vus);              // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_vpkuhum(vbs, vbs);              // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_vpkuwum(vi, vi);                // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_vpkuwum(vui, vui);              // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_vpkuwum(vbi, vbi);              // CHECK: @llvm.ppc.altivec.vperm
 
   /* vec_packpx */
   res_vp = vec_packpx(vui, vui);                // CHECK: @llvm.ppc.altivec.vpkpx
@@ -754,17 +775,25 @@
   /* vec_perm */
   res_vsc = vec_perm(vsc, vsc, vuc);            // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_perm(vuc, vuc, vuc);            // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_perm(vbc, vbc, vuc);            // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_perm(vs, vs, vuc);              // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_perm(vus, vus, vuc);            // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_perm(vbs, vbs, vuc);            // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_perm(vp, vp, vuc);              // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_perm(vi, vi, vuc);              // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_perm(vui, vui, vuc);            // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_perm(vbi, vbi, vuc);            // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_perm(vf, vf, vuc);              // CHECK: @llvm.ppc.altivec.vperm
   res_vsc = vec_vperm(vsc, vsc, vuc);           // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_vperm(vuc, vuc, vuc);           // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_vperm(vbc, vbc, vuc);           // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_vperm(vs, vs, vuc);             // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_vperm(vus, vus, vuc);           // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_vperm(vbs, vbs, vuc);           // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_vperm(vp, vp, vuc);             // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_vperm(vi, vi, vuc);             // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_vperm(vui, vui, vuc);           // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_vperm(vbi, vbi, vuc);           // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_vperm(vf, vf, vuc);             // CHECK: @llvm.ppc.altivec.vperm
 
   /* vec_re */
@@ -890,6 +919,7 @@
   res_vuc = vec_sld(vuc, vuc, 0);               // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_sld(vs, vs, 0);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_sld(vus, vus, 0);               // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_sld(vp, vp, 0);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_sld(vi, vi, 0);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_sld(vui, vui, 0);               // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_sld(vf, vf, 0);                 // CHECK: @llvm.ppc.altivec.vperm
@@ -897,6 +927,7 @@
   res_vuc = vec_vsldoi(vuc, vuc, 0);            // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_vsldoi(vs, vs, 0);              // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_vsldoi(vus, vus, 0);            // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_vsldoi(vp, vp, 0);              // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_vsldoi(vi, vi, 0);              // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_vsldoi(vui, vui, 0);            // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_vsldoi(vf, vf, 0);              // CHECK: @llvm.ppc.altivec.vperm
@@ -972,17 +1003,25 @@
   /* vec_splat */
   res_vsc = vec_splat(vsc, 0);                  // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_splat(vuc, 0);                  // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_splat(vbc, 0);                  // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_splat(vs, 0);                   // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_splat(vus, 0);                  // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_splat(vbs, 0);                  // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_splat(vp, 0);                   // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_splat(vi, 0);                   // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_splat(vui, 0);                  // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_splat(vbi, 0);                  // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_splat(vf, 0);                   // CHECK: @llvm.ppc.altivec.vperm
   res_vsc = vec_vspltb(vsc, 0);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vuc = vec_vspltb(vuc, 0);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vbc = vec_vspltb(vbc, 0);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vs  = vec_vsplth(vs, 0);                  // CHECK: @llvm.ppc.altivec.vperm
   res_vus = vec_vsplth(vus, 0);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vbs = vec_vsplth(vbs, 0);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vp  = vec_vsplth(vp, 0);                  // CHECK: @llvm.ppc.altivec.vperm
   res_vi  = vec_vspltw(vi, 0);                  // CHECK: @llvm.ppc.altivec.vperm
   res_vui = vec_vspltw(vui, 0);                 // CHECK: @llvm.ppc.altivec.vperm
+  res_vbi = vec_vspltw(vbi, 0);                 // CHECK: @llvm.ppc.altivec.vperm
   res_vf  = vec_vspltw(vf, 0);                  // CHECK: @llvm.ppc.altivec.vperm
 
   /* vec_splat_s8 */





More information about the cfe-commits mailing list