diff options
author | Anton Yartsev <anton.yartsev@gmail.com> | 2010-08-19 03:00:09 +0000 |
---|---|---|
committer | Anton Yartsev <anton.yartsev@gmail.com> | 2010-08-19 03:00:09 +0000 |
commit | f54dbfdd16c053d6f305a4c48cb5aba0fe168f2d (patch) | |
tree | b8f7194c9fcfed568454a66b05d1f1fe9e3405dc | |
parent | 20cf717034ba1f20fc47c025ecb72ed9b631ad13 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111509 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Headers/altivec.h | 346 | ||||
-rw-r--r-- | test/CodeGen/builtins-ppc-altivec.c | 39 |
2 files changed, 360 insertions, 25 deletions
diff --git a/lib/Headers/altivec.h b/lib/Headers/altivec.h index d7e514aad6..1350eb5bd1 100644 --- a/lib/Headers/altivec.h +++ b/lib/Headers/altivec.h @@ -45,18 +45,30 @@ vec_perm(vector signed char a, vector signed char b, vector unsigned char c); 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 @@ vec_mergeh(vector unsigned char a, vector unsigned char b) 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 @@ vec_mergeh(vector unsigned short a, vector unsigned short b) 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 @@ vec_mergeh(vector unsigned int a, vector unsigned int b) 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 @@ vec_vmrghb(vector unsigned char a, vector unsigned char b) 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 @@ vec_vmrghh(vector unsigned short a, vector unsigned short b) 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 @@ vec_vmrghw(vector unsigned int a, vector unsigned int b) 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 @@ vec_mergel(vector unsigned char a, vector unsigned char b) 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 @@ vec_mergel(vector unsigned short a, vector unsigned short b) 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 @@ vec_mergel(vector unsigned int a, vector unsigned int b) 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 @@ vec_vmrglb(vector unsigned char a, vector unsigned char b) 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 @@ vec_vmrglh(vector unsigned short a, vector unsigned short b) 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 @@ vec_vmrglw(vector unsigned int a, vector unsigned int b) 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 @@ vec_pack(vector unsigned short a, vector unsigned short b) 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 @@ vec_pack(vector unsigned int a, vector unsigned int b) 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 @@ vec_vpkuhum(vector unsigned short a, vector unsigned short b) 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 @@ vec_vpkuwum(vector unsigned int a, vector unsigned int b) 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 @@ vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c) 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 @@ vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char 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 @@ vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c) 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 @@ vec_vperm(vector unsigned char a, vector unsigned char b, vector unsigned char c 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 @@ vec_vperm(vector unsigned short a, vector unsigned short b, vector unsigned char 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 @@ vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c) 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 @@ vec_vslw(vector unsigned int a, vector unsigned int b) 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 @@ vec_sld(vector signed char a, vector signed char b, unsigned char c) 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 @@ vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c) 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 @@ vec_sld(vector short a, vector short b, unsigned char c) 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 @@ vec_sld(vector int a, vector int b, unsigned char c) 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 @@ vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c) 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 @@ vec_sld(vector float a, vector float b, unsigned char c) 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 @@ vec_vsldoi(vector signed char a, vector signed char b, unsigned char c) 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 @@ vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c) 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 @@ vec_vsldoi(vector short a, vector short b, unsigned char c) 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 @@ vec_vsldoi(vector int a, vector int b, unsigned char c) 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 @@ vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c) 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 @@ vec_vslo(vector float a, vector unsigned char b) 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 @@ static vector unsigned short __ATTRS_o_ai 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 @@ static vector unsigned int __ATTRS_o_ai 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 @@ static vector float __ATTRS_o_ai 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 @@ vec_splat(vector float a, unsigned char b) 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 @@ static vector short __ATTRS_o_ai 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 @@ static vector unsigned short __ATTRS_o_ai 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 @@ static vector int __ATTRS_o_ai 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 @@ static vector unsigned int __ATTRS_o_ai 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 @@ static vector float __ATTRS_o_ai 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)); } diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c index 620cb16bbb..587e2b405e 100644 --- a/test/CodeGen/builtins-ppc-altivec.c +++ b/test/CodeGen/builtins-ppc-altivec.c @@ -6,6 +6,7 @@ vector unsigned char vuc = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 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 @@ int test6() { /* 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 @@ int test6() { /* 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 @@ int test6() { /* 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 @@ int test6() { 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 @@ int test6() { 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 @@ int test6() { /* 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 */ |