[PPC64LE] Add PPC64LE dynarec infrastructure with MOV opcodes#3592
Draft
runlevel5 wants to merge 1 commit intoptitSeb:mainfrom
Draft
[PPC64LE] Add PPC64LE dynarec infrastructure with MOV opcodes#3592runlevel5 wants to merge 1 commit intoptitSeb:mainfrom
runlevel5 wants to merge 1 commit intoptitSeb:mainfrom
Conversation
d02e0ea to
9d67773
Compare
ptitSeb
reviewed
Feb 28, 2026
ptitSeb
reviewed
Feb 28, 2026
Owner
|
Sorry, but you'll have to update from main and add |
52308d3 to
942b062
Compare
Contributor
Author
|
@ptitSeb I have addressed all your feedbacks |
ptitSeb
reviewed
Mar 1, 2026
ptitSeb
reviewed
Mar 1, 2026
ptitSeb
reviewed
Mar 1, 2026
ptitSeb
requested changes
Mar 1, 2026
Owner
ptitSeb
left a comment
There was a problem hiding this comment.
More comments to address, sorry.
ptitSeb
reviewed
Mar 1, 2026
ptitSeb
reviewed
Mar 1, 2026
ksco
requested changes
Mar 2, 2026
Add the core dynarec infrastructure for PPC64LE, following the incremental approach used by the RV64 dynarec (initial commit 5a9b896). This includes: - PPC64LE emitter macros (ppc64le_emitter.h) - Register mapping and private types (ppc64le_mapping.h, private.h) - Dynarec helper macros (dynarec_ppc64le_helper.h) - Core helper functions: geted, move32/64, jump_to_epilog/next, call_c/call_n, grab_segdata, emit_pf, fpu_reset_cache, fpu_propagate_stack (dynarec_ppc64le_helper.c) - Architecture-specific functions: dynarec_ppc64le_arch.c - Constants table: dynarec_ppc64le_consts.c - Functions for FPU state management (stubbed for x87/SSE/AVX, following RV64 precedent of empty TODO stubs) - Stub printer (returns '???' for all instructions) - Assembly: prolog, epilog, next dispatcher, lock primitives - CMakeLists.txt integration for PPC64LE dynarec - Shared dynarec infrastructure modifications for PPC64LE support - 3 MOV opcodes in _00.c: 0x89 (MOV Ed,Gd), 0x8B (MOV Gd,Ed), 0x8D (LEA Gd,Ed) FPU/x87/MMX/SSE/AVX cache management functions are stubbed with empty bodies, matching the RV64 initial commit pattern where all FPU functions were empty TODO stubs. These will be expanded in a follow-up PR when the first FPU opcodes are implemented.
942b062 to
4093ed9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the core dynarec infrastructure for PPC64LE with 3 MOV opcodes as proof the pipeline works end-to-end. Follows the incremental approach of the RV64 dynarec initial commit (
5a9b896).Depends on #3591 (platform support PR) — please merge that first.
Changes (36 files, ~9200 lines)
Core Infrastructure
ppc64le_emitter.h): Instruction encoding macros for PPC64LE ISA. Argument order follows Power ISA assembly convention (Rt, offset, Ra) — documented in header comment.dynarec_ppc64le_helper.h/c): STEPNAME-aliased macros and core functions (geted,move32/move64,jump_to_epilog/jump_to_next,call_c/call_n,grab_segdata,emit_pf). Displacement modes use named constants (DISP_NONE/DISP_D/DISP_DQ) and magic numbers replaced withPPC64_DISP_MAX.ppc64le_mapping.h): x86-64 to PPC64LE register mapping, ELFv2 ABI-compliant.dynarec_ppc64le_functions.c/h):fpu_reset,inst_name_pass3,updateNativeFlags,get_free_scratch,ppc64le_fast_hash, plus FPU register management stubs.dynarec_ppc64le_arch.c):CancelBlock,FillBlock,AddMarkRecursive, native address resolution, jump table support.dynarec_ppc64le_consts.c/h): Constants table management (unused arrays removed per review).Assembly
ppc64le_prolog.S/ppc64le_epilog.S: Dynarec entry/exit.ppc64le_next.S: Block-to-block dispatcher.ppc64le_lock.S/h: Atomic operations (LL/SC pairs, mutex-based 128-bit CAS).Opcodes (3 MOV instructions in
_00.c)0x89— MOV Ed,Gd0x8B— MOV Gd,Ed0x8D— LEA Gd,EdStubs
_66.c,_f0.c,_66f0.ccontain only DEFAULT fallback.Shared Dynarec Modifications
CMakeLists.txt,dynarec_native_pass.c,dynarec_arch.h,dynarec_helper.h,dynarec_next.h,native_lock.h,dynacache_reloc.h,dynarec.c: PPC64LE#elifbranches.Review Changes
dynarec_ppc64le_arch.hand WIN32 guard (ptitSeb)dynarec_ppc64le_consts.c(ptitSeb)DQ_ALIGNtoDISP_NONE/DISP_D/DISP_DQnamed constants (ptitSeb)PPC64_DISP_MAXconstant (ptitSeb)GOCONDmacro (~80 lines) (ptitSeb)x87_get_st_emptymacro bug, removed duplicatedynarec64_F0(self-audit)BEQZ_safealias no longer needed after GOCOND removalNotes on Reviewer Feedback
Re: unused macros in helper.h (ksco): Most macros in
dynarec_ppc64le_helper.hare required by the shareddynarec_native_pass.cor are building blocks used by other macros. The genuinely unused items (GOCOND, duplicate dynarec64_F0) have been removed.Re: unused functions in functions.c (ksco): All 19 public functions are called from shared dynarec infrastructure (
dynarec_native.c,dynarec_native_pass.c,dynarec_native_functions.c,dynarec.c). None can be removed without breaking compilation.Re: ALSL/BSTRPICK_D/BSTRINS_D names (ksco): These LoongArch names do not exist in the PPC64LE code. The PPC equivalents are already named
SLADDy,BF_EXTRACT, andBF_INSERT.Re: AVX 256-bit (ksco): PPC64LE has 128-bit VSX only. The AVX macros are shared infrastructure stubs required by
dynarec_native_pass.c— they don't imply 256-bit support.Related
5a9b896