Skip to content

Commit e79d7c1

Browse files
committed
[mono][jit] Remove OP_FCONV_TO_I/OP_RCONV_TO_I from the back ends, convert them to TO_I4/TO_I8 in the front end.
1 parent 04be7a9 commit e79d7c1

20 files changed

+14
-41
lines changed

src/mono/mono/mini/cpu-amd64.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ float_conv_to_u4: dest:i src1:f len:49
267267
float_conv_to_u8: dest:i src1:f len:49
268268
float_conv_to_u2: dest:i src1:f len:49
269269
float_conv_to_u1: dest:i src1:f len:49
270-
float_conv_to_i: dest:i src1:f len:49
271270
float_conv_to_ovf_i: dest:a src1:f len:40
272271
float_conv_to_ovd_u: dest:a src1:f len:40
273272
float_mul_ovf:
@@ -293,7 +292,6 @@ r4_conv_to_u2: dest:i src1:f len:32
293292
r4_conv_to_i4: dest:i src1:f len:16
294293
r4_conv_to_u4: dest:i src1:f len:32
295294
r4_conv_to_i8: dest:i src1:f len:32
296-
r4_conv_to_i: dest:i src1:f len:32
297295
r4_conv_to_r8: dest:f src1:f len:17
298296
r4_conv_to_r4: dest:f src1:f len:17
299297
r4_add: dest:f src1:f src2:f clob:1 len:5

src/mono/mono/mini/cpu-arm.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ float_conv_to_u4: dest:i src1:f len:88
211211
float_conv_to_u8: dest:l src1:f len:88
212212
float_conv_to_u2: dest:i src1:f len:88
213213
float_conv_to_u1: dest:i src1:f len:88
214-
float_conv_to_i: dest:i src1:f len:40
215214
float_ceq: dest:i src1:f src2:f len:16
216215
float_cgt: dest:i src1:f src2:f len:16
217216
float_cgt_un: dest:i src1:f src2:f len:20
@@ -226,7 +225,6 @@ rmove: dest:f src1:f len:4
226225
r4_conv_to_i1: dest:i src1:f len:88
227226
r4_conv_to_i2: dest:i src1:f len:88
228227
r4_conv_to_i4: dest:i src1:f len:88
229-
r4_conv_to_i: dest:i src1:f len:88
230228
r4_conv_to_u1: dest:i src1:f len:88
231229
r4_conv_to_u2: dest:i src1:f len:88
232230
r4_conv_to_u4: dest:i src1:f len:88

src/mono/mono/mini/cpu-arm64.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ float_conv_to_u4: dest:i src1:f len:40
209209
float_conv_to_u8: dest:l src1:f len:40
210210
float_conv_to_u2: dest:i src1:f len:40
211211
float_conv_to_u1: dest:i src1:f len:40
212-
float_conv_to_i: dest:i src1:f len:40
213212
float_ceq: dest:i src1:f src2:f len:16
214213
float_cgt: dest:i src1:f src2:f len:16
215214
float_cgt_un: dest:i src1:f src2:f len:20
@@ -228,7 +227,6 @@ r4_conv_to_u2: dest:i src1:f len:8
228227
r4_conv_to_i4: dest:i src1:f len:8
229228
r4_conv_to_u4: dest:i src1:f len:8
230229
r4_conv_to_i8: dest:l src1:f len:8
231-
r4_conv_to_i: dest:l src1:f len:8
232230
r4_conv_to_u8: dest:l src1:f len:8
233231
r4_conv_to_r4: dest:f src1:f len:4
234232
r4_conv_to_r8: dest:f src1:f len:4

src/mono/mono/mini/cpu-mips.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ float_conv_to_u4: dest:i src1:f len:40
377377
float_conv_to_u8: dest:l src1:f len:40
378378
float_conv_to_u2: dest:i src1:f len:40
379379
float_conv_to_u1: dest:i src1:f len:40
380-
float_conv_to_i: dest:i src1:f len:40
381380
float_ceq: dest:i src1:f src2:f len:20
382381
float_cgt: dest:i src1:f src2:f len:20
383382
float_cgt_un: dest:i src1:f src2:f len:20

