From: Dmitry Selyutin Date: Sun, 28 May 2023 22:04:58 +0000 (+0300) Subject: all: sync recent ff/pi/lf updates X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c64b3da1b7f7b5cd625c3a754d5f6e7688f412fa;p=binutils-gdb.git all: sync recent ff/pi/lf updates --- diff --git a/gas/config/tc-ppc-svp64.c b/gas/config/tc-ppc-svp64.c index 20b2bc1cafe..ae4e757d021 100644 --- a/gas/config/tc-ppc-svp64.c +++ b/gas/config/tc-ppc-svp64.c @@ -920,8 +920,15 @@ svp64_decode_pi (char *str, struct svp64_ctx *svp64) if ( ! ISSPACE (*str) && *str != SVP64_SEP && *str != '\0') return NULL; - svp64_insn_set_prefix_rm_ldst_imm_post_mode (&svp64->insn, 0x4); - svp64_insn_set_prefix_rm_ldst_imm_post_pi (&svp64->insn, 1); + if (svp64->desc->mode == SVP64_MODE_LDST_IMM) { + svp64_insn_set_prefix_rm_ldst_imm_simple_mode (&svp64->insn, 0x4); + svp64_insn_set_prefix_rm_ldst_imm_simple_pi (&svp64->insn, 1); + } else if (svp64->desc->mode == SVP64_MODE_LDST_IDX) { + svp64_insn_set_prefix_rm_ldst_idx_simple_mode (&svp64->insn, 0x4); + svp64_insn_set_prefix_rm_ldst_idx_simple_pi (&svp64->insn, 1); + } else { + svp64_raise (_("/pi only supported in LD/ST mode")); + } *str++ = '\0'; @@ -931,14 +938,21 @@ svp64_decode_pi (char *str, struct svp64_ctx *svp64) static char * svp64_decode_lf (char *str, struct svp64_ctx *svp64) { - uint64_t mode = svp64_insn_get_prefix_rm_ldst_imm_post_mode (&svp64->insn); - str += (sizeof ("lf") - 1); if ( ! ISSPACE (*str) && *str != SVP64_SEP && *str != '\0') return NULL; - svp64_insn_set_prefix_rm_ldst_imm_post_mode (&svp64->insn, (mode | 0x4)); - svp64_insn_set_prefix_rm_ldst_imm_post_lf (&svp64->insn, 1); + if (svp64->desc->mode == SVP64_MODE_LDST_IMM) { + uint64_t mode = svp64_insn_get_prefix_rm_ldst_imm_simple_mode (&svp64->insn); + svp64_insn_set_prefix_rm_ldst_imm_simple_mode (&svp64->insn, (mode | 0x4)); + svp64_insn_set_prefix_rm_ldst_imm_simple_pi (&svp64->insn, 1); + } else if (svp64->desc->mode == SVP64_MODE_LDST_IDX) { + uint64_t mode = svp64_insn_get_prefix_rm_ldst_idx_simple_mode (&svp64->insn); + svp64_insn_set_prefix_rm_ldst_idx_simple_mode (&svp64->insn, (mode | 0x4)); + svp64_insn_set_prefix_rm_ldst_idx_simple_pi (&svp64->insn, 1); + } else { + svp64_raise (_("/lf only supported in LD/ST mode")); + } *str++ = '\0'; diff --git a/opcodes/ppc-svp64-dis.c b/opcodes/ppc-svp64-dis.c index 05e666f7551..736ff8de502 100644 --- a/opcodes/ppc-svp64-dis.c +++ b/opcodes/ppc-svp64-dis.c @@ -457,10 +457,12 @@ svp64_spec_normal_ffrc1 (const struct svp64_ctx *svp64, struct disassemble_info *info) { size_t len = 0; + uint64_t VLi = svp64_insn_get_prefix_rm_normal_ffrc1_VLi (&svp64->insn); uint64_t inv = svp64_insn_get_prefix_rm_normal_ffrc1_inv (&svp64->insn); uint64_t CR = svp64_insn_get_prefix_rm_normal_ffrc1_CR (&svp64->insn); len += svp64_spec_ffrc1 (info, inv, CR); + len += svp64_spec_VLi (info, VLi); len += svp64_spec_normal (svp64, info); return len; @@ -471,12 +473,12 @@ svp64_spec_normal_ffrc0 (const struct svp64_ctx *svp64, struct disassemble_info *info) { size_t len = 0; - uint64_t inv = svp64_insn_get_prefix_rm_normal_ffrc0_inv (&svp64->insn); uint64_t VLi = svp64_insn_get_prefix_rm_normal_ffrc0_VLi (&svp64->insn); + uint64_t inv = svp64_insn_get_prefix_rm_normal_ffrc0_inv (&svp64->insn); uint64_t RC1 = svp64_insn_get_prefix_rm_normal_ffrc0_RC1 (&svp64->insn); - len += svp64_spec_VLi (info, VLi); len += svp64_spec_ffrc0 (info, inv, RC1); + len += svp64_spec_VLi (info, VLi); len += svp64_spec_normal (svp64, info); return len; @@ -512,34 +514,40 @@ svp64_spec_ldst_imm (const struct svp64_ctx *svp64, } static size_t -svp64_spec_ldst_imm_simple (const struct svp64_ctx *svp64, - struct disassemble_info *info) +svp64_spec_pi (struct disassemble_info *info, bool pi) { - size_t len = 0; - uint64_t zz = svp64_insn_get_prefix_rm_ldst_imm_simple_zz (&svp64->insn); - uint64_t els = svp64_insn_get_prefix_rm_ldst_imm_simple_els (&svp64->insn); + if (pi) + return svp64_spec_printf (info, "pi"); - len += svp64_spec_dz_sz_zz (info, zz, zz); - len += svp64_spec_els (info, els); - len += svp64_spec_ldst_imm (svp64, info); + return 0; +} - return len; +static size_t +svp64_spec_lf (struct disassemble_info *info, bool lf) +{ + if (lf) + return svp64_spec_printf (info, "lf"); + + return 0; } static size_t -svp64_spec_ldst_imm_post (const struct svp64_ctx *svp64, +svp64_spec_ldst_imm_simple (const struct svp64_ctx *svp64, struct disassemble_info *info) { size_t len = 0; - uint64_t pi = svp64_insn_get_prefix_rm_ldst_imm_post_pi (&svp64->insn); - uint64_t lf = svp64_insn_get_prefix_rm_ldst_imm_post_lf (&svp64->insn); + uint64_t pi = svp64_insn_get_prefix_rm_ldst_imm_simple_pi (&svp64->insn); + uint64_t lf = svp64_insn_get_prefix_rm_ldst_imm_simple_lf (&svp64->insn); + uint64_t els = svp64_insn_get_prefix_rm_ldst_imm_simple_els (&svp64->insn); + uint64_t zz = svp64_insn_get_prefix_rm_ldst_imm_simple_zz (&svp64->insn); - if (pi) - len += svp64_spec_printf (info, "pi"); - if (lf) - len += svp64_spec_printf (info, "lf"); + len += svp64_spec_pi (info, pi); + len += svp64_spec_lf (info, lf); + len += svp64_spec_els (info, els); + len += svp64_spec_dz_sz_zz (info, zz, zz); + len += svp64_spec_ldst_imm (svp64, info); - return 0; + return len; } static size_t @@ -562,33 +570,16 @@ svp64_spec_ldst_imm_ffrc0 (const struct svp64_ctx *svp64, { size_t len = 0; uint64_t inv = svp64_insn_get_prefix_rm_ldst_imm_ffrc0_inv (&svp64->insn); - uint64_t els = svp64_insn_get_prefix_rm_ldst_imm_ffrc0_els (&svp64->insn); + uint64_t VLi = svp64_insn_get_prefix_rm_ldst_imm_ffrc0_VLi (&svp64->insn); uint64_t RC1 = svp64_insn_get_prefix_rm_ldst_imm_ffrc0_RC1 (&svp64->insn); len += svp64_spec_ffrc0 (info, inv, RC1); - len += svp64_spec_els (info, els); + len += svp64_spec_VLi (info, VLi); len += svp64_spec_ldst_imm (svp64, info); return len; } -static size_t -svp64_spec_ldst_imm_sat (const struct svp64_ctx *svp64, - struct disassemble_info *info) -{ - size_t len = 0; - uint64_t N = svp64_insn_get_prefix_rm_ldst_imm_sat_N (&svp64->insn); - uint64_t zz = svp64_insn_get_prefix_rm_ldst_imm_sat_zz (&svp64->insn); - uint64_t els = svp64_insn_get_prefix_rm_ldst_imm_sat_els (&svp64->insn); - - len += svp64_spec_sat (info, N); - len += svp64_spec_dz_sz_zz (info, zz, zz); - len += svp64_spec_els (info, els); - len += svp64_spec_normal (svp64, info); - - return len; -} - static size_t svp64_spec_ldst_idx (const struct svp64_ctx *svp64, struct disassemble_info *info) @@ -607,10 +598,14 @@ svp64_spec_ldst_idx_simple (const struct svp64_ctx *svp64, struct disassemble_info *info) { size_t len = 0; + uint64_t pi = svp64_insn_get_prefix_rm_ldst_idx_simple_pi (&svp64->insn); + uint64_t els = svp64_insn_get_prefix_rm_ldst_idx_simple_els (&svp64->insn); uint64_t SEA = svp64_insn_get_prefix_rm_ldst_idx_simple_SEA (&svp64->insn); uint64_t dz = svp64_insn_get_prefix_rm_ldst_idx_simple_dz (&svp64->insn); uint64_t sz = svp64_insn_get_prefix_rm_ldst_idx_simple_sz (&svp64->insn); + len += svp64_spec_pi (info, pi); + len += svp64_spec_els (info, els); len += svp64_spec_SEA (info, SEA); len += svp64_spec_dz_sz_zz (info, dz, sz); len += svp64_spec_ldst_idx (svp64, info); @@ -618,17 +613,16 @@ svp64_spec_ldst_idx_simple (const struct svp64_ctx *svp64, return len; } + static size_t svp64_spec_ldst_idx_ffrc1 (const struct svp64_ctx *svp64, struct disassemble_info *info) { size_t len = 0; - uint64_t N = svp64_insn_get_prefix_rm_ldst_idx_sat_N (&svp64->insn); - uint64_t dz = svp64_insn_get_prefix_rm_ldst_idx_sat_dz (&svp64->insn); - uint64_t sz = svp64_insn_get_prefix_rm_ldst_idx_sat_sz (&svp64->insn); + uint64_t inv = svp64_insn_get_prefix_rm_ldst_idx_ffrc1_inv (&svp64->insn); + uint64_t CR = svp64_insn_get_prefix_rm_ldst_idx_ffrc1_CR (&svp64->insn); - len += svp64_spec_sat (info, N); - len += svp64_spec_dz_sz_zz (info, dz, sz); + len += svp64_spec_ffrc1 (info, inv, CR); len += svp64_spec_ldst_idx (svp64, info); return len; @@ -639,12 +633,12 @@ svp64_spec_ldst_idx_ffrc0 (const struct svp64_ctx *svp64, struct disassemble_info *info) { size_t len = 0; - uint64_t N = svp64_insn_get_prefix_rm_ldst_idx_sat_N (&svp64->insn); - uint64_t dz = svp64_insn_get_prefix_rm_ldst_idx_sat_dz (&svp64->insn); - uint64_t sz = svp64_insn_get_prefix_rm_ldst_idx_sat_sz (&svp64->insn); + uint64_t inv = svp64_insn_get_prefix_rm_ldst_idx_ffrc0_inv (&svp64->insn); + uint64_t VLi = svp64_insn_get_prefix_rm_ldst_idx_ffrc0_VLi (&svp64->insn); + uint64_t RC1 = svp64_insn_get_prefix_rm_ldst_idx_ffrc0_RC1 (&svp64->insn); - len += svp64_spec_sat (info, N); - len += svp64_spec_dz_sz_zz (info, dz, sz); + len += svp64_spec_ffrc0 (info, inv, RC1); + len += svp64_spec_VLi (info, VLi); len += svp64_spec_ldst_idx (svp64, info); return len; @@ -701,13 +695,12 @@ svp64_spec_crop_ff3 (const struct svp64_ctx *svp64, 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); + uint64_t zz = svp64_insn_get_prefix_rm_crop_ff3_zz (&svp64->insn); + uint64_t CR = svp64_insn_get_prefix_rm_crop_ff3_CR (&svp64->insn); + len += svp64_spec_ffrc0 (info, inv, CR); len += svp64_spec_VLi (info, VLi); - len += svp64_spec_ffrc0 (info, inv, RC1); - len += svp64_spec_dz_sz_zz (info, dz, sz); + len += svp64_spec_dz_sz_zz (info, zz, zz); return len; } @@ -718,13 +711,13 @@ svp64_spec_crop_ff5 (const struct svp64_ctx *svp64, { size_t len = 0; uint64_t VLi = svp64_insn_get_prefix_rm_crop_ff5_VLi (&svp64->insn); + uint64_t RC1 = 1; 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_ffrc1 (info, inv, RC1); len += svp64_spec_VLi (info, VLi); - len += svp64_spec_ffrc1 (info, inv, CR); len += svp64_spec_dz_sz_zz (info, dz, sz); return len; @@ -842,11 +835,9 @@ svp64_print_spec (const struct svp64_ctx *svp64, {0x20, 0x30, svp64_spec_normal_sat}, /* saturation (no Rc) */ }; static const struct svp64_spec_subtable ldst_imm[] = { - {0x00, 0x38, svp64_spec_ldst_imm_simple}, /* simple (no Rc) */ - {0x08, 0x38, svp64_spec_ldst_imm_post}, /* post (no Rc) */ + {0x00, 0x10, svp64_spec_ldst_imm_simple}, /* simple (no Rc) */ {0x11, 0x11, svp64_spec_ldst_imm_ffrc1}, /* ffirst, Rc=1 */ {0x10, 0x11, svp64_spec_ldst_imm_ffrc0}, /* ffirst, Rc=0 */ - {0x20, 0x30, svp64_spec_ldst_imm_sat}, /* saturation (no Rc) */ }; static const struct svp64_spec_subtable ldst_idx[] = { {0x00, 0x10, svp64_spec_ldst_idx_simple}, /* simple (no Rc) */ @@ -856,8 +847,8 @@ svp64_print_spec (const struct svp64_ctx *svp64, 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}, /* ffirst, 3-bit CR */ - {0x20, 0x20, svp64_spec_crop_ff5}, /* ffirst, 5-bit CR */ + {0x11, 0x11, svp64_spec_crop_ff3}, /* ffirst, 3-bit CR */ + {0x10, 0x10, svp64_spec_crop_ff5}, /* ffirst, 5-bit CR */ }; static const struct svp64_spec_subtable branch[] = { {0x00, 0x03, svp64_spec_branch_simple}, /* simple */