https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122431
--- Comment #8 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Kishan Parmar from comment #5)
> I am curious why a similar andn expander is not exposed for scalar modes? I
> attempted to add define_expand "andn<mode>3" for SI and DI modes, which
> effectively solved this bug for scalars. However, this caused unexpected
> regressions where rlwimi and rldimi patterns stopped matching for edge cases.
> currently working on a fix for that interaction.
It is there, but more generic than you might imagine:
(define_insn "*bool<mode>3_imm"
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
(match_operator:GPR 3 "boolean_or_operator"
[(match_operand:GPR 1 "gpc_reg_operand" "%r")
(match_operand:GPR 2 "logical_const_operand" "n")]))]
""
"%q3i%e2 %0,%1,%u2"
[(set_attr "type" "logical")])
(define_insn "*bool<mode>3"
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
(match_operator:GPR 3 "boolean_operator"
[(match_operand:GPR 1 "gpc_reg_operand" "r")
(match_operand:GPR 2 "gpc_reg_operand" "r")]))]
""
"%q3 %0,%1,%2"
[(set_attr "type" "logical")])
(and "*bool<mode>3_dot" and "*bool<mode>3_dot2" and "*boolc<mode>3" and
its dots, and everything for "boolcc" as well).