riscv64: Implement fcmp in ISLE (#5512)

Rework the compilation of fcmp in the riscv64 backend to be in ISLE, removing the need for the dedicated Fcmp instruction. This change is motivated by #5500, which showed that the riscv64 backend was generating branch instructions in the middle of a basic block.

We can't remove lower_br_fcmp quite yet as it's used in a few places in the emit module, but it's now no longer reachable from the ISLE lowerings.

Fixes #5500
This commit is contained in:
Trevor Elliott
2023-01-04 11:52:00 -08:00
committed by GitHub
parent d1920f5a2d
commit b2d5afdf83
7 changed files with 202 additions and 113 deletions

View File

@@ -752,18 +752,10 @@
(lower (icmp cc x @ (value_type ty) y))
(lower_icmp cc x y ty))
(decl gen_fcmp (FloatCC Value Value Type) Reg)
(rule
(gen_fcmp cc x y ty)
(let
((result WritableReg (temp_writable_reg $I64))
(_ Unit (emit (MInst.Fcmp cc result x y ty))))
(writable_reg_to_reg result)))
;;;;; Rules for `fcmp`;;;;;;;;;
(rule
(lower (fcmp cc x @ (value_type ty) y))
(gen_fcmp cc x y ty))
(cmp_value (emit_fcmp cc ty x y)))
;;;;; Rules for `func_addr`;;;;;;;;;
(rule