> diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c > index c77b0322869..8480cf09294 100644 > --- a/gcc/config/riscv/riscv.c > +++ b/gcc/config/riscv/riscv.c > @@ -2131,6 +2131,14 @@ riscv_rtx_costs (rtx x, machine_mode mode, int > outer_code, int opno ATTRIBUTE_UN > *total = riscv_extend_cost (XEXP (x, 0), GET_CODE (x) == ZERO_EXTEND); > return false; > > + case BSWAP: > + if (TARGET_ZBB) > + { > + *total = COSTS_N_INSNS (1);
Add a cost model for HImode? maybe `*total = COSTS_N_INSNS (mode == HImode ? 2 : 1);` ?