From 51c3dc3bbd5e7515cbc03249c5e34b239a87b281 Mon Sep 17 00:00:00 2001 From: Fei Peng Date: Fri, 7 Sep 2018 14:45:37 -0700 Subject: [PATCH] Fix AVX2 Gather Intrinsic failture with JITStress --- src/jit/gentree.cpp | 5 ++++- src/jit/gentree.h | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp index 39fee9c..8c5852e 100644 --- a/src/jit/gentree.cpp +++ b/src/jit/gentree.cpp @@ -1361,7 +1361,8 @@ AGAIN: case GT_HWIntrinsic: if ((op1->AsHWIntrinsic()->gtHWIntrinsicId != op2->AsHWIntrinsic()->gtHWIntrinsicId) || (op1->AsHWIntrinsic()->gtSIMDBaseType != op2->AsHWIntrinsic()->gtSIMDBaseType) || - (op1->AsHWIntrinsic()->gtSIMDSize != op2->AsHWIntrinsic()->gtSIMDSize)) + (op1->AsHWIntrinsic()->gtSIMDSize != op2->AsHWIntrinsic()->gtSIMDSize) || + (op1->AsHWIntrinsic()->gtIndexBaseType != op2->AsHWIntrinsic()->gtIndexBaseType)) { return false; } @@ -2054,6 +2055,7 @@ AGAIN: hash += tree->gtHWIntrinsic.gtHWIntrinsicId; hash += tree->gtHWIntrinsic.gtSIMDBaseType; hash += tree->gtHWIntrinsic.gtSIMDSize; + hash += tree->gtHWIntrinsic.gtIndexBaseType; break; #endif // FEATURE_HW_INTRINSICS @@ -7546,6 +7548,7 @@ GenTree* Compiler::gtCloneExpr( GenTreeHWIntrinsic(hwintrinsicOp->TypeGet(), hwintrinsicOp->gtGetOp1(), hwintrinsicOp->gtGetOp2IfPresent(), hwintrinsicOp->gtHWIntrinsicId, hwintrinsicOp->gtSIMDBaseType, hwintrinsicOp->gtSIMDSize); + copy->AsHWIntrinsic()->gtIndexBaseType = hwintrinsicOp->gtIndexBaseType; } break; #endif diff --git a/src/jit/gentree.h b/src/jit/gentree.h index d30d51e..d14ad1a 100644 --- a/src/jit/gentree.h +++ b/src/jit/gentree.h @@ -4119,18 +4119,24 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic var_types gtIndexBaseType; // for AVX2 Gather* intrinsics GenTreeHWIntrinsic(var_types type, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size) - : GenTreeJitIntrinsic(GT_HWIntrinsic, type, nullptr, nullptr, baseType, size), gtHWIntrinsicId(hwIntrinsicID) + : GenTreeJitIntrinsic(GT_HWIntrinsic, type, nullptr, nullptr, baseType, size) + , gtHWIntrinsicId(hwIntrinsicID) + , gtIndexBaseType(TYP_UNKNOWN) { } GenTreeHWIntrinsic(var_types type, GenTree* op1, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size) - : GenTreeJitIntrinsic(GT_HWIntrinsic, type, op1, nullptr, baseType, size), gtHWIntrinsicId(hwIntrinsicID) + : GenTreeJitIntrinsic(GT_HWIntrinsic, type, op1, nullptr, baseType, size) + , gtHWIntrinsicId(hwIntrinsicID) + , gtIndexBaseType(TYP_UNKNOWN) { } GenTreeHWIntrinsic( var_types type, GenTree* op1, GenTree* op2, NamedIntrinsic hwIntrinsicID, var_types baseType, unsigned size) - : GenTreeJitIntrinsic(GT_HWIntrinsic, type, op1, op2, baseType, size), gtHWIntrinsicId(hwIntrinsicID) + : GenTreeJitIntrinsic(GT_HWIntrinsic, type, op1, op2, baseType, size) + , gtHWIntrinsicId(hwIntrinsicID) + , gtIndexBaseType(TYP_UNKNOWN) { } -- 2.7.4