GCC modified for the FreeChainXenon project
Find a file
Uros Bizjak b50a851eef i386: Double-word sign-extension missed-optimization [PR110717]
When sign-extending the value in a double-word register pair using shift and
ashiftrt sequence with the same count immediate value less than word width,
there is no need to shift the lower word of the value. The sign-extension
could be limited to the upper word, but we uselessly shift the lower word
with it as well:
	movq	%rdi, %rax
	movq	%rsi, %rdx
	shldq	$59, %rdi, %rdx
	salq	$59, %rax
	shrdq	$59, %rdx, %rax
	sarq	$59, %rdx
	ret
for -m64 and
	movl	4(%esp), %eax
	movl	8(%esp), %edx
	shldl	$27, %eax, %edx
	sall	$27, %eax
	shrdl	$27, %edx, %eax
	sarl	$27, %edx
	ret
for -m32.

The patch introduces a new post-reload splitter to provide the combined
ASHIFTRT/SHIFT instruction pattern.  The instruction is split to a sequence
of SAL and SAR insns with the same count immediate operand:
	movq    %rsi, %rdx
	movq    %rdi, %rax
	salq    $59, %rdx
	sarq    $59, %rdx
	ret

Some complication is required to properly handle STV transform, where we
emit a sequence with DImode PSLLQ and PSRAQ insns for 32-bit AVX512VL
targets when profitable.

The patch also fixes a small oversight and enables STV transform of SImode
ASHIFTRT to PSRAD also for SSE2 targets.

	PR target/110717

gcc/ChangeLog:

	* config/i386/i386-features.cc
	(general_scalar_chain::compute_convert_gain): Calculate gain
	for extend higpart case.
	(general_scalar_chain::convert_op): Handle
	ASHIFTRT/ASHIFT combined RTX.
	(general_scalar_to_vector_candidate_p): Enable ASHIFTRT for
	SImode for SSE2 targets.  Handle ASHIFTRT/ASHIFT combined RTX.
	* config/i386/i386.md (*extend<dwi>2_doubleword_highpart):
	New define_insn_and_split pattern.
	(*extendv2di2_highpart_stv): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr110717.c: New test.
2023-07-20 20:56:19 +02:00
c++tools Daily bump. 2023-06-23 00:16:38 +00:00
config Daily bump. 2022-11-15 08:32:29 +00:00
contrib Daily bump. 2023-07-14 00:16:43 +00:00
fixincludes Daily bump. 2023-06-16 00:17:18 +00:00
gcc i386: Double-word sign-extension missed-optimization [PR110717] 2023-07-20 20:56:19 +02:00
gnattools Daily bump. 2023-04-26 00:17:46 +00:00
gotools Daily bump. 2022-08-31 00:16:45 +00:00
include Daily bump. 2023-06-13 00:17:29 +00:00
INSTALL
intl Daily bump. 2023-06-16 00:17:18 +00:00
libada Update copyright years. 2023-01-16 11:52:17 +01:00
libatomic Daily bump. 2023-06-11 00:17:37 +00:00
libbacktrace Daily bump. 2023-03-29 00:17:01 +00:00
libcc1 Daily bump. 2023-05-19 00:17:43 +00:00
libcody Daily bump. 2023-06-16 00:17:18 +00:00
libcpp Daily bump. 2023-07-20 00:17:53 +00:00
libdecnumber Daily bump. 2023-06-16 00:17:18 +00:00
libffi Daily bump. 2023-05-07 00:16:40 +00:00
libgcc Daily bump. 2023-07-20 00:17:53 +00:00
libgfortran Fortran: add IEEE_QUIET_* and IEEE_SIGNALING_* comparisons 2023-07-20 10:54:54 +02:00
libgm2 Daily bump. 2023-06-03 00:16:48 +00:00
libgo compiler, libgo: support bootstrapping gc compiler 2023-06-23 16:17:11 -07:00
libgomp libgomp.texi: Split OpenMP routines chapter into sections 2023-07-20 18:13:54 +02:00
libiberty Daily bump. 2023-06-16 00:17:18 +00:00
libitm Daily bump. 2023-06-03 00:16:48 +00:00
libobjc Daily bump. 2023-05-23 00:17:11 +00:00
libphobos Daily bump. 2023-07-11 00:16:56 +00:00
libquadmath Daily bump. 2023-03-03 00:16:38 +00:00
libsanitizer Daily bump. 2023-05-01 00:16:44 +00:00
libssp Update copyright years. 2023-01-16 11:52:17 +01:00
libstdc++-v3 Daily bump. 2023-07-20 00:17:53 +00:00
libvtv Update copyright years. 2023-01-16 11:52:17 +01:00
lto-plugin Daily bump. 2023-07-01 00:18:32 +00:00
maintainer-scripts Daily bump. 2023-07-08 00:16:53 +00:00
zlib Daily bump. 2023-06-17 00:17:17 +00:00
.dir-locals.el
.gitattributes
.gitignore .gitignore: do not ignore config.h 2022-07-19 17:07:04 +03:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-07-19 00:17:46 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure configure, Darwin: Ensure overrides to host-pie are passed to gcc configure. 2023-06-25 10:16:39 +01:00
configure.ac configure, Darwin: Ensure overrides to host-pie are passed to gcc configure. 2023-06-25 10:16:39 +01:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 Generic configury support for shared libs on VxWorks 2022-10-11 07:31:07 +00:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS MAINTAINERS: Add myself as riscv port reviewer. 2023-07-18 17:38:41 +08:00
Makefile.def configure, Darwin: Ensure overrides to host-pie are passed to gcc configure. 2023-06-25 10:16:39 +01:00
Makefile.in Collect both user and kernel events for autofdo tests and autoprofiledbootstrap 2023-07-07 13:06:28 -07:00
Makefile.tpl Collect both user and kernel events for autofdo tests and autoprofiledbootstrap 2023-07-07 13:06:28 -07: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.