@@ -1877,6 +1877,7 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
1877
1877
SmallVector<unsigned , 4 > concreteOverloads;
1878
1878
SmallVector<unsigned , 4 > numericOverloads;
1879
1879
SmallVector<unsigned , 4 > sequenceOverloads;
1880
+ SmallVector<unsigned , 4 > simdOverloads;
1880
1881
SmallVector<unsigned , 4 > otherGenericOverloads;
1881
1882
1882
1883
auto refinesOrConformsTo = [&](NominalTypeDecl *nominal, KnownProtocolKind kind) -> bool {
@@ -1898,7 +1899,10 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
1898
1899
unsigned index = *iter;
1899
1900
auto *decl = Choices[index]->getOverloadChoice ().getDecl ();
1900
1901
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>()) {
1902
1906
concreteOverloads.push_back (index);
1903
1907
} else if (refinesOrConformsTo (nominal, KnownProtocolKind::AdditiveArithmetic)) {
1904
1908
numericOverloads.push_back (index);
@@ -1955,11 +1959,20 @@ void DisjunctionChoiceProducer::partitionGenericOperators(
1955
1959
sequenceOverloads.clear ();
1956
1960
break ;
1957
1961
}
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
+ }
1958
1970
}
1959
1971
1960
1972
first = std::copy (otherGenericOverloads.begin (), otherGenericOverloads.end (), first);
1961
1973
first = std::copy (numericOverloads.begin (), numericOverloads.end (), first);
1962
1974
first = std::copy (sequenceOverloads.begin (), sequenceOverloads.end (), first);
1975
+ first = std::copy (simdOverloads.begin (), simdOverloads.end (), first);
1963
1976
}
1964
1977
1965
1978
void DisjunctionChoiceProducer::partitionDisjunction (
@@ -2044,7 +2057,8 @@ void DisjunctionChoiceProducer::partitionDisjunction(
2044
2057
}
2045
2058
2046
2059
// Partition SIMD operators.
2047
- if (isOperatorDisjunction (Disjunction)) {
2060
+ if (isOperatorDisjunction (Disjunction) &&
2061
+ !Choices[0 ]->getOverloadChoice ().getName ().getBaseIdentifier ().isArithmeticOperator ()) {
2048
2062
forEachChoice (Choices, [&](unsigned index, Constraint *constraint) -> bool {
2049
2063
if (isSIMDOperator (constraint->getOverloadChoice ().getDecl ())) {
2050
2064
simdOperators.push_back (index);
0 commit comments