From 9395b1d99fd7463173e031ce35f53138b061efef Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Fri, 22 Jun 2018 22:28:49 +0000 Subject: [PATCH] rs6000-c.c (altivec_overloaded_builtins): Change behavior of vec_pack (vector double... gcc/ChangeLog: 2018-06-22 Kelvin Nilsen * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Change behavior of vec_pack (vector double, vector double) to match behavior of vec_float2 (vector double, vector double). gcc/testsuite/ChangeLog: 2018-06-22 Kelvin Nilsen * gcc.target/powerpc/builtins-3-p8.c (test_pack_float): Remove this test. * gcc.target/powerpc/builtins-9.c: New test. * gcc.target/powerpc/fold-vec-pack-double.c: Modify dg directives to expect different code generation on big-endian vs. little-endian targets. From-SVN: r261974 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/rs6000-c.c | 2 +- gcc/testsuite/ChangeLog | 9 +++++++++ .../gcc.target/powerpc/builtins-3-p8.c | 8 -------- gcc/testsuite/gcc.target/powerpc/builtins-9.c | 19 +++++++++++++++++++ .../gcc.target/powerpc/fold-vec-pack-double.c | 4 +++- 6 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-9.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b14a342af1..f9dc07c5b6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-22 Kelvin Nilsen + + * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Change + behavior of vec_pack (vector double, vector double) to match + behavior of vec_float2 (vector double, vector double). + 2018-06-22 Olivier Hainque * gimplify.c (gimplify_function_tree): Prevent creation diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 06332f05d0a..f4b1bf7c466 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -2425,7 +2425,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 }, - { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM, + { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_FLOAT2_V2DF, RS6000_BTI_V4SF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, { P8V_BUILTIN_VEC_NEG, P8V_BUILTIN_NEG_V16QI, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b99ba40ab90..018fdf05682 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2018-06-22 Kelvin Nilsen + + * gcc.target/powerpc/builtins-3-p8.c (test_pack_float): Remove + this test. + * gcc.target/powerpc/builtins-9.c: New test. + * gcc.target/powerpc/fold-vec-pack-double.c: Modify dg directives + to expect different code generation on big-endian vs. + little-endian targets. + 2018-06-22 Tom de Vries * g++.dg/guality/guality.exp (guality_gdb_name): Default to diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c index 94021818868..e0233325a84 100644 --- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c @@ -11,12 +11,6 @@ test_eq_long_long (vector bool long long x, vector bool long long y) return vec_cmpeq (x, y); } -vector float -test_pack_float (vector double x, vector double y) -{ - return vec_pack (x, y); -} - vector unsigned char test_vsi_packs_vusi_vusi (vector unsigned short x, vector unsigned short y) @@ -214,7 +208,6 @@ test_neg_double (vector double x) /* Expected test results: test_eq_long_long 1 vcmpequd inst - test_pack_float 1 vpkudum inst test_vsi_packs_vsll_vsll 1 vpksdss test_vui_packs_vull_vull 1 vpkudus test_vui_packs_vssi_vssi 1 vpkshss @@ -241,7 +234,6 @@ test_neg_double (vector double x) */ /* { dg-final { scan-assembler-times "vcmpequd" 1 } } */ -/* { dg-final { scan-assembler-times "vpkudum" 1 } } */ /* { dg-final { scan-assembler-times "vpksdss" 1 } } */ /* { dg-final { scan-assembler-times "vpkudus" 2 } } */ /* { dg-final { scan-assembler-times "vpkuhus" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-9.c b/gcc/testsuite/gcc.target/powerpc/builtins-9.c new file mode 100644 index 00000000000..d8d895dcdc7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-9.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-maltivec -mcpu=power8 -O3" } */ + +#include + +vector float +test_pack_float (vector double x, vector double y) +{ + return vec_pack (x, y); +} + +/* { dg-final { scan-assembler-times "vmrgew" 1 { target be } } } */ +/* { dg-final { scan-assembler-times "vmrgow" 1 { target le } } } */ + +/* { dg-final { scan-assembler-times "xvcvdpsp" 2 } } */ +/* { dg-final { scan-assembler-times "xxpermdi" 2 } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c index 29d049abe80..46cfef0ec22 100644 --- a/gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c @@ -3,6 +3,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-options "-mvsx -mpower8-vector -O2" } */ #include @@ -15,4 +16,5 @@ test_pack (vector double vd2, vector double vd3) return vec_pack (vd2, vd3); } -/* { dg-final { scan-assembler-times "vpkudum" 1 } } */ +/* { dg-final { scan-assembler-times "vmrgew" 1 { target be } } } */ +/* { dg-final { scan-assembler-times "vmrgow" 1 { target le } } } */ -- 2.30.2