https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99813
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the bug is in swapped constraints on add<mode>3_poly_1.
We have:
(define_constraint "Uai"
"@internal
A constraint that matches a VG-based constant that can be added by
a single INC or DEC."
(match_operand 0 "aarch64_sve_scalar_inc_dec_immediate"))
(define_constraint "Uav"
"@internal
A constraint that matches a VG-based constant that can be added by
a single ADDVL or ADDPL."
(match_operand 0 "aarch64_sve_addvl_addpl_immediate"))
and *add<mode>3_aarch64 has:
Uai,Uav
and matching output for those 2 constraints is:
* return aarch64_output_sve_scalar_inc_dec (operands[2]);
* return aarch64_output_sve_addvl_addpl (operands[2]);"
Now, *add<mode>3_poly_1 has:
Uav,Uai
and matching output for those 2 constraints is:
* return aarch64_output_sve_scalar_inc_dec (operands[2]);
* return aarch64_output_sve_addvl_addpl (operands[2]);
so IMHO, either we need to swap those 2 return lines, or do:
--- gcc/config/aarch64/aarch64.md.jj 2021-02-25 23:07:07.851319165 +0100
+++ gcc/config/aarch64/aarch64.md 2021-03-30 11:13:35.994077470 +0200
@@ -2051,7 +2051,7 @@
(match_operand:GPI 0 "register_operand" "=r,r,r,r,r,r,&r")
(plus:GPI
(match_operand:GPI 1 "register_operand" "%rk,rk,rk,rk,rk,0,rk")
- (match_operand:GPI 2 "aarch64_pluslong_or_poly_operand"
"I,r,J,Uaa,Uav,Uai,Uat")))]
+ (match_operand:GPI 2 "aarch64_pluslong_or_poly_operand"
"I,r,J,Uaa,Uai,Uav,Uat")))]
"TARGET_SVE && operands[0] != stack_pointer_rtx"
"@
add\\t%<w>0, %<w>1, %2