1999-05-03 15:29:11 +08:00
|
|
|
/* Print SPARC instructions.
|
2017-01-02 11:36:43 +08:00
|
|
|
Copyright (C) 1989-2017 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-05 17:49:03 +08:00
|
|
|
This file is part of the GNU opcodes library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
2003-01-29 20:51:57 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-05 17:49:03 +08:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
any later version.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-05 17:49:03 +08:00
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
License for more details.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-01-29 20:51:57 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-07-01 19:16:33 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#include "sysdep.h"
|
2012-05-17 23:13:28 +08:00
|
|
|
#include <stdio.h>
|
1999-05-03 15:29:11 +08:00
|
|
|
#include "opcode/sparc.h"
|
|
|
|
#include "dis-asm.h"
|
|
|
|
#include "libiberty.h"
|
|
|
|
#include "opintl.h"
|
|
|
|
|
|
|
|
/* Bitmask of v9 architectures. */
|
|
|
|
#define MASK_V9 ((1 << SPARC_OPCODE_ARCH_V9) \
|
2000-10-20 18:38:47 +08:00
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9A) \
|
bfd,opcodes: sparc: new opcode v9{c,d,e,v,m} architectures and bfd machine numbers.
This patch adds support for the opcode architectures
SPARC_OPCODE_ARCH_V9{C,D,E,V,M} and its associated BFD machine numbers
bfd_mach_sparc_v9{c,d,e,v,m} and bfd_mach_sparc_v8plus{c,d,e,v,m}.
Note that for arches up to v9b (UltraSPARC III), the detection of the
BFD machine type was based on the bits in the e_machine field of the ELF
header. However, there are no more available bits in that field, so
this patch takes the approach of using the hardware capabilities stored
in the object attributes HWCAPS/HWCAPS2 in order to characterize the
machine the object was built for.
bfd/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v8plusc): Define.
(bfd_mach_sparc_v9c): Likewise.
(bfd_mach_sparc_v8plusd): Likewise.
(bfd_mach_sparc_v9d): Likewise.
(bfd_mach_sparc_v8pluse): Likewise.
(bfd_mach_sparc_v9e): Likewise.
(bfd_mach_sparc_v8plusv): Likewise
(bfd_mach_sparc_v9v): Likewise.
(bfd_mach_sparc_v8plusm): Likewise.
(bfd_mach_sparc_v9m): Likewise.
(bfd_mach_sparc_v9_p): Adapt to v8plusm and v9m.
(bfd_mach_sparc_64bit_p): Likewise.
* bfd-in2.h: Regenerate.
* cpu-sparc.c (arch_info_struct): Add entries for
bfd_mach_sparc_v8plus{c,d,e,v,m} and bfd_mach_sparc_v9{c,d,e,v,m}.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v8plus{c,d,e,v,m}
and bfd_mach_sparc_v9{c,d,e,v,m}.
* elf32-sparc.c (elf32_sparc_final_write_processing): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Likewise.
include/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* opcode/sparc.h (enum sparc_opcode_arch_val): Add
SPARC_OPCODE_ARCH_V9C, SPARC_OPCODE_ARCH_V9D,
SPARC_OPCODE_ARCH_V9E, SPARC_OPCODE_ARCH_V9V and
SPARC_OPCODE_ARCH_V9M.
opcodes/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Add SPARC_OPCODE_ARCH_V9{C,D,E,V,M}.
(compute_arch_mask): Handle bfd_mach_sparc_v8plus{c,d,e,v,m} and
bfd_mach_sparc_v9{c,d,e,v,m}.
* sparc-opc.c (MASK_V9C): Define.
(MASK_V9D): Likewise.
(MASK_V9E): Likewise.
(MASK_V9V): Likewise.
(MASK_V9M): Likewise.
(v6): Add MASK_V9{C,D,E,V,M}.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9andleon): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Define.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(sparc_opcode_archs): Add entry for v9{c,d,e,v,m}.
2016-06-17 17:12:48 +08:00
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9B) \
|
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9C) \
|
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9D) \
|
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9E) \
|
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9V) \
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
| (1 << SPARC_OPCODE_ARCH_V9M) \
|
|
|
|
| (1 << SPARC_OPCODE_ARCH_M8))
|
1999-05-03 15:29:11 +08:00
|
|
|
/* 1 if INSN is for v9 only. */
|
|
|
|
#define V9_ONLY_P(insn) (! ((insn)->architecture & ~MASK_V9))
|
|
|
|
/* 1 if INSN is for v9. */
|
|
|
|
#define V9_P(insn) (((insn)->architecture & MASK_V9) != 0)
|
|
|
|
|
|
|
|
/* The sorted opcode table. */
|
2005-07-01 19:16:33 +08:00
|
|
|
static const sparc_opcode **sorted_opcodes;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* For faster lookup, after insns are sorted they are hashed. */
|
|
|
|
/* ??? I think there is room for even more improvement. */
|
|
|
|
|
|
|
|
#define HASH_SIZE 256
|
|
|
|
/* It is important that we only look at insn code bits as that is how the
|
|
|
|
opcode table is hashed. OPCODE_BITS is a table of valid bits for each
|
|
|
|
of the main types (0,1,2,3). */
|
|
|
|
static int opcode_bits[4] = { 0x01c00000, 0x0, 0x01f80000, 0x01f80000 };
|
|
|
|
#define HASH_INSN(INSN) \
|
|
|
|
((((INSN) >> 24) & 0xc0) | (((INSN) & opcode_bits[((INSN) >> 30) & 3]) >> 19))
|
2005-07-01 19:16:33 +08:00
|
|
|
typedef struct sparc_opcode_hash
|
2003-01-29 20:51:57 +08:00
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
struct sparc_opcode_hash *next;
|
|
|
|
const sparc_opcode *opcode;
|
|
|
|
} sparc_opcode_hash;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
static sparc_opcode_hash *opcode_hash_table[HASH_SIZE];
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Sign-extend a value which is N bits long. */
|
|
|
|
#define SEX(value, bits) \
|
|
|
|
((((int)(value)) << ((8 * sizeof (int)) - bits)) \
|
|
|
|
>> ((8 * sizeof (int)) - bits) )
|
|
|
|
|
|
|
|
static char *reg_names[] =
|
2005-07-01 19:16:33 +08:00
|
|
|
{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
|
|
|
|
"o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
|
|
|
|
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
|
|
|
|
"i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
|
|
|
|
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
|
|
|
|
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
|
1999-05-03 15:29:11 +08:00
|
|
|
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
|
|
|
|
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
|
2005-07-01 19:16:33 +08:00
|
|
|
"f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",
|
|
|
|
"f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47",
|
1999-05-03 15:29:11 +08:00
|
|
|
"f48", "f49", "f50", "f51", "f52", "f53", "f54", "f55",
|
|
|
|
"f56", "f57", "f58", "f59", "f60", "f61", "f62", "f63",
|
|
|
|
/* psr, wim, tbr, fpsr, cpsr are v8 only. */
|
|
|
|
"y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr"
|
|
|
|
};
|
|
|
|
|
|
|
|
#define freg_names (®_names[4 * 8])
|
|
|
|
|
|
|
|
/* These are ordered according to there register number in
|
|
|
|
rdpr and wrpr insns. */
|
|
|
|
static char *v9_priv_reg_names[] =
|
|
|
|
{
|
|
|
|
"tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl",
|
|
|
|
"pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin",
|
2006-02-25 09:33:24 +08:00
|
|
|
"wstate", "fq", "gl"
|
2015-08-25 23:16:34 +08:00
|
|
|
/* "ver" and "pmcdper" - special cased */
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
|
|
|
|
2006-02-25 09:33:24 +08:00
|
|
|
/* These are ordered according to there register number in
|
|
|
|
rdhpr and wrhpr insns. */
|
|
|
|
static char *v9_hpriv_reg_names[] =
|
|
|
|
{
|
|
|
|
"hpstate", "htstate", "resv2", "hintp", "resv4", "htba", "hver",
|
2015-08-12 19:45:07 +08:00
|
|
|
"resv7", "resv8", "resv9", "resv10", "resv11", "resv12", "resv13",
|
2006-02-25 09:33:24 +08:00
|
|
|
"resv14", "resv15", "resv16", "resv17", "resv18", "resv19", "resv20",
|
opcodes,gas: sparc: fix rdasr,wrasr,rdpr,wrpr,rdhpr,wrhpr insns.
This patch fixes and expands the definition of the read/write
instructions for ancillary-state, privileged and hyperprivileged
registers in opcodes.
It also adds support for three new v9m hyperprivileged registers:
%hmcdper, %hmcddfr and %hva_mask_nz.
Finally, the patch expands existing tests (and adds several new ones) in
order to cover all the read/write instructions in all its variants.
opcodes/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (rdasr): New macro.
(wrasr): Likewise.
(rdpr): Likewise.
(wrpr): Likewise.
(rdhpr): Likewise.
(wrhpr): Likewise.
(sparc_opcodes): Use the macros above to fix and expand the
definition of read/write instructions from/to
asr/privileged/hyperprivileged instructions.
* sparc-dis.c (v9_hpriv_reg_names): Add %hmcdper, %hmcddfr and
%hva_mask_nz. Prefer softint_set and softint_clear over
set_softint and clear_softint.
(print_insn_sparc): Support %ver in Rd.
gas/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (hpriv_reg_table): Add registers %hmcdper,
%hmcddfr and %hva_mask_nz.
(sparc_ip): New handling of asr/privileged/hyperprivileged
registers, adapted to the new form of the sparc opcodes table.
* testsuite/gas/sparc/rdasr.s: New file.
* testsuite/gas/sparc/rdasr.d: Likewise.
* testsuite/gas/sparc/wrasr.s: Likewise.
* testsuite/gas/sparc/wrasr.d: Likewise.
* testsuite/gas/sparc/sparc.exp (sparc_elf_setup): Add rdasr and
wrasr tests.
* testsuite/gas/sparc/rdpr.d: Use -Av9m, as some privileged
registers require it.
* testsuite/gas/sparc/wrpr.s: Complete to cover all privileged
registers and write instruction modalities.
* testsuite/gas/sparc/wrpr.d: Likewise.
* testsuite/gas/sparc/rdhpr.s: Likewise for hyperprivileged
registers.
* testsuite/gas/sparc/rdhpr.d: Likewise.
* testsuite/gas/sparc/wrhpr.s: Likewise.
* testsuite/gas/sparc/wrhpr.d: Likewise.
2016-06-17 17:15:43 +08:00
|
|
|
"resv21", "resv22", "hmcdper", "hmcddfr", "resv25", "resv26", "hva_mask_nz",
|
2014-03-20 00:43:41 +08:00
|
|
|
"hstick_offset", "hstick_enable", "resv30", "hstick_cmpr"
|
2006-02-25 09:33:24 +08:00
|
|
|
};
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* These are ordered according to there register number in
|
|
|
|
rd and wr insns (-16). */
|
|
|
|
static char *v9a_asr_reg_names[] =
|
|
|
|
{
|
opcodes,gas: sparc: fix rdasr,wrasr,rdpr,wrpr,rdhpr,wrhpr insns.
This patch fixes and expands the definition of the read/write
instructions for ancillary-state, privileged and hyperprivileged
registers in opcodes.
It also adds support for three new v9m hyperprivileged registers:
%hmcdper, %hmcddfr and %hva_mask_nz.
Finally, the patch expands existing tests (and adds several new ones) in
order to cover all the read/write instructions in all its variants.
opcodes/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (rdasr): New macro.
(wrasr): Likewise.
(rdpr): Likewise.
(wrpr): Likewise.
(rdhpr): Likewise.
(wrhpr): Likewise.
(sparc_opcodes): Use the macros above to fix and expand the
definition of read/write instructions from/to
asr/privileged/hyperprivileged instructions.
* sparc-dis.c (v9_hpriv_reg_names): Add %hmcdper, %hmcddfr and
%hva_mask_nz. Prefer softint_set and softint_clear over
set_softint and clear_softint.
(print_insn_sparc): Support %ver in Rd.
gas/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (hpriv_reg_table): Add registers %hmcdper,
%hmcddfr and %hva_mask_nz.
(sparc_ip): New handling of asr/privileged/hyperprivileged
registers, adapted to the new form of the sparc opcodes table.
* testsuite/gas/sparc/rdasr.s: New file.
* testsuite/gas/sparc/rdasr.d: Likewise.
* testsuite/gas/sparc/wrasr.s: Likewise.
* testsuite/gas/sparc/wrasr.d: Likewise.
* testsuite/gas/sparc/sparc.exp (sparc_elf_setup): Add rdasr and
wrasr tests.
* testsuite/gas/sparc/rdpr.d: Use -Av9m, as some privileged
registers require it.
* testsuite/gas/sparc/wrpr.s: Complete to cover all privileged
registers and write instruction modalities.
* testsuite/gas/sparc/wrpr.d: Likewise.
* testsuite/gas/sparc/rdhpr.s: Likewise for hyperprivileged
registers.
* testsuite/gas/sparc/rdhpr.d: Likewise.
* testsuite/gas/sparc/wrhpr.s: Likewise.
* testsuite/gas/sparc/wrhpr.d: Likewise.
2016-06-17 17:15:43 +08:00
|
|
|
"pcr", "pic", "dcr", "gsr", "softint_set", "softint_clear",
|
2012-04-28 04:43:35 +08:00
|
|
|
"softint", "tick_cmpr", "stick", "stick_cmpr", "cfr",
|
2014-10-09 20:16:53 +08:00
|
|
|
"pause", "mwait"
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Macros used to extract instruction fields. Not all fields have
|
|
|
|
macros defined here, only those which are actually used. */
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
#define X_RD(i) (((i) >> 25) & 0x1f)
|
|
|
|
#define X_RS1(i) (((i) >> 14) & 0x1f)
|
|
|
|
#define X_LDST_I(i) (((i) >> 13) & 1)
|
|
|
|
#define X_ASI(i) (((i) >> 5) & 0xff)
|
|
|
|
#define X_RS2(i) (((i) >> 0) & 0x1f)
|
2011-08-06 00:52:50 +08:00
|
|
|
#define X_RS3(i) (((i) >> 9) & 0x1f)
|
2005-07-01 19:16:33 +08:00
|
|
|
#define X_IMM(i,n) (((i) >> 0) & ((1 << (n)) - 1))
|
|
|
|
#define X_SIMM(i,n) SEX (X_IMM ((i), (n)), (n))
|
|
|
|
#define X_DISP22(i) (((i) >> 0) & 0x3fffff)
|
|
|
|
#define X_IMM22(i) X_DISP22 (i)
|
|
|
|
#define X_DISP30(i) (((i) >> 0) & 0x3fffffff)
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
#define X_IMM2(i) (((i & 0x10) >> 3) | (i & 0x1))
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* These are for v9. */
|
2005-07-01 19:16:33 +08:00
|
|
|
#define X_DISP16(i) (((((i) >> 20) & 3) << 14) | (((i) >> 0) & 0x3fff))
|
2012-04-13 00:26:06 +08:00
|
|
|
#define X_DISP10(i) (((((i) >> 19) & 3) << 8) | (((i) >> 5) & 0xff))
|
2005-07-01 19:16:33 +08:00
|
|
|
#define X_DISP19(i) (((i) >> 0) & 0x7ffff)
|
|
|
|
#define X_MEMBAR(i) ((i) & 0x7f)
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Here is the union which was used to extract instruction fields
|
|
|
|
before the shift and mask macros were written.
|
|
|
|
|
|
|
|
union sparc_insn
|
|
|
|
{
|
|
|
|
unsigned long int code;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int anop:2;
|
|
|
|
#define op ldst.anop
|
|
|
|
unsigned int anrd:5;
|
|
|
|
#define rd ldst.anrd
|
|
|
|
unsigned int op3:6;
|
|
|
|
unsigned int anrs1:5;
|
|
|
|
#define rs1 ldst.anrs1
|
|
|
|
unsigned int i:1;
|
|
|
|
unsigned int anasi:8;
|
|
|
|
#define asi ldst.anasi
|
|
|
|
unsigned int anrs2:5;
|
|
|
|
#define rs2 ldst.anrs2
|
|
|
|
#define shcnt rs2
|
|
|
|
} ldst;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int anop:2, anrd:5, op3:6, anrs1:5, i:1;
|
|
|
|
unsigned int IMM13:13;
|
|
|
|
#define imm13 IMM13.IMM13
|
|
|
|
} IMM13;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int anop:2;
|
|
|
|
unsigned int a:1;
|
|
|
|
unsigned int cond:4;
|
|
|
|
unsigned int op2:3;
|
|
|
|
unsigned int DISP22:22;
|
|
|
|
#define disp22 branch.DISP22
|
|
|
|
#define imm22 disp22
|
|
|
|
} branch;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int anop:2;
|
|
|
|
unsigned int a:1;
|
|
|
|
unsigned int z:1;
|
|
|
|
unsigned int rcond:3;
|
|
|
|
unsigned int op2:3;
|
|
|
|
unsigned int DISP16HI:2;
|
|
|
|
unsigned int p:1;
|
|
|
|
unsigned int _rs1:5;
|
|
|
|
unsigned int DISP16LO:14;
|
|
|
|
} branch16;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int anop:2;
|
|
|
|
unsigned int adisp30:30;
|
|
|
|
#define disp30 call.adisp30
|
|
|
|
} call;
|
2005-07-01 19:16:33 +08:00
|
|
|
}; */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Nonzero if INSN is the opcode for a delayed branch. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
is_delayed_branch (unsigned long insn)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
sparc_opcode_hash *op;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next)
|
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
const sparc_opcode *opcode = op->opcode;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if ((opcode->match & insn) == opcode->match
|
|
|
|
&& (opcode->lose & insn) == 0)
|
2005-07-01 19:16:33 +08:00
|
|
|
return opcode->flags & F_DELAYED;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* extern void qsort (); */
|
|
|
|
|
|
|
|
/* Records current mask of SPARC_OPCODE_ARCH_FOO values, used to pass value
|
|
|
|
to compare_opcodes. */
|
|
|
|
static unsigned int current_arch_mask;
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
/* Given BFD mach number, return a mask of SPARC_OPCODE_ARCH_FOO values. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
compute_arch_mask (unsigned long mach)
|
|
|
|
{
|
|
|
|
switch (mach)
|
|
|
|
{
|
|
|
|
case 0 :
|
|
|
|
case bfd_mach_sparc :
|
2013-08-06 00:11:07 +08:00
|
|
|
return (SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V8)
|
|
|
|
| SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_LEON));
|
2005-07-01 19:16:33 +08:00
|
|
|
case bfd_mach_sparc_sparclet :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_SPARCLET);
|
|
|
|
case bfd_mach_sparc_sparclite :
|
|
|
|
case bfd_mach_sparc_sparclite_le :
|
|
|
|
/* sparclites insns are recognized by default (because that's how
|
|
|
|
they've always been treated, for better or worse). Kludge this by
|
|
|
|
indicating generic v8 is also selected. */
|
|
|
|
return (SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_SPARCLITE)
|
|
|
|
| SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V8));
|
|
|
|
case bfd_mach_sparc_v8plus :
|
|
|
|
case bfd_mach_sparc_v9 :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9);
|
|
|
|
case bfd_mach_sparc_v8plusa :
|
|
|
|
case bfd_mach_sparc_v9a :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9A);
|
|
|
|
case bfd_mach_sparc_v8plusb :
|
|
|
|
case bfd_mach_sparc_v9b :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9B);
|
bfd,opcodes: sparc: new opcode v9{c,d,e,v,m} architectures and bfd machine numbers.
This patch adds support for the opcode architectures
SPARC_OPCODE_ARCH_V9{C,D,E,V,M} and its associated BFD machine numbers
bfd_mach_sparc_v9{c,d,e,v,m} and bfd_mach_sparc_v8plus{c,d,e,v,m}.
Note that for arches up to v9b (UltraSPARC III), the detection of the
BFD machine type was based on the bits in the e_machine field of the ELF
header. However, there are no more available bits in that field, so
this patch takes the approach of using the hardware capabilities stored
in the object attributes HWCAPS/HWCAPS2 in order to characterize the
machine the object was built for.
bfd/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v8plusc): Define.
(bfd_mach_sparc_v9c): Likewise.
(bfd_mach_sparc_v8plusd): Likewise.
(bfd_mach_sparc_v9d): Likewise.
(bfd_mach_sparc_v8pluse): Likewise.
(bfd_mach_sparc_v9e): Likewise.
(bfd_mach_sparc_v8plusv): Likewise
(bfd_mach_sparc_v9v): Likewise.
(bfd_mach_sparc_v8plusm): Likewise.
(bfd_mach_sparc_v9m): Likewise.
(bfd_mach_sparc_v9_p): Adapt to v8plusm and v9m.
(bfd_mach_sparc_64bit_p): Likewise.
* bfd-in2.h: Regenerate.
* cpu-sparc.c (arch_info_struct): Add entries for
bfd_mach_sparc_v8plus{c,d,e,v,m} and bfd_mach_sparc_v9{c,d,e,v,m}.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v8plus{c,d,e,v,m}
and bfd_mach_sparc_v9{c,d,e,v,m}.
* elf32-sparc.c (elf32_sparc_final_write_processing): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Likewise.
include/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* opcode/sparc.h (enum sparc_opcode_arch_val): Add
SPARC_OPCODE_ARCH_V9C, SPARC_OPCODE_ARCH_V9D,
SPARC_OPCODE_ARCH_V9E, SPARC_OPCODE_ARCH_V9V and
SPARC_OPCODE_ARCH_V9M.
opcodes/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Add SPARC_OPCODE_ARCH_V9{C,D,E,V,M}.
(compute_arch_mask): Handle bfd_mach_sparc_v8plus{c,d,e,v,m} and
bfd_mach_sparc_v9{c,d,e,v,m}.
* sparc-opc.c (MASK_V9C): Define.
(MASK_V9D): Likewise.
(MASK_V9E): Likewise.
(MASK_V9V): Likewise.
(MASK_V9M): Likewise.
(v6): Add MASK_V9{C,D,E,V,M}.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9andleon): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Define.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(sparc_opcode_archs): Add entry for v9{c,d,e,v,m}.
2016-06-17 17:12:48 +08:00
|
|
|
case bfd_mach_sparc_v8plusc :
|
|
|
|
case bfd_mach_sparc_v9c :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9C);
|
|
|
|
case bfd_mach_sparc_v8plusd :
|
|
|
|
case bfd_mach_sparc_v9d :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9D);
|
|
|
|
case bfd_mach_sparc_v8pluse :
|
|
|
|
case bfd_mach_sparc_v9e :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9E);
|
|
|
|
case bfd_mach_sparc_v8plusv :
|
|
|
|
case bfd_mach_sparc_v9v :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9V);
|
|
|
|
case bfd_mach_sparc_v8plusm :
|
|
|
|
case bfd_mach_sparc_v9m :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9M);
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
case bfd_mach_sparc_v8plusm8 :
|
|
|
|
case bfd_mach_sparc_v9m8 :
|
|
|
|
return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_M8);
|
2005-07-01 19:16:33 +08:00
|
|
|
}
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compare opcodes A and B. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
compare_opcodes (const void * a, const void * b)
|
|
|
|
{
|
|
|
|
sparc_opcode *op0 = * (sparc_opcode **) a;
|
|
|
|
sparc_opcode *op1 = * (sparc_opcode **) b;
|
|
|
|
unsigned long int match0 = op0->match, match1 = op1->match;
|
|
|
|
unsigned long int lose0 = op0->lose, lose1 = op1->lose;
|
|
|
|
register unsigned int i;
|
|
|
|
|
|
|
|
/* If one (and only one) insn isn't supported by the current architecture,
|
|
|
|
prefer the one that is. If neither are supported, but they're both for
|
|
|
|
the same architecture, continue processing. Otherwise (both unsupported
|
|
|
|
and for different architectures), prefer lower numbered arch's (fudged
|
|
|
|
by comparing the bitmasks). */
|
|
|
|
if (op0->architecture & current_arch_mask)
|
|
|
|
{
|
|
|
|
if (! (op1->architecture & current_arch_mask))
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (op1->architecture & current_arch_mask)
|
|
|
|
return 1;
|
|
|
|
else if (op0->architecture != op1->architecture)
|
|
|
|
return op0->architecture - op1->architecture;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If a bit is set in both match and lose, there is something
|
|
|
|
wrong with the opcode table. */
|
|
|
|
if (match0 & lose0)
|
|
|
|
{
|
|
|
|
fprintf
|
|
|
|
(stderr,
|
|
|
|
/* xgettext:c-format */
|
|
|
|
_("Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"),
|
|
|
|
op0->name, match0, lose0);
|
|
|
|
op0->lose &= ~op0->match;
|
|
|
|
lose0 = op0->lose;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match1 & lose1)
|
|
|
|
{
|
|
|
|
fprintf
|
|
|
|
(stderr,
|
|
|
|
/* xgettext:c-format */
|
|
|
|
_("Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"),
|
|
|
|
op1->name, match1, lose1);
|
|
|
|
op1->lose &= ~op1->match;
|
|
|
|
lose1 = op1->lose;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Because the bits that are variable in one opcode are constant in
|
|
|
|
another, it is important to order the opcodes in the right order. */
|
|
|
|
for (i = 0; i < 32; ++i)
|
|
|
|
{
|
|
|
|
unsigned long int x = 1 << i;
|
|
|
|
int x0 = (match0 & x) != 0;
|
|
|
|
int x1 = (match1 & x) != 0;
|
|
|
|
|
|
|
|
if (x0 != x1)
|
|
|
|
return x1 - x0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 32; ++i)
|
|
|
|
{
|
|
|
|
unsigned long int x = 1 << i;
|
|
|
|
int x0 = (lose0 & x) != 0;
|
|
|
|
int x1 = (lose1 & x) != 0;
|
|
|
|
|
|
|
|
if (x0 != x1)
|
|
|
|
return x1 - x0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* They are functionally equal. So as long as the opcode table is
|
|
|
|
valid, we can put whichever one first we want, on aesthetic grounds. */
|
|
|
|
|
|
|
|
/* Our first aesthetic ground is that aliases defer to real insns. */
|
|
|
|
{
|
|
|
|
int alias_diff = (op0->flags & F_ALIAS) - (op1->flags & F_ALIAS);
|
|
|
|
|
|
|
|
if (alias_diff != 0)
|
|
|
|
/* Put the one that isn't an alias first. */
|
|
|
|
return alias_diff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Except for aliases, two "identical" instructions had
|
|
|
|
better have the same opcode. This is a sanity check on the table. */
|
|
|
|
i = strcmp (op0->name, op1->name);
|
|
|
|
if (i)
|
|
|
|
{
|
Increase the accuracy of sparc instruction aliases.
Make current with UA2011 specification.
Add an F_PREFERRED opcode flag that indicates a preferred alias
when multiple aliases for the same opcode exists.
For 'lzd':
Add 'lzcnt' as primary instruction, and make 'lzd' an alias.
Add 'ldtw', 'ldtwa', 'sttw', 'sttwa':
The modern opcode for for 'ldd', 'ldda', 'std', and 'stda' on
integer registers. Mark the latter now as aliases.
For 'flush':
Support "[address]" syntax as well as plain "address".
Rework 'mov' aliases for 'wr':
Eliminate bogus three operand moves, and encode the
instructions properly for the "mov REG, %ASR" cases,
specifically we should encode the register in rs2 not rs1 as
per The SPARC V8 Architecture Manual.
Add missing cbcond aliases:
c{w,x}bz, c{w,x}blu, c{w,x}bnz, c{w,x}bgeu
Add 'd' suffix VIS logical ops:
The primary opcode for 'fzero' is now 'fzerod' (compare with
'fzeros'), for example. And thus 'fzero' is now an alias.
Add modern opcodes for condition code setting edge instructions:
They are now edgeN{,l}cc instead of plain edgeN{,l}.
Add modern opcodes for VIS comparisons:
All VIS comparisons now start with prefix "fp", retain the
older variants as aliases.
The signed variants for equal and not-equal have "u" aliases
to show that these comparisons are equally suited for unsigned
compares.
Update existing test cases as needed, and add several new ones.
include/opcode/
* sparc.h (F_PREFERRED): Define.
(F_PREF_ALIAS): Define.
opcodes/
* sparc-dis.c (compare_opcodes): When encountering multiple aliases
of an opcode, prefer the one with F_PREFERRED set.
* sparc-opc.c (sparc_opcodes): Add ldtw, ldtwa, sttw, sttwa,
lzcnt, flush with '[address]' syntax, and missing cbcond pseudo
ops. Make 64-bit VIS logical ops have "d" suffix in their names,
mark existing mnenomics as aliases. Add "cc" suffix to edge
instructions generating condition codes, mark existing mnenomics
as aliases. Add "fp" prefix to VIS compare instructions, mark
existing mnenomics as aliases.
gas/testsuite/
* gas/sparc/cbcond.s: Add tests for new opcode aliases.
* gas/sparc/cbcond.d: Updated.
* gas/sparc/hpcvis3.s: Add tests for new opcode aliases.
* gas/sparc/hpcvis3.d: Updated.
* gas/sparc/v8-movwr-imm.d: Fix expected disassembly.
* gas/sparc/edge.s: New test.
* gas/sparc/edge.d: Expected disassembly.
* gas/sparc/flush.s: New test.
* gas/sparc/flush.d: Expected disassembly.
* gas/sparc/ldd_std.s: New test.
* gas/sparc/ldd_std.d: Expected disassembly.
* gas/sparc/ldtw_sttw.s: New test.
* gas/sparc/ldtw_sttw.d: Expected disassembly.
* gas/sparc/sparc.exp: Run new tests.
2013-04-07 06:22:03 +08:00
|
|
|
if (op0->flags & F_ALIAS)
|
|
|
|
{
|
|
|
|
if (op0->flags & F_PREFERRED)
|
|
|
|
return -1;
|
|
|
|
if (op1->flags & F_PREFERRED)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* If they're both aliases, and neither is marked as preferred,
|
|
|
|
be arbitrary. */
|
|
|
|
return i;
|
|
|
|
}
|
2005-07-01 19:16:33 +08:00
|
|
|
else
|
|
|
|
fprintf (stderr,
|
|
|
|
/* xgettext:c-format */
|
|
|
|
_("Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n"),
|
|
|
|
op0->name, op1->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fewer arguments are preferred. */
|
|
|
|
{
|
|
|
|
int length_diff = strlen (op0->args) - strlen (op1->args);
|
|
|
|
|
|
|
|
if (length_diff != 0)
|
|
|
|
/* Put the one with fewer arguments first. */
|
|
|
|
return length_diff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Put 1+i before i+1. */
|
|
|
|
{
|
|
|
|
char *p0 = (char *) strchr (op0->args, '+');
|
|
|
|
char *p1 = (char *) strchr (op1->args, '+');
|
|
|
|
|
|
|
|
if (p0 && p1)
|
|
|
|
{
|
|
|
|
/* There is a plus in both operands. Note that a plus
|
|
|
|
sign cannot be the first character in args,
|
|
|
|
so the following [-1]'s are valid. */
|
|
|
|
if (p0[-1] == 'i' && p1[1] == 'i')
|
|
|
|
/* op0 is i+1 and op1 is 1+i, so op1 goes first. */
|
|
|
|
return 1;
|
|
|
|
if (p0[1] == 'i' && p1[-1] == 'i')
|
|
|
|
/* op0 is 1+i and op1 is i+1, so op0 goes first. */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Put 1,i before i,1. */
|
|
|
|
{
|
|
|
|
int i0 = strncmp (op0->args, "i,1", 3) == 0;
|
|
|
|
int i1 = strncmp (op1->args, "i,1", 3) == 0;
|
|
|
|
|
|
|
|
if (i0 ^ i1)
|
|
|
|
return i0 - i1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* They are, as far as we can tell, identical.
|
|
|
|
Since qsort may have rearranged the table partially, there is
|
|
|
|
no way to tell which one was first in the opcode table as
|
|
|
|
written, so just say there are equal. */
|
|
|
|
/* ??? This is no longer true now that we sort a vector of pointers,
|
|
|
|
not the table itself. */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Build a hash table from the opcode table.
|
|
|
|
OPCODE_TABLE is a sorted list of pointers into the opcode table. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
build_hash_table (const sparc_opcode **opcode_table,
|
|
|
|
sparc_opcode_hash **hash_table,
|
|
|
|
int num_opcodes)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int hash_count[HASH_SIZE];
|
|
|
|
static sparc_opcode_hash *hash_buf = NULL;
|
|
|
|
|
|
|
|
/* Start at the end of the table and work backwards so that each
|
|
|
|
chain is sorted. */
|
|
|
|
|
|
|
|
memset (hash_table, 0, HASH_SIZE * sizeof (hash_table[0]));
|
|
|
|
memset (hash_count, 0, HASH_SIZE * sizeof (hash_count[0]));
|
|
|
|
if (hash_buf != NULL)
|
|
|
|
free (hash_buf);
|
|
|
|
hash_buf = xmalloc (sizeof (* hash_buf) * num_opcodes);
|
|
|
|
for (i = num_opcodes - 1; i >= 0; --i)
|
|
|
|
{
|
|
|
|
int hash = HASH_INSN (opcode_table[i]->match);
|
|
|
|
sparc_opcode_hash *h = &hash_buf[i];
|
|
|
|
|
|
|
|
h->next = hash_table[hash];
|
|
|
|
h->opcode = opcode_table[i];
|
|
|
|
hash_table[hash] = h;
|
|
|
|
++hash_count[hash];
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0 /* for debugging */
|
|
|
|
{
|
|
|
|
int min_count = num_opcodes, max_count = 0;
|
|
|
|
int total;
|
|
|
|
|
|
|
|
for (i = 0; i < HASH_SIZE; ++i)
|
|
|
|
{
|
|
|
|
if (hash_count[i] < min_count)
|
|
|
|
min_count = hash_count[i];
|
|
|
|
if (hash_count[i] > max_count)
|
|
|
|
max_count = hash_count[i];
|
|
|
|
total += hash_count[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
printf ("Opcode hash table stats: min %d, max %d, ave %f\n",
|
|
|
|
min_count, max_count, (double) total / HASH_SIZE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Print one instruction from MEMADDR on INFO->STREAM.
|
|
|
|
|
|
|
|
We suffix the instruction with a comment that gives the absolute
|
|
|
|
address involved, as well as its symbolic form, if the instruction
|
|
|
|
is preceded by a findable `sethi' and it either adds an immediate
|
|
|
|
displacement to that register, or it is an `add' or `or' instruction
|
|
|
|
on that register. */
|
|
|
|
|
|
|
|
int
|
2005-07-01 19:16:33 +08:00
|
|
|
print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
FILE *stream = info->stream;
|
|
|
|
bfd_byte buffer[4];
|
|
|
|
unsigned long insn;
|
2005-07-01 19:16:33 +08:00
|
|
|
sparc_opcode_hash *op;
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Nonzero of opcode table has been initialized. */
|
|
|
|
static int opcodes_initialized = 0;
|
|
|
|
/* bfd mach number of last call. */
|
|
|
|
static unsigned long current_mach = 0;
|
2004-03-15 21:36:28 +08:00
|
|
|
bfd_vma (*getword) (const void *);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (!opcodes_initialized
|
|
|
|
|| info->mach != current_mach)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
current_arch_mask = compute_arch_mask (info->mach);
|
|
|
|
|
|
|
|
if (!opcodes_initialized)
|
2005-07-01 19:16:33 +08:00
|
|
|
sorted_opcodes =
|
|
|
|
xmalloc (sparc_num_opcodes * sizeof (sparc_opcode *));
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Reset the sorted table so we can resort it. */
|
|
|
|
for (i = 0; i < sparc_num_opcodes; ++i)
|
|
|
|
sorted_opcodes[i] = &sparc_opcodes[i];
|
|
|
|
qsort ((char *) sorted_opcodes, sparc_num_opcodes,
|
|
|
|
sizeof (sorted_opcodes[0]), compare_opcodes);
|
|
|
|
|
|
|
|
build_hash_table (sorted_opcodes, opcode_hash_table, sparc_num_opcodes);
|
|
|
|
current_mach = info->mach;
|
|
|
|
opcodes_initialized = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
int status =
|
|
|
|
(*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info);
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
(*info->memory_error_func) (status, memaddr, info);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* On SPARClite variants such as DANlite (sparc86x), instructions
|
2003-01-29 20:51:57 +08:00
|
|
|
are always big-endian even when the machine is in little-endian mode. */
|
1999-05-03 15:29:11 +08:00
|
|
|
if (info->endian == BFD_ENDIAN_BIG || info->mach == bfd_mach_sparc_sparclite)
|
|
|
|
getword = bfd_getb32;
|
|
|
|
else
|
|
|
|
getword = bfd_getl32;
|
|
|
|
|
|
|
|
insn = getword (buffer);
|
|
|
|
|
2003-01-29 20:51:57 +08:00
|
|
|
info->insn_info_valid = 1; /* We do return this info. */
|
|
|
|
info->insn_type = dis_nonbranch; /* Assume non branch insn. */
|
|
|
|
info->branch_delay_insns = 0; /* Assume no delay. */
|
|
|
|
info->target = 0; /* Assume no target known. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next)
|
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
const sparc_opcode *opcode = op->opcode;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* If the insn isn't supported by the current architecture, skip it. */
|
|
|
|
if (! (opcode->architecture & current_arch_mask))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((opcode->match & insn) == opcode->match
|
|
|
|
&& (opcode->lose & insn) == 0)
|
|
|
|
{
|
|
|
|
/* Nonzero means that we have found an instruction which has
|
|
|
|
the effect of adding or or'ing the imm13 field to rs1. */
|
|
|
|
int imm_added_to_rs1 = 0;
|
1999-07-09 00:14:07 +08:00
|
|
|
int imm_ored_to_rs1 = 0;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Nonzero means that we have found a plus sign in the args
|
|
|
|
field of the opcode table. */
|
|
|
|
int found_plus = 0;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Nonzero means we have an annulled branch. */
|
|
|
|
int is_annulled = 0;
|
|
|
|
|
|
|
|
/* Do we have an `add' or `or' instruction combining an
|
|
|
|
immediate with rs1? */
|
1999-07-09 00:14:07 +08:00
|
|
|
if (opcode->match == 0x80102000) /* or */
|
|
|
|
imm_ored_to_rs1 = 1;
|
|
|
|
if (opcode->match == 0x80002000) /* add */
|
1999-05-03 15:29:11 +08:00
|
|
|
imm_added_to_rs1 = 1;
|
|
|
|
|
|
|
|
if (X_RS1 (insn) != X_RD (insn)
|
|
|
|
&& strchr (opcode->args, 'r') != 0)
|
|
|
|
/* Can't do simple format if source and dest are different. */
|
|
|
|
continue;
|
|
|
|
if (X_RS2 (insn) != X_RD (insn)
|
|
|
|
&& strchr (opcode->args, 'O') != 0)
|
|
|
|
/* Can't do simple format if source and dest are different. */
|
|
|
|
continue;
|
|
|
|
|
2012-07-24 20:56:47 +08:00
|
|
|
(*info->fprintf_func) (stream, "%s", opcode->name);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
const char *s;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (opcode->args[0] != ',')
|
|
|
|
(*info->fprintf_func) (stream, " ");
|
2003-01-29 20:51:57 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
for (s = opcode->args; *s != '\0'; ++s)
|
|
|
|
{
|
|
|
|
while (*s == ',')
|
|
|
|
{
|
|
|
|
(*info->fprintf_func) (stream, ",");
|
|
|
|
++s;
|
2003-01-29 20:51:57 +08:00
|
|
|
switch (*s)
|
|
|
|
{
|
|
|
|
case 'a':
|
|
|
|
(*info->fprintf_func) (stream, "a");
|
|
|
|
is_annulled = 1;
|
|
|
|
++s;
|
|
|
|
continue;
|
|
|
|
case 'N':
|
|
|
|
(*info->fprintf_func) (stream, "pn");
|
|
|
|
++s;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case 'T':
|
|
|
|
(*info->fprintf_func) (stream, "pt");
|
|
|
|
++s;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
(*info->fprintf_func) (stream, " ");
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
switch (*s)
|
|
|
|
{
|
|
|
|
case '+':
|
|
|
|
found_plus = 1;
|
2005-07-01 19:16:33 +08:00
|
|
|
/* Fall through. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
(*info->fprintf_func) (stream, "%c", *s);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '#':
|
|
|
|
(*info->fprintf_func) (stream, "0");
|
|
|
|
break;
|
|
|
|
|
|
|
|
#define reg(n) (*info->fprintf_func) (stream, "%%%s", reg_names[n])
|
|
|
|
case '1':
|
|
|
|
case 'r':
|
|
|
|
reg (X_RS1 (insn));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '2':
|
|
|
|
case 'O':
|
|
|
|
reg (X_RS2 (insn));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
reg (X_RD (insn));
|
|
|
|
break;
|
|
|
|
#undef reg
|
|
|
|
|
|
|
|
#define freg(n) (*info->fprintf_func) (stream, "%%%s", freg_names[n])
|
|
|
|
#define fregx(n) (*info->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)])
|
|
|
|
case 'e':
|
|
|
|
freg (X_RS1 (insn));
|
|
|
|
break;
|
2005-07-01 19:16:33 +08:00
|
|
|
case 'v': /* Double/even. */
|
|
|
|
case 'V': /* Quad/multiple of 4. */
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
case ';': /* Double/even multiple of 8 doubles. */
|
1999-05-03 15:29:11 +08:00
|
|
|
fregx (X_RS1 (insn));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'f':
|
|
|
|
freg (X_RS2 (insn));
|
|
|
|
break;
|
2005-07-01 19:16:33 +08:00
|
|
|
case 'B': /* Double/even. */
|
|
|
|
case 'R': /* Quad/multiple of 4. */
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
case ':': /* Double/even multiple of 8 doubles. */
|
1999-05-03 15:29:11 +08:00
|
|
|
fregx (X_RS2 (insn));
|
|
|
|
break;
|
|
|
|
|
2011-08-06 00:52:50 +08:00
|
|
|
case '4':
|
|
|
|
freg (X_RS3 (insn));
|
|
|
|
break;
|
|
|
|
case '5': /* Double/even. */
|
|
|
|
fregx (X_RS3 (insn));
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'g':
|
|
|
|
freg (X_RD (insn));
|
|
|
|
break;
|
2005-07-01 19:16:33 +08:00
|
|
|
case 'H': /* Double/even. */
|
|
|
|
case 'J': /* Quad/multiple of 4. */
|
2014-10-09 20:16:53 +08:00
|
|
|
case '}': /* Double/even. */
|
1999-05-03 15:29:11 +08:00
|
|
|
fregx (X_RD (insn));
|
|
|
|
break;
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
|
|
|
|
case '^': /* Double/even multiple of 8 doubles. */
|
|
|
|
fregx (X_RD (insn) & ~0x6);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '\'': /* Double/even in FPCMPSHL. */
|
|
|
|
fregx (X_RS2 (insn | 0x11));
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#undef freg
|
|
|
|
#undef fregx
|
|
|
|
|
|
|
|
#define creg(n) (*info->fprintf_func) (stream, "%%c%u", (unsigned int) (n))
|
|
|
|
case 'b':
|
|
|
|
creg (X_RS1 (insn));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
creg (X_RS2 (insn));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'D':
|
|
|
|
creg (X_RD (insn));
|
|
|
|
break;
|
|
|
|
#undef creg
|
|
|
|
|
|
|
|
case 'h':
|
|
|
|
(*info->fprintf_func) (stream, "%%hi(%#x)",
|
2002-02-11 21:24:51 +08:00
|
|
|
((unsigned) 0xFFFFFFFF
|
1999-05-03 15:29:11 +08:00
|
|
|
& ((int) X_IMM22 (insn) << 10)));
|
|
|
|
break;
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
case 'i': /* 13 bit immediate. */
|
|
|
|
case 'I': /* 11 bit immediate. */
|
|
|
|
case 'j': /* 10 bit immediate. */
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
int imm;
|
|
|
|
|
|
|
|
if (*s == 'i')
|
|
|
|
imm = X_SIMM (insn, 13);
|
|
|
|
else if (*s == 'I')
|
|
|
|
imm = X_SIMM (insn, 11);
|
|
|
|
else
|
|
|
|
imm = X_SIMM (insn, 10);
|
|
|
|
|
|
|
|
/* Check to see whether we have a 1+i, and take
|
|
|
|
note of that fact.
|
|
|
|
|
|
|
|
Note: because of the way we sort the table,
|
|
|
|
we will be matching 1+i rather than i+1,
|
|
|
|
so it is OK to assume that i is after +,
|
|
|
|
not before it. */
|
|
|
|
if (found_plus)
|
|
|
|
imm_added_to_rs1 = 1;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if (imm <= 9)
|
|
|
|
(*info->fprintf_func) (stream, "%d", imm);
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%#x", imm);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-04-28 02:02:35 +08:00
|
|
|
case ')': /* 5 bit unsigned immediate from RS3. */
|
2012-07-24 20:56:47 +08:00
|
|
|
(info->fprintf_func) (stream, "%#x", (unsigned int) X_RS3 (insn));
|
2012-04-28 02:02:35 +08:00
|
|
|
break;
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
case 'X': /* 5 bit unsigned immediate. */
|
|
|
|
case 'Y': /* 6 bit unsigned immediate. */
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
int imm = X_IMM (insn, *s == 'X' ? 5 : 6);
|
|
|
|
|
|
|
|
if (imm <= 9)
|
|
|
|
(info->fprintf_func) (stream, "%d", imm);
|
|
|
|
else
|
|
|
|
(info->fprintf_func) (stream, "%#x", (unsigned) imm);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-10-20 18:38:47 +08:00
|
|
|
case '3':
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-08 03:27:52 +08:00
|
|
|
(info->fprintf_func) (stream, "%ld", X_IMM (insn, 3));
|
2000-10-20 18:38:47 +08:00
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'K':
|
|
|
|
{
|
|
|
|
int mask = X_MEMBAR (insn);
|
|
|
|
int bit = 0x40, printed_one = 0;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if (mask == 0)
|
|
|
|
(info->fprintf_func) (stream, "0");
|
|
|
|
else
|
|
|
|
while (bit)
|
|
|
|
{
|
|
|
|
if (mask & bit)
|
|
|
|
{
|
|
|
|
if (printed_one)
|
|
|
|
(info->fprintf_func) (stream, "|");
|
|
|
|
name = sparc_decode_membar (bit);
|
|
|
|
(info->fprintf_func) (stream, "%s", name);
|
|
|
|
printed_one = 1;
|
|
|
|
}
|
|
|
|
bit >>= 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-04-13 00:26:06 +08:00
|
|
|
case '=':
|
|
|
|
info->target = memaddr + SEX (X_DISP10 (insn), 10) * 4;
|
|
|
|
(*info->print_address_func) (info->target, info);
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'k':
|
|
|
|
info->target = memaddr + SEX (X_DISP16 (insn), 16) * 4;
|
|
|
|
(*info->print_address_func) (info->target, info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'G':
|
|
|
|
info->target = memaddr + SEX (X_DISP19 (insn), 19) * 4;
|
|
|
|
(*info->print_address_func) (info->target, info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '6':
|
|
|
|
case '7':
|
|
|
|
case '8':
|
|
|
|
case '9':
|
|
|
|
(*info->fprintf_func) (stream, "%%fcc%c", *s - '6' + '0');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'z':
|
|
|
|
(*info->fprintf_func) (stream, "%%icc");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Z':
|
|
|
|
(*info->fprintf_func) (stream, "%%xcc");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'E':
|
|
|
|
(*info->fprintf_func) (stream, "%%ccr");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
(*info->fprintf_func) (stream, "%%fprs");
|
|
|
|
break;
|
|
|
|
|
2014-10-09 20:16:53 +08:00
|
|
|
case '{':
|
|
|
|
(*info->fprintf_func) (stream, "%%mcdper");
|
|
|
|
break;
|
|
|
|
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
case '&':
|
|
|
|
(*info->fprintf_func) (stream, "%%entropy");
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'o':
|
|
|
|
(*info->fprintf_func) (stream, "%%asi");
|
|
|
|
break;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'W':
|
|
|
|
(*info->fprintf_func) (stream, "%%tick");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'P':
|
|
|
|
(*info->fprintf_func) (stream, "%%pc");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '?':
|
|
|
|
if (X_RS1 (insn) == 31)
|
|
|
|
(*info->fprintf_func) (stream, "%%ver");
|
2015-08-25 23:16:34 +08:00
|
|
|
else if (X_RS1 (insn) == 23)
|
|
|
|
(*info->fprintf_func) (stream, "%%pmcdper");
|
2006-02-25 09:33:24 +08:00
|
|
|
else if ((unsigned) X_RS1 (insn) < 17)
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%%s",
|
|
|
|
v9_priv_reg_names[X_RS1 (insn)]);
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%reserved");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '!':
|
opcodes,gas: sparc: fix rdasr,wrasr,rdpr,wrpr,rdhpr,wrhpr insns.
This patch fixes and expands the definition of the read/write
instructions for ancillary-state, privileged and hyperprivileged
registers in opcodes.
It also adds support for three new v9m hyperprivileged registers:
%hmcdper, %hmcddfr and %hva_mask_nz.
Finally, the patch expands existing tests (and adds several new ones) in
order to cover all the read/write instructions in all its variants.
opcodes/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (rdasr): New macro.
(wrasr): Likewise.
(rdpr): Likewise.
(wrpr): Likewise.
(rdhpr): Likewise.
(wrhpr): Likewise.
(sparc_opcodes): Use the macros above to fix and expand the
definition of read/write instructions from/to
asr/privileged/hyperprivileged instructions.
* sparc-dis.c (v9_hpriv_reg_names): Add %hmcdper, %hmcddfr and
%hva_mask_nz. Prefer softint_set and softint_clear over
set_softint and clear_softint.
(print_insn_sparc): Support %ver in Rd.
gas/ChangeLog:
2016-06-17 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (hpriv_reg_table): Add registers %hmcdper,
%hmcddfr and %hva_mask_nz.
(sparc_ip): New handling of asr/privileged/hyperprivileged
registers, adapted to the new form of the sparc opcodes table.
* testsuite/gas/sparc/rdasr.s: New file.
* testsuite/gas/sparc/rdasr.d: Likewise.
* testsuite/gas/sparc/wrasr.s: Likewise.
* testsuite/gas/sparc/wrasr.d: Likewise.
* testsuite/gas/sparc/sparc.exp (sparc_elf_setup): Add rdasr and
wrasr tests.
* testsuite/gas/sparc/rdpr.d: Use -Av9m, as some privileged
registers require it.
* testsuite/gas/sparc/wrpr.s: Complete to cover all privileged
registers and write instruction modalities.
* testsuite/gas/sparc/wrpr.d: Likewise.
* testsuite/gas/sparc/rdhpr.s: Likewise for hyperprivileged
registers.
* testsuite/gas/sparc/rdhpr.d: Likewise.
* testsuite/gas/sparc/wrhpr.s: Likewise.
* testsuite/gas/sparc/wrhpr.d: Likewise.
2016-06-17 17:15:43 +08:00
|
|
|
if (X_RD (insn) == 31)
|
|
|
|
(*info->fprintf_func) (stream, "%%ver");
|
|
|
|
else if (X_RD (insn) == 23)
|
2015-08-25 23:16:34 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%pmcdper");
|
|
|
|
else if ((unsigned) X_RD (insn) < 17)
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%%s",
|
|
|
|
v9_priv_reg_names[X_RD (insn)]);
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%reserved");
|
|
|
|
break;
|
|
|
|
|
2006-02-25 09:33:24 +08:00
|
|
|
case '$':
|
|
|
|
if ((unsigned) X_RS1 (insn) < 32)
|
|
|
|
(*info->fprintf_func) (stream, "%%%s",
|
|
|
|
v9_hpriv_reg_names[X_RS1 (insn)]);
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%reserved");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '%':
|
|
|
|
if ((unsigned) X_RD (insn) < 32)
|
|
|
|
(*info->fprintf_func) (stream, "%%%s",
|
|
|
|
v9_hpriv_reg_names[X_RD (insn)]);
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%reserved");
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case '/':
|
2011-08-06 00:52:50 +08:00
|
|
|
if (X_RS1 (insn) < 16 || X_RS1 (insn) > 28)
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%reserved");
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%%s",
|
|
|
|
v9a_asr_reg_names[X_RS1 (insn)-16]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '_':
|
2011-08-06 00:52:50 +08:00
|
|
|
if (X_RD (insn) < 16 || X_RD (insn) > 28)
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%reserved");
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%%s",
|
|
|
|
v9a_asr_reg_names[X_RD (insn)-16]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '*':
|
|
|
|
{
|
|
|
|
const char *name = sparc_decode_prefetch (X_RD (insn));
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
(*info->fprintf_func) (stream, "%s", name);
|
|
|
|
else
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-08 03:27:52 +08:00
|
|
|
(*info->fprintf_func) (stream, "%ld", X_RD (insn));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'M':
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-08 03:27:52 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%asr%ld", X_RS1 (insn));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'm':
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-08 03:27:52 +08:00
|
|
|
(*info->fprintf_func) (stream, "%%asr%ld", X_RD (insn));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'L':
|
|
|
|
info->target = memaddr + SEX (X_DISP30 (insn), 30) * 4;
|
|
|
|
(*info->print_address_func) (info->target, info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'n':
|
|
|
|
(*info->fprintf_func)
|
|
|
|
(stream, "%#x", SEX (X_DISP22 (insn), 22));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'l':
|
|
|
|
info->target = memaddr + SEX (X_DISP22 (insn), 22) * 4;
|
|
|
|
(*info->print_address_func) (info->target, info);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'A':
|
|
|
|
{
|
|
|
|
const char *name = sparc_decode_asi (X_ASI (insn));
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
(*info->fprintf_func) (stream, "%s", name);
|
|
|
|
else
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-08 03:27:52 +08:00
|
|
|
(*info->fprintf_func) (stream, "(%ld)", X_ASI (insn));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'C':
|
|
|
|
(*info->fprintf_func) (stream, "%%csr");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'F':
|
|
|
|
(*info->fprintf_func) (stream, "%%fsr");
|
|
|
|
break;
|
|
|
|
|
2011-08-06 00:52:50 +08:00
|
|
|
case '(':
|
|
|
|
(*info->fprintf_func) (stream, "%%efsr");
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'p':
|
|
|
|
(*info->fprintf_func) (stream, "%%psr");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'q':
|
|
|
|
(*info->fprintf_func) (stream, "%%fq");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Q':
|
|
|
|
(*info->fprintf_func) (stream, "%%cq");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
(*info->fprintf_func) (stream, "%%tbr");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'w':
|
|
|
|
(*info->fprintf_func) (stream, "%%wim");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'x':
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-08 03:27:52 +08:00
|
|
|
(*info->fprintf_func) (stream, "%ld",
|
1999-05-03 15:29:11 +08:00
|
|
|
((X_LDST_I (insn) << 8)
|
|
|
|
+ X_ASI (insn)));
|
|
|
|
break;
|
|
|
|
|
binutils: support for the SPARC M8 processor
This patch adds support for the new SPARC M8 processor (implementing OSA
2017) to binutils.
New instructions:
- Dictionary Unpack
+ dictunpack
- Partitioned Compare with shifted result
+ Signed variants: fpcmp{le,gt,eq,ne}{8,16,32}shl
+ Unsigned variants: fpcmpu{le,gt}{8,16,32}shl
- Partitioned Dual-Equal compared, with shifted result
+ fpcmpde{8,16,32}shl
- Partitioned Unsigned Range Compare, with shifted result
+ fpcmpur{8,16,32}shl
- 64-bit shifts on Floating-Point registers
+ fps{ll,ra,rl}64x
- Misaligned loads and stores
+ ldm{sh,uh,sw,uw,x,ux}
+ ldm{sh,uh,sw,uw,x,ux}a
+ ldmf{s,d}
+ ldmf{s,d}a
+ stm{h,w,x}
+ stm{h,w,x}a
+ stmf{s,d}
+ stmf{s,d}a
- Oracle Numbers
+ on{add,sub,mul,div}
- Reverse Bytes/Bits
+ revbitsb
+ revbytes{h,w,x}
- Run-Length instructions
+ rle_burst
+ rle_length
- New crypto instructions
+ sha3
- Instruction to read the new register %entropy
+ rd %entropy
New Alternate Address Identifiers:
- 0x24, #ASI_CORE_COMMIT_COUNT
- 0x24, #ASI_CORE_SELECT_COUNT
- 0x48, #ASI_ARF_ECC_REG
- 0x53, #ASI_ITLB_PROBE
- 0x58, #ASI_DSFAR
- 0x5a, #ASI_DTLB_PROBE_PRIMARY
- 0x5b, #ASI_DTLB_PROBE_REAL
- 0x64, #ASI_CORE_SELECT_COMMIT_NHT
The new assembler command-line options for selecting the M8 architecture
are:
-Av9m8 or -Asparc6 for 64-bit binaries.
-Av8plusm8 for 32-bit (v8+) binaries.
The corresponding disassembler command-line options are:
-msparc:v9m8 for 64-bit binaries.
-msparc:v8plusm8 for 32-bit (v8+) binaries.
Tested for regressions in the following targets:
sparc-aout sparc-linux sparc-vxworks sparc64-linux
bfd/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* archures.c (bfd_mach_sparc_v9m8): Define.
(bfd_mach_sparc_v8plusm8): Likewise.
(bfd_mach_sparc_v9_p): Adjust to M8.
(bfd_mach_sparc_64bit_p): Likewise.
* aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
bfd_mach_sparc_v8plusm8.
* bfd-in2.h: Regenerated.
* cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
sparc:v8plusm8.
* elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
SHA3.
* elf32-sparc.c (elf32_sparc_final_write_processing): Handle
bfd_mach_sparc_v8plusm8.
binutils/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* NEWS: Mention the SPARC M8 support.
gas/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* config/tc-sparc.c (sparc_arch_table): Entries for `sparc6',
`v9m8' and `v8plusm8'.
(sparc_md_end): Handle SPARC_OPCODE_ARCH_M8.
(get_hwcap_name): Support the M8 hardware capabilities.
(sparc_ip): Handle new operand types.
* doc/c-sparc.texi (Sparc-Opts): Document -Av9m8, -Av8plusm8 and
-Asparc6, and the corresponding -xarch aliases.
* testsuite/gas/sparc/sparc6.s: New file.
* testsuite/gas/sparc/sparc6.d: Likewise.
* testsuite/gas/sparc/sparc6-diag.s: Likewise.
* testsuite/gas/sparc/sparc6-diag.l: Likewise.
* testsuite/gas/sparc/fpcmpshl.s: Likewise.
* testsuite/gas/sparc/fpcmpshl.d: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.s: Likewise.
* testsuite/gas/sparc/fpcmpshl-diag.l: Likewise.
* testsuite/gas/sparc/ldm-stm.s: Likewise.
* testsuite/gas/sparc/ldm-stm.d: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.s: Likewise.
* testsuite/gas/sparc/ldm-stm-diag.l: Likewise.
* testsuite/gas/sparc/ldmf-stmf.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf.d: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.s: Likewise.
* testsuite/gas/sparc/ldmf-stmf-diag.l: Likewise.
* testsuite/gas/sparc/on.s: Likewise.
* testsuite/gas/sparc/on.d: Likewise.
* testsuite/gas/sparc/on-diag.s: Likewise.
* testsuite/gas/sparc/on-diag.l: Likewise.
* testsuite/gas/sparc/rle.s: Likewise.
* testsuite/gas/sparc/rle.d: Likewise.
* testsuite/gas/sparc/sparc.exp (gas_64_check): Run new tests.
* testsuite/gas/sparc/rdasr.s: Add test for RDENTROPY.
* testsuite/gas/sparc/rdasr.d: Likewise.
include/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf/sparc.h (ELF_SPARC_HWCAP2_SPARC6): Define.
(ELF_SPARC_HWCAP2_ONADDSUB): Likewise.
(ELF_SPARC_HWCAP2_ONMUL): Likewise.
(ELF_SPARC_HWCAP2_ONDIV): Likewise.
(ELF_SPARC_HWCAP2_DICTUNP): Likewise.
(ELF_SPARC_HWCAP2_FPCMPSHL): Likewise.
(ELF_SPARC_HWCAP2_RLE): Likewise.
(ELF_SPARC_HWCAP2_SHA3): Likewise.
* opcode/sparc.h (sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_M8
and adjust SPARC_OPCODE_ARCH_MAX.
(HWCAP2_SPARC6): Define.
(HWCAP2_ONADDSUB): Likewise.
(HWCAP2_ONMUL): Likewise.
(HWCAP2_ONDIV): Likewise.
(HWCAP2_DICTUNP): Likewise.
(HWCAP2_FPCMPSHL): Likewise.
(HWCAP2_RLE): Likewise.
(HWCAP2_SHA3): Likewise.
(OPM): Likewise.
(OPMI): Likewise.
(ONFCN): Likewise.
(REVFCN): Likewise.
(SIMM10): Likewise.
opcodes/ChangeLog:
2017-05-19 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-dis.c (MASK_V9): Include SPARC_OPCODE_ARCH_M8.
(X_IMM2): Define.
(compute_arch_mask): Handle bfd_mach_sparc_v8plusm8 and
bfd_mach_sparc_v9m8.
(print_insn_sparc): Handle new operand types.
* sparc-opc.c (MASK_M8): Define.
(v6): Add MASK_M8.
(v6notlet): Likewise.
(v7): Likewise.
(v8): Likewise.
(v9): Likewise.
(v9a): Likewise.
(v9b): Likewise.
(v9c): Likewise.
(v9d): Likewise.
(v9e): Likewise.
(v9v): Likewise.
(v9m): Likewise.
(v9andleon): Likewise.
(m8): Define.
(HWS_VM8): Define.
(HWS2_VM8): Likewise.
(sparc_opcode_archs): Add entry for "m8".
(sparc_opcodes): Add OSA2017 and M8 instructions
dictunpack, fpcmp{ule,ugt,eq,ne,de,ur}{8,16,32}shl,
fpx{ll,ra,rl}64x,
ldm{sh,uh,sw,uw,x,ux}, ldm{sh,uh,sw,uw,x,ux}a, ldmf{s,d},
ldmf{s,d}a, on{add,sub,mul,div}, rdentropy, revbitsb,
revbytes{h,w,x}, rle_burst, rle_length, sha3, stm{h,w,x},
stm{h,w,x}a, stmf{s,d}, stmf{s,d}a.
(asi_table): New M8 ASIs ASI_CORE_COMMIT_COUNT,
ASI_CORE_SELECT_COUNT, ASI_ARF_ECC_REG, ASI_ITLB_PROBE, ASI_DSFAR,
ASI_DTLB_PROBE_PRIMARY, ASI_DTLB_PROBE_REAL,
ASI_CORE_SELECT_COMMIT_NHT.
2017-05-20 00:27:08 +08:00
|
|
|
case '|': /* 2-bit immediate */
|
|
|
|
(*info->fprintf_func) (stream, "%ld", X_IMM2 (insn));
|
|
|
|
break;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'y':
|
|
|
|
(*info->fprintf_func) (stream, "%%y");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'u':
|
|
|
|
case 'U':
|
|
|
|
{
|
|
|
|
int val = *s == 'U' ? X_RS1 (insn) : X_RD (insn);
|
|
|
|
const char *name = sparc_decode_sparclet_cpreg (val);
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
(*info->fprintf_func) (stream, "%s", name);
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (stream, "%%cpreg(%d)", val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we are adding or or'ing something to rs1, then
|
|
|
|
check to see whether the previous instruction was
|
|
|
|
a sethi to the same register as in the sethi.
|
|
|
|
If so, attempt to print the result of the add or
|
|
|
|
or (in this context add and or do the same thing)
|
|
|
|
and its symbolic value. */
|
1999-07-09 00:14:07 +08:00
|
|
|
if (imm_ored_to_rs1 || imm_added_to_rs1)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
unsigned long prev_insn;
|
|
|
|
int errcode;
|
|
|
|
|
2003-01-29 20:51:57 +08:00
|
|
|
if (memaddr >= 4)
|
|
|
|
errcode =
|
|
|
|
(*info->read_memory_func)
|
1999-05-03 15:29:11 +08:00
|
|
|
(memaddr - 4, buffer, sizeof (buffer), info);
|
2003-01-29 20:51:57 +08:00
|
|
|
else
|
|
|
|
errcode = 1;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
prev_insn = getword (buffer);
|
|
|
|
|
|
|
|
if (errcode == 0)
|
|
|
|
{
|
|
|
|
/* If it is a delayed branch, we need to look at the
|
|
|
|
instruction before the delayed branch. This handles
|
2003-01-29 20:51:57 +08:00
|
|
|
sequences such as:
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
sethi %o1, %hi(_foo), %o1
|
|
|
|
call _printf
|
2003-01-29 20:51:57 +08:00
|
|
|
or %o1, %lo(_foo), %o1 */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
if (is_delayed_branch (prev_insn))
|
|
|
|
{
|
2003-01-29 20:51:57 +08:00
|
|
|
if (memaddr >= 8)
|
|
|
|
errcode = (*info->read_memory_func)
|
|
|
|
(memaddr - 8, buffer, sizeof (buffer), info);
|
|
|
|
else
|
|
|
|
errcode = 1;
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
prev_insn = getword (buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If there was a problem reading memory, then assume
|
|
|
|
the previous instruction was not sethi. */
|
|
|
|
if (errcode == 0)
|
|
|
|
{
|
|
|
|
/* Is it sethi to the same register? */
|
|
|
|
if ((prev_insn & 0xc1c00000) == 0x01000000
|
|
|
|
&& X_RD (prev_insn) == X_RS1 (insn))
|
|
|
|
{
|
|
|
|
(*info->fprintf_func) (stream, "\t! ");
|
2005-07-01 19:16:33 +08:00
|
|
|
info->target =
|
2002-02-11 21:24:51 +08:00
|
|
|
((unsigned) 0xFFFFFFFF
|
|
|
|
& ((int) X_IMM22 (prev_insn) << 10));
|
1999-07-09 00:14:07 +08:00
|
|
|
if (imm_added_to_rs1)
|
|
|
|
info->target += X_SIMM (insn, 13);
|
|
|
|
else
|
|
|
|
info->target |= X_SIMM (insn, 13);
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->print_address_func) (info->target, info);
|
|
|
|
info->insn_type = dis_dref;
|
|
|
|
info->data_size = 4; /* FIXME!!! */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opcode->flags & (F_UNBR|F_CONDBR|F_JSR))
|
|
|
|
{
|
2010-06-27 12:07:55 +08:00
|
|
|
/* FIXME -- check is_annulled flag. */
|
|
|
|
(void) is_annulled;
|
1999-05-03 15:29:11 +08:00
|
|
|
if (opcode->flags & F_UNBR)
|
|
|
|
info->insn_type = dis_branch;
|
|
|
|
if (opcode->flags & F_CONDBR)
|
|
|
|
info->insn_type = dis_condbranch;
|
|
|
|
if (opcode->flags & F_JSR)
|
|
|
|
info->insn_type = dis_jsr;
|
|
|
|
if (opcode->flags & F_DELAYED)
|
|
|
|
info->branch_delay_insns = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sizeof (buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-29 20:51:57 +08:00
|
|
|
info->insn_type = dis_noninsn; /* Mark as non-valid instruction. */
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (stream, _("unknown"));
|
|
|
|
return sizeof (buffer);
|
|
|
|
}
|