https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124479
Bug ID: 124479
Summary: RISC-V: unrecognizable insn (bclri from Zbs) in
Windows version of GCC
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: evgeny.linsky at gmail dot com
Target Milestone: ---
GCC version: riscv-none-elf-gcc.exe (xPack GNU RISC-V Embedded GCC x86_64)
15.2.0 (Windows package from
https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/tag/v15.2.0-1
)
System type: Windows (not reproducible on Linux)
Command:
riscv-none-elf-gcc.exe -march=rv64imfdc_zba_zbb_zbc_zbs -mabi=lp64d -O3 -c
test.c -Wall -Wextra -save-temps
Preprocessed source (test.c --> test.i):
# 0 "test.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "test.c"
union A {
long long x;
short y[4];
};
long long x = 1;
int main() {
union A a;
a.y[1] = x; // <--- error in codegen for assignment here
x = a.x;
}
Compiler output:
test.c: In function 'main':
test.c:12:1: error: unrecognizable insn:
12 | }
| ^
(insn 11 10 12 2 (set (reg:DI 144)
(and:DI (reg:DI 146)
(const_int 2147483647 [0x7fffffff]))) "test.c":10:12 -1
(expr_list:REG_EQUAL (const_int -4294901761 [0xffffffff0000ffff])
(nil)))
during RTL pass: vregs
test.c:12:1: internal compiler error: in extract_insn, at recog.cc:2882
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Expected behavior: successful compilation
Notes:
I failed to reproduce this behavior on Linux. GCC produces
(insn 11 10 12 2 (set (reg:DI 144)
(and:DI (reg:DI 146)
(const_int -2147483649 [0xffffffff7fffffff]))) "test.c":10:12 632
{*bclridi}
(expr_list:REG_EQUAL (const_int -4294901761 [0xffffffff0000ffff])
(nil)))
on vregs phase, so it looks like Windows GCC cuts bitmask to 32 bits, breaking
*bclridi pattern.