Revision | abe2d74032d6d12a6918715086bbdf8843296f36 (tree) |
---|---|
Zeit | 2022-01-21 14:52:56 |
Autor | Frank Chang <frank.chang@sifi...> |
Commiter | Alistair Francis |
target/riscv: rvv-1.0: Add Zve32f support for scalar fp insns
Zve32f extension requires the scalar processor to implement the F
extension and implement all vector floating-point instructions for
floating-point operands with EEW=32 (i.e., no widening floating-point
operations).
Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220118014522.13613-14-frank.chang@sifive.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@@ -66,6 +66,17 @@ static bool require_scale_rvf(DisasContext *s) | ||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | +static bool require_zve32f(DisasContext *s) | |
70 | +{ | |
71 | + /* RVV + Zve32f = RVV. */ | |
72 | + if (has_ext(s, RVV)) { | |
73 | + return true; | |
74 | + } | |
75 | + | |
76 | + /* Zve32f doesn't support FP64. (Section 18.2) */ | |
77 | + return s->ext_zve32f ? s->sew <= MO_32 : true; | |
78 | +} | |
79 | + | |
69 | 80 | static bool require_zve64f(DisasContext *s) |
70 | 81 | { |
71 | 82 | /* RVV + Zve64f = RVV. */ |
@@ -2229,6 +2240,7 @@ static bool opfvv_check(DisasContext *s, arg_rmrr *a) | ||
2229 | 2240 | require_rvf(s) && |
2230 | 2241 | vext_check_isa_ill(s) && |
2231 | 2242 | vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm) && |
2243 | + require_zve32f(s) && | |
2232 | 2244 | require_zve64f(s); |
2233 | 2245 | } |
2234 | 2246 |
@@ -2310,6 +2322,7 @@ static bool opfvf_check(DisasContext *s, arg_rmrr *a) | ||
2310 | 2322 | require_rvf(s) && |
2311 | 2323 | vext_check_isa_ill(s) && |
2312 | 2324 | vext_check_ss(s, a->rd, a->rs2, a->vm) && |
2325 | + require_zve32f(s) && | |
2313 | 2326 | require_zve64f(s); |
2314 | 2327 | } |
2315 | 2328 |
@@ -2532,6 +2545,7 @@ static bool opfv_check(DisasContext *s, arg_rmr *a) | ||
2532 | 2545 | vext_check_isa_ill(s) && |
2533 | 2546 | /* OPFV instructions ignore vs1 check */ |
2534 | 2547 | vext_check_ss(s, a->rd, a->rs2, a->vm) && |
2548 | + require_zve32f(s) && | |
2535 | 2549 | require_zve64f(s); |
2536 | 2550 | } |
2537 | 2551 |
@@ -2598,6 +2612,7 @@ static bool opfvv_cmp_check(DisasContext *s, arg_rmrr *a) | ||
2598 | 2612 | require_rvf(s) && |
2599 | 2613 | vext_check_isa_ill(s) && |
2600 | 2614 | vext_check_mss(s, a->rd, a->rs1, a->rs2) && |
2615 | + require_zve32f(s) && | |
2601 | 2616 | require_zve64f(s); |
2602 | 2617 | } |
2603 | 2618 |
@@ -2612,6 +2627,7 @@ static bool opfvf_cmp_check(DisasContext *s, arg_rmrr *a) | ||
2612 | 2627 | require_rvf(s) && |
2613 | 2628 | vext_check_isa_ill(s) && |
2614 | 2629 | vext_check_ms(s, a->rd, a->rs2) && |
2630 | + require_zve32f(s) && | |
2615 | 2631 | require_zve64f(s); |
2616 | 2632 | } |
2617 | 2633 |
@@ -2634,6 +2650,7 @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a) | ||
2634 | 2650 | require_rvf(s) && |
2635 | 2651 | vext_check_isa_ill(s) && |
2636 | 2652 | require_align(a->rd, s->lmul) && |
2653 | + require_zve32f(s) && | |
2637 | 2654 | require_zve64f(s)) { |
2638 | 2655 | gen_set_rm(s, RISCV_FRM_DYN); |
2639 | 2656 |
@@ -3368,6 +3385,7 @@ static bool trans_vfmv_f_s(DisasContext *s, arg_vfmv_f_s *a) | ||
3368 | 3385 | if (require_rvv(s) && |
3369 | 3386 | require_rvf(s) && |
3370 | 3387 | vext_check_isa_ill(s) && |
3388 | + require_zve32f(s) && | |
3371 | 3389 | require_zve64f(s)) { |
3372 | 3390 | gen_set_rm(s, RISCV_FRM_DYN); |
3373 | 3391 |
@@ -3395,6 +3413,7 @@ static bool trans_vfmv_s_f(DisasContext *s, arg_vfmv_s_f *a) | ||
3395 | 3413 | if (require_rvv(s) && |
3396 | 3414 | require_rvf(s) && |
3397 | 3415 | vext_check_isa_ill(s) && |
3416 | + require_zve32f(s) && | |
3398 | 3417 | require_zve64f(s)) { |
3399 | 3418 | gen_set_rm(s, RISCV_FRM_DYN); |
3400 | 3419 |
@@ -3447,6 +3466,7 @@ static bool fslideup_check(DisasContext *s, arg_rmrr *a) | ||
3447 | 3466 | { |
3448 | 3467 | return slideup_check(s, a) && |
3449 | 3468 | require_rvf(s) && |
3469 | + require_zve32f(s) && | |
3450 | 3470 | require_zve64f(s); |
3451 | 3471 | } |
3452 | 3472 |
@@ -3454,6 +3474,7 @@ static bool fslidedown_check(DisasContext *s, arg_rmrr *a) | ||
3454 | 3474 | { |
3455 | 3475 | return slidedown_check(s, a) && |
3456 | 3476 | require_rvf(s) && |
3477 | + require_zve32f(s) && | |
3457 | 3478 | require_zve64f(s); |
3458 | 3479 | } |
3459 | 3480 |