fix codegen riscv64 normalize_cmp_value. (#5873)

* fix issue5839

* add target.

* fix normalize_cmp_value.

* fix test failutre.

* fix test failure.

* fix parameter type.

* Update cranelift/codegen/src/isa/riscv64/inst.isle

Co-authored-by: Jamey Sharp <jamey@minilop.net>

* Update cranelift/codegen/src/isa/riscv64/lower.isle

Co-authored-by: Jamey Sharp <jamey@minilop.net>

* remove convert rule from IntCC to ExtendOp

---------

Co-authored-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
yuyang
2023-03-01 07:00:23 +08:00
committed by GitHub
parent 0e9a48afd5
commit 32cfd60877
9 changed files with 109 additions and 66 deletions

View File

@@ -626,12 +626,12 @@
;;;;; Rules for `select`;;;;;;;;;
(rule
(lower (has_type ty (select c @ (value_type cty) x y)))
(gen_select ty (truthy_to_reg cty (normalize_cmp_value cty c)) x y))
(gen_select ty (truthy_to_reg cty (normalize_cmp_value cty c (ExtendOp.Zero))) x y))
(rule 1
(lower (has_type (fits_in_64 ty) (select (icmp cc a b @ (value_type in_ty)) x y)))
(let ((a Reg (normalize_cmp_value in_ty a))
(b Reg (normalize_cmp_value in_ty b)))
(let ((a Reg (normalize_cmp_value in_ty a (intcc_to_extend_op cc)))
(b Reg (normalize_cmp_value in_ty b (intcc_to_extend_op cc))))
(gen_select_reg cc a b x y)))
;;;;; Rules for `bitselect`;;;;;;;;;
@@ -851,7 +851,7 @@
(rule -1
(lower (has_type ty (select_spectre_guard c @ (value_type cty) x y)))
(gen_select ty (truthy_to_reg cty (normalize_cmp_value cty c)) x y))
(gen_select ty (truthy_to_reg cty (normalize_cmp_value cty c (ExtendOp.Zero))) x y))
;;;;; Rules for `bmask`;;;;;;;;;
(rule