Repository: dotnet/runtime
File: src/coreclr/jit/simd.h (C/C++)

Code before:
        {
            return EvaluateSimdMaskToPattern<TSimd, uint8_t>(arg0);
        }

        case TYP_SHORT:
        case TYP_USHORT:
        {
            return EvaluateSimdMaskToPattern<TSimd, uint16_t>(arg0);
        }

        default:
        {
            unreached();
        }
    }
}

//------------------------------------------------------------------------
// NarrowAndDuplicateSimdLong: Narrow each ULONG element in arg0 to size
//    TSimd. Each element is then duplicated to the number of TSimd values
//    that fit into a ULONG.
//    For example, [1, 2] with TBase of UINT becomes [1, 1, 2, 2]
//
// Arguments:
//    result -  Returns the narrowed and duplicated simd value
//    vecCon -  The simd value to narrow and duplicate
//
template <typename TSimd, typename TBase>
void NarrowAndDuplicateSimdLong(TSimd* result, const TSimd& arg0)
{
    uint32_t count = sizeof(TSimd) / sizeof(TBase);

    for (uint32_t i = 0; i < count; i++)
    {
        uint64_t input0;
        memcpy(&input0, &arg0.u8[(i * sizeof(TBase) / sizeof(uint64_t)) * sizeof(uint64_t)], sizeof(uint64_t));

        // Saturate to largest value for TBase
        if (input0 > (TBase)-1)
        {
            input0 = (TBase)-1;
        }

        memcpy(&result->u8[i * sizeof(TBase)], &input0, sizeof(TBase));
    }
}

template <typename TSimd>
void NarrowAndDuplicateSimdLong(var_types baseType, TSimd* result, const TSimd& arg0)
{
    switch (baseType)

Review comment (refactor):
The parameter name in the documentation is 'vecCon', but the actual parameter name in the function signature is 'arg0'. Update the documentation to use 'arg0' for consistency.
```suggestion
//    arg0   -  The simd value to narrow and duplicate
```

Code after:
        {
            return EvaluateSimdMaskToPattern<TSimd, uint8_t>(arg0);
        }

        case TYP_SHORT:
        case TYP_USHORT:
        {
            return EvaluateSimdMaskToPattern<TSimd, uint16_t>(arg0);
        }

        default:
        {
            unreached();
        }
    }
}

//------------------------------------------------------------------------
// NarrowAndDuplicateSimdLong: Narrow each ULONG element in arg0 to size
//    TSimd. Each element is then duplicated to the number of TSimd values
//    that fit into a ULONG.
//    For example, [1, 2] with TBase of UINT becomes [1, 1, 2, 2]
//
// Arguments:
//    result -  Returns the narrowed and duplicated simd value
//    arg0   -  The simd value to narrow and duplicate
//
template <typename TSimd, typename TBase>
void NarrowAndDuplicateSimdLong(TSimd* result, const TSimd& arg0)
{
    uint32_t count = sizeof(TSimd) / sizeof(TBase);

    for (uint32_t i = 0; i < count; i++)
    {
        uint64_t input0;
        memcpy(&input0, &arg0.u8[(i * sizeof(TBase) / sizeof(uint64_t)) * sizeof(uint64_t)], sizeof(uint64_t));

        // Saturate to largest value for TBase
        if (input0 > (TBase)-1)
        {
            input0 = (TBase)-1;
        }

        memcpy(&result->u8[i * sizeof(TBase)], &input0, sizeof(TBase));
    }
}

template <typename TSimd>
void NarrowAndDuplicateSimdLong(var_types baseType, TSimd* result, const TSimd& arg0)
{
    switch (baseType)