[PATCH] D76984: [X86][SSE] Handle basic inversion of PTEST/TESTP operands (PR38522)
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 28 05:55:36 PDT 2020
RKSimon created this revision.
RKSimon added reviewers: craig.topper, spatel, lebedev.ri, gnzlbg.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
RKSimon planned changes to this revision.
RKSimon added a comment.
RKSimon updated this revision to Diff 253332.
sorry, git stash screwed up - fixed version shortly.
RKSimon added a comment.
fixed merge
PTEST/TESTP sets EFLAGS as:
TESTZ: ZF = (Op0 & Op1) == 0
TESTC: CF = (~Op0 & Op1) == 0
TESTNZC: ZF == 0 && CF == 0
If we are inverting the 0'th operand of a PTEST/TESTP instruction we can adjust the comparisons to correct handle the inversion implicitly.
Additionally, for "TESTZ" (ZF) cases, the allones case, PTEST(X,-1) can be simplified to PTEST(X,X).
We can expand this for the TEST(X,~Y) pattern and also handle KTEST/KORTEST as well but I wanted to get some initial feedback first.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76984
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/combine-ptest.ll
llvm/test/CodeGen/X86/combine-testpd.ll
llvm/test/CodeGen/X86/combine-testps.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76984.253332.patch
Type: text/x-patch
Size: 13573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200328/258fe41f/attachment-0001.bin>
More information about the llvm-commits
mailing list