word-length relies in base-len (sum of length of all fields
in bitrange objects that conform the instruction), word-value
and word-mask are not using the offset entry in the bitrange
object to calculate the accurate values when constant fields
are provided (ifld-constant? #t), so one more argument
is passed to those procedures to be used in the compute.
Regression tests to the following targets were done:
2021-09-15 Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
* ifield.scm: word-len has a relative value depending of word-offset
value, method field-value use word-offset parameter.
* insn.scm: remove condition ifld-beyond-base? in insn-base-value
procedure to allow field access when its offset is different to zero.
* utils.scm: word-value/work-mask accept an offset as argument to
compute the mask and get the value when offset is different that zero.
Mike Frysinger [Sun, 27 Jun 2021 03:26:58 +0000 (23:26 -0400)]
sim-decode: include cgen-mem & cgen-ops
The bpf & cris ports use functions from both of these APIs, so include
them here for all ports just in case (and since there isn't an API for
ports to declare specific additional headers they need).
Mike Frysinger [Sun, 31 Jan 2021 21:40:48 +0000 (16:40 -0500)]
sim: rename TRACE_EXTRACT to CGEN_TRACE_EXTRACT
As was done for other touch points in the sim project, add a CGEN_
prefix to namespace it away from the common code. The generated
files have already been updated years ago.
Alan Modra [Thu, 13 Jun 2019 01:45:07 +0000 (11:15 +0930)]
Update to autotools used by binutils
When cgen source is installed in the top source directory of
binutils-gdb and configuring with --enable-maintainer-mode
--enable-cgen-maint=yes it is somewhat annoying to regenerate cgen
files without differences due to using different autotools.
Particularly so since the generated files in the git repository don't
all use the same autotools.
This patch fixes that by modernising the source a little and
regenerating with autoconf-2.69 and automake-1.15.1.
Note that doc/stamp-vti and doc/version.texi contain dates taken from
your checked out doc/cgen.texi file time stamp. So in order to
regenerate these files consistently it is necessary to
touch --date=xxx doc/cgen.texi
with the date taken from the last doc/cgen.texi commit.
Stafford Horne [Sat, 1 Jun 2019 07:26:29 +0000 (16:26 +0900)]
gen-doc: Updates for latest cpu definitions
Doc generation was no longer working due to several issues.
- openrisc.cpu no longer exists (its not cpu/or1k.cpu in binutils-gdb)
- Relavive paths for archfile no longer work due to wrong cwd.
- Many architectures have been added and removed.
I have be able to get this working and added all the architectures I
could get working with the below changes. I have posted the results
here:
http://shorne.noip.me/downloads/gen-doc/
ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* gen-all-doc (archs): Add new archs and update locations.
(archfile): Prepend cgendir.
(index.html gen): Change name openrisc to or1k.
* html.scm (gen-html-trailer): Change redhat.com to
sourceware.org.
Stafford Horne [Sat, 1 Jun 2019 07:26:28 +0000 (16:26 +0900)]
cgen: Add unordered compare operation
On OpenRISC we have added FPU unordered comparison operations (NaN
detection). This patch adds the unordered operation which will generate
c hooks to be implemented in simulators.
An unordered comparison can now be defined as:
; Compare unordered (set flag if either r1 or r2 is NaN)
(set BI flag (unordered WI r1 r2))
; Compare unordered, greater than or equal
(set BI flag (or (unordered WI r1 r2)
(ge WI r1 r2)))
ChangeLog:
yyyy-mm-dd Stafford Horne <shorne@gmail.com>
* rtl-c.scm (unordered): New comparison operation.
* rtx-funcs.scm (unordered): New rtx node.
Jose E. Marchesi [Tue, 14 May 2019 18:09:25 +0000 (20:09 +0200)]
cgen: partial support for 64-bit wide fields in 32-bit hosts
Hi people!
This patch adds support for having 64-bit wide fields working in
32-bit hosts. This is not a complete solution, but it is enough for
supporting:
- Defining a 64-bit h-sint in your .cpu file.
- Using that hardware to define an operand featuring as index a
64-bit wide multi-ifield.
Note that the current CGEN support in binutils provides
cgen_{extract,insert}_normal functions that get `long' values, hence
the need for the operand to be indexed by a multi-ifield.
This is used by an eBPF binutils port which I will be upstreaming this
week. All other CGEN-based ports currently in binutils are not
impacted by this change.
Eventually, we shall make the "portable" INT/UINT modes (and
associated hardwares s-int/s-uint) to work properly in 32-bit hosts
when holding 64-bit values.
I have a tentative large patch attempting that, including changes in
binutils's opcodes CGEN support, that I will send for comments soon,
but in the meanwhile I would really appreciate if this gets into cgen.
(Without this patch applied, the eBPF assembler doesn't work properly
in 32-bit hosts.)
Thanks!
2019-05-14 Jose E. Marchesi <jose.marchesi@oracle.com>
* opcodes.scm (gen-ifield-default-type): Use int64_t for fields
wider than 32-bits.
(/gen-parse-number): Use u?int64_t for > 32-bit modes.
(gen-ifield-value-decl): Fix call to gen-ifield-default-type.
(<ifield>, gen-insert): Likewise.
(<ifield>, gen-extract): Likewise.
* opc-asmdis.scm (char): Likewise.
Alan Modra [Sat, 3 Mar 2018 01:31:31 +0000 (01:31 +0000)]
binutils opcodes error messages
This patch is aimed at making binutils/opcodes files comply with the
GNU coding standard regarding error messages, that is, they should
start with the program name followed by a colon, then a lower case
message. Accomplished by calling opcodes_error_handler to output the
program name (and final '\n'), rather than calling fprintf.
Alan Modra [Thu, 13 Apr 2017 11:58:48 +0000 (11:58 +0000)]
PR 20946
* desc-cpu.scm (lookup_mach_via_bfd_name): Return NULL if the name
could not be matched.
(@arch@_cgen_cpu_open): Allow for lookup_mach_via_bfd_name returning
Mike Frysinger [Mon, 9 May 2016 21:50:25 +0000 (21:50 +0000)]
cgen: sim: Updates to sim files to match gdb types
The types like MACH and MODEL have changes to SIM_MACH and SIM_MODEL
make updates to match these changes. This way people dont have to
manually update the generated files in GDB.
Nick Clifton [Wed, 3 Nov 2010 17:02:34 +0000 (17:02 +0000)]
* cpu/xstormy16.cpu (alignfix-mem-far): New macro. Like
alignfix-mem, but works with 32-bit addresses.
(set-alignfix-mem-far): New macro. Like set-alignfix-mem but
works with 32-bit addresses.
(movfgrgri, movfgrgripostinc, movfgrgripredec, movfgrgrii,
movfgrgriipostinc, movfgrgriipredec): Use alignfix-mem-far.
(movfgrigr, movfgripostincgr, movfgripredecgr): Use
set-alignfix-mem-far.
(movfgrgriipostinc, movfgriipostincgr): Propagate addition to
source register into base register.
(movfgrgriipredec, movfgriipredecgr): Propagate subtraction from
source register into base register.
* xstormy16-sem.cxx: Regenerate.
* testutils.inc (pass): Update parameter layout for write syscall.
(fail): Likewise.
* movgrgrii.cgs: Fix endianness typo in assertion.
* movgrgriipostinc.cgs: Likewise.
* movgrgriipredec.cgs: Likewise.
* movgrgripostinc.cgs: Likewise.
* movgrgripredec.cgs: Likewise.
* movgrigr.cgs: Likewise.
* movgriipostincgr.cgs: Likewise.
* movgripostincgr.cgs: Likewise.
* movgripredecgr.cgs: Likewise.
* rrcgrgr.cgs: Rotate only inserts carry flag once.
* rrcgrimm4.cgs: Likewise.
* movfgrgriipostinc.cgs: New test. Checks MOVF load with post increment.
* movfgrgriipredec.cgs: New test. Checks MOVF load with pre decrement.
* movfgriipostincgr.cgs: New test. Checks MOVF store with post increment.
* movfgriipostincgr.cgs: New test. Checks MOVF store with pre decrement.
Doug Evans [Thu, 28 Jan 2010 04:45:15 +0000 (04:45 +0000)]
* pmacros.scm: Follow commenting convention. Replace change to
$pmacro to %pmacro. $pmacro is confusing with $ in assembler syntax.
(/pmacro-orig-prefix, /pmacro-prefix): New globals.
Doug Evans [Mon, 25 Jan 2010 00:40:29 +0000 (00:40 +0000)]
* utils-cgen.scm (<location>): Define using new define-class.
(<ident>, <source-ident>, <context>): Ditto.
* cos.scm (/object-string): New function.
(/object-error): Use it.
(/object-count-true): New function
(object-copy-top): Delete. All callers changed to call object-copy.
(/parse-member-list, /build-getter-defs, /build-setter-defs): New fns.
(define-class, define-interface, define-method): New macros.
(define-getters, define-setters, vmake): Moved here ...
* utils-cgen.scm: ... from here.
Doug Evans [Wed, 6 Jan 2010 05:05:13 +0000 (05:05 +0000)]
* mode.scm (<mode>) Rename member non-mode-c-type to c-type.
All uses updated.
(mode:non-mode-c-type): Delete.
(mode:c-type): Update.
* rtl-c.scm (s-shop): Fix casting of DI mode values.
Doug Evans [Mon, 23 Nov 2009 03:28:31 +0000 (03:28 +0000)]
* insn.scm (/parse-insn-format): Watch for duplicate ifields.
* read.scm (parse-error-continuable): New function.
(define /continuable-error-found?): New variable.
(/init-reader!): Initialize it.
(/finish-reader!): New function.
(cpu-load): Call it.
* utils-cgen.scm (obj-list-nub): New function.
Doug Evans [Sat, 21 Nov 2009 09:57:58 +0000 (09:57 +0000)]
* sim.scm (/operand-number-elaboration-written?): New variable.
(/op-gen-written-update op): New function.
(/op-gen-set-trace, /op-gen-set-trace-parallel): Call it.