[RISCV] Print Zfa fli instruction FP values in a more adaptive way.
authorCraig Topper <craig.topper@sifive.com>
Fri, 10 Mar 2023 15:57:44 +0000 (07:57 -0800)
committerCraig Topper <craig.topper@sifive.com>
Fri, 10 Mar 2023 15:57:44 +0000 (07:57 -0800)
commitc2bcb21cc6be5dabaadd3bc2ecc5df98ab77b59e
tree66447fa6593852e6b9eeaeeb4f467f8d827e31b6
parentcddc1b6b278399ea453903037f70e2cab356ead1
[RISCV] Print Zfa fli instruction FP values in a more adaptive way.

Previously, we printed all constants in scientific notation with
6 digits of precision. This is not enough to accurately display
the smallest value, but increasing the precision would be too much
for other values.

This patch prints values with fractional bits using only as many digits as
needed. 1*2^-15 and 1*2^-16 will be printed in scientific notation while
the others are printed without scientific notation. The integer values
are printed with a single 0 after the decimal point.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D145645
llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
llvm/test/CodeGen/RISCV/double-zfa.ll
llvm/test/CodeGen/RISCV/float-zfa.ll
llvm/test/CodeGen/RISCV/half-zfa-fli.ll
llvm/test/MC/RISCV/zfa-valid.s