Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[mono] Remove the support for non r4fp, its not used by any supported platforms. #82005

Merged
merged 1 commit into from
Apr 3, 2023
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
5 changes: 1 addition & 4 deletions src/mono/mono/mini/calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ ret_type_to_call_opcode (MonoCompile *cfg, MonoType *type, int calli, int virt)
case MONO_TYPE_U8:
return calli? OP_LCALL_REG: virt? OP_LCALL_MEMBASE: OP_LCALL;
case MONO_TYPE_R4:
if (cfg->r4fp)
return calli? OP_RCALL_REG: virt? OP_RCALL_MEMBASE: OP_RCALL;
else
return calli? OP_FCALL_REG: virt? OP_FCALL_MEMBASE: OP_FCALL;
return calli? OP_RCALL_REG: virt? OP_RCALL_MEMBASE: OP_RCALL;
case MONO_TYPE_R8:
return calli? OP_FCALL_REG: virt? OP_FCALL_MEMBASE: OP_FCALL;
case MONO_TYPE_VALUETYPE:
Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono/mini/intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ llvm_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
MonoInst *ins = NULL;
int opcode = 0;
// Convert Math and MathF methods into LLVM intrinsics, e.g. MathF.Sin -> @llvm.sin.f32
if (in_corlib && !strcmp (m_class_get_name (cmethod->klass), "MathF") && cfg->r4fp) {
if (in_corlib && !strcmp (m_class_get_name (cmethod->klass), "MathF")) {
// (float)
if (fsig->param_count == 1 && fsig->params [0]->type == MONO_TYPE_R4) {
if (!strcmp (cmethod->name, "Ceiling")) {
Expand Down Expand Up @@ -1524,7 +1524,7 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
#endif
break;
case MONO_TYPE_R4:
ins->type = GINT_TO_UINT8 (cfg->r4_stack_type);
ins->type = GINT_TO_UINT8 (STACK_R4);
break;
case MONO_TYPE_R8:
ins->type = STACK_R8;
Expand Down Expand Up @@ -1662,7 +1662,7 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
#endif
break;
case MONO_TYPE_R4:
ins->type = GINT_TO_UINT8 (cfg->r4_stack_type);
ins->type = GINT_TO_UINT8 (STACK_R4);
break;
case MONO_TYPE_R8:
ins->type = STACK_R8;
Expand Down
29 changes: 13 additions & 16 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ mono_type_to_regmove (MonoCompile *cfg, MonoType *type)
return OP_LMOVE;
#endif
case MONO_TYPE_R4:
return cfg->r4fp ? OP_RMOVE : OP_FMOVE;
return OP_RMOVE;
case MONO_TYPE_R8:
return OP_FMOVE;
case MONO_TYPE_VALUETYPE:
Expand Down Expand Up @@ -483,9 +483,8 @@ add_widen_op (MonoCompile *cfg, MonoInst *ins, MonoInst **arg1_ref, MonoInst **a
MonoInst *arg1 = *arg1_ref;
MonoInst *arg2 = *arg2_ref;

if (cfg->r4fp &&
((arg1->type == STACK_R4 && arg2->type == STACK_R8) ||
(arg1->type == STACK_R8 && arg2->type == STACK_R4))) {
if ((arg1->type == STACK_R4 && arg2->type == STACK_R8) ||
(arg1->type == STACK_R8 && arg2->type == STACK_R4)) {
MonoInst *conv;

/* Mixing r4/r8 is allowed by the spec */
Expand Down Expand Up @@ -827,7 +826,7 @@ mini_type_to_eval_stack_type (MonoCompile *cfg, MonoType *type, MonoInst *inst)
inst->type = STACK_I8;
return;
case MONO_TYPE_R4:
inst->type = GINT_TO_UINT8 (cfg->r4_stack_type);
inst->type = GINT_TO_UINT8 (STACK_R4);
break;
case MONO_TYPE_R8:
inst->type = STACK_R8;
Expand Down Expand Up @@ -1161,7 +1160,7 @@ type_from_op (MonoCompile *cfg, MonoInst *ins, MonoInst *src1, MonoInst *src2)
ins->opcode += ovf2ops_op_map [src1->type];
break;
case MONO_CEE_CONV_R4:
ins->type = GINT_TO_UINT8 (cfg->r4_stack_type);
ins->type = GINT_TO_UINT8 (STACK_R4);
ins->opcode += unops_op_map [src1->type];
break;
case MONO_CEE_CONV_R8:
Expand Down Expand Up @@ -1219,7 +1218,7 @@ type_from_op (MonoCompile *cfg, MonoInst *ins, MonoInst *src1, MonoInst *src2)
ins->type = STACK_I8;
break;
case OP_LOADR4_MEMBASE:
ins->type = GINT_TO_UINT8 (cfg->r4_stack_type);
ins->type = GINT_TO_UINT8 (STACK_R4);
break;
case OP_LOADR8_MEMBASE:
ins->type = STACK_R8;
Expand Down Expand Up @@ -1434,7 +1433,7 @@ mini_type_to_stack_type (MonoCompile *cfg, MonoType *t)
case MONO_TYPE_U8:
return STACK_I8;
case MONO_TYPE_R4:
return (MonoStackType)cfg->r4_stack_type;
return (MonoStackType)STACK_R4;
case MONO_TYPE_R8:
return STACK_R8;
case MONO_TYPE_VALUETYPE:
Expand Down Expand Up @@ -1917,7 +1916,7 @@ target_type_is_incompatible (MonoCompile *cfg, MonoType *target, MonoInst *arg)
return 1;
return 0;
case MONO_TYPE_R4:
if (arg->type != cfg->r4_stack_type)
if (arg->type != STACK_R4)
return 1;
return 0;
case MONO_TYPE_R8:
Expand Down Expand Up @@ -1980,8 +1979,6 @@ target_type_is_incompatible (MonoCompile *cfg, MonoType *target, MonoInst *arg)
static MonoInst*
convert_value (MonoCompile *cfg, MonoType *type, MonoInst *ins)
{
if (!cfg->r4fp)
return ins;
type = mini_get_underlying_type (type);
switch (type->type) {
case MONO_TYPE_R4:
Expand Down Expand Up @@ -2074,7 +2071,7 @@ check_call_signature (MonoCompile *cfg, MonoMethodSignature *sig, MonoInst **arg
return TRUE;
continue;
case MONO_TYPE_R4:
if (args [i]->type != cfg->r4_stack_type)
if (args [i]->type != STACK_R4)
return TRUE;
continue;
case MONO_TYPE_R8:
Expand Down Expand Up @@ -4639,7 +4636,7 @@ mini_emit_init_rvar (MonoCompile *cfg, int dreg, MonoType *rtype)
MONO_EMIT_NEW_ICONST (cfg, dreg, 0);
} else if (t == MONO_TYPE_I8 || t == MONO_TYPE_U8) {
MONO_EMIT_NEW_I8CONST (cfg, dreg, 0);
} else if (cfg->r4fp && t == MONO_TYPE_R4) {
} else if (t == MONO_TYPE_R4) {
MONO_INST_NEW (cfg, ins, OP_R4CONST);
ins->type = STACK_R4;
ins->inst_p0 = (void*)&r4_0;
Expand Down Expand Up @@ -4675,7 +4672,7 @@ emit_dummy_init_rvar (MonoCompile *cfg, int dreg, MonoType *rtype)
MONO_EMIT_NEW_DUMMY_INIT (cfg, dreg, OP_DUMMY_ICONST);
} else if (t == MONO_TYPE_I8 || t == MONO_TYPE_U8) {
MONO_EMIT_NEW_DUMMY_INIT (cfg, dreg, OP_DUMMY_I8CONST);
} else if (cfg->r4fp && t == MONO_TYPE_R4) {
} else if (t == MONO_TYPE_R4) {
MONO_EMIT_NEW_DUMMY_INIT (cfg, dreg, OP_DUMMY_R4CONST);
} else if (t == MONO_TYPE_R4 || t == MONO_TYPE_R8) {
MONO_EMIT_NEW_DUMMY_INIT (cfg, dreg, OP_DUMMY_R8CONST);
Expand Down Expand Up @@ -7281,10 +7278,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b

dreg = alloc_freg (cfg);
EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOADR4_MEMBASE, dreg, cons->dreg, 0);
ins->type = GINT_TO_UINT8 (cfg->r4_stack_type);
ins->type = GINT_TO_UINT8 (STACK_R4);
} else {
MONO_INST_NEW (cfg, ins, OP_R4CONST);
ins->type = GINT_TO_UINT8 (cfg->r4_stack_type);
ins->type = GINT_TO_UINT8 (STACK_R4);
ins->dreg = alloc_dreg (cfg, STACK_R8);
ins->inst_p0 = f;
MONO_ADD_INS (cfg->cbb, ins);
Expand Down
104 changes: 16 additions & 88 deletions src/mono/mono/mini/mini-amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -5350,12 +5350,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
amd64_mov_reg_reg (code, ins->dreg, ins->sreg1, sizeof (target_mgreg_t));
break;
case OP_AMD64_SET_XMMREG_R4: {
if (cfg->r4fp) {
if (ins->dreg != ins->sreg1)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg1);
} else {
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg1);
}
if (ins->dreg != ins->sreg1)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg1);
break;
}
case OP_AMD64_SET_XMMREG_R8: {
Expand Down Expand Up @@ -5862,10 +5858,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
float f = *(float *)ins->inst_p0;

if ((f == 0.0) && (mono_signbit (f) == 0)) {
if (cfg->r4fp)
amd64_sse_xorps_reg_reg (code, ins->dreg, ins->dreg);
else
amd64_sse_xorpd_reg_reg (code, ins->dreg, ins->dreg);
amd64_sse_xorps_reg_reg (code, ins->dreg, ins->dreg);
} else {
if (cfg->compile_aot && cfg->code_exec_only) {
mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_R4_GOT, ins->inst_p0);
Expand All @@ -5875,8 +5868,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_R4, ins->inst_p0);
amd64_sse_movss_reg_membase (code, ins->dreg, AMD64_RIP, 0);
}
if (!cfg->r4fp)
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
}
break;
}
Expand All @@ -5887,51 +5878,25 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
amd64_sse_movsd_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
break;
case OP_STORER4_MEMBASE_REG:
if (cfg->r4fp) {
amd64_sse_movss_membase_reg (code, ins->inst_destbasereg, ins->inst_offset, ins->sreg1);
} else {
/* This requires a double->single conversion */
amd64_sse_cvtsd2ss_reg_reg (code, MONO_ARCH_FP_SCRATCH_REG, ins->sreg1);
amd64_sse_movss_membase_reg (code, ins->inst_destbasereg, ins->inst_offset, MONO_ARCH_FP_SCRATCH_REG);
}
amd64_sse_movss_membase_reg (code, ins->inst_destbasereg, ins->inst_offset, ins->sreg1);
break;
case OP_LOADR4_MEMBASE:
if (cfg->r4fp) {
amd64_sse_movss_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
} else {
amd64_sse_movss_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
}
amd64_sse_movss_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
break;
case OP_ICONV_TO_R4:
if (cfg->r4fp) {
amd64_sse_cvtsi2ss_reg_reg_size (code, ins->dreg, ins->sreg1, 4);
} else {
amd64_sse_cvtsi2ss_reg_reg_size (code, ins->dreg, ins->sreg1, 4);
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
}
amd64_sse_cvtsi2ss_reg_reg_size (code, ins->dreg, ins->sreg1, 4);
break;
case OP_ICONV_TO_R8:
amd64_sse_cvtsi2sd_reg_reg_size (code, ins->dreg, ins->sreg1, 4);
break;
case OP_LCONV_TO_R4:
if (cfg->r4fp) {
amd64_sse_cvtsi2ss_reg_reg (code, ins->dreg, ins->sreg1);
} else {
amd64_sse_cvtsi2ss_reg_reg (code, ins->dreg, ins->sreg1);
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
}
amd64_sse_cvtsi2ss_reg_reg (code, ins->dreg, ins->sreg1);
break;
case OP_LCONV_TO_R8:
amd64_sse_cvtsi2sd_reg_reg (code, ins->dreg, ins->sreg1);
break;
case OP_FCONV_TO_R4:
if (cfg->r4fp) {
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg1);
} else {
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg1);
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
}
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg1);
break;
case OP_FCONV_TO_I1:
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 1, TRUE);
Expand Down Expand Up @@ -6037,17 +6002,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg1);
break;
case OP_MOVE_F_TO_I4:
if (cfg->r4fp) {
amd64_movd_reg_xreg_size (code, ins->dreg, ins->sreg1, 8);
} else {
amd64_sse_cvtsd2ss_reg_reg (code, MONO_ARCH_FP_SCRATCH_REG, ins->sreg1);
amd64_movd_reg_xreg_size (code, ins->dreg, MONO_ARCH_FP_SCRATCH_REG, 8);
}
amd64_movd_reg_xreg_size (code, ins->dreg, ins->sreg1, 8);
break;
case OP_MOVE_I4_TO_F:
amd64_movd_xreg_reg_size (code, ins->dreg, ins->sreg1, 8);
if (!cfg->r4fp)
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
break;
case OP_MOVE_F_TO_I8:
amd64_movd_reg_xreg_size (code, ins->dreg, ins->sreg1, 8);
Expand Down Expand Up @@ -6579,12 +6537,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
break;
}
case OP_ATOMIC_LOAD_R4: {
if (cfg->r4fp) {
amd64_sse_movss_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
} else {
amd64_sse_movss_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
}
amd64_sse_movss_reg_membase (code, ins->dreg, ins->inst_basereg, ins->inst_offset);
break;
}
case OP_ATOMIC_LOAD_R8: {
Expand Down Expand Up @@ -6630,13 +6583,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
break;
}
case OP_ATOMIC_STORE_R4: {
if (cfg->r4fp) {
amd64_sse_movss_membase_reg (code, ins->inst_destbasereg, ins->inst_offset, ins->sreg1);
} else {
amd64_sse_cvtsd2ss_reg_reg (code, MONO_ARCH_FP_SCRATCH_REG, ins->sreg1);
amd64_sse_movss_membase_reg (code, ins->inst_destbasereg, ins->inst_offset, MONO_ARCH_FP_SCRATCH_REG);
}

amd64_sse_movss_membase_reg (code, ins->inst_destbasereg, ins->inst_offset, ins->sreg1);
if (ins->backend.memory_barrier_kind == MONO_MEMORY_BARRIER_SEQ)
x86_mfence (code);
break;
Expand Down Expand Up @@ -7228,33 +7175,21 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
case OP_INSERTX_R4_SLOW:
switch (ins->inst_c0) {
case 0:
if (cfg->r4fp)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
else
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
break;
case 1:
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, mono_simd_shuffle_mask(1, 0, 2, 3));
if (cfg->r4fp)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
else
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, mono_simd_shuffle_mask(1, 0, 2, 3));
break;
case 2:
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, mono_simd_shuffle_mask(2, 1, 0, 3));
if (cfg->r4fp)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
else
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, mono_simd_shuffle_mask(2, 1, 0, 3));
break;
case 3:
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, mono_simd_shuffle_mask(3, 1, 2, 0));
if (cfg->r4fp)
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
else
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_movss_reg_reg (code, ins->dreg, ins->sreg2);
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, mono_simd_shuffle_mask(3, 1, 2, 0));
break;
}
Expand Down Expand Up @@ -7309,8 +7244,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
case OP_ICONV_TO_R4_RAW:
amd64_movd_xreg_reg_size (code, ins->dreg, ins->sreg1, 4);
if (!cfg->r4fp)
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg);
break;

case OP_FCONV_TO_R8_X:
Expand Down Expand Up @@ -7349,12 +7282,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, 0x44);
break;
case OP_EXPAND_R4:
if (cfg->r4fp) {
amd64_sse_movsd_reg_reg (code, ins->dreg, ins->sreg1);
} else {
amd64_sse_movsd_reg_reg (code, ins->dreg, ins->sreg1);
amd64_sse_cvtsd2ss_reg_reg (code, ins->dreg, ins->dreg);
}
amd64_sse_movsd_reg_reg (code, ins->dreg, ins->sreg1);
amd64_sse_pshufd_reg_reg_imm (code, ins->dreg, ins->dreg, 0);
break;
case OP_EXPAND_R8:
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono/mini/mini-amd64.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ typedef struct {
#define MONO_ARCH_HAVE_SDB_TRAMPOLINES 1
#define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1
#define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1
#define MONO_ARCH_FLOAT32_SUPPORTED 1
#define MONO_ARCH_LLVM_TARGET_LAYOUT "e-i64:64-i128:128-n8:16:32:64-S128"

#define MONO_ARCH_HAVE_INTERP_PINVOKE_TRAMP
Expand Down
Loading