On Wed, May 26, 2021 at 12:12 PM Andrew Pinski <pins...@gmail.com> wrote: > > 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 There's no simplification opportunity for nonimmediate_operand, but I'm not sure for other cases(not constants). Reading from codes in case NOT of simplify_unary_operation_1, there may be (vec_duplicate (not (plus X - 1))???
> 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 -- BR, Hongtao