From: Xi Ruoyao <xry111@xry111.site>
To: David Laight <David.Laight@ACULAB.COM>,
'Huacai Chen' <chenhuacai@loongson.cn>,
Arnd Bergmann <arnd@arndb.de>,
Huacai Chen <chenhuacai@kernel.org>
Cc: "loongarch@lists.linux.dev" <loongarch@lists.linux.dev>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
Xuefeng Li <lixuefeng@loongson.cn>, Guo Ren <guoren@kernel.org>,
Xuerui Wang <kernel@xen0n.name>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3] LoongArch: Add unaligned access support
Date: Mon, 17 Oct 2022 22:19:59 +0800 [thread overview]
Message-ID: <b31086df86febba62f76ff9ec775b7a6e16c1933.camel@xry111.site> (raw)
In-Reply-To: <39ea2a6fee654b68974ef38237a61e80@AcuMS.aculab.com>
On Mon, 2022-10-17 at 13:11 +0000, David Laight wrote:
> From: Huacai Chen
> > Sent: 17 October 2022 13:52
> >
> > Loongson-2 series (Loongson-2K500, Loongson-2K1000) don't support
> > unaligned access in hardware, while Loongson-3 series (Loongson-3A5000,
> > Loongson-3C5000) are configurable whether support unaligned access in
> > hardware. This patch add unaligned access emulation for those LoongArch
> > processors without hardware support.
> >
> .....
> > + } else if (insn.reg2i12_format.opcode == fstd_op ||
> > + insn.reg3_format.opcode == fstxd_op) {
> > + value = read_fpr(insn.reg2i12_format.rd);
> > + res = unaligned_write(addr, value, 8);
> > + if (res)
> > + goto fault;
> > + } else if (insn.reg2i12_format.opcode == fsts_op ||
> > + insn.reg3_format.opcode == fstxs_op) {
> > + value = read_fpr(insn.reg2i12_format.rd);
> > + res = unaligned_write(addr, value, 4);
> > + if (res)
> > + goto fault;
>
> Are those right?
> Shouldn't something be converting from 'double' to
> 'float' in there?
> And generating SIGFPE (?) if the exponent is out of range.
To me it looks right.
The semantic of FST.S does not include conversion. It just stores the
lower 32 bits of a floating-point register into the memory. If someone
attempts to use FST.S to convert a double into a float, it's a
programming error.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
next prev parent reply other threads:[~2022-10-17 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 12:52 [PATCH V3] LoongArch: Add unaligned access support Huacai Chen
2022-10-17 13:11 ` David Laight
2022-10-17 14:19 ` Xi Ruoyao [this message]
2022-10-18 1:59 ` Huacai Chen
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=b31086df86febba62f76ff9ec775b7a6e16c1933.camel@xry111.site \
--to=xry111@xry111.site \
--cc=David.Laight@ACULAB.COM \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=guoren@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=loongarch@lists.linux.dev \
/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