M68K: Fix fmove.x 96-bit extended immediate decode length and printing - #3016
Merged
Conversation
Collaborator
|
Please add a PR description. What does the signing have to do with the bug? |
Rot127
requested changes
Aug 12, 2026
Rot127
requested changes
Aug 26, 2026
Rot127
left a comment
Collaborator
There was a problem hiding this comment.
Add a note in the v6 guide please.
Rot127
requested changes
Aug 29, 2026
Rot127
approved these changes
Aug 30, 2026
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.
Your checklist for this pull request
Detailed description
Summary
M68K
fmove.xandfmove.pinline immediates use 12-byte Motorola external operands. The decoder now consumes all 12 operand bytes, preserves the complete representation in dedicated lossless detail types, and prints useful assembly text. Packed register-to-memory moves also expose and print their static or dynamic k-factor.References
Motorola MC68881/MC68882 Floating-Point Coprocessor User's Manual, first edition (1987):
https://www.bitsavers.org/components/motorola/68000/68020/MC68881_MC68882_Floating-Point_Coprocessor_Users_Manual_1ed_1987.pdf
.x/.poperand sizeFMOVEdescription, pages 4-64 through 4-67, and Section 4.7.1.4/Table 4-16: packed register-to-memory conversion uses a signed 7-bit static k-factor or a data-register-supplied dynamic k-factor.External representations
An extended immediate is retained as:
sign_exp: mantissa sign in bit 15 and the 15-bit biased exponent in bits 14-0reserved: the external format's complete reserved wordsignificand: the explicit integer bit followed by 63 fraction bitsA packed-decimal immediate is retained as a high 32-bit
headerand low 64-bitfraction. Together they preserve the manual's complete layout:SM, mantissa signSE, exponent signy, used withSEfor infinity and NaN encodingsEXP2:EXP0, the three packed-BCD exponent digitsEXP3, generated on an overflowing move out; onlyEXP2:EXP0are used on inputMANT16, the integer mantissa digitMANT15:MANT0, the sixteen packed-BCD fractional digitsFor packed register-to-memory moves, the manual defines the k-factor as follows:
-64through0select the number of significant digits to the right of the decimal point (FortranFformat).+1through+17select the number of significant mantissa digits (FortranEformat).+18through+63setOPERRand are treated as+17by the coprocessor.rrr0000selectsD0throughD7; the register's low seven bits contain the signed k-factor and its upper 25 bits are ignored.Changes
fmove.xandfmove.psources, rejecting truncated encodings instead of consuming sentinel data.M68K_OP_FP_EXTENDEDwithfp_extendedandM68K_OP_FP_PACKEDwithfp_packed, so detail consumers receive the complete external representation without rounding or discarding reserved bits.M68K_FPU_SIZE_PACKEDto distinguish.pfrom.x, even though both external operands are 12 bytes..ximmediates in GNU-compatible#0e...form.extended_to_double()supplies a binary64 approximation only for this assembly-text%gpath; the detail operand remains exact and is never stored indimm..pimmediates directly from their packed-BCD digits, including signed zero, infinity, NaN, and deterministic invalid-BCD text, without a floating-point approximation..xand.psources asM68K_OP_MEM; only inline#...values use the new value operand types.{#k}/{dn}, and include the dynamic register in register-access details..xtext, special values, packed BCD, memory operands, and both k-factor forms.cstool -doutput.Result
For both immediate formats, the instruction is 16 bytes total: the F-line word, command word, and complete 12-byte external operand. Subsequent instructions therefore begin at the correct offset. Detail clients receive lossless
.x/.pdata, while disassembly remains human-readable.Closing issues
closes #3013