[Bug target/111166] gcc unnecessarily creates vector operations for packing 32 bit integers into struct (x86_64)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 28 12:53:33 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111166
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |guojiufu at gcc dot gnu.org,
| |sayle at gcc dot gnu.org
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Roger was working on TImode incoming(?) argument code generation, this is
TImode outgoing argument code generation where we produce for 32bit parts
7: NOTE_INSN_BASIC_BLOCK 2
2: r84:SI=di:SI
3: r85:SI=si:SI
4: r86:SI=dx:SI
5: r87:SI=cx:SI
6: NOTE_INSN_FUNCTION_BEG
9: r88:DI=zero_extend(r84:SI)
10: r89:DI=r82:TI#0
11: r91:DI=0xffffffff00000000
12: {r90:DI=r89:DI&r91:DI;clobber flags:CC;}
13: {r92:DI=r90:DI|r88:DI;clobber flags:CC;}
14: r82:TI=r82:TI&<0xffffffffffffffff,0>|zero_extend(r92:DI)
15: r93:DI=zero_extend(r85:SI)
16: {r94:DI=r93:DI<<0x20;clobber flags:CC;}
17: r95:DI=r82:TI#0
18: r96:DI=zero_extend(r95:DI#0)
19: {r97:DI=r96:DI|r94:DI;clobber flags:CC;}
20: r82:TI=r82:TI&<0xffffffffffffffff,0>|zero_extend(r97:DI)
21: r98:DI=zero_extend(r86:SI)
22: r99:DI=r82:TI#8
23: r101:DI=0xffffffff00000000
24: {r100:DI=r99:DI&r101:DI;clobber flags:CC;}
25: {r102:DI=r100:DI|r98:DI;clobber flags:CC;}
26: r82:TI=r82:TI&<0,0xffffffffffffffff>|zero_extend(r102:DI)<<0x40
27: r103:DI=zero_extend(r87:SI)
28: {r104:DI=r103:DI<<0x20;clobber flags:CC;}
29: r105:DI=r82:TI#8
30: r106:DI=zero_extend(r105:DI#0)
31: {r107:DI=r106:DI|r104:DI;clobber flags:CC;}
32: r82:TI=r82:TI&<0,0xffffffffffffffff>|zero_extend(r107:DI)<<0x40
33: r108:DI=r82:TI#0
34: r109:DI=r82:TI#8
35: di:DI=r108:DI
36: si:DI=r109:DI
37: ax:DI=call [`do_smth_with_4_u32'] argc:0
and we fail to dissect "backwards" from the
33: r108:DI=r82:TI#0
34: r109:DI=r82:TI#8
subregs. Possibly one issue is that we re-use r82. The dual-use of r82
at the end also poses issues as combine tries to match things like
(parallel [
(set (reg:DI 108 [ D.2865 ])
(subreg:DI (reg:TI 82 [ D.2865 ]) 0))
(set (reg:TI 82 [ D.2865 ])
(ior:TI (and:TI (reg:TI 82 [ D.2865 ])
(const_wide_int 0x0ffffffffffffffff))
(ashift:TI (zero_extend:TI (reg:DI 107))
(const_int 64 [0x40]))))
])
but fails to "rename" r82 to split the parallel.
At RTL expansion time we store to D.2865 where it's DECL_RTL is r82:TI so
we can hardly fix it there. Only a later pass could figure each of the
insns fully define the reg.
Jiufu Guo is working to improve what we choose for DECL_RTL, but for
incoming params / outgoing return. This is a case where we could,
with -fno-tree-vectorize, improve DECL_RTL for an automatic var and
choose not TImode but something like a (concat:TI reg:DI reg:DI).
More information about the Gcc-bugs
mailing list