Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a var_types_classification for simd #82616

Merged
merged 2 commits into from
Feb 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions src/coreclr/jit/vartype.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum var_types_classification
VTF_BYR = 0x0010, // type is Byref
VTF_I = 0x0020, // is machine sized
VTF_S = 0x0040, // is a struct type
VTF_VEC = 0x0080, // is a vector type
};

#include "vartypesdef.h"
Expand Down Expand Up @@ -61,30 +62,16 @@ inline var_types TypeGet(var_types v)
return v;
}

#ifdef FEATURE_SIMD
template <class T>
inline bool varTypeIsSIMD(T vt)
{
switch (TypeGet(vt))
{
case TYP_SIMD8:
case TYP_SIMD12:
case TYP_SIMD16:
case TYP_SIMD32:
return true;
default:
return false;
}
}
#else // FEATURE_SIMD

// Always return false if FEATURE_SIMD is not enabled
template <class T>
inline bool varTypeIsSIMD(T vt)
{
#ifdef FEATURE_SIMD
return ((varTypeClassification[TypeGet(vt)] & VTF_VEC) != 0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative would be: return (TypeGet(vt) >= TYP_SIMD8) && (TypeGet(vt) <= TYP_SIMD32);

I'd expect varTypeClassification to typically be cached though, so I'm operating under the assumption a new classification is "better".

#else
// Always return false if FEATURE_SIMD is not enabled
return false;
}
#endif // !FEATURE_SIMD
}

template <class T>
inline bool varTypeIsIntegral(T vt)
Expand Down