[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paschalis Mpeis via llvm-branch-commits
paschalis-mpeis wrote: The benefits of having`getFRemInstrCost` in my view are the below: 1. frem is a special case anyway: It's an IR instruction that is not supported by all hw and targets have to specialize. Handling it in a dedicated switch case with a dedicated TTI function call, clearly e

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Alexey Bataev via llvm-branch-commits
alexey-bataev wrote: > Changing `getArithmeticInstrCost` is just too dangerous. What if one opcode > needs TLI for a different reason? That should be fine, what's the dangerous in it? https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-co

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
paulwalker-arm wrote: Changing `getArithmeticInstrCost` is just too dangerous. What if one opcode needs TLI for a different reason? all of a sudden all existing callers are entered into the contract (FREM is guaranteed to be transformed into a math call) without ensuring that's actually the c

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Alexey Bataev via llvm-branch-commits
alexey-bataev wrote: > Personally I'm happy with keeping this nuance outside of TTI but if we really > want this captured within TTI then I think it's time to break FREM into its > own cost function (i.e. implement getFRemInstrCost. That way > getArithmeticInstrCost can work as it does today a

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -8362,9 +8362,12 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef VectorizedVals, unsigned OpIdx = isa(VL0) ? 0 : 1; TTI::OperandValueInfo Op1Info = getOperandInfo(E->getOperand(0)); TTI::OperandValueInfo Op2Info = getOperandInfo(E->getOperand(OpIdx));

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -1031,6 +1032,22 @@ APInt llvm::possiblyDemandedEltsInMask(Value *Mask) { return DemandedElts; } +InstructionCost +llvm::getVecLibCallCost(const Instruction *I, const TargetTransformInfo *TTI, +const TargetLibraryInfo *TLI, VectorType *VecTy, +

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
https://github.com/paulwalker-arm commented: I've review the patch from both side so most of the comment will be void if you opt for the new TTI hook. That advantage of the TTI hook is that because it is specific to FREM you can hardware things like numbers of operands, which should streamlin

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -410,6 +410,14 @@ bool maskIsAllOneOrUndef(Value *Mask); /// for each lane which may be active. APInt possiblyDemandedEltsInMask(Value *Mask); +/// Returns the cost of a call when a target has a vector library function for +/// the given \p VecTy, otherwise an invalid cost.

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -1031,6 +1032,22 @@ APInt llvm::possiblyDemandedEltsInMask(Value *Mask) { return DemandedElts; } +InstructionCost +llvm::getVecLibCallCost(const Instruction *I, const TargetTransformInfo *TTI, +const TargetLibraryInfo *TLI, VectorType *VecTy, +

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
https://github.com/paulwalker-arm edited https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Alexey Bataev via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Alexey Bataev via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paul Walker via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Alexey Bataev via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paschalis Mpeis via llvm-branch-commits
@@ -8362,9 +8362,20 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef VectorizedVals, unsigned OpIdx = isa(VL0) ? 0 : 1; TTI::OperandValueInfo Op1Info = getOperandInfo(E->getOperand(0)); TTI::OperandValueInfo Op2Info = getOperandInfo(E->getOperand(OpIdx));

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paschalis Mpeis via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-22 Thread Paschalis Mpeis via llvm-branch-commits
https://github.com/paschalis-mpeis updated https://github.com/llvm/llvm-project/pull/82488 >From 641aaf7c13d520bef52b092726f8346bfecb1c8d Mon Sep 17 00:00:00 2001 From: Paschalis Mpeis Date: Wed, 21 Feb 2024 11:53:00 + Subject: [PATCH 1/4] SLP cannot vectorize frem calls in AArch64. It nee

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Alexey Bataev via llvm-branch-commits
@@ -8362,9 +8362,20 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef VectorizedVals, unsigned OpIdx = isa(VL0) ? 0 : 1; TTI::OperandValueInfo Op1Info = getOperandInfo(E->getOperand(0)); TTI::OperandValueInfo Op2Info = getOperandInfo(E->getOperand(OpIdx));

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paul Walker via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paul Walker via llvm-branch-commits
@@ -869,6 +870,18 @@ TargetTransformInfo::getOperandInfo(const Value *V) { return {OpInfo, OpProps}; } +InstructionCost TargetTransformInfo::getVecLibCallCost( +const int OpCode, const TargetLibraryInfo *TLI, VectorType *VecTy, +TTI::TargetCostKind CostKind) { + Typ

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
paschalis-mpeis wrote: Addressed reviewers and rebased to parent pr: - #80423 Github is now rendering **only** the changes of this patch. https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.l

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
https://github.com/paschalis-mpeis edited https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
https://github.com/paschalis-mpeis edited https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
@@ -8362,9 +8362,20 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef VectorizedVals, unsigned OpIdx = isa(VL0) ? 0 : 1; TTI::OperandValueInfo Op1Info = getOperandInfo(E->getOperand(0)); TTI::OperandValueInfo Op2Info = getOperandInfo(E->getOperand(OpIdx));

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
https://github.com/paschalis-mpeis edited https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
https://github.com/paschalis-mpeis updated https://github.com/llvm/llvm-project/pull/82488 >From 641aaf7c13d520bef52b092726f8346bfecb1c8d Mon Sep 17 00:00:00 2001 From: Paschalis Mpeis Date: Wed, 21 Feb 2024 11:53:00 + Subject: [PATCH 1/3] SLP cannot vectorize frem calls in AArch64. It nee

[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

2024-02-21 Thread Paschalis Mpeis via llvm-branch-commits
https://github.com/paschalis-mpeis edited https://github.com/llvm/llvm-project/pull/82488 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits