Go to file
Kewen Lin 13f0528c78 rs6000: Fix wrong RTL patterns for vector merge high/low char on LE
Commit r12-4496 changes some define_expands and define_insns
for vector merge high/low char, which are altivec_vmrg[hl]b.
These defines are mainly for built-in function vec_merge{h,l}
and some internal gen function needs.  These functions should
consider endianness, taking vec_mergeh as example, as PVIPR
defines, vec_mergeh "Merges the first halves (in element order)
of two vectors", it does note it's in element order.  So it's
mapped into vmrghb on BE while vmrglb on LE respectively.
Although the mapped insns are different, as the discussion in
PR106069, the RTL pattern should be still the same, it is
conformed before commit r12-4496, but gets changed into
different patterns on BE and LE starting from commit r12-4496.
Similar to 32-bit element case in commit log of r15-1504, this
8-bit element pattern on LE doesn't actually match what the
underlying insn is intended to represent, once some optimization
like combine does some changes basing on it, it would cause
the unexpected consequence.  The newly constructed test case
pr106069-1.c is a typical example for this issue.

So this patch is to fix the wrong RTL pattern, ensure the
associated RTL patterns become the same as before which can
have the same semantic as their mapped insns.  With the
proposed patch, the expanders like altivec_vmrghb expands
into altivec_vmrghb_direct_be or altivec_vmrglb_direct_le
depending on endianness, "direct" can easily show which
insn would be generated, _be and _le are mainly for the
different RTL patterns as endianness.

Co-authored-by: Xionghu Luo <xionghuluo@tencent.com>

	PR target/106069
	PR target/115355

gcc/ChangeLog:

	* config/rs6000/altivec.md (altivec_vmrghb_direct): Rename to ...
	(altivec_vmrghb_direct_be): ... this.  Add condition BYTES_BIG_ENDIAN.
	(altivec_vmrghb_direct_le): New define_insn.
	(altivec_vmrglb_direct): Rename to ...
	(altivec_vmrglb_direct_be): ... this.  Add condition BYTES_BIG_ENDIAN.
	(altivec_vmrglb_direct_le): New define_insn.
	(altivec_vmrghb): Adjust by calling gen_altivec_vmrghb_direct_be
	for BE and gen_altivec_vmrglb_direct_le for LE.
	(altivec_vmrglb): Adjust by calling gen_altivec_vmrglb_direct_be
	for BE and gen_altivec_vmrghb_direct_le for LE.
	* config/rs6000/rs6000.cc (altivec_expand_vec_perm_const): Replace
	CODE_FOR_altivec_vmrghb_direct by
	CODE_FOR_altivec_vmrghb_direct_be for BE and
	CODE_FOR_altivec_vmrghb_direct_le for LE.  And replace
	CODE_FOR_altivec_vmrglb_direct by
	CODE_FOR_altivec_vmrglb_direct_be for BE and
	CODE_FOR_altivec_vmrglb_direct_le for LE.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr106069-1.c: New test.

(cherry picked from commit 62520e4e9f)
2024-07-02 21:01:08 -05:00
c++tools Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
config Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
contrib Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
fixincludes Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
gcc rs6000: Fix wrong RTL patterns for vector merge high/low char on LE 2024-07-02 21:01:08 -05:00
gnattools Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
gotools Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
include Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
INSTALL
intl Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libada Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libatomic Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libbacktrace Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libcc1 Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libcody Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libcpp Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libdecnumber Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libffi Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libgcc Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libgfortran Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libgo compiler, libgo: support bootstrapping gc compiler 2023-06-23 16:16:06 -07:00
libgomp Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libiberty Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libitm Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libobjc Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
liboffloadmic Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libphobos Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libquadmath Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libsanitizer Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libssp Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
libstdc++-v3 Daily bump. 2024-06-28 00:20:48 +00:00
libvtv Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
lto-plugin Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
maintainer-scripts Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
zlib Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
.dir-locals.el dir-locals: Use https for bug references 2021-07-20 11:40:34 +01:00
.gitattributes
.gitignore Add cscope.out to git ignore. 2021-06-24 16:51:40 +05:30
ABOUT-NLS
ar-lib
ChangeLog Update ChangeLog and version files for release 2024-06-20 08:09:02 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure configure, Darwin: Correct a pasto in host-shared processing. 2024-04-22 19:45:27 +01:00
configure.ac configure, Darwin: Correct a pasto in host-shared processing. 2024-04-22 19:45:27 +01:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update my email address. 2022-04-19 10:29:15 -07:00
Makefile.def toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.in toplevel: Makefile.def: Make configure-sim depend on all-readline 2022-03-09 20:54:37 +01:00
Makefile.tpl Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.