Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Slang-specific intrinsics for integer pack/unpack #6459

Merged
merged 12 commits into from
Feb 28, 2025
31 changes: 0 additions & 31 deletions source/slang-core-module/slang-embedded-core-module-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ enum BaseTypeConversionRank : uint8_t
kBaseTypeConversionRank_Int32,
kBaseTypeConversionRank_IntPtr,
kBaseTypeConversionRank_Int64,

// Packed type conversion ranks where the overall rank order does not apply.
// They must be explicitly casted to another type.
kBaseTypeConversionRank_Int8x4Packed,
kBaseTypeConversionRank_UInt8x4Packed,

kBaseTypeConversionRank_Error,
};

Expand Down Expand Up @@ -155,17 +149,6 @@ static const BaseTypeConversionInfo kBaseTypes[] = {
UINT_MASK,
kBaseTypeConversionKind_Unsigned,
kBaseTypeConversionRank_IntPtr},

{"int8_t4_packed",
BaseType::Int8x4Packed,
0,
kBaseTypeConversionKind_Unsigned,
kBaseTypeConversionRank_Int8x4Packed},
{"uint8_t4_packed",
BaseType::UInt8x4Packed,
0,
kBaseTypeConversionKind_Unsigned,
kBaseTypeConversionRank_UInt8x4Packed},
};

void Session::finalizeSharedASTBuilder()
Expand All @@ -192,12 +175,6 @@ void Session::finalizeSharedASTBuilder()
globalAstBuilder->getBuiltinType(baseType.tag);
}

static bool isConversionRankPackedType(BaseTypeConversionRank rank)
{
return (rank == BaseTypeConversionRank::kBaseTypeConversionRank_Int8x4Packed) ||
(rank == BaseTypeConversionRank::kBaseTypeConversionRank_UInt8x4Packed);
}

// Given two base types, we need to be able to compute the cost of converting between them.
ConversionCost getBaseTypeConversionCost(
BaseTypeConversionInfo const& toInfo,
Expand All @@ -210,14 +187,6 @@ ConversionCost getBaseTypeConversionCost(
return kConversionCost_None;
}

// Handle special case for packed types, where they must be explicitly casted to another type.
bool isToPackedType = isConversionRankPackedType(toInfo.conversionRank);
bool isFromPackedType = isConversionRankPackedType(fromInfo.conversionRank);
if (isToPackedType || isFromPackedType)
{
return kConversionCost_GeneralConversion;
}

// Conversions within the same kind are easist to handle
if (toInfo.conversionKind == fromInfo.conversionKind)
{
Expand Down
Loading
Loading