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

[Ppc64le] bug fixes #74131

Merged
merged 8 commits into from
Aug 19, 2022
20 changes: 10 additions & 10 deletions src/mono/mono/mini/cpu-ppc64.mdesc
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@
#
# See the code in mini-x86.c for more details on how the specifiers are used.
#
tailcall: len:124 clob:c
tailcall: len:152 clob:c
tailcall_parameter: len:0 # PowerPC outputs a nice fixed size memcpy loop for larger stack_usage, so 0.
memory_barrier: len:4
nop: len:4
relaxed_nop: len:4
break: len:40
break: len:44
seq_point: len:48
il_seq_point: len:0
call: dest:a clob:c len:36
call: dest:a clob:c len:40
br: len:4
throw: src1:i len:40
rethrow: src1:i len:40
throw: src1:i len:44
rethrow: src1:i len:44
ckfinite: dest:f src1:f
ppc_check_finite: src1:i len:16
add_ovf_carry: dest:i src1:i src2:i len:16
Expand All @@ -77,16 +77,16 @@ fcompare: src1:f src2:f len:12
arglist: src1:i len:12
setlret: src1:i src2:i len:12
check_this: src1:b len:4
voidcall: len:36 clob:c
voidcall: len:40 clob:c
voidcall_reg: src1:i len:16 clob:c
voidcall_membase: src1:b len:16 clob:c
fcall: dest:g len:36 clob:c
fcall: dest:g len:40 clob:c
fcall_reg: dest:g src1:i len:16 clob:c
fcall_membase: dest:g src1:b len:16 clob:c
lcall: dest:a len:36 clob:c
lcall: dest:a len:40 clob:c
lcall_reg: dest:a src1:i len:16 clob:c
lcall_membase: dest:a src1:b len:16 clob:c
vcall: len:16 clob:c
vcall: len:20 clob:c
vcall_reg: src1:i len:16 clob:c
vcall_membase: src1:b len:12 clob:c
call_reg: dest:a src1:i len:16 clob:c
Expand Down Expand Up @@ -404,7 +404,7 @@ int_max_un: dest:i src1:i src2:i len:8 clob:1

#long_conv_to_ovf_i4_2: dest:i src1:i src2:i len:30

vcall2: len:36 clob:c
vcall2: len:40 clob:c
vcall2_reg: src1:i len:16 clob:c
vcall2_membase: src1:b len:16 clob:c

Expand Down
42 changes: 30 additions & 12 deletions src/mono/mono/mini/mini-ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5142,8 +5142,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
int soffset = 0;
int cur_reg;
int size = 0;
g_assert (ppc_is_imm16 (inst->inst_offset));
g_assert (ppc_is_imm16 (inst->inst_offset + ainfo->vtregs * sizeof (target_mgreg_t)));
g_assert (ppc_is_imm32 (inst->inst_offset));
g_assert (ppc_is_imm32 (inst->inst_offset + ainfo->vtregs * sizeof (target_mgreg_t)));
/* FIXME: what if there is no class? */
if (sig->pinvoke && !sig->marshalling_disabled && mono_class_from_mono_type_internal (inst->inst_vtype))
size = mono_class_native_size (mono_class_from_mono_type_internal (inst->inst_vtype), NULL);
Expand Down Expand Up @@ -5171,21 +5171,39 @@ mono_arch_emit_prolog (MonoCompile *cfg)
(sizeof (target_mgreg_t) - ainfo->bytes) * 8);
ppc_stptr (code, ppc_r0, doffset, inst->inst_basereg);
#else
if (mono_class_native_size (inst->klass, NULL) == 1) {
ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
} else if (mono_class_native_size (inst->klass, NULL) == 2) {
ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
} else if (mono_class_native_size (inst->klass, NULL) == 4) { // WDS -- maybe <=4?
ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
} else {
ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); // WDS -- Better way?
if (ppc_is_imm16 (inst->inst_offset)) {
if (mono_class_native_size (inst->klass, NULL) == 1) {
ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
} else if (mono_class_native_size (inst->klass, NULL) == 2) {
ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
} else if (mono_class_native_size (inst->klass, NULL) == 4) { // WDS -- maybe <=4?
ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
} else {
ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); // WDS -- Better way?
}
}
else if (ppc_is_imm32 (inst->inst_offset)) {
ppc_addis (code, ppc_r12, inst->inst_basereg, ppc_ha(doffset));
ppc_stptr (code, ainfo->reg + cur_reg, doffset, ppc_r12);
}
else {
g_assert_not_reached();
}
#endif
} else
#endif
{
ppc_stptr (code, ainfo->reg + cur_reg, doffset,
inst->inst_basereg);
if (ppc_is_imm16 (inst->inst_offset)) {
ppc_stptr (code, ainfo->reg + cur_reg, doffset,
inst->inst_basereg);
}
else if (ppc_is_imm32 (inst->inst_offset)) {
ppc_addis (code, ppc_r12, inst->inst_basereg, ppc_ha(doffset));
ppc_stptr (code, ainfo->reg + cur_reg, doffset, ppc_r12);
}
else {
g_assert_not_reached();
}
}
}
soffset += sizeof (target_mgreg_t);
Expand Down