[all-commits] [llvm/llvm-project] b8652f: [X86] Fold AND(SRL(X, Y), 1) -> SETCC(BT(X, Y)) (RECO...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Fri Apr 1 09:03:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8652fbcbbde830ec2f48ff165e5706fb607d02b
      https://github.com/llvm/llvm-project/commit/b8652fbcbbde830ec2f48ff165e5706fb607d02b
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-04-01 (Fri, 01 Apr 2022)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/setcc.ll

  Log Message:
  -----------
  [X86] Fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) (RECOMMITTED)

As noticed on PR39174, if we're extracting a single non-constant bit index, then try to use BT+SETCC instead to avoid messing around moving the shift amount to the ECX register, using slow x86 shift ops etc.

Recommitted with a fix to ensure we zext/trunc the SETCC result to the original type.

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




More information about the All-commits mailing list