* [PATCH V3] Use sub-mode to move block on struct param and ret
@ 2022-11-29 13:37 Jiufu Guo
0 siblings, 0 replies; only message in thread
From: Jiufu Guo @ 2022-11-29 13:37 UTC (permalink / raw)
To: gcc-patches; +Cc: segher, dje.gcc, linkw, guojiufu, rguenther, jeffreyalaw
Hi,
When assigning a parameter to a variable, or assigning a variable to
return value with struct type, "block move" are used to expand
the assignment. It would be better to use the register mode according
to the target/ABI to move the blocks. And then this would raise more
opportunities for other optimization passes(cse/dse/xprop).
As the example code (like code in PR65421):
typedef struct SA {double a[3];} A;
A ret_arg_pt (A *a){return *a;} // on ppc64le, expect only 3 lfd(s)
A ret_arg (A a) {return a;} // just empty fun body
void st_arg (A a, A *p) {*p = a;} //only 3 stfd(s)
This patches check the "from" and "to" of an assignment in
"expand_assignment", if it is about param/ret which may passing via
register, then use the register mode to move sub-blocks for the
assignning.
This patches are based on the discussions for previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606498.html
When drafting this patch, I also investigated to update gimplify/nrv
to replace "return D.xxx;" with "return <retval>;". While there is
one issue: "<retval>" with PARALLEL code can not be accessed through
address/component_ref.
In this patches serial, the first patch is adding support for assigning
from parameter; the second support assigning to returns; the last
one adds test cases.
BR,
Jeff (Jiufu)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-29 13:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 13:37 [PATCH V3] Use sub-mode to move block on struct param and ret Jiufu Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).