https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122431

Kishan Parmar <kishan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #5 from Kishan Parmar <kishan at gcc dot gnu.org> ---
Below match.pd patch successfully resolves PR90323 for vector modes, because
having the existing vector andn expander in rs6000.md.

--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -12033,6 +12033,16 @@ and,
       (IFN_AVG_CEIL @0 @2)))
 #endif

+
+#if GIMPLE
+
+(simplify
+ (bit_xor:c (bit_and:c (bit_xor:c @0 @1) @2) @1)
+
+ (if (direct_internal_fn_supported_p (IFN_BIT_ANDN, type, OPTIMIZE_FOR_BOTH))
+  (bit_ior (bit_and @0 @2) (IFN_BIT_ANDN @1 @2))))
+#endif
+
 /* vec shift left insert (dup (A), A) -> dup(A) */
 (simplify
  (IFN_VEC_SHL_INSERT (vec_duplicate@1 @0) @0)

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.

Reply via email to