[all-commits] [llvm/llvm-project] 5b89aa: [X86] Fold concat(PCMP*(), PCMP*()) -> CMPPS(concat...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Fri Jun 28 07:24:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b89aaab00ab3fb7f7ed7c3b38da34ba25eee235
      https://github.com/llvm/llvm-project/commit/5b89aaab00ab3fb7f7ed7c3b38da34ba25eee235
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2024-06-28 (Fri, 28 Jun 2024)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/bitcast-int-to-vector-bool-sext.ll
    M llvm/test/CodeGen/X86/bitcast-int-to-vector-bool-zext.ll
    M llvm/test/CodeGen/X86/cmpf-avx.ll
    M llvm/test/CodeGen/X86/vector-popcnt-256-ult-ugt.ll
    M llvm/test/CodeGen/X86/vector-sext.ll
    M llvm/test/CodeGen/X86/vector-unsigned-cmp.ll

  Log Message:
  -----------
  [X86] Fold concat(PCMP*(),PCMP*()) -> CMPPS(concat,concat) on AVX1 targets (#95915)

This is a more restricted solution to #82242 (vs the more general #82290 + #84360) whereby if we're concat'ing PCMPEQ/GT nodes to 256-bits on a AVX1 target then determine if the integer values are in bounds to allow them to be converted to FP for a (legal) float comparison.

By performing this inside combineConcatVectorOps and working on PCMPEQ/GT nodes and not ICMP, we delay the fold until after more lowering has occurred, which avoids many of the issues where we were getting 'stuck' with CMPPS or unnecessary 256-bit nodes, and can more easily determine if either of the new concats() will be free.

Additionally this patch requires BOTH comparison operands to be in range, while technically not required this does help avoid the remaining regressions. It doesn't require that one of the operands is constant as it didn't seem necessary to include that constraint.

I've reused some of the code from #82290, and we may be able to add additional functionality (more CondCode patterns, v4i64/v4f64 handling, 'bitcastable' integers etc.) in future patches.

Fixes #82242



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