[all-commits] [llvm/llvm-project] a33fca: [RISCV] Pass 'half' in the lower 16 bits of an f32...
Craig Topper via All-commits
all-commits at lists.llvm.org
Tue Mar 30 09:48:22 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a33fcafaf0493fe30106be099070a96d10882e9d
https://github.com/llvm/llvm-project/commit/a33fcafaf0493fe30106be099070a96d10882e9d
Author: Craig Topper <craig.topper at sifive.com>
Date: 2021-03-30 (Tue, 30 Mar 2021)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
A llvm/test/CodeGen/RISCV/calling-conv-half.ll
M llvm/test/CodeGen/RISCV/copysign-casts.ll
Log Message:
-----------
[RISCV] Pass 'half' in the lower 16 bits of an f32 value when F extension is enabled, but Zfh is not.
Without Zfh the half type isn't legal, but it could still be
used as an argument/return in IR. Clang will not generate this today.
Previously we promoted the half value to float for arguments and
returns if the F extension is enabled but Zfh isn't. Then depending on
which ABI is enabled we would pass it in either an FPR or a GPR in
float format.
If the F extension isn't enabled, it would get passed in the lower
16 bits of a GPR in half format.
With this patch the value will always in half format and will be
in the lower bits of a GPR or FPR. This should be consistent
with where the bits are located when Zfh is enabled.
I've based this implementation off of how this is done on ARM.
I've manually nan-boxed the value to 32 bits using integer ops.
It looks like flw, fsw, fmv.s, fmv.w.x, fmf.x.w won't
canonicalize nans so should leave the value alone. I think those
are the instructions that could get used on this value.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D98670
More information about the All-commits
mailing list