Commit Graph

4007 Commits

Author SHA1 Message Date
Jan Beulich
5e0423804a x86: drop seg_entry
Use struct reg_entry instead for most purposes, with a separate array
holding just the respective opcode prefix bytes.
2021-03-30 14:09:41 +02:00
Jan Beulich
3468486226 x86: drop REGNAM_{AL,AX,EAX}
The former two are unused anyway. And having such constants isn't very
helpful either, when they live in a place where updating the register
table wouldn't even allow noticing the need to adjust these constants.
2021-03-30 14:08:48 +02:00
Jan Beulich
6288d05f11 x86: adjust st(<N>) parsing
st(1) ... st(7) will never be looked up in the hash table, so there's no
point inserting the entries. It's also not really necessary to do a 2nd
hash lookup after parsing the register number, nor is there a real
reason for having both st and st(0) entries. Plus we can easily do away
with the need for st to be first in the table.
2021-03-30 14:08:11 +02:00
Jan Beulich
bbe1eca622 x86: move some opcode table entries
For a long time there hasn't been a need anymore to keep together all
templates with identical mnemonics. Move the MOVQ and MOVABS ones next
to their MOV counterparts. Move the string forms of CMPSD and MOVSD next
to their CMPS / MOVS counterparts. Re-arrange what so fgar was the SSE3
section.

This makes reasonably obvious that MONITOR/MWAIT aren't suitable to
cover by CpuSSE3, but adjusting this is left for another time.
2021-03-29 12:06:43 +02:00
Jan Beulich
c8cad9d389 x86: VPSADBW's source operands are also commutative
In commit 79dec6b7ba ("x86-64: optimize certain commutative
VEX-encoded insns") I missed the fact that there being subtraction
involved here doesn't matter, as absolute differences get summed up.
2021-03-29 12:06:09 +02:00
Jan Beulich
5cdaf10025 x86: fold SSE2AVX and their base MMX/SSE templates
This way not only the overall (source) table size shrinks by quite a
bit and the risk of related templates going out of sync with one another
gets lowered, but also (dis)similarities between neighboring templates
become easier to spot.

Note that for certain SSE2AVX templates this results in benign attribute
changes:
- LDMXCSR and STMXCSR: NoAVX gets set,
- MOVMSKPS, PMOVMSKB, PEXTR{B,W} (register destination), and PINSR{B,W}
  (register source): IgnoreSize and NoRex64 get set,
- CVT{DQ,PS}2PD, CVTSD2SS, MOVMSKPD, MOVDDUP, PMOV{S,Z}X{BW,WD,DQ}, and
  ROUNDSD: NoRex64 gets set,
- CVTSS2SD, INSERTPS, PEXTRW (memory destination), PINSRW (memory
  source), and PMOV{S,Z}X{BD,WQ,BQ}: IgnoreSize gets set.
Similarly the "normal" (non-SSE2AVX)
- non-64-bit CVTS{I,S}2SD forms get NoRex64 set,
- CMP{EQ,ORD,NEQ,UNORD}{P,S}{S,D} forms get C set,
all again in a benign way.

The remaining differences in the generated table are due to re-ordering
of entries in the course of being folded into templates.
2021-03-29 12:05:25 +02:00
Jan Beulich
73e45eb208 x86: undo Prefix_0X<nn> use in opcode table
The table entries are more natural to read (and slightly shorter) when
the prefixes, like is the case for VEX/XOP/EVEX-encoded entries, are
specified as part of the opcode. This is particularly noticable for
side-by-side legacy and SSE2AVX entries.

An implication is that we now need to use "unsigned long long" for the
initially parsed opcode in i386-gen. I don't expect this to be an issue.
2021-03-29 12:04:03 +02:00
Jan Beulich
9df6f676c2 x86: shrink some struct insn_template fields
Now that all base opcodes are only at most 2 bytes in size, shrink its
template field to just as much. By also shrinking extension_opcode and
operands to just what they really need, we can free up an entire 32-bit
slot (plus 4 left bits past the bitfields themselves).

At present this alters sizeof(struct insn_template) only for 32-bit
builds. In 64-bit builds it instead leaves a padding hole that will
allow to buffer future growth of other fields (opcode_modifier,
cpu_flags, operand_types[]).
2021-03-29 12:03:31 +02:00
Jan Beulich
389d00a5e5 x86: derive opcode encoding space attribute from base opcode
Just like is already done for VEX/XOP/EVEX encoded insns, record the
encoding space information in the respective opcode modifier field. Do
this again without changing the source table, but rather by deriving the
values from their existing source representation.
2021-03-29 12:02:50 +02:00
Alan Modra
63b4cc53dc TRUE/FALSE simplification
There is really no need to write code like "foo != 0 ? TRUE : FALSE"
unless we had stupidly defined FALSE as something other than 0 or TRUE
as something other than 1.  The simpler "foo != 0" does just as well.
Similarly "(condition == TRUE)" or "(condition == FALSE) can be
simplified to "(condition)" and "(!condition)" respectively.

I'll note that there is reason to use "integer_expression != 0" when
assigning a bfd_boolean rather than the simpler "integer_expression",
if you expect the variable to have 0 or 1 value.  It's probably even a
good idea to not rely on implicit conversion if bfd_boolean were _Bool.

bfd/
	* aoutx.h (aout_link_write_symbols): Don't cast boolean expression
	to bfd_boolean.
	* elf32-or1k.c (or1k_set_got_and_rela_sizes): Dont compare booleans
	against FALSE.
	* elf32-arc.c (name_for_global_symbol): Don't compare boolean to TRUE.
	(is_reloc_PC_relative): Don't use "boolean_condition ? TRUE : FALSE".
	(is_reloc_SDA_relative, is_reloc_for_GOT): Likewise.
	(is_reloc_for_PLT, is_reloc_for_TLS): Likewise.
	* elf32-arm.c (stm32l4xx_need_create_replacing_stub): Likewise.
	* elf32-nds32.c (insert_nds32_elf_blank): Likewise.
	* elf32-rx.c (rx_set_section_contents): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_ignore_undef_symbol): Likewise.
	* mach-o.c (bfd_mach_o_read_command): Likewise.
	* targets.c (bfd_get_target_info): Likewise.
binutils/
	* dlltool.c (main): Don't use "boolean_condition ? TRUE : FALSE".
	* dwarf.c (read_and_display_attr_value): Likewise.
	(display_debug_str_offsets): Likewise.
	* objdump.c (dump_bfd): Likewise.
	* readelf.c (dump_section_as_strings): Likewise.
	(dump_section_as_bytes): Likewise.
gas/
	* atof-generic.c (FALSE, TRUE): Don't define.
	* config/obj-elf.h (FALSE, TRUE): Don't define.
	* config/obj-som.h (FALSE, TRUE): Don't define.
	* config/tc-hppa.h (FALSE, TRUE): Don't define.
	* config/tc-pdp11.c (FALSE, TRUE): Don't define.
	* config/tc-iq2000.h (obj_fix_adjustable): Delete.
	* config/tc-m32r.h (TC_FIX_ADJUSTABLE): Delete.
	* config/tc-mt.h (obj_fix_adjustable): Delete.
	* config/tc-nds32.h (TC_FIX_ADJUSTABLE): Delete.
	* config/tc-arc.c (parse_opcode_flags): Simplify boolean expression.
	(relaxable_flag, relaxable_operand, assemble_insn): Likewise.
	(tokenize_extregister): Likewise.
	* config/tc-csky.c (parse_opcode, get_operand_value): Likewise.
	(parse_operands_op, parse_operands, md_assemble): Likewise.
	* config/tc-d10v.c (build_insn): Likewise.
	* config/tc-score.c (s3_gen_insn_frag): Likewise.
	* config/tc-score7.c (s7_gen_insn_frag, s7_relax_frag): Likewise.
	* config/tc-tic6x.c (tic6x_update_features, md_assemble): Likewise.
	* config/tc-z80.c (emit_byte): Likewise.
include/
	* opcode/aarch64.h (alias_opcode_p): Simplify boolean expression.
	(opcode_has_alias, pseudo_opcode_p, optional_operand_p): Likewise.
	(opcode_has_special_coder): Likewise.
ld/
	* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Simplify
	boolean expression.
	* lexsup.c (parse_args): Likewise.
	* pe-dll.c (pe_dll_id_target): Likewise.
opcodes/
	* aarch64-opc.c (vector_qualifier_p): Simplify boolean expression.
	(fp_qualifier_p, get_data_pattern): Likewise.
	(aarch64_get_operand_modifier_from_value): Likewise.
	(aarch64_extend_operator_p, aarch64_shift_operator_p): Likewise.
	(operand_variant_qualifier_p): Likewise.
	(qualifier_value_in_range_constraint_p): Likewise.
	(aarch64_get_qualifier_esize): Likewise.
	(aarch64_get_qualifier_nelem): Likewise.
	(aarch64_get_qualifier_standard_value): Likewise.
	(get_lower_bound, get_upper_bound): Likewise.
	(aarch64_find_best_match, match_operands_qualifier): Likewise.
	(aarch64_print_operand): Likewise.
	* aarch64-opc.h (operand_has_inserter, operand_has_extractor): Likewise.
	(operand_need_sign_extension, operand_need_shift_by_two): Likewise.
	(operand_need_shift_by_four, operand_maybe_stack_pointer): Likewise.
	* arm-dis.c (print_insn_mve, print_insn_thumb32): Likewise.
	* tic6x-dis.c (tic6x_check_fetch_packet_header): Likewise.
	(print_insn_tic6x): Likewise.
2021-03-29 11:22:22 +10:30
Alan Modra
3d7d6c1b50 opcodes int vs bfd_boolean fixes
cpu/
	* frv.opc (frv_is_branch_major, frv_is_float_major),
	(frv_is_media_major, frv_is_branch_insn, frv_is_float_insn),
	(frv_is_media_insn, spr_valid): Correct prototypes.
include/
	* opcode/aarch64.h (aarch64_opcode_encode): Correct prototype.
opcodes/
	* arc-dis.c (extract_operand_value): Correct NULL cast.
	* frv-opc.h: Regenerate.
2021-03-29 11:22:21 +10:30
Jan Beulich
c3344b626d x86-64: don't accept supposedly disabled MOVQ forms
While all of MMX, SSE, and SSE2 are included in "generic64", they can be
individually disabled. There are two MOVQ forms lacking respective
attributes. While the MMX one would get refused anyway (due to MMX
registers not recognized with .nommx), the assembler did happily accept
the SSE2 form. Add respective CPU settings to both, paralleling what the
MOVD counterparts have.
2021-03-26 11:43:19 +01:00
Hafiz Abid Qadeer
efa30ac3c5 [NIOS2] Fix disassembly of br.n instruction.
The code was checking wrong bit for sign extension. It caused it
to zero-extend instead of sign-extend the immediate value.

2021-03-25  Abid Qadeer  <abidh@codesourcery.com>

	opcodes/
	* nios2-dis.c (nios2_print_insn_arg): Fix sign extension of
	immediate in br.n instruction.

	gas/
	* testsuite/gas/nios2/brn.s: New.
	* testsuite/gas/nios2/brn.d: New.
2021-03-25 10:52:14 +00:00
Jan Beulich
596a02ff55 x86: flag bad S/G insn operand combinations
For VEX-encoded ones, all three involved vector registers have to be
distinct. For EVEX-encoded ones an actual mask register has to be in use
and zeroing-masking cannot be used (violation of either will #UD).
Additionally both involved vector registers have to be distinct for
EVEX-encoded gathers.
2021-03-25 08:20:19 +01:00
Jan Beulich
5364285240 x86: flag as bad AVX512 insns with EVEX.z set but EVEX.aaa clear
This combination makes no sense and is documented to cause #UD.
2021-03-25 08:19:21 +01:00
Jan Beulich
c0e54661f7 x86: fix AMD Zen3 insns
For INVLPGB the operand count was wrong (besides %edx there's also %ecx
which is an input to the insn). In this case I see little sense in
retaining the bogus 2-operand template. Plus swapping of the operands
wasn't properly suppressed for Intel syntax.

For PVALIDATE, RMPADJUST, and RMPUPDATE bogus single operand templates
were specified. These get retained, as the address operand is the only
one really needed to expressed non-default address size, but only for
compatibility reasons. Proper multi-operand insn get introduced and the
testcases get adjusted / extended accordingly.

While at it also drop the redundant definition of __amd64__ - we already
have x86_64 defined (or not) to distinguish 64-bit and non-64-bit cases.
2021-03-25 08:18:41 +01:00
Alan Modra
5a4037661b PR27647 PowerPC extended conditional branch mnemonics
opcodes/
	PR 27647
	* ppc-opc.c (XLOCB_MASK): Delete.
	(XLBOBB_MASK, XLBOBIBB_MASK, XLBOCBBB_MASK): Define using
	XLBH_MASK.
	(powerpc_opcodes): Accept a BH field on all extended forms of
	bclr, bclrl, bcctr, bcctrl, bctar, bctarl.
gas/
	PR 27647
	* testsuite/gas/ppc/a2.d: Update expected output.
	* testsuite/gas/ppc/power8.d: Likewise.
2021-03-25 11:31:53 +10:30
Jan Beulich
9a182d0461 x86: derive opcode length from opcode value
In the majority of cases we can easily determine the length from the
encoding, irrespective of whether a prefix is specified there as well.
We further don't even need to record the value in the table entries, as
it's easy enough to determine it (without any guesswork, unless an insn
with major opcode 00 appeared that requires a 2nd opcode byte to be
specified explicitly) when installing the chosen template for further
processing.

Should an encoding appear which
- has a major opcode byte of 66, F3, or F2,
- requires a 2nd opcode byte to be specified explicitly,
- doesn't have a mandatory prefix
we'd need to convert all templates presently encoding a mandatory prefix
this way to the Prefix_0X<nn> model to eliminate the respective guessing
i386-gen does.
2021-03-24 08:33:33 +01:00
Jan Beulich
3564871692 x86: derive mandatory prefix attribute from base opcode
Just like is already done for legacy encoded insns, record the mandatory
prefix information in the respective opcode modifier field. Do this
without changing the source table, but rather by deriving the values from
their existing source representation.
2021-03-24 08:32:32 +01:00
Jan Beulich
311845694b x86: don't use opcode_length to identify pseudo prefixes
This is in preparation of opcode_length going away as a field in the
templates. Identify pseudo prefixes by a base opcode of zero instead:
No real prefix has an opcode of zero. This at the same time allows
dropping a curious special case from i386-gen.

Since most attributes are identical for all pseudo prefixes, take the
opportunity and also template them.
2021-03-24 08:31:41 +01:00
Jan Beulich
b933fa4b5d x86: re-number PREFIX_0X<nn>
In preparation to use PREFIX_0X<nn> attributes also in VEX/XOP/EVEX
encoding templates, renumber the pseudo-enumerators such that their
values can then also be used directly in the respective prefix bit
fields.
2021-03-23 17:09:53 +01:00
Jan Beulich
dac10fb0d1 x86: re-order two fields of struct insn_template
To facilitate a subsequent table parser change, re-order CPU flags and
opcode modifier fields. No functional change intended.
2021-03-23 17:09:11 +01:00
Jan Beulich
441f6aca39 x86: split opcode prefix and opcode space representation
Commit 8b65b8953a ("x86: Remove the prefix byte from non-VEX/EVEX
base_opcode") used the opcodeprefix field for two distinct purposes. In
preparation of having VEX/XOP/EVEX and non-VEX templates become similar
in the representatioon of both encoding space and opcode prefixes, split
the field to have a separate one holding an insn's opcode space.
2021-03-23 17:08:39 +01:00
Martin Liska
08dedd6631 Add startswith function and use it instead of CONST_STRNEQ.
bfd/ChangeLog:

	* bfd-in.h (startswith): Add startswith function.
	(CONST_STRNEQ): Remove.
	* bfd-in2.h (startswith): Regenerate with make headers.
	* archive.c (bfd_slurp_armap): Replace usage of CONST_STRNEQ with startswith.
	(_bfd_slurp_extended_name_table): Likewise.
	* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
	* bfd.c (bfd_get_sign_extend_vma): Likewise.
	(bfd_convert_section_size): Likewise.
	(bfd_convert_section_contents): Likewise.
	* coff-stgo32.c (go32exe_create_stub): Likewise.
	(go32exe_check_format): Likewise.
	* coffcode.h (styp_to_sec_flags): Likewise.
	(GNU_DEBUGALTLINK): Likewise.
	* coffgen.c (_bfd_coff_section_already_linked): Likewise.
	(coff_gc_sweep): Likewise.
	(bfd_coff_gc_sections): Likewise.
	* cofflink.c (coff_link_add_symbols): Likewise.
	(process_embedded_commands): Likewise.
	* compress.c (bfd_is_section_compressed_with_header): Likewise.
	(bfd_init_section_decompress_status): Likewise.
	* dwarf2.c (find_debug_info): Likewise.
	(place_sections): Likewise.
	* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
	* elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
	* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
	(assign_section_numbers): Likewise.
	(elfcore_grok_win32pstatus): Likewise.
	* elf32-arm.c (cmse_scan): Likewise.
	(elf32_arm_gc_mark_extra_sections): Likewise.
	(elf32_arm_size_dynamic_sections): Likewise.
	(is_arm_elf_unwind_section_name): Likewise.
	* elf32-bfin.c (bfin_size_dynamic_sections): Likewise.
	* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
	* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
	* elf32-csky.c (csky_elf_size_dynamic_sections): Likewise.
	* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
	* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
	* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
	* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
	* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
	* elf32-msp430.c (msp430_elf_relax_delete_bytes): Likewise.
	* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
	* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
	* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
	* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
	* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
	* elf32-tic6x.c (is_tic6x_elf_unwind_section_name): Likewise.
	(elf32_tic6x_size_dynamic_sections): Likewise.
	* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
	* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
	(xtensa_is_insntable_section): Likewise.
	(xtensa_is_littable_section): Likewise.
	(xtensa_is_proptable_section): Likewise.
	(xtensa_property_section_name): Likewise.
	(xtensa_callback_required_dependence): Likewise.
	* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
	* elf64-ia64-vms.c (is_unwind_section_name): Likewise.
	(get_reloc_section): Likewise.
	(elf64_ia64_size_dynamic_sections): Likewise.
	(elf64_ia64_object_p): Likewise.
	* elf64-mmix.c (mmix_elf_add_symbol_hook): Likewise.
	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
	* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	(_bfd_elf_gc_mark_extra_sections): Likewise.
	(bfd_elf_parse_eh_frame_entries): Likewise.
	(_bfd_elf_section_already_linked): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
	* elfnn-ia64.c (is_unwind_section_name): Likewise.
	(elfNN_ia64_size_dynamic_sections): Likewise.
	(elfNN_ia64_object_p): Likewise.
	* elfxx-mips.c (FN_STUB_P): Likewise.
	(CALL_STUB_P): Likewise.
	(CALL_FP_STUB_P): Likewise.
	(_bfd_mips_elf_section_from_shdr): Likewise.
	(_bfd_mips_elf_fake_sections): Likewise.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_final_write_processing): Likewise.
	(_bfd_mips_elf_final_link): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
	* elfxx-x86.c (elf_i386_is_reloc_section): Likewise.
	(elf_x86_64_is_reloc_section): Likewise.
	* hpux-core.c (thread_section_p): Likewise.
	* libcoff.h (bfd_pei_p): Likewise.
	* linker.c (REAL): Likewise.
	(unwrap_hash_lookup): Likewise.
	(_bfd_generic_link_add_one_symbol): Likewise.
	* mmo.c (mmo_internal_write_section): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* pef.c (bfd_pef_print_symbol): Likewise.
	* pei-x86_64.c (pex64_print_all_pdata_sections): Likewise.
	* som.c (som_slurp_symbol_table): Likewise.
	(som_slurp_armap): Likewise.
	* wasm-module.c (wasm_compute_custom_section_file_position): Likewise.

binutils/ChangeLog:

	* dlltool.c (scan_drectve_symbols): Replace usage of CONST_STRNEQ with startswith.
	* emul_aix.c (ar_emul_aix_parse_arg): Likewise.
	* objcopy.c (is_mergeable_note_section): Likewise.
	* objdump.c (dump_dwarf_section): Likewise.
	* prdbg.c (pr_method_type): Likewise.
	(pr_class_baseclass): Likewise.
	(tg_class_baseclass): Likewise.
	* readelf.c (process_lto_symbol_tables): Likewise.
	* stabs.c (ULLHIGH): Likewise.
	(parse_stab_argtypes): Likewise.
	(stab_demangle_function_name): Likewise.

gas/ChangeLog:

	* config/tc-i386.c (md_parse_option): Replace usage of CONST_STRNEQ with startswith.
	(x86_64_section_word): Likewise.
	* config/tc-sparc.c (md_parse_option): Likewise.

gdb/ChangeLog:

	* arm-tdep.c (show_disassembly_style_sfunc): Replace usage of CONST_STRNEQ with startswith.
	(_initialize_arm_tdep): Likewise.