src/mono/mono/mini/cpu-ppc.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ float_conv_to_u4: dest:i src1:f len:40
194194
float_conv_to_u8: dest:l src1:f len:40
195195
float_conv_to_u2: dest:i src1:f len:40
196196
float_conv_to_u1: dest:i src1:f len:40
197-
float_conv_to_i: dest:i src1:f len:40
198197
float_ceq: dest:i src1:f src2:f len:16
199198
float_cgt: dest:i src1:f src2:f len:16
200199
float_cgt_un: dest:i src1:f src2:f len:20

src/mono/mono/mini/cpu-ppc64.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ float_conv_to_u4: dest:i src1:f len:40
198198
float_conv_to_u8: dest:i src1:f len:40
199199
float_conv_to_u2: dest:i src1:f len:40
200200
float_conv_to_u1: dest:i src1:f len:40
201-
float_conv_to_i: dest:i src1:f len:40
202201
float_ceq: dest:i src1:f src2:f len:16
203202
float_cgt: dest:i src1:f src2:f len:16
204203
float_cgt_un: dest:i src1:f src2:f len:20

src/mono/mono/mini/cpu-s390x.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ float_conv_to_i1: dest:i src1:f len:50
122122
float_conv_to_i2: dest:i src1:f len:50
123123
float_conv_to_i4: dest:i src1:f len:50
124124
float_conv_to_i8: dest:l src1:f len:50
125-
float_conv_to_i: dest:i src1:f len:52
126125
float_conv_to_r4: dest:f src1:f len:8
127126
float_conv_to_u1: dest:i src1:f len:72
128127
float_conv_to_u2: dest:i src1:f len:72
@@ -143,7 +142,6 @@ r4_conv_to_u1: dest:i src1:f len:32
143142
r4_conv_to_i2: dest:i src1:f len:32
144143
r4_conv_to_u2: dest:i src1:f len:32
145144
r4_conv_to_i4: dest:i src1:f len:16
146-
r4_conv_to_i: dest:i src1:f len:16
147145
r4_conv_to_u4: dest:i src1:f len:32
148146
r4_conv_to_i8: dest:i src1:f len:32
149147
r4_conv_to_r8: dest:f src1:f len:17

src/mono/mono/mini/cpu-sparc.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ float_conv_to_u4: dest:i src1:f len:40
174174
float_conv_to_u8: dest:L src1:f len:40
175175
float_conv_to_u2: dest:i src1:f len:40
176176
float_conv_to_u1: dest:i src1:f len:40
177-
float_conv_to_i: dest:i src1:f len:40
178177
float_ceq: dest:i src1:f src2:f len:64
179178
float_cgt: dest:i src1:f src2:f len:64
180179
float_cgt_un: dest:i src1:f src2:f len:64

src/mono/mono/mini/cpu-x86.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ float_conv_to_u4: dest:i src1:f len:39
254254
float_conv_to_u8: dest:L src1:f len:39
255255
float_conv_to_u2: dest:y src1:f len:39
256256
float_conv_to_u1: dest:y src1:f len:39
257-
float_conv_to_i: dest:i src1:f len:39
258257
float_conv_to_ovf_i: dest:a src1:f len:30
259258
float_conv_to_ovd_u: dest:a src1:f len:30
260259
float_mul_ovf:

src/mono/mono/mini/method-to-ir.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,17 @@ type_from_op (MonoCompile *cfg, MonoInst *ins, MonoInst *src1, MonoInst *src2)
11821182
case MONO_CEE_CONV_OVF_U:
11831183
ins->type = STACK_PTR;
11841184
ins->opcode += ovfops_op_map [src1->type];
1185+
1186+
switch (ins->opcode) {
1187+
case OP_FCONV_TO_I:
1188+
ins->opcode = TARGET_SIZEOF_VOID_P == 4 ? OP_FCONV_TO_I4 : OP_FCONV_TO_I8;
1189+
break;
1190+
case OP_RCONV_TO_I:
1191+
ins->opcode = TARGET_SIZEOF_VOID_P == 4 ? OP_RCONV_TO_I4 : OP_RCONV_TO_I8;
1192+
break;
1193+
default:
1194+
break;
1195+
}
11851196
break;
11861197
case MONO_CEE_ADD_OVF:
11871198
case MONO_CEE_ADD_OVF_UN:
@@ -8723,8 +8734,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
87238734
break;
87248735
case MONO_CEE_CONV_U2:
87258736
case MONO_CEE_CONV_U1:
8726-
case MONO_CEE_CONV_I:
87278737
case MONO_CEE_CONV_U:
8738+
case MONO_CEE_CONV_I:
87288739
ADD_UNOP (il_op);
87298740
CHECK_CFG_EXCEPTION;
87308741
break;

