On 3/23/23 10:29, Peter Bergner wrote:
https://gcc.gnu.org/PR41742
These are not addressed in the trunk patch, because int c is not initialized
with registers and for this reason we cannot eliminate them. If we initialize
int c then zero extension goes away.
I'm sorry that I don't know how REE works. Why can't it optimize this?
I see in the REE dump:
(insn 20 18 22 3 (set (reg:DI 4 4)
(zero_extend:DI (reg:QI 4 4 [orig:120 cD.3556+3 ] [120])))
"pr41742.c":6:41 8 {zero_extendqidi2} (nil))
(call_insn 22 20 41 3 (parallel [
(set (reg:DI 3 3)
(call (mem:SI (symbol_ref:DI ("memset") [flags 0x41]
<function_decl 0x7fff925f8400 __builtin_memset>) [0 memsetD.1196 S4 A8])
(const_int 64 [0x40])))
(use (const_int 0 [0]))
(clobber (reg:DI 96 lr)) ...
Is there a reason why REE cannot see that our (reg:QI 4) is a param register
and thus due to our ABI, already correctly sign/zero extended?
I don't think REE has ever considered exploiting ABI constraints.
Handling that might be a notable improvement on various targets. It'd
be a great place to do some experimentation.
jeff