mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
8a1927856a
The INTEGER_CST code uses the remainder bits in computations whether to use whole constant or just part of it and extend it at runtime, and furthermore uses it to avoid using all bits even when using the (almost) whole constant. The problem is that the prec % (2 * limb_prec) computation it uses is appropriate only for the normal lowering of mergeable operations (where we process 2 limbs at a time in a loop starting with least significant limbs and process the remaining 0-2 limbs after the loop (there with constant indexes). For that case it is ok not to emit the upper prec % (2 * limb_prec) bits into the constant, because those bits will be extracted using INTEGER_CST idx and so will be used directly in the statements as INTEGER_CSTs. For other cases, where we either process just a single limb in a loop, process it downwards (e.g. non-equality comparisons) or with some runtime addends (some shifts), there is either just at most one limb lowered with INTEGER_CST idx after the loop (e.g. for right shift) or before the loop (e.g. non-equality comparisons), or all limbs are processed with non-INTEGER_CST indexes (e.g. for left shift, when m_var_msb is set). Now, the m_var_msb case is already handled through if (m_var_msb) type = TREE_TYPE (op); else /* If we have a guarantee the most significant partial limb (if any) will be only accessed through handle_operand with INTEGER_CST idx, we don't need to include the partial limb in .rodata. */ type = build_bitint_type (prec - rem, 1); but for the right shifts or comparisons the prec - rem when rem was prec % (2 * limb_prec) was incorrect, so the following patch fixes it to use remainder for 2 limbs only if m_upwards_2limb and remainder for 1 limb otherwise. 2024-01-15 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113370 * gimple-lower-bitint.cc (bitint_large_huge::handle_operand): Only set rem to prec % (2 * limb_prec) if m_upwards_2limb, otherwise set it to just prec % limb_prec. * gcc.dg/torture/bitint-48.c: New test. |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
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.