[all-commits] [llvm/llvm-project] aefd25: [DAG][X86] expandABD - add branchless abds/abdu ex...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu May 23 03:07:57 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aefd2572a504d675ef623d2f3d61364232b19f26
      https://github.com/llvm/llvm-project/commit/aefd2572a504d675ef623d2f3d61364232b19f26
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2024-05-23 (Thu, 23 May 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/abds-vector-128.ll
    M llvm/test/CodeGen/X86/abds-vector-256.ll
    M llvm/test/CodeGen/X86/abdu-vector-128.ll
    M llvm/test/CodeGen/X86/abdu-vector-256.ll
    M llvm/test/CodeGen/X86/midpoint-int-vec-128.ll
    M llvm/test/CodeGen/X86/midpoint-int-vec-256.ll

  Log Message:
  -----------
  [DAG][X86] expandABD - add branchless abds/abdu expansion for 0/-1 comparison result cases (#92780)

If the comparison results are allbits masks, we can expand as `abd(lhs, rhs) -> sub(cmpgt(lhs, rhs), xor(sub(lhs, rhs), cmpgt(lhs, rhs)))`, replacing a sub+sub+select pattern with the simpler sub+xor+sub pattern.

This allows us to remove a lot of X86 specific legalization code, and will be useful in future generic expansion for the legalization work in #92576

Alive2: https://alive2.llvm.org/ce/z/sj863C



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list