mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow Builtin.bitcast to do VecNxInt1 -> IntN (#36252)
This is necessary to support the idiom for movmsk operations on x86.
This commit is contained in:
@@ -577,6 +577,15 @@ static ValueDecl *getCastOperation(ASTContext &Context, Identifier Id,
|
||||
if (auto *BIT = CheckOutput->getAs<BuiltinIntegerType>())
|
||||
if (BIT->isFixedWidth() && BIT->getFixedWidth() == BFT->getBitWidth())
|
||||
break;
|
||||
|
||||
// Support VecNxInt1 -> IntN bitcast for SIMD comparison results.
|
||||
if (auto *Vec = CheckInput->getAs<BuiltinVectorType>())
|
||||
if (auto *BIT = CheckOutput->getAs<BuiltinIntegerType>())
|
||||
if (auto *Element = Vec->getElementType()->getAs<BuiltinIntegerType>())
|
||||
if (Element->getFixedWidth() == 1 &&
|
||||
BIT->isFixedWidth() &&
|
||||
BIT->getFixedWidth() == Vec->getNumElements())
|
||||
break;
|
||||
|
||||
// FIXME: Implement bitcast typechecking.
|
||||
llvm_unreachable("Bitcast not supported yet!");
|
||||
|
||||
Reference in New Issue
Block a user