[all-commits] [llvm/llvm-project] bf5748: [x86] fold vector (X > -1) & Y to shift+andn

RotateRight via All-commits all-commits at lists.llvm.org
Fri Nov 12 05:18:00 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf5748a1af0d2f6f9396d9dc6ac89d15de41eee7
      https://github.com/llvm/llvm-project/commit/bf5748a1af0d2f6f9396d9dc6ac89d15de41eee7
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-11-12 (Fri, 12 Nov 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/vector-pcmp.ll
    M llvm/test/CodeGen/X86/vselect-zero.ll

  Log Message:
  -----------
  [x86] fold vector (X > -1) & Y to shift+andn

and (pcmpgt X, -1), Y --> pandn (vsrai X, BitWidth-1), Y

This avoids the -1 constant vector in favor of an arithmetic shift
instruction if it exists (the ISA is still not complete after all
these years...).

We catch this pattern late in combining by matching PCMPGT, so it
should not interfere with more general folds.

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




More information about the All-commits mailing list