@@ -193,6 +193,47 @@ struct : public arg_t {
193193 }
194194} v_zimm6;
195195
196+ struct : public arg_t {
197+ std::string to_string (insn_t insn) const {
198+ static const char * table[32 ] = {
199+ " -1.0" ,
200+ " min" ,
201+ " 1.52587890625e-05" ,
202+ " 3.0517578125e-05" ,
203+ " 0.00390625" ,
204+ " 0.0078125" ,
205+ " 0.0625" ,
206+ " 0.125" ,
207+ " 0.25" ,
208+ " 0.3125" ,
209+ " 0.375" ,
210+ " 0.4375" ,
211+ " 0.5" ,
212+ " 0.625" ,
213+ " 0.75" ,
214+ " 0.875" ,
215+ " 1.0" ,
216+ " 1.25" ,
217+ " 1.5" ,
218+ " 1.75" ,
219+ " 2.0" ,
220+ " 2.5" ,
221+ " 3.0" ,
222+ " 4.0" ,
223+ " 8.0" ,
224+ " 16.0" ,
225+ " 128.0" ,
226+ " 256.0" ,
227+ " 32768.0" ,
228+ " 65536.0" ,
229+ " inf" ,
230+ " nan"
231+ };
232+
233+ return table[insn.rs1 ()];
234+ }
235+ } fli_imm;
236+
196237struct : public arg_t {
197238 std::string to_string (insn_t insn) const {
198239 int32_t target = insn.sb_imm ();
@@ -644,11 +685,21 @@ static void NOINLINE add_xftype_insn(disassembler_t* d, const char* name, uint32
644685 d->add_insn (new disasm_insn_t (name, match, mask, {&frd, &xrs1}));
645686}
646687
688+ static void NOINLINE add_xf2type_insn (disassembler_t * d, const char * name, uint32_t match, uint32_t mask)
689+ {
690+ d->add_insn (new disasm_insn_t (name, match, mask, {&frd, &xrs1, &xrs2}));
691+ }
692+
647693static void NOINLINE add_fx2type_insn (disassembler_t * d, const char * name, uint32_t match, uint32_t mask)
648694{
649695 d->add_insn (new disasm_insn_t (name, match, mask, {&xrd, &frs1, &frs2}));
650696}
651697
698+ static void NOINLINE add_flitype_insn (disassembler_t * d, const char * name, uint32_t match, uint32_t mask)
699+ {
700+ d->add_insn (new disasm_insn_t (name, match, mask, {&xrd, &fli_imm}));
701+ }
702+
652703static void NOINLINE add_sfence_insn (disassembler_t * d, const char * name, uint32_t match, uint32_t mask)
653704{
654705 d->add_insn (new disasm_insn_t (name, match, mask, {&xrs1, &xrs2}));
@@ -794,7 +845,9 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)
794845 #define DEFINE_FR3TYPE (code ) add_fr3type_insn(this , #code, match_##code, mask_##code);
795846 #define DEFINE_FXTYPE (code ) add_fxtype_insn(this , #code, match_##code, mask_##code);
796847 #define DEFINE_FX2TYPE (code ) add_fx2type_insn(this , #code, match_##code, mask_##code);
848+ #define DEFINE_FLITYPE (code ) add_flitype_insn(this , #code, match_##code, mask_##code);
797849 #define DEFINE_XFTYPE (code ) add_xftype_insn(this , #code, match_##code, mask_##code);
850+ #define DEFINE_XF2TYPE (code ) add_xf2type_insn(this , #code, match_##code, mask_##code);
798851 #define DEFINE_SFENCE_TYPE (code ) add_sfence_insn(this , #code, match_##code, mask_##code);
799852
800853 add_insn (new disasm_insn_t (" unimp" , match_csrrw|(CSR_CYCLE<<20 ), 0xffffffff , {}));
@@ -1179,6 +1232,56 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)
11791232 DEFINE_FX2TYPE (fle_d);
11801233 }
11811234
1235+ if (isa->extension_enabled (EXT_ZFA)) {
1236+ DEFINE_FLITYPE (fli_s);
1237+ DEFINE_FRTYPE (fminm_s);
1238+ DEFINE_FRTYPE (fmaxm_s);
1239+ DEFINE_FR1TYPE (fround_s);
1240+ DEFINE_FR1TYPE (froundnx_s);
1241+ DEFINE_FX2TYPE (fleq_s);
1242+ DEFINE_FX2TYPE (fltq_s);
1243+
1244+ if (isa->extension_enabled (EXT_ZFH) || isa->extension_enabled (EXT_ZVFH)) {
1245+ DEFINE_FLITYPE (fli_h);
1246+ DEFINE_FRTYPE (fminm_h);
1247+ DEFINE_FRTYPE (fmaxm_h);
1248+ DEFINE_FR1TYPE (fround_h);
1249+ DEFINE_FR1TYPE (froundnx_h);
1250+ DEFINE_FX2TYPE (fleq_h);
1251+ DEFINE_FX2TYPE (fltq_h);
1252+ }
1253+
1254+ if (isa->extension_enabled (' D' )) {
1255+ DEFINE_FLITYPE (fli_d);
1256+ DEFINE_FRTYPE (fminm_d);
1257+ DEFINE_FRTYPE (fmaxm_d);
1258+ DEFINE_FR1TYPE (fround_d);
1259+ DEFINE_FR1TYPE (froundnx_d);
1260+ DEFINE_FX2TYPE (fleq_d);
1261+ DEFINE_FX2TYPE (fltq_d);
1262+
1263+ if (isa->get_max_xlen () == 32 ) {
1264+ DEFINE_XF2TYPE (fmvp_d_x);
1265+ DEFINE_FXTYPE (fmvh_x_d);
1266+ }
1267+ }
1268+
1269+ if (isa->extension_enabled (' Q' )) {
1270+ DEFINE_FLITYPE (fli_q);
1271+ DEFINE_FRTYPE (fminm_q);
1272+ DEFINE_FRTYPE (fmaxm_q);
1273+ DEFINE_FR1TYPE (fround_q);
1274+ DEFINE_FR1TYPE (froundnx_q);
1275+ DEFINE_FX2TYPE (fleq_q);
1276+ DEFINE_FX2TYPE (fltq_q);
1277+
1278+ if (isa->get_max_xlen () == 64 ) {
1279+ DEFINE_XF2TYPE (fmvp_q_x);
1280+ DEFINE_FXTYPE (fmvh_x_q);
1281+ }
1282+ }
1283+ }
1284+
11821285 if (isa->extension_enabled (EXT_ZDINX)) {
11831286 DEFINE_RTYPE (fadd_d);
11841287 DEFINE_RTYPE (fsub_d);
@@ -2146,7 +2249,8 @@ disassembler_t::disassembler_t(const isa_parser_t *isa)
21462249
21472250 // next-highest priority: other instructions in same base ISA
21482251 std::string fallback_isa_string = std::string (" rv" ) + std::to_string (isa->get_max_xlen ()) +
2149- " gqcvh_zfh_zba_zbb_zbc_zbs_zcb_zicbom_zicboz_zicond_zkn_zkr_zks_svinval_zcmop_zimop" ;
2252+ " gqcvh_zfh_zfa_zba_zbb_zbc_zbs_zcb_zicbom_zicboz_zicond_zk_zks_svinval_"
2253+ " zcmop_zimop_zawrs_zicfiss_zicfilp_zvknc_zvkg_zvfbfmin_zvfbfwma_zfbfmin" ;
21502254 isa_parser_t fallback_isa (fallback_isa_string.c_str (), DEFAULT_PRIV);
21512255 add_instructions (&fallback_isa);
21522256
0 commit comments