* [PATCH, rs6000] Add support for vec_pack and vec_sld built-ins
@ 2016-12-08 16:28 Carl E. Love
2016-12-09 3:03 ` Segher Boessenkool
0 siblings, 1 reply; 3+ messages in thread
From: Carl E. Love @ 2016-12-08 16:28 UTC (permalink / raw)
To: Segher Boessenkool, gcc-patches, Bill Schmidt, David Edelsohn; +Cc: cel
GCC maintainers:
The following patch adds two more built-ins that are missing.
Specifically:
vector float vec_pack vector double vector double
vector double vec_sld vector double vector double
The patch has been boot strapped and tested on
powerpc64le-unknown-linux-gnu (Power 8) and on
powerpc64-unknown-linux-gnu (Power 7) with no regressions.
Is this OK for trunk?
Carl Love
2016-12-08 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-c.c: Add built-in support for
vector float vec_pack vector double vector double
vector double vec_sld vector double vector double
* config/rs6000/rs6000.c: Add icode check for vsldoi_v2df to allow
4-bit unsigned literal.
* config/rs6000/rs6000-builtin.def: Add definition for VSLDOI_2DF
* doc/extend.texi: Update the built-in documentation file for the
new powerpc vec_pack and vec_sld built-ins.
gcc/testsuite/ChangeLog:
2016-12-08 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-3.c: Add new test of the test suite
file.
* gcc.target/powerpc/builtins-3.c: Add new test of the test suite
file.
---
gcc/config/rs6000/rs6000-builtin.def | 1 +
gcc/config/rs6000/rs6000-c.c | 4 ++++
gcc/config/rs6000/rs6000.c | 1 +
gcc/doc/extend.texi | 3 +++
gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c | 10 +++++++++-
gcc/testsuite/gcc.target/powerpc/builtins-3.c | 9 ++++++++-
6 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index d21f275..68f0936 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -958,6 +958,7 @@ BU_ALTIVEC_3 (VSLDOI_16QI, "vsldoi_16qi", CONST, altivec_vsldoi_v16qi)
BU_ALTIVEC_3 (VSLDOI_8HI, "vsldoi_8hi", CONST, altivec_vsldoi_v8hi)
BU_ALTIVEC_3 (VSLDOI_4SI, "vsldoi_4si", CONST, altivec_vsldoi_v4si)
BU_ALTIVEC_3 (VSLDOI_4SF, "vsldoi_4sf", CONST, altivec_vsldoi_v4sf)
+BU_ALTIVEC_3 (VSLDOI_2DF, "vsldoi_2df", CONST, altivec_vsldoi_v2df)
/* Altivec DST builtins. */
BU_ALTIVEC_D (DST, "dst", MISC, altivec_dst)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 4f332d7..bf01a11 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2118,6 +2118,8 @@ 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,
+ RS6000_BTI_V4SF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM,
RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM,
@@ -3193,6 +3195,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_NOT_OPAQUE },
{ ALTIVEC_BUILTIN_VEC_SLD, ALTIVEC_BUILTIN_VSLDOI_16QI,
RS6000_BTI_bool_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_NOT_OPAQUE },
+ { ALTIVEC_BUILTIN_VEC_SLD, ALTIVEC_BUILTIN_VSLDOI_2DF,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_NOT_OPAQUE },
{ ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V2DF,
RS6000_BTI_void, RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF },
{ ALTIVEC_BUILTIN_VEC_ST, ALTIVEC_BUILTIN_STVX_V2DI,
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 59bd3fe..228a6e2 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -15096,6 +15096,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
with identical values. We'd never reach here at runtime in
this case. */
if (icode == CODE_FOR_altivec_vsldoi_v4sf
+ || icode == CODE_FOR_altivec_vsldoi_v2df
|| icode == CODE_FOR_altivec_vsldoi_v4si
|| icode == CODE_FOR_altivec_vsldoi_v8hi
|| icode == CODE_FOR_altivec_vsldoi_v16qi)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index a8402e1..9477446 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -16513,6 +16513,8 @@ vector unsigned char vec_vslb (vector unsigned char,
vector unsigned char);
vector float vec_sld (vector float, vector float, const int);
+vector double vec_sld (vector double, vector double, const int);
+
vector signed int vec_sld (vector signed int,
vector signed int,
const int);
@@ -17745,6 +17747,7 @@ vector int vec_pack (vector long long, vector long long);
vector unsigned int vec_pack (vector unsigned long long,
vector unsigned long long);
vector bool int vec_pack (vector bool long long, vector bool long long);
+vector float vec_pack (vector double, vector double);
vector int vec_packs (vector long long, vector long long);
vector unsigned int vec_packs (vector unsigned long long,
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
index e52795c..8acdd89 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
@@ -10,8 +10,16 @@ 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);
+}
+
/* Expected test results:
- test_eq_long_long 1 vcmpequd inst */
+ test_eq_long_long 1 vcmpequd inst
+ test_pack_float 1 vpkudum inst */
/* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
+/* { dg-final { scan-assembler-times "vpkudum" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3.c b/gcc/testsuite/gcc.target/powerpc/builtins-3.c
index 1d243ce..f070bf3 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3.c
@@ -22,13 +22,20 @@ test_eq_int (vector bool int x, vector bool int y)
return vec_cmpeq (x, y);
}
+vector double
+test_shift_left_double (vector double x, vector double y)
+{
+ return vec_sld (x, y, /* shift_by */ 10);
+}
/* Expected test results:
test_eq_char 1 vcmpequb inst
test_eq_short 1 vcmpequh inst
- test_eq_int 1 vcmpequw inst */
+ test_eq_int 1 vcmpequw inst
+ test_shift_left_double 1 vsldoi inst */
/* { dg-final { scan-assembler-times "vcmpequb" 1 } } */
/* { dg-final { scan-assembler-times "vcmpequh" 1 } } */
/* { dg-final { scan-assembler-times "vcmpequw" 1 } } */
+/* { dg-final { scan-assembler-times "vsldoi" 1 } } */
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, rs6000] Add support for vec_pack and vec_sld built-ins
2016-12-08 16:28 [PATCH, rs6000] Add support for vec_pack and vec_sld built-ins Carl E. Love
@ 2016-12-09 3:03 ` Segher Boessenkool
2016-12-13 16:22 ` Carl E. Love
0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2016-12-09 3:03 UTC (permalink / raw)
To: Carl E. Love; +Cc: gcc-patches, Bill Schmidt, David Edelsohn
On Thu, Dec 08, 2016 at 08:28:22AM -0800, Carl E. Love wrote:
> The following patch adds two more built-ins that are missing.
> Specifically:
>
> vector float vec_pack vector double vector double
> vector double vec_sld vector double vector double
>
> The patch has been boot strapped and tested on
> powerpc64le-unknown-linux-gnu (Power 8) and on
> powerpc64-unknown-linux-gnu (Power 7) with no regressions.
> 2016-12-08 Carl Love <cel@us.ibm.com>
>
> * config/rs6000/rs6000-c.c: Add built-in support for
> vector float vec_pack vector double vector double
> vector double vec_sld vector double vector double
Add some parens and commas here?
> * config/rs6000/rs6000.c: Add icode check for vsldoi_v2df to allow
> 4-bit unsigned literal.
> * config/rs6000/rs6000-builtin.def: Add definition for VSLDOI_2DF
> * doc/extend.texi: Update the built-in documentation file for the
> new powerpc vec_pack and vec_sld built-ins.
Okay for trunk with that. Thanks,
Segher
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, rs6000] Add support for vec_pack and vec_sld built-ins
2016-12-09 3:03 ` Segher Boessenkool
@ 2016-12-13 16:22 ` Carl E. Love
0 siblings, 0 replies; 3+ messages in thread
From: Carl E. Love @ 2016-12-13 16:22 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: gcc-patches, Bill Schmidt, David Edelsohn
On Thu, 2016-12-08 at 21:03 -0600, Segher Boessenkool wrote:
> On Thu, Dec 08, 2016 at 08:28:22AM -0800, Carl E. Love wrote:
> > The following patch adds two more built-ins that are missing.
> > Specifically:
> >
> > vector float vec_pack vector double vector double
> > vector double vec_sld vector double vector double
> >
> > The patch has been boot strapped and tested on
> > powerpc64le-unknown-linux-gnu (Power 8) and on
> > powerpc64-unknown-linux-gnu (Power 7) with no regressions.
>
> > 2016-12-08 Carl Love <cel@us.ibm.com>
> >
> > * config/rs6000/rs6000-c.c: Add built-in support for
> > vector float vec_pack vector double vector double
> > vector double vec_sld vector double vector double
>
> Add some parens and commas here?
>
> > * config/rs6000/rs6000.c: Add icode check for vsldoi_v2df to allow
> > 4-bit unsigned literal.
> > * config/rs6000/rs6000-builtin.def: Add definition for VSLDOI_2DF
> > * doc/extend.texi: Update the built-in documentation file for the
> > new powerpc vec_pack and vec_sld built-ins.
>
> Okay for trunk with that. Thanks,
Segher:
The patch has been committed with the requested changes to the ChangeLog
message.
Revision 243612 - Directory Listing
Modified Tue Dec 13 16:18:36 2016 UTC (77 seconds ago) by carll
gcc/ChangeLog:
2016-12-13 Carl Love <cel@us.ibm.com>
* config/rs6000/rs6000-c.c: Add built-in support for
vector float vec_pack (vector double, vector double)
vector double vec_sld (vector double, vector double)
* config/rs6000/rs6000.c: Add icode check for vsldoi_v2df to allow
4-bit unsigned literal.
* config/rs6000/rs6000-builtin.def: Add definition for VSLDOI_2DF
* doc/extend.texi: Update the built-in documentation file for the
new powerpc vec_pack and vec_sld built-ins.
gcc/testsuite/ChangeLog:
2016-12-13 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-3.c: Add new test of the test suite
file.
* gcc.target/powerpc/builtins-3-p8.c: Add new test of the test suite
file.
Carl Love
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-13 16:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 16:28 [PATCH, rs6000] Add support for vec_pack and vec_sld built-ins Carl E. Love
2016-12-09 3:03 ` Segher Boessenkool
2016-12-13 16:22 ` Carl E. Love
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).