-
- Downloads
aarch64/expr: Use ccmp when the outer expression is used twice [PR100942]
Ccmp is not used if the result of the and/ior is used by both a GIMPLE_COND and a GIMPLE_ASSIGN. This improves the code generation here by using ccmp in this case. Two changes is required, first we need to allow the outer statement's result be used more than once. The second change is that during the expansion of the gimple, we need to try using ccmp. This is needed because we don't use expand the ssa name of the lhs but rather expand directly from the gimple. A small note on the ccmp_4.c testcase, we should be able to get slightly better than with this patch but it is one extra instruction compared to before. PR target/100942 gcc/ChangeLog: * ccmp.cc (ccmp_candidate_p): Add outer argument. Allow if the outer is true and the lhs is used more than once. (expand_ccmp_expr): Update call to ccmp_candidate_p. * expr.h (expand_expr_real_gassign): Declare. * expr.cc (expand_expr_real_gassign): New function, split out from... (expand_expr_real_1): ...here. * cfgexpand.cc (expand_gimple_stmt_1): Use expand_expr_real_gassign. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ccmp_3.c: New test. * gcc.target/aarch64/ccmp_4.c: New test. * gcc.target/aarch64/ccmp_5.c: New test. Signed-off-by:Andrew Pinski <quic_apinski@quicinc.com> Co-Authored-By:
Richard Sandiford <richard.sandiford@arm.com>
Showing
- gcc/ccmp.cc 7 additions, 5 deletionsgcc/ccmp.cc
- gcc/cfgexpand.cc 6 additions, 25 deletionsgcc/cfgexpand.cc
- gcc/expr.cc 58 additions, 45 deletionsgcc/expr.cc
- gcc/expr.h 3 additions, 0 deletionsgcc/expr.h
- gcc/testsuite/gcc.target/aarch64/ccmp_3.c 20 additions, 0 deletionsgcc/testsuite/gcc.target/aarch64/ccmp_3.c
- gcc/testsuite/gcc.target/aarch64/ccmp_4.c 35 additions, 0 deletionsgcc/testsuite/gcc.target/aarch64/ccmp_4.c
- gcc/testsuite/gcc.target/aarch64/ccmp_5.c 20 additions, 0 deletionsgcc/testsuite/gcc.target/aarch64/ccmp_5.c
Loading
Please register or sign in to comment