src/mono/mono/mini/mini-amd64.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6013,7 +6013,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
60136013
case OP_FCONV_TO_I4:
60146014
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
60156015
break;
6016-
case OP_FCONV_TO_I:
60176016
case OP_FCONV_TO_I8:
60186017
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 8, TRUE);
60196018
break;
@@ -6042,7 +6041,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
60426041
amd64_sse_cvtss2si_reg_reg (code, ins->dreg, ins->sreg1);
60436042
break;
60446043
case OP_RCONV_TO_I8:
6045-
case OP_RCONV_TO_I:
60466044
amd64_sse_cvtss2si_reg_reg_size (code, ins->dreg, ins->sreg1, 8);
60476045
break;
60486046
case OP_RCONV_TO_R8:

src/mono/mono/mini/mini-arm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5682,7 +5682,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
56825682
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 2, FALSE);
56835683
break;
56845684
case OP_FCONV_TO_I4:
5685-
case OP_FCONV_TO_I:
56865685
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
56875686
break;
56885687
case OP_FCONV_TO_U4:
@@ -5904,7 +5903,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
59045903
code = emit_r4_to_int (cfg, code, ins->dreg, ins->sreg1, 2, FALSE);
59055904
break;
59065905
case OP_RCONV_TO_I4:
5907-
case OP_RCONV_TO_I:
59085906
code = emit_r4_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
59095907
break;
59105908
case OP_RCONV_TO_U4:

src/mono/mono/mini/mini-arm64.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4233,7 +4233,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
42334233
arm_fcvtzu_dx (code, dreg, sreg1);
42344234
break;
42354235
case OP_FCONV_TO_I8:
4236-
case OP_FCONV_TO_I:
42374236
arm_fcvtzs_dx (code, dreg, sreg1);
42384237
break;
42394238
case OP_FCONV_TO_U8:
@@ -4350,7 +4349,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
43504349
arm_fcvtzu_sx (code, dreg, sreg1);
43514350
break;
43524351
case OP_RCONV_TO_I8:
4353-
case OP_RCONV_TO_I:
43544352
arm_fcvtzs_sx (code, dreg, sreg1);
43554353
break;
43564354
case OP_RCONV_TO_U8:

src/mono/mono/mini/mini-llvm.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -997,9 +997,6 @@ op_to_llvm_type (int opcode)
997997
case OP_FCONV_TO_U8:
998998
case OP_RCONV_TO_U8:
999999
return LLVMInt64Type ();
1000-
case OP_FCONV_TO_I:
1001-
case OP_RCONV_TO_I:
1002-
return TARGET_SIZEOF_VOID_P == 8 ? LLVMInt64Type () : LLVMInt32Type ();
10031000
case OP_IADD_OVF:
10041001
case OP_IADD_OVF_UN:
10051002
case OP_ISUB_OVF:
@@ -6594,10 +6591,6 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
65946591
case OP_RCONV_TO_I8:
65956592
values [ins->dreg] = LLVMBuildFPToSI (builder, lhs, LLVMInt64Type (), dname);
65966593
break;
6597-
case OP_FCONV_TO_I:
6598-
case OP_RCONV_TO_I:
6599-
values [ins->dreg] = LLVMBuildFPToSI (builder, lhs, IntPtrType (), dname);
6600-
break;
66016594
case OP_ICONV_TO_R8:
66026595
case OP_LCONV_TO_R8:
66036596
values [ins->dreg] = LLVMBuildSIToFP (builder, lhs, LLVMDoubleType (), dname);
@@ -7804,8 +7797,8 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
78047797
break;
78057798
case OP_FMAX:
78067799
case OP_FMIN: {
7807-
LLVMValueRef args [] = { l, r };
78087800
#if defined(TARGET_X86) || defined(TARGET_AMD64)
7801+
LLVMValueRef args [] = { l, r };
78097802
LLVMTypeRef t = LLVMTypeOf (l);
78107803
LLVMTypeRef elem_t = LLVMGetElementType (t);
78117804
unsigned int elems = LLVMGetVectorSize (t);
@@ -7833,6 +7826,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
78337826
}
78347827

