Robin Dapp 2a155ceffe cse: Only use non-reg vec_select simplifications. [PR121649]
When merging classes, cse computes new equivalences for constants.
In the PR we have

  (insn 1173 1172 1174 2 (set (reg:V8QI 33 v1)
         (const_vector:V8QI [
                 (const_int 3 [0x3])
                 (const_int -4 [0xfffffffffffffffc])
                 (const_int 0 [0]) repeated x6
             ])) "pr121649.c":63:3 1325 {*aarch64_simd_movv8qi}
      (nil))

of which the second element is selected:

  (insn 1178 1177 1179 2 (set (reg:QI 4 x4)
          (vec_select:QI (reg:V8QI 33 v1)
              (parallel [
                      (const_int 1 [0x1])
                  ]))) "pr121649.c":63:3 2968 {aarch64_get_lanev8qi}
       (expr_list:REG_EQUAL (const_int -4 [0xfffffffffffffffc])
          (nil)))

We find (const_int 3 [0x3]) and a few others to be equivalent, among
them (reg:QI v1).  This is a "fake set" that we create to help CSE extract
const_vector elements and reuse them.  Element 0 is special, though.
We lowpart-subreg simplify it to (reg:QI v1) directly and, as the register
stays the same, consider it equivalent to (reg:V8QI v1).

Because both equivs refer to the same hard reg, in merge_equiv_classes, the
old (reg:V8QI) equiv is deleted and replaced by the new (reg:QI) one,
forgetting that the old equiv had 7 more elements.
Subsequently, extracting element 1 of a zero-extended QImode register results
in "0" instead of the correct "-4".

Therefore, this patch only uses those vec_select simplification that do
not directly result in a register.

	PR rtl-optimization/121649

gcc/ChangeLog:

	* cse.cc (find_sets_in_insn):  Only use non-reg vec_select
	simplifications.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr121649.c: New test.
2026-03-07 11:56:32 +01:00
2026-01-02 09:56:11 +01:00
2026-02-05 00:16:28 +00:00
2026-03-02 09:49:03 +00:00
2026-02-16 00:16:25 +00:00
2026-01-10 00:16:49 +00:00
2026-02-06 00:16:39 +00:00
2026-01-02 09:56:11 +01:00
2026-02-22 00:16:27 +00:00
2026-01-02 10:47:06 +01:00
2026-01-16 00:16:30 +00:00
2026-03-02 09:49:03 +00:00
2026-01-10 00:16:49 +00:00
2026-01-30 00:16:31 +00:00
2026-02-24 00:16:30 +00:00
2026-03-07 00:16:29 +00:00
2026-02-27 00:16:38 +00:00
2026-03-07 00:16:29 +00:00
2025-12-30 00:16:33 +00:00
2026-03-02 09:49:03 +00:00
2026-01-02 09:56:11 +01:00
2026-03-06 00:16:27 +00:00
2026-02-13 00:16:32 +00:00
2026-01-02 09:56:11 +01:00
2026-02-06 00:16:39 +00:00
2026-01-02 00:16:23 +00:00
2025-12-30 00:16:33 +00:00
2026-01-02 09:56:11 +01:00
2026-03-07 00:16:29 +00:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-27 00:16:29 +00:00
2025-12-30 00:16:33 +00:00
2026-03-02 09:49:03 +00:00

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.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%