ld/ChangeLog:

	* emultempl/aix.em: Replace usage of CONST_STRNEQ with startswith.
	* emultempl/beos.em: Likewise.
	* emultempl/elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
	* ldctor.c (ctor_prio): Likewise.
	* ldelf.c (ldelf_try_needed): Likewise.
	(ldelf_parse_ld_so_conf): Likewise.
	(ldelf_after_open): Likewise.
	(output_rel_find): Likewise.
	(ldelf_place_orphan): Likewise.
	* ldfile.c (ldfile_add_library_path): Likewise.
	* ldlang.c (lang_add_input_file): Likewise.
	* ldmain.c (get_sysroot): Likewise.
	(get_emulation): Likewise.
	(add_archive_element): Likewise.
	* ldwrite.c (unsplittable_name): Likewise.
	(clone_section): Likewise.
	* lexsup.c (parse_args): Likewise.
	* pe-dll.c (is_import): Likewise.
	(pe_implied_import_dll): Likewise.

opcodes/ChangeLog:

	* aarch64-dis.c (parse_aarch64_dis_option): Replace usage of CONST_STRNEQ with startswith.
	* arc-dis.c (parse_option): Likewise.
	* arm-dis.c (parse_arm_disassembler_options): Likewise.
	* cris-dis.c (print_with_operands): Likewise.
	* h8300-dis.c (bfd_h8_disassemble): Likewise.
	* i386-dis.c (print_insn): Likewise.
	* ia64-gen.c (fetch_insn_class): Likewise.
	(parse_resource_users): Likewise.
	(in_iclass): Likewise.
	(lookup_specifier): Likewise.
	(insert_opcode_dependencies): Likewise.
	* mips-dis.c (parse_mips_ase_option): Likewise.
	(parse_mips_dis_option): Likewise.
	* s390-dis.c (disassemble_init_s390): Likewise.
	* wasm32-dis.c (parse_wasm32_disassembler_options): Likewise.
2021-03-22 11:01:43 +01:00
Kuan-Lin Chen
80d49d6a1b RISC-V : Support bitmanip-0.93 ZBA/ZBB/ZBC instructions
bfd/
	* elfxx-riscv.c (riscv_std_z_ext_strtab): Add zba, zbb and zbc.

gas/
	* config/tc-riscv.c (ext_version_table): Add b, zba, zbb and zbc.
	(riscv_multi_subset_supports): Add INSN_CLASS_ZB*.
	* testsuite/gas/riscv/b-ext-64.s: Bitmanip test case.
	* testsuite/gas/riscv/b-ext-64.d: Likewise.
	* testsuite/gas/riscv/b-ext.s: Likewise.
	* testsuite/gas/riscv/b-ext.d: Likewise.

include/
	* opcode/riscv-opc.h: Support zba, zbb and zbc extensions.
	* opcode/riscv.h (riscv_insn_class): Add INSN_CLASS_ZB*.

opcodes/
	* riscv-opc.c (riscv_opcodes): Add zba, zbb and zbc instructions.
2021-03-16 14:38:19 +08:00
Przemyslaw Wirkus
7fce7ea986 aarch64: Add few missing system registers
This patch adds few missing system registers to GAS: LORC_EL1,
LOREA_EL1, LORN_EL1, LORSA_EL1, ICC_CTLR_EL3, ICC_SRE_ELX, ICH_VTR_EL2.

gas/ChangeLog:

2021-03-02  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* testsuite/gas/aarch64/illegal-sysreg-7.d: New test.
	* testsuite/gas/aarch64/illegal-sysreg-7.l: New test.
	* testsuite/gas/aarch64/illegal-sysreg-7.s: New test.
	* testsuite/gas/aarch64/sysreg-7.d: New test.
	* testsuite/gas/aarch64/sysreg-7.s: New test.

opcodes/ChangeLog:

2021-03-02  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-opc.c: Add lorc_el1, lorea_el1, lorn_el1, lorsa_el1,
	icc_ctlr_el3, icc_sre_elx, ich_vtr_el2 system registers.
