This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH], Add support for PowerPC ISA 3.0 vector byte reverse instructions


This patch adds support for adding built-in functions for the ISA 3.0 vector
byte reverse instructions (XXBR{Q,D,W,H}).

The vec_revb built-in function follows the specifications in the OpenPOWER ABI
for Linux Supplement Power Architecture 64-Bit ELF V2 ABI and reverses the
bytes in each vector element.  I added a GCC extension, so that vec_revb of a
vector unsigned char, vector signed char, or vector char argument would act the
same as a vector __int128_t or vector __uint128_t (i.e. reverse all of the
bytes).

In the course of working on this patch, I tried to get the code in the rs6000.c
function altivec_expand_vec_perm_const to generate these instructions, but
there doesn't seem to be any caller of it to implement the permutes.  I will
open a bug on this altivec_expand_vec_perm_const, and if these patches are
checked in, I will try to add support for the instructions.

I have checked this on a little endian power8 system (64-bit only), a big
endian power8 system (64-bit only), and a big endian power7 system (both 32-bit
and 64-bit), and there were no regressions.  Can I check this into the trunk?

[gcc]
2017-01-17  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
	__builtin_vec_revb builtins.
	* config/rs6000/rs6000-builtins.def (P9V_BUILTIN_XXBRQ_V16QI): Add
	built-in functions to support generation of the ISA 3.0 XXBR<x>
	vector byte reverse instructions.
	(P9V_BUILTIN_XXBRQ_V1TI): Likewise.
	(P9V_BUILTIN_XXBRD_V2DI): Likewise.
	(P9V_BUILTIN_XXBRD_V2DF): Likewise.
	(P9V_BUILTIN_XXBGW_V4SI): Likewise.
	(P9V_BUILTIN_XXBGW_V4SF): Likewise.
	(P9V_BUILTIN_XXBGH_V8HI): Likewise.
	(P9V_BUILTIN_VEC_REVB): Likewise.
	* config/rs6000/vsx.md (p9_xxbrq_v1ti): New insns/expanders to
	generate the ISA 3.0 XXBR<x> vector byte reverse instructions.
	(p9_xxbrq_v16qi): Likewise.
	(p9_xxbrd_<mode>, VSX_D iterator): Likewise.
	(p9_xxbrw_<mode>, VSX_W iterator): Likewise.
	(p9_xxbrh_v8hi): Likewise.
	* config/rs6000/altivec.h (vec_revb): Define if ISA 3.0.
	* doc/extend.texi (RS/6000 Altivec Built-ins): Document the
	vec_revb built-in functions.

[gcc/testsuite]
2017-01-13  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* gcc.target/powerpc/p9-xxbr-1.c: New test.
	* gcc.target/powerpc/p9-xxbr-2.c: Likewise.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

Attachment: gcc-stage7.patch045b
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]