When the mode of the destination operand selected by the condition
is SImode, explicit sign extension is applied to both selected
source operands, and the destination operand is marked as
sign-extended.
This method can eliminate some of the sign extension instructions
caused by conditional selection optimization.
gcc/ChangeLog:
* config/loongarch/loongarch.cc
(loongarch_sign_extend_if_subreg_prom_p): Determine if the
current operand is SUBREG and if the source of SUBREG is
the sign-extended value.
(loongarch_expand_conditional_move): Optimize.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/sign-extend-4.c: New test.
* gcc.target/loongarch/sign-extend-5.c: New test.