https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100711
Bug ID: 100711 Summary: Miss optimization for pandn Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com CC: hjl.tools at gmail dot com Target Milestone: --- Target: x86_64-*-* i?86-*-* cat test.c typedef int v4si __attribute__((vector_size (16))); v4si foo (int a, v4si b) { return (__extension__ (v4si) {~a, ~a, ~a, ~a}) & b; } generate notl %edi vmovdqa %xmm0, %xmm1 vpbroadcastd %edi, %xmm0 vpand %xmm1, %xmm0, %xmm0 ret it should be better as vmovdqa %xmm0, %xmm1 vpbroadcastd %edi, %xmm0 vpandn %xmm1, %xmm0, %xmm0