Hi,
Yet another -maltivec=be patch, this one for the vector pack/unpack
builtins. For the pack operations, we need to reverse the order of the
inputs for little endian without -maltivec=be. For the unpack
operations, we need to replace unpackh with unpackl, and vice versa, for
little endian without -maltivec=be.
For both pack and unpack, there are some internal uses that should not
have their semantics changed from the existing implementation. For
these, _direct forms of the insns are provided, as has been done in
previous patches in this series.
Four new test cases are added to test these builtins for all applicable
vector types, with and without -maltivec=be.
Bootstrapped and tested on powerpc64{,le}-unknown-linux-gnu with no
regressions. Is this ok for trunk?
Thanks,
Bill
gcc:
2014-02-04 Bill Schmidt wschm...@linux.vnet.ibm.com
* altivec.md (UNSPEC_VPACK_UNS_UNS_MOD_DIRECT): New unspec.
(UNSPEC_VUNPACK_HI_SIGN_DIRECT): Likewise.
(UNSPEC_VUNPACK_LO_SIGN_DIRECT): Likewise.
(mulv8hi3): Use gen_altivec_vpkuwum_direct instead of
gen_altivec_vpkuwum.
(altivec_vpkpx): Test for VECTOR_ELT_ORDER_BIG instead of for
BYTES_BIG_ENDIAN.
(altivec_vpksVI_charss): Likewise.
(altivec_vpksVI_charus): Likewise.
(altivec_vpkuVI_charus): Likewise.
(altivec_vpkuVI_charum): Likewise.
(altivec_vpkuVI_charum_direct): New (copy of
altivec_vpkuVI_charum that still relies on BYTES_BIG_ENDIAN, for
internal use).
(altivec_vupkhsVU_char): Emit vupkls* instead of vupkhs* when
target is little endian and -maltivec=be is not specified.
(*altivec_vupkhsVU_char_direct): New (copy of
altivec_vupkhsVU_char that always emits vupkhs*, for internal
use).
(altivec_vupklsVU_char): Emit vupkhs* instead of vupkls* when
target is little endian and -maltivec=be is not specified.
(*altivec_vupklsVU_char_direct): New (copy of
altivec_vupklsVU_char that always emits vupkls*, for internal
use).
(altivec_vupkhpx): Emit vupklpx instead of vupkhpx when target is
little endian and -maltivec=be is not specified.
(altivec_vupklpx): Emit vupkhpx instead of vupklpx when target is
little endian and -maltivec=be is not specified.
gcc/testsuite:
2014-02-04 Bill Schmidt wschm...@linux.vnet.ibm.com
* gcc.dg/vmx/pack.c: New.
* gcc.dg/vmx/pack-be-order.c: New.
* gcc.dg/vmx/unpack.c: New.
* gcc.dg/vmx/unpack-be-order.c: New.
Index: gcc/testsuite/gcc.dg/vmx/unpack.c
===
--- gcc/testsuite/gcc.dg/vmx/unpack.c (revision 0)
+++ gcc/testsuite/gcc.dg/vmx/unpack.c (revision 0)
@@ -0,0 +1,67 @@
+#include harness.h
+
+#define BIG 4294967295
+
+static void test()
+{
+ /* Input vectors. */
+ vector signed char vsc = {-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7};
+ vector bool char vbc = {0,255,255,0,0,0,255,0,255,0,0,255,255,255,0,255};
+ vector pixel vp = {(015) + (110) + (25) + 3,
+(115) + (410) + (55) + 6,
+(015) + (710) + (85) + 9,
+(115) + (1010) + (115) + 12,
+(115) + (1310) + (145) + 15,
+(015) + (1610) + (175) + 18,
+(115) + (1910) + (205) + 21,
+(015) + (2210) + (235) + 24};
+ vector signed short vss = {-4,-3,-2,-1,0,1,2,3};
+ vector bool short vbs = {0,65535,65535,0,0,0,65535,0};
+
+ /* Result vectors. */
+ vector signed short vsch, vscl;
+ vector bool short vbsh, vbsl;
+ vector unsigned int vuih, vuil;
+ vector signed int vsih, vsil;
+ vector bool int vbih, vbil;
+
+ /* Expected result vectors. */
+ vector signed short vschr = {-8,-7,-6,-5,-4,-3,-2,-1};
+ vector signed short vsclr = {0,1,2,3,4,5,6,7};
+ vector bool short vbshr = {0,65535,65535,0,0,0,65535,0};
+ vector bool short vbslr = {65535,0,0,65535,65535,65535,0,65535};
+ vector unsigned int vuihr = {(024) + (116) + (28) + 3,
+ (6553524) + (416) + (58) + 6,
+ (024) + (716) + (88) + 9,
+ (6553524) + (1016) + (118) + 12};
+ vector unsigned int vuilr = {(6553524) + (1316) + (148) + 15,
+ (024) + (1616) + (178) + 18,
+ (6553524) + (1916) + (208) + 21,
+ (024) + (2216) + (238) + 24};
+ vector signed int vsihr = {-4,-3,-2,-1};
+ vector signed int vsilr = {0,1,2,3};
+ vector bool int vbihr = {0,BIG,BIG,0};
+ vector bool int vbilr = {0,0,BIG,0};
+
+ vsch = vec_unpackh (vsc);
+ vscl = vec_unpackl (vsc);
+ vbsh = vec_unpackh (vbc);
+ vbsl = vec_unpackl (vbc);
+ vuih = vec_unpackh (vp);
+ vuil = vec_unpackl (vp);
+ vsih = vec_unpackh (vss);
+ vsil = vec_unpackl (vss);
+ vbih = vec_unpackh (vbs);
+ vbil = vec_unpackl