@@ -21530,6 +21530,35 @@ GenTree* Compiler::gtNewSimdCeilNode(var_types type, GenTree* op1, CorInfoType s
21530
21530
return gtNewSimdHWIntrinsicNode(type, op1, intrinsic, simdBaseJitType, simdSize);
21531
21531
}
21532
21532
21533
+ //------------------------------------------------------------------------
21534
+ // gtNewSimdCvtMaskToVectorNode: Convert a HW instrinsic mask node to a vector
21535
+ //
21536
+ // Arguments:
21537
+ // type -- The type of the node to convert to
21538
+ // op1 -- The node to convert
21539
+ // simdBaseJitType -- the base jit type of the converted node
21540
+ // simdSize -- the simd size of the converted node
21541
+ //
21542
+ // Return Value:
21543
+ // The node converted to the given type
21544
+ //
21545
+ GenTree* Compiler::gtNewSimdCvtMaskToVectorNode(var_types type,
21546
+ GenTree* op1,
21547
+ CorInfoType simdBaseJitType,
21548
+ unsigned simdSize)
21549
+ {
21550
+ assert(varTypeIsMask(op1));
21551
+ assert(varTypeIsSIMD(type));
21552
+
21553
+ #if defined(TARGET_XARCH)
21554
+ return gtNewSimdHWIntrinsicNode(type, op1, NI_EVEX_ConvertMaskToVector, simdBaseJitType, simdSize);
21555
+ #elif defined(TARGET_ARM64)
21556
+ return gtNewSimdHWIntrinsicNode(type, op1, NI_Sve_ConvertMaskToVector, simdBaseJitType, simdSize);
21557
+ #else
21558
+ #error Unsupported platform
21559
+ #endif // !TARGET_XARCH && !TARGET_ARM64
21560
+ }
21561
+
21533
21562
GenTree* Compiler::gtNewSimdCvtNode(var_types type,
21534
21563
GenTree* op1,
21535
21564
CorInfoType simdTargetBaseJitType,
@@ -21892,6 +21921,37 @@ GenTree* Compiler::gtNewSimdCvtNativeNode(var_types type,
21892
21921
return gtNewSimdHWIntrinsicNode(type, op1, hwIntrinsicID, simdSourceBaseJitType, simdSize);
21893
21922
}
21894
21923
21924
+ //------------------------------------------------------------------------
21925
+ // gtNewSimdCvtVectorToMaskNode: Convert a HW instrinsic vector node to a mask
21926
+ //
21927
+ // Arguments:
21928
+ // type -- The type of the mask to produce.
21929
+ // op1 -- The node to convert
21930
+ // simdBaseJitType -- the base jit type of the converted node
21931
+ // simdSize -- the simd size of the converted node
21932
+ //
21933
+ // Return Value:
21934
+ // The node converted to the a mask type
21935
+ //
21936
+ GenTree* Compiler::gtNewSimdCvtVectorToMaskNode(var_types type,
21937
+ GenTree* op1,
21938
+ CorInfoType simdBaseJitType,
21939
+ unsigned simdSize)
21940
+ {
21941
+ assert(varTypeIsMask(type));
21942
+ assert(varTypeIsSIMD(op1));
21943
+
21944
+ #if defined(TARGET_XARCH)
21945
+ return gtNewSimdHWIntrinsicNode(TYP_MASK, op1, NI_EVEX_ConvertVectorToMask, simdBaseJitType, simdSize);
21946
+ #elif defined(TARGET_ARM64)
21947
+ // We use cmpne which requires an embedded mask.
21948
+ GenTree* trueMask = gtNewSimdAllTrueMaskNode(simdBaseJitType, simdSize);
21949
+ return gtNewSimdHWIntrinsicNode(TYP_MASK, trueMask, op1, NI_Sve_ConvertVectorToMask, simdBaseJitType, simdSize);
21950
+ #else
21951
+ #error Unsupported platform
21952
+ #endif // !TARGET_XARCH && !TARGET_ARM64
21953
+ }
21954
+
21895
21955
GenTree* Compiler::gtNewSimdCmpOpNode(
21896
21956
genTreeOps op, var_types type, GenTree* op1, GenTree* op2, CorInfoType simdBaseJitType, unsigned simdSize)
21897
21957
{
@@ -22569,19 +22629,15 @@ GenTree* Compiler::gtNewSimdCmpOpNode(
22569
22629
22570
22630
assert(intrinsic != NI_Illegal);
22571
22631
22572
- #if defined(TARGET_XARCH)
22573
22632
if (needsConvertMaskToVector)
22574
22633
{
22575
22634
GenTree* retNode = gtNewSimdHWIntrinsicNode(TYP_MASK, op1, op2, intrinsic, simdBaseJitType, simdSize);
22576
- return gtNewSimdHWIntrinsicNode (type, retNode, NI_EVEX_ConvertMaskToVector , simdBaseJitType, simdSize);
22635
+ return gtNewSimdCvtMaskToVectorNode (type, retNode, simdBaseJitType, simdSize);
22577
22636
}
22578
22637
else
22579
22638
{
22580
22639
return gtNewSimdHWIntrinsicNode(type, op1, op2, intrinsic, simdBaseJitType, simdSize);
22581
22640
}
22582
- #else
22583
- return gtNewSimdHWIntrinsicNode(type, op1, op2, intrinsic, simdBaseJitType, simdSize);
22584
- #endif
22585
22641
}
22586
22642
22587
22643
GenTree* Compiler::gtNewSimdCmpOpAllNode(
@@ -27157,6 +27213,20 @@ bool GenTreeHWIntrinsic::OperIsCreateScalarUnsafe() const
27157
27213
}
27158
27214
}
27159
27215
27216
+ //------------------------------------------------------------------------
27217
+ // OperIsBitwiseHWIntrinsic: Is the operation a bitwise logic operation.
27218
+ //
27219
+ // Arguments:
27220
+ // oper -- The operation to check
27221
+ //
27222
+ // Return Value:
27223
+ // Whether oper is a bitwise logic intrinsic node.
27224
+ //
27225
+ bool GenTreeHWIntrinsic::OperIsBitwiseHWIntrinsic(genTreeOps oper)
27226
+ {
27227
+ return (oper == GT_AND) || (oper == GT_AND_NOT) || (oper == GT_OR) || (oper == GT_XOR);
27228
+ }
27229
+
27160
27230
//------------------------------------------------------------------------
27161
27231
// OperIsBitwiseHWIntrinsic: Is this HWIntrinsic a bitwise logic intrinsic node.
27162
27232
//
@@ -27165,8 +27235,8 @@ bool GenTreeHWIntrinsic::OperIsCreateScalarUnsafe() const
27165
27235
//
27166
27236
bool GenTreeHWIntrinsic::OperIsBitwiseHWIntrinsic() const
27167
27237
{
27168
- genTreeOps Oper = HWOperGet();
27169
- return Oper == GT_AND || Oper == GT_OR || Oper == GT_XOR || Oper == GT_AND_NOT ;
27238
+ genTreeOps oper = HWOperGet();
27239
+ return OperIsBitwiseHWIntrinsic(oper) ;
27170
27240
}
27171
27241
27172
27242
//------------------------------------------------------------------------
0 commit comments