-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
target/riscv: Add support for Zfbfmin extension
Add trans_* and helper function for Zfbfmin instructions. Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn> Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230615063302.102409-3-liweiwei@iscas.ac.cn> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
- Loading branch information
1 parent
4556fda
commit 5d1270c
Showing
6 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* RISC-V translation routines for the BF16 Standard Extensions. | ||
* | ||
* Copyright (c) 2020-2023 PLCT Lab | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2 or later, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#define REQUIRE_ZFBFMIN(ctx) do { \ | ||
if (!ctx->cfg_ptr->ext_zfbfmin) { \ | ||
return false; \ | ||
} \ | ||
} while (0) | ||
|
||
static bool trans_fcvt_bf16_s(DisasContext *ctx, arg_fcvt_bf16_s *a) | ||
{ | ||
REQUIRE_FPU; | ||
REQUIRE_ZFBFMIN(ctx); | ||
|
||
TCGv_i64 dest = dest_fpr(ctx, a->rd); | ||
TCGv_i64 src1 = get_fpr_hs(ctx, a->rs1); | ||
|
||
gen_set_rm(ctx, a->rm); | ||
gen_helper_fcvt_bf16_s(dest, cpu_env, src1); | ||
gen_set_fpr_hs(ctx, a->rd, dest); | ||
mark_fs_dirty(ctx); | ||
return true; | ||
} | ||
|
||
static bool trans_fcvt_s_bf16(DisasContext *ctx, arg_fcvt_s_bf16 *a) | ||
{ | ||
REQUIRE_FPU; | ||
REQUIRE_ZFBFMIN(ctx); | ||
|
||
TCGv_i64 dest = dest_fpr(ctx, a->rd); | ||
TCGv_i64 src1 = get_fpr_hs(ctx, a->rs1); | ||
|
||
gen_set_rm(ctx, a->rm); | ||
gen_helper_fcvt_s_bf16(dest, cpu_env, src1); | ||
gen_set_fpr_hs(ctx, a->rd, dest); | ||
mark_fs_dirty(ctx); | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters