On Tue, May 25, 2021 at 6:17 PM Hongtao Liu <crazy...@gmail.com> wrote: > > Update patch: > The new patch simplify (vec_duplicate (not (nonimmedaite_operand))) > to (not (vec_duplicate (nonimmedaite_operand))). This is not a > straightforward simplification, just adding some tendency to pull not > out of vec_duplicate. > > For i386, it will enable below opt > > from > notl %edi > vpbroadcastd %edi, %xmm0 > vpand %xmm1, %xmm0, %xmm0 > to > vpbroadcastd %edi, %xmm0 > vpandn %xmm1, %xmm0, %xmm0 > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,}. > Ok for trunk? > gcc/ChangeLog: > > PR target/100711 > * simplify-rtx.c (simplify_unary_operation_1): > Simplify (vec_duplicate (not (nonimmedaite_operand))) > to (not (vec_duplicate (nonimmedaite_operand))). > > gcc/testsuite/ChangeLog: > > PR target/100711 > * gcc.target/i386/avx2-pr100711.c: New test. > * gcc.target/i386/avx512bw-pr100711.c: New test.
This patch should not use nonimmedaite_operand at all in simplify-rtx.c. Rather use !CONSTANT_P (XEXP (op, 0)) instead. And even then (not CONST_INT) will never be there anyways as it will always be simplified to a constant in the first place. So removing that check is fine. Thanks, Andrew