[all-commits] [llvm/llvm-project] 918ccb: [X86][SSE] Handle basic inversion of PTEST/TESTP o...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Wed Apr 1 03:33:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 918ccb64b02281355a6226fe8af07dc40e8ff9e3
      https://github.com/llvm/llvm-project/commit/918ccb64b02281355a6226fe8af07dc40e8ff9e3
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-04-01 (Wed, 01 Apr 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/combine-ptest.ll
    M llvm/test/CodeGen/X86/combine-testpd.ll
    M llvm/test/CodeGen/X86/combine-testps.ll

  Log Message:
  -----------
  [X86][SSE] Handle basic inversion of PTEST/TESTP operands (PR38522)

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 TESTZ(X,~Y) pattern and also handle KTEST/KORTEST in the future.

Differential Revision: https://reviews.llvm.org/D76984




More information about the All-commits mailing list