78357828
#elif defined(TARGET_ARM64)
7829+
LLVMValueRef args [] = { l, r };
78367830
IntrinsicId iid = ins->inst_c0 == OP_FMAX ? INTRINS_AARCH64_ADV_SIMD_FMAX : INTRINS_AARCH64_ADV_SIMD_FMIN;
78377831
llvm_ovr_tag_t ovr_tag = ovr_tag_from_mono_vector_class (ins->klass);
78387832
result = call_overloaded_intrins (ctx, iid, ovr_tag, args, "");

src/mono/mono/mini/mini-mips.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4266,7 +4266,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
42664266
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 2, FALSE);
42674267
break;
42684268
case OP_FCONV_TO_I4:
4269-
case OP_FCONV_TO_I:
42704269
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
42714270
break;
42724271
case OP_FCONV_TO_U4:

src/mono/mono/mini/mini-ppc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4159,7 +4159,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
41594159
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 2, FALSE);
41604160
break;
41614161
case OP_FCONV_TO_I4:
4162-
case OP_FCONV_TO_I:
41634162
code = emit_float_to_int (cfg, code, ins->dreg, ins->sreg1, 4, TRUE);
41644163
break;
41654164
case OP_FCONV_TO_U4:

src/mono/mono/mini/mini-runtime.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4811,10 +4811,6 @@ register_icalls (void)
48114811
register_opcode_emulation (OP_FCONV_TO_U1, __emul_fconv_to_u1, mono_icall_sig_uint8_double, mono_fconv_u1, FALSE);
48124812
register_opcode_emulation (OP_FCONV_TO_U2, __emul_fconv_to_u2, mono_icall_sig_uint16_double, mono_fconv_u2, FALSE);
48134813

4814-
#if TARGET_SIZEOF_VOID_P == 4
4815-
register_opcode_emulation (OP_FCONV_TO_I, __emul_fconv_to_i, mono_icall_sig_int32_double, mono_fconv_i4, FALSE);
4816-
#endif
4817-
48184814
register_opcode_emulation (OP_FBEQ, __emul_fcmp_eq, mono_icall_sig_uint32_double_double, mono_fcmp_eq, FALSE);
48194815
register_opcode_emulation (OP_FBLT, __emul_fcmp_lt, mono_icall_sig_uint32_double_double, mono_fcmp_lt, FALSE);
48204816
register_opcode_emulation (OP_FBGT, __emul_fcmp_gt, mono_icall_sig_uint32_double_double, mono_fcmp_gt, FALSE);

src/mono/mono/mini/mini-s390x.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4296,7 +4296,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
42964296
}
42974297
break;
42984298
case OP_FCONV_TO_I8:
4299-
case OP_FCONV_TO_I:
43004299
s390_cgdbr (code, ins->dreg, 5, ins->sreg1);
43014300
break;
43024301
case OP_FCONV_TO_U8:
@@ -4351,7 +4350,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
43514350
}
43524351
break;
43534352
case OP_RCONV_TO_I8:
4354-
case OP_RCONV_TO_I:
43554353
s390_cgebr (code, ins->dreg, 5, ins->sreg1);
43564354
break;
43574355
case OP_RCONV_TO_U8:

src/mono/mono/mini/mini-sparc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,9 +3393,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
33933393
case OP_FCONV_TO_U1:
33943394
case OP_FCONV_TO_I2:
33953395
case OP_FCONV_TO_U2:
3396-
#ifndef SPARCV9
3397-
case OP_FCONV_TO_I:
3398-
#endif
33993396
case OP_FCONV_TO_I4:
34003397
case OP_FCONV_TO_U4: {
34013398
MonoInst *spill = cfg->arch.float_spill_slot;

src/mono/mono/mini/mini-x86.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,7 +3510,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
35103510
code = emit_float_to_int (cfg, code, ins->dreg, 2, FALSE);
35113511
break;
35123512
case OP_FCONV_TO_I4:
3513-
case OP_FCONV_TO_I:
35143513
code = emit_float_to_int (cfg, code, ins->dreg, 4, TRUE);
35153514
break;
35163515
case OP_FCONV_TO_I8:
@@ -6155,7 +6154,6 @@ mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins)
61556154
case OP_FCONV_TO_I2:
61566155
case OP_FCONV_TO_U2:
61576156
case OP_FCONV_TO_I4:
6158-
case OP_FCONV_TO_I:
61596157
break;
61606158
default:
61616159
return;

0 commit comments

Comments
 (0)