diff options
author | Alan Modra <amodra@gmail.com> | 2022-10-13 08:46:28 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-10-14 22:07:18 +1030 |
commit | 61a457e5da46bad626bc3b6985a58fb5ae41842d (patch) | |
tree | d3923c9cbc7483191b42daebce20f42e2788c442 /gas | |
parent | d12f8998d2d086f0a6606589e5aedb7147e6f2f1 (diff) | |
download | gdb-61a457e5da46bad626bc3b6985a58fb5ae41842d.zip gdb-61a457e5da46bad626bc3b6985a58fb5ae41842d.tar.gz gdb-61a457e5da46bad626bc3b6985a58fb5ae41842d.tar.bz2 |
e200 LSP support
It has bothered me for a long time that we have disabled LSP (and SPE)
tests. Also the LSP test comment indicating there is something wrong
with get_powerpc_dialect. I don't think there is. Decoding of a VLE
instruction depends on whether the processor is in VLE mode (some
processors support both VLE and standard PPC) which we flag per
section with SHF_PPC_VLE for decoding when disassembling.
Background: Some versions of powerpc e200 have "Lightweight Signal
Processing" support, examples being e200z215 and e200z425. As far as
I can tell, LSP and SPE are mutually exclusive. This seems to be
borne out by insn encoding, for example LSP "zvaddih" and SPE "evaddw"
have the same encoding. So none of the processor descriptions in
ppc_opts ought to have both PPC_OPCODE_LSP and PPC_OPCODE_SPE/2, if we
want disassembly to work. I also could not find anything to suggest
that the LSP insns are enabled only in VLE mode, which means the LSP
insns should not be in vle_opcodes.
Fix all this by moving the LSP insns to their own table, and add a new
e200z2 cpu entry with LSP support, removing LSP from -me200z4 and from
-mvle. (Yes, I know, as I said above some of the e200z4 processors
have LSP. Others have SPE. It's hard to choose good options. Think
of z2 as meaning earlier, z4 as later.) Also add -mlsp to allow
adding the LSP insn set.
include/
* opcode/ppc.h (lsp_opcodes, lsp_num_opcodes): Declare.
(LSP_OP_TO_SEG): Define.
binutils/
* doc/binutils.texi: Update ppc docs.
gas/
* config/tc-ppc.c (ppc_setup_opcodes): Add lsp opcodes to ppc_hash.
* doc/c-ppc.texi: Document e200 and lsp.
* testsuite/gas/ppc/lsp-checks.d: Assemble with -me200z2.
* testsuite/gas/ppc/lsp.d: Likewise, disassembly too.
* testsuite/gas/ppc/ppc.exp: Don't xfail lsp test.
opcodes/
* ppc-dis.c (ppc_opts): Add e200z2 and lsp. Don't set
PPC_OPCODE_LSP for e200z4 or vle.
(ppc_parse_cpu): Mutually exclude LSP and SPE.
(LSP_OPCD_SEGS): Define.
(lsp_opcd_indices): New array.
(disassemble_init_powerpc): Init lsp_opcd_indices.
(lookup_lsp): New function.
(print_insn_powerpc): Call it.
* ppc-opc.c: Include libiberty.h for ARRAY_SIZE and use throughout.
(vle_opcodes): Move LSP opcodes to..
(lsp_opcodes): ..here, and sort.
(lsp_num_opcodes): New.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-ppc.c | 24 | ||||
-rw-r--r-- | gas/doc/c-ppc.texi | 16 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/lsp-checks.d | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/lsp.d | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/ppc.exp | 4 |
5 files changed, 38 insertions, 12 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index d20fd75..5077e05 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1810,6 +1810,30 @@ ppc_setup_opcodes (void) } } + /* LSP instructions */ + if ((ppc_cpu & PPC_OPCODE_LSP) != 0) + { + unsigned int prev_seg = 0; + unsigned int seg; + op_end = lsp_opcodes + lsp_num_opcodes; + for (op = lsp_opcodes; op < op_end; op++) + { + if (ENABLE_CHECKING) + { + seg = LSP_OP_TO_SEG (op->opcode); + if (seg < prev_seg) + { + as_bad (_("opcode is not sorted for %s"), op->name); + bad_insn = true; + } + prev_seg = seg; + bad_insn |= insn_validate (op); + } + + str_hash_insert (ppc_hash, op->name, op, 0); + } + } + /* SPE2 instructions */ if ((ppc_cpu & PPC_OPCODE_SPE2) == PPC_OPCODE_SPE2) { diff --git a/gas/doc/c-ppc.texi b/gas/doc/c-ppc.texi index 2986d3d..4a9addc 100644 --- a/gas/doc/c-ppc.texi +++ b/gas/doc/c-ppc.texi @@ -81,6 +81,12 @@ Generate code for PowerPC 821/850/860. @item -mppc64, -m620 Generate code for PowerPC 620/625/630. +@item -me200z2, -me200z4 +Generate code for e200 variants, e200z2 with LSP, e200z4 with SPE. + +@item -me300 +Generate code for PowerPC e300 family. + @item -me500, -me500x2 Generate code for Motorola e500 core complex. @@ -96,11 +102,14 @@ Generate code for Freescale e5500 core complex. @item -me6500 Generate code for Freescale e6500 core complex. +@item -mlsp +Enable LSP instructions. (Disables SPE and SPE2.) + @item -mspe -Generate code for Motorola SPE instructions. +Generate code for Motorola SPE instructions. (Disables LSP.) @item -mspe2 -Generate code for Freescale SPE2 instructions. +Generate code for Freescale SPE2 instructions. (Disables LSP.) @item -mtitan Generate code for AppliedMicro Titan core complex. @@ -114,9 +123,6 @@ Generate code for 32-bit BookE. @item -ma2 Generate code for A2 architecture. -@item -me300 -Generate code for PowerPC e300 family. - @item -maltivec Generate code for processors with AltiVec instructions. diff --git a/gas/testsuite/gas/ppc/lsp-checks.d b/gas/testsuite/gas/ppc/lsp-checks.d index d74151f..d654da6 100644 --- a/gas/testsuite/gas/ppc/lsp-checks.d +++ b/gas/testsuite/gas/ppc/lsp-checks.d @@ -1,3 +1,3 @@ #name: Test LSP operands checks -#as: -a32 -mbig -mvle +#as: -a32 -mbig -me200z2 #error_output: lsp-checks.l diff --git a/gas/testsuite/gas/ppc/lsp.d b/gas/testsuite/gas/ppc/lsp.d index ca45a36..311e008 100644 --- a/gas/testsuite/gas/ppc/lsp.d +++ b/gas/testsuite/gas/ppc/lsp.d @@ -1,5 +1,5 @@ -#as: -a32 -mbig -mvle -#objdump: -d -Mvle +#as: -a32 -mbig -me200z2 +#objdump: -d -Me200z2 #name: Validate LSP instructions .*: +file format elf.*-powerpc.* diff --git a/gas/testsuite/gas/ppc/ppc.exp b/gas/testsuite/gas/ppc/ppc.exp index 53c2d0d..9a18ce2 100644 --- a/gas/testsuite/gas/ppc/ppc.exp +++ b/gas/testsuite/gas/ppc/ppc.exp @@ -87,11 +87,7 @@ run_dump_test "vle-simple-4" run_dump_test "vle-simple-5" run_dump_test "vle-simple-6" run_dump_test "vle-mult-ld-st-insns" - -#fail expected until get_powerpc_dialect() patch not applied -setup_xfail "*-*-*" run_dump_test "lsp" - run_dump_test "lsp-checks" run_dump_test "efs" run_dump_test "efs2" |