Do not embed result type in VN for scalar hw intrinsics (#72895)
authorKunal Pathak <Kunal.Pathak@microsoft.com>
Thu, 28 Jul 2022 20:21:20 +0000 (13:21 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Jul 2022 20:21:20 +0000 (13:21 -0700)
* do not embed result type for scalar hw intrinsics

* Check the simdSize

* oversight fix

src/coreclr/jit/hwintrinsic.cpp

index 417b517..58a0653 100644 (file)
@@ -210,10 +210,18 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, Co
 //
 /* static */ bool Compiler::vnEncodesResultTypeForHWIntrinsic(NamedIntrinsic hwIntrinsicID)
 {
+    // No extra type information is needed for scalar/special HW Intrinsic.
+    //
+    unsigned simdSize = 0;
+    if (HWIntrinsicInfo::tryLookupSimdSize(hwIntrinsicID, &simdSize) && (simdSize == 0))
+    {
+        return false;
+    }
+
     int numArgs = HWIntrinsicInfo::lookupNumArgs(hwIntrinsicID);
 
     // HW Intrinsic's with -1 for numArgs have a varying number of args, so we currently
-    // give themm a unique value number them, and don't add an extra argument.
+    // give them a unique value number, and don't add an extra argument.
     //
     if (numArgs == -1)
     {