[RISCV] Use AdjustInstrPostInstrSelection to insert a FRM dependency for scalar FP...
authorCraig Topper <craig.topper@sifive.com>
Tue, 14 Dec 2021 17:54:24 +0000 (09:54 -0800)
committerCraig Topper <craig.topper@sifive.com>
Tue, 14 Dec 2021 18:17:57 +0000 (10:17 -0800)
commit3f1c403a2b0a60198aee1c69ee2be7c0aa3a70e8
treea5ac66f1ecb070578406f647ec8bf68b48e23ba8
parent1042de90589c74c6998c127d1ee1b33ff3efb8cc
[RISCV] Use AdjustInstrPostInstrSelection to insert a FRM dependency for scalar FP instructions with dynamic rounding mode.

In order to support constrained FP intrinsics we need to model FRM
dependency. Whether or not a instruction uses FRM is based on a 3
bit field in the instruction. Because of this we can't add
'Uses = [FRM]' to the tablegen descriptions.

This patch examines the immediate after isel and adds an implicit
use of FRM. This idea came from Roger Ferrer Ibanez.

Other ideas:
We could be overly conservative and just pretend all instructions with
frm field read the FRM register. Or we could have pseudoinstructions
for CodeGen with rounding mode.

Reviewed By: asb, frasercrmck, arcbbb

Differential Revision: https://reviews.llvm.org/D115555
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/lib/Target/RISCV/RISCVInstrFormats.td
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.h
llvm/lib/Target/RISCV/RISCVInstrInfoF.td
llvm/test/CodeGen/RISCV/frm-dependency.ll [new file with mode: 0644]