https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126276
Bug ID: 126276
Summary: [17 Regression] Recent change breaks cris-elf
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: law at gcc dot gnu.org
Target Milestone: ---
This change breaks the cris-elf port:
commit e46d96d20bbfa786d30c9371631da00939845f05 (HEAD)
Author: Roger Sayle <[email protected]>
Date: Wed Jul 15 12:26:16 2026 +0100
PR middle-end/123236: Simplify (int)((long long)x >> 4)
This patch addresses a code quality regression on x86_64 related to
PR 123236. That original PR (and the related PR 101266) concern tree
level optimizations, where this problem should also be fixed, but it
also reveals a regression in the RTL optimizers.
A motivating test case (on x86_64) is:
int bar(int a) {
long long t = a;
return t >> 4;
}
[ ... ]
The reduced testcase to compile with -O2:
long read_sleb128_val, read_encoded_value_with_base_result;
char read_encoded_value_with_base_byte;
void read_encoded_value_with_base() {
if (read_encoded_value_with_base_byte & 4)
read_sleb128_val = read_encoded_value_with_base_result;
}
j.c:6:1: error: unrecognizable insn:
6 | }
| ^
(insn 28 6 29 2 (set (reg:CC_ZnN 19 ccr)
(compare:CC_ZnN (zero_extract:SI (reg:QI 9 r9 [orig:31
read_encoded_value_with_base_byte ] [31])
(const_int 1 [0x1])
(const_int 2 [0x2]))
(const_int 0 [0]))) "j.c":4:6 -1
(nil))
during RTL pass: split2
Given the failure is in split2, there's a very real possibility this is a cris
specific issue.