Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4744,6 +4744,18 @@ void CodeGen::genIntrinsic(GenTreeIntrinsic* treeNode)
case NI_System_Math_MaxNumber:
instr = is4 ? INS_fmax_s : INS_fmax_d;
break;
case NI_System_Math_Min:
instr = INS_min;
break;
case NI_System_Math_MinUnsigned:
instr = INS_minu;
break;
case NI_System_Math_Max:
instr = INS_max;
break;
case NI_System_Math_MaxUnsigned:
instr = INS_maxu;
break;
case NI_PRIMITIVE_LeadingZeroCount:
instr = is4 ? INS_clzw : INS_clz;
break;
Expand Down
17 changes: 16 additions & 1 deletion src/coreclr/jit/emitriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ void emitter::emitIns_R_R_R(
if ((INS_add <= ins && ins <= INS_and) || (INS_mul <= ins && ins <= INS_remuw) ||
(INS_addw <= ins && ins <= INS_sraw) || (INS_fadd_s <= ins && ins <= INS_fmax_s) ||
(INS_fadd_d <= ins && ins <= INS_fmax_d) || (INS_feq_s <= ins && ins <= INS_fle_s) ||
(INS_feq_d <= ins && ins <= INS_fle_d) || (INS_lr_w <= ins && ins <= INS_amomaxu_d))
(INS_feq_d <= ins && ins <= INS_fle_d) || (INS_lr_w <= ins && ins <= INS_amomaxu_d) ||
(INS_min <= ins && ins <= INS_maxu))
{
#ifdef DEBUG
switch (ins)
Expand Down Expand Up @@ -913,6 +914,11 @@ void emitter::emitIns_R_R_R(
case INS_amominu_d:
case INS_amomaxu_w:
case INS_amomaxu_d:

case INS_min:
case INS_minu:
case INS_max:
case INS_maxu:
break;
default:
NYI_RISCV64("illegal ins within emitIns_R_R_R!");
Expand Down Expand Up @@ -4081,6 +4087,15 @@ void emitter::emitDispInsName(
return emitDispIllegalInstruction(code);
}
return;
case 0b0000101:
{
if ((opcode3 >> 2) != 1) // clmul[h] unsupported
return emitDispIllegalInstruction(code);

static const char names[][5] = {"min ", "minu", "max ", "maxu"};
printf("%s %s, %s, %s\n", names[opcode3 & 0b11], rd, rs1, rs2);
return;
}
default:
return emitDispIllegalInstruction(code);
}
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5404,10 +5404,12 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
case NI_System_Math_MaxMagnitude:
case NI_System_Math_MaxMagnitudeNumber:
case NI_System_Math_MaxNumber:
case NI_System_Math_MaxUnsigned:
case NI_System_Math_Min:
case NI_System_Math_MinMagnitude:
case NI_System_Math_MinMagnitudeNumber:
case NI_System_Math_MinNumber:
case NI_System_Math_MinUnsigned:
case NI_System_Math_Pow:
case NI_System_Math_Round:
case NI_System_Math_Sin:
Expand Down Expand Up @@ -5759,10 +5761,12 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
case NI_System_Math_MaxMagnitude:
case NI_System_Math_MaxMagnitudeNumber:
case NI_System_Math_MaxNumber:
case NI_System_Math_MaxUnsigned:
case NI_System_Math_Min:
case NI_System_Math_MinMagnitude:
case NI_System_Math_MinMagnitudeNumber:
case NI_System_Math_MinNumber:
case NI_System_Math_MinUnsigned:
{
level++;
break;
Expand Down Expand Up @@ -12758,6 +12762,9 @@ void Compiler::gtDispTree(GenTree* tree,
case NI_System_Math_MaxNumber:
printf(" maxNumber");
break;
case NI_System_Math_MaxUnsigned:
printf(" maxUnsigned");
break;
case NI_System_Math_Min:
printf(" min");
break;
Expand All @@ -12770,6 +12777,9 @@ void Compiler::gtDispTree(GenTree* tree,
case NI_System_Math_MinNumber:
printf(" minNumber");
break;
case NI_System_Math_MinUnsigned:
printf(" minUnsigned");
break;
case NI_System_Math_Pow:
printf(" pow");
break;
Expand Down
Loading
Loading