diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index 0534375b821af..362a8b1d82df3 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -115,6 +115,7 @@ set( JIT_SOURCES hostallocator.cpp indirectcalltransformer.cpp importer.cpp + importer_vectorization.cpp inline.cpp inlinepolicy.cpp instr.cpp diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 47d84ae3fe5b9..f9647e92c562f 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -3028,6 +3028,7 @@ class Compiler // For binary opers. GenTree* gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1, GenTree* op2); + GenTreeColon* gtNewColonNode(var_types type, GenTree* elseNode, GenTree* thenNode); GenTreeQmark* gtNewQmarkNode(var_types type, GenTree* cond, GenTreeColon* colon); GenTree* gtNewLargeOperNode(genTreeOps oper, @@ -3037,6 +3038,9 @@ class Compiler GenTreeIntCon* gtNewIconNode(ssize_t value, var_types type = TYP_INT); GenTreeIntCon* gtNewIconNode(unsigned fieldOffset, FieldSeqNode* fieldSeq); + GenTreeIntCon* gtNewNull(); + GenTreeIntCon* gtNewTrue(); + GenTreeIntCon* gtNewFalse(); GenTree* gtNewPhysRegNode(regNumber reg, var_types type); @@ -3365,7 +3369,7 @@ class Compiler GenTreeLclFld* gtNewLclFldNode(unsigned lnum, var_types type, unsigned offset); GenTree* gtNewInlineCandidateReturnExpr(GenTree* inlineCandidate, var_types type, BasicBlockFlags bbFlags); - GenTree* gtNewFieldRef(var_types type, CORINFO_FIELD_HANDLE fldHnd, GenTree* obj = nullptr, DWORD offset = 0); + GenTreeField* gtNewFieldRef(var_types type, CORINFO_FIELD_HANDLE fldHnd, GenTree* obj = nullptr, DWORD offset = 0); GenTree* gtNewIndexRef(var_types typ, GenTree* arrayOp, GenTree* indexOp); @@ -4407,6 +4411,19 @@ class Compiler void impResetLeaveBlock(BasicBlock* block, unsigned jmpAddr); GenTree* impTypeIsAssignable(GenTree* typeTo, GenTree* typeFrom); + GenTree* impStringEqualsOrStartsWith(bool startsWith, CORINFO_SIG_INFO* sig, unsigned methodFlags); + GenTree* impSpanEqualsOrStartsWith(bool startsWith, CORINFO_SIG_INFO* sig, unsigned methodFlags); + GenTree* impExpandHalfConstEquals(GenTreeLclVar* data, + GenTree* lengthFld, + bool checkForNull, + bool startsWith, + WCHAR* cnsData, + int len, + int dataOffset); + GenTree* impExpandHalfConstEqualsSWAR(GenTreeLclVar* data, WCHAR* cns, int len, int dataOffset); + GenTree* impExpandHalfConstEqualsSIMD(GenTreeLclVar* data, WCHAR* cns, int len, int dataOffset); + GenTreeStrCon* impGetStrConFromSpan(GenTree* span); + GenTree* impIntrinsic(GenTree* newobjThis, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE method, @@ -4523,7 +4540,7 @@ class Compiler void impInsertTreeBefore(GenTree* tree, const DebugInfo& di, Statement* stmtBefore); void impAssignTempGen(unsigned tmp, GenTree* val, - unsigned curLevel, + unsigned curLevel = (unsigned)CHECK_SPILL_NONE, Statement** pAfterStmt = nullptr, const DebugInfo& di = DebugInfo(), BasicBlock* block = nullptr); diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index 6672e2fbb6ece..fcbb8cca3b438 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -1093,7 +1093,7 @@ inline GenTree* Compiler::gtNewRuntimeLookup(CORINFO_GENERIC_HANDLE hnd, CorInfo // Return Value: // The created node. // -inline GenTree* Compiler::gtNewFieldRef(var_types type, CORINFO_FIELD_HANDLE fldHnd, GenTree* obj, DWORD offset) +inline GenTreeField* Compiler::gtNewFieldRef(var_types type, CORINFO_FIELD_HANDLE fldHnd, GenTree* obj, DWORD offset) { // GT_FIELD nodes are transformed into GT_IND nodes. assert(GenTree::s_gtNodeSizes[GT_IND] <= GenTree::s_gtNodeSizes[GT_FIELD]); @@ -1105,7 +1105,7 @@ inline GenTree* Compiler::gtNewFieldRef(var_types type, CORINFO_FIELD_HANDLE fld type = impNormStructType(structHnd); } - GenTree* fieldNode = new (this, GT_FIELD) GenTreeField(type, obj, fldHnd, offset); + GenTreeField* fieldNode = new (this, GT_FIELD) GenTreeField(type, obj, fldHnd, offset); // If "obj" is the address of a local, note that a field of that struct local has been accessed. if ((obj != nullptr) && obj->OperIs(GT_ADDR) && varTypeIsStruct(obj->AsUnOp()->gtOp1) && diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 428a4db6d8d9e..7cb6166f21191 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -5735,6 +5735,11 @@ GenTree* Compiler::gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1, return node; } +GenTreeColon* Compiler::gtNewColonNode(var_types type, GenTree* elseNode, GenTree* thenNode) +{ + return new (this, GT_COLON) GenTreeColon(TYP_INT, elseNode, thenNode); +} + GenTreeQmark* Compiler::gtNewQmarkNode(var_types type, GenTree* cond, GenTreeColon* colon) { compQmarkUsed = true; @@ -5753,6 +5758,21 @@ GenTreeIntCon* Compiler::gtNewIconNode(ssize_t value, var_types type) return new (this, GT_CNS_INT) GenTreeIntCon(type, value); } +GenTreeIntCon* Compiler::gtNewNull() +{ + return gtNewIconNode(0, TYP_REF); +} + +GenTreeIntCon* Compiler::gtNewTrue() +{ + return gtNewIconNode(1, TYP_INT); +} + +GenTreeIntCon* Compiler::gtNewFalse() +{ + return gtNewIconNode(0, TYP_INT); +} + GenTreeIntCon* Compiler::gtNewIconNode(unsigned fieldOffset, FieldSeqNode* fieldSeq) { GenTreeIntCon* node = new (this, GT_CNS_INT) GenTreeIntCon(TYP_I_IMPL, static_cast(fieldOffset)); diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 3e84db2f91290..c22b6915675f7 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -3912,6 +3912,39 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis, retNode = impArrayAccessIntrinsic(clsHnd, sig, memberRef, readonlyCall, ni); break; + case NI_System_String_Equals: + { + retNode = impStringEqualsOrStartsWith(/*startsWith:*/ false, sig, methodFlags); + break; + } + + case NI_System_MemoryExtensions_Equals: + case NI_System_MemoryExtensions_SequenceEqual: + { + retNode = impSpanEqualsOrStartsWith(/*startsWith:*/ false, sig, methodFlags); + break; + } + + case NI_System_String_StartsWith: + { + retNode = impStringEqualsOrStartsWith(/*startsWith:*/ true, sig, methodFlags); + break; + } + + case NI_System_MemoryExtensions_StartsWith: + { + retNode = impSpanEqualsOrStartsWith(/*startsWith:*/ true, sig, methodFlags); + break; + } + + case NI_System_MemoryExtensions_AsSpan: + case NI_System_String_op_Implicit: + { + assert(sig->numArgs == 1); + isSpecial = impStackTop().val->OperIs(GT_CNS_STR); + break; + } + case NI_System_String_get_Chars: { GenTree* op2 = impPopStack().val; @@ -5243,7 +5276,11 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method) } else if (strcmp(className, "String") == 0) { - if (strcmp(methodName, "get_Chars") == 0) + if (strcmp(methodName, "Equals") == 0) + { + result = NI_System_String_Equals; + } + else if (strcmp(methodName, "get_Chars") == 0) { result = NI_System_String_get_Chars; } @@ -5251,6 +5288,33 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method) { result = NI_System_String_get_Length; } + else if (strcmp(methodName, "op_Implicit") == 0) + { + result = NI_System_String_op_Implicit; + } + else if (strcmp(methodName, "StartsWith") == 0) + { + result = NI_System_String_StartsWith; + } + } + else if (strcmp(className, "MemoryExtensions") == 0) + { + if (strcmp(methodName, "AsSpan") == 0) + { + result = NI_System_MemoryExtensions_AsSpan; + } + if (strcmp(methodName, "SequenceEqual") == 0) + { + result = NI_System_MemoryExtensions_SequenceEqual; + } + else if (strcmp(methodName, "Equals") == 0) + { + result = NI_System_MemoryExtensions_Equals; + } + else if (strcmp(methodName, "StartsWith") == 0) + { + result = NI_System_MemoryExtensions_StartsWith; + } } else if (strcmp(className, "Span`1") == 0) { diff --git a/src/coreclr/jit/importer_vectorization.cpp b/src/coreclr/jit/importer_vectorization.cpp new file mode 100644 index 0000000000000..00a5389a8939e --- /dev/null +++ b/src/coreclr/jit/importer_vectorization.cpp @@ -0,0 +1,752 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "jitpch.h" +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//------------------------------------------------------------------------ +// importer_vectorization.cpp +// +// This file is responsible for various (partial) vectorizations during import phase, +// e.g. the following APIs are currently supported: +// +// 1) String.Equals(string, string) +// 2) String.Equals(string, string, StringComparison.Ordinal) +// 3) str.Equals(string) +// 4) str.Equals(String, StringComparison.Ordinal) +// 5) str.StartsWith(string, StringComparison.Ordinal) +// 6) MemoryExtensions.SequenceEqual(ROS, ROS) +// 7) MemoryExtensions.Equals(ROS, ROS, StringComparison.Ordinal) +// 8) MemoryExtensions.StartsWith(ROS, ROS) +// 9) MemoryExtensions.StartsWith(ROS, ROS, StringComparison.Ordinal) +// +// When one of the arguments is a constant string of a [0..32] size so we can inline +// a vectorized comparison against it using SWAR or SIMD techniques (e.g. via two V256 vectors) +// +// We might add these in future: +// 1) OrdinalIgnoreCase for everything above +// 2) Span.CopyTo +// 3) Spans/Arrays of bytes (e.g. UTF8) against a constant RVA data +// + +//------------------------------------------------------------------------ +// impExpandHalfConstEqualsSIMD: Attempts to unroll and vectorize +// Equals against a constant WCHAR data for Length in [8..32] range +// using SIMD instructions. C# equivalent of what this function emits: +// +// bool IsTestString(ReadOnlySpan span) +// { +// // Length and Null checks are not handled here +// ref char s = ref MemoryMarshal.GetReference(span); +// var v1 = Vector128.LoadUnsafe(ref s); +// var v1 = Vector128.LoadUnsafe(ref s, span.Length - Vector128.Count); +// var cns1 = Vector128.Create('T', 'e', 's', 't', 'S', 't', 'r', 'i'); +// var cns2 = Vector128.Create('s', 't', 'S', 't', 'r', 'i', 'n', 'g'); +// return ((v1 ^ cns1) | (v2 ^ cns2)) == Vector.Zero; +// +// // for: +// // return span.SequenceEqual("TestString"); +// } +// +// Arguments: +// data - Pointer to a data to vectorize +// cns - Constant data (array of 2-byte chars) +// len - Number of chars in the cns +// dataOffset - Offset for data +// +// Return Value: +// A pointer to the newly created SIMD node or nullptr if unrolling is not +// possible or not profitable +// +// Notes: +// This function doesn't check obj for null or its Length, it's just an internal helper +// for impExpandHalfConstEquals +// +GenTree* Compiler::impExpandHalfConstEqualsSIMD(GenTreeLclVar* data, WCHAR* cns, int len, int dataOffset) +{ + assert(len >= 8 && len <= 32); + +#if defined(FEATURE_HW_INTRINSICS) && defined(TARGET_64BIT) + if (!compOpportunisticallyDependsOn(InstructionSet_Vector128)) + { + // We need SSE2 or ADVSIMD at least + return nullptr; + } + + CorInfoType baseType = CORINFO_TYPE_ULONG; + + int simdSize; + var_types simdType; + + NamedIntrinsic niZero; + NamedIntrinsic niEquals; + NamedIntrinsic niCreate; + + GenTree* cnsVec1; + GenTree* cnsVec2; + + // Optimization: don't use two vectors for Length == 8 or 16 + bool useSingleVector = false; + +#if defined(TARGET_XARCH) + if (compOpportunisticallyDependsOn(InstructionSet_Vector256) && len >= 16) + { + // Handle [16..32] inputs via two Vector256 + assert(len >= 16 && len <= 32); + + simdSize = 32; + simdType = TYP_SIMD32; + + niZero = NI_Vector256_get_Zero; + niEquals = NI_Vector256_op_Equality; + niCreate = NI_Vector256_Create; + + // Special case: use a single vector for Length == 16 + useSingleVector = len == 16; + + assert(sizeof(ssize_t) == 8); // this code is guarded with TARGET_64BIT + GenTree* long1 = gtNewIconNode(*(ssize_t*)(cns + 0), TYP_LONG); + GenTree* long2 = gtNewIconNode(*(ssize_t*)(cns + 4), TYP_LONG); + GenTree* long3 = gtNewIconNode(*(ssize_t*)(cns + 8), TYP_LONG); + GenTree* long4 = gtNewIconNode(*(ssize_t*)(cns + 12), TYP_LONG); + cnsVec1 = gtNewSimdHWIntrinsicNode(simdType, long1, long2, long3, long4, niCreate, baseType, simdSize); + + // cnsVec2 most likely overlaps with cnsVec1: + GenTree* long5 = gtNewIconNode(*(ssize_t*)(cns + len - 16), TYP_LONG); + GenTree* long6 = gtNewIconNode(*(ssize_t*)(cns + len - 12), TYP_LONG); + GenTree* long7 = gtNewIconNode(*(ssize_t*)(cns + len - 8), TYP_LONG); + GenTree* long8 = gtNewIconNode(*(ssize_t*)(cns + len - 4), TYP_LONG); + cnsVec2 = gtNewSimdHWIntrinsicNode(simdType, long5, long6, long7, long8, niCreate, baseType, simdSize); + } + else +#endif + if (len <= 16) + { + // Handle [8..16] inputs via two Vector128 + assert(len >= 8 && len <= 16); + + simdSize = 16; + simdType = TYP_SIMD16; + + niZero = NI_Vector128_get_Zero; + niEquals = NI_Vector128_op_Equality; + niCreate = NI_Vector128_Create; + + // Special case: use a single vector for Length == 8 + useSingleVector = len == 8; + + assert(sizeof(ssize_t) == 8); // this code is guarded with TARGET_64BIT + GenTree* long1 = gtNewIconNode(*(ssize_t*)(cns + 0), TYP_LONG); + GenTree* long2 = gtNewIconNode(*(ssize_t*)(cns + 4), TYP_LONG); + cnsVec1 = gtNewSimdHWIntrinsicNode(simdType, long1, long2, niCreate, baseType, simdSize); + + // cnsVec2 most likely overlaps with cnsVec1: + GenTree* long3 = gtNewIconNode(*(ssize_t*)(cns + len - 8), TYP_LONG); + GenTree* long4 = gtNewIconNode(*(ssize_t*)(cns + len - 4), TYP_LONG); + cnsVec2 = gtNewSimdHWIntrinsicNode(simdType, long3, long4, niCreate, baseType, simdSize); + } + else + { + JITDUMP("impExpandHalfConstEqualsSIMD: No V256 support and data is too big for V128\n"); + // NOTE: We might consider using four V128 for ARM64 + return nullptr; + } + + GenTree* zero = gtNewSimdHWIntrinsicNode(simdType, niZero, baseType, simdSize); + + GenTree* offset1 = gtNewIconNode(dataOffset, TYP_I_IMPL); + GenTree* offset2 = gtNewIconNode(dataOffset + len * sizeof(USHORT) - simdSize, TYP_I_IMPL); + GenTree* dataPtr1 = gtNewOperNode(GT_ADD, TYP_BYREF, data, offset1); + GenTree* dataPtr2 = gtNewOperNode(GT_ADD, TYP_BYREF, gtClone(data), offset2); + + GenTree* vec1 = gtNewIndir(simdType, dataPtr1); + GenTree* vec2 = gtNewIndir(simdType, dataPtr2); + + // TODO-Unroll-CQ: Spill vec1 and vec2 for better pipelining, currently we end up emitting: + // + // vmovdqu xmm0, xmmword ptr [rcx+12] + // vpxor xmm0, xmm0, xmmword ptr[reloc @RWD00] + // vmovdqu xmm1, xmmword ptr [rcx+20] + // vpxor xmm1, xmm1, xmmword ptr[reloc @RWD16] + // + // While we should re-order them to be: + // + // vmovdqu xmm0, xmmword ptr [rcx+12] + // vmovdqu xmm1, xmmword ptr [rcx+20] + // vpxor xmm0, xmm0, xmmword ptr[reloc @RWD00] + // vpxor xmm1, xmm1, xmmword ptr[reloc @RWD16] + // + + // ((v1 ^ cns1) | (v2 ^ cns2)) == zero + GenTree* xor1 = gtNewSimdBinOpNode(GT_XOR, simdType, vec1, cnsVec1, baseType, simdSize, false); + GenTree* xor2 = gtNewSimdBinOpNode(GT_XOR, simdType, vec2, cnsVec2, baseType, simdSize, false); + GenTree* orr = gtNewSimdBinOpNode(GT_OR, simdType, xor1, xor2, baseType, simdSize, false); + return gtNewSimdHWIntrinsicNode(TYP_BOOL, useSingleVector ? xor1 : orr, zero, niEquals, baseType, simdSize); +#else + return nullptr; +#endif +} + +//------------------------------------------------------------------------ +// impCreateCompareInd: creates the following tree: +// +// * EQ int +// +--* IND +// | \--* ADD byref +// | +--* +// | \--* CNS_INT +// \--* CNS_INT +// +// Arguments: +// comp - Compiler object +// obj - GenTree representing data pointer +// type - type for the IND node +// offset - offset for the data pointer +// value - constant value to compare against +// +// Return Value: +// A tree with indirect load and comparison +// +static GenTree* impCreateCompareInd(Compiler* comp, GenTreeLclVar* obj, var_types type, ssize_t offset, ssize_t value) +{ + GenTree* offsetTree = comp->gtNewIconNode(offset, TYP_I_IMPL); + GenTree* addOffsetTree = comp->gtNewOperNode(GT_ADD, TYP_BYREF, obj, offsetTree); + GenTree* indirTree = comp->gtNewIndir(type, addOffsetTree); + GenTree* valueTree = comp->gtNewIconNode(value, genActualType(type)); + return comp->gtNewOperNode(GT_EQ, TYP_INT, indirTree, valueTree); +} + +//------------------------------------------------------------------------ +// impExpandHalfConstEqualsSWAR: Attempts to unroll and vectorize +// Equals against a constant WCHAR data for Length in [1..8] range +// using SWAR (a sort of SIMD but for GPR registers and instructions) +// +// Arguments: +// data - Pointer to a data to vectorize +// cns - Constant data (array of 2-byte chars) +// len - Number of chars in the cns +// dataOffset - Offset for data +// +// Return Value: +// A pointer to the newly created SWAR node or nullptr if unrolling is not +// possible or not profitable +// +// Notes: +// This function doesn't check obj for null or its Length, it's just an internal helper +// for impExpandHalfConstEquals +// +GenTree* Compiler::impExpandHalfConstEqualsSWAR(GenTreeLclVar* data, WCHAR* cns, int len, int dataOffset) +{ + assert(len >= 1 && len <= 8); + +// Compose Int32 or Int64 values from ushort components +#define MAKEINT32(c1, c2) ((UINT64)c2 << 16) | ((UINT64)c1 << 0) +#define MAKEINT64(c1, c2, c3, c4) ((UINT64)c4 << 48) | ((UINT64)c3 << 32) | ((UINT64)c2 << 16) | ((UINT64)c1 << 0) + + if (len == 1) + { + // [ ch1 ] + // [value] + // + return impCreateCompareInd(this, data, TYP_SHORT, dataOffset, cns[0]); + } + if (len == 2) + { + // [ ch1 ][ ch2 ] + // [ value ] + // + const UINT32 value = MAKEINT32(cns[0], cns[1]); + return impCreateCompareInd(this, data, TYP_INT, dataOffset, value); + } +#ifdef TARGET_64BIT + if (len == 3) + { + // handle len = 3 via two Int32 with overlapping: + // + // [ ch1 ][ ch2 ][ ch3 ] + // [ value1 ] + // [ value2 ] + // + // where offset for value2 is 2 bytes (1 char) + // + UINT32 value1 = MAKEINT32(cns[0], cns[1]); + UINT32 value2 = MAKEINT32(cns[1], cns[2]); + GenTree* firstIndir = impCreateCompareInd(this, data, TYP_INT, dataOffset, value1); + GenTree* secondIndir = + impCreateCompareInd(this, gtClone(data)->AsLclVar(), TYP_INT, dataOffset + sizeof(USHORT), value2); + + // TODO-Unroll-CQ: Consider merging two indirs via XOR instead of QMARK + // e.g. gtNewOperNode(GT_XOR, TYP_INT, firstIndir, secondIndir); + // but it currently has CQ issues (redundant movs) + GenTreeColon* doubleIndirColon = gtNewColonNode(TYP_INT, secondIndir, gtNewFalse()); + return gtNewQmarkNode(TYP_INT, firstIndir, doubleIndirColon); + } + + assert(len >= 4 && len <= 8); + + UINT64 value1 = MAKEINT64(cns[0], cns[1], cns[2], cns[3]); + if (len == 4) + { + // [ ch1 ][ ch2 ][ ch3 ][ ch4 ] + // [ value ] + // + return impCreateCompareInd(this, data, TYP_LONG, dataOffset, value1); + } + + // For 5..7 value2 will overlap with value1, e.g. for Length == 6: + // + // [ ch1 ][ ch2 ][ ch3 ][ ch4 ][ ch5 ][ ch6 ] + // [ value1 ] + // [ value2 ] + // + UINT64 value2 = MAKEINT64(cns[len - 4], cns[len - 3], cns[len - 2], cns[len - 1]); + GenTree* firstIndir = impCreateCompareInd(this, data, TYP_LONG, dataOffset, value1); + + ssize_t offset = dataOffset + len * sizeof(WCHAR) - sizeof(UINT64); + GenTree* secondIndir = impCreateCompareInd(this, gtClone(data)->AsLclVar(), TYP_LONG, offset, value2); + + // TODO-Unroll-CQ: Consider merging two indirs via XOR instead of QMARK + GenTreeColon* doubleIndirColon = gtNewColonNode(TYP_INT, secondIndir, gtNewFalse()); + return gtNewQmarkNode(TYP_INT, firstIndir, doubleIndirColon); +#else // TARGET_64BIT + return nullptr; +#endif +} + +//------------------------------------------------------------------------ +// impExpandHalfConstEquals: Attempts to unroll and vectorize +// Equals against a constant WCHAR data for Length in [8..32] range +// using either SWAR or SIMD. In a general case it will look like this: +// +// bool equals = obj != null && obj.Length == len && (SWAR or SIMD) +// +// Arguments: +// data - Pointer (LCL_VAR) to a data to vectorize +// lengthFld - Pointer (LCL_VAR or GT_FIELD) to Length field +// checkForNull - Check data for null +// startsWith - Is it StartsWith or Equals? +// cns - Constant data (array of 2-byte chars) +// len - Number of 2-byte chars in the cns +// dataOffset - Offset for data +// +// Return Value: +// A pointer to the newly created SIMD node or nullptr if unrolling is not +// possible or not profitable +// +GenTree* Compiler::impExpandHalfConstEquals(GenTreeLclVar* data, + GenTree* lengthFld, + bool checkForNull, + bool startsWith, + WCHAR* cnsData, + int len, + int dataOffset) +{ + assert(len >= 0); + + if (compCurBB->isRunRarely()) + { + // Not profitable to expand + JITDUMP("impExpandHalfConstEquals: block is cold - not profitable to expand.\n"); + return nullptr; + } + + if ((compIsForInlining() ? (fgBBcount + impInlineRoot()->fgBBcount) : (fgBBcount)) > 20) + { + // We don't want to unroll too much and in big methods + // TODO-Unroll-CQ: come up with some better heuristic/budget + JITDUMP("impExpandHalfConstEquals: method has too many BBs (>20) - not profitable to expand.\n"); + return nullptr; + } + + const genTreeOps cmpOp = startsWith ? GT_GE : GT_EQ; + GenTree* elementsCount = gtNewIconNode(len); + GenTree* lenCheckNode; + if (len == 0) + { + // For zero length we don't need to compare content, the following expression is enough: + // + // varData != null && lengthFld == 0 + // + lenCheckNode = gtNewOperNode(cmpOp, TYP_INT, lengthFld, elementsCount); + } + else + { + assert(cnsData != nullptr); + + GenTree* indirCmp = nullptr; + if (len < 8) // SWAR impl supports len == 8 but we'd better give it to SIMD + { + indirCmp = impExpandHalfConstEqualsSWAR(gtClone(data)->AsLclVar(), cnsData, len, dataOffset); + } + else if (len <= 32) + { + indirCmp = impExpandHalfConstEqualsSIMD(gtClone(data)->AsLclVar(), cnsData, len, dataOffset); + } + + if (indirCmp == nullptr) + { + JITDUMP("unable to compose indirCmp\n"); + return nullptr; + } + + GenTreeColon* lenCheckColon = gtNewColonNode(TYP_INT, indirCmp, gtNewFalse()); + + // For StartsWith we use GT_GE, e.g.: `x.Length >= 10` + lenCheckNode = gtNewQmarkNode(TYP_INT, gtNewOperNode(cmpOp, TYP_INT, lengthFld, elementsCount), lenCheckColon); + } + + GenTree* rootQmark; + if (checkForNull) + { + // varData == nullptr + GenTreeColon* nullCheckColon = gtNewColonNode(TYP_INT, lenCheckNode, gtNewFalse()); + rootQmark = gtNewQmarkNode(TYP_INT, gtNewOperNode(GT_NE, TYP_INT, data, gtNewNull()), nullCheckColon); + } + else + { + // no nullcheck, just "obj.Length == len && (SWAR or SIMD)" + rootQmark = lenCheckNode; + } + + return rootQmark; +} + +//------------------------------------------------------------------------ +// impGetStrConFromSpan: Try to obtain string literal out of a span: +// var span = "str".AsSpan(); +// var span = (ReadOnlySpan)"str" +// +// Arguments: +// span - String_op_Implicit or MemoryExtensions_AsSpan call +// with a string literal +// +// Returns: +// GenTreeStrCon node or nullptr +// +GenTreeStrCon* Compiler::impGetStrConFromSpan(GenTree* span) +{ + GenTreeCall* argCall = nullptr; + if (span->OperIs(GT_RET_EXPR)) + { + // NOTE: we don't support chains of RET_EXPR here + GenTree* inlineCandidate = span->AsRetExpr()->gtInlineCandidate; + if (inlineCandidate->OperIs(GT_CALL)) + { + argCall = inlineCandidate->AsCall(); + } + } + else if (span->OperIs(GT_CALL)) + { + argCall = span->AsCall(); + } + + if ((argCall != nullptr) && ((argCall->gtCallMoreFlags & GTF_CALL_M_SPECIAL_INTRINSIC) != 0)) + { + const NamedIntrinsic ni = lookupNamedIntrinsic(argCall->gtCallMethHnd); + if ((ni == NI_System_MemoryExtensions_AsSpan) || (ni == NI_System_String_op_Implicit)) + { + assert(argCall->gtCallArgs->GetNext() == nullptr); + if (argCall->gtCallArgs->GetNode()->OperIs(GT_CNS_STR)) + { + return argCall->gtCallArgs->GetNode()->AsStrCon(); + } + } + } + return nullptr; +} + +//------------------------------------------------------------------------ +// impStringEqualsOrStartsWith: The main entry-point for String methods +// We're going to unroll & vectorize the following cases: +// 1) String.Equals(obj, "cns") +// 2) String.Equals(obj, "cns", StringComparison.Ordinal) +// 3) String.Equals("cns", obj) +// 4) String.Equals("cns", obj, StringComparison.Ordinal) +// 5) obj.Equals("cns") +// 5) obj.Equals("cns") +// 6) obj.Equals("cns", StringComparison.Ordinal) +// 7) "cns".Equals(obj) +// 8) "cns".Equals(obj, StringComparison.Ordinal) +// 9) obj.StartsWith("cns", StringComparison.Ordinal) +// 10) "cns".StartsWith(obj, StringComparison.Ordinal) +// +// For cases 5, 6 and 9 we don't emit "obj != null" +// NOTE: String.Equals(object) is not supported currently +// +// Arguments: +// startsWith - Is it StartsWith or Equals? +// sig - signature of StartsWith or Equals method +// methodFlags - its flags +// +// Returns: +// GenTree representing vectorized comparison or nullptr +// +GenTree* Compiler::impStringEqualsOrStartsWith(bool startsWith, CORINFO_SIG_INFO* sig, unsigned methodFlags) +{ + const bool isStatic = methodFlags & CORINFO_FLG_STATIC; + const int argsCount = sig->numArgs + (isStatic ? 0 : 1); + + GenTree* op1; + GenTree* op2; + if (argsCount == 3) // overload with StringComparison + { + if (!impStackTop(0).val->IsIntegralConst(4)) // StringComparison.Ordinal + { + // TODO-Unroll-CQ: Unroll & vectorize OrdinalIgnoreCase + return nullptr; + } + op1 = impStackTop(2).val; + op2 = impStackTop(1).val; + } + else + { + assert(argsCount == 2); + op1 = impStackTop(1).val; + op2 = impStackTop(0).val; + } + + if (!(op1->OperIs(GT_CNS_STR) ^ op2->OperIs(GT_CNS_STR))) + { + // either op1 or op2 has to be CNS_STR, but not both - that case is optimized + // just fine as is. + return nullptr; + } + + GenTree* varStr; + GenTreeStrCon* cnsStr; + if (op1->OperIs(GT_CNS_STR)) + { + cnsStr = op1->AsStrCon(); + varStr = op2; + } + else + { + cnsStr = op2->AsStrCon(); + varStr = op1; + } + + bool needsNullcheck = true; + if ((op1 != cnsStr) && !isStatic) + { + // for the following cases we should not check varStr for null: + // + // obj.Equals("cns") + // obj.Equals("cns", StringComparison.Ordinal) + // obj.StartsWith("cns", StringComparison.Ordinal) + // + // instead, it should throw NRE if it's null + needsNullcheck = false; + } + + int cnsLength = -1; + const char16_t* str = nullptr; + if (cnsStr->IsStringEmptyField()) + { + // check for fake "" first + cnsLength = 0; + JITDUMP("Trying to unroll String.Equals|StartsWith(op1, \"\")...\n", str) + } + else + { + str = info.compCompHnd->getStringLiteral(cnsStr->gtScpHnd, cnsStr->gtSconCPX, &cnsLength); + if ((cnsLength < 0) || (str == nullptr)) + { + // We were unable to get the literal (e.g. dynamic context) + return nullptr; + } + JITDUMP("Trying to unroll String.Equals|StartsWith(op1, \"%ws\")...\n", str) + } + + // Create a temp which is safe to gtClone for varStr + // We're not appending it as a statement until we figure out unrolling is profitable (and possible) + unsigned varStrTmp = lvaGrabTemp(true DEBUGARG("spilling varStr")); + lvaTable[varStrTmp].lvType = varStr->TypeGet(); + GenTreeLclVar* varStrLcl = gtNewLclvNode(varStrTmp, varStr->TypeGet()); + + // Create a tree representing string's Length: + // TODO-Unroll-CQ: Consider using ARR_LENGTH here, but we'll have to modify QMARK to propagate BBF_HAS_IDX_LEN + int strLenOffset = OFFSETOF__CORINFO_String__stringLen; + GenTree* lenOffset = gtNewIconNode(strLenOffset, TYP_I_IMPL); + GenTree* lenNode = gtNewIndir(TYP_INT, gtNewOperNode(GT_ADD, TYP_BYREF, varStrLcl, lenOffset)); + varStrLcl = gtClone(varStrLcl)->AsLclVar(); + + GenTree* unrolled = impExpandHalfConstEquals(varStrLcl, lenNode, needsNullcheck, startsWith, (WCHAR*)str, cnsLength, + strLenOffset + sizeof(int)); + if (unrolled != nullptr) + { + impAssignTempGen(varStrTmp, varStr); + if (unrolled->OperIs(GT_QMARK)) + { + // QMARK nodes cannot reside on the evaluation stack + unsigned rootTmp = lvaGrabTemp(true DEBUGARG("spilling unroll qmark")); + impAssignTempGen(rootTmp, unrolled); + unrolled = gtNewLclvNode(rootTmp, TYP_INT); + } + + JITDUMP("\n... Successfully unrolled to:\n") + DISPTREE(unrolled) + for (int i = 0; i < argsCount; i++) + { + impPopStack(); + } + } + return unrolled; +} + +//------------------------------------------------------------------------ +// impSpanEqualsOrStartsWith: The main entry-point for [ReadOnly]Span methods +// We're going to unroll & vectorize the following cases: +// 1) MemoryExtensions.SequenceEqual(var, "cns") +// 2) MemoryExtensions.SequenceEqual("cns", var) +// 3) MemoryExtensions.Equals(var, "cns", StringComparison.Ordinal) +// 4) MemoryExtensions.Equals("cns", var, StringComparison.Ordinal) +// 5) MemoryExtensions.StartsWith("cns", var) +// 6) MemoryExtensions.StartsWith(var, "cns") +// 7) MemoryExtensions.StartsWith("cns", var, StringComparison.Ordinal) +// 8) MemoryExtensions.StartsWith(var, "cns", StringComparison.Ordinal) +// +// Arguments: +// startsWith - Is it StartsWith or Equals? +// sig - signature of StartsWith or Equals method +// methodFlags - its flags +// +// Returns: +// GenTree representing vectorized comparison or nullptr +// +GenTree* Compiler::impSpanEqualsOrStartsWith(bool startsWith, CORINFO_SIG_INFO* sig, unsigned methodFlags) +{ + const bool isStatic = methodFlags & CORINFO_FLG_STATIC; + const int argsCount = sig->numArgs + (isStatic ? 0 : 1); + + GenTree* op1; + GenTree* op2; + if (argsCount == 3) // overload with StringComparison + { + if (!impStackTop(0).val->IsIntegralConst(4)) // StringComparison.Ordinal + { + // TODO-Unroll-CQ: Unroll & vectorize OrdinalIgnoreCase + return nullptr; + } + op1 = impStackTop(2).val; + op2 = impStackTop(1).val; + } + else + { + assert(argsCount == 2); + op1 = impStackTop(1).val; + op2 = impStackTop(0).val; + } + + // For generic StartsWith and Equals we need to make sure T is char + if (sig->sigInst.methInstCount != 0) + { + assert(sig->sigInst.methInstCount == 1); + CORINFO_CLASS_HANDLE targetElemHnd = sig->sigInst.methInst[0]; + CorInfoType typ = info.compCompHnd->getTypeForPrimitiveValueClass(targetElemHnd); + if ((typ != CORINFO_TYPE_SHORT) && (typ != CORINFO_TYPE_USHORT) && (typ != CORINFO_TYPE_CHAR)) + { + return nullptr; + } + } + + // Try to obtain original string literals out of span arguments + GenTreeStrCon* op1Str = impGetStrConFromSpan(op1); + GenTreeStrCon* op2Str = impGetStrConFromSpan(op2); + + if (!((op1Str != nullptr) ^ (op2Str != nullptr))) + { + // either op1 or op2 has to be '(ReadOnlySpan)"cns"' + return nullptr; + } + + GenTree* spanObj; + GenTreeStrCon* cnsStr; + if (op1Str != nullptr) + { + cnsStr = op1Str; + spanObj = op2; + } + else + { + cnsStr = op2Str; + spanObj = op1; + } + + int cnsLength = -1; + const char16_t* str = nullptr; + if (cnsStr->IsStringEmptyField()) + { + // check for fake "" first + cnsLength = 0; + JITDUMP("Trying to unroll MemoryExtensions.Equals|SequenceEqual|StartsWith(op1, \"\")...\n", str) + } + else + { + str = info.compCompHnd->getStringLiteral(cnsStr->gtScpHnd, cnsStr->gtSconCPX, &cnsLength); + if (cnsLength < 0 || str == nullptr) + { + // We were unable to get the literal (e.g. dynamic context) + return nullptr; + } + JITDUMP("Trying to unroll MemoryExtensions.Equals|SequenceEqual|StartsWith(op1, \"%ws\")...\n", str) + } + + CORINFO_CLASS_HANDLE spanCls = gtGetStructHandle(spanObj); + CORINFO_FIELD_HANDLE pointerHnd = info.compCompHnd->getFieldInClass(spanCls, 0); + CORINFO_FIELD_HANDLE lengthHnd = info.compCompHnd->getFieldInClass(spanCls, 1); + const unsigned lengthOffset = info.compCompHnd->getFieldOffset(lengthHnd); + + // Create a placeholder for Span object - we're not going to Append it to statements + // in advance to avoid redundant spills in case if we fail to vectorize + unsigned spanObjRef = lvaGrabTemp(true DEBUGARG("spanObj tmp")); + unsigned spanDataTmp = lvaGrabTemp(true DEBUGARG("spanData tmp")); + lvaTable[spanObjRef].lvType = TYP_BYREF; + lvaTable[spanDataTmp].lvType = TYP_BYREF; + + GenTreeLclVar* spanObjRefLcl = gtNewLclvNode(spanObjRef, TYP_BYREF); + GenTreeLclVar* spanDataTmpLcl = gtNewLclvNode(spanDataTmp, TYP_BYREF); + + GenTreeField* spanLength = gtNewFieldRef(TYP_INT, lengthHnd, gtClone(spanObjRefLcl), lengthOffset); + GenTreeField* spanData = gtNewFieldRef(TYP_BYREF, pointerHnd, spanObjRefLcl); + + GenTree* unrolled = + impExpandHalfConstEquals(spanDataTmpLcl, spanLength, false, startsWith, (WCHAR*)str, cnsLength, 0); + if (unrolled != nullptr) + { + // We succeeded, fill the placeholders: + impAssignTempGen(spanObjRef, impGetStructAddr(spanObj, spanCls, (unsigned)CHECK_SPILL_NONE, true)); + impAssignTempGen(spanDataTmp, spanData); + if (unrolled->OperIs(GT_QMARK)) + { + // QMARK can't be a root node, spill it to a temp + unsigned rootTmp = lvaGrabTemp(true DEBUGARG("spilling unroll qmark")); + impAssignTempGen(rootTmp, unrolled); + unrolled = gtNewLclvNode(rootTmp, TYP_INT); + } + + JITDUMP("... Successfully unrolled to:\n") + DISPTREE(unrolled) + + for (int i = 0; i < argsCount; i++) + { + impPopStack(); + } + + // We have to clean up GT_RET_EXPR for String.op_Implicit or MemoryExtensions.AsSpans + if ((spanObj != op1) && op1->OperIs(GT_RET_EXPR)) + { + GenTree* inlineCandidate = op1->AsRetExpr()->gtInlineCandidate; + assert(inlineCandidate->IsCall()); + inlineCandidate->gtBashToNOP(); + } + else if ((spanObj != op2) && op2->OperIs(GT_RET_EXPR)) + { + GenTree* inlineCandidate = op2->AsRetExpr()->gtInlineCandidate; + assert(inlineCandidate->IsCall()); + inlineCandidate->gtBashToNOP(); + } + } + return unrolled; +} diff --git a/src/coreclr/jit/namedintrinsiclist.h b/src/coreclr/jit/namedintrinsiclist.h index c830a26dfe944..7f66f33e41d2e 100644 --- a/src/coreclr/jit/namedintrinsiclist.h +++ b/src/coreclr/jit/namedintrinsiclist.h @@ -86,11 +86,19 @@ enum NamedIntrinsic : unsigned short NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray, NI_System_Runtime_CompilerServices_RuntimeHelpers_IsKnownConstant, + NI_System_String_Equals, NI_System_String_get_Chars, NI_System_String_get_Length, + NI_System_String_op_Implicit, + NI_System_String_StartsWith, NI_System_Span_get_Item, NI_System_ReadOnlySpan_get_Item, + NI_System_MemoryExtensions_AsSpan, + NI_System_MemoryExtensions_Equals, + NI_System_MemoryExtensions_SequenceEqual, + NI_System_MemoryExtensions_StartsWith, + // These are used by HWIntrinsics but are defined more generally // to allow dead code optimization and handle the recursion case diff --git a/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Globalization.cs b/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Globalization.cs index b879174b7fbc3..0f605b908411c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Globalization.cs +++ b/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.Globalization.cs @@ -42,6 +42,7 @@ public static bool Contains(this ReadOnlySpan span, ReadOnlySpan val /// The value to compare with the source span. /// One of the enumeration values that determines how the and are compared. /// + [Intrinsic] // Unrolled and vectorized for half-constant input (Ordinal) public static bool Equals(this ReadOnlySpan span, ReadOnlySpan other, StringComparison comparisonType) { string.CheckStringComparison(comparisonType); @@ -330,6 +331,7 @@ ref MemoryMarshal.GetReference(value), /// The source span. /// The sequence to compare to the beginning of the source span. /// One of the enumeration values that determines how the and are compared. + [Intrinsic] // Unrolled and vectorized for half-constant input (Ordinal) public static bool StartsWith(this ReadOnlySpan span, ReadOnlySpan value, StringComparison comparisonType) { string.CheckStringComparison(comparisonType); diff --git a/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs b/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs index b94aa277005e6..6563f2ca697f3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs +++ b/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs @@ -87,6 +87,7 @@ public static Span AsSpan(this T[]? array, Range range) /// /// The target string. /// Returns default when is null. + [Intrinsic] // When input is a string literal [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan AsSpan(this string? text) { @@ -445,6 +446,7 @@ ref Unsafe.As(ref MemoryMarshal.GetReference(value)), /// /// Determines whether two sequences are equal by comparing the elements using IEquatable{T}.Equals(T). /// + [Intrinsic] // Unrolled and vectorized for half-constant input [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool SequenceEqual(this Span span, ReadOnlySpan other) where T : IEquatable { @@ -1021,6 +1023,7 @@ private static unsafe int LastIndexOfAnyProbabilistic(ref char searchSpace, int /// /// Determines whether two sequences are equal by comparing the elements using IEquatable{T}.Equals(T). /// + [Intrinsic] // Unrolled and vectorized for half-constant input [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool SequenceEqual(this ReadOnlySpan span, ReadOnlySpan other) where T : IEquatable { @@ -1133,6 +1136,7 @@ ref Unsafe.As(ref MemoryMarshal.GetReference(other)), /// /// Determines whether the specified sequence appears at the start of the span. /// + [Intrinsic] // Unrolled and vectorized for half-constant input [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool StartsWith(this Span span, ReadOnlySpan value) where T : IEquatable { @@ -1153,6 +1157,7 @@ ref Unsafe.As(ref MemoryMarshal.GetReference(value)), /// /// Determines whether the specified sequence appears at the start of the span. /// + [Intrinsic] // Unrolled and vectorized for half-constant input [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool StartsWith(this ReadOnlySpan span, ReadOnlySpan value) where T : IEquatable { diff --git a/src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs b/src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs index bcc5060e06845..51444d6077064 100644 --- a/src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs +++ b/src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs @@ -610,6 +610,7 @@ public override bool Equals([NotNullWhen(true)] object? obj) } // Determines whether two strings match. + [Intrinsic] // Unrolled and vectorized for half-constant input public bool Equals([NotNullWhen(true)] string? value) { if (object.ReferenceEquals(this, value)) @@ -628,6 +629,7 @@ public bool Equals([NotNullWhen(true)] string? value) return EqualsHelper(this, value); } + [Intrinsic] // Unrolled and vectorized for half-constant input (Ordinal) public bool Equals([NotNullWhen(true)] string? value, StringComparison comparisonType) { if (object.ReferenceEquals(this, value)) @@ -669,20 +671,9 @@ public bool Equals([NotNullWhen(true)] string? value, StringComparison compariso } // Determines whether two Strings match. + [Intrinsic] // Unrolled and vectorized for half-constant input public static bool Equals(string? a, string? b) { - // Transform 'str == ""' to 'str != null && str.Length == 0' if either a or b are jit-time - // constants. Otherwise, these two blocks are eliminated - if (RuntimeHelpers.IsKnownConstant(a) && a != null && a.Length == 0) - { - return b != null && b.Length == 0; - } - - if (RuntimeHelpers.IsKnownConstant(b) && b != null && b.Length == 0) - { - return a != null && a.Length == 0; - } - if (object.ReferenceEquals(a, b)) { return true; @@ -696,6 +687,7 @@ public static bool Equals(string? a, string? b) return EqualsHelper(a, b); } + [Intrinsic] // Unrolled and vectorized for half-constant input (Ordinal) public static bool Equals(string? a, string? b, StringComparison comparisonType) { if (object.ReferenceEquals(a, b)) @@ -940,6 +932,7 @@ public bool StartsWith(string value!!) return StartsWith(value, StringComparison.CurrentCulture); } + [Intrinsic] // Unrolled and vectorized for half-constant input (Ordinal) public bool StartsWith(string value!!, StringComparison comparisonType) { if ((object)this == (object)value) diff --git a/src/libraries/System.Private.CoreLib/src/System/String.cs b/src/libraries/System.Private.CoreLib/src/System/String.cs index 2183d5e59befe..edd0e1a0932e9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/String.cs +++ b/src/libraries/System.Private.CoreLib/src/System/String.cs @@ -334,6 +334,7 @@ public static string Create(IFormatProvider? provider, [InterpolatedStringHandle public static string Create(IFormatProvider? provider, Span initialBuffer, [InterpolatedStringHandlerArgument("provider", "initialBuffer")] ref DefaultInterpolatedStringHandler handler) => handler.ToStringAndClear(); + [Intrinsic] // When input is a string literal [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator ReadOnlySpan(string? value) => value != null ? new ReadOnlySpan(ref value.GetRawStringData(), value.Length) : default; diff --git a/src/tests/JIT/opt/Vectorization/StringEquals.cs b/src/tests/JIT/opt/Vectorization/StringEquals.cs new file mode 100644 index 0000000000000..d5c80c0e41126 --- /dev/null +++ b/src/tests/JIT/opt/Vectorization/StringEquals.cs @@ -0,0 +1,364 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; + +public class StringEquals +{ + public static int Main() + { + int testCount = 0; + foreach (var method in typeof(Tests).GetMethods()) + { + if (!method.Name.StartsWith("Equals_")) + continue; + + foreach (string testStr in Tests.s_TestData) + { + testCount++; + method.Invoke(null, new object[] { testStr }); + } + } + + Console.WriteLine(testCount); + return testCount == 25920 ? 100 : 0; + } +} + +public static class Tests +{ + [MethodImpl(MethodImplOptions.NoInlining)] + static void ValidateEquals(bool result, string left, string right) + { + if (result != (left == right)) + throw new Exception($"{result} != ({left} == {right})"); + } + + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_0(string s) => ValidateEquals(s == "", s, ""); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_1(string s) => ValidateEquals(s == "3", s, "3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_2(string s) => ValidateEquals(s == "\0", s, "\0"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_3(string s) => ValidateEquals(s == "ж", s, "ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_4(string s) => ValidateEquals(s == "1", s, "1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_5(string s) => ValidateEquals(s == "33", s, "33"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_6(string s) => ValidateEquals(s == "31", s, "31"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_7(string s) => ValidateEquals(s == "a1", s, "a1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_8(string s) => ValidateEquals(s == "12", s, "12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_9(string s) => ValidateEquals(s == "1\0", s, "1\0"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_10(string s) => ValidateEquals(s == "b12", s, "b12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_11(string s) => ValidateEquals(s == "ж23", s, "ж23"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_12(string s) => ValidateEquals(s == "2a2", s, "2a2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_13(string s) => ValidateEquals(s == "222", s, "222"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_14(string s) => ValidateEquals(s == "0ь3", s, "0ь3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_15(string s) => ValidateEquals(s == "bж31", s, "bж31"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_16(string s) => ValidateEquals(s == "ьЙbЙ", s, "ьЙbЙ"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_17(string s) => ValidateEquals(s == "b033", s, "b033"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_18(string s) => ValidateEquals(s == "311ь", s, "311ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_19(string s) => ValidateEquals(s == "жЙ12", s, "жЙ12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_20(string s) => ValidateEquals(s == "2011b", s, "2011b"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_21(string s) => ValidateEquals(s == "222b2", s, "222b2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_22(string s) => ValidateEquals(s == "aЙ213", s, "aЙ213"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_23(string s) => ValidateEquals(s == "1a131", s, "1a131"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_24(string s) => ValidateEquals(s == "3232Й", s, "3232Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_25(string s) => ValidateEquals(s == "3b0ьжь", s, "3b0ьжь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_26(string s) => ValidateEquals(s == "213b2Й", s, "213b2Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_27(string s) => ValidateEquals(s == "b31210", s, "b31210"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_28(string s) => ValidateEquals(s == "1ж0021", s, "1ж0021"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_29(string s) => ValidateEquals(s == "3ь3112", s, "3ь3112"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_30(string s) => ValidateEquals(s == "122b231", s, "122b231"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_31(string s) => ValidateEquals(s == "03ж32ж3", s, "03ж32ж3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_32(string s) => ValidateEquals(s == "bb31ж2Й", s, "bb31ж2Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_33(string s) => ValidateEquals(s == "023bьжЙ", s, "023bьжЙ"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_34(string s) => ValidateEquals(s == "\0232a12", s, "\0232a12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_35(string s) => ValidateEquals(s == "ж13ь11Йь", s, "ж13ь11Йь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_36(string s) => ValidateEquals(s == "11ьbb32ь", s, "11ьbb32ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_37(string s) => ValidateEquals(s == "222Йж3ж3", s, "222Йж3ж3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_38(string s) => ValidateEquals(s == "ж303aЙ12", s, "ж303aЙ12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_39(string s) => ValidateEquals(s == "ьb22322b", s, "ьb22322b"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_40(string s) => ValidateEquals(s == "a22b10b1Й", s, "a22b10b1Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_41(string s) => ValidateEquals(s == "3ba2221ь3", s, "3ba2221ь3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_42(string s) => ValidateEquals(s == "жa1Й0b1Й1", s, "жa1Й0b1Й1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_43(string s) => ValidateEquals(s == "a20Йжж1ьь", s, "a20Йжж1ьь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_44(string s) => ValidateEquals(s == "ьaж32132ь", s, "ьaж32132ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_45(string s) => ValidateEquals(s == "11111Й3Й12", s, "11111Й3Й12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_46(string s) => ValidateEquals(s == "11Й\02Йb3жж", s, "11Й\02Йb3жж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_47(string s) => ValidateEquals(s == "21bжжж0103", s, "21bжжж0103"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_48(string s) => ValidateEquals(s == "333332aЙ11", s, "333332aЙ11"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_49(string s) => ValidateEquals(s == "Й123112313", s, "Й123112313"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_50(string s) => ValidateEquals(s == "12ЙьЙaЙ11ьb", s, "12ЙьЙaЙ11ьb"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_51(string s) => ValidateEquals(s == "жж22221Й3Й2", s, "жж22221Й3Й2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_52(string s) => ValidateEquals(s == "ьЙ1bbж3202ж", s, "ьЙ1bbж3202ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_53(string s) => ValidateEquals(s == "1bbЙ2Й33Й2ж", s, "1bbЙ2Й33Й2ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_54(string s) => ValidateEquals(s == "2013133ь1bж", s, "2013133ь1bж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_55(string s) => ValidateEquals(s == "23a2\02жa2a13", s, "23a2\02жa2a13"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_56(string s) => ValidateEquals(s == "23Й210Й3a3ж1", s, "23Й210Й3a3ж1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_57(string s) => ValidateEquals(s == "32Й2133bb2Й3", s, "32Й2133bb2Й3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_58(string s) => ValidateEquals(s == "Й3bb1ь3bbьb3", s, "Й3bb1ь3bbьb3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_59(string s) => ValidateEquals(s == "a0Йbabж2Й133", s, "a0Йbabж2Й133"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_60(string s) => ValidateEquals(s == "320жa22a11ж1b", s, "320жa22a11ж1b"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_61(string s) => ValidateEquals(s == "ь321b3ьЙЙ13Й2", s, "ь321b3ьЙЙ13Й2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_62(string s) => ValidateEquals(s == "a3ь1ж2a\022a1a", s, "a3ь1ж2a\022a1a"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_63(string s) => ValidateEquals(s == "3Йb30b33231bь", s, "3Йb30b33231bь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_64(string s) => ValidateEquals(s == "2210121ж13231", s, "2210121ж13231"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_65(string s) => ValidateEquals(s == "013311aa3203Й1", s, "013311aa3203Й1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_66(string s) => ValidateEquals(s == "12ЙЙ1Й2aЙ2ьbЙa", s, "12ЙЙ1Й2aЙ2ьbЙa"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_67(string s) => ValidateEquals(s == "2b1Й11130221bь", s, "2b1Й11130221bь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_68(string s) => ValidateEquals(s == "230110Й0b3112ж", s, "230110Й0b3112ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_69(string s) => ValidateEquals(s == "a213ьab121b332", s, "a213ьab121b332"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_70(string s) => ValidateEquals(s == "111a01ж3121b123", s, "111a01ж3121b123"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_71(string s) => ValidateEquals(s == "13a322Й2Й3bжb0Й", s, "13a322Й2Й3bжb0Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_72(string s) => ValidateEquals(s == "\021232b1Йaa1032", s, "\021232b1Йaa1032"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_73(string s) => ValidateEquals(s == "жЙ112ьb12Йь3b2ж", s, "жЙ112ьb12Йь3b2ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_74(string s) => ValidateEquals(s == "2bьь331bb\023122", s, "2bьь331bb\023122"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_75(string s) => ValidateEquals(s == "aж22Й2203b023bь3", s, "aж22Й2203b023bь3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_76(string s) => ValidateEquals(s == "aЙ033ж3a220ь3331", s, "aЙ033ж3a220ь3331"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_77(string s) => ValidateEquals(s == "20Йжa1b1313жЙb2a", s, "20Йжa1b1313жЙb2a"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_78(string s) => ValidateEquals(s == "131Й1\022ж2322123", s, "131Й1\022ж2322123"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_79(string s) => ValidateEquals(s == "23323b21ь11bЙ321", s, "23323b21ь11bЙ321"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_80(string s) => ValidateEquals(s == "302aьжa3213жaЙ3Йж", s, "302aьжa3213жaЙ3Йж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_81(string s) => ValidateEquals(s == "ж13b00210b1212102", s, "ж13b00210b1212102"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_82(string s) => ValidateEquals(s == "20320Й3Й3ьж3Й2122", s, "20320Й3Й3ьж3Й2122"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_83(string s) => ValidateEquals(s == "0bb23a30baЙb2333ь", s, "0bb23a30baЙb2333ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_84(string s) => ValidateEquals(s == "22122ь130230103a2", s, "22122ь130230103a2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_85(string s) => ValidateEquals(s == "ььba20ж1жьЙьbЙ31bж", s, "ььba20ж1жьЙьbЙ31bж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_86(string s) => ValidateEquals(s == "bb1ь1033bж3011bж10", s, "bb1ь1033bж3011bж10"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_87(string s) => ValidateEquals(s == "1ь320a3a22b3333b13", s, "1ь320a3a22b3333b13"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_88(string s) => ValidateEquals(s == "0a22aЙжa2222ж23Й13", s, "0a22aЙжa2222ж23Й13"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_89(string s) => ValidateEquals(s == "Й11Й213212ж1233b23", s, "Й11Й213212ж1233b23"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_90(string s) => ValidateEquals(s == "32ь1Й03123ь011332ab", s, "32ь1Й03123ь011332ab"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_91(string s) => ValidateEquals(s == "222ж2311b133b3ж3223", s, "222ж2311b133b3ж3223"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_92(string s) => ValidateEquals(s == "0111ь3002222a3aaaa3", s, "0111ь3002222a3aaaa3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_93(string s) => ValidateEquals(s == "313Й213aж01a12231a2", s, "313Й213aж01a12231a2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_94(string s) => ValidateEquals(s == "1ж022ь1323b3b3ж222ь", s, "1ж022ь1323b3b3ж222ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_95(string s) => ValidateEquals(s == "ь023a3b213ь033ж13231", s, "ь023a3b213ь033ж13231"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_96(string s) => ValidateEquals(s == "ab2b0bь322300ж2220ж2", s, "ab2b0bь322300ж2220ж2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_97(string s) => ValidateEquals(s == "1133Й323223ж31002123", s, "1133Й323223ж31002123"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_98(string s) => ValidateEquals(s == "233ж0b3Й023Йьaaж3321", s, "233ж0b3Й023Йьaaж3321"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_99(string s) => ValidateEquals(s == "3Й11b313323230a02Й30", s, "3Й11b313323230a02Й30"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_100(string s) => ValidateEquals(s == "1ж2Йж0131a2ж2aЙЙ3ьb11", s, "1ж2Йж0131a2ж2aЙЙ3ьb11"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_101(string s) => ValidateEquals(s == "Й13303ba3ьж31a1102222", s, "Й13303ba3ьж31a1102222"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_102(string s) => ValidateEquals(s == "32331221ь3ьb103212132", s, "32331221ь3ьb103212132"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_103(string s) => ValidateEquals(s == "133Й0332210231331100Й", s, "133Й0332210231331100Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_104(string s) => ValidateEquals(s == "22221322Й1133bb0Й3222", s, "22221322Й1133bb0Й3222"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_105(string s) => ValidateEquals(s == "12b011ж3a1ж3ЙЙa12Й0ь3ь", s, "12b011ж3a1ж3ЙЙa12Й0ь3ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_106(string s) => ValidateEquals(s == "0333ь12113ь11331ж323Йж", s, "0333ь12113ь11331ж323Йж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_107(string s) => ValidateEquals(s == "0Й13a310ь12\02ь\02320331", s, "0Й13a310ь12\02ь\02320331"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_108(string s) => ValidateEquals(s == "022b2ьж0302b33Й21ж1112", s, "022b2ьж0302b33Й21ж1112"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_109(string s) => ValidateEquals(s == "3322ж2133133b3032Йaa12", s, "3322ж2133133b3032Йaa12"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_110(string s) => ValidateEquals(s == "Й132Йaьb33a3Й33Йb21a2b2", s, "Й132Йaьb33a3Й33Йb21a2b2"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_111(string s) => ValidateEquals(s == "31102113Й11жb31bЙ12b133", s, "31102113Й11жb31bЙ12b133"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_112(string s) => ValidateEquals(s == "ЙьЙЙ0Й03a\023ь3311ьЙ1323", s, "ЙьЙЙ0Й03a\023ь3311ьЙ1323"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_113(string s) => ValidateEquals(s == "212323жa23203bb00жa12ж3", s, "212323жa23203bb00жa12ж3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_114(string s) => ValidateEquals(s == "жЙ31130ж32322313010aa13", s, "жЙ31130ж32322313010aa13"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_115(string s) => ValidateEquals(s == "123aж2221\022ж22Й021bЙЙ0Й", s, "123aж2221\022ж22Й021bЙЙ0Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_116(string s) => ValidateEquals(s == "211131ж2213303b1b0231a11", s, "211131ж2213303b1b0231a11"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_117(string s) => ValidateEquals(s == "ь1aЙжь0110Й2b220жж3ьж3ж1", s, "ь1aЙжь0110Й2b220жж3ьж3ж1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_118(string s) => ValidateEquals(s == "3жab2221133331311\023ЙЙ3ж", s, "3жab2221133331311\023ЙЙ3ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_119(string s) => ValidateEquals(s == "21Й20\02ьь333ьb332223Йж1Й", s, "21Й20\02ьь333ьb332223Йж1Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_120(string s) => ValidateEquals(s == "1Й2120a01110Й1121003a3b33", s, "1Й2120a01110Й1121003a3b33"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_121(string s) => ValidateEquals(s == "3021a1Й1aa1111b22Й112Й201", s, "3021a1Й1aa1111b22Й112Й201"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_122(string s) => ValidateEquals(s == "2b21ьaьb\023Й33301Й3123Йж1", s, "2b21ьaьb\023Й33301Й3123Йж1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_123(string s) => ValidateEquals(s == "2ж1baЙЙ1a\021ж23323жbж331ж", s, "2ж1baЙЙ1a\021ж23323жbж331ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_124(string s) => ValidateEquals(s == "bab12332ж31130Й3230ь1011a", s, "bab12332ж31130Й3230ь1011a"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_125(string s) => ValidateEquals(s == "110aь31ж33ьь33333a2b32ь12ь", s, "110aь31ж33ьь33333a2b32ь12ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_126(string s) => ValidateEquals(s == "a2жЙ11ь1bь312a11aьaьb02Йb0", s, "a2жЙ11ь1bь312a11aьaьb02Йb0"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_127(string s) => ValidateEquals(s == "32b2ж12a32a3ж23ж1ьЙbb22213", s, "32b2ж12a32a3ж23ж1ьЙbb22213"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_128(string s) => ValidateEquals(s == "30ж111ь11120жжb10212жbь33Й", s, "30ж111ь11120жжb10212жbь33Й"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_129(string s) => ValidateEquals(s == "33b1311ж1\023bж020Й10b0302ж", s, "33b1311ж1\023bж020Й10b0302ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_130(string s) => ValidateEquals(s == "b3122жa12\021123a3130100113ь", s, "b3122жa12\021123a3130100113ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_131(string s) => ValidateEquals(s == "302a1ж322\021221\02a1331b2жь1", s, "302a1ж322\021221\02a1331b2жь1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_132(string s) => ValidateEquals(s == "31201322жж\0221Й\021Йьь32Й11ж", s, "31201322жж\0221Й\021Йьь32Й11ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_133(string s) => ValidateEquals(s == "3bжa132a13ba1311ж1Й22ЙbЙa33", s, "3bжa132a13ba1311ж1Й22ЙbЙa33"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_134(string s) => ValidateEquals(s == "b33Й113ЙЙab1b332211222Й32\02", s, "b33Й113ЙЙab1b332211222Й32\02"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_135(string s) => ValidateEquals(s == "0ж333b31b212121b1aж02ж133111", s, "0ж333b31b212121b1aж02ж133111"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_136(string s) => ValidateEquals(s == "0101Й220Й0жЙ3Й2abba0b1223aab", s, "0101Й220Й0жЙ3Й2abba0b1223aab"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_137(string s) => ValidateEquals(s == "2Й330bЙ123ж2ж02ж212ь112111Й1", s, "2Й330bЙ123ж2ж02ж212ь112111Й1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_138(string s) => ValidateEquals(s == "22a\0212aь3b1303Й3bb2b313Й222", s, "22a\0212aь3b1303Й3bb2b313Й222"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_139(string s) => ValidateEquals(s == "2ьж133332102222\020Йжbb2\022\02", s, "2ьж133332102222\020Йжbb2\022\02"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_140(string s) => ValidateEquals(s == "2\02321b31123231b2ЙЙ122abЙ2131", s, "2\02321b31123231b2ЙЙ122abЙ2131"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_141(string s) => ValidateEquals(s == "1b021ьЙ30a2332ь3Й12231жж1aжь1", s, "1b021ьЙ30a2332ь3Й12231жж1aжь1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_142(string s) => ValidateEquals(s == "1ж3ьь3ь1ь1ь0ж1Й122132a2ььaЙ3b", s, "1ж3ьь3ь1ь1ь0ж1Й122132a2ььaЙ3b"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_143(string s) => ValidateEquals(s == "21bbb31301ь3жaaж0Й3323b33ь1ь1", s, "21bbb31301ь3жaaж0Й3323b33ь1ь1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_144(string s) => ValidateEquals(s == "a00Йь11жжaa321ьЙ1Й31жa21ж3223", s, "a00Йь11жжaa321ьЙ1Й31жa21ж3223"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_145(string s) => ValidateEquals(s == "3132b0Йb3110ab\0201Й1ж32222a33ж", s, "3132b0Йb3110ab\0201Й1ж32222a33ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_146(string s) => ValidateEquals(s == "32b110bb312ь02Й1b2Й23232Й12ь33", s, "32b110bb312ь02Й1b2Й23232Й12ь33"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_147(string s) => ValidateEquals(s == "ж121bbbЙ2b1ж12222Йь1Йb02013жь1", s, "ж121bbbЙ2b1ж12222Йь1Йb02013жь1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_148(string s) => ValidateEquals(s == "ь1b00a3310231001b1a1ь33жжb130ь", s, "ь1b00a3310231001b1a1ь33жжb130ь"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_149(string s) => ValidateEquals(s == "ж3b211b121ж23bь12a1Й2Йж12313aж", s, "ж3b211b121ж23bь12a1Й2Йж12313aж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_150(string s) => ValidateEquals(s == "1a3жb31311322жь33213Й3ь13330жa3", s, "1a3жb31311322жь33213Й3ь13330жa3"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_151(string s) => ValidateEquals(s == "b33Йbж3333233101a33ж3b231221ь11", s, "b33Йbж3333233101a33ж3b231221ь11"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_152(string s) => ValidateEquals(s == "1Й212Й3ж112a31aьжьЙ32ж233a32Й1ж", s, "1Й212Й3ж112a31aьжьЙ32ж233a32Й1ж"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_153(string s) => ValidateEquals(s == "133ь02aьa0Й3Йab3ь1Й3Й2a21121210", s, "133ь02aьa0Й3Йab3ь1Й3Й2a21121210"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_154(string s) => ValidateEquals(s == "1320baж31b3Й2Й1322b113212212331", s, "1320baж31b3Й2Й1322b113212212331"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_155(string s) => ValidateEquals(s == "1Йa332132жb31Й33Й32321ж31b120ж03", s, "1Йa332132жb31Й33Й32321ж31b120ж03"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_156(string s) => ValidateEquals(s == "213321a1b3жь3111жЙ2b2Й3101221ь33", s, "213321a1b3жь3111жЙ2b2Й3101221ь33"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_157(string s) => ValidateEquals(s == "2ж1311a23b2212aЙ21Й11жb3233bb3a1", s, "2ж1311a23b2212aЙ21Й11жb3233bb3a1"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_158(string s) => ValidateEquals(s == "01Й11113ь3Й32a3ьЙЙ3Й32b2ab221310", s, "01Й11113ь3Й32a3ьЙЙ3Й32b2ab221310"); + [MethodImpl(MethodImplOptions.NoInlining)] public static void Equals_159(string s) => ValidateEquals(s == "a120213b11211\0223223312ьь1Й3222Й", s, "a120213b11211\0223223312ьь1Й3222Й"); + + public static readonly string[] s_TestData = + { + null, + "", + "\0", + "a", + "0", + "ж", + "3", + "33", + "31", + "a\0", + "12", + "13", + "b12", + "ж23", + "2a2", + "222", + "0ь3", + "bж31", + "ьЙbЙ", + "b033", + "311ь", + "жЙ12", + "2011b", + "222b2", + "aЙ213", + "1a131", + "3232Й", + "3b0ьжь", + "213b2Й", + "b31210", + "1ж0021", + "3ь3112", + "122b231", + "03ж32ж3", + "bb31ж2Й", + "023bьжЙ", + "\0232a12", + "ж13ь11Йь", + "11ьbb32ь", + "222Йж3ж3", + "ж303aЙ12", + "ьb22322b", + "a22b10b1Й", + "3ba2221ь3", + "жa1Й0b1Й1", + "a20Йжж1ьь", + "ьaж32132ь", + "11111Й3Й12", + "11Й\02Йb3жж", + "21bжжж0103", + "333332aЙ11", + "Й123112313", + "12ЙьЙaЙ11ьb", + "жж22221Й3Й2", + "ьЙ1bbж3202ж", + "1bbЙ2Й33Й2ж", + "2013133ь1bж", + "23a2\02жa2a13", + "23Й210Й3a3ж1", + "32Й2133bb2Й3", + "Й3bb1ь3bbьb3", + "a0Йbabж2Й133", + "320жa22a11ж1b", + "ь321b3ьЙЙ13Й2", + "a3ь1ж2a\022a1a", + "3Йb30b33231bь", + "2210121ж13231", + "013311aa3203Й1", + "12ЙЙ1Й2aЙ2ьbЙa", + "2b1Й11130221bь", + "230110Й0b3112ж", + "a213ьab121b332", + "111a01ж3121b123", + "13a322Й2Й3bжb0Й", + "\021232b1Йaa1032", + "жЙ112ьb12Йь3b2ж", + "2bьь331bb\023122", + "aж22Й2203b023bь3", + "aЙ033ж3a220ь3331", + "20Йжa1b1313жЙb2a", + "131Й1\022ж2322123", + "23323b21ь11bЙ321", + "302aьжa3213жaЙ3Йж", + "ж13b00210b1212102", + "20320Й3Й3ьж3Й2122", + "0bb23a30baЙb2333ь", + "22122ь130230103a2", + "ььba20ж1жьЙьbЙ31bж", + "bb1ь1033bж3011bж10", + "1ь320a3a22b3333b13", + "0a22aЙжa2222ж23Й13", + "Й11Й213212ж1233b23", + "32ь1Й03123ь011332ab", + "222ж2311b133b3ж3223", + "0111ь3002222a3aaaa3", + "313Й213aж01a12231a2", + "1ж022ь1323b3b3ж222ь", + "ь023a3b213ь033ж13231", + "ab2b0bь322300ж2220ж2", + "1133Й323223ж31002123", + "233ж0b3Й023Йьaaж3321", + "3Й11b313323230a02Й30", + "1ж2Йж0131a2ж2aЙЙ3ьb11", + "Й13303ba3ьж31a1102222", + "32331221ь3ьb103212132", + "133Й0332210231331100Й", + "22221322Й1133bb0Й3222", + "12b011ж3a1ж3ЙЙa12Й0ь3ь", + "0333ь12113ь11331ж323Йж", + "0Й13a310ь12\02ь\02\02320331", + "022b2ьж0302b33Й21ж1112", + "3322ж2133133b3032Йaa12", + "Й132Йaьb33a3Й33Йb21a2b2", + "31102113Й11жb31bЙ12b133", + "ЙьЙЙ0Й03a\023ь3311ьЙ1323", + "212323жa23203bb00жa12ж3", + "жЙ31130ж32322313010aa13", + "123aж2221\022ж22Й021bЙЙ0Й", + "211131ж2213303b1b0231a11", + "ь1aЙжь0110Й2b220жж3ьж3ж1", + "3жab2221133331311\023ЙЙ3ж", + "21Й20\02ьь333ьb332223Йж1Й", + "1Й2120a01110Й1121003a3b33", + "3021a1Й1aa1111b22Й112Й201", + "2b21ьaьb\023Й33301Й3123Йж1", + "2ж1baЙЙ1a\021ж23323жbж331ж", + "bab12332ж31130Й3230ь1011a", + "110aь31ж33ьь33333a2b32ь12ь", + "a2жЙ11ь1bь312a11aьaьb02Йb0", + "32b2ж12a32a3ж23ж1ьЙbb22213", + "30ж111ь11120жжb10212жbь33Й", + "33b1311ж1\023bж020Й10b0302ж", + "b3122жa12\021123a3130100113ь", + "302a1ж322\021221z2a1331b2жь1", + "31201322жж\0221Йz21Йьь32Й11ж", + "3bжa132a13ba1311ж1Й22ЙbЙa33", + "b33Й113ЙЙab1b332211222Й32\02", + "0ж333b31b212121b1aж02ж133111", + "0101Й220Й0жЙ3Й2abba0b1223aa\0", + "2Й330bЙ123ж2ж02ж212ь112111Й1", + "22a\0212aь3b1303Й3bb2b313Й222", + "2ьж133332102222\020Йжbb2\022\02", + "2\02321b31123231b2ЙЙ122abЙ2131", + "1b021ьЙ30a2332ь3Й12231жж1aжь1", + "1ж3ьь3ь1ь1ь0ж1Й122132a2ььaЙ3b", + "21bbb31301ь3жaaж0Й3323b33ь1ь1", + "a00Йь11жжaa321ьЙ1Й31жa21ж3223", + "3132b0Йb3110ab\0201Й1ж32222a33ж", + "32b110bb312ь02Й1b2Й23232Й12ь33", + "ж121bbbЙ2b1ж12222Йь1Йb02013жь1", + "ь1b00a3310231001b1a1ь33жжb130ь", + "ж3b211b121ж23bь12a1Й2Йж12313aж", + "1a3жb31311322жь33213Й3ь13330жa3", + "b33Йbж3333233101a33ж3b231221ь11", + "1Й212Й3ж112a31aьжьЙ32ж233a32Й1ж", + "133ь02aьa0Й3Йab3ь1Й3Й2a21121210", + "1320baж31b3Й2Й1322b113212212331", + "1Йa332132жb31Й33Й32321ж31b120ж03", + "213321a1b3жь3111жЙ2b2Й3101221ь33", + "2ж1311a23b2212aЙ21Й11жb3233bb3a1", + "01Й11113ь3Й32a3ьЙЙ3Й32b2ab221310", + "a120213b11211\0223223312ьь1Й3222Й", + }; +} diff --git a/src/tests/JIT/opt/Vectorization/StringEquals.csproj b/src/tests/JIT/opt/Vectorization/StringEquals.csproj new file mode 100644 index 0000000000000..6946bed81bfd5 --- /dev/null +++ b/src/tests/JIT/opt/Vectorization/StringEquals.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + diff --git a/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth.cs b/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth.cs new file mode 100644 index 0000000000000..d50deb26defcf --- /dev/null +++ b/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth.cs @@ -0,0 +1,149 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; + +public class UnrollEqualsStartsWIth +{ + public static int Main() + { + var testTypes = typeof(UnrollEqualsStartsWIth).Assembly + .GetTypes() + .Where(t => t.Name.StartsWith("Tests_len")) + .ToArray(); + + int testCount = 0; + foreach (var testType in testTypes) + testCount += RunTests(testType); + return testCount == 113652 ? 100 : 0; + } + + public static int RunTests(Type type) + { + // List of "reference" (unoptimized) tests + var refImpl = type + .GetMethods() + .Where(m => m.Name.StartsWith("Test_ref_")) + .ToArray(); + + // List of actual tests + var tstImpl = type + .GetMethods() + .Where(m => m.Name.StartsWith("Test_tst_")) + .ToArray(); + + string[] testData = + { + "", + string.Empty, + "a", + "A", + "\0", + "a-", + "aa", + "aAa", + "aaA", + "a-aa", + "aaaa", + "aaaaa", + "aaaaa", + "aaaaaa", + "aaaaaa", + "aaaaaaa", + "aaaaaaa", + "aaAAaaaa", + "aaaaa-aa", + "aaaaaaaaa", + "aaaaaaaaa", + "aaaaaaaaaa", + "aaaaaaaaaa", + "aaaaaaaaaaa", + "aaaAAaaaaaa", + "aaaaaa-aaaaa", + "aaaaaaaaaaaa", + "aaaaaaaaaaaaa", + "aaaaaaaaaжжaaa", + "aaaaaaaaaaaaaaa", + "aaaAAAaaaaaazzz", + "aaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaжaaaa", + "aaaaaaAAAAaaaaaaa", + "aaaaaaaaaaaaaaaaaa", + "aaaaaaaggggggggggaa", + "aaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaa", + "aaaaaaAAAAaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaa\0", + "aaaччччччччччaaaaжжaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaa", + "gggggggggggaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "aaaaa\\aaaaaaaaaaaNNNNNNaaaaaa", + "aaaaaaaaaaaaaaaaaaaaaaaaaa-aaaa", + "aaaaaaaaaaaaaa\0aaaaaaaaaaaaaaaaa", + "aaaaaZZZZZZZaaaaaaaaaaaaaaaaaaaaa\0", + }; + + var testDataList = testData.ToList(); + foreach (var td in testData) + { + // Add more test input - uppercase, lowercase, replace some chars + testDataList.Add(td.ToUpper()); + testDataList.Add(td.Replace('a', 'b')); + testDataList.Add(td.Replace('a', 'Ф')); + testDataList.Add(td.ToLower()); + } + + // Add null and check how various APIs react to it + testDataList.Add(null); + + int testCasesCount = 0; + foreach (var testStr in testDataList) + { + for (int i = 0; i < refImpl.Length; i++) + { + // Compare states for ref and tst (e.g. both should return the same value and the same exception if any) + if (!GetInvokeResult(refImpl[i], testStr).Equals(GetInvokeResult(tstImpl[i], testStr))) + throw new InvalidOperationException($"Different states, type={type}, str={testStr}, mi={tstImpl[i]}"); + testCasesCount++; + } + } + return testCasesCount; + } + + // Invoke method and return its return value and exception if happened + public static (bool, Type) GetInvokeResult(MethodInfo mi, string str) + { + bool eq = false; + Type excType = null; + try + { + eq = (bool)mi.Invoke(null, new object[] { str }); + } + catch (TargetInvocationException e) + { + excType = e.InnerException.GetType(); + } + catch (Exception e) + { + excType = e.GetType(); + } + return (eq, excType); + } +} + +public class Utils +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T Const(T t) => t; + + [MethodImpl(MethodImplOptions.NoInlining)] + public static T Var(T t) => t; + + public const MethodImplOptions Opt = MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization; + public const MethodImplOptions NoOpt = MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization; +} diff --git a/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth.csproj b/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth.csproj new file mode 100644 index 0000000000000..8d47a4514590e --- /dev/null +++ b/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth.csproj @@ -0,0 +1,10 @@ + + + Exe + True + + + + + + diff --git a/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth_Tests.cs b/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth_Tests.cs new file mode 100644 index 0000000000000..8f4b3bfc14a65 --- /dev/null +++ b/src/tests/JIT/opt/Vectorization/UnrollEqualsStartsWIth_Tests.cs @@ -0,0 +1,999 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; + +public static class Tests_len0_0 +{ + const string cns = ""; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len1_1 +{ + const string cns = "a"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len1_2 +{ + const string cns = "A"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len1_3 +{ + const string cns = " "; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len2_4 +{ + const string cns = "a-"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len2_5 +{ + const string cns = "aa"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len3_6 +{ + const string cns = "a-a"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len4_7 +{ + const string cns = "aaaa"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len5_8 +{ + const string cns = "aaaaa"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len14_9 +{ + const string cns = "aaaaaaaaaжжaaa"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len15_10 +{ + const string cns = "aaaaaaaqqqqqqqq"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len31_11 +{ + const string cns = "aaaaaaaaaaaaaaaaaaaaaaaaaa-aaaa"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len31_12 +{ + const string cns = "aaaaaaaaaaaaaa aaaaaaaaaaa"; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +} + +public static class Tests_len34_13 +{ + const string cns = "aaaaaZZZZZZZaaaaaaaaaaaaaaaaaaaaa "; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_0(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_0(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_1(string s) => Utils.Var(cns) == s; + [MethodImpl(Utils.Opt)] public static bool Test_tst_1(string s) => cns == s; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_2(string s) => string.Equals(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_2(string s) => string.Equals(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_3(string s) => string.Equals(null, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_3(string s) => string.Equals(null, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_4(string s) => string.Equals((object)s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_4(string s) => string.Equals((object)s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_5(string s) => string.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_5(string s) => string.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_6(string s) => string.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_6(string s) => string.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_7(string s) => string.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_7(string s) => string.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_8(string s) => (s as object).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_8(string s) => (s as object).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_9(string s) => s.Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_9(string s) => s.Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_10(string s) => ((string)null).Equals(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_10(string s) => ((string)null).Equals(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_11(string s) => s.Equals(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_11(string s) => s.Equals(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_12(string s) => s.Equals(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_12(string s) => s.Equals(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_13(string s) => s.Equals(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_13(string s) => s.Equals(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_14(string s) => s == Utils.Var(cns); + [MethodImpl(Utils.Opt)] public static bool Test_tst_14(string s) => s == cns; + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_15(string s) => s.StartsWith(Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_15(string s) => s.StartsWith(cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_16(string s) => s.StartsWith(Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_16(string s) => s.StartsWith(cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_17(string s) => s.StartsWith(Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_17(string s) => s.StartsWith(cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_18(string s) => s.StartsWith(Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_18(string s) => s.StartsWith(cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_19(string s) => s.StartsWith(Utils.Var(cns), true, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_19(string s) => s.StartsWith(cns, true, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_20(string s) => s.StartsWith(Utils.Var(cns), false, null); + [MethodImpl(Utils.Opt)] public static bool Test_tst_20(string s) => s.StartsWith(cns, false, null); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_21(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_21(string s) => MemoryExtensions.SequenceEqual(s, cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_22(string s) => MemoryExtensions.SequenceEqual(Utils.Var(cns), s); + [MethodImpl(Utils.Opt)] public static bool Test_tst_22(string s) => MemoryExtensions.SequenceEqual(cns, s); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_23(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_23(string s) => MemoryExtensions.Equals(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_24(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_24(string s) => MemoryExtensions.Equals(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_25(string s) => MemoryExtensions.Equals(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_25(string s) => MemoryExtensions.Equals(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_26(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.InvariantCulture); + [MethodImpl(Utils.Opt)] public static bool Test_tst_26(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.InvariantCulture); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_27(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.Ordinal); + [MethodImpl(Utils.Opt)] public static bool Test_tst_27(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.Ordinal); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_28(string s) => MemoryExtensions.StartsWith(s, Utils.Var(cns), StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.Opt)] public static bool Test_tst_28(string s) => MemoryExtensions.StartsWith(s, cns, StringComparison.OrdinalIgnoreCase); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_29(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_30(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(1), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_31(string s) => MemoryExtensions.SequenceEqual(s.AsSpan(0, 2), cns); + [MethodImpl(Utils.NoOpt)]public static bool Test_ref_32(string s) => MemoryExtensions.SequenceEqual(s, Utils.Var(cns)); + [MethodImpl(Utils.Opt)] public static bool Test_tst_32(string s) => MemoryExtensions.SequenceEqual(s, cns); +}