aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target
diff options
context:
space:
mode:
authorHaochen Gui <guihaoc@gcc.gnu.org>2023-04-21 10:11:32 +0800
committerHaochen Gui <guihaoc@gcc.gnu.org>2023-04-21 10:11:32 +0800
commita8f45d61caba90649b3f264babab17353d774751 (patch)
tree8c6e2896e447ed8555cba0963167e90453f99be3 /gcc/testsuite/gcc.target
parent861b252088c551dc1ea6f5988dc0b24419f984da (diff)
downloadgcc-a8f45d61caba90649b3f264babab17353d774751.zip
gcc-a8f45d61caba90649b3f264babab17353d774751.tar.gz
gcc-a8f45d61caba90649b3f264babab17353d774751.tar.bz2
rs6000: correct vector sign extend builtins on Big Endian
gcc/ PR target/108812 * config/rs6000/vsx.md (vsx_sign_extend_qi_<mode>): Rename to... (vsx_sign_extend_v16qi_<mode>): ... this. (vsx_sign_extend_hi_<mode>): Rename to... (vsx_sign_extend_v8hi_<mode>): ... this. (vsx_sign_extend_si_v2di): Rename to... (vsx_sign_extend_v4si_v2di): ... this. (vsignextend_qi_<mode>): Remove. (vsignextend_hi_<mode>): Remove. (vsignextend_si_v2di): Remove. (vsignextend_v2di_v1ti): Remove. (*xxspltib_<mode>_split): Replace gen_vsx_sign_extend_qi_v2di with gen_vsx_sign_extend_v16qi_v2di and gen_vsx_sign_extend_qi_v4si with gen_vsx_sign_extend_v16qi_v4si. * config/rs6000/rs6000.md (split for DI constant generation): Replace gen_vsx_sign_extend_qi_si with gen_vsx_sign_extend_v16qi_si. (split for HSDI constant generation): Replace gen_vsx_sign_extend_qi_di with gen_vsx_sign_extend_v16qi_di and gen_vsx_sign_extend_qi_si with gen_vsx_sign_extend_v16qi_si. * config/rs6000/rs6000-builtins.def (__builtin_altivec_vsignextsb2d): Set bif-pattern to vsx_sign_extend_v16qi_v2di. (__builtin_altivec_vsignextsb2w): Set bif-pattern to vsx_sign_extend_v16qi_v4si. (__builtin_altivec_visgnextsh2d): Set bif-pattern to vsx_sign_extend_v8hi_v2di. (__builtin_altivec_vsignextsh2w): Set bif-pattern to vsx_sign_extend_v8hi_v4si. (__builtin_altivec_vsignextsw2d): Set bif-pattern to vsx_sign_extend_si_v2di. (__builtin_altivec_vsignext): Set bif-pattern to vsx_sign_extend_v2di_v1ti. * config/rs6000/rs6000-builtin.cc (lxvrse_expand_builtin): Replace gen_vsx_sign_extend_qi_v2di with gen_vsx_sign_extend_v16qi_v2di, gen_vsx_sign_extend_hi_v2di with gen_vsx_sign_extend_v8hi_v2di and gen_vsx_sign_extend_si_v2di with gen_vsx_sign_extend_v4si_v2di. gcc/testsuite/ PR target/108812 * gcc.target/powerpc/p9-sign_extend-runnable.c: Set corresponding expected vectors for Big Endian. * gcc.target/powerpc/int_128bit-runnable.c: Likewise. (cherry picked from commit a213e2c965382c24fe391ee5798effeba8da0fdf)
Diffstat (limited to 'gcc/testsuite/gcc.target')
-rw-r--r--gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c25
2 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c b/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c
index 1afb002..68217c6 100644
--- a/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c
@@ -90,7 +90,11 @@ int main ()
vec_arg1_di[0] = 1000;
vec_arg1_di[1] = -123456;
+#ifdef __BIG_ENDIAN__
+ expected_result = -123456;
+#else
expected_result = 1000;
+#endif
vec_result = vec_signextq (vec_arg1_di);
@@ -109,7 +113,11 @@ int main ()
vec_arg1_di[0] = -123456;
vec_arg1_di[1] = 1000;
+#ifdef __BIG_ENDIAN__
+ expected_result = 1000;
+#else
expected_result = -123456;
+#endif
vec_result = vec_signextq (vec_arg1_di);
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c b/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c
index fdcad01..03c0f12 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-sign_extend-runnable.c
@@ -34,7 +34,12 @@ int main ()
/* test sign extend byte to word */
vec_arg_qi = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
-1, -2, -3, -4, -5, -6, -7, -8};
+
+#ifdef __BIG_ENDIAN__
+ vec_expected_wi = (vector signed int) {4, 8, -4, -8};
+#else
vec_expected_wi = (vector signed int) {1, 5, -1, -5};
+#endif
vec_result_wi = vec_signexti (vec_arg_qi);
@@ -54,7 +59,12 @@ int main ()
/* test sign extend byte to double */
vec_arg_qi = (vector signed char){1, 2, 3, 4, 5, 6, 7, 8,
-1, -2, -3, -4, -5, -6, -7, -8};
+
+#ifdef __BIG_ENDIAN__
+ vec_expected_di = (vector signed long long int){8, -8};
+#else
vec_expected_di = (vector signed long long int){1, -1};
+#endif
vec_result_di = vec_signextll(vec_arg_qi);
@@ -72,7 +82,12 @@ int main ()
/* test sign extend short to word */
vec_arg_hi = (vector signed short int){1, 2, 3, 4, -1, -2, -3, -4};
+
+#ifdef __BIG_ENDIAN__
+ vec_expected_wi = (vector signed int){2, 4, -2, -4};
+#else
vec_expected_wi = (vector signed int){1, 3, -1, -3};
+#endif
vec_result_wi = vec_signexti(vec_arg_hi);
@@ -90,7 +105,12 @@ int main ()
/* test sign extend short to double word */
vec_arg_hi = (vector signed short int ){1, 3, 5, 7, -1, -3, -5, -7};
+
+#ifdef __BIG_ENDIAN__
+ vec_expected_di = (vector signed long long int){7, -7};
+#else
vec_expected_di = (vector signed long long int){1, -1};
+#endif
vec_result_di = vec_signextll(vec_arg_hi);
@@ -108,7 +128,12 @@ int main ()
/* test sign extend word to double word */
vec_arg_wi = (vector signed int ){1, 3, -1, -3};
+
+#ifdef __BIG_ENDIAN__
+ vec_expected_di = (vector signed long long int){3, -3};
+#else
vec_expected_di = (vector signed long long int){1, -1};
+#endif
vec_result_di = vec_signextll(vec_arg_wi);