From: Dmitry Selyutin Date: Tue, 11 Apr 2023 18:27:26 +0000 (+0300) Subject: ppc/svp64: disassemble CR op mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f652dbc956fadc36a3304448127a005fa428d2e;p=binutils-gdb.git ppc/svp64: disassemble CR op mode --- diff --git a/opcodes/ppc-svp64-dis.c b/opcodes/ppc-svp64-dis.c index f82baf9ce8e..d34748bcf5d 100644 --- a/opcodes/ppc-svp64-dis.c +++ b/opcodes/ppc-svp64-dis.c @@ -275,6 +275,24 @@ svp64_spec_dz_sz_zz (struct disassemble_info *info, bool dz, bool sz) return len; } +static size_t +svp64_spec_dz_sz_zz_SNZ (struct disassemble_info *info, + bool dz, bool sz, bool SNZ) +{ + size_t len = 0; + + if (SNZ) + { + len += svp64_spec_printf (info, "snz"); + if (dz) + len += svp64_spec_printf (info, "zz"); + } + else + len += svp64_spec_dz_sz_zz (info, dz, sz); + + return len; +} + static size_t svp64_spec_mr (struct disassemble_info *info, bool RG) { @@ -381,6 +399,7 @@ svp64_spec_els (struct disassemble_info *info, bool els) { if (els) return svp64_spec_printf (info, "els"); + return 0; } @@ -388,7 +407,8 @@ static size_t svp64_spec_SEA (struct disassemble_info *info, bool SEA) { if (SEA) - return svp64_spec_printf (info, "SEA"); + return svp64_spec_printf (info, "sea"); + return 0; } @@ -608,6 +628,86 @@ svp64_spec_ldst_idx_sat (const struct svp64_ctx *svp64, return len; } +static size_t +svp64_spec_crop (const struct svp64_ctx *svp64, + struct disassemble_info *info, bool dz, bool sz) +{ + size_t len = 0; + uint64_t SNZ = svp64_insn_get_prefix_rm_crop_SNZ (&svp64->insn); + + len += svp64_spec_dz_sz_zz_SNZ (info, dz, sz, SNZ); + len += svp64_spec_vec (svp64, info); + + return len; +} + +static size_t +svp64_spec_crop_simple (const struct svp64_ctx *svp64, + struct disassemble_info *info) +{ + size_t len = 0; + uint64_t RG = svp64_insn_get_prefix_rm_crop_simple_RG (&svp64->insn); + uint64_t dz = svp64_insn_get_prefix_rm_crop_simple_dz (&svp64->insn); + uint64_t sz = svp64_insn_get_prefix_rm_crop_simple_sz (&svp64->insn); + + if (RG) + len += svp64_spec_printf (info, "rg"); + len += svp64_spec_crop (svp64, info, dz, sz); + + return len; +} + +static size_t +svp64_spec_crop_mr (const struct svp64_ctx *svp64, + struct disassemble_info *info) +{ + size_t len = 0; + uint64_t RG = svp64_insn_get_prefix_rm_crop_mr_RG (&svp64->insn); + uint64_t dz = svp64_insn_get_prefix_rm_crop_mr_dz (&svp64->insn); + uint64_t sz = svp64_insn_get_prefix_rm_crop_mr_sz (&svp64->insn); + + len += svp64_spec_mr (info, RG); + len += svp64_spec_crop (svp64, info, dz, sz); + + return len; +} + +static size_t +svp64_spec_crop_ff3 (const struct svp64_ctx *svp64, + struct disassemble_info *info) +{ + size_t len = 0; + uint64_t VLi = svp64_insn_get_prefix_rm_crop_ff3_VLi (&svp64->insn); + uint64_t inv = svp64_insn_get_prefix_rm_crop_ff3_inv (&svp64->insn); + uint64_t sz = svp64_insn_get_prefix_rm_crop_ff3_sz (&svp64->insn); + uint64_t dz = svp64_insn_get_prefix_rm_crop_ff3_dz (&svp64->insn); + uint64_t RC1 = svp64_insn_get_prefix_rm_crop_ff3_RC1 (&svp64->insn); + + len += svp64_spec_VLi (info, VLi); + len += svp64_spec_ffrc0 (info, inv, RC1); + len += svp64_spec_dz_sz_zz (info, dz, sz); + + return len; +} + +static size_t +svp64_spec_crop_ff5 (const struct svp64_ctx *svp64, + struct disassemble_info *info) +{ + size_t len = 0; + uint64_t VLi = svp64_insn_get_prefix_rm_crop_ff5_VLi (&svp64->insn); + uint64_t inv = svp64_insn_get_prefix_rm_crop_ff5_inv (&svp64->insn); + uint64_t CR = svp64_insn_get_prefix_rm_crop_ff5_CR (&svp64->insn); + uint64_t dz = svp64_insn_get_prefix_rm_crop_ff5_dz (&svp64->insn); + uint64_t sz = svp64_insn_get_prefix_rm_crop_ff5_sz (&svp64->insn); + + len += svp64_spec_VLi (info, VLi); + len += svp64_spec_ffrc1 (info, inv, CR); + len += svp64_spec_dz_sz_zz (info, dz, sz); + + return len; +} + static size_t svp64_print_spec (const struct svp64_ctx *svp64, struct disassemble_info *info) @@ -632,10 +732,17 @@ svp64_print_spec (const struct svp64_ctx *svp64, {0x00, 0x30, svp64_spec_ldst_idx_simple}, /* simple (no Rc) */ {0x20, 0x30, svp64_spec_ldst_idx_sat}, /* saturation (no Rc) */ }; + static const struct svp64_spec_subtable crop[] = { + {0x00, 0x38, svp64_spec_crop_simple}, /* simple */ + {0x08, 0x38, svp64_spec_crop_mr}, /* mapreduce */ + {0x21, 0x21, svp64_spec_crop_ff3}, /* failfirst, 3-bit CR */ + {0x20, 0x20, svp64_spec_crop_ff5}, /* failfirst, 5-bit CR */ + }; static const struct svp64_spec_table tables[] = { [SVP64_MODE_NORMAL] = {normal, ARRAY_SIZE (normal)}, [SVP64_MODE_LDST_IMM] = {ldst_imm, ARRAY_SIZE (ldst_imm)}, [SVP64_MODE_LDST_IDX] = {ldst_idx, ARRAY_SIZE (ldst_idx)}, + [SVP64_MODE_CROP] = {crop, ARRAY_SIZE (crop)}, }; const struct svp64_spec_table *table = &tables[svp64->desc->mode]; uint64_t mode = svp64_insn_get_prefix_rm_mode (&svp64->insn);