@@ -19133,14 +19133,22 @@ GenTree* Compiler::gtNewSimdBinOpNode(genTreeOps op,
19133
19133
{
19134
19134
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
19135
19135
19136
- if (varTypeIsFloating(simdBaseType) || !compOpportunisticallyDependsOn(InstructionSet_AVX2) )
19136
+ if (varTypeIsFloating(simdBaseType))
19137
19137
{
19138
19138
intrinsic = NI_AVX_And;
19139
19139
}
19140
- else
19140
+ else if (compOpportunisticallyDependsOn(InstructionSet_AVX2))
19141
19141
{
19142
19142
intrinsic = NI_AVX2_And;
19143
19143
}
19144
+ else
19145
+ {
19146
+ // Since this is a bitwise operation, we can still support it by lying
19147
+ // about the type and doing the operation using a supported instruction
19148
+
19149
+ intrinsic = NI_AVX_And;
19150
+ simdBaseJitType = CORINFO_TYPE_FLOAT;
19151
+ }
19144
19152
}
19145
19153
else if (simdBaseType == TYP_FLOAT)
19146
19154
{
@@ -19159,14 +19167,22 @@ GenTree* Compiler::gtNewSimdBinOpNode(genTreeOps op,
19159
19167
{
19160
19168
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
19161
19169
19162
- if (varTypeIsFloating(simdBaseType) || !compOpportunisticallyDependsOn(InstructionSet_AVX2) )
19170
+ if (varTypeIsFloating(simdBaseType))
19163
19171
{
19164
19172
intrinsic = NI_AVX_AndNot;
19165
19173
}
19166
- else
19174
+ else if (compOpportunisticallyDependsOn(InstructionSet_AVX2))
19167
19175
{
19168
19176
intrinsic = NI_AVX2_AndNot;
19169
19177
}
19178
+ else
19179
+ {
19180
+ // Since this is a bitwise operation, we can still support it by lying
19181
+ // about the type and doing the operation using a supported instruction
19182
+
19183
+ intrinsic = NI_AVX_AndNot;
19184
+ simdBaseJitType = CORINFO_TYPE_FLOAT;
19185
+ }
19170
19186
}
19171
19187
else if (simdBaseType == TYP_FLOAT)
19172
19188
{
@@ -19337,14 +19353,22 @@ GenTree* Compiler::gtNewSimdBinOpNode(genTreeOps op,
19337
19353
{
19338
19354
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
19339
19355
19340
- if (varTypeIsFloating(simdBaseType) || !compOpportunisticallyDependsOn(InstructionSet_AVX2) )
19356
+ if (varTypeIsFloating(simdBaseType))
19341
19357
{
19342
19358
intrinsic = NI_AVX_Or;
19343
19359
}
19344
- else
19360
+ else if (compOpportunisticallyDependsOn(InstructionSet_AVX2))
19345
19361
{
19346
19362
intrinsic = NI_AVX2_Or;
19347
19363
}
19364
+ else
19365
+ {
19366
+ // Since this is a bitwise operation, we can still support it by lying
19367
+ // about the type and doing the operation using a supported instruction
19368
+
19369
+ intrinsic = NI_AVX_Or;
19370
+ simdBaseJitType = CORINFO_TYPE_FLOAT;
19371
+ }
19348
19372
}
19349
19373
else if (simdBaseType == TYP_FLOAT)
19350
19374
{
@@ -19390,14 +19414,22 @@ GenTree* Compiler::gtNewSimdBinOpNode(genTreeOps op,
19390
19414
{
19391
19415
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
19392
19416
19393
- if (varTypeIsFloating(simdBaseType) || !compOpportunisticallyDependsOn(InstructionSet_AVX2) )
19417
+ if (varTypeIsFloating(simdBaseType))
19394
19418
{
19395
19419
intrinsic = NI_AVX_Xor;
19396
19420
}
19397
- else
19421
+ else if (compOpportunisticallyDependsOn(InstructionSet_AVX2))
19398
19422
{
19399
19423
intrinsic = NI_AVX2_Xor;
19400
19424
}
19425
+ else
19426
+ {
19427
+ // Since this is a bitwise operation, we can still support it by lying
19428
+ // about the type and doing the operation using a supported instruction
19429
+
19430
+ intrinsic = NI_AVX_Xor;
19431
+ simdBaseJitType = CORINFO_TYPE_FLOAT;
19432
+ }
19401
19433
}
19402
19434
else if (simdBaseType == TYP_FLOAT)
19403
19435
{
@@ -20458,18 +20490,19 @@ GenTree* Compiler::gtNewSimdDotProdNode(var_types type,
20458
20490
bool isSimdAsHWIntrinsic)
20459
20491
{
20460
20492
assert(IsBaselineSimdIsaSupportedDebugOnly());
20493
+ assert(varTypeIsArithmetic(type));
20461
20494
20462
- assert(varTypeIsSIMD(type) );
20463
- assert(getSIMDTypeForSize(simdSize) == type );
20495
+ var_types simdType = getSIMDTypeForSize(simdSize );
20496
+ assert(varTypeIsSIMD(simdType) );
20464
20497
20465
20498
assert(op1 != nullptr);
20466
- assert(op1->TypeGet() == type );
20499
+ assert(op1->TypeGet() == simdType );
20467
20500
20468
20501
assert(op2 != nullptr);
20469
- assert(op2->TypeGet() == type );
20502
+ assert(op2->TypeGet() == simdType );
20470
20503
20471
20504
var_types simdBaseType = JitType2PreciseVarType(simdBaseJitType);
20472
- assert(varTypeIsArithmetic (simdBaseType));
20505
+ assert(genActualType (simdBaseType) == type );
20473
20506
20474
20507
NamedIntrinsic intrinsic = NI_Illegal;
20475
20508
@@ -21061,11 +21094,7 @@ GenTree* Compiler::gtNewSimdUnOpNode(genTreeOps op,
21061
21094
21062
21095
case GT_NOT:
21063
21096
{
21064
- if (simdSize == 32)
21065
- {
21066
- assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
21067
- assert(varTypeIsFloating(simdBaseType) || compIsaSupportedDebugOnly(InstructionSet_AVX2));
21068
- }
21097
+ assert((simdSize != 32) || compIsaSupportedDebugOnly(InstructionSet_AVX));
21069
21098
21070
21099
intrinsic = (simdSize == 32) ? NI_Vector256_get_AllBitsSet : NI_Vector128_get_AllBitsSet;
21071
21100
op2 = gtNewSimdHWIntrinsicNode(type, intrinsic, simdBaseJitType, simdSize, isSimdAsHWIntrinsic);
0 commit comments