[llvm] [llvm][CodeGen] Intrinsic `llvm.powi.*` code gen for vector arguments (PR #118242)

Zhaoxin Yang via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 17:16:03 PST 2024


ylzsx wrote:

> I kind of think this should be handled by unrolling the vector in `DAGTypeLegalizer::PromoteIntOp_ExpOp`.
> 
> This should work
> 
> ```
> diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
> index 493abfde148c..e386fd510419 100644
> --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
> +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
> @@ -2579,6 +2579,9 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) {
>        N->getOpcode() == ISD::FPOWI || N->getOpcode() == ISD::STRICT_FPOWI;
>    unsigned OpOffset = IsStrict ? 1 : 0;
> 
> +  if (N->getValueType(0).isVector())
> +    return DAG.UnrollVectorOp(N);
> +
>    // The integer operand is the last operand in FPOWI (or FLDEXP) (so the result
>    // and floating point operand is already type legalized).
>    RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0))
> ```

Thanks. Your approach is simpler and more reasonable. I will modify it to adopt this solution.

https://github.com/llvm/llvm-project/pull/118242


More information about the llvm-commits mailing list