From f283b487ad1f1ae1ff3f181649801297be3a6a1a Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Mon, 26 Nov 2018 11:44:51 -0800 Subject: [PATCH] Fixing a few small issues with the SIMD vs SIMD HWIntrinsics (dotnet/coreclr#21097) * Fixing the simdHandleCache to add entries for Vector64FloatHandle and Vector128FloatHandle * Fixing two places that were calling just OperIsSIMD() rather than OperIsSIMDorSimdHWintrinsic() Commit migrated from https://github.com/dotnet/coreclr/commit/570bda3870a8c3b479384b21e1e1bdd427fdd3a1 --- src/coreclr/src/jit/compiler.h | 4 ++-- src/coreclr/src/jit/hwintrinsic.cpp | 8 ++++---- src/coreclr/src/jit/lowerarmarch.cpp | 2 +- src/coreclr/src/jit/morph.cpp | 5 +++-- src/coreclr/src/jit/simd.cpp | 19 +++++++++++++------ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/coreclr/src/jit/compiler.h b/src/coreclr/src/jit/compiler.h index 1ffd5e0..1e5663f 100644 --- a/src/coreclr/src/jit/compiler.h +++ b/src/coreclr/src/jit/compiler.h @@ -7536,12 +7536,12 @@ private: #ifdef FEATURE_HW_INTRINSICS #if defined(_TARGET_ARM64_) CORINFO_CLASS_HANDLE Vector64FloatHandle; - CORINFO_CLASS_HANDLE Vector64UIntHandle; + CORINFO_CLASS_HANDLE Vector64IntHandle; CORINFO_CLASS_HANDLE Vector64UShortHandle; CORINFO_CLASS_HANDLE Vector64UByteHandle; CORINFO_CLASS_HANDLE Vector64ShortHandle; CORINFO_CLASS_HANDLE Vector64ByteHandle; - CORINFO_CLASS_HANDLE Vector64IntHandle; + CORINFO_CLASS_HANDLE Vector64UIntHandle; #endif // defined(_TARGET_ARM64_) CORINFO_CLASS_HANDLE Vector128FloatHandle; CORINFO_CLASS_HANDLE Vector128DoubleHandle; diff --git a/src/coreclr/src/jit/hwintrinsic.cpp b/src/coreclr/src/jit/hwintrinsic.cpp index a2f741e..a87f40f 100644 --- a/src/coreclr/src/jit/hwintrinsic.cpp +++ b/src/coreclr/src/jit/hwintrinsic.cpp @@ -117,8 +117,8 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va { case TYP_FLOAT: return m_simdHandleCache->Vector64FloatHandle; - case TYP_UINT: - return m_simdHandleCache->Vector64UIntHandle; + case TYP_INT: + return m_simdHandleCache->Vector64IntHandle; case TYP_USHORT: return m_simdHandleCache->Vector64UShortHandle; case TYP_UBYTE: @@ -127,8 +127,8 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va return m_simdHandleCache->Vector64ShortHandle; case TYP_BYTE: return m_simdHandleCache->Vector64ByteHandle; - case TYP_INT: - return m_simdHandleCache->Vector64IntHandle; + case TYP_UINT: + return m_simdHandleCache->Vector64UIntHandle; default: assert(!"Didn't find a class handle for simdType"); } diff --git a/src/coreclr/src/jit/lowerarmarch.cpp b/src/coreclr/src/jit/lowerarmarch.cpp index 2ad167e..d8d23eb 100644 --- a/src/coreclr/src/jit/lowerarmarch.cpp +++ b/src/coreclr/src/jit/lowerarmarch.cpp @@ -357,7 +357,7 @@ void Lowering::LowerBlockStore(GenTreeBlk* blkNode) addr->ClearContained(); } } - else if (!source->IsMultiRegCall() && !source->OperIsSIMD()) + else if (!source->IsMultiRegCall() && !source->OperIsSIMDorSimdHWintrinsic()) { assert(source->IsLocal()); MakeSrcContained(blkNode, source); diff --git a/src/coreclr/src/jit/morph.cpp b/src/coreclr/src/jit/morph.cpp index fb7ab00..863ebba 100644 --- a/src/coreclr/src/jit/morph.cpp +++ b/src/coreclr/src/jit/morph.cpp @@ -1594,8 +1594,9 @@ void fgArgInfo::ArgsComplete() else if (isMultiRegArg && varTypeIsSIMD(argx->TypeGet())) { // SIMD types do not need the optimization below due to their sizes - if (argx->OperIs(GT_SIMD) || (argx->OperIs(GT_OBJ) && argx->AsObj()->gtOp1->OperIs(GT_ADDR) && - argx->AsObj()->gtOp1->gtOp.gtOp1->OperIs(GT_SIMD))) + if (argx->OperIsSIMDorSimdHWintrinsic() || + (argx->OperIs(GT_OBJ) && argx->AsObj()->gtOp1->OperIs(GT_ADDR) && + argx->AsObj()->gtOp1->gtOp.gtOp1->OperIsSIMDorSimdHWintrinsic())) { curArgTabEntry->needTmp = true; } diff --git a/src/coreclr/src/jit/simd.cpp b/src/coreclr/src/jit/simd.cpp index 1f735a1..ccebc78 100644 --- a/src/coreclr/src/jit/simd.cpp +++ b/src/coreclr/src/jit/simd.cpp @@ -437,15 +437,15 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u size = Vector256SizeBytes; JITDUMP(" Known type Vector256\n"); } - else if (typeHnd == m_simdHandleCache->Vector256FloatHandle) + else +#endif // defined(_TARGET_XARCH) + if (typeHnd == m_simdHandleCache->Vector128FloatHandle) { simdBaseType = TYP_FLOAT; - size = Vector256SizeBytes; - JITDUMP(" Known type Vector256\n"); + size = Vector128SizeBytes; + JITDUMP(" Known type Vector128\n"); } - else -#endif // defined(_TARGET_XARCH) - if (typeHnd == m_simdHandleCache->Vector128DoubleHandle) + else if (typeHnd == m_simdHandleCache->Vector128DoubleHandle) { simdBaseType = TYP_DOUBLE; size = Vector128SizeBytes; @@ -499,7 +499,14 @@ var_types Compiler::getBaseTypeAndSizeOfSIMDType(CORINFO_CLASS_HANDLE typeHnd, u size = Vector128SizeBytes; JITDUMP(" Known type Vector128\n"); } + else #if defined(_TARGET_ARM64_) + if (typeHnd == m_simdHandleCache->Vector64FloatHandle) + { + simdBaseType = TYP_FLOAT; + size = Vector64SizeBytes; + JITDUMP(" Known type Vector64\n"); + } else if (typeHnd == m_simdHandleCache->Vector64IntHandle) { simdBaseType = TYP_INT; -- 2.7.4