@@ -1877,6 +1877,7 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
18771877 SmallVector<unsigned , 4 > concreteOverloads;
18781878 SmallVector<unsigned , 4 > numericOverloads;
18791879 SmallVector<unsigned , 4 > sequenceOverloads;
1880+ SmallVector<unsigned , 4 > simdOverloads;
18801881 SmallVector<unsigned , 4 > otherGenericOverloads;
18811882
18821883 auto refinesOrConformsTo = [&](NominalTypeDecl *nominal, KnownProtocolKind kind) -> bool {
@@ -1898,7 +1899,10 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
18981899 unsigned index = *iter;
18991900 auto *decl = Choices[index]->getOverloadChoice ().getDecl ();
19001901 auto *nominal = decl->getDeclContext ()->getSelfNominalTypeDecl ();
1901- if (!decl->getInterfaceType ()->is <GenericFunctionType>()) {
1902+
1903+ if (isSIMDOperator (decl)) {
1904+ simdOverloads.push_back (index);
1905+ } else if (!decl->getInterfaceType ()->is <GenericFunctionType>()) {
19021906 concreteOverloads.push_back (index);
19031907 } else if (refinesOrConformsTo (nominal, KnownProtocolKind::AdditiveArithmetic)) {
19041908 numericOverloads.push_back (index);
@@ -1955,11 +1959,20 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
19551959 sequenceOverloads.clear ();
19561960 break ;
19571961 }
1962+
1963+ if (TypeChecker::conformsToKnownProtocol (
1964+ argType, KnownProtocolKind::SIMD,
1965+ CS.DC ->getParentModule ())) {
1966+ first = std::copy (simdOverloads.begin (), simdOverloads.end (), first);
1967+ simdOverloads.clear ();
1968+ break ;
1969+ }
19581970 }
19591971
19601972 first = std::copy (otherGenericOverloads.begin (), otherGenericOverloads.end (), first);
19611973 first = std::copy (numericOverloads.begin (), numericOverloads.end (), first);
19621974 first = std::copy (sequenceOverloads.begin (), sequenceOverloads.end (), first);
1975+ first = std::copy (simdOverloads.begin (), simdOverloads.end (), first);
19631976}
19641977
19651978void DisjunctionChoiceProducer::partitionDisjunction (
@@ -2044,7 +2057,8 @@ void DisjunctionChoiceProducer::partitionDisjunction(
20442057 }
20452058
20462059 // Partition SIMD operators.
2047- if (isOperatorDisjunction (Disjunction)) {
2060+ if (isOperatorDisjunction (Disjunction) &&
2061+ !Choices[0 ]->getOverloadChoice ().getName ().getBaseIdentifier ().isArithmeticOperator ()) {
20482062 forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
20492063 if (isSIMDOperator (constraint->getOverloadChoice ().getDecl ())) {
20502064 simdOperators.push_back (index);
0 commit comments