Hi!
So, I tested this patch. The test builds Linux for all targets, and the
number reported here is just binary size (usually a good indicator for
combine effectiveness). C0 is the unmodified compiler, C1 is with your
patch. A size of 0 means it did not build.
C0 C1
alpha 6403469 100.000%
arc 0 0
arm 10196358 100.000%
arm64 0 20228766
armhf 15042594 100.000%
c6x 2496218 100.000%
csky 0 0
h8300 1217198 100.000%
i386 11966700 100.000%
ia64 18814277 100.000%
m68k 3856350 100.000%
microblaze 5864258 100.000%
mips 9142108 100.000%
mips64 7344744 100.000%
nds32 0 0
nios2 3909477 100.000%
openrisc 4554446 100.000%
parisc 7721195 100.000%
parisc64 0 0
powerpc 10447477 100.000%
powerpc64 22257111 100.000%
powerpc64le 19292786 100.000%
riscv32 1630934 100.000%
riscv64 7628058 100.000%
s390 15173928 100.000%
sh 3410671 100.000%
shnommu 1685616 100.000%
sparc 4737096 100.000%
sparc64 7167122 100.000%
x86_64 19718928 100.000%
xtensa 2639363 100.000%
So, there is no difference for most targets (I checked some targets and
there really is no difference). The only exception is aarch64 (which
the kernel calls "arm64"): the unpatched compiler ICEs! (At least three
times, even).
during RTL pass: reload
/home/segher/src/kernel/kernel/cgroup/cgroup.c: In function 'rebind_subsystems':
/home/segher/src/kernel/kernel/cgroup/cgroup.c:1777:1: internal compiler error:
in lra_set_insn_recog_data, at lra.c:1004
1777 | }
| ^
0x1096215f lra_set_insn_recog_data(rtx_insn*)
/home/segher/src/gcc/gcc/lra.c:1004
0x109625d7 lra_get_insn_recog_data
/home/segher/src/gcc/gcc/lra-int.h:488
0x109625d7 lra_update_insn_regno_info(rtx_insn*)
/home/segher/src/gcc/gcc/lra.c:1625
0x10962d03 lra_update_insn_regno_info(rtx_insn*)
/home/segher/src/gcc/gcc/lra.c:1623
0x10962d03 lra_push_insn_1
/home/segher/src/gcc/gcc/lra.c:1780
[etc]
This means LRA found an unrecognised insn; and that insn is
(insn 817 804 818 21 (set (reg:DI 324)
(sign_extract:DI (ashift:DI (subreg:DI (reg:SI 232) 0)
(const_int 3 [0x3]))
(const_int 35 [0x23])
(const_int 0 [0])))
"/home/segher/src/kernel/kernel/cgroup/cgroup.c":1747:3 -1
(nil))
LRA created that as a reload for
(insn 347 819 348 21 (parallel [
(set (mem/f:DI (reg:DI 324) [233 *__p_84+0 S8 A64])
(asm_operands/v:DI ("stlr %1, %0") ("=Q") 0 [
(reg:DI 325 [orig:106 prephitmp_18 ] [106])
]
[
(asm_input:DI ("r")
/home/segher/src/kernel/kernel/cgroup/cgroup.c:1747)
]
[] /home/segher/src/kernel/kernel/cgroup/cgroup.c:1747))
(clobber (mem:BLK (scratch) [0 A8]))
]) "/home/segher/src/kernel/kernel/cgroup/cgroup.c":1747:3 -1
(expr_list:REG_DEAD (reg:SI 232)
(expr_list:REG_DEAD (reg:DI 106 [ prephitmp_18 ])
(nil))))
as
347: {[r324:DI]=asm_operands;clobber [scratch];}
REG_DEAD r232:SI
REG_DEAD r106:DI
Inserting insn reload before:
817: r324:DI=sign_extract(r232:SI#0<<0x3,0x23,0)
818: r324:DI=r324:DI+r284:DI
819: r325:DI=r106:DI
(and then it died).
Can you fix this first? There probably is something target-specific
wrong related to zero_extract.
Segher