qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org,  laurent@vivier.eu
Subject: Re: [PATCH v5 21/24] target/m68k: Implement packed decimal real loads and stores
Date: Sat, 10 May 2025 18:36:26 +0200	[thread overview]
Message-ID: <875xi8zalx.fsf@igel.home> (raw)
In-Reply-To: <20250507211300.9735-22-richard.henderson@linaro.org> (Richard Henderson's message of "Wed, 7 May 2025 14:12:56 -0700")

On Mai 07 2025, Richard Henderson wrote:

> +    /* Convert the 3 digit decimal exponent to binary. */
> +    exp = ((hi >> 24) & 0xf)
> +        + ((hi >> 20) & 0xf) * 10
> +        + ((hi >> 16) & 0xf) * 100;

This is backwards.  An exponent of 123 is stored as 0x01230000, not
0x03210000.

> +    for (int i = 24; exp10; i -= 4, exp10 /= 10) {
> +        res_hi |= (exp10 % 10) << i;

Again, this is backwards.  Also, the decimal exponent of an extended
precision number can be as big as 4951.  From the fpsp040:

| A15. Convert the exponent to bcd.
|      As in A14 above, the exp is converted to bcd and the
|      digits are stored in the final string.
|
|      Digits are stored in L_SCR1(a6) on return from BINDEC as:
|
|	 32               16 15                0
|	-----------------------------------------
|	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
|	-----------------------------------------

That is, the fourth digit of the exponent is stored in the upper 4 bits
of the padding (OPERR is set if e4 is non-zero).

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


  reply	other threads:[~2025-05-10 16:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 21:12 [PATCH v5 00/24] target/m68k: fpu improvements Richard Henderson
2025-05-07 21:12 ` [PATCH v5 01/24] target/m68k: Add FPSR exception bit defines Richard Henderson
2025-05-07 21:12 ` [PATCH v5 02/24] target/m68k: Restore fp rounding mode on vm load Richard Henderson
2025-05-07 21:12 ` [PATCH v5 03/24] target/m68k: Keep FPSR up-to-date Richard Henderson
2025-05-07 21:12 ` [PATCH v5 04/24] target/m68k: Update FPSR.EXC Richard Henderson
2025-05-07 21:12 ` [PATCH v5 05/24] target/m68k: Update FPSR for FMOVECR Richard Henderson
2025-05-07 21:12 ` [PATCH v5 06/24] target/m68k: Introduce M68K_FEATURE_FPU_PACKED_DECIMAL Richard Henderson
2025-05-07 21:12 ` [PATCH v5 07/24] target/m68k: Merge gen_ea into SRC_EA and DEST_EA Richard Henderson
2025-05-07 21:12 ` [PATCH v5 08/24] target/m68k: Use g_assert_not_reached in gen_lea_mode and gen_ea_mode Richard Henderson
2025-05-07 21:12 ` [PATCH v5 09/24] target/m68k: Use OS_UNSIZED in LEA, PEA, JMP Richard Henderson
2025-05-07 21:12 ` [PATCH v5 10/24] target/m68k: Move pre-dec/post-inc to gen_lea_mode Richard Henderson
2025-05-07 21:12 ` [PATCH v5 11/24] target/m68k: Split gen_ea_mode for load/store Richard Henderson
2025-05-07 21:12 ` [PATCH v5 12/24] target/m68k: Remove env argument to gen_lea_indexed Richard Henderson
2025-05-07 21:12 ` [PATCH v5 13/24] target/m68k: Remove env argument to gen_lea_mode Richard Henderson
2025-05-07 21:12 ` [PATCH v5 14/24] target/m68k: Remove env argument to gen_load_mode Richard Henderson
2025-05-07 21:12 ` [PATCH v5 15/24] target/m68k: Remove env argument to gen_store_mode Richard Henderson
2025-05-07 21:12 ` [PATCH v5 16/24] target/m68k: Remove env argument to gen_ea_mode_fp Richard Henderson
2025-05-07 21:12 ` [PATCH v5 17/24] target/m68k: Split gen_ea_mode_fp for load/store Richard Henderson
2025-05-07 21:12 ` [PATCH v5 18/24] target/m68k: Move gen_addr_fault into gen_{load, store}_mode_fp Richard Henderson
2025-05-07 21:12 ` [PATCH v5 19/24] target/m68k: Merge gen_load_fp, gen_load_mode_fp Richard Henderson
2025-05-07 21:12 ` [PATCH v5 20/24] target/m68k: Merge gen_store_fp, gen_store_mode_fp Richard Henderson
2025-05-07 21:12 ` [PATCH v5 21/24] target/m68k: Implement packed decimal real loads and stores Richard Henderson
2025-05-10 16:36   ` Andreas Schwab [this message]
2025-05-11 17:20     ` Richard Henderson
2025-05-07 21:12 ` [PATCH v5 22/24] tests/tcg/m68k: Add packed decimal tests Richard Henderson
2025-05-07 21:12 ` [PATCH v5 23/24] target/m68k: Make vmstate variables static Richard Henderson
2025-05-07 21:12 ` [PATCH v5 24/24] target/m68k: Implement FPIAR Richard Henderson
2025-05-07 21:28 ` [PATCH v5 00/24] target/m68k: fpu improvements Helge Deller
2025-05-08 21:39   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xi8zalx.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).