Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
get rid of TYP_CHAR
Browse files Browse the repository at this point in the history
  • Loading branch information
FeiPengIntel committed Dec 13, 2017
1 parent 07d8a29 commit ef2b28d
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 121 deletions.
2 changes: 0 additions & 2 deletions src/jit/assertionprop.cpp
Expand Up @@ -1271,7 +1271,6 @@ AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1,
case TYP_UBYTE:
case TYP_SHORT:
case TYP_USHORT:
case TYP_CHAR:
#ifdef _TARGET_64BIT_
case TYP_UINT:
case TYP_INT:
Expand Down Expand Up @@ -2236,7 +2235,6 @@ AssertionIndex Compiler::optAssertionIsSubrange(GenTreePtr tree, var_types toTyp
case TYP_UBYTE:
case TYP_SHORT:
case TYP_USHORT:
case TYP_CHAR:
if ((curAssertion->op2.u2.loBound < AssertionDsc::GetLowerBoundForIntegralType(toType)) ||
(curAssertion->op2.u2.hiBound > AssertionDsc::GetUpperBoundForIntegralType(toType)))
{
Expand Down
6 changes: 3 additions & 3 deletions src/jit/codegenarm64.cpp
Expand Up @@ -3749,7 +3749,7 @@ void CodeGen::genSIMDIntrinsic(GenTreeSIMD* simdNode)
// NYI for unsupported base types
if (simdNode->gtSIMDBaseType != TYP_INT && simdNode->gtSIMDBaseType != TYP_LONG &&
simdNode->gtSIMDBaseType != TYP_FLOAT && simdNode->gtSIMDBaseType != TYP_DOUBLE &&
simdNode->gtSIMDBaseType != TYP_CHAR && simdNode->gtSIMDBaseType != TYP_UBYTE &&
simdNode->gtSIMDBaseType != TYP_USHORT && simdNode->gtSIMDBaseType != TYP_UBYTE &&
simdNode->gtSIMDBaseType != TYP_SHORT && simdNode->gtSIMDBaseType != TYP_BYTE &&
simdNode->gtSIMDBaseType != TYP_UINT && simdNode->gtSIMDBaseType != TYP_ULONG)
{
Expand Down Expand Up @@ -3859,7 +3859,7 @@ insOpts CodeGen::genGetSimdInsOpt(bool is16B, var_types elementType)
case TYP_INT:
result = is16B ? INS_OPTS_4S : INS_OPTS_2S;
break;
case TYP_CHAR:
case TYP_USHORT:
case TYP_SHORT:
result = is16B ? INS_OPTS_8H : INS_OPTS_4H;
break;
Expand Down Expand Up @@ -4329,7 +4329,7 @@ void CodeGen::genSIMDIntrinsicNarrow(GenTreeSIMD* simdNode)
opt = INS_OPTS_4H;
opt2 = INS_OPTS_8H;
break;
case TYP_CHAR:
case TYP_USHORT:
case TYP_SHORT:
opt = INS_OPTS_8B;
opt2 = INS_OPTS_16B;
Expand Down
18 changes: 9 additions & 9 deletions src/jit/codegenlegacy.cpp
Expand Up @@ -3999,7 +3999,7 @@ emitJumpKind CodeGen::genCondSetFlags(GenTreePtr cond)
if (iVal & 0xffffff00)
goto NO_TEST_FOR_AND;
break;
case TYP_CHAR:
case TYP_USHORT:
case TYP_SHORT:
if (iVal & 0xffff0000)
goto NO_TEST_FOR_AND;
Expand Down Expand Up @@ -4317,7 +4317,7 @@ emitJumpKind CodeGen::genCondSetFlags(GenTreePtr cond)
if (ival != (signed short)ival)
smallOk = false;
break;
case TYP_CHAR:
case TYP_USHORT:
if (ival != (unsigned short)ival)
smallOk = false;
break;
Expand Down Expand Up @@ -6724,7 +6724,7 @@ void CodeGen::genCodeForTreeSmpBinArithLogOp(GenTreePtr tree, regMaskTP destReg,
andMask = 0x000000FF;
break;
case TYP_SHORT:
case TYP_CHAR:
case TYP_USHORT:
andMask = 0x0000FFFF;
break;
default:
Expand All @@ -6743,7 +6743,7 @@ void CodeGen::genCodeForTreeSmpBinArithLogOp(GenTreePtr tree, regMaskTP destReg,
else // varTypeIsShort(typ)
{
assert(varTypeIsShort(typ));
op1->gtType = TYP_CHAR;
op1->gtType = TYP_USHORT;
}

/* Generate the first operand into a scratch register */
Expand Down Expand Up @@ -10846,7 +10846,7 @@ void CodeGen::genCodeForNumericCast(GenTreePtr tree, regMaskTP destReg, regMaskT
case TYP_BOOL:
case TYP_BYTE:
case TYP_SHORT:
case TYP_CHAR:
case TYP_USHORT:
case TYP_UBYTE:
break;

Expand Down Expand Up @@ -10992,7 +10992,7 @@ void CodeGen::genCodeForNumericCast(GenTreePtr tree, regMaskTP destReg, regMaskT
unsv = true;
typeMask = ssize_t((int)0xFFFFFF00L);
break;
case TYP_CHAR:
case TYP_USHORT:
unsv = true;
typeMask = ssize_t((int)0xFFFF0000L);
break;
Expand Down Expand Up @@ -11771,7 +11771,7 @@ void CodeGen::genCodeForTreeSmpOpAsg(GenTreePtr tree)
case TYP_SHORT:
mask = 0x0000FFFF;
break;
case TYP_CHAR:
case TYP_USHORT:
mask = 0x0000FFFF;
break;
default:
Expand Down Expand Up @@ -14673,7 +14673,7 @@ void CodeGen::genCodeForTreeLng(GenTreePtr tree, regMaskTP needReg, regMaskTP av
{
case TYP_BOOL:
case TYP_BYTE:
case TYP_CHAR:
case TYP_USHORT:
case TYP_SHORT:
case TYP_INT:
case TYP_UBYTE:
Expand Down Expand Up @@ -15733,7 +15733,7 @@ size_t CodeGen::genPushArgList(GenTreeCall* call)
case TYP_BOOL:
case TYP_BYTE:
case TYP_SHORT:
case TYP_CHAR:
case TYP_USHORT:
case TYP_UBYTE:

/* Don't want to push a small value, make it a full word */
Expand Down
2 changes: 1 addition & 1 deletion src/jit/codegenxarch.cpp
Expand Up @@ -6584,7 +6584,7 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
typeMax = SHRT_MAX;
break;

case TYP_CHAR:
case TYP_USHORT:
typeMask = ssize_t((int)0xFFFF0000L);
break;

Expand Down
4 changes: 0 additions & 4 deletions src/jit/compiler.h
Expand Up @@ -5977,7 +5977,6 @@ class Compiler
return INT_MIN;
case TYP_BOOL:
case TYP_UBYTE:
case TYP_CHAR:
case TYP_USHORT:
case TYP_UINT:
return 0;
Expand All @@ -5999,7 +5998,6 @@ class Compiler
return INT_MAX;
case TYP_UBYTE:
return UCHAR_MAX;
case TYP_CHAR:
case TYP_USHORT:
return USHRT_MAX;
case TYP_UINT:
Expand Down Expand Up @@ -7452,8 +7450,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
return SIMDDoubleHandle;
case TYP_INT:
return SIMDIntHandle;
case TYP_CHAR:
return SIMDUShortHandle;
case TYP_USHORT:
return SIMDUShortHandle;
case TYP_UBYTE:
Expand Down
3 changes: 1 addition & 2 deletions src/jit/compiler.hpp
Expand Up @@ -538,7 +538,6 @@ inline bool genTypeCanRepresentValue(var_types type, TValue value)
case TYP_BYTE:
return FitsIn<INT8>(value);
case TYP_USHORT:
case TYP_CHAR:
return FitsIn<UINT16>(value);
case TYP_SHORT:
return FitsIn<INT16>(value);
Expand Down Expand Up @@ -626,7 +625,7 @@ inline var_types genUnsignedType(var_types type)
type = TYP_UBYTE;
break;
case TYP_SHORT:
type = TYP_CHAR;
type = TYP_USHORT;
break;
case TYP_INT:
type = TYP_UINT;
Expand Down
4 changes: 2 additions & 2 deletions src/jit/ee_il_dll.hpp
Expand Up @@ -138,11 +138,11 @@ inline var_types JITtype2varType(CorInfoType type)
TYP_UNDEF, // CORINFO_TYPE_UNDEF = 0x0,
TYP_VOID, // CORINFO_TYPE_VOID = 0x1,
TYP_BOOL, // CORINFO_TYPE_BOOL = 0x2,
TYP_CHAR, // CORINFO_TYPE_CHAR = 0x3,
TYP_USHORT, // CORINFO_TYPE_CHAR = 0x3,
TYP_BYTE, // CORINFO_TYPE_BYTE = 0x4,
TYP_UBYTE, // CORINFO_TYPE_UBYTE = 0x5,
TYP_SHORT, // CORINFO_TYPE_SHORT = 0x6,
TYP_CHAR, // CORINFO_TYPE_USHORT = 0x7,
TYP_USHORT, // CORINFO_TYPE_USHORT = 0x7,
TYP_INT, // CORINFO_TYPE_INT = 0x8,
TYP_INT, // CORINFO_TYPE_UINT = 0x9,
TYP_LONG, // CORINFO_TYPE_LONG = 0xa,
Expand Down
6 changes: 3 additions & 3 deletions src/jit/gentree.cpp
Expand Up @@ -13767,7 +13767,7 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
i1 = itemp;
goto CNS_INT;

case TYP_CHAR:
case TYP_USHORT:
itemp = INT32(UINT16(i1));
if (tree->gtOverflow())
{
Expand Down Expand Up @@ -13892,7 +13892,7 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
i1 = INT32(INT16(lval1));
goto CHECK_INT_OVERFLOW;

case TYP_CHAR:
case TYP_USHORT:
i1 = INT32(UINT16(lval1));
goto CHECK_UINT_OVERFLOW;

Expand Down Expand Up @@ -14036,7 +14036,7 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
i1 = INT32(INT16(d1));
goto CNS_INT;

case TYP_CHAR:
case TYP_USHORT:
i1 = INT32(UINT16(d1));
goto CNS_INT;

Expand Down
4 changes: 1 addition & 3 deletions src/jit/hwintrinsiccodegenxarch.cpp
Expand Up @@ -149,7 +149,6 @@ void CodeGen::genSSE2Intrinsic(GenTreeHWIntrinsic* node)
case TYP_UBYTE:
ins = INS_paddb;
break;
case TYP_CHAR:
case TYP_SHORT:
case TYP_USHORT:
ins = INS_paddw;
Expand Down Expand Up @@ -206,7 +205,7 @@ void CodeGen::genSSE42Intrinsic(GenTreeHWIntrinsic* node)
inst_RV_RV(INS_mov, targetReg, op1Reg, targetType, emitTypeSize(targetType));
}

if (baseType == TYP_UBYTE || baseType == TYP_CHAR) // baseType is the type of the second argument
if (baseType == TYP_UBYTE || baseType == TYP_USHORT) // baseType is the type of the second argument
{
assert(targetType == TYP_INT);
inst_RV_RV(INS_crc32, targetReg, op2Reg, baseType, emitTypeSize(baseType));
Expand Down Expand Up @@ -307,7 +306,6 @@ void CodeGen::genAVX2Intrinsic(GenTreeHWIntrinsic* node)
case TYP_UBYTE:
ins = INS_paddb;
break;
case TYP_CHAR:
case TYP_SHORT:
case TYP_USHORT:
ins = INS_paddw;
Expand Down
2 changes: 0 additions & 2 deletions src/jit/hwintrinsicxarch.cpp
Expand Up @@ -264,7 +264,6 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va
return Vector128DoubleHandle;
case TYP_INT:
return Vector128IntHandle;
case TYP_CHAR:
case TYP_USHORT:
return Vector128UShortHandle;
case TYP_UBYTE:
Expand Down Expand Up @@ -293,7 +292,6 @@ CORINFO_CLASS_HANDLE Compiler::gtGetStructHandleForHWSIMD(var_types simdType, va
return Vector256DoubleHandle;
case TYP_INT:
return Vector256IntHandle;
case TYP_CHAR:
case TYP_USHORT:
return Vector256UShortHandle;
case TYP_UBYTE:
Expand Down
15 changes: 7 additions & 8 deletions src/jit/importer.cpp
Expand Up @@ -3552,7 +3552,7 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
case CORINFO_INTRINSIC_StringGetChar:
op2 = impPopStack().val;
op1 = impPopStack().val;
op1 = gtNewIndexRef(TYP_CHAR, op1, op2);
op1 = gtNewIndexRef(TYP_USHORT, op1, op2);
op1->gtFlags |= GTF_INX_STRING_LAYOUT;
retNode = op1;
break;
Expand Down Expand Up @@ -6373,7 +6373,6 @@ GenTreePtr Compiler::impImportStaticReadOnlyField(void* fldAddr, var_types lclTy
ival = *((short*)fldAddr);
goto IVAL_COMMON;

case TYP_CHAR:
case TYP_USHORT:
ival = *((unsigned short*)fldAddr);
goto IVAL_COMMON;
Expand Down Expand Up @@ -11208,7 +11207,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
lclTyp = TYP_UBYTE;
goto ARR_LD;
case CEE_LDELEM_U2:
lclTyp = TYP_CHAR;
lclTyp = TYP_USHORT;
goto ARR_LD;

ARR_LD:
Expand Down Expand Up @@ -12230,7 +12229,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
lclTyp = TYP_UBYTE;
goto CONV_OVF;
case CEE_CONV_OVF_U2:
lclTyp = TYP_CHAR;
lclTyp = TYP_USHORT;
goto CONV_OVF;
case CEE_CONV_OVF_U:
lclTyp = TYP_U_IMPL;
Expand Down Expand Up @@ -12262,7 +12261,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
lclTyp = TYP_UBYTE;
goto CONV_OVF_UN;
case CEE_CONV_OVF_U2_UN:
lclTyp = TYP_CHAR;
lclTyp = TYP_USHORT;
goto CONV_OVF_UN;
case CEE_CONV_OVF_U_UN:
lclTyp = TYP_U_IMPL;
Expand Down Expand Up @@ -12305,7 +12304,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
lclTyp = TYP_UBYTE;
goto CONV;
case CEE_CONV_U2:
lclTyp = TYP_CHAR;
lclTyp = TYP_USHORT;
goto CONV;
#if (REGSIZE_BYTES == 8)
case CEE_CONV_U:
Expand Down Expand Up @@ -12419,7 +12418,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
mask = 0x00FF;
umask = 0x007F;
break;
case TYP_CHAR:
case TYP_USHORT:
case TYP_SHORT:
mask = 0xFFFF;
umask = 0x7FFF;
Expand Down Expand Up @@ -12754,7 +12753,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
lclTyp = TYP_UBYTE;
goto LDIND;
case CEE_LDIND_U2:
lclTyp = TYP_CHAR;
lclTyp = TYP_USHORT;
goto LDIND;
LDIND:

Expand Down
6 changes: 3 additions & 3 deletions src/jit/lower.cpp
Expand Up @@ -2799,8 +2799,8 @@ GenTree* Lowering::OptimizeConstCompare(GenTree* cmp)
}
else if (FitsIn<UINT16>(mask) && genTypeSize(andOp1) == 2)
{
andOp1->gtType = TYP_CHAR;
andOp2->gtType = TYP_CHAR;
andOp1->gtType = TYP_USHORT;
andOp2->gtType = TYP_USHORT;
}
}
#endif
Expand Down Expand Up @@ -5699,7 +5699,7 @@ void Lowering::getCastDescription(GenTreePtr treeNode, CastInfo* castInfo)
typeMax = SHRT_MAX;
break;

case TYP_CHAR:
case TYP_USHORT:
typeMask = ssize_t((int)0xFFFF0000L);
break;

Expand Down
10 changes: 5 additions & 5 deletions src/jit/optimizer.cpp
Expand Up @@ -2980,7 +2980,7 @@ bool jitIterSmallOverflow(int iterAtExit, var_types incrType)
case TYP_SHORT:
type_MAX = SHRT_MAX;
break;
case TYP_CHAR:
case TYP_USHORT:
type_MAX = USHRT_MAX;
break;

Expand Down Expand Up @@ -3021,7 +3021,7 @@ bool jitIterSmallUnderflow(int iterAtExit, var_types decrType)
case TYP_UBYTE:
type_MIN = 0;
break;
case TYP_CHAR:
case TYP_USHORT:
type_MIN = 0;
break;

Expand Down Expand Up @@ -3094,7 +3094,7 @@ bool Compiler::optComputeLoopRep(int constInit,
case TYP_SHORT:
INIT_ITER_BY_TYPE(signed short);
break;
case TYP_CHAR:
case TYP_USHORT:
INIT_ITER_BY_TYPE(unsigned short);
break;

Expand Down Expand Up @@ -5656,7 +5656,7 @@ bool Compiler::optNarrowTree(GenTreePtr tree, var_types srct, var_types dstt, Va
case TYP_SHORT:
lmask = 0x00007FFF;
break;
case TYP_CHAR:
case TYP_USHORT:
lmask = 0x0000FFFF;
break;
case TYP_INT:
Expand Down Expand Up @@ -5706,7 +5706,7 @@ bool Compiler::optNarrowTree(GenTreePtr tree, var_types srct, var_types dstt, Va
case TYP_SHORT:
imask = 0x00007FFF;
break;
case TYP_CHAR:
case TYP_USHORT:
imask = 0x0000FFFF;
break;
#ifdef _TARGET_64BIT_
Expand Down

0 comments on commit ef2b28d

Please sign in to comment.