Skip to content

Commit

Permalink
riscv64: Mark fcmp as already extended (bytecodealliance#7151)
Browse files Browse the repository at this point in the history
  • Loading branch information
afonso360 authored Oct 4, 2023
1 parent 7ef5094 commit 946c21d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cranelift/codegen/src/isa/riscv64/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -2154,9 +2154,10 @@
(rule 1 (val_already_extended (uextend _)) $true)
(rule 1 (val_already_extended (sextend _)) $true)

;; The result of `icmp` is zero or one, meaning that it's already sign extended
;; to the full register width.
;; The result of `icmp`/`fcmp` is zero or one, meaning that it's already sign
;; extended to the full register width.
(rule 1 (val_already_extended (icmp _ _ _)) $true)
(rule 1 (val_already_extended (fcmp _ _ _)) $true)

(type ExtendOp
(enum
Expand Down
18 changes: 18 additions & 0 deletions cranelift/filetests/filetests/isa/riscv64/extend.clif
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,21 @@ block0(v0: i8, v1: i64):
; add a0, a0, a1
; ret


function %extend_fcmp(f64, f64) -> i64 {
block0(v0: f64, v1: f64):
v3 = fcmp.f64 lt v0, v1
v4 = sextend.i64 v3
return v4
}

; VCode:
; block0:
; flt.d a0,fa0,fa1
; ret
;
; Disassembled:
; block0: ; offset 0x0
; flt.d a0, fa0, fa1
; ret

0 comments on commit 946c21d

Please sign in to comment.