[all-commits] [llvm/llvm-project] b22fa9: [ValueTracking][X86] Compute KnownBits for phadd/p...

mskamp via All-commits all-commits at lists.llvm.org
Tue Jul 16 07:50:42 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b22fa9093bb1a7be2de4e9d7073c94d3ecb69987
      https://github.com/llvm/llvm-project/commit/b22fa9093bb1a7be2de4e9d7073c94d3ecb69987
  Author: mskamp <msk at posteo.org>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M llvm/include/llvm/Analysis/VectorUtils.h
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Analysis/VectorUtils.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    A llvm/test/Analysis/ValueTracking/knownbits-x86-hadd-hsub.ll
    A llvm/test/CodeGen/X86/knownbits-hadd-hsub.ll
    M llvm/test/CodeGen/X86/pr53247.ll
    M llvm/unittests/Analysis/VectorUtilsTest.cpp

  Log Message:
  -----------
  [ValueTracking][X86] Compute KnownBits for phadd/phsub (#92429)

Add KnownBits computations to ValueTracking and X86 DAG lowering.
    
These instructions add/subtract adjacent vector elements in their operands. Example: phadd [X1, X2] [Y1, Y2] = [X1 + X2, Y1 + Y2]. This means that, in this example, we can compute the KnownBits of the operation by computing the KnownBits of [X1, X2] + [X1, X2] and [Y1, Y2] + [Y1, Y2] and intersecting the results. This approach also generalizes to all x86 vector types.
    
There are also the operations phadd.sw and phsub.sw, which perform saturating addition/subtraction. Use sadd_sat and ssub_sat to compute the KnownBits of these operations.
    
Also adjust the existing test case pr53247.ll because it can be transformed to a constant using the new KnownBits computation.
    
Fixes #82516.



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