From: Richard Henderson <richard.henderson@linaro.org>
To: "Akihiko Odaki" <akihiko.odaki@daynix.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 7/7] tests/tcg/arm: Manually bit-cast half-precision numbers
Date: Sat, 29 Jun 2024 09:21:40 -0700 [thread overview]
Message-ID: <eb2c8141-4b16-43bb-94ba-698e3d937eff@linaro.org> (raw)
In-Reply-To: <20240629-tcg-v3-7-fa57918bdf09@daynix.com>
On 6/29/24 01:56, Akihiko Odaki wrote:
> clang version 18.1.6 does not allow specifying an integer as the value
> of a single-precision register. Manually bit-cast into float with vmov
> first.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> tests/tcg/arm/fcvt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/tcg/arm/fcvt.c b/tests/tcg/arm/fcvt.c
> index f631197287a1..5263f607b59c 100644
> --- a/tests/tcg/arm/fcvt.c
> +++ b/tests/tcg/arm/fcvt.c
> @@ -355,7 +355,9 @@ static void convert_half_to_single(void)
>
> print_half_number(i, input);
> #if defined(__arm__)
> - asm("vcvtb.f32.f16 %0, %1" : "=w" (output) : "x" ((uint32_t)input));
> + float tmp;
> + asm("vmov %0, %1" : "=w" (tmp) : "r" (input));
> + asm("vcvtb.f32.f16 %0, %1" : "=w" (output) : "x" (tmp));
> #else
> asm("fcvt %s0, %h1" : "=w" (output) : "w" (input));
> #endif
Better as
#if defined(__arm__)
- asm("vcvtb.f32.f16 %0, %1" : "=w" (output) : "x" ((uint32_t)input));
+ /*
+ * Clang refuses to allocate an integer to a fp register.
+ * Perform the move from a general register by hand.
+ */
+ asm("vmov %0, %1\n\t"
+ "vcvtb.f32.f16 %0, %0" : "=w" (output) : "r" (input));
#else
without the C temporary. With that,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
prev parent reply other threads:[~2024-06-29 16:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-29 8:56 [PATCH v3 0/7] tests/tcg/aarch64: Fix inline assemblies for clang Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 1/7] tests/tcg/aarch64: Use -fno-integrated-as Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 2/7] tests/tcg/aarch64: Specify -Wa,-march=armv9-a+sme Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 3/7] tests/tcg/aarch64: Fix test architecture specification Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 4/7] tests/tcg/aarch64: Explicitly specify register width Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 5/7] tests/tcg/aarch64: Fix irg operand type Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 6/7] tests/tcg/aarch64: Do not use x constraint Akihiko Odaki
2024-06-29 8:56 ` [PATCH v3 7/7] tests/tcg/arm: Manually bit-cast half-precision numbers Akihiko Odaki
2024-06-29 16:21 ` Richard Henderson [this message]
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=eb2c8141-4b16-43bb-94ba-698e3d937eff@linaro.org \
--to=richard.henderson@linaro.org \
--cc=akihiko.odaki@daynix.com \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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).