2021-03-12 14:20:46 +00:00
Alan Modra
78c84bf926 Re: x86: correct decoding of nop/reserved space (0f18 ... 0x1f)
* i386-dis.c (print_insn <PREFIX_IGNORED>): Correct typo.
2021-03-12 10:41:34 +10:30
Jan Beulich
fd1fd06186 x86: re-order logic in OP_XMM()
Instead of excluding an increasing number of modes in the initial if(),
check the special modes first.
2021-03-11 16:21:48 +01:00
Jan Beulich
ac7a231133 x86: drop a few redundant EVEX-related checks
vex.b can only be set when vex.evex is also set. Similarly vex.evex can
only be set when need_vex is also set.
2021-03-11 16:21:19 +01:00
Jan Beulich
da944c8a70 x86: remove stray uses of xmmq_mode
xmmq_mode is documented to not allow for broadcast - don't include it in
respective checks in OP_E_memory().
2021-03-11 16:20:37 +01:00
Jan Beulich
b763d508db x86/Intel: correct AVX512 S/G disassembly
Commit 6ff00b5e12 ("x86/Intel: correct permitted operand sizes for
AVX512 scatter/gather") brought the assembler side of AVX512 S/G insn
handling in line with AVX2's, but the disassembler side was forgotten.
This has the benefit of
- allowing to fold a number of table entries,
- rendering a few #define-s and enumerators unused.
2021-03-10 08:20:29 +01:00
Jan Beulich
32e31ad7da x86: re-arrange enumerator and table entry order
Some of the enumerators have ended up misplaced under the general
current ordering scheme. Move them (and their table entries) around
accordingly. Add a couple of blank lines as separators when close to
code being touched anyway. Also drop the odd 0F from 0FXOP (there's no
"0f" involved there anywhere) infixes where the respective enum gets
played with anyway.
2021-03-10 08:19:43 +01:00
Jan Beulich
85ba7507f6 x86: reuse further VEX entries for EVEX
When the VEX.L=1 decode matches that of both EVEX.L'L=1 and EVEX.L'L=2
(typically when all three are invalid) the (smaller) VEX table entry can
be reused by EVEX, instead of duplicating data. (Note that XM and XMM as
well as EXxmm_md and EXd are equivalent at least for the purposes here.)
2021-03-10 08:19:11 +01:00
Jan Beulich
066f82b96a x86: reuse VEX entries for EVEX vperm{q,pd}
By matching VEX decode order (L before W), some EVEX entries can refer
back to VEX ones instead of carrying duplicates.
2021-03-10 08:18:24 +01:00
Jan Beulich
fc681dd6a1 x86: re-arrange order of decode for various EVEX opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.

This also adds a PREFIX_DATA 7531c61332 ("x86: simplify decode of
opcodes valid with (embedded) 66 prefix only") missed to apply to
vbroadcastf64x4.
2021-03-10 08:16:54 +01:00
Jan Beulich
13954a3119 x86: re-arrange order of decode for various mask reg opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.
2021-03-10 08:16:24 +01:00
Jan Beulich
14d10c6ccc x86: re-arrange order of decode for various VEX opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.
2021-03-10 08:15:46 +01:00
Jan Beulich
00ec187565 x86: re-arrange order of decode for various legacy opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.
2021-03-10 08:15:10 +01:00
Jan Beulich
319419837c x86: correct decoding of nop/reserved space (0f18 ... 0x1f)
All encodings not used in this range are (reserved) NOPs. Hence their
decoding should be fully consistent. For this to work the PREFIX_IGNORED
logic needs slightly extending, such that the attribute will also
- have an effect when used inside prefix_table[], yet without always
  falling back to using slot 0,
- cause prefixes marked as ignored while decoding through prefix_table[]
  to no longer be considered decoded, when encountered in a subsequent
  decoding step.

In adjacent code also drop meaningless PREFIX_OPCODE.
2021-03-10 08:14:11 +01:00
Jan Beulich
742732c7f0 x86: fold some prefix related attributes into a single one
RepPrefixOk, HLEPrefixOk, and NoTrackPrefixOk can't be specified
together, so can share an enum-like field. IsLockable can be inferred
from HLE setting and hence only needs specifying when neither of them
is present.
2021-03-09 08:54:32 +01:00
Jan Beulich
e93a3b27b2 x86-64: make SYSEXIT handling similar to SYSRET's
Despite SYSEXIT being an Intel-only insn in long mode, its behavior
there is similar to SYSRET's: Depending on REX.W execution continues in
either 64-bit or compatibility mode. Hence distinguishing by suffix is
as necessary here as it is there.
2021-03-09 08:53:38 +01:00
Jan Beulich
75363b6d60 x86: infer operand count of templates
Having this count explicitly in the table is redundant and (even if just
slightly) disturbs clarity. Infer the count from the number of operands
actually found.

Also convert the "no operands" indicator from "{ 0 }" to just "{}", as
that (now) ends up being easier to parse.
2021-03-03 12:57:08 +01:00
Nelson Chu
5a9f5403c7 RISC-V: PR27158, fixed UJ/SB types and added CSS/CL/CS types for .insn.
* Renamed obsolete UJ/SB types and RVC types, also added CSS/CL(CS) types,

[VALID/EXTRACT/ENCODE macros]
BTYPE_IMM:            Renamed from SBTYPE_IMM.
JTYPE_IMM:            Renamed from UJTYPE_IMM.
CITYPE_IMM:           Renamed from RVC_IMM.
CITYPE_LUI_IMM:       Renamed from RVC_LUI_IMM.
CITYPE_ADDI16SP_IMM:  Renamed from RVC_ADDI16SP_IMM.
CITYPE_LWSP_IMM:      Renamed from RVC_LWSP_IMM.
CITYPE_LDSP_IMM:      Renamed from RVC_LDSP_IMM.
CIWTYPE_IMM:          Renamed from RVC_UIMM8.
CIWTYPE_ADDI4SPN_IMM: Renamed from RVC_ADDI4SPN_IMM.
CSSTYPE_IMM:          Added for .insn without special encoding.
CSSTYPE_SWSP_IMM:     Renamed from RVC_SWSP_IMM.
CSSTYPE_SDSP_IMM:     Renamed from RVC_SDSP_IMM.
CLTYPE_IMM:           Added for .insn without special encoding.
CLTYPE_LW_IMM:        Renamed from RVC_LW_IMM.
CLTYPE_LD_IMM:        Renamed from RVC_LD_IMM.
RVC_SIMM3:            Unused and removed.
CBTYPE_IMM:           Renamed from RVC_B_IMM.
CJTYPE_IMM:           Renamed from RVC_J_IMM.

* Added new operands and removed the unused ones,

C5: Unsigned CL(CS) immediate, added for .insn directive.
C6: Unsigned CSS immediate, added for .insn directive.
Ci: Unused and removed.
C<: Unused and removed.

bfd/
    PR 27158
    * elfnn-riscv.c (perform_relocation): Updated encoding macros.
    (_bfd_riscv_relax_call): Likewise.
    (_bfd_riscv_relax_lui): Likewise.
    * elfxx-riscv.c (howto_table): Likewise.
gas/
    PR 27158
    * config/tc-riscv.c (riscv_ip): Updated encoding macros.
    (md_apply_fix): Likewise.
    (md_convert_frag_branch): Likewise.
    (validate_riscv_insn): Likewise.  Also arranged operands, including
    added C5 and C6 operands, and removed unused Ci and C< operands.
    * doc/c-riscv.texi: Updated and added CSS/CL/CS types.
    * testsuite/gas/riscv/insn.d: Added CSS/CL/CS instructions.
    * testsuite/gas/riscv/insn.s: Likewise.
gdb/
    PR 27158
    * riscv-tdep.c (decode_ci_type_insn): Updated encoding macros.
    (decode_j_type_insn): Likewise.
    (decode_cj_type_insn): Likewise.
    (decode_b_type_insn): Likewise.
    (decode): Likewise.
include/
    PR 27158
    * opcode/riscv.h: Updated encoding macros.
opcodes/
    PR 27158
    * riscv-dis.c (print_insn_args): Updated encoding macros.
    * riscv-opc.c (MASK_RVC_IMM): defined to ENCODE_CITYPE_IMM.
    (match_c_addi16sp): Updated encoding macros.
    (match_c_lui): Likewise.
    (match_c_lui_with_hint): Likewise.
    (match_c_addi4spn): Likewise.
    (match_c_slli): Likewise.
    (match_slli_as_c_slli): Likewise.
    (match_c_slli64): Likewise.
    (match_srxi_as_c_srxi): Likewise.
    (riscv_insn_types): Added .insn css/cl/cs.
sim/
    PR 27158
    * riscv/sim-main.c (execute_i): Updated encoding macros.
2021-02-19 11:44:49 +08:00
Nelson Chu
3d73d29e4e RISC-V: Add bfd/cpu-riscv.h to support all spec versions controlling.
Make the opcode/riscv-opc.c and include/opcode/riscv.h tidy, move the
spec versions stuff to bfd/cpu-riscv.h.  Also move the csr stuff and
ext_version_table to gas/config/tc-riscv.c for internal use.  To avoid
too many repeated code, define general RISCV_GET_SPEC_NAME/SPEC_CLASS
macros.  Therefore, assembler/dis-assembler/linker/gdb can get all spec
versions related stuff from cpu-riscv.h and cpu-riscv.c, since the stuff
are defined there uniformly.

bfd/
    * Makefile.am: Added cpu-riscv.h.
    * Makefile.in: Regenerated.
    * po/SRC-POTFILES.in: Regenerated.
    * cpu-riscv.h: Added to support spec versions controlling.
    Also added extern arrays and functions for cpu-riscv.c.
    (enum riscv_spec_class): Define all spec classes here uniformly.
    (struct riscv_spec): Added for all specs.
    (RISCV_GET_SPEC_CLASS): Added to reduce repeated code.
    (RISCV_GET_SPEC_NAME): Likewise.
    (RISCV_GET_ISA_SPEC_CLASS): Added to get ISA spec class.
    (RISCV_GET_PRIV_SPEC_CLASS): Added to get privileged spec class.
    (RISCV_GET_PRIV_SPEC_NAME): Added to get privileged spec name.
    * cpu-riscv.c (struct priv_spec_t): Replaced with struct riscv_spec.
    (riscv_get_priv_spec_class): Replaced with RISCV_GET_PRIV_SPEC_CLASS.
    (riscv_get_priv_spec_name): Replaced with RISCV_GET_PRIV_SPEC_NAME.
    (riscv_priv_specs): Moved below.
    (riscv_get_priv_spec_class_from_numbers): Likewise, updated.
    (riscv_isa_specs): Moved from include/opcode/riscv.h.
    * elfnn-riscv.c: Included cpu-riscv.h.
    (riscv_merge_attributes): Initialize in_priv_spec and out_priv_spec.
    * elfxx-riscv.c: Included cpu-riscv.h and opcode/riscv.h.
    (RISCV_UNKNOWN_VERSION): Moved from include/opcode/riscv.h.
    * elfxx-riscv.h: Removed extern functions to cpu-riscv.h.
gas/
    * config/tc-riscv.c: Included cpu-riscv.h.
    (enum riscv_csr_clas): Moved from include/opcode/riscv.h.
    (struct riscv_csr_extra): Likewise.
    (struct riscv_ext_version): Likewise.
    (ext_version_table): Moved from opcodes/riscv-opc.c.
    (default_isa_spec): Updated type to riscv_spec_class.
    (default_priv_spec): Likewise.
    (riscv_set_default_isa_spec): Updated.
    (init_ext_version_hash): Likewise.
    (riscv_init_csr_hash): Likewise, also fixed indent.
include/
    * opcode/riscv.h: Moved stuff and make the file tidy.
opcodes/
    * riscv-dis.c: Included cpu-riscv.h, and removed elfxx-riscv.h.
    (default_priv_spec): Updated type to riscv_spec_class.
    (parse_riscv_dis_option): Updated.
    * riscv-opc.c: Moved stuff and make the file tidy.
2021-02-18 15:09:16 +08:00
Alan Modra
b9b204b311 read_leb128 overflow checking
There is a tiny error left in dwarf.c:read_leb128 after Nick fixed the
signed overflow problem in code I wrote.  It's to do with sleb128
values that have unnecessary excess bytes.  For example, -1 is
represented as 0x7f, the most efficient encoding, but also as
0xff,0x7f or 0xff,0xff,0x7f and so on.  None of these sequences
overflow any size signed value, but read_leb128 will report an
overflow given enough excess bytes.  This patch fixes that problem,
and since the proper test for signed values with excess bytes can
easily be adapted to also test a sleb byte with just some bits that
overflow the result, I changed the code to not use signed right
shifts.  (The C standard ISO/IEC 9899:1999 6.5.7 says signed right
shifts of negative values have an implementation defined value.  A
long time ago I even used a C compiler for a certain microprocessor
that always did unsigned right shifts.  Mind you, it is very unlikely
to be compiling binutils with such a compiler.)

bfd/
	* wasm-module.c: Guard include of limits.h.
	(CHAR_BIT): Provide backup define.
	(wasm_read_leb128): Use CHAR_BIT to size "result" in bits.
	Correct signed overflow checking.
opcodes/
	* wasm32-dis.c: Include limits.h.
	(CHAR_BIT): Provide backup define.
	(wasm_read_leb128): Use CHAR_BIT to size "result" in bits.
	Correct signed overflow checking.
binutils/
	* dwarf.c: Include limits.h.
	(CHAR_BIT): Provide backup define.
	(read_leb128): Use CHAR_BIT to size "result" in bits.  Correct
	signed overflow checking.
	* testsuite/binutils-all/pr26548.s,
	* testsuite/binutils-all/pr26548.d,
	* testsuite/binutils-all/pr26548e.d: New tests.
	* testsuite/binutils-all/readelf.exp: Run them.
	(readelf_test): Drop unused "xfails" parameter.  Update all uses.
2021-02-17 16:57:59 +10:30
Jan Beulich
394ae71f02 x86: CVTPI2PD has special behavior
CVTPI2PD with a memory operand, unlike CVTPI2PS, doesn't engage MMX
logic. Therefore it
- has a proper AVX equivalent (CVTDQ2PD) and hence can be subject to
  SSE2AVX translation and SSE checking,
- should not record MMX use in the respective ELF note.
2021-02-16 11:34:25 +01:00
Jan Beulich
b818b220e4 x86: have preprocessor expand macros
There's no point having i386-gen's set_bitfield() to handle any aliases,
now that we pass the opcode table through the C preprocessor anyway.
2021-02-16 11:27:40 +01:00
Andreas Krebbel
ba2b480f10 IBM Z: Implement instruction set extensions
opcodes/

        * s390-mkopc.c (main): Accept arch14 as cpu string.
        * s390-opc.txt: Add new arch14 instructions.

include/

        * opcode/s390.h (enum s390_opcode_cpu_val): Add
        S390_OPCODE_ARCH14.

gas/

        * config/tc-s390.c (s390_parse_cpu): New entry for arch14.
        * doc/c-s390.texi: Document arch14 march option.
        * testsuite/gas/s390/s390.exp: Run the arch14 related tests.
        * testsuite/gas/s390/zarch-arch14.d: New test.
        * testsuite/gas/s390/zarch-arch14.s: New test.
2021-02-15 14:32:17 +01:00
Nick Alcock
9514861402 bfd, opcodes, libctf: support --with-included-gettext
Right now, these libraries hardwire -L../intl -lintl on a few fixed
platforms, which works fine on those platforms but on other platforms
leads to shared libraries that lack libintl_* symbols when configured
--with-included-gettext, and/or static libraries that contain libintl as
*another* static library.  If we instead use the LIBINTL variable
defined in ../intl/config.intl, this gives us the right thing on all
three classes of platform (gettext in libc, gettext in system libintl,
gettext in ../intl/libintl.a)..  This also means we can rip out some
Darwin-specific machinery from configure.ac and also simplify the Cygwin
side.

This also means that the libctf testsuite (and other places that include
libbfd, libopcodes or libctf) don't need to grow libintl dependencies
just on account of those libraries (though they still need such
dependencies if they themselves use gettext machinery).

bfd/ChangeLog
2021-02-03  Nick Alcock  <nick.alcock@oracle.com>

	* configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
	favour of LIBINTL.
	* configure: Regenerated.

libctf/ChangeLog
2021-02-02  Nick Alcock  <nick.alcock@oracle.com>

	* configure.ac (CTF_LIBADD): Remove explicit -lintl population in
	favour of LIBINTL.
	* Makefile.am (libctf_nobfd_la_LIBADD): No longer explicitly
	include $(LIBINTL).
	(check-DEJAGNU): Pass down to tests as well.
	* configure: Regenerated.
	* Makefile.in: Likewise.

opcodes/ChangeLog
2021-02-04  Nick Alcock  <nick.alcock@oracle.com>

	* configure.ac (SHARED_LIBADD): Remove explicit -lintl population in
	favour of LIBINTL.
	* configure: Regenerated.
2021-02-10 15:26:57 +00:00
Mike Frysinger
bfd428bc12 opcodes: tic54x: namespace exported variables
The tic54x exports some fairly generic variable names that can
conflict with programs that use them, so put proper tic54x_
prefixes on all of them.
2021-02-08 18:26:08 -05:00
Nelson Chu
24075dcc85 RISC-V: Removed the v0.93 bitmanip ZBA/ZBB/ZBC instructions.
bfd/
    * elfxx-riscv.c (riscv_parse_prefixed_ext): Removed zb*.
gas/
    * config/tc-riscv.c (riscv_multi_subset_supports): Removed
    INSN_CLASS_ZB*.
    * testsuite/gas/riscv/bitmanip-insns-32.d: Removed.
    * testsuite/gas/riscv/bitmanip-insns-64.d: Removed.
    * testsuite/gas/riscv/bitmanip-insns.s: Removed.
include/
    * opcode/riscv-opc.h: Removed macros for zb* extensions.
    * opcode/riscv.h (riscv_insn_class): Removed INSN_CLASS_ZB*.
opcodes/
    * riscv-opc.c (MASK_RVB_IMM): Removed.
    (riscv_opcodes): Removed zb* instructions.
    (riscv_ext_version_table): Removed versions for zb*.
2021-02-04 16:52:13 +08:00
Alan Modra
c3ffb8f340 Segmentation fault i386-gen
A case of inst->next being uninitialised.

	* i386-gen.c (parse_template): Ensure entire template_instance
	is initialised.
2021-01-26 20:54:43 +10:30
Nelson Chu
1942a04836 RISC-V: Indent and GNU coding standards tidy, also aligned the code.
bfd/
    * elfnn-riscv.c: Indent, labels and GNU coding standards tidy,
    also aligned the code.
gas/
    * config/tc-riscv.c: Indent and GNU coding standards tidy,
    also aligned the code.
    * config/tc-riscv.h: Likewise.
include/
    * opcode/riscv.h: Indent and GNU coding standards tidy,
    also aligned the code.
opcodes/
    * riscv-opc.c (riscv_gpr_names_abi): Aligned the code.
    (riscv_fpr_names_abi): Likewise.
    (riscv_opcodes): Likewise.
    (riscv_insn_types): Likewise.
2021-01-15 17:41:18 +08:00
Nelson Chu
b800637e76 RISC-V: Error and warning messages tidy.
Error and warning messages usually starting with lower case letter,
and without the period at the end.  Besides, add the prefixed "internel:"
at the beginning of the messages when they are caused internally.
Also fix indents and typos.

bfd/
    * elfnn-riscv.c (riscv_merge_attributes): Fix typos of messages.
gas/
    * config/tc-riscv.c: Error and warning messages tidy.
    * testsuite/gas/riscv/priv-reg-fail-fext.l: Updated.
    * testsuite/gas/riscv/priv-reg-fail-read-only-01.l: Likewise.
    * testsuite/gas/riscv/priv-reg-fail-read-only-02.l: Likewise.
    * testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.
    * testsuite/gas/riscv/priv-reg-fail-version-1p10.l: Likewise.
    * testsuite/gas/riscv/priv-reg-fail-version-1p11.l: Likewise.
    * testsuite/gas/riscv/priv-reg-fail-version-1p9p1.l: Likewise.
ld/
    * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Updated.
    * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
    * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
    * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
    * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
    * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
opcodes/
    * riscv-dis.c (parse_riscv_dis_option): Fix typos of message.
2021-01-15 17:33:59 +08:00
Nelson Chu
dcd709e056 RISC-V: Comments tidy and improvement.
The GNU coding standards said the comments should be complete sentences
and end with a period and two spaces.  But sometimes it should be more
cleaner when the comments only include a word or codes.  Therefore, I made
the following changes after referring to other target/generic codes,

* Try to write sentences in comments, must end with a period and two spaces.
* End with two spaces without a period for codes/instructions only.
* End with one space without a period for a single word/variable only.

Besids, also rewrite/remove some comments which are obsolete or too long,
and fix indents for comments.

bfd/
    * elfnn-riscv.c: Comments tidy and improvement.
    * elfxx-riscv.c: Likewise.
    * elfxx-riscv.h: Likewise.
gas/
    * config/tc-riscv.c: Comments tidy and improvement.  Also update
    comment "fallthru" to "Fall through" that end with a period and
    two spaces.
include/
    * elf/riscv.h: Comments tidy and improvement.
    * opcode/riscv-opc.h: Likewise.
    * opcode/riscv.h: Likewise.
opcodes/
    * riscv-dis.c: Comments tidy and improvement.
    * riscv-opc.c: Likewise.
2021-01-15 17:28:07 +08:00
Alan Modra
5347ed60c5 Regen Makefile.in for jobserver.m4 aclocal.m4 dependency
bfd/
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
binutils/
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gas/
	* Makefile.in: Regenerate.
	* Makefile.in: Regenerate.
gprof/
	* Makefile.in: Regenerate.
ld/
	* Makefile.in: Regenerate.
libctf/
	* Makefile.in: Regenerate.
opcodes/
	* Makefile.in: Regenerate.
2021-01-13 22:06:02 +10:30
H.J. Lu
d546b61084 Implement a workaround for GNU mak jobserver
Compiling binutils using -flto=jobserver with GCC 11 leads to

libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2 -fprofile-generate -flto=jobserver -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o config/tc-i386.o config/obj-elf.o config/atof-ieee.o  ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a -L/tmp/binutils-gdb/objdir/zlib -lz ../libiberty/libiberty.a -ldl
lto-wrapper: warning: jobserver is not available: '--jobserver-auth=' is not present in 'MAKEFLAGS'

since the '+' is missing on the recipe line in Makefiles generated by
automake.  Add the '+' to the recipe line by hand.

bfd/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

binutils/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

config/

	PR binutils/26792
	* jobserver.m4: New file.

gas/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

gprof/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

ld/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

libctf/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

opcodes/

	PR binutils/26792
	* configure.ac: Use GNU_MAKE_JOBSERVER.
	* aclocal.m4: Regenerated.
	* configure: Likewise.
2021-01-12 05:45:44 -08:00
Nick Clifton
6d104cac0a Updated translations for some subdirectories 2021-01-12 13:18:50 +00:00
H.J. Lu
83b33c6cb9 Binutils: Check if AR works with --plugin and rc
Check if AR works with --plugin and rc before passing --plugin to AR and
RANLIB.

bfd/

	PR ld/27173

binutils/

	PR ld/27173
	* configure: Regenerated.

gas/

	PR ld/27173
	* configure: Regenerated.

gprof/

	PR ld/27173
	* configure: Regenerated.

ld/

	PR ld/27173
	* configure: Regenerated.

libctf/

	PR ld/27173
	* configure: Regenerated.

opcodes/

	PR ld/27173
	* configure: Regenerated.
2021-01-11 16:29:45 -08:00
Kyrylo Tkachov
82c70b08df aarch64: Remove support for CSRE
This patch removes support for the CSRE extension from aarch64
gas/objdump.
CSRE (FEAT_CSRE) is part of the Future Architecture Technologies program
and at this time Arm is withdrawing this particular feature.

The patch removes the system registers and the CSR PDEC instruction.

gas/ChangeLog
	* NEWS: Remove CSRE.
	* config/tc-aarch64.c (parse_csr_operand): Delete.
	(parse_operands): Delete handling of AARCH64_OPND_CSRE_CSR.
	(aarch64_features): Remove csre.
	* doc/c-aarch64.texi: Remove CSRE.
	* testsuite/gas/aarch64/csre.d: Delete.
	* testsuite/gas/aarch64/csre-invalid.s: Likewise.
	* testsuite/gas/aarch64/csre-invalid.d: Likewise.
	* testsuite/gas/aarch64/csre_csr.s: Likewise.
	* testsuite/gas/aarch64/csre_csr.d: Likewise.
	* testsuite/gas/aarch64/csre_csr-invalid.s: Likewise.
	* testsuite/gas/aarch64/csre_csr-invalid.l: Likewise.
	* testsuite/gas/aarch64/csre_csr-invalid.d: Likewise.

include/ChangeLog

	* opcode/aarch64.h (AARCH64_FEATURE_CSRE): Delete.
	(aarch64_opnd): Delete AARCH64_OPND_CSRE_CSR.

opcodes/ChangeLog

	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Likewise.
	* aarch64-opc-2.c: Likewise.
	* aarch64-opc.c (aarch64_print_operand): Delete handling of
	AARCH64_OPND_CSRE_CSR.
	* aarch64-tbl.h (aarch64_feature_csre): Delete.
	(CSRE): Likewise.
	(_CSRE_INSN): Likewise.
	(aarch64_opcode_table): Delete csr.
2021-01-11 15:01:09 +00:00
Nick Clifton
a8aa72b913 Updated translations for multiple subdirectories 2021-01-11 12:55:33 +00:00
H.J. Lu
a4966cd965 Binutils: Pass --plugin to AR and RANLIB
Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
build.

bfd/

	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gprof/

	* configure: Regenerated.

ld/

	* configure: Regenerated.

libctf/

	* configure: Regenerated.

opcodes/

	* configure: Regenerated.
2021-01-09 06:51:51 -08:00
Nick Clifton
573fe3fbc1 Change version number to 2.36.50 and regenerate files 2021-01-09 11:01:01 +00:00
Nick Clifton
055bc77a80 Add Changelog entries and NEWS entries for 2.36 branch 2021-01-09 10:40:28 +00:00
Peter Bergner
aae7fcb8d7 POWER10: Add Return-Oriented Programming instructions
POWER10 adds some return-oriented programming (ROP) instructions and
this patch adds support for them.  You will notice that they are enabled
for POWER8 and later, not just POWER10 and later.  This is on purpose.
This allows the instructions to be added to POWER8 binaries that can be
run on POWER8, POWER9 and POWER10 cpus.  On POWER8 and POWER9, these
instructions just act as nop's.

opcodes/
	* ppc-opc.c (insert_dw, (extract_dw): New functions.
	(DW, (XRC_MASK): Define.
	(powerpc_opcodes) <hashchk, hashchkp, hashst, haststp>: New mnemonics.
gas/
	* testsuite/gas/ppc/rop-checks.d,
	* testsuite/gas/ppc/rop-checks.l,
	* testsuite/gas/ppc/rop-checks.s,
	* testsuite/gas/ppc/rop.d,
	* testsuite/gas/ppc/rop.s: New tests.
	* testsuite/gas/ppc/ppc.exp: Run them.
2021-01-09 15:16:13 +10:30
Alan Modra
6430704567 configure regen
commit f478212851 did the regen by hand, missed a change in
ld/configure and didn't update line numbers.  Fix that, and an old
regen of ld/Makefile.in with the wrong automake.

bfd/
	* configure: Regenerate.
binutils/
	* configure: Regenerate.
gas/
	* configure: Regenerate.
gprof/
	* configure: Regenerate.
ld/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
libctf/
	* configure: Regenerate.
opcodes/
	* configure: Regenerate.
zlib/
	* configure: Regenerate.
2021-01-09 15:12:44 +10:30
Nick Clifton
ed20522215 Updated Swedish translation for the opcodes/ subdirectory 2021-01-08 11:56:01 +00:00
Nick Clifton
e84c871648 Fix places in the AArch64 opcodes library code where a call to assert() has side effects.
PR 27129
	* aarch64-dis.c (determine_disassembling_preference): Move call to
	aarch64_match_operands_constraint outside of the assertion.
	* aarch64-asm.c (aarch64_ins_limm_1): Remove call to assert.
	Replace with a return of FALSE.
2021-01-08 11:51:50 +00:00
Nick Clifton
fb932b57cb Treat the AArch64 register id_aa64mmfr2_el1 as a core system register.
PR 27139
	* aarch64-opc.c (aarch64_sys_regs): Treat id_aa64mmfr2_el1 as a
	core system register.
2021-01-08 11:29:43 +00:00
Samuel Thibault
f478212851 libtool.m4: update GNU/Hurd test from upstream. In upstream libtool, 47a889a4ca20 ("Improve GNU/Hurd support.") fixed detection of shlibpath_overrides_runpath, thus avoiding unnecessary relink. This backports it.
.	* libtool.m4: Match gnu* along other GNU systems.

*/ChangeLog:

	* configure: Re-generate.
2021-01-07 16:47:36 +00:00
Nick Clifton
1b0927db3c Updated French translation for the opcodes/ subdirectory. 2021-01-07 14:47:49 +00:00
Fredrik Noring
3b288c8e2e m68k: Require m68020up rather than m68000up for CHK.L instruction.
* m68k-opc.c (chkl): Change minimum architecture requirement to
	m68020.
2021-01-07 14:45:10 +00:00
Philipp Tomsich
aa881ecde4 RISC-V: Add pause hint instruction.
Add support for the pause hint instruction, as specified in the
Zihintpause extension.  The pause instruction is encoded as a
special form of a memory fence (which is available as part of the
base instruction set).  The chosen encoding does not mandate any
particular memory ordering and therefore is a true hint.

bfd/
    * elfxx-riscv.c (riscv_std_z_ext_strtab): Added zihintpause.
gas/
    * config/tc-riscv.c (riscv_multi_subset_supports): Added
    INSN_CLASS_ZIHINTPAUSE.
    * testsuite/gas/riscv/pause.d: New testcase.  Adding coverage for
    the pause hint instruction.
    * testsuite/gas/riscv/pause.s: Likewise.
include/
    * opcode/riscv-opc.h: Added MATCH_PAUSE, MASK_PAUSE and DECLARE_INSN
    for pause hint instruction.
    * opcode/riscv.h (enum riscv_insn_class): Added INSN_CLASS_ZIHINTPAUSE.
opcodes/
    * riscv-opc.c (riscv_opcodes): Add pause hint instruction.
2021-01-07 16:45:43 +08:00
Claire Xenia Wolf
2652cfad8d RISC-V: Support riscv bitmanip frozen ZBA/ZBB/ZBC instructions (v0.93).
In fact rev8/orc.b/zext.h are the aliases of grevi/gorci/pack[w], so we
should update them to INSN_ALIAS when we have supported their true instruction
in the future.  Though we still use the [MATCH|MAKS]_[GREVI|GORCI|PACK|PACKW]
to encode them.  Besides, the orc.b has the same encoding both in rv32 and
rv64, so we just keep one of them in the opcode table.

This patch is implemented according to the following link,
https://github.com/riscv/riscv-bitmanip/pull/101

2021-01-07  Claire Xenia Wolf  <claire@symbioticeda.com>
            Jim Wilson  <jimw@sifive.com>
            Andrew Waterman  <andrew@sifive.com>
            Maxim Blinov  <maxim.blinov@embecosm.com>
            Kito Cheng  <kito.cheng@sifive.com>
            Nelson Chu  <nelson.chu@sifive.com>

bfd/
    * elfxx-riscv.c (riscv_std_z_ext_strtab): Added zba, zbb and zbc.
gas/
    * config/tc-riscv.c (riscv_multi_subset_supports): Handle INSN_CLASS_ZB*.
    (riscv_get_default_ext_version): Do not check the default_isa_spec when
    the version defined in the riscv_opcodes table is ISA_SPEC_CLASS_DRAFT.
    * testsuite/gas/riscv/bitmanip-insns-32.d: New testcase.
    * testsuite/gas/riscv/bitmanip-insns-64.d: Likewise.
    * testsuite/gas/riscv/bitmanip-insns.s: Likewise.
include/
    * opcode/riscv-opc.h: Added MASK/MATCH/DECLARE_INSN for ZBA/ZBB/ZBC.
    * opcode/riscv.h (riscv_insn_class): Added INSN_CLASS_ZB*.
    (enum riscv_isa_spec_class): Added ISA_SPEC_CLASS_DRAFT for the
    frozen extensions.
opcodes/
    * riscv-opc.c (riscv_opcodes): Add ZBA/ZBB/ZBC instructions.
    (MASK_RVB_IMM): Used for rev8 and orc.b encoding.
2021-01-07 11:44:54 +08:00
Alan Modra
f9a6a8f09d PR27116, Spelling errors found by Debian style checker
PR 27116
bfd/
	* xcofflink.c: Correct spelling in comments.
binutils/
	* coffgrok.c (do_type): Correct spelling of auxiliary in errors.
	* doc/binutils.texi: Correct grammar.
	* readelf.c (process_version_sections): Correct spelling of auxiliary
	in warning.
	* testsuite/binutils-all/vax/objdump.exp: Comment grammar fix.
config/
	* override.m4: Correct comment grammar.
gas/
	* config/tc-i386.c: Correct comment spelling.
	* config/tc-riscv.c: Likewise.
	* config/tc-s390.c: Correct comment grammar.
	* doc/c-i386.texi: Correct spelling.
	* doc/c-s390.texi: Correct grammar.
gold/
	* tilegx.cc: Correct comment spelling.
gprof/
	* README: Correct grammar.
	* gprof.texi: Likewise.
include/
	* coff/internal.h: Correct comment spelling.
	* coff/sym.h: Likewise.
	* opcode/aarch64.h: Likewise.
ld/
	* configure.tgt: Correct comment grammar.
	* emultempl/m68hc1xelf.em: Likewise.
	* ld.texi: Correct grammar.
2021-01-01 14:36:35 +10:30
Alan Modra
250d07de5c Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
Alan Modra
c2795844e6 ChangeLog rotation 2021-01-01 10:31:02 +10:30
Nelson Chu
c2137f55ad RISC-V: Add sext.[bh] and zext.[bhw] pseudo instructions.
https://github.com/riscv/riscv-asm-manual/pull/61

We aleady have sext.w, so just add sext.b, sext.h, zext.b, zext.h
and zext.w.  In a certain sense, zext.b is not a pseudo - It is an
alias of andi.  Similarly, sext.b and sext.h are aliases of other
rvb instructions, when we enable b extension; But they are pseudos
when we just enable rvi.  However, this patch does not consider the
rvb cases.  Besides, zext.w is only valid in rv64.

gas/
    * config/tc-riscv.c (riscv_ext): New function.  Use md_assemblef
    to expand the zext and sext pseudos, to give them a chance to be
    expanded into c-ext instructions.
    (macro): Handle M_ZEXTH, M_ZEXTW, M_SEXTB and M_SEXTH.
    * testsuite/gas/riscv/ext.s: New testcase.
    * testsuite/gas/riscv/ext-32.d: Likewise.
    * testsuite/gas/riscv/ext-64.d: Likewise.
include/
    * opcode/riscv.h (M_ZEXTH, M_ZEXTW, M_SEXTB, M_SEXTH.): Added.
opcodes/
    * riscv-opc.c (riscv_opcodes): Add sext.[bh] and zext.[bhw].
2020-12-10 10:50:44 +08:00
Nelson Chu
8152e0407c RISC-V: Dump CSR according to the elf privileged spec attributes.
opcodes/
    * disassemble.h (riscv_get_disassembler): Declare.
    * disassemble.c (disassembler): Changed to riscv_get_disassembler.
    * riscv-dis.c (riscv_get_disassembler): Check the elf privileged spec
    attributes before calling print_insn_riscv.
    (parse_riscv_dis_option): Same as the assembler, the priority of elf
    attributes are higher than the options.  If we find the privileged
    attributes, but the -Mpriv-spec= is different, then output error/warning
    and still use the elf attributes set.
2020-12-10 10:43:18 +08:00
Nelson Chu
729a53530e RISC-V: Control fence.i and csr instructions by zifencei and zicsr.
bfd/
    * elfxx-riscv.c (riscv_ext_dont_care_version): New function.  Return
    TRUE if we don't care the versions of the extensions.  These extensions
    are added to the subset list for special purposes, with the explicit
    versions or the RISCV_UNKNOWN_VERSION versions.
    (riscv_parse_add_subset): If we do care the versions of the extension,
    and the versions are unknown, then report errors for the non-implicit
    extensions, and return directly for the implicit one.
    (riscv_arch_str1): Do not output i extension after e, and the extensions
    which versions are unknown.
gas/
    * config/tc-riscv.c (riscv_multi_subset_supports): Handle INSN_CLASS_ZICSR
    and INSN_CLASS_ZIFENCEI.
    * testsuite/gas/riscv/march-imply-i.s: New testcase.
    * testsuite/gas/riscv/march-imply-i2p0-01.d: New testcase.  The version
    of i is less than 2.1, and zi* are supported in the chosen spec, so
    enable the fence.i and csr instructions, also output the implicit zi* to
    the arch string.
    * testsuite/gas/riscv/march-imply-i2p0-02.d: Likewise, but the zi* are
    not supported in the spec 2.2.  Enable the related instructions since
    i's version is less than 2.1, but do not output them.
    * testsuite/gas/riscv/march-imply-i2p1-01.d: New testcase.  The version
    of i is 2.1, so don't add it's implicit zi*, and disable the related
    instructions.
    * testsuite/gas/riscv/march-imply-i2p1-01.l: Likewise.
    * testsuite/gas/riscv/march-imply-i2p1-02.d: Likewise, and set the zi*
    explicitly, so enable the related instructions.
    * testsuite/gas/riscv/march-imply-i2p0.d: Removed.
    * testsuite/gas/riscv/march-imply-i2p1.d: Removed.
include/
    * opcode/riscv.h: Add INSN_CLASS_ZICSR and INSN_CLASS_ZIFENCEI.
opcodes/
    * riscv-opc.c (riscv_opcodes): Control fence.i and csr instructions by
    zifencei and zicsr.
2020-12-10 10:37:43 +08:00
Andreas Krebbel
c524d11e50 IBM Z: Add risbgz and risbgnz extended mnemonics
These two extended mnemonics are documented in the Principles of
Operations manual but currently not supported by Binutils. They
provide aliases for already supported instructions with the zero flag
being set.  The flag otherwise is mingled into one of the immediate
operands what makes asm code much harder to read.

opcodes/

	* s390-opc.txt: Add risbgz and risbgnz.
	* s390-opc.c (U6_26): New operand type.
	(INSTR_RIE_RRUUU2, MASK_RIE_RRUUU2): New instruction format and
	mask.

gas/

	* testsuite/gas/s390/zarch-z10.s: Add tests for risbgz.
	* testsuite/gas/s390/zarch-z10.d: Add regexp for risbgz.
	* testsuite/gas/s390/zarch-zEC12.s: Add tests for risbgnz.
	* testsuite/gas/s390/zarch-zEC12.d: Add regexp for risbgnz.
2020-12-04 09:14:02 +01:00
Andreas Krebbel
b10b530a45 IBM Z: Add support for HLASM extended mnemonics
Add extended mnemonics used in the HLASM assembler.  All of them are
just aliases for instructions we already support and help when
assembling code which was written for the HLASM assembler.

The HLASM mnemonics are documented here:
https://www.ibm.com/support/knowledgecenter/SSENW6_1.6.0/com.ibm.hlasm.v1r6.asm/asmr1023.pdf

See the 'Branching with extended mnemonic codes' chapter.

objdump will still print the existing mnemonics with the exception of
relative nop branches (i.e. conditional branches with an empty
condition code mask).  Now we have jnop and jgnop which will be used
by objdump when possible.

The same change have been applied to the LLVM assembler:
https://reviews.llvm.org/D92185

opcodes/

	* s390-opc.txt: Add extended mnemonics.

gas/

	* testsuite/gas/s390/esa-g5.s: Test new extended mnemonics.
	* testsuite/gas/s390/esa-g5.d: Likewise.
	* testsuite/gas/s390/esa-z900.s: Likewise.
	* testsuite/gas/s390/esa-z900.d: Likewise.
	* testsuite/gas/s390/zarch-z900.s: Likewise.
	* testsuite/gas/s390/zarch-z900.d: Likewise.

ld/

	* testsuite/ld-s390/tlsbin_64.dd: The newly added jgnop mnemonic
	replaces long relative branches with empty condition code mask.
2020-12-03 16:51:12 +01:00
Nelson Chu
27a46348cb RISC-V: Remove the unimplemented extensions.
Although spec had defined and ratified p, v and n extensions,
but we don't have any related implementaitons so far, so keep
them in the supported extension table looks weird.  Remove them
until we have the related implementations.

	opcodes/
	* riscv-opc.c (riscv_ext_version_table): Remove the p, v, n
	and their versions.
2020-12-01 15:13:06 +08:00
Nelson Chu
5a1b31e1e1 RISC-V: Add zifencei and prefixed h class extensions.
bfd/
	* elfxx-riscv.c (riscv_parse_std_ext): Stop parsing standard
	extensions when parsed h keyword.
	(riscv_get_prefix_class): Support prefixed h class.
	(riscv_std_h_ext_strtab): Likewise.
	(riscv_ext_h_valid_p): Likewise.
	(parse_config): Likewise.
	(riscv_std_z_ext_strtab): Add zifencei.
	* elfxx-riscv.h (riscv_isa_ext_class): Add RV_ISA_CLASS_H.

	gas/
	* testsuite/gas/riscv/march-fail-order-z.d: New testcase, check
	orders of prefixed z extensions.
	* testsuite/gas/riscv/march-fail-order-z.l: Likewise.
	* testsuite/gas/riscv/march-fail-single-char-h.d: New testcase.
	* testsuite/gas/riscv/march-fail-single-char.l: Updated.
	* testsuite/gas/riscv/march-fail-unknown-h.d: New testcase.
	* testsuite/gas/riscv/march-fail-unknown.l: Updated.

	opcodes/
	* riscv-opc.c (riscv_ext_version_table): Add zifencei.
2020-12-01 15:11:30 +08:00
Borislav Petkov
632ee6fd82 x86: Do not dump DS/CS segment overrides for branch hints
The previous change

  "x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode"

to ignore segment override prefixes in 64-bit mode lead to dumping
branch hints as excessive prefixes:

  ffffffff8109d5a0 <vmx_get_rflags>:
  ...
  ffffffff8109d601:       3e 77 0a                ds ja,pt ffffffff8109d60e <vmx_get_rflags+0x6e>
  						^^^^^

In this particular case, those prefixes are not excessive but are used
to provide branch hints - taken/not-taken - to the CPU.

Assign active_seg_prefix in that particular case to consume them.

gas/

2002-11-29  Borislav Petkov  <bp@suse.de>

        * testsuite/gas/i386/branch.d: Add new branch insns test.
        * testsuite/gas/i386/branch.s: Likewise.
        * testsuite/gas/i386/i386.exp: Insert the new branch test.
        * testsuite/gas/i386/x86-64-branch.d: Test for branch hints insns.
        * testsuite/gas/i386/x86-64-branch.s: Likewise.
        * testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise.

opcodes/

2020-11-28 Borislav Petkov  <bp@suse.de>

        * i386-dis.c (print_insn): Set active_seg_prefix for branch hint insns
        to not dump branch hint prefixes 0x2E and 0x3E as unused prefixes.
2020-11-29 09:08:56 -08:00
Przemyslaw Wirkus
e64441b14c aarch64: Extract Condition flag manipulation feature from Armv8.4-A
Extract FLAGM (Condition flag manipulation) feature from Armv8.4-A.
Please note that FLAGM stays a Armv8.4-A feature but now can be
assigned to other architectures or CPUs.

New -march option +flagm is added to enable independently this
feature.
2020-11-16 21:07:17 +00:00
Borislav Petkov
0fa0fc8539 x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode
"In 64-bit mode, the CS, DS, ES, and SS segment-override prefixes have
no effect. These four prefixes are not treated as segment-override
prefixes for the purposes of multiple-prefix rules. Instead, they are
treated as null prefixes." (AMD APM v2).

However, objdump disassembles instructions containing those ignored
prefixes by still generating that segment override:

  66 66 2e 0f 1f 84 00 	data16 nopw %cs:0x0(%rax,%rax,1)
  00 00 00 00

Print those segment override prefixes as excessive ones:

  66 66 2e 0f 1f 84 00    data16 cs nopw 0x0(%rax,%rax,1)
  00 00 00 00

which is what they actually are - they have no effect and the decoding
hardware ignores them.

gas/

2020-11-14  Borislav Petkov  <bp@suse.de>

	* testsuite/gas/i386/x86-64-segovr.d: Adjust regexes.
	* testsuite/gas/i386/x86-64-nops.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-1.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-2.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-3.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-4.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-5.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise.
	* testsuite/gas/i386/x86-64-nops-7.d: Likewise.
	* testsuite/gas/i386/x86-64-nop-1.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-6.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-7.d: Likewise.
	* testsuite/gas/i386/x86-64-align-branch-8.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-1.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-2.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-3.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-4.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops-5.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-nops.d:: Likewise.

ld/

2020-11-14  Borislav Petkov  <bp@suse.de>

	* testsuite/ld-x86-64/pe-x86-64-4.od: Adjust regexes.
	* testsuite/ld-x86-64/tlsld3.dd: Likewise.
	* testsuite/ld-x86-64/tlsld4.dd: Likewise.

opcodes/

2020-11-14  Borislav Petkov  <bp@suse.de>

	* i386-dis.c (ckprefix): Do not assign active_seg_prefix in
	64-bit addressing mode.
	(NOTRACK_Fixup): Test prefixes for PREFIX_DS, instead of
	active_seg_prefix.
2020-11-14 06:20:33 -08:00
Przemyslaw Wirkus
f27c0b449f aarch64: Allow LS64 feature with Armv8.6
Allow users to use LS64 extension with Armv8.6 architecture.
2020-11-11 15:30:21 +00:00
Spencer E. Olson
9372689d72 Add support for the LMBD (left-most bit detect) instruction to the PRU assembler.
include	* opcode/pru.h: Add LMBD (left-most bit detect) opcode index
opcodes * pru-opc.c: Add opcode description for LMBD (left-most bit detect)
gas 	* testsuite/gas/pru/misc.s: Add tests for lmbd (left-most bit detect)
 	* testsuite/gas/pru/misc.d: Add tests for lmbd (left-most bit
2020-11-09 12:41:09 +00:00
Przemyslaw Wirkus
4a3e3e2282 aarch64: Update LS64 feature with system register
This patch:
+ Adds new ACCDATA_EL1 (Accelerator Data) system register, see [0].
+ Adds LS64 instruction tests.
+ Update LS64 feature test with new register.
+ Fix comment for AARCH64_OPND_Rt_LS64.

    [0] https://developer.arm.com/docs/ddi0595/i/aarch64-system-registers/accdata_el1

Note: as this is register only extension we do not want to hide these
registers behind -march flag going forward (they should be enabled by
default).
2020-11-09 11:37:32 +00:00
Przemyslaw Wirkus
8edca81ece aarch64: Limit Rt register number for LS64 load/store instructions
Atomic 64-byte load/store instructions limit Rt register number to
values matching below condition (register <Xt> number must be even
and <= 22):

    if Rt<4:3> == '11' || Rt<0> == '1' then UNDEFINED;

This patch adds check if Rt fulfills above requirement.

For more details regarding atomic 64-byte load/store instruction for
Armv8.7 please refer to Arm A64 Instruction set documentation for
Armv8-A architecture profile, see document page 157 for load
instruction, and pages 414-418 for store instructions of [0].

    [0]: https://developer.arm.com/docs/ddi0596/i
2020-11-09 11:19:44 +00:00
Przemyslaw Wirkus
af1bd771fc aarch64: Extract Pointer Authentication feature from Armv8.3-A
Extract PAC (Pointer Authentication) feature from Armv8.3-A.
Please note that PAC stays a Armv8.3-A feature but now can be
assigned to other architectures or CPUs.
2020-11-06 13:14:14 +00:00
Przemyslaw Wirkus
55cc012834 aarch64: Update feature RAS system registers
This patch:
+ updates RAS feature system registers with new RAS 1.1 regs.
+ extends RAS/RAS 1.1 support for all architecture levels of Armv8-A.

Please note that early Armv8-A architectures do not officially support RAS
extension.

Rationale of the patch:
To ease development so that user-friendly RAS system registers operands can be
used. Certain use cases require developers to enable only more generic
architecture (e.g. -march=armv8-a) during system development. Users must use
RAS extension registers bearing in mind that system they use must support it.

The RAS (Reliability, Availability, Serviceability) extension is a
system-level extension that defines a number of system registers.

RAS 1.1 (FEAT_RASv1p1) introduces five new system registers:
ERXPFGCTL_EL1, ERXPFGCDN_EL1, ERXMISC2_EL1, ERXMISC3_EL1 and
ERXPFGF_EL1.

For details see [0].

[0] https://developer.arm.com/docs/ddi0595/i/
2020-11-04 20:54:13 +00:00
Przemyslaw Wirkus
fd65497db4 [PATCH][GAS] aarch64: Add atomic 64-byte load/store instructions for Armv8.7
Armv8.7 architecture introduces the "accelerator extension", aka
load/store of 64 bytes. New atomic load/store instructions are: LD64B,
ST64B, ST64BV and ST64BV0.

This patch adds:
+ New feature +ls64 to -march command line.
+ New atomic load/store instructions associated with above feature.

For more details regarding atomic 64-byte load/store instruction for
Armv8.7 please refer to Arm A64 Instruction set documentation for
Armv8-A architecture profile, see document page 157 for load
instruction, and pages 414-418 for store instructions of [0].

    [0]: https://developer.arm.com/docs/ddi0596/i
2020-11-03 14:29:31 +00:00
Przemyslaw Wirkus
3a959875ea [PATCH] aarch64: Update missing ChangeLog for AArch64 commits
Patch with missing ChangeLog entries for GAS AArch64 files.
2020-11-03 11:55:14 +00:00
Przemyslaw Wirkus
a984d94aab [PATCH][GAS] aarch64: Add WFIT instruction for Armv8.7-a
This patch adds new to Armv8.7 WFIT instruction which take one operand:

    WFIT <Xt>

Where:
    <Xt> is 64-bit name of the general-purpose source register, encoded in the
         "Rd" field.

For more details regarding WFIT (Wait For Interrupt with Timeout) instruction for
Armv8.7-a please refer to Arm A64 Instruction set documentation for Armv8-A
architecture profile, see document pages 570 of [0].

	[0]: https://developer.arm.com/docs/ddi0596/i

gas/ChangeLog:

2020-10-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Update docs.
	* testsuite/gas/aarch64/system-5.d: Update test with WFIT insn.
	* testsuite/gas/aarch64/system-5.s: Update test with WFIT insn.

opcodes/ChangeLog:

2020-10-30  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-tbl.h (struct aarch64_opcode): New instruction WFIT.
	* aarch64-asm-2.c: Regenerated.
	* aarch64-dis-2.c: Regenerated.
	* aarch64-opc-2.c: Regenerated.
2020-10-30 10:31:38 +00:00
Przemyslaw Wirkus
dd4a72c859 aarch64: Add CSR PDEC instruction
This patch adds:
+ New feature +csre to -march command line.
+ New instruction CSR PDEC associated with CSRE feature.

Please note that CSRE system registers were already upstreamed. This patch
should finalize CSRE feature implementation.

CSRE feature adds CSR PDEC (Decrements Call stack pointer by the size of
a Call stack record) instruction. Although this instruction has operand
(PDEC) it's instruction's only operand. PDEC forces instruction field Rt
to be set to 0b1111. This results in fixed opcode of the instruction.

gas/ChangeLog:

2020-10-27  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Update docs.
	* config/tc-aarch64.c (parse_csr_operand): New operand parser.
	(parse_operands): Call to CSR operand parser.
	* testsuite/gas/aarch64/csre_csr-invalid.d: New test.
	* testsuite/gas/aarch64/csre_csr-invalid.l: New test.
	* testsuite/gas/aarch64/csre_csr-invalid.s: New test.
	* testsuite/gas/aarch64/csre_csr.d: New test.
	* testsuite/gas/aarch64/csre_csr.s: New test.

include/ChangeLog:

2020-10-27  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_CSRE): New -march feature.
	(enum aarch64_opnd): New CSR instruction field AARCH64_OPND_CSRE_CSR.

opcodes/ChangeLog:

2020-10-27  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-opc.c (aarch64_print_operand): CSR PDEC operand print-out.
	* aarch64-tbl.h (CSRE): New CSRE feature handler.
	(_CSRE_INSN): New CSRE instruction type.
	(struct aarch64_opcode): New 'csre' entry for a CSRE CLI feature.
	* aarch64-asm-2.c: Regenerated.
	* aarch64-dis-2.c: Regenerated.
	* aarch64-opc-2.c: Regenerated.
2020-10-28 14:19:42 +00:00
Przemyslaw Wirkus
82503ca7ed aarch64: Add WFET instruction for Armv8.7-a
This patch adds new to Armv8.7 WFET instruction which take one operand:

    WFET <Xt>

Where:
    <Xt> is 64-bit name of the general-purpose source register, encoded in the
         "Rd" field.

For more details regarding WFET (Wait For Event with Timeout) instruction for
Armv8.7-a please refer to Arm A64 Instruction set documentation for Armv8-A
architecture profile, see document pages 565 of [0].

	[0]: https://developer.arm.com/docs/ddi0596/i

gas/ChangeLog:

2020-10-27  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Update docs.
	* testsuite/gas/aarch64/system-5.d: New test.
	* testsuite/gas/aarch64/system-5.s: New test.

opcodes/ChangeLog:

2020-10-27  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-tbl.h (struct aarch64_opcode): Add new WFET instruction encoding
	and operand description.
	* aarch64-asm-2.c: Regenerated.
	* aarch64-dis-2.c: Regenerated.
	* aarch64-opc-2.c: Regenerated.
2020-10-28 14:12:37 +00:00
Przemyslaw Wirkus
fd195909ce aarch64: Add DSB instruction Armv8.7-a variant
This patch adds new variant (nXS) of DSB memory barrier instruction
available in Armv8.7-a. New nXS variant has different encoding in
comparison with pre Armv8.7-a DSB memory barrier variant thus new
instruction and new operand was added.

DSB memory nXS barrier variant specifies the limitation on the barrier
operation. Allowed values are:

	DSB SYnXS|#28
	DSB ISHnXS|#24
	DSB NSHnXS|#20
	DSB OSHnXS|#16

Please note that till now,  for barriers, barrier operation was encoded in
4-bit unsigned immediate CRm field (in the range 0 to 15).
For DSB memory nXS barrier variant, barrier operation is a 5-bit unsigned
assembly instruction immediate, encoded in instruction in two bits CRm<3:2>:

		CRm<3:2>  #imm
		  00       16
		  01       20
		  10       24
		  11       28

This patch extends current AArch64 barrier instructions with above mapping.

Notable patch changes include:
+ New DSB memory barrier variant encoding for Armv8.7-a.
+ New operand BARRIER_DSB_NXS for above instruction in order to
distinguish between existing and new DSB instruction flavour.
+ New set of DSB nXS barrier options.
+ New instruction inserter and extractor map between instruction
immediate 5-bit value and 2-bit CRm field of the instruction itself (see
FLD_CRm_dsb_nxs).
+ Regeneration of aarch64-[asm|dis|opc]-2.c files.
+ Test cases to cover new instruction assembling and disassembling.

For more details regarding DSB memory barrier instruction and its
Armv8.7-a flavour please refer to Arm A64 Instruction set documentation
for Armv8-A architecture profile, see document pages 132-133 of [0].

	[0]: https://developer.arm.com/docs/ddi0596/i

gas/ChangeLog:

2020-10-23  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Docs update.
	* config/tc-aarch64.c (parse_operands): Add
	AARCH64_OPND_BARRIER_DSB_NXS handler.
	(md_begin): Add content of aarch64_barrier_dsb_nxs_options to
	aarch64_barrier_opt_hsh hash.
	* testsuite/gas/aarch64/system-4-invalid.d: New test.
	* testsuite/gas/aarch64/system-4-invalid.l: New test.
	* testsuite/gas/aarch64/system-4-invalid.s: New test.
	* testsuite/gas/aarch64/system-4.d: New test.
	* testsuite/gas/aarch64/system-4.s: New test.

include/ChangeLog:

2020-10-23  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* opcode/aarch64.h (enum aarch64_opnd): New operand
	AARCH64_OPND_BARRIER_DSB_NXS.
	(aarch64_barrier_dsb_nxs_options): Declare DSB nXS options.

opcodes/ChangeLog:

2020-10-23  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-asm.c (aarch64_ins_barrier_dsb_nxs): New inserter.
	* aarch64-asm.h (AARCH64_DECL_OPD_INSERTER): New inserter
	ins_barrier_dsb_nx.
	* aarch64-dis.c (aarch64_ext_barrier_dsb_nxs): New extractor.
	* aarch64-dis.h (AARCH64_DECL_OPD_EXTRACTOR): New extractor
	ext_barrier_dsb_nx.
	* aarch64-opc.c (aarch64_print_operand): New options table
	aarch64_barrier_dsb_nxs_options.
	* aarch64-opc.h (enum aarch64_field_kind): New field name FLD_CRm_dsb_nxs.
	* aarch64-tbl.h (struct aarch64_opcode): Define DSB nXS barrier
	Armv8.7-a instruction.
	* aarch64-asm-2.c: Regenerated.
	* aarch64-dis-2.c: Regenerated.
	* aarch64-opc-2.c: Regenerated.
2020-10-28 14:05:05 +00:00
Przemyslaw Wirkus
8926e54e3a aarch64: Add basic support for armv8.7-a architecture
This patch adds support for AArch64 -march=armv8.7-a command line option
in GAS.

Please note that this change ONLY extends -march= command line interface
with a new "armv8.7-a" option. Architectural changes like new instructions
will be added in following patches.

gas/ChangeLog:

2020-10-16  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Docs update.
	* config/tc-aarch64.c (armv8.7-a): New arch.
	* doc/c-aarch64.texi (-march=armv8.7-a): Update docs.

include/ChangeLog:

2020-10-16  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_V8_7): New feature bitmask.
	(AARCH64_ARCH_V8_7): New arch feature set.

opcodes/ChangeLog:

2020-10-16  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-tbl.h (ARMV8_7): New macro.
2020-10-28 13:58:17 +00:00
Cooper Qu
eae61d61e9 CSKY: Change plsl.u16 to plsl.16.
gas/
	* testsuite/gas/csky/enhance_dsp.s : Change plsl.u16 to plsl.16.
	* testsuite/gas/csky/enhance_dsp.d : Change plsl.u16 to plsl.16.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Change plsl.u16 to plsl.16.

Change-Id: Ifb43573192e215527355f6541365b9f6a8ec80a4
2020-10-26 16:26:32 +08:00
Cooper Qu
039dac293d CSKY: Fix and add some instructions for VDSPV1.
gas/
	* config/tc-csky.c (get_operand_value): Add handler for
	OPRND_TYPE_IMM5b_VSH and OPRND_TYPE_VREG_WITH_INDEX.
	* testsuite/gas/csky/csky_vdsp.d : Fix the disassembling
	for vector register.

opcodes/
	* csky-dis.c (csky_output_operand): Add handler for
	OPRND_TYPE_IMM5b_VSH and OPRND_TYPE_VREG_WITH_INDEX.
	* csky-opc.h (OPRND_TYPE_VREG_WITH_INDEX): New enum.
	(OPRND_TYPE_IMM5b_VSH): New enum.
	(csky_v2_opcodes): Fix and add some instructions for VDSPV1.

Change-Id: Ia5675d7b716fe5c331e6121ad8f83061ef6454bb
2020-10-26 16:13:55 +08:00
Cui,Lili
069ef16480 Change avxvnni disassembler output from {vex3} to {vex}
gas/

	* testsuite/gas/i386/avx-vnni.d: Change psuedo prefix from
	{vex3} to {vex}
	* testsuite/gas/i386/x86-64-avx-vnni.d: Likewise.

opcodes/

	* i386-dis.c: Change "XV" to print "{vex}" pseudo prefix.
2020-10-26 10:51:55 +08:00
Przemyslaw Wirkus
6278c6a663 [PATCH][GAS][AArch64] Define BRBE system registers
This patch introduces BRBE (Branch Record Buffer Extension) system
registers.

Note: as this is register only extension we do not want to hide these
registers behind -march flag going forward (they should be enabled by
default).

gas/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Docs update.
	* testsuite/gas/aarch64/brbe-invalid.d: New test.
	* testsuite/gas/aarch64/brbe-invalid.l: New test.
	* testsuite/gas/aarch64/brbe-invalid.s: New test.
	* testsuite/gas/aarch64/brbe.d: New test.
	* testsuite/gas/aarch64/brbe.s: New test.

opcodes/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-opc.c: Add BRBE system registers.
2020-10-22 15:17:35 +01:00
Przemyslaw Wirkus
5feaa09bec aarch64: Define CSRE system registers
This patch introduces CSRE (Call Stack Recorder Extension) system
registers.

Note: as this is register only extension we do not want to hide these
registers behind -march flag going forward (they should be enabled by
default).

CSRE feature adds CSR PDEC (Decrements Call stack pointer by the size
of a Call stack record) instruction. This instruction will be added in
a following, separate patch. This change only adds CSRE system
registers.

gas/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Docs update.
	* testsuite/gas/aarch64/csre-invalid.d: New test.
	* testsuite/gas/aarch64/csre-invalid.l: New test.
	* testsuite/gas/aarch64/csre-invalid.s: New test.
	* testsuite/gas/aarch64/csre.d: New test.
	* testsuite/gas/aarch64/csre.s: New test.

opcodes/ChangeLog:

2020-10-08  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* aarch64-opc.c: New CSRE system registers defined.
2020-10-22 15:17:10 +01:00
H.J. Lu
9ef6c56ffc opcodes/po/es.po: Remove the duplicated entry
Remove the duplicated entry in opcodes/po/es.po:

binutils-gdb/opcodes/po/es.po:749: duplicate message definition...
binutils-gdb/opcodes/po/es.po:742: ...this is the location of the first definition

	* po/es.po: Remove the duplicated entry.
2020-10-22 05:21:35 -07:00
Dr. David Alan Gilbert
777cd7ab3f Fix printf formatting errors where "0x" is used as a prefix for a decimal number.
bfd	* po/es.po: Fix printf format

binutils * windmc.c: Fix printf format

gas	* config/tc-arc.c: Fix printf format

opcodes	* po/es.po: Fix printf format

sim	* arm/armos.c: Fix printf format
	* ppc/emul_netbsd.c: Fix printf format
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
2020-10-22 12:00:10 +01:00
Ganesh Gopalasubramanian
646cc3e010 Add AMD znver3 processor support
gas/

	* config/tc-i386.c (cpu_arch): Add CPU_ZNVER3_FLAGS flags.
	(i386_align_code): Add PROCESSOR_ZNVER cases.
	* doc/c-i386.texi: Add znver3, snp, invlpgb and tlbsync.
	* gas/i386/i386.exp: Add new znver3 test cases.
	* gas/i386/arch-14-znver3.d: New.
	* gas/i386/arch-14.d: New.
	* gas/i386/arch-14.s: New.
	* gas/i386/invlpgb.d: New.
	* gas/i386/invlpgb64.d: New.
	* gas/i386/invlpgb.s: New.
	* gas/i386/snp.d: New.
	* gas/i386/snp64.d: New.
	* gas/i386/snp.s: New.
	* gas/i386/tlbsync.d: New.
	* gas/i386/tlbsync.s: New.
	* gas/i386/x86-64-arch-4-znver3.d: New.
	* gas/i386/x86-64-arch-4.d: New.
	* gas/i386/x86-64-arch-4.s: New.

opcodes/

	* i386-dis.c (rm_table): Add tlbsync, snp, invlpgb.
	* i386-gen.c (cpu_flag_init): Add new CPU_INVLPGB_FLAGS,
	CPU_TLBSYNC_FLAGS, and CPU_SNP_FLAGS.
	Add CPU_ZNVER3_FLAGS.
	(cpu_flags): Add CpuINVLPGB, CpuTLBSYNC, CpuSNP.
	* i386-opc.h: Add CpuINVLPGB, CpuTLBSYNC, CpuSNP.
	* i386-opc.tbl: Add invlpgb, tlbsync, psmash, pvalidate,
	rmpupdate, rmpadjust.
	* i386-init.h: Re-generated.
	* i386-tbl.h: Re-generated.
2020-10-20 13:58:04 -07:00
Cui,Lili
5739259879 Enhancement for avx-vnni patch
1. Rename CpuVEX_PREFIX to PseudoVexPrefix and
   move it from cpu_flags to opcode_modifiers.
2. Delete {vex2} invalid test.
3. Use VexW0 and VexVVVV in the AVX-VNNI instructions.

gas/
	* config/tc-i386.c: Move Pseudo Prefix check to match_template.
	* testsuite/gas/i386/avx-vnni-inval.l: New file.
	* testsuite/gas/i386/avx-vnni-inval.s: Likewise.
	* testsuite/gas/i386/avx-vnni.d: Delete invalid {vex2} test.
	* testsuite/gas/i386/avx-vnni.s: Likewise.
	* testsuite/gas/i386/i386.exp: Add AVX VNNI invalid tests.
	* testsuite/gas/i386/x86-64-avx-vnni-inval.l: New file.
	* testsuite/gas/i386/x86-64-avx-vnni-inval.s: Likewise.
	* testsuite/gas/i386/x86-64-avx-vnni.d: Delete invalid {vex2} test.
	* testsuite/gas/i386/x86-64-avx-vnni.s: Likewise.

opcodes/
	* i386-opc.tbl: Rename CpuVEX_PREFIX to PseudoVexPrefix
	and move it from cpu_flags to opcode_modifiers.
	Use VexW0 and VexVVVV in the AVX-VNNI instructions.
	* i386-gen.c: Likewise.
	* i386-opc.h: Likewise.
	* i386-opc.h: Likewise.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2020-10-16 11:37:09 +08:00
H.J. Lu
58bf9b6a7f x86: Support Intel AVX VNNI
Intel AVX VNNI instructions are marked with CpuVEX_PREFIX.  Without the
pseudo {vex} prefix, mnemonics of Intel VNNI instructions are encoded
with the EVEX prefix.  The pseudo {vex} prefix can be used to encode
mnemonics of Intel VNNI instructions with the VEX prefix.

gas/

	* NEWS: Add Intel AVX VNNI.
	* config/tc-i386.c (cpu_arch): Add .avx_vnni and noavx_vnni.
	(cpu_flags_match): Support CpuVEX_PREFIX.
	* doc/c-i386.texi: Document .avx_vnni, noavx_vnni and how to
	encode Intel VNNI instructions with VEX prefix.
	* testsuite/gas/i386/avx-vnni.d: New file.
	* testsuite/gas/i386/avx-vnni.s: Likewise.
	* testsuite/gas/i386/x86-64-avx-vnni.d: Likewise.
	* testsuite/gas/i386/x86-64-avx-vnni.s: Likewise.
	* testsuite/gas/i386/i386.exp: Run AVX VNNI tests.

opcodes/

	* i386-dis.c (PREFIX_VEX_0F3850): New.
	(PREFIX_VEX_0F3851): Likewise.
	(PREFIX_VEX_0F3852): Likewise.
	(PREFIX_VEX_0F3853): Likewise.
	(VEX_W_0F3850_P_2): Likewise.
	(VEX_W_0F3851_P_2): Likewise.
	(VEX_W_0F3852_P_2): Likewise.
	(VEX_W_0F3853_P_2): Likewise.
	(prefix_table): Add PREFIX_VEX_0F3850, PREFIX_VEX_0F3851,
	PREFIX_VEX_0F3852 and PREFIX_VEX_0F3853.
	(vex_table): Add VEX_W_0F3850_P_2, VEX_W_0F3851_P_2,
	VEX_W_0F3852_P_2 and VEX_W_0F3853_P_2.
	(putop): Add support for "XV" to print "{vex3}" pseudo prefix.
	* i386-gen.c (cpu_flag_init): Clear the CpuAVX_VNNI bit in
	CPU_UNKNOWN_FLAGS.  Add CPU_AVX_VNNI_FLAGS and
	CPU_ANY_AVX_VNNI_FLAGS.
	(cpu_flags): Add CpuAVX_VNNI and CpuVEX_PREFIX.
	* i386-opc.h (CpuAVX_VNNI): New.
	(CpuVEX_PREFIX): Likewise.
	(i386_cpu_flags): Add cpuavx_vnni and cpuvex_prefix.
	* i386-opc.tbl: Add Intel AVX VNNI instructions.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2020-10-14 05:02:31 -07:00
Lili Cui
c1fa250ae1 x86: Add support for Intel HRESET instruction
gas/

	* NEWS: Add Intel HRESET.
	* config/tc-i386.c (cpu_arch): Add .hreset.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document .hreset, nohreset.
	* testsuite/gas/i386/i386.exp: Run HRESET tests.
	* testsuite/gas/i386/hreset.d: New file.
	* testsuite/gas/i386/x86-64-hreset.d: Likewise.
	* testsuite/gas/i386/hreset.s: Likewise.

opcodes/

	* i386-dis.c (PREFIX_0F3A0F): New.
	(MOD_0F3A0F_PREFIX_1): Likewise.
	(REG_0F3A0F_PREFIX_1_MOD_3): Likewise.
	(RM_0F3A0F_P_1_MOD_3_REG_0): Likewise.
	(prefix_table): Add PREFIX_0F3A0F.
	(mod_table): Add MOD_0F3A0F_PREFIX_1.
	(reg_table): Add REG_0F3A0F_PREFIX_1_MOD_3.
	(rm_table): Add RM_0F3A0F_P_1_MOD_3_REG_0.
	* i386-gen.c (cpu_flag_init): Add HRESET_FLAGS,
	CPU_ANY_HRESET_FLAGS.
	(cpu_flags): Add CpuHRESET.
	(output_i386_opcode): Allow 4 byte base_opcode.
	* i386-opc.h (enum): Add CpuHRESET.
	(i386_cpu_flags): Add cpuhreset.
	* i386-opc.tbl: Add Intel HRESET instruction.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-10-14 04:53:59 -07:00
Lili Cui
f64c42a9fb x86: Support Intel UINTR
gas/

	* NEWS: Add Intel UINTR.
	* config/tc-i386.c (cpu_arch): Add .uintr.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document .uintr and nouintr.
	* testsuite/gas/i386/i386.exp: Run UINTR tests.
	* testsuite/gas/i386/x86-64-uintr.d: Likewise.
	* testsuite/gas/i386/x86-64-uintr.s: Likewise.

opcodes/

	* i386-dis.c (enum): Add
	PREFIX_MOD_3_0F01_REG_5_RM_4,
	PREFIX_MOD_3_0F01_REG_5_RM_5,
	PREFIX_MOD_3_0F01_REG_5_RM_6,
	PREFIX_MOD_3_0F01_REG_5_RM_7,
	X86_64_0F01_REG_5_MOD_3_RM_4_PREFIX_1,
	X86_64_0F01_REG_5_MOD_3_RM_5_PREFIX_1,
	X86_64_0F01_REG_5_MOD_3_RM_6_PREFIX_1,
	X86_64_0F01_REG_5_MOD_3_RM_7_PREFIX_1,
	X86_64_0FC7_REG_6_MOD_3_PREFIX_1.
	(prefix_table): New instructions (see prefixes above).
	(rm_table): Likewise
	* i386-gen.c (cpu_flag_init): Add CPU_UINTR_FLAGS,
	CPU_ANY_UINTR_FLAGS.
	(cpu_flags): Add CpuUINTR.
	* i386-opc.h (enum): Add CpuUINTR.
	(i386_cpu_flags): Add cpuuintr.
	* i386-opc.tbl: Add UINTR insns.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-10-14 04:31:54 -07:00
H.J. Lu
8b65b8953a x86: Remove the prefix byte from non-VEX/EVEX base_opcode
Replace the prefix byte in non-VEX/EVEX base_opcode with PREFIX_0X66,
PREFIX_0XF2 or PREFIX_0XF3.

gas/

	* config/tc-i386.c (load_insn_p): Check opcodeprefix == 0 for
	base_opcode == 0xfc7.
	(match_template): Likewise.
	(process_suffix): Check opcodeprefix == PREFIX_0XF2 for CRC32.
	(check_byte_reg): Likewise.
	(output_insn): Don't add the 0xf3 prefix twice for PadLock
	instructions.  Don't add prefix from non-VEX/EVEX base_opcode.

opcodes/

	* i386-gen.c (process_i386_opcode_modifier): Return 1 for
	non-VEX/EVEX/prefix encoding.
	(output_i386_opcode): Fail if non-VEX/EVEX/prefix base_opcode
	has a prefix byte.
	* i386-opc.tbl: Replace the prefix byte in non-VEX/EVEX
	base_opcode with PREFIX_0X66, PREFIX_0XF2 or PREFIX_0XF3.
	* i386-tbl.h: Regenerated.
2020-10-14 04:20:55 -07:00
H.J. Lu
7b47a31256 x86: Rename VexOpcode to OpcodePrefix
Rename VexOpcode to OpcodePrefix so that OpcodePrefix can be used for
regular encoding prefix.

gas/

	* config/tc-i386.c (build_vex_prefix): Replace vexopcode with
	opcodeprefix.
	(build_evex_prefix): Likewise.
	(is_any_vex_encoding): Don't check vexopcode.
	(output_insn): Handle opcodeprefix.

opcodes/

	* i386-gen.c (opcode_modifiers): Replace VexOpcode with
	OpcodePrefix.
	* i386-opc.h (VexOpcode): Renamed to ...
	(OpcodePrefix): This.
	(PREFIX_NONE): New.
	(PREFIX_0X66): Likewise.
	(PREFIX_0XF2): Likewise.
	(PREFIX_0XF3): Likewise.
	* i386-opc.tbl (Prefix_0X66): New.
	(Prefix_0XF2): Likewise.
	(Prefix_0XF3): Likewise.
	Replace VexOpcode= with OpcodePrefix=.  Use Prefix_0X66 on xorpd.
	Use Prefix_0XF3 on cvtdq2pd.  Use Prefix_0XF2 on cvtpd2dq.
	* i386-tbl.h: Regenerated.
2020-10-13 19:29:09 -07:00
Samanta Navarro
0cc79db2b6 Fix spelling mistakes 2020-10-05 14:20:15 +01:00
H.J. Lu
5b316d90e4 x86-64: Always display suffix for %LQ in 64bit
In 64bit, assembler generates a warning for "sysret":

$ echo sysret | as --64 -o x.o -
{standard input}: Assembler messages:
{standard input}:1: Warning: no instruction mnemonic suffix given and no register operands; using default for `sysret'

Always display suffix for %LQ in 64bit to display "sysretl".

gas/

	PR binutils/26704
	* testsuite/gas/i386/noreg64-data16.d: Expect sysretl instead of
	sysret.
	* testsuite/gas/i386/noreg64.d: Likewise.
	* testsuite/gas/i386/x86-64-intel64.d: Likewise.
	* testsuite/gas/i386/x86-64-opcode.d: Likewise.

opcodes/

	PR binutils/26704
	* i386-dis.c (putop): Always display suffix for %LQ in 64bit.
2020-10-05 05:28:12 -07:00
H.J. Lu
0e9f3bf126 x86: Clear modrm if not needed
The MODRM byte can be checked to display the instruction name only if the
MODRM byte needed.  Clear modrm if the MODRM byte isn't needed so that
modrm field checks in putop like, modrm.mod == N with N != 0, can be done
without checking need_modrm.

gas/

	PR binutils/26705
	* testsuite/gas/i386/x86-64-suffix.s: Add "mov %rsp,%rbp" before
	sysretq.
	* testsuite/gas/i386/x86-64-suffix-intel.d: Updated.
	* testsuite/gas/i386/x86-64-suffix.d: Likewise.

opcodes/

	PR binutils/26705
	* i386-dis.c (print_insn): Clear modrm if not needed.
	(putop): Check need_modrm for modrm.mod != 3.  Don't check
	need_modrm for modrm.mod == 3.
2020-10-05 05:23:39 -07:00
Przemyslaw Wirkus
12e35da62f This patch introduces ETMv4 (Embedded Trace Macrocell) system registers for the AArch64 architecture.
gas           * testsuite/gas/aarch64/etm-ro-invalid.d: New test.
              * testsuite/gas/aarch64/etm-ro-invalid.l: New test.
              * testsuite/gas/aarch64/etm-ro-invalid.s: New test.
              * testsuite/gas/aarch64/etm-ro.s: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.d: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.l: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.s: New test.
              * testsuite/gas/aarch64/etm-wo.s: New test.
              * testsuite/gas/aarch64/etm.s: New test.
              * testsuite/gas/aarch64/sysreg.d: system register s2_1_c0_c3_0 disassembled
              now to trcstatr.

opcodes       * aarch64-opc.c: Added ETMv4 system registers TRCACATRn, TRCACVRn,
              TRCAUTHSTATUS, TRCAUXCTLR, TRCBBCTLR, TRCCCCTLR, TRCCIDCCTLR0, TRCCIDCCTLR1,
              TRCCIDCVRn, TRCCIDR0, TRCCIDR1, TRCCIDR2, TRCCIDR3, TRCCLAIMCLR, TRCCLAIMSET,
              TRCCNTCTLRn, TRCCNTRLDVRn, TRCCNTVRn, TRCCONFIGR, TRCDEVAFF0, TRCDEVAFF1,
              TRCDEVARCH, TRCDEVID, TRCDEVTYPE, TRCDVCMRn, TRCDVCVRn, TRCEVENTCTL0R,
              TRCEVENTCTL1R, TRCEXTINSELR, TRCIDR0, TRCIDR1, TRCIDR2, TRCIDR3, TRCIDR4,
              TRCIDR5, TRCIDR6, TRCIDR7, TRCIDR8, TRCIDR9, TRCIDR10, TRCIDR11, TRCIDR12,
              TRCIDR13, TRCIMSPEC0, TRCIMSPECn, TRCITCTRL, TRCLAR WOTRCLSR, TRCOSLAR
              WOTRCOSLSR, TRCPDCR, TRCPDSR, TRCPIDR0, TRCPIDR1, TRCPIDR2, TRCPIDR3,
              TRCPIDR4, TRCPIDR[5,6,7], TRCPRGCTLR, TRCP,CSELR, TRCQCTLR, TRCRSCTLRn,
              TRCSEQEVRn, TRCSEQRSTEVR, TRCSEQSTR, TRCSSCCRn, TRCSSCSRn, TRCSSPCICRn,
              TRCSTALLCTLR, TRCSTATR, TRCSYNCPR, TRCTRACEIDR,  TRCTSCTLR, TRCVDARCCTLR,
              TRCVDCTLR, TRCVDSACCTLR, TRCVICTLR, TRCVIIECTLR, TRCVIPCSSCTLR, TRCVISSCTLR,
              TRCVMIDCCTLR0, TRCVMIDCCTLR1 and TRCVMIDCVRn.
2020-09-28 15:49:11 +01:00
Przemyslaw Wirkus
3454861d89 This patch introduces ETE (Embedded Trace Extension) system registers for the AArch64 architecture.
gas           * testsuite/gas/aarch64/ete.d: New test.
              * testsuite/gas/aarch64/ete.s: New test.

opcodes       * aarch64-opc.c: Add ETE system registers TRCEXTINSELR<0-3> and TRCRSR.
2020-09-28 15:41:23 +01:00
Przemyslaw Wirkus
1ff8e40105 This patch introduces TRBE (Trace Buffer Extension) system registers for the AArch64 architecture.
gas           * testsuite/gas/aarch64/trbe-invalid.d: New test.
              * testsuite/gas/aarch64/trbe-invalid.l: New test.
              * testsuite/gas/aarch64/trbe-invalid.s: New test.
              * testsuite/gas/aarch64/trbe.d: New test.
              * testsuite/gas/aarch64/trbe.s: New test.

opcodes       * aarch64-opc.c: Add TRBE system registers TRBIDR_EL1 , TRBBASER_EL1 ,
              TRBLIMITR_EL1 , TRBMAR_EL1 , TRBPTR_EL1, TRBSR_EL1 and TRBTRG_EL1.
2020-09-28 15:37:50 +01:00
Alan Modra
0be2fe677c ubsan: opcodes/csky-opc.h:929 shift exponent 536870912
opcodes/
	* csky-opc.h: Formatting.
	(GENERAL_REG_BANK): Correct spelling.  Update use throughout file.
	(get_register_name): Mask arch with CSKY_ARCH_MASK for shift,
	and shift 1u.
	(get_register_number): Likewise.
	* csky-dis.c (get_gr_name, get_cr_name): Don't mask mach_flag.
gas/
	* config/tc-csky.c (parse_type_ctrlreg): Don't mask mach_flag
	for csky_get_control_regno.
	(csky_get_reg_val): Likewise when calling csky_get_general_regno.
2020-09-26 15:28:22 +09:30
Cui,Lili
09d7303523 Put together MOD_VEX_0F38* in i386-dis.c,
There are 11 MOD_VEX_0F38* inserted in MOD_0F38* group,
which should be placed in MOD_VEX_0F38* group.

opcode/
	PR 26654
	*i386-dis.c (enum): Put MOD_VEX_0F38* together.
2020-09-25 09:39:00 +08:00
Andrew Burgess
011a045a6b csky/opcodes: enclose if body in curly braces
This commit:

  commit afdcafe891
  Date:   Thu Sep 17 14:30:28 2020 +0800

      CSKY: Add objdump option -M abi-names.

cases the build of GDB (configured with --enabled-targets=all) to fail
with this error:

  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../src/opcodes -I. -I../../src/opcodes -I../bfd -I../../src/opcodes/../include -I../../src/opcodes/../bfd -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror -O0 -g3 -D_GLIBCXX_DEBUG=1 -MT csky-dis.lo -MD -MP -MF .deps/csky-dis.Tpo -c ../../src/opcodes/csky-dis.c -o csky-dis.o
  ../../src/opcodes/csky-dis.c: In function 'csky_output_operand':
  ../../src/opcodes/csky-dis.c:849:7: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
    849 |       if (IS_CSKY_V1 (mach_flag))
        |       ^~
  ../../src/opcodes/csky-dis.c:851:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    851 |  strcat (str, buf);
        |  ^~~~~~

this commit adds { ... } around the if body to resolve this issue.

opcodes/ChangeLog:

	* csky-dis.c (csky_output_operand): Enclose body of if in curly
	braces.
2020-09-24 15:14:53 +01:00
Cui,Lili
81d54bb7ae Add support for Intel TDX instructions.
gas/

	* NEWS: Add TDX.
	* config/tc-i386.c (cpu_arch): Add .tdx.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document tdx.
	* testsuite/gas/i386/i386.exp: Run tdx tests.
	* testsuite/gas/i386/tdx.d: Likewise.
	* testsuite/gas/i386/tdx.s: Likewise.
	* testsuite/gas/i386/x86-64-tdx.d: Likewise.
	* testsuite/gas/i386/x86-64-tdx.s: Likewise.

opcodes/

	* i386-dis.c (enum): Add PREFIX_0F01_REG_1_RM_5,
	PREFIX_0F01_REG_1_RM_6, PREFIX_0F01_REG_1_RM_7,
	X86_64_0F01_REG_1_RM_5_P_2, X86_64_0F01_REG_1_RM_6_P_2,
	X86_64_0F01_REG_1_RM_7_P_2.
	(prefix_table): Likewise.
	(x86_64_table): Likewise.
	(rm_table): Likewise.
	* i386-gen.c (cpu_flag_init): Add CPU_TDX_FLAGS
	and CPU_ANY_TDX_FLAGS.
	(cpu_flags): Add CpuTDX.
	* i386-opc.h (enum): Add CpuTDX.
	(i386_cpu_flags): Add cputdx.
	* i386-opc.tbl: Add TDX insns.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-09-24 10:38:15 +08:00
Cooper Qu
afdcafe891 CSKY: Add objdump option -M abi-names.
Add option parser for disassembler, and refine the codes of
parse register operand and disassemble register operand.
While strengthen the operands legality check of some instructions.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (parse_type_ctrlreg): Use function
	csky_get_control_regno to operand.
	(csky_get_reg_val): Likewise.
	(is_reg_sp_with_bracket): Use function csky_get_reg_val
	to parse operand.
	(is_reg_sp): Refine.
	(is_oimm_within_range): Fix, report error when operand
	is not constant.
	(parse_type_cpreg): Refine.
	(parse_type_cpcreg): Refine.
	(get_operand_value): Add handle of OPRND_TYPE_IMM5b_LS.
	(md_assemble): Fix no error reporting somtimes when
	operands number are not fit.
	(csky_addc64): Refine.
	(csky_subc64): Refine.
	(csky_or64): Refine.
	(v1_work_fpu_fo): Refine.
	(v1_work_fpu_read): Refine.
	(v1_work_fpu_writed): Refine.
	(v1_work_fpu_readd): Refine.
	(v2_work_addc): New function, strengthen the operands legality
	check of addc.
	* gas/testsuite/gas/csky/all.d : Use register number format when
	disassemble register name by default.
	* gas/testsuite/gas/csky/cskyv2_all.d : Likewise.
	* gas/testsuite/gas/csky/trust.d: Likewise.
	* gas/testsuite/gas/csky/cskyv2_ck860.d : Fix.
	* gas/testsuite/gas/csky/trust.s : Fix.

opcodes/
	* csky-dis.c (using_abi): New.
	(parse_csky_dis_options): New function.
	(get_gr_name): New function.
	(get_cr_name): New function.
	(csky_output_operand): Use get_gr_name and get_cr_name to
	disassemble and add handle of OPRND_TYPE_IMM5b_LS.
	(print_insn_csky): Parse disassembler options.
	* opcodes/csky-opc.h (OPRND_TYPE_IMM5b_LS): New enum.
	(GENARAL_REG_BANK): Define.
	(REG_SUPPORT_ALL): Define.
	(REG_SUPPORT_ALL): New.
	(ASH): Define.
	(REG_SUPPORT_A): Define.
	(REG_SUPPORT_B): Define.
	(REG_SUPPORT_C): Define.
	(REG_SUPPORT_D): Define.
	(REG_SUPPORT_E): Define.
	(csky_abiv1_general_regs): New.
	(csky_abiv1_control_regs): New.
	(csky_abiv2_general_regs): New.
	(csky_abiv2_control_regs): New.
	(get_register_name): New function.
	(get_register_number): New function.
	(csky_get_general_reg_name): New function.
	(csky_get_general_regno): New function.
	(csky_get_control_reg_name): New function.
	(csky_get_control_regno): New function.
	(csky_v2_opcodes): Prefer two oprerans format for bclri and
	bseti, strengthen the operands legality check of addc, zext
	and sext.
2020-09-23 23:55:36 +08:00
Terry Guo
c4694f172b Enable support to Intel Keylocker instructions
gas/
	* NEWS: Add Key Locker.
	* config/tc-i386.c (cpu_arch): Add .kl and .wide_kl.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document kl and wide_kl.
	* testsuite/gas/i386/i386.exp: Run keylocker tests.
	* testsuite/gas/i386/keylocker-intel.d: New test.
	* testsuite/gas/i386/keylocker.d: Likewise.
	* testsuite/gas/i386/keylocker.s: Likewise.
	* testsuite/gas/i386/x86-64-keylocker-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-keylocker.d: Likewise.
	* testsuite/gas/i386/x86-64-keylocker.s: Likewise.
	* testsuite/gas/i386/x86-64-property-10.d: Likewise.
	* testsuite/gas/i386/property-10.d: Likewise.
	* testsuite/gas/i386/property-10.s: Likewise.

opcodes/
	* i386-dis.c (enum): Add REG_0F38D8_PREFIX_1,
	MOD_0F38FA_PREFIX_1, MOD_0F38FB_PREFIX_1,
	MOD_0F38DC_PREFIX_1, MOD_0F38DD_PREFIX_1,
	MOD_0F38DE_PREFIX_1, MOD_0F38DF_PREFIX_1,
	PREFIX_0F38D8, PREFIX_0F38FA, PREFIX_0F38FB.
	(reg_table): New instructions (see prefixes above).
	(prefix_table): Likewise.
	(three_byte_table): Likewise.
	(mod_table): Likewise
	* i386-gen.c (cpu_flag_init): Add CPU_KL_FLAGS, CPU_WIDE_KL_FLAGS,
	CPU_ANY_KL_FLAGS and CPU_ANY_WIDE_KL_FLAGS.
	(cpu_flags): Likewise.
	(operand_type_init): Likewise.
	* i386-opc.h (enum): Add CpuKL and CpuWide_KL.
	(i386_cpu_flags): Add cpukl and cpuwide_kl.
	* i386-opc.tbl: Add KL and WIDE_KL insns.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2020-09-23 10:47:44 +08:00
Alan Modra
c73eac969a rx-dis.c:103:3: suspicious concatenation of string literals
* rx-dis.c (flag_names): Add missing comma.
	(register_names, flag_names, double_register_names),
	(double_register_high_names, double_register_low_names),
	(double_control_register_names, double_condition_names): Remove
	trailing commas.
2020-09-21 18:20:58 +09:30
David Faust
6e25f88828 bpf: xBPF SDIV, SMOD instructions
Add gas and opcodes support for two xBPF-exclusive ALU operations:
SDIV (signed division) and SMOD (signed modulo), and add tests for
them in gas.

cpu/
	* bpf.cpu (insn-op-code-alu): Add SDIV and SMOD.
	(define-alu-insn-bin, daib): Take ISAs as an argument.
	(define-alu-instructions): Update calls to daib pmacro with
	ISAs; add sdiv and smod.

gas/
	* testsuite/gas/bpf/alu-xbpf.d: New file.
	* testsuite/gas/bpf/alu-xbpf.s: Likewise.
	* testsuite/gas/bpf/alu32-xbpf.d: Likewise.
	* testsuite/gas/bpf/alu32-xbpf.d: Likewise.
	* testuiste/gas/bpf/bpf.exp: Run new tests.

opcodes/
	* bpf-desc.c: Regenerate.
	* bpf-desc.h: Likewise.
	* bpf-opc.c: Likewise.
	* bpf-opc.h: Likewise.
2020-09-18 10:04:23 -07:00
Andrew Burgess
c568ac5ff7 opcodes/csky: return the default disassembler when there is no bfd
The disassembler function should return a valid disassembler function
even when there is no BFD present.  This is implied (I believe) by the
comment in dis-asm.h which says the BFD may be NULL.  Further, it
makes sense when considering that the disassembler is used in GDB, and
GDB may connect to a target and perform debugging even without a BFD
being supplied.

This commit makes the csky_get_disassembler function return the
default disassembler configuration when no bfd is supplied, this is
the same default configuration as is used when a BFD is supplied, but
the BFD has no attributes section.

Before the change configuring GDB with --enable-targets=all and
running the tests gdb.base/all-architectures-2.exp results in many
errors, but after this change there are no failures.

opcodes/ChangeLog:

	* csky-dis.c (csky_get_disassembler): Don't return NULL when there
	is no BFD.
2020-09-17 14:52:05 +08:00
Alan Modra
c1229f84a4 Tidy elf_symbol_from
bfd/
	* elf-bfd.h (elf_symbol_from): Remove unused ABFD parameter.
	* elf.c (ignore_section_sym, _bfd_elf_copy_private_symbol_data),
	(swap_out_syms): Adjust elf_symbol_from invocation.
binutils/
	* nm.c (print_symbol): Adjust elf_symbol_from invocation.
	* objcopy.c (is_hidden_symbol): Likewise.
gas/
	* config/obj-elf.c (obj_elf_visibility, elf_frob_symbol): Adjust
	elf_symbol_from invocation.
	* config/tc-aarch64.c (s_variant_pcs): Likewise.
	* config/tc-m68hc11.c (s_m68hc11_mark_symbol): Likewise.
	* config/tc-ppc.c (ppc_elf_localentry, ppc_force_relocation),
	(ppc_fix_adjustable): Likewise.
	* config/tc-xgate.c (xgate_frob_symbol): Likewise.
ld/
	* plugin.c (asymbol_from_plugin_symbol): Adjust elf_symbol_from
	invocation.
opcodes/
	* ppc-dis.c (ppc_symbol_is_valid): Adjust elf_symbol_from invocation.
2020-09-16 16:41:33 +09:30
Nick Clifton
7ad578807a Stop symbols generated by the annobin gcc plugin from breaking the disassembly of PowerPC binaries.
* ppc-dis.c (ppc_symbol_is_valid): New function.  Returns false
	for hidden, local, no-type symbols.
	(disassemble_init_powerpc): Point the symbol_is_valid field in the
	info structure at the new function.
2020-09-10 13:23:11 +01:00
Cooper Qu
79c8d443b1 CSKY: Add L2Cache instructions for CK860.
opcodes/
	* csky-opc.h (csky_v2_opcodes): Add L2Cache instructions.
	* testsuite/gas/csky/cskyv2_ck860.d : Adjust to icache.iva
	opcode fixing.
2020-09-10 17:41:23 +08:00
Cooper Qu
525a0aa301 CSKY: Add new arches while refine the cpu option process.
Add arches CK804, CK805 and CK800. CK800 is an special arch which
support all instructions for CSKYV2. Refine the cpu tables to
simplify adding a new cpu.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (struct csky_cpu_info): Add new members
	isa_flag, features and ver.
	(struct csky_cpu_feature): New.
	(struct csky_cpu_version): New.
	(CSKY_FEATURE_MAX): Define.
	(CSKY_CPU_REVERISON_MAX): Define.
	(FEATURE_DSP_EXT, FEATURE_DSP, FEATURE_MMU, FEATURE_VDSP,
	 FEATURE_FLOAT, FEATURE_TRUST, FEATURE_JAVA, FEATURE_SHIELD):
	Define, each standard one collection of instructions.
	(CSKY_FEATURES_DEF_NULL, CSKY_FEATURES_DEF_e,
	 CSKY_FEATURES_DEF_t, CSKY_FEATURES_DEF_f, CSKY_FEATURES_DEF_v,
	 CSKY_FEATURES_DEF_ef, CSKY_FEATURES_DEF_jt,
	 CSKY_FEATURES_DEF_efht, CSKY_FEATURES_DEF_efv,
	 CSKY_FEATURES_DEF_eft, CSKY_FEATURES_DEF_d,
	 CSKY_FEATURES_DEF_df, CSKY_FEATURES_DEF_ft,
	 CSKY_FEATURES_DEF_tv, CSKY_FEATURES_DEF_fv,
	 CSKY_FEATURES_DEF_dft, CSKY_FEATURES_DEF_dfv,
	 CSKY_FEATURES_DEF_ftv, CSKY_FEATURES_DEF_eftv): Define,
	the features combination used by cpu.
	(CSKY_CPU_REVERISON_r0p0, CSKY_CPU_REVERISON_r1p0,
	 CSKY_CPU_REVERISON_r2p0, CSKY_CPU_REVERISON_r3p0,
	 CSKY_CPU_REVERISON_RESERVED, CSKY_CPU_REVERISON_R3):
	Define, version information used by cpu.
	(csky_cpus): Refine, and add CK804, CK805 and CK800.
	(parse_cpu): Refine.
	(parse_arch): Refine.
	(md_show_usage): Refine.
	(md_begin): Refine.

include/
	* opcode/csky.h (CSKY_ARCH_804): Define.
	(CSKY_ARCH_805): Define.
	(CSKY_ARCH_800): Define.
2020-09-10 17:41:11 +08:00
Nick Clifton
0332f66274 Fix compile time warnings when building for the CSKY target on a 32-bit host.
incldue	* opcode/csky.h (CSKY_ISA_FLOAT_7E60): Use a long long type for
	this value.

opcodes	* csky-dis.c (csky_output_operand): Coerce the immediate values to
	long before printing.
2020-09-10 09:58:15 +01:00
Alan Modra
23bef3fea3 sprintf arg overlaps destination
* csky-dis.c (csky_output_operand): Don't sprintf str to itself.
2020-09-10 14:12:52 +09:30
Cooper Qu
6a1ed9106f CSKY: Change mvtc and mulsw's ISA flag.
gas/
	* config/tc-csky.c (CSKYV2_ISA_DSP): CSKY_ISA_DSPE60.
	(CSKY_ISA_860): Likewise.

include/
	* opcode/csky.h (CSKY_ISA_DSPE60): Define.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Change mvtc and mulsw's
	ISA flag.
2020-09-09 19:26:34 +08:00
Cooper Qu
1feede9b38 CSKY: Add FPUV3 instructions, which supported by ck860f.
Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>

gas/
	* config/tc-csky.c (float_work_fpuv3_fmovi): New function,
	helper function to encode fpuv3 fmovi instructions.
	(float_work_fpuv3_fstore): New function.
	(struct literal): Add new member 'offset'.
	(csky_cpus): New cpu CK860f.
	(enter_literal): Return literal pool pointer instead of offset.
	(parse_rt): Adjust the change of enter_literal.
	(parse_rtf): Likewise.
	(v1_work_lrw): Likewise.
	(v1_work_jbsr): Likewise.
	(v2_work_lrw): Likewise.
	(v2_work_jbsr): Likewise.
	(v2_work_jsri): Likewise.
	(vdsp_work_vlrw): Likewise.
	(is_freglist_legal): Add handler for FPUV3.
	(parse_type_freg): Likewise.
	(is_imm_within_range): Set e.X_add_number if it is a signed and
	negtive number.
	(get_operand_value): Add handler for OPRND_TYPE_IMM9b,
	OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI
	and OPRND_TYPE_DFLOAT_FMOVI.
	(float_to_half): Convert float number to harf float.

opcodes/
	* csky-dis.c (csky_output_operand): Add handlers for
	OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
	OPRND_TYPE_DFLOAT_FMOVI. Refine OPRND_TYPE_FREGLIST_DASH
	to support FPUV3 instructions.
	* csky-opc.h (enum operand_type): New enum OPRND_TYPE_IMM9b,
	OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
	OPRND_TYPE_DFLOAT_FMOVI.
	(OPRND_MASK_4_5, OPRND_MASK_6, OPRND_MASK_6_7, OPRND_MASK_6_8,
	 OPRND_MASK_7, OPRND_MASK_7_8, OPRND_MASK_17_24,
	 OPRND_MASK_20, OPRND_MASK_20_21, OPRND_MASK_20_22,
	 OPRND_MASK_20_23, OPRND_MASK_20_24, OPRND_MASK_20_25,
	 OPRND_MASK_0_3or5_8, OPRND_MASK_0_3or6_7, OPRND_MASK_0_3or25,
	 OPRND_MASK_0_4or21_24, OPRND_MASK_5or20_21,
	 OPRND_MASK_5or20_22, OPRND_MASK_5or20_23, OPRND_MASK_5or20_24,
	 OPRND_MASK_5or20_25, OPRND_MASK_8_9or21_25,
	 OPRND_MASK_8_9or16_25, OPRND_MASK_4_6or20, OPRND_MASK_5_7or20,
	 OPRND_MASK_4_5or20or25, OPRND_MASK_4_6or20or25,
	 OPRND_MASK_4_7or20or25, OPRND_MASK_6_9or17_24,
	 OPRND_MASK_6_7or20, OPRND_MASK_6or20, OPRND_MASK_7or20,
	 OPRND_MASK_5or8_9or16_25, OPRND_MASK_5or8_9or20_25): Define.
	(csky_v2_opcodes): Add FPUV3 instructions.

include/
	* opcode/csky.h (CSKY_ISA_FLOAT_7E60): Define.
2020-09-09 19:25:40 +08:00
Alex Coplan
38cf07a6c0 aarch64: Add support for Armv8-R system registers
This patch adds support for the system registers introduced in Armv8-R
AArch64.

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (parse_sys_reg): Also pass sysreg name to
	validation function.
	(parse_sys_ins_reg): Likewise.
	(print_operands): Pass CPU features to aarch64_print_operand().
	* testsuite/gas/aarch64/v8-r-bad-sysregs.d: New test.
	* testsuite/gas/aarch64/v8-r-bad-sysregs.l: Error output.
	* testsuite/gas/aarch64/v8-r-bad-sysregs.s: Input.
	* testsuite/gas/aarch64/v8-r-sysregs-need-arch.d: New test.
	* testsuite/gas/aarch64/v8-r-sysregs-need-arch.l: Error output.
	* testsuite/gas/aarch64/v8-r-sysregs.d: New test.
	* testsuite/gas/aarch64/v8-r-sysregs.s: Input for previous two tests.

include/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* opcode/aarch64.h (aarch64_sys_ins_reg_supported_p): Also take
	system register name in order to simplify validation for v8-R.
	(aarch64_print_operand): Also take CPU feature set, as disassembly for
	system registers now depends on arch variant.

opcodes/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-dis.c (print_operands): Pass CPU features to
	aarch64_print_operand().
	* aarch64-opc.c (aarch64_print_operand): Use CPU features to determine
	preferred disassembly of system registers.
	(SR_RNG): Refactor to use new SR_FEAT2 macro.
	(SR_FEAT2): New.
	(SR_V8_1_A): New.
	(SR_V8_4_A): New.
	(SR_V8_A): New.
	(SR_V8_R): New.
	(SR_EXPAND_ELx): New.
	(SR_EXPAND_EL12): New.
	(aarch64_sys_regs): Specify which registers are only on
	A-profile, add R-profile system registers.
	(ENC_BARLAR): New.
	(PRBARn_ELx): New.
	(PRLARn_ELx): New.
	(aarch64_sys_ins_reg_supported_p): Reject EL3 registers for
	Armv8-R AArch64.
2020-09-08 14:21:44 +01:00
Alex Coplan
03fb3142c7 aarch64: Add support for Armv8-R DFB alias
This adds support for the DFB alias introduced in Armv8-R AArch64.

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* testsuite/gas/aarch64/dfb.d: New test.
	* testsuite/gas/aarch64/dfb.s: Input.

opcodes/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-tbl.h (aarch64_feature_v8_r): New.
	(ARMV8_R): New.
	(V8_R_INSN): New.
	(aarch64_opcode_table): Add dfb.
	* aarch64-opc-2.c: Regenerate.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis-2.c: Regenerate.
2020-09-08 14:18:38 +01:00
Alex Coplan
95830c988a aarch64: Add base support for Armv8-R
This patch adds the basic infrastructure needed to support Armv8-R in
AArch64 binutils: new command-line flags, new feature bits, a new BFD
architecture, and support for differentiating between architecture
variants in the disassembler.

The new command-line options added by this patch are -march=armv8-r in
GAS and -m aarch64:armv8-r in objdump.

The disassembler support is necessary since Armv8-R AArch64 introduces a
system register (VSCTLR_EL2) which shares an encoding with a different
system register (TTBR0_EL2) in Armv8-A. This also allows us to use the
correct preferred disassembly for the new DFB alias introduced in
Armv8-R.

bfd/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* archures.c (bfd_mach_aarch64_8R): New.
	* bfd-in2.h: Regenerate.
	* cpu-aarch64.c (bfd_aarch64_arch_v8_r): New.
	(bfd_aarch64_arch_ilp32): Update tail pointer.

gas/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-aarch64.c (aarch64_archs): Add armv8-r.
	* doc/c-aarch64.texi: Document -march=armv8-r.

include/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* opcode/aarch64.h (AARCH64_FEATURE_V8_A): New.
	(AARCH64_FEATURE_V8_R): New.
	(AARCH64_ARCH_V8): Include new A-profile feature bit.
	(AARCH64_ARCH_V8_R): New.

opcodes/ChangeLog:

2020-09-08  Alex Coplan  <alex.coplan@arm.com>

	* aarch64-dis.c (arch_variant): New.
	(determine_disassembling_preference): Disassemble according to
	arch variant.
	(select_aarch64_variant): New.
	(print_insn_aarch64): Set feature set.
2020-09-08 14:14:11 +01:00
Alan Modra
7c80dd4c2c ubsan: v850-opc.c:412 left shift cannot be represented
include/
	* opcode/v850.h (struct v850_operand <insert>): Make param op an
	unsigned long.
opcodes/
	* v850-opc.c (insert_i5div1, insert_i5div2, insert_i5div3),
	(insert_d5_4, insert_d8_6, insert_d8_7, insert_v8, insert_d9),
	(insert_u16_loop, insert_d16_15, insert_d16_16, insert_d17_16),
	(insert_d22, insert_d23, insert_d23_align1, insert_i9, insert_u9),
	(insert_spe, insert_r4, insert_POS, insert_WIDTH, insert_SELID),
	(insert_VECTOR8, insert_VECTOR5, insert_CACHEOP, insert_PREFOP),
	(nsert_IMM10U, insert_SRSEL1, insert_SRSEL2): Use unsigned long
	for value parameter and update code to suit.
	(extract_d9, extract_d16_15, extract_d16_16, extract_d17_16),
	(extract_d22, extract_d23, extract_i9): Use unsigned long variables.
2020-09-02 16:30:44 +09:30
Alan Modra
b4b393495f ubsan: i386-dis.c
i386-dis.c:12207 left shift of 128 by 24 places cannot be represented in type 'long int'
i386-dis.c:12220 left shift of 128 by 24 places cannot be represented in type 'long int'
i386-dis.c:12222 left shift of 1 by 31 places cannot be represented in type 'long int'
i386-dis.c:12222 signed integer overflow: 162254319 - -2147483648 cannot be represented in type 'long int'

	* i386-dis.c (OP_E_memory): Don't cast to signed type when
	negating.
	(get32, get32s): Use unsigned types in shift expressions.
2020-09-02 16:30:44 +09:30
Alan Modra
caf4537af5 ubsan: csky-dis.c:1038 left shift cannot be represented
* csky-dis.c (print_insn_csky): Use unsigned type for "given".
2020-09-02 16:30:44 +09:30
Alan Modra
3c5097eae4 ubsan: crx-dis.c:571 left shift of negative value
* crx-dis.c: Whitespace.
	(print_arg): Use unsigned type for longdisp and mask variables,
	and for left shift constant.
2020-09-02 16:30:44 +09:30
Alan Modra
ae3e98b418 ubsan: *-ibld.c
bfin-dis.c:160 shift exponent 32 is too large for 32-bit type 'long unsigned int'
bpf-ibld.c:196 left shift of 1 by 31 places cannot be represented in type 'long int'
bpf-ibld.c:196 negation of -2147483648 cannot be represented in type 'long int'; cast to an unsigned type to negate this
 itself
bpf-ibld.c:197 left shift of 1 by 31 places cannot be represented in type 'long int'
bpf-ibld.c:197 signed integer overflow: -2147483648 - 1 cannot be represented in type 'long int'
bpf-ibld.c:501 left shift of 1 by 31 places cannot be represented in type 'long int'

	* cgen-ibld.in (insert_normal, extract_normal): Use 1UL in left shift.
	* bpf-ibld.c: Regenerate.
	* epiphany-ibld.c: Regenerate.
	* fr30-ibld.c: Regenerate.
	* frv-ibld.c: Regenerate.
	* ip2k-ibld.c: Regenerate.
	* iq2000-ibld.c: Regenerate.
	* lm32-ibld.c: Regenerate.
	* m32c-ibld.c: Regenerate.
	* m32r-ibld.c: Regenerate.
	* mep-ibld.c: Regenerate.
	* mt-ibld.c: Regenerate.
	* or1k-ibld.c: Regenerate.
	* xc16x-ibld.c: Regenerate.
	* xstormy16-ibld.c: Regenerate.
2020-09-02 16:30:44 +09:30
Alan Modra
427202d967 ubsan: bfin-dis.c:160 shift exponent 32 is too large
* bfin-dis.c (MASKBITS): Use SIGNBIT.
2020-09-02 16:30:44 +09:30
Cooper Qu
4211a34001 CSKY: Add CPU CK803r3.
Move divul and divsl to CSKYV2_ISA_3E3R3 instruction set, which is
enabled by ck803r3, and it's still a part of enhance DSP instruction
set.

gas/
	* config/tc-csky.c (csky_cpus): Add ck803r3.
	(CSKY_ISA_803R3): Define.
	(CSKY_ISA_803R2): Refine, use CSKY_ISA_803R1.

include/
	* opcode/csky.h (CSKYV2_ISA_3E3R3): Define.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Move divul and divsl
	to CSKYV2_ISA_3E3R3 instruction set.
2020-09-02 14:21:31 +08:00
Cooper Qu
8119cc3837 CSKY: Fix Encode of mulsws.
gas/
	* testsuite/gas/csky/cskyv2_dsp.d : Fix Encode of mulsws.

opcodes/
	* csky-opc.h (csky_v2_opcodes): Fix Encode of mulsws.
2020-09-02 14:21:21 +08:00
Alan Modra
8dbe96f070 mep: ubsan: mep-ibld.c:1635,1645,1652 left shift of negative value
cpu/
	* mep-core.cpu (f-8s8a2, f-12s4a2, f-17s16a2): Multiply signed
	value by two rather than shifting left.
	(f-24s5a2n): Similarly multiply signed f-24s5a2n-hi to extract.
opcodes/
	* mep-ibld.c: Regenerate.
2020-09-01 16:03:08 +09:30
Cooper Qu
e2e82b115c CSKY: Refine operand format error reporting.
Rename SET_ERROR_NUMBER to SET_ERROR_STRING, and add SET_ERROR_INTEGER
to report error message which pass an integer argument.

gas/
	* config/tc-csky.c (csky_error_state): New member 'arg_int'.
	(SET_ERROR_NUMBER): Rename to SET_ERROR_STRING.
	(SET_ERROR_INTEGER): New.
	(err_formats): Add error format for ERROR_FREG_OVER_RANGE and
	ERROR_VREG_OVER_RANGE.
	(csky_show_error): Pass an integer argument for some error
	numbers.
	(parse_exp): Call SET_ERROR_STRING instead of SET_ERROR_NUMBER.
	(parse_rt): Likewise.
	(parse_type_ctrlreg): Likewise.
	(csky_get_reg_val): Likewise.
	(is_reglist_legal): Likewise.
	(is_freglist_legal): Likewise.
	(is_reglist_dash_comma_legal): Likewise.
	(is_reg_lshift_illegal): Likewise.
	(is_psr_bit): Likewise.
	(parse_type_cpreg): Likewise.
	(parse_type_cpcreg): Likewise.
	(parse_type_areg): Likewise.
	(parse_type_freg): Likewise.
	(parse_ldst_imm): Likewise and call SET_ERROR_INTEGER.
	(get_operand_value): Likewise.
	(parse_operands_op): Likewise and call is_imm_within_range,
	is_imm_within_range_ext and is_oimm_within_range.
	(md_assemble): Likewise.
	(is_imm_within_range): New.
	(is_imm_within_range_ext): Rename from is_imm_over_range.
	(is_oimm_within_range): Rename from is_oimm_over_range.
	(v2_work_add_sub): Call SET_ERROR_INTEGER.
	(csky_rolc): call is_imm_within_range instead of
	is_imm_over_range.

opcodes/
	* csky-dis.c (csky_output_operand): Assign dis_info.value for
	OPRND_TYPE_VREG.
2020-08-31 11:32:18 +08:00
Alan Modra
2781f857e6 cr16 disassembly error of disp20 fields
When looking at the UB errors, I noticed that cbitb_test.d disassembly
wasn't reproducing the input assembly.  That turned out to be an error
in make_argument case arg_cr.  This fixes that and makes some general
tidies.

opcodes/
	* cr16-dis.c: Formatting.
	(parameter): Delete struct typedef.  Use dwordU instead
	throughout file.
	(make_argument <arg_idxr>): Simplify detection of cbitb, sbitb
	and tbitb.
	(make_argument <arg_cr>): Extract 20-bit field not 16-bit.
gas/
	* testsuite/gas/cr16/cbitb_test.d: Update expected output.
	* testsuite/gas/cr16/cbitw_test.d: Likewise.
	* testsuite/gas/cr16/sbitb_test.d: Likewise.
	* testsuite/gas/cr16/sbitw_test.d: Likewise.
	* testsuite/gas/cr16/storb_test.d: Likewise.
	* testsuite/gas/cr16/storw_test.d: Likewise.
	* testsuite/gas/cr16/tbitb_test.d: Likewise.
	* testsuite/gas/cr16/tbitw_test.d: Likewise.
2020-08-30 20:49:32 +09:30
Alan Modra
0c0577f6a8 PR26446 UBSAN: tc-csky.c:2618,4022 index out of bounds
PR 26446
	* csky-opc.h (MAX_OPRND_NUM): Define to 5.
	(union csky_operand): Use MAX_OPRND_NUM to size oprnds array.
2020-08-29 13:17:57 +09:30
Alan Modra
a1e60a1bdc PR26449, PR26450 UBSAN: frv-ibld.c:135 left shift
Eh well, I guess the code didn't quite live up to the comment.

	PR 26449
	PR 26450
	* cgen-ibld.in (insert_1): Use 1UL in forming mask.
	(extract_normal): Likewise.
	(insert_normal): Likewise, and move past zero length test.
	(put_insn_int_value): Handle mask for zero length, use 1UL.
	* bpf-ibld.c, * epiphany-ibld.c, * fr30-ibld.c, * frv-ibld.c,
	* ip2k-ibld.c, * iq2000-ibld.c, * lm32-ibld.c, * m32c-ibld.c,
	* m32r-ibld.c, * mep-ibld.c, * mt-ibld.c, * or1k-ibld.c,
	* xc16x-ibld.c, * xstormy16-ibld.c: Regenerate.
2020-08-28 23:52:26 +09:30
Cooper Qu
0861f561eb CSKY: Support attribute section.
bfd
        * elf32-csky.c (csky_archs): Fix arch names.
        (csky_find_arch_with_name): New.
        (elf32_csky_merge_attributes): New.
        (csky_elf_merge_private_bfd_data): Add process of merge
        attribute section.
        (elf32_csky_obj_attrs_arg_type): New.
        (elf32_csky_obj_attrs_handle_unknown): New.
        (elf_backend_obj_attrs_vendor): Define.
        (elf_backend_obj_attrs_section): Define.
        (elf_backend_obj_attrs_arg_type): Define.
        (elf_backend_obj_attrs_section_type): Define.

binutils/
        * readelf.c (get_csky_section_type_name): New.
        (get_section_type_name): Add handler for CSKY.
        (display_csky_attribute): New.
        (process_arch_specific): Add handler for CSKY.
        * testsuite/binutils-all/strip-3.d: Remove .csky.attributes
        section.

elfcpp/
        * elfcpp.h (enum SHT): New enum SHT_CSKY_ATTRIBUTES.

gas/
        * gas/config/tc-csky.c (md_begin): Set attributes.
        (isa_flag): Change type to unsigned 64 bits.
        (struct csky_cpu_info): Likewise.
        (struct csky_macro_info): Likewise.
        (set_csky_attribute): New.
        * testsuite/gas/csky/802j.d: Ignore .csky.attributes section.
        * testsuite/gas/csky/all.d: Likewise.
        * testsuite/gas/csky/bsr1.d: Likewise.
        * testsuite/gas/csky/csky_vdsp.d: Likewise.
        * testsuite/gas/csky/cskyv2_all.d: Likewise.
        * testsuite/gas/csky/cskyv2_ck803r2.d: Likewise.
        * testsuite/gas/csky/cskyv2_ck860.d: Likewise.
        * testsuite/gas/csky/cskyv2_dsp.d: Likewise.
        * testsuite/gas/csky/cskyv2_elrw.d: Likewise.
        * testsuite/gas/csky/cskyv2_float.d: Likewise.
        * testsuite/gas/csky/enhance_dsp.d: Likewise.
        * testsuite/gas/csky/java.d: Likewise.
        * testsuite/gas/csky/v1_float.d: Likewise.
        * testsuite/gas/csky/v2_float_part1.d: Likewise.
        * testsuite/gas/csky/v2_float_part2.d: Likewise.
        * testsuite/gas/csky/v2_tls_gd.d: Likewise.
        * testsuite/gas/csky/v2_tls_ie.d: Likewise.
        * testsuite/gas/csky/v2_tls_ld.d: Likewise.
        * testsuite/gas/csky/v2_tls_le.d: Likewise.
        * testsuite/gas/elf/elf.exp: Add handler for CSKY.
        * testsuite/gas/elf/section2.e-csky: New.

include/
        * elf/csky.h (SHT_CSKY_ATTRIBUTES): Define.
        (Tag_CSKY_ARCH_NAME): New enum constant.
        (Tag_CSKY_CPU_NAME): Likewise.
        (Tag_CSKY_ISA_FLAGS): Likewise.
        (Tag_CSKY_DSP_VERSION): Likewise.
        (Tag_CSKY_VDSP_VERSION): Likewise.
        (Tag_CSKY_FPU_VERSION): Likewise.
        (Tag_CSKY_FPU_ABI): Likewise.
        (Tag_CSKY_FPU_ROUNDING): Likewise.
        (Tag_CSKY_FPU_DENORMAL): Likewise.
        (Tag_CSKY_FPU_Exception): Likewise.
        (Tag_CSKY_FPU_NUMBER_MODULE): Likewise.
        (Tag_CSKY_FPU_HARDFP): Likewise.
        (Tag_CSKY_MAX): Likewise.
        (VAL_CSKY_DSP_VERSION_EXTENSION): Likewise.
        (VAL_CSKY_DSP_VERSION_2): Likewise.
        (VAL_CSKY_VDSP_VERSION_1): Likewise.
        (VAL_CSKY_VDSP_VERSION_2): Likewise.
        (VAL_CSKY_FPU_ABI_SOFT): Likewise.
        (VAL_CSKY_FPU_ABI_SOFTFP): Likewise.
        (VAL_CSKY_FPU_ABI_HARD): Likewise.
        (VAL_CSKY_FPU_HARDFP_HALF): Likewise.
        (VAL_CSKY_FPU_HARDFP_SINGLE): Likewise.
        (VAL_CSKY_FPU_HARDFP_DOUBLE): Likewise.
        * opcode/csky.h (CSKY_ISA_VDSP_V2): Define.
        CSKYV1_ISA_E1: Change to long constant type.
        CSKYV2_ISA_E1: Likewise.
        CSKYV2_ISA_1E2: Likewise.
        CSKYV2_ISA_2E3: Likewise.
        CSKYV2_ISA_3E7: Likewise.
        CSKYV2_ISA_7E10: Likewise.
        CSKYV2_ISA_3E3R1: Likewise.
        CSKYV2_ISA_3E3R2: Likewise.
        CSKYV2_ISA_10E60: Likewise.
        CSKY_ISA_TRUST: Likewise.
        CSKY_ISA_CACHE: Likewise.
        CSKY_ISA_NVIC: Likewise.
        CSKY_ISA_CP: Likewise.
        CSKY_ISA_MP: Likewise.
        CSKY_ISA_MP_1E2: Likewise.
        CSKY_ISA_JAVA: Likewise.
        CSKY_ISA_MAC: Likewise.
        CSKY_ISA_MAC_DSP: Likewise.
        CSKY_ISA_DSP: Likewise.
        CSKY_ISA_DSP_1E2: Likewise.
        CSKY_ISA_DSP_ENHANCE: Likewise.
        CSKY_ISA_FLOAT_E1: Likewise.
        CSKY_ISA_FLOAT_1E2: Likewise.
        CSKY_ISA_FLOAT_1E3: Likewise.
        CSKY_ISA_FLOAT_3E4: Likewise.
        CSKY_ISA_VDSP: Likewise.

ld/
        * emulparams/cskyelf.sh: Support attribute section.
        * testsuite/ld-csky/tls-le-v1.d: Match .csky.attributes section.
        * ld/testsuite/ld-csky/tls-le.d: Likewise.
        * testsuite/ld-elf/non-contiguous.ld: Ignore .csky.attributes
        section.

opcodes/
        * csky-dis.c (CSKY_DEFAULT_ISA): Define.
        (csky_dis_info): Add member isa.
        (csky_find_inst_info): Skip instructions that do not belong to
        current CPU.
        (csky_get_disassembler): Get infomation from attribute section.
        (print_insn_csky): Set defualt ISA flag.
        * csky.h (CSKY_ISA_VDSP_2): Rename from CSKY_ISA_VDSP_V2.
        * csky-opc.h (struct csky_opcode): Change isa_flag16 and
        isa_flag32'type to unsigned 64 bits.
2020-08-28 17:23:24 +08:00
Jose E. Marchesi
31b3f3e6e4 opcodes: Add missing entries to ebpf_isa_attr
opcodes/

	* disassemble.c (enum epbf_isa_attr): Add ISA_XBPFBE, ISA_EBPFMAX.
2020-08-26 16:48:39 +02:00
David Faust
4449c81a85 bpf: add xBPF ISA
This patch adds support for xBPF, another ISA targetting the BPF
virtual architecture. For now, the primary difference between eBPF
and xBPF is that xBPF supports indirect calls through the
'call %reg' form of the call instruction.

bfd/
	* archures.c (bfd_mach_xbpf): Define.
	* bfd-in2.h: Regenerate.
	* cpu-bpf.c (bfd_xbpf_arch) New.
	(bfd_bpf_arch) Update next in list field to point to xbpf arch.

cpu/
	* bpf.cpu (arch bpf): Add xbpf mach and isas.
	(define-xbpf-isa) New pmacro.
	(all-isas) Add xbpfle,xbpfbe.
	(endian-isas): New pmacro.
	(mach xbpf): New.
	(model xbpf-def): Likewise.
	(h-gpr): Add xbpf mach.
	(f-dstle, f-srcle, dstle, srcle): Add xbpfle isa.
	(f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa.
	(define-alu-insn-un): Use new endian-isas pmacro.
	(define-alu-insn-bin, define-alu-insn-mov): Likewise.
	(define-endian-insn, define-lddw): Likewise.
	(dlind, dxli, dxsi, dsti): Likewise.
	(define-cond-jump-insn, define-call-insn): Likewise.
	(define-atomic-insns): Likewise.

gas/
	* config/tc-bpf.c: Add option -mxbpf to select xbpf isa.
	* testsuite/gas/bpf/indcall-1.d: New file.
	* testsuite/gas/bpf/indcall-1.s: Likewise.
	* testsuite/gas/bpf/indcall-bad-1.l: Likewise.
	* testsuite/gas/bpf/indcall-bad-1.s: Likewise.
	* testsuite/gas/bpf/bpf.exp: Run new tests.

opcodes/
	* bpf-desc.c: Regenerate.
	* bpf-desc.h: Likewise.
	* bpf-opc.c: Likewise.
	* bpf-opc.h: Likewise.
	* disassemble.c (disassemble_init_for_target): Set bits for xBPF
	ISA when appropriate.
2020-08-26 15:39:00 +02:00
Alan Modra
8640c87dcd PR26504, ASAN: parse_disassembler_options vax-dis.c:142
PR 26504
	* vax-dis.c (parse_disassembler_options): Always add at least one
	to entry_addr_total_slots.
2020-08-25 23:07:10 +09:30
Cooper Qu
531c73a37b CSKY: Add new arch CK860.
bfd/
        * bfd-in2.h (bfd_mach_ck860): New.
        * cpu-csky.c (arch_info_struct): Add item for CK860.

gas/
        * config/tc-csky.c (csky_archs): Add item for CK860,
        change ck810 and ck807's arch_flag.
        (csky_cpus): Add item for CK860.
        (md_begin): Enable DSP for CK810 and CK807 by default.
        (md_apply_fix): Fix CKCORE_TLS_IE32 relocation failure.
        * gas/testsuite/gas/csky/cskyv2_all.d: Change 'sync 0'
        to 'sync'.
        * gas/testsuite/gas/csky/cskyv2_all.s: Likewise.
        * gas/testsuite/gas/csky/cskyv2_ck860.d: New.
        * gas/testsuite/gas/csky/cskyv2_ck860.s: New.
        * gas/testsuite/gas/csky/enhance_dsp.d: Change plsli.u16
        to plsli.16.
        * gas/testsuite/gas/csky/enhance_dsp.s: Likewise.

include/
        * opcode/csky.h (CSKYV2_ISA_10E60): New.
        (CSKY_ARCH_860): New.

opcode/
        * csky-dis.c (csky_find_inst_info): Skip CK860's instructions
        in other CPUs to speed up disassembling.
        * csky-opc.h (csky_v2_opcodes): Add CK860's instructions,
        Change plsli.u16 to plsli.16, change sync's operand format.

Change-Id: I80ec1a9c0cc600d668082a9b91ae6d45b33ec0fc
2020-08-24 20:27:07 +08:00
Cooper Qu
d04aee0f41 CSKY: Add ck803r2 series cpu.
gas/
        * config/tc-csky.c (CSKY_ISA_803R2): New.
        (csky_archs): Add ck803r2 series.
        (md_begin): Fix warning about -medsp.
        (csky_get_freg_val): Support lowercase of fpu register name.
        * testsuite/gas/csky/cskyv2_ck803r2.s: New file.
        * testsuite/gas/csky/cskyv2_ck803r2.d: New file.

include/
        * csky.h (CSKYV2_ISA_3E3R2): New.

opcodes/
        * csky-opc.h (csky_v2_opcodes): Add instruction bnezad.
2020-08-24 10:25:03 +08:00
Nick Clifton
ccf61261eb Fix problems with the AArch64 linker exposed by testing it with sanitization enabled.
bfd	* elfnn-aarch64.c (_bfd_aarch64_erratum_835769_scan): Only sort
	the data map if there are entries in it.
	(_bfd_aarch64_erratum_843419_scan): Likewise.

opcodes	* aarch64-dis.c (get_sym_code_type): Return FALSE for non-ELF
	symbols.
2020-08-21 15:32:20 +01:00
Cooper Qu
d285ba8d06 CSKY: Support two operands form for bloop.
gas/
        * config/tc-csky.c (csky_insn_info): Add member last_isize.
        (md_assemble): Assign value to csky_insn.last_isize.
        * testsuite/gas/csky/enhance_dsp.d: Test bloop's two operands form.
        * testsuite/gas/csky/enhance_dsp.s: Likewise.

opcodes/
        * csky-opc.h (csky_v2_opcodes): Add two operands form for bloop.
2020-08-21 16:50:11 +08:00
Alan Modra
18a8a00ebe Correct vcmpsq, vcmpuq and xvtlsbb BF field
These shouldn't be optional.  The record form of vector instructions
set CR6, giving an expectation that omitting BF should be the same as
specifying CR6.

opcodes/
	* ppc-opc.c (powerpc_opcodes): Replace OBF with BF for vcmpsq,
	vcmpuq and xvtlsbb.
gas/
	* testsuite/gas/ppc/int128.s: Correct vcmpuq.
	* testsuite/gas/ppc/int128.d: Update.
	* testsuite/gas/ppc/xvtlsbb.d: Update.
2020-08-19 08:47:35 +09:30
Peter Bergner
587a437176 Add ChangeLog entries for previous commit. 2020-08-18 12:48:42 -05:00
Peter Bergner
f5fc30d05c PowerPC: Rename xvcvbf16sp to xvcvbf16spn
The xvcvbf16sp mnemonic has been renamed to xvcvbf16spn, to be consistent
with the other non-signaling conversion instructions which all end with "n".

opcodes/
	* ppc-opc.c (powerpc_opcodes) <xvcvbf16sp>: Rename from this...
	<xvcvbf16spn>: ...to this.

gas/
	* testsuite/gas/ppc/vsx4.s: Update test to use new mnemonic.
	* testsuite/gas/ppc/vsx4.d: Likewise.
2020-08-18 12:43:46 -05:00
Alex Coplan
2e49fd1edf aarch64: Add support for MPAM system registers
This patch adds support for the system registers introduced in the
Armv8-A MPAM extension.

See https://developer.arm.com/documentation/ddi0598/latest for the
Arm ARM supplement documenting this extension.

gas/ChangeLog:

	* testsuite/gas/aarch64/mpam-bad.d: New test.
	* testsuite/gas/aarch64/mpam-bad.l: Error output.
	* testsuite/gas/aarch64/mpam-bad.s: Input.
	* testsuite/gas/aarch64/mpam.d: New test.
	* testsuite/gas/aarch64/mpam.s: Input.

opcodes/ChangeLog:

	* aarch64-opc.c (aarch64_sys_regs): Add MPAM registers.
2020-08-12 13:53:17 +01:00
Nick Clifton
79ddc88496 Updated Serbian and Russian translations for various sub-directories 2020-08-12 11:25:38 +01:00
Alan Modra
08770ec259 PowerPC CELL cctp*
* ppc-opc.c (powerpc_opcodes): Move cctpl, cctpm and cctph.
2020-08-11 22:06:40 +09:30
Przemyslaw Wirkus
f7cb161ea6 [aarch64] GAS doesn't validate the architecture version for any tlbi registers. Fixed with this patch.
* gas/config/tc-aarch64.c (parse_sys_reg): Call to
	aarch64_sys_ins_reg_supported_p instead of aarch64_sys_reg_supported_p.
	(parse_sys_ins_reg): Add aarch64_sys_reg_deprecated_p check.
	* include/opcode/aarch64.h (aarch64_sys_reg_deprecated_p): Functions
	paramaters changed.
	(aarch64_sys_reg_supported_p): Function removed.
	(aarch64_sys_ins_reg_supported_p): Functions paramaters changed.
	* opcodes/aarch64-opc.c (aarch64_print_operand):
	(aarch64_sys_reg_deprecated_p): Functions paramaters changed.
	(aarch64_sys_reg_supported_p): Function removed.
	(aarch64_sys_ins_reg_supported_p): Functions paramaters changed.
	(aarch64_sys_ins_reg_supported_p): Merged aarch64_sys_reg_supported_p
	into this function.
	* gas/testsuite/gas/aarch64/illegal-sysreg-5.d: New test.
	* gas/testsuite/gas/aarch64/illegal-sysreg-5.l: New test.
	* gas/testsuite/gas/aarch64/sysreg-5.s: New test.
2020-08-10 16:20:17 +01:00
Alan Modra
3eb651743e Implement missing powerpc mtspr and mfspr extended insns
* ppc-opc.c (powerpc_opcodes): Add many mtspr and mfspr extended
	instructions.
2020-08-10 21:52:17 +09:30
Alan Modra
8b2742a156 Implement missing powerpc extended mnemonics
gas/
	* testsuite/gas/ppc/power8.d,
	* testsuite/gas/ppc/power8.s: Add miso.
	* testsuite/gas/ppc/power9.d,
	* testsuite/gas/ppc/power8.s: Add exser, msgsndu, msgclru.
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add exser, msgsndu, msgclru.
	Enable icbt for power5, miso for power8.
2020-08-10 21:52:17 +09:30
Alan Modra
5fbec329ec Prioritise mtfprd and mtvrd over mtvsrd in PowerPC disassembly
gas/
	* testsuite/gas/ppc/power8.d: Update.
	* testsuite/gas/ppc/vsx2.d: Update.
opcodes/
	* ppc-opc.c (powerpc_opcodes): Prioritise mtfprd and mtvrd over
	mtvsrd, and similarly for mfvsrd.
2020-08-10 21:52:17 +09:30
Christian Groessler
563a322515 Z8k: fix sout/soudb opcodes with direct address
Problem found by Tadashi G. Takaoka.

2020-08-04  Christian Groessler  <chris@groessler.org>
     Tadashi G. Takaoka <tadashi.g.takaoka@gmail.com>

 * z8kgen.c (opt): Fix "sout imm16,rs" and "soutb imm16,rbs"
 opcodes (special "out" to absolute address).
 * z8k-opc.h: Regenerate.

2020-08-04  Christian Groessler  <chris@groessler.org>

 * gas/testsuite/gas/z8k/inout.d: Adapt to correct encoding of
 "sout/soutb #imm,reg"
2020-08-04 22:31:42 +02:00
H.J. Lu
41eb8e8885 x86: Add {disp16} pseudo prefix
Use Prefix_XXX for pseudo prefixes.  Add {disp16} pseudo prefix and
replace {disp32} pseudo prefix with {disp16} in 16-bit mode test.
Check invalid {disp16}/{disp32} pseudo prefixes.

gas/

	PR gas/26305
	* config/tc-i386.c (_i386_insn::disp_encoding): Add
	disp_encoding_16bit.
	(parse_insn): Check Prefix_XXX for pseudo prefixes.  Handle
	{disp16}.
	(build_modrm_byte): Handle {disp16}.
	(i386_index_check): Check invalid {disp16} and {disp32} pseudo
	prefixes.
	* doc/c-i386.texi: Update {disp32} documentation and document
	{disp16}.
	* testsuite/gas/i386/i386.exp: Run x86-64-inval-pseudo.
	* testsuite/gas/i386/inval-pseudo.s: Add {disp32}/{disp16}
	tests.
	* testsuite/gas/i386/pseudos.s: Add {disp8}/{disp32} vmovaps
	tests with 128-byte displacement.  Add {disp16} tests.
	* testsuite/gas/i386/x86-64-pseudos.s: Add {disp8}/{disp32}
	vmovaps test.  Add (%r13)/(%r13d) tests.
	* testsuite/gas/i386/x86-64-inval-pseudo.l: New file.
	* testsuite/gas/i386/x86-64-inval-pseudo.s: Likewise.
	* testsuite/gas/i386/inval-pseudo.l: Updated.
	* testsuite/gas/i386/pseudos.d: Likewise.
	* testsuite/gas/i386/x86-64-pseudos.d: Likewise.

opcodes/

	PR gas/26305
	* i386-opc.h (Prefix_Disp8): New.
	(Prefix_Disp16): Likewise.
	(Prefix_Disp32): Likewise.
	(Prefix_Load): Likewise.
	(Prefix_Store): Likewise.
	(Prefix_VEX): Likewise.
	(Prefix_VEX3): Likewise.
	(Prefix_EVEX): Likewise.
	(Prefix_REX): Likewise.
	(Prefix_NoOptimize): Likewise.
	* i386-opc.tbl: Use Prefix_XXX on pseudo prefixes.  Add {disp16}.
	* i386-tbl.h: Regenerated.
2020-07-30 16:13:17 -07:00
Andreas Arnez
9811697376 PR26279 Work around maybe-uninitialized warning in s390-mkopc.c
In s390-mkopc.c, the function insertExpandedMnemonic() searches for the
first occurrence of '*' or '$' in the given mnemonic, and, if a match is
found, chooses an extension table using a switch() on that character.  The
switch statement contains a default case that prints an error message and
does not set the extension table.  Although this case cannot occur, some
GCC versions obviously conclude that the extension table might have been
left uninitialized after the switch statement and consequently emit
maybe-uninitialized warnings for the variables 'ext_table' and
'ext_table_length'.

Circumvent the warning by handling the unreachable default case with
abort().

opcodes/
	* s390-mkopc.c (insertExpandedMnemonic): Handle unreachable
	default case with abort() instead of printing an error message and
	continuing, to avoid a maybe-uninitialized warning.
2020-07-29 19:46:44 +02:00
Nick Clifton
2dddfa201b Updated German translation for the opcodes sub-directory 2020-07-24 10:14:22 +01:00
Jan Beulich
bf4ba07ca6 Revert "x86: Don't display eiz with no scale"
This reverts commit 04c662e2b6.
In my underlying suggestion I neglected the fact that in those
cases (,%eiz,1) is the only visible indication that 32-bit
addressing is in effect.
2020-07-21 14:20:11 +02:00
H.J. Lu
04c662e2b6 x86: Don't display eiz with no scale
Change

67 48 8b 1c 25 ef cd ab 89 	mov    0x89abcdef(,%eiz,1),%rbx

to

67 48 8b 1c 25 ef cd ab 89 	mov    0x89abcdef,%rbx

in AT&T syntax and

67 48 8b 1c 25 ef cd ab 89 	mov    rbx,QWORD PTR [eiz*1+0x89abcdef]

to

67 48 8b 1c 25 ef cd ab 89 	mov    rbx,QWORD PTR ds:0x89abcdef

in Intel syntax.

gas/

	PR gas/26237
	* testsuite/gas/i386/evex-no-scale-64.d: Updated.
	* testsuite/gas/i386/addr32.d: Likewise.
	* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-addr32.d: Likewise.

opcodes/

	PR gas/26237
	* i386-dis.c (OP_E_memory): Don't display eiz with no scale
	without base nor index registers.
2020-07-15 06:57:47 -07:00
Jan Beulich
f0e8d0bae4 x86: move putop() case labels to restore alphabetic sorting
... as far as non-fall-through behavior permits.
2020-07-15 08:55:53 +02:00
Jan Beulich
c3f5525ff1 x86: make PUSH/POP disassembly uniform
Irrespective of their encoding the resulting output should look the
same. Therefore wire the handling of PUSH/POP with GPR operands
encoded in the main opcode byte to the same logic used for other
operands. This frees up yet another macro character.
2020-07-15 08:55:20 +02:00
Jan Beulich
36938cabf0 x86: avoid attaching suffixes to unambiguous insns
"Unambiguous" is is in particular taking as reference the assembler,
which also accepts certain insns - despite them allowing for varying
operand size, and hence in principle being ambiguous - without any
suffix. For example, from the very beginning of the life of x86-64 I had
trouble understanding why a plain and simple RET had to be printed as
RETQ. In case someone really used the 16-bit form, RETW disambiguates
the two quite fine.
2020-07-15 08:53:55 +02:00
H.J. Lu
8e58ef803c x86-64: Zero-extend lower 32 bits displacement to 64 bits
Since the addr32 (0x67) prefix zero-extends the lower 32 bits address to
64 bits, change disassembler to zero-extend the lower 32 bits displacement
to 64 bits when there is no base nor index registers.

gas/

	PR gas/26237
	* testsuite/gas/i386/addr32.s: Add tests for 32-bit wrapped around
	address.
	* testsuite/gas/i386/x86-64-addr32.s: Likewise.
	* testsuite/gas/i386/addr32.d: Updated.
	* testsuite/gas/i386/x86-64-addr32-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-addr32.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-addr32-intel.d: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-addr32.d: Likewise.

opcodes/

	PR gas/26237
	* i386-dis.c (OP_E_memory): Without base nor index registers,
	32-bit displacement to 64 bits.
2020-07-14 09:58:07 -07:00
Claudiu Zissulescu
570b0ed6d5 arc: Detect usage of illegal double register pairs
ARC can use odd-even double register pairs in some selected
instructions. Although the GNU assembler doesn't allow even-odd
registers to be used, there may be cases when the disassembler is
presented with such situation.  This patch add a test and detects such
cases.

opcodes/
2020-07-14  Claudiu Zissulescu  <claziss@gmail.com>

	* arc-dis.c (print_insn_arc): Detect and emit a warning when a
	faulty double register pair is detected.

binutils/
2020-07-14  Claudiu Zissulescu  <claziss@gmail.com>

	* testsuite/binutils-all/arc/double_regs.s: New test.
	* testsuite/binutils-all/arc/objdump.exp: Add the above test.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2020-07-14 14:51:15 +03:00
Jan Beulich
bfbd943845 x86/Intel: debug registers are named DRn
%db<n> is an AT&T invention; the Intel documentation and MASM have only
ever specified DRn (in line with CRn and TRn). (In principle gas also
shouldn't accept the names in Intel mode, but at least for now I've kept
things as they are. Perhaps as a first step this should just be warned
about.)
2020-07-14 10:43:38 +02:00
Jan Beulich
78467458dd x86: drop Rm and the 'L' macro
Rm (and hence OP_R()) can be dropped by making 'Z' force modrm.mod to 3
(for OP_E()) instead of ignoring it. While at it move 'Z' handling to
its designated place (after 'Y'; 'W' handling will be moved by a later
change).

Moves to/from TRn are illegal in 64-bit mode and thus get converted to
honor this at the same time (also getting them in line with moves
to/from CRn/DRn ModRM.mod handling wise). This then also frees up the L
macro.
2020-07-14 10:43:03 +02:00
Jan Beulich
464d2b6568 x86: drop Rdq, Rd, and MaskR
Rdq, Rd, and MaskR can be replaced by Edq, Ed / Rm, and MaskE
respectively, as OP_R() doesn't enforce ModRM.mod == 3, and hence where
MOD matters but hasn't been decoded yet it needs to be anyway. (The case
of converting to Rm is temporary until a subsequent change.)
2020-07-14 10:42:33 +02:00
Jan Beulich
035e7389dd x86: simplify decode of opcodes valid only without any (embedded) prefix
In this case there's no need to go through prefix_table[] at all - the
.prefix_requirement == PREFIX_OPCODE machinery takes care of this case
already.

A couple of further adjustments are needed though:
- Gv / Ev and alike then can't be used (needs to be Gdq / Edq instead),
- dq_mode and friends shouldn't lead to PREFIX_DATA getting set in
  used_prefixes.
2020-07-14 10:42:03 +02:00
Jan Beulich
bb5b3501b3 x86: also use %BW / %DQ for kshift* 2020-07-14 10:41:30 +02:00
Jan Beulich
7531c61332 x86: simplify decode of opcodes valid with (embedded) 66 prefix only
The only valid (embedded or explicit) prefix being the data size one
(which is a fairly common pattern), avoid going through prefix_table[].
Instead extend the "required prefix" logic to also handle PREFIX_DATA
alone in a table entry, now used to identify this case. This requires
moving the (adjusted) ->prefix_requirement logic ahead of the printing
of stray prefixes, as the latter needs to observe the new setting of
PREFIX_DATA in used_prefixes.

Also add PREFIX_OPCODE on related entries when previously there was
mistakenly no decode step through prefix_table[].
2020-07-14 10:33:40 +02:00
Jan Beulich
17d3c7eccd x86: drop further EVEX table entries that can be served by VEX ones
A few cases were missed by 6df22cf64c ("x86: drop EVEX table entries
that can be served by VEX ones").
2020-07-14 10:32:51 +02:00
Jan Beulich
41f5efc685 x86: drop need_vex_reg
It was quite odd for the prior operand handling to have to clear this
flag for the actual operand handling to print nothing. Have the actual
operand handling determine whether the operand is actually present.
With this {d,q}_scalar_swap_mode become unused and hence also get dropped.
2020-07-14 10:32:19 +02:00
Jan Beulich
89e65d17e3 x86: drop Vex128 and Vex256
These are only used when VEX.L or EVEX.L'L have already been decoded,
and hence the "normal" length dependent name determination is quite
fine. Adjust a few enumerators to make clear that vex_len_table[] has
been consulted; be consistent and do so for all *f128 and *i128 insns
in one go.
2020-07-14 10:31:49 +02:00
Jan Beulich
492a76aab5 x86: replace %LW by %DQ
This makes more visible what the two alternatives will be that result
from this macro.
2020-07-14 10:30:26 +02:00
Jan Beulich
059edf8b97 x86: merge/move logic determining the EVEX disp8 shift
Fold redundant case blocks and move the extra adjustments logic into
the single case block that actually needs it - there's no need to go
through the extra logic for all the other cases. Also utilize there that
vex.b cannot be set at this point, due to earlier logic. Reduce the
comment there, which was partly stale anyway.
2020-07-14 10:29:55 +02:00
Jan Beulich
4726e9a479 x86: extend %BW use to VP{COMPRESS,EXPAND}{B,W}
Unlike the earlier ones these also need their operands adjusted. Replace
the (mis-described: there's nothing "scalar" here) {b,w}_scalar_mode by
a single new mode, with the actual unit width controlled by EVEX.W.
2020-07-14 10:29:25 +02:00
Jan Beulich
b24d668c07 x86-64: fix {,V}PCMPESTR{I,M} disassembly in Intel mode
The operands don't allow disambiguating the insn in 64-bit mode, and
hence suffixes need to be emitted not just in AT&T mode. Achieve this
by re-using %LQ while dropping PCMPESTR_Fixup().
2020-07-14 10:28:12 +02:00
Jan Beulich
c4de76066e x86: fold VCMP_Fixup() into CMP_Fixup()
There's no reason to have two functions and two tables, when the AVX
functionality here is a proper superset of the SSE one.
2020-07-14 10:27:32 +02:00
Jan Beulich
9ab00b61a9 x86: don't disassemble MOVBE with two suffixes
MOVBE_Fixup() is entirely redundant with the S macro already used on the
mnemonics, leading to double suffixes in suffix-always mode. Drop the
function.
2020-07-14 10:26:51 +02:00
Jan Beulich
2875b28aa8 x86: avoid attaching suffix to register-only CRC32
Just like other insns with GPR operands, CRC32 with only register
operands should not get a suffix added unless in suffix-always mode.
Do away with CRC32_Fixup() altogether, using other more generic logic
instead.
2020-07-14 10:25:43 +02:00
Jan Beulich
e184e6110e x86-64: don't hide an empty but meaningless REX prefix
Unlike for non-zero values passed to USED_REX(), where rex_used gets
updated only when the respective bit was actually set in the encoding,
zero getting passed in is not further guarded, yet such a (potentially
"empty") REX prefix takes effect only when there are registers numbered
4 and up.
2020-07-14 10:24:26 +02:00
Jan Beulich
e8b5d5f971 x86: drop dead code from OP_IMREG()
There's only a very limited set of modes that this function gets invoked
with - avoid it being more generic than it needs to be. This may, down
the road, allow actually doing away with the function altogether.

This eliminates a first improperly used "USED_REX (0)".
2020-07-14 10:23:36 +02:00