[X86] Simplify some `pternlog` intrinsics
authorNoah Goldstein <goldstein.w.n@gmail.com>
Mon, 3 Apr 2023 04:40:38 +0000 (23:40 -0500)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Mon, 3 Apr 2023 16:05:11 +0000 (11:05 -0500)
commitcacc0033b12b2e6400eedd6e449644e87ec3099b
tree0a0f0db4af799a8932577da6adfa1f230c572e3b
parent63243b94cd4cb23a9c145fd129f24ed47be1883d
[X86] Simplify some `pternlog` intrinsics

Currently `pternlog` intrinsics stay as a function call and are unable
to merge with other bin-ops / constant-fold.

This commit adds support for reducing all `pternlog` intrinsics to
their base logic-ops so that they can be further reduced in other
passes.

Since the x86 backend doesn't do a great job creating `vpternlog`
instructions from stray logic ops, the current logic only simplifies
in the cases were we obviously will be able to do as good or
better. As the x86 backend improves, more cases can be simplified.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D145220
llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp
llvm/test/CodeGen/X86/ternlog.ll
llvm/test/Transforms/InstCombine/X86/x86-ternlog.ll
llvm/unittests/Transforms/CMakeLists.txt
llvm/unittests/Transforms/InstCombine/CMakeLists.txt [new file with mode: 0644]
llvm/unittests/Transforms/InstCombine/X86/CMakeLists.txt [new file with mode: 0644]
llvm/unittests/Transforms/InstCombine/X86/TernlogTest.cpp [new file with mode: 0644]