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] Performance improvements while branching during function calls #90367

Merged
merged 19 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a9d9b6d
[ppc64le] Fixed thunk address 8 byte alignment issue
alhad-deshpande Sep 8, 2022
2b2092f
Merge branch 'main' of https://github.com/Sapana-Khemkar/runtime into…
alhad-deshpande Oct 19, 2022
3531291
Fixed FSharp crash issue
alhad-deshpande Oct 19, 2022
9a042d7
Merge branch 'dotnet:main' into main
alhad-deshpande Oct 21, 2022
96f7c4d
[ppc64le] Implementation of mono_arch_get_delegate_virtual_invoke_imp…
alhad-deshpande Oct 21, 2022
6a05d50
Fixed clang15 build issues and returning address of sc_sp instead of …
alhad-deshpande Nov 9, 2022
8110ac8
Merge branch 'dotnet:main' into main
alhad-deshpande Nov 9, 2022
18910e3
Merge branch 'dotnet:main' into main
alhad-deshpande Apr 12, 2023
5fc3241
Merge branch 'dotnet:main' into main
alhad-deshpande Apr 17, 2023
6a89b7c
Merge branch 'dotnet:main' into main
alhad-deshpande May 3, 2023
1a1a0e2
Added float32 support and implemented related opcodes
alhad-deshpande May 11, 2023
6b2758d
Correction in OP_RCONV_TO_R cases
alhad-deshpande May 11, 2023
5d9a5db
Merge branch 'dotnet:main' into main
alhad-deshpande May 11, 2023
d1ebd9a
Merge branch 'dotnet:main' into main
alhad-deshpande May 12, 2023
fe1b890
Corrected code for few opcodes
alhad-deshpande May 24, 2023
3fef59b
Merge branch 'main' of https://github.com/Sapana-Khemkar/runtime into…
alhad-deshpande Aug 3, 2023
0cb3cec
Merge branch 'main' of https://github.com/Sapana-Khemkar/runtime into…
alhad-deshpande Aug 11, 2023
a1fec64
[ppc64le] performance improvements while branching
alhad-deshpande Aug 11, 2023
e94afeb
Merge branch 'dotnet:main' into main
alhad-deshpande Aug 11, 2023
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
42 changes: 21 additions & 21 deletions src/mono/mono/mini/mini-ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ gboolean
mono_ppc_is_direct_call_sequence (guint32 *code)
{
#ifdef TARGET_POWERPC64
g_assert(*code == 0x4e800021 || *code == 0x4e800020 || *code == 0x4e800420);
g_assert(*code == 0x4e800021 || *code == 0x4e800020 || *code == 0x4e800421 || *code == 0x4e800420);

/* the thunk-less direct call sequence: lis/ori/sldi/oris/ori/mtlr/blrl */
if (ppc_opcode (code [-1]) == 31) { /* mtlr */
Expand Down Expand Up @@ -2939,7 +2939,7 @@ ppc_patch_full (MonoCompile *cfg, guchar *code, const guchar *target, gboolean i
return;
}

if (prim == 15 || ins == 0x4e800021 || ins == 0x4e800020 || ins == 0x4e800420) {
if (prim == 15 || ins == 0x4e800021 || ins == 0x4e800020 || ins == 0x4e800421 || ins == 0x4e800420) {
#ifdef TARGET_POWERPC64
#if !defined(PPC_USES_FUNCTION_DESCRIPTOR)
handle_thunk (cfg, code, target);
Expand All @@ -2948,7 +2948,7 @@ ppc_patch_full (MonoCompile *cfg, guchar *code, const guchar *target, gboolean i
guint32 *branch_ins;

/* the trampoline code will try to patch the blrl, blr, bcctr */
if (ins == 0x4e800021 || ins == 0x4e800020 || ins == 0x4e800420) {
if (ins == 0x4e800021 || ins == 0x4e800020 || ins == 0x4e800421 || ins == 0x4e800420) {
branch_ins = seq;
if (ppc_is_load_op (seq [-3]) || ppc_opcode (seq [-3]) == 31) /* ld || lwz || mr */
code -= 32;
Expand Down Expand Up @@ -2996,15 +2996,15 @@ ppc_patch_full (MonoCompile *cfg, guchar *code, const guchar *target, gboolean i
#else
guint32 *seq;
/* the trampoline code will try to patch the blrl, blr, bcctr */
if (ins == 0x4e800021 || ins == 0x4e800020 || ins == 0x4e800420) {
if (ins == 0x4e800021 || ins == 0x4e800020 || ins == 0x4e800421 || ins == 0x4e800420) {
code -= 12;
}
/* this is the lis/ori/mtlr/blrl sequence */
seq = (guint32*)code;
g_assert ((seq [0] >> 26) == 15);
g_assert ((seq [1] >> 26) == 24);
g_assert ((seq [2] >> 26) == 31);
g_assert (seq [3] == 0x4e800021 || seq [3] == 0x4e800020 || seq [3] == 0x4e800420);
g_assert (seq [3] == 0x4e800021 || seq [3] == 0x4e800020 || seq [3] == 0x4e800421 || seq [3] == 0x4e800420);
/* FIXME: make this thread safe */
ppc_lis (code, PPC_CALL_REG, (guint32)(target) >> 16);
ppc_ori (code, PPC_CALL_REG, PPC_CALL_REG, (guint32)(target) & 0xffff);
Expand Down Expand Up @@ -3426,8 +3426,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
ppc_ldr (code, PPC_CALL_REG, 0, PPC_CALL_REG);
cfg->thunk_area += THUNK_SIZE;
#endif
ppc_mtlr (code, PPC_CALL_REG);
ppc_blrl (code);
ppc_mtctr (code, PPC_CALL_REG);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
} else {
ppc_bl (code, 0);
}
Expand Down Expand Up @@ -3913,8 +3913,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
ppc_ldr (code, PPC_CALL_REG, 0, PPC_CALL_REG);
cfg->thunk_area += THUNK_SIZE;
#endif
ppc_mtlr (code, PPC_CALL_REG);
ppc_blrl (code);
ppc_mtctr (code, PPC_CALL_REG);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
} else {
ppc_bl (code, 0);
}
Expand Down Expand Up @@ -3945,9 +3945,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
}
#endif
ppc_mtlr (code, ins->sreg1);
ppc_mtctr (code, ins->sreg1);
#endif
ppc_blrl (code);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
/* FIXME: this should be handled somewhere else in the new jit */
code = emit_move_return_value (cfg, ins, code);
break;
Expand All @@ -3965,8 +3965,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
} else {
ppc_ldptr (code, ppc_r12, ins->inst_offset, ins->sreg1);
}
ppc_mtlr (code, ppc_r12);
ppc_blrl (code);
ppc_mtctr (code, ppc_r12);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
/* FIXME: this should be handled somewhere else in the new jit */
code = emit_move_return_value (cfg, ins, code);
break;
Expand Down Expand Up @@ -4022,8 +4022,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
ppc_ldr (code, PPC_CALL_REG, 0, PPC_CALL_REG);
cfg->thunk_area += THUNK_SIZE;
#endif
ppc_mtlr (code, PPC_CALL_REG);
ppc_blrl (code);
ppc_mtctr (code, PPC_CALL_REG);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
} else {
ppc_bl (code, 0);
}
Expand All @@ -4040,8 +4040,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
ppc_ldr (code, PPC_CALL_REG, 0, PPC_CALL_REG);
cfg->thunk_area += THUNK_SIZE;
#endif
ppc_mtlr (code, PPC_CALL_REG);
ppc_blrl (code);
ppc_mtctr (code, PPC_CALL_REG);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
} else {
ppc_bl (code, 0);
}
Expand Down Expand Up @@ -4725,8 +4725,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
ppc_ldr (code, PPC_CALL_REG, 0, PPC_CALL_REG);
cfg->thunk_area += THUNK_SIZE;
#endif
ppc_mtlr (code, PPC_CALL_REG);
ppc_blrl (code);
ppc_mtctr (code, PPC_CALL_REG);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
} else {
ppc_bl (code, 0);
}
Expand Down Expand Up @@ -5348,8 +5348,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
ppc_ldr (code, PPC_CALL_REG, 0, PPC_CALL_REG);
cfg->thunk_area += THUNK_SIZE;
#endif
ppc_mtlr (code, PPC_CALL_REG);
ppc_blrl (code);
ppc_mtctr (code, PPC_CALL_REG);
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
} else {
ppc_bl (code, 0);
}
Expand Down
Loading