summaryrefslogtreecommitdiff
path: root/src/jit/namedintrinsiclist.h
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2017-09-11 11:12:45 -0700
committerGitHub <noreply@github.com>2017-09-11 11:12:45 -0700
commite764b4dd021a38ba4c55a806069c4856e56e3f45 (patch)
tree54e674dee207120a4d26ec01f933a1759cbec6d4 /src/jit/namedintrinsiclist.h
parent354211fb52ae1503172ba0b1b44ff217ad712dbc (diff)
downloadcoreclr-e764b4dd021a38ba4c55a806069c4856e56e3f45.tar.gz
coreclr-e764b4dd021a38ba4c55a806069c4856e56e3f45.tar.bz2
coreclr-e764b4dd021a38ba4c55a806069c4856e56e3f45.zip
JIT: optimize Enum.HasFlag (#13748)
Check for calls to `Enum.HasFlag` using the new named intrinsic support introduced in #13815. Implement a simple recognizer for these named intrinsics (currently just recognizing `Enum.HasFlag`). When the call is recognized, optimize if both operands are boxes with compatible types and both boxes can be removed. The optimization changes the call to a simple and/compare tree on the underlying enum values. To accomplish this, generalize the behavior of `gtTryRemoveBoxUpstreamEffects` to add a "trial removal" mode and to optionally suppress narrowing of the copy source. Invoke the optimization during importation (which will catch most cases) and again during morph (to get the post-inline cases). Added test cases. Suprisingly there were almost no uses of HasFlag in the current CoreCLR test suite. Closes #5626.
Diffstat (limited to 'src/jit/namedintrinsiclist.h')
-rw-r--r--src/jit/namedintrinsiclist.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/jit/namedintrinsiclist.h b/src/jit/namedintrinsiclist.h
new file mode 100644
index 0000000000..cf81afc119
--- /dev/null
+++ b/src/jit/namedintrinsiclist.h
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#ifndef _NAMEDINTRINSICLIST_H_
+#define _NAMEDINTRINSICLIST_H_
+
+// Named jit intrinsics
+
+enum NamedIntrinsic
+{
+ NI_Illegal = 0,
+ NI_Enum_HasFlag = 1
+};
+
+#endif // _NAMEDINTRINSICLIST_H_