Skip to content

Commit 3d97c3e

Browse files
authored
Merge pull request #2153 from chihminchao/enhance-zve
Enhance zve
2 parents 59c1f33 + b59f916 commit 3d97c3e

22 files changed

+55
-28
lines changed

riscv/csrs.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ bool misa_csr_t::unlogged_write(const reg_t val) noexcept {
736736
const bool prev_h = old_misa & (1L << ('H' - 'A'));
737737
const reg_t new_misa = (adjusted_val & write_mask) | (old_misa & ~write_mask);
738738
const bool new_h = new_misa & (1L << ('H' - 'A'));
739+
const bool new_v = proc->get_isa().has_any_vector();
739740

740741
proc->set_extension_enable(EXT_ZCA, (new_misa & (1L << ('C' - 'A'))) || !proc->get_isa().extension_enabled('C'));
741742
proc->set_extension_enable(EXT_ZCF, (new_misa & (1L << ('F' - 'A'))) && proc->extension_enabled(EXT_ZCA) && proc->get_xlen() == 32);
@@ -745,8 +746,8 @@ bool misa_csr_t::unlogged_write(const reg_t val) noexcept {
745746
proc->set_extension_enable(EXT_ZCMT, proc->extension_enabled(EXT_ZCA));
746747
proc->set_extension_enable(EXT_ZFH, new_misa & (1L << ('F' - 'A')));
747748
proc->set_extension_enable(EXT_ZFHMIN, new_misa & (1L << ('F' - 'A')));
748-
proc->set_extension_enable(EXT_ZVFH, (new_misa & (1L << ('V' - 'A'))) && proc->extension_enabled(EXT_ZFHMIN));
749-
proc->set_extension_enable(EXT_ZVFHMIN, new_misa & (1L << ('V' - 'A')));
749+
proc->set_extension_enable(EXT_ZVFH, new_v && proc->get_isa().get_zvf() && proc->extension_enabled(EXT_ZFHMIN));
750+
proc->set_extension_enable(EXT_ZVFHMIN, new_v && proc->get_isa().get_zvf());
750751
proc->set_extension_enable(EXT_ZAAMO, (new_misa & (1L << ('A' - 'A'))) || !proc->get_isa().extension_enabled('A'));
751752
proc->set_extension_enable(EXT_ZALRSC, (new_misa & (1L << ('A' - 'A'))) || !proc->get_isa().extension_enabled('A'));
752753
proc->set_extension_enable(EXT_ZBA, (new_misa & (1L << ('B' - 'A'))) || !proc->get_isa().extension_enabled('B'));

riscv/insns/vfncvt_f_x_w.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
VI_NON_ALTFMT_INSN
33

44
VI_VFP_NCVT_INT_TO_FP(
5-
{ vd = i32_to_f16(vs2); }, // BODY32
6-
{ vd = i64_to_f32(vs2); }, // BODY64
7-
{ require_extension(EXT_ZVFH); }, // CHECK32
8-
{ require_extension('F'); }, // CHECK64
9-
int // sign
5+
{ vd = i32_to_f16(vs2); }, // BODY32
6+
{ vd = i64_to_f32(vs2); }, // BODY64
7+
{ require_extension(EXT_ZVFH); }, // CHECK32
8+
{ require(p->get_isa().get_zvf()); }, // CHECK64
9+
int // sign
1010
)

riscv/insns/vfncvt_f_xu_w.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
VI_NON_ALTFMT_INSN
33

44
VI_VFP_NCVT_INT_TO_FP(
5-
{ vd = ui32_to_f16(vs2); }, // BODY32
6-
{ vd = ui64_to_f32(vs2); }, // BODY64
7-
{ require_extension(EXT_ZVFH); }, // CHECK32
8-
{ require_extension('F'); }, // CHECK64
9-
uint // sign
5+
{ vd = ui32_to_f16(vs2); }, // BODY32
6+
{ vd = ui64_to_f32(vs2); }, // BODY64
7+
{ require_extension(EXT_ZVFH); }, // CHECK32
8+
{ require(p->get_isa().get_zvf()); }, // CHECK64
9+
uint // sign
1010
)

riscv/insns/vfncvt_rtz_x_f_w.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ VI_VFP_NCVT_FP_TO_INT(
66
{ vd = f32_to_i16(vs2, softfloat_round_minMag, true); }, // BODY32
77
{ vd = f64_to_i32(vs2, softfloat_round_minMag, true); }, // BODY64
88
{ require_zvfbfa_or_zvfh; }, // CHECK16
9-
{ require(p->extension_enabled('F')); }, // CHECK32
10-
{ require(p->extension_enabled('D')); }, // CHECK64
9+
{ require(p->get_isa().get_zvf()); }, // CHECK32
10+
{ require(p->get_isa().get_zvd()); }, // CHECK64
1111
int // sign
1212
)

riscv/insns/vfncvt_rtz_xu_f_w.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ VI_VFP_NCVT_FP_TO_INT(
66
{ vd = f32_to_ui16(vs2, softfloat_round_minMag, true); }, // BODY32
77
{ vd = f64_to_ui32(vs2, softfloat_round_minMag, true); }, // BODY64
88
{ require_zvfbfa_or_zvfh; }, // CHECK16
9-
{ require(p->extension_enabled('F')); }, // CHECK32
10-
{ require(p->extension_enabled('D')); }, // CHECK64
9+
{ require(p->get_isa().get_zvf()); }, // CHECK32
10+
{ require(p->get_isa().get_zvd()); }, // CHECK64
1111
uint // sign
1212
)

riscv/insns/vfncvt_x_f_w.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ VI_VFP_NCVT_FP_TO_INT(
66
{ vd = f32_to_i16(vs2, softfloat_roundingMode, true); }, // BODY32
77
{ vd = f64_to_i32(vs2, softfloat_roundingMode, true); }, // BODY64
88
{ require_zvfbfa_or_zvfh; }, // CHECK16
9-
{ require(p->extension_enabled('F')); }, // CHECK32
10-
{ require(p->extension_enabled('D')); }, // CHECK64
9+
{ require(p->get_isa().get_zvf()); }, // CHECK32
10+
{ require(p->get_isa().get_zvd()); }, // CHECK64
1111
int // sign
1212
)

riscv/insns/vfncvt_xu_f_w.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ VI_VFP_NCVT_FP_TO_INT(
66
{ vd = f32_to_ui16(vs2, softfloat_roundingMode, true); }, // BODY32
77
{ vd = f64_to_ui32(vs2, softfloat_roundingMode, true); }, // BODY64
88
{ require_zvfbfa_or_zvfh; }, // CHECK16
9-
{ require(p->extension_enabled('F')); }, // CHECK32
10-
{ require(p->extension_enabled('D')); }, // CHECK64
9+
{ require(p->get_isa().get_zvf()); }, // CHECK32
10+
{ require(p->get_isa().get_zvd()); }, // CHECK64
1111
uint // sign
1212
)

riscv/insns/vfwcvt_f_x_v.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VI_VFP_WCVT_INT_TO_FP(
55
{ vd = i32_to_f32(vs2); }, // BODY16
66
{ vd = i32_to_f64(vs2); }, // BODY32
77
{ require_zvfbfa_or_zvfh; }, // CHECK8
8-
{ require_extension('F'); }, // CHECK16
9-
{ require_extension('D'); }, // CHECK32
8+
{ require(p->get_isa().get_zvf()); }, // CHECK64
9+
{ require(p->get_isa().get_zvd()); }, // CHECK64
1010
int // sign
1111
)

riscv/insns/vfwcvt_f_xu_v.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VI_VFP_WCVT_INT_TO_FP(
55
{ vd = ui32_to_f32(vs2); }, // BODY16
66
{ vd = ui32_to_f64(vs2); }, // BODY32
77
{ require_zvfbfa_or_zvfh; }, // CHECK8
8-
{ require_extension('F'); }, // CHECK16
9-
{ require_extension('D'); }, // CHECK32
8+
{ require(p->get_isa().get_zvf()); }, // CHECK32
9+
{ require(p->get_isa().get_zvd()); }, // CHECK64
1010
uint // sign
1111
)

riscv/insns/vfwcvt_rtz_x_f_v.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ VI_VFP_WCVT_FP_TO_INT(
55
{ vd = f16_to_i32(vs2, softfloat_round_minMag, true); }, // BODY16
66
{ vd = f32_to_i64(vs2, softfloat_round_minMag, true); }, // BODY32
77
{ require_extension(EXT_ZVFH); }, // CHECK16
8-
{ require_extension('F'); }, // CHECK32
8+
{ require(p->get_isa().get_zvf()); }, // CHECK32
99
int // sign
1010
)

0 commit comments

Comments
 (0)