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)

Reply via email to