diff options
Diffstat (limited to 'riscV/RTLpathSE_simplify.v')
-rw-r--r-- | riscV/RTLpathSE_simplify.v | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/riscV/RTLpathSE_simplify.v b/riscV/RTLpathSE_simplify.v index f17dfe7d..f1f44331 100644 --- a/riscV/RTLpathSE_simplify.v +++ b/riscV/RTLpathSE_simplify.v @@ -373,14 +373,14 @@ Definition target_cbranch_expanse (prev: hsistate_local) (cond: condition) (args let hv2 := fsi_sreg_get prev a2 in let lhsv := make_lhsv_cmp is_inv hv1 hv2 in Some (cond, lhsv)*) - (*| (Ccompu c), (a1 :: a2 :: nil) => + | (Ccompu c), (a1 :: a2 :: nil) => let is_inv := is_inv_cmp_int c in let cond := transl_cbranch_int32u c (make_optR0 false is_inv) in let hv1 := fsi_sreg_get prev a1 in let hv2 := fsi_sreg_get prev a2 in let lhsv := make_lhsv_cmp is_inv hv1 hv2 in Some (cond, lhsv) - | (Ccompimm c n), (a1 :: nil) => + (*| (Ccompimm c n), (a1 :: nil) => let is_inv := is_inv_cmp_int c in let hv1 := fsi_sreg_get prev a1 in (if Int.eq n Int.zero then @@ -388,7 +388,7 @@ Definition target_cbranch_expanse (prev: hsistate_local) (cond: condition) (args let cond := transl_cbranch_int32s c (make_optR0 true is_inv) in Some (cond, lhsv) else - let hvs := loadimm32 n in + let hvs := loadimm32 hv1 n false in let lhsv := make_lhsv_cmp is_inv hv1 hvs in let cond := transl_cbranch_int32s c (make_optR0 false is_inv) in Some (cond, lhsv)) @@ -400,7 +400,7 @@ Definition target_cbranch_expanse (prev: hsistate_local) (cond: condition) (args let cond := transl_cbranch_int32u c (make_optR0 true is_inv) in Some (cond, lhsv) else - let hvs := loadimm32 n in + let hvs := loadimm32 hv1 n false in let lhsv := make_lhsv_cmp is_inv hv1 hvs in let cond := transl_cbranch_int32u c (make_optR0 false is_inv) in Some (cond, lhsv)) @@ -426,7 +426,7 @@ Definition target_cbranch_expanse (prev: hsistate_local) (cond: condition) (args let cond := transl_cbranch_int64s c (make_optR0 true is_inv) in Some (cond, lhsv) else - let hvs := loadimm64 n in + let hvs := loadimm64 hv1 n in let lhsv := make_lhsv_cmp is_inv hv1 hvs in let cond := transl_cbranch_int64s c (make_optR0 false is_inv) in Some (cond, lhsv)) @@ -438,7 +438,7 @@ Definition target_cbranch_expanse (prev: hsistate_local) (cond: condition) (args let cond := transl_cbranch_int64u c (make_optR0 true is_inv) in Some (cond, lhsv) else - let hvs := loadimm64 n in + let hvs := loadimm64 hv1 n in let lhsv := make_lhsv_cmp is_inv hv1 hvs in let cond := transl_cbranch_int64u c (make_optR0 false is_inv) in Some (cond, lhsv)) @@ -465,7 +465,7 @@ Definition target_cbranch_expanse (prev: hsistate_local) (cond: condition) (args let hv2 := fsi_sreg_get prev f2 in let is_inv := is_inv_cmp_float c in let lhsv := make_lhsv_cmp is_inv hv1 hv2 in - expanse_cbranch_fp true cond_single c lhsv*) + expanse_cbranch_fp true cond_single c lhsv*) | _, _ => None end. @@ -1245,15 +1245,20 @@ Proof. (*unfold target_cbranch_expanse, seval_condition; simpl. intros H (LREF & SREF & SREG & SMEM) ?. destruct c; try congruence. - all: - repeat (destruct l; simpl in H; try congruence); - destruct c; inv H; simpl; - erewrite !fsi_sreg_get_correct; eauto; + repeat (destruct l; simpl in H; try congruence). + inv H; simpl. + try erewrite !fsi_sreg_get_correct; eauto. + + - simpl. + destruct c; inv H; simpl. + try erewrite !fsi_sreg_get_correct; eauto; try (destruct (seval_sval ge sp (si_sreg st r) rs0 m0) eqn:OKv1; try congruence); try (destruct (seval_sval ge sp (si_sreg st r0) rs0 m0) eqn:OKv2; try congruence); try (destruct (seval_smem ge sp (si_smem st) rs0 m0) eqn:OKmem; try congruence). + try destruct (Int.eq n Int.zero) eqn: EQIMM; + try apply Int.same_if_eq in EQIMM; all: try replace (Cle) with (swap_comparison Cge) by auto; try replace (Clt) with (swap_comparison Cgt) by auto; |