@@ -1946,6 +1946,7 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
1946
1946
SmallVector<unsigned , 4 > concreteOverloads;
1947
1947
SmallVector<unsigned , 4 > numericOverloads;
1948
1948
SmallVector<unsigned , 4 > sequenceOverloads;
1949
+ SmallVector<unsigned , 4 > simdOverloads;
1949
1950
SmallVector<unsigned , 4 > otherGenericOverloads;
1950
1951
1951
1952
auto refinesOrConformsTo = [&](NominalTypeDecl *nominal, KnownProtocolKind kind) -> bool {
@@ -1967,7 +1968,10 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
1967
1968
unsigned index = *iter;
1968
1969
auto *decl = Choices[index ]->getOverloadChoice ().getDecl ();
1969
1970
auto *nominal = decl->getDeclContext ()->getSelfNominalTypeDecl ();
1970
- if (!decl->getInterfaceType ()->is <GenericFunctionType>()) {
1971
+
1972
+ if (isSIMDOperator (decl)) {
1973
+ simdOverloads.push_back (index );
1974
+ } else if (!decl->getInterfaceType ()->is <GenericFunctionType>()) {
1971
1975
concreteOverloads.push_back (index );
1972
1976
} else if (refinesOrConformsTo (nominal, KnownProtocolKind::AdditiveArithmetic)) {
1973
1977
numericOverloads.push_back (index );
@@ -2024,11 +2028,20 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
2024
2028
sequenceOverloads.clear ();
2025
2029
break ;
2026
2030
}
2031
+
2032
+ if (TypeChecker::conformsToKnownProtocol (
2033
+ argType, KnownProtocolKind::SIMD,
2034
+ CS.DC ->getParentModule ())) {
2035
+ first = std::copy (simdOverloads.begin (), simdOverloads.end (), first);
2036
+ simdOverloads.clear ();
2037
+ break ;
2038
+ }
2027
2039
}
2028
2040
2029
2041
first = std::copy (otherGenericOverloads.begin (), otherGenericOverloads.end (), first);
2030
2042
first = std::copy (numericOverloads.begin (), numericOverloads.end (), first);
2031
2043
first = std::copy (sequenceOverloads.begin (), sequenceOverloads.end (), first);
2044
+ first = std::copy (simdOverloads.begin (), simdOverloads.end (), first);
2032
2045
}
2033
2046
2034
2047
void DisjunctionChoiceProducer::partitionDisjunction (
@@ -2113,7 +2126,8 @@ void DisjunctionChoiceProducer::partitionDisjunction(
2113
2126
}
2114
2127
2115
2128
// Partition SIMD operators.
2116
- if (isOperatorDisjunction (Disjunction)) {
2129
+ if (isOperatorDisjunction (Disjunction) &&
2130
+ !Choices[0 ]->getOverloadChoice ().getName ().getBaseIdentifier ().isArithmeticOperator ()) {
2117
2131
forEachChoice (Choices, [&](unsigned index , Constraint *constraint) -> bool {
2118
2132
if (isSIMDOperator (constraint->getOverloadChoice ().getDecl ())) {
2119
2133
simdOperators.push_back (index );
0 commit comments