OpenRISC orfpx64a32 and openrisc spec 1.3 support
v3 cover OpenRISC orfpx64a32 and openrisc spec 1.3 support
Hello,
Its been a while since v2, but we have been busy changing direction a bit. Instead of just adding the orfpx64a32 extension support we have created a new architecture specification [0] and this series includes some of those changes.
Changes from v2:
- Use explicit register pairs in orfpx64a32 extension instead of implicit suggestioned by rth.
- Add unordered FPU comparison instructions.
- Add test for the previously added l.adrp instruction.
- A few non material cgen comment/symbol updates.
Changes from v1:
- Rebased
- Note Andrey is working on doing his FSF copyright assignment for binutils, sim
The orfpx64a32 extension patches are to the OpenRISC assembler and simulator to support 64-bit floating point operations on 32-bit cores using register pairs, see orfpx64a32 [1].
The original patches were written by Andrey Bacherov and I have made some updates to get the simulator working and to match ABI updates for the final architecture 1.3 specification.
Example of orfpx64a32 operations:
lf.add.d r3,r4, r5,r6, r7,r8 ; {r3,r4} <= {r5,r6} + {r7,r8}
lf.add.d r16,r18, r20,r22, r24,r26 ; {r16,r18} <= {r20,r22} + {r24,r26}Note, on 64-bit architectures the instructions will be written with 64-bit registers.
lf.add.d r3, r5, r7 ; r3 <= r5 + r7 lf.add.d r16, r20 r24 ; r16 <= r20 + r24
The new unordered comparison instructions allow the OpenRISC FPU to do comparisons where input may include NaNs [2]
These binutil patches have been used along with the GCC FPU patches [3] on the OpenRISC GCC 9 toolchain to test single and double precision floating point support including unordered comparisons. The main 'real' implementation of this hardware is Andrey's or1k_marocchino [4] core implementation which we have been using along with simulators for verification.
This whole patch series can be found on my github repo [5] as well.
[0] https://github.com/openrisc/doc/blob/master/openrisc-arch-1.3-rev1.pdf
[1] https://openrisc.io/proposals/orfpx64a32
[2] https://openrisc.io/proposals/lfsf
[3] git at github.com:stffrdhrn/gcc.git or1k-fpu-2
[4] https://github.com/openrisc/or1k_marocchino
[5] [email protected]:stffrdhrn/binutils-gdb.git orfpx64a32-3
-Stafford
Stafford Horne (11):
cpu/or1k: Add support for orfp64a32 spec
cpu/or1k: Define unordered comparisons
cpu/or1k: Document no branch delay slot architectures and l.adrp cpu/or1k: Update fpu compare symbols to imply set flag opcodes/or1k: Regenerate opcodes
sim/or1k: Regenerate sim
sim/common: Wire in df/di conversion
sim/common: wire up new unordered comparisons sim/testsuite/or1k: Add test for 64-bit fpu operations sim/testsuite/or1k: Add test case for l.adrp instruction sim/testsuite/or1k: Add tests for unordered compares
cpu/or1k.cpu | 21 +- cpu/or1k.opc | 92 ++ cpu/or1kcommon.cpu | 113 +- cpu/or1korbis.cpu | 3 +- cpu/or1korfpx.cpu | 214 ++- opcodes/or1k-asm.c | 72 +- opcodes/or1k-desc.c | 309 +++- opcodes/or1k-desc.h | 341 ++--- opcodes/or1k-dis.c | 43 +- opcodes/or1k-ibld.c | 234 ++- opcodes/or1k-opc.c | 319 +++- opcodes/or1k-opc.h | 39 +- opcodes/or1k-opinst.c | 100 +- sim/common/cgen-accfp.c | 49 + sim/common/cgen-fpu.h | 2 + sim/or1k/arch.c | 2 +- sim/or1k/arch.h | 2 +- sim/or1k/cpu.c | 78 +- sim/or1k/cpu.h | 174 ++- sim/or1k/cpuall.h | 2 +- sim/or1k/decode.c | 568 ++++++-- sim/or1k/decode.h | 21 +- sim/or1k/model.c | 1456 ++++++++++++++++--- sim/or1k/sem-switch.c | 602 +++++++- sim/or1k/sem.c | 672 ++++++++- sim/testsuite/sim/or1k/adrp.S | 73 + sim/testsuite/sim/or1k/fpu-unordered.S | 97 ++ sim/testsuite/sim/or1k/fpu64a32-unordered.S | 100 ++ sim/testsuite/sim/or1k/fpu64a32.S | 172 +++ 29 files changed, 5253 insertions(+), 717 deletions(-) create mode 100644 sim/testsuite/sim/or1k/adrp.S create mode 100644 sim/testsuite/sim/or1k/fpu-unordered.S create mode 100644 sim/testsuite/sim/or1k/fpu64a32-unordered.S create mode 100644 sim/testsuite/sim/or1k/fpu64a32.S
Signature · 1 line
2.21.0
PATCH v3 1/11 cpu/or1k: Add support for orfp64a32 spec
This patch adds support for OpenRISC 64-bit FPU operations on 32-bit cores by using register pairs. The functionality has been added to OpenRISC architecture specification version 1.3 as per architecture proposal 14[0].
For supporting assembly of both 64-bit and 32-bit precision instructions we have defined CGEN_VALIDATE_INSN_SUPPORTED. This allows cgen to use 64-bit bit architecture assembly parsing on 64-bit toolchains and 32-bit architecture assembly parsing on 32-bit toolchains. Without this the assembler has issues parsing register pairs.
This patch also contains a few fixes to the symantics for existing OpenRISC single and double precision FPU operations.
[0] https://openrisc.io/proposals/orfpx64a32
cpu/ChangeLog:
yyyy-mm-dd Andrey Bacherov <[email protected]>
Stafford Horne <[email protected]>
* or1k.cpu (ORFPX64A32-MACHS): New pmacro.
(ORFPX-MACHS): Removed pmacro.
* or1k.opc (or1k_cgen_insn_supported): New function. (CGEN_VALIDATE_INSN_SUPPORTED): Define macro. (parse_regpair, print_regpair): New functions.
* or1kcommon.cpu (h-spr, spr-shift, spr-address, h-gpr): Reorder and add comments.
(h-fdr): Update comment to indicate or64. (reg-pair-reg-lo, reg-pair-reg-hi): New pmacros for register pairs. (h-fd32r): New hardware for 64-bit fpu registers. (h-i64r): New hardware for 64-bit int registers.
* or1korbis.cpu (f-resv-8-1): New field.
* or1korfpx.cpu (rDSF, rASF, rBSF): Update attribute to ORFPX32-MACHS. (rDDF, rADF, rBDF): Update operand comment to indicate or64. (f-rdoff-10-1, f-raoff-9-1, f-rboff-8-1): New fields. (h-roff1): New hardware.
(double-field-and-ops mnemonic): New pmacro to generate operations rDD32F, rAD32F, rBD32F, rDDI and rADI. (float-regreg-insn): Update single precision generator to MACH ORFPX32-MACHS. Add generator for or32 64-bit instructions. (float-setflag-insn): Update single precision generator to MACH ORFPX32-MACHS. Fix double instructions from single to double precision. Add generator for or32 64-bit instructions. (float-cust-insn cust-num): Update single precision generator to MACH ORFPX32-MACHS. Add generator for or32 64-bit instructions. (lf-rem-s, lf-itof-s, lf-ftoi-s, lf-madd-s): Update MACH to ORFPX32-MACHS.
(lf-rem-d): Fix operation from mod to rem.
(lf-rem-d32, lf-itof-d32, lf-ftoi-d32, lf-madd-d32): New instruction. (lf-itof-d): Fix operands from single to double. (lf-ftoi-d): Update operand mode from DI to WI.
---
Changes since v2:
- switch from implicit to explicit reg pairs (new functions parse_regpair print_regpair)
cpu/or1k.cpu | 15 +++-- cpu/or1k.opc | 92 +++++++++++++++++++++++++ cpu/or1kcommon.cpu | 113 +++++++++++++++++++++++++------ cpu/or1korbis.cpu | 1 + cpu/or1korfpx.cpu | 165 +++++++++++++++++++++++++++++++++++++++------ 5 files changed, 340 insertions(+), 46 deletions(-)
cpu/or1k.cpu +8 -7
@@ -1,8 +1,9 @@ ; OpenRISC 1000 architecture. -*- Scheme -*- -; Copyright 2000-2014 Free Software Foundation, Inc. +; Copyright 2000-2019 Free Software Foundation, Inc. ; Contributed for OR32 by Johan Rydberg, jrydberg at opencores.org ; Modified by Julius Baxter, juliusbaxter at gmail.com ; Modified by Peter Gavin, pgavin at gmail.com +; Modified by Andrey Bacherov, avbacherov at opencores.org ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by
@@ -42,12 +43,12 @@ (base-insn-bitsize 32) ) -(define-pmacro OR32-MACHS or32,or32nd) -(define-pmacro OR64-MACHS or64,or64nd) -(define-pmacro ORBIS-MACHS or32,or32nd,or64,or64nd) -(define-pmacro ORFPX-MACHS or32,or32nd,or64,or64nd) -(define-pmacro ORFPX32-MACHS or32,or32nd,or64,or64nd) -(define-pmacro ORFPX64-MACHS or64,or64nd) +(define-pmacro OR32-MACHS or32,or32nd) +(define-pmacro OR64-MACHS or64,or64nd) +(define-pmacro ORBIS-MACHS or32,or32nd,or64,or64nd) +(define-pmacro ORFPX32-MACHS or32,or32nd,or64,or64nd) +(define-pmacro ORFPX64-MACHS or64,or64nd) +(define-pmacro ORFPX64A32-MACHS or32,or32nd) ; float64 for 32-bit machs (define-attr (for model)
cpu/or1k.opc +92 -0
107 lines not on this page · raw message
cpu/or1kcommon.cpu +94 -19
142 lines not on this page · raw message
cpu/or1korbis.cpu +1 -0
@@ -61,6 +61,7 @@ (dnf f-resv-10-7 "resv-10-7" ((MACH ORBIS-MACHS) RESERVED) 10 7) (dnf f-resv-10-3 "resv-10-3" ((MACH ORBIS-MACHS) RESERVED) 10 3) (dnf f-resv-10-1 "resv-10-1" ((MACH ORBIS-MACHS) RESERVED) 10 1) +(dnf f-resv-8-1 "resv-8-1" ((MACH ORBIS-MACHS) RESERVED) 8 1) (dnf f-resv-7-4 "resv-7-4" ((MACH ORBIS-MACHS) RESERVED) 7 4) (dnf f-resv-5-2 "resv-5-2" ((MACH ORBIS-MACHS) RESERVED) 5 2)
cpu/or1korfpx.cpu +145 -20
272 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 2/11 cpu/or1k: Define unordered comparisons
In reply to Stafford HorneAdd support for new floating point unordered comparisons. These have been defined in OpenRISC architecture proposal 7[0] and are now included in the architecture specification 1.3.
These new instructions provide the ability for floating point comparisons to detect NaNs.
[0] https://openrisc.io/proposals/lfsf
cpu/ChangeLog:
yyyy-mm-dd Stafford Horne <[email protected]>
* or1korfpx.cpu (insn-opcode-float-regreg): Add SFUEQ_S, SFUNE_S, SFUGT_S, SFUGE_S, SFULT_S, SFULE_S, SFUN_S, SFUEQ_D, SFUNE_D, SFUGT_D, SFUGE_D, SFULT_D, SFULE_D, SFUN_D opcodes. (float-setflag-insn-base): New pmacro based on float-setflag-insn. (float-setflag-symantics, float-setflag-unordered-cmp-symantics, float-setflag-unordered-symantics): New pmacro for instruction symantics.
(float-setflag-insn): Update to use float-setflag-insn-base. (float-setflag-unordered-insn): New pmacro for generating instructions.
--- cpu/or1korfpx.cpu | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-)
cpu/or1korfpx.cpu +43 -4
@@ -54,6 +54,20 @@ ("SFGE_D" #x1b) ("SFLT_D" #x1c) ("SFLE_D" #x1d) + ("SFUEQ_S" #x28) + ("SFUNE_S" #x29) + ("SFUGT_S" #x2a) + ("SFUGE_S" #x2b) + ("SFULT_S" #x2c) + ("SFULE_S" #x2d) + ("SFUN_S" #x2e) + ("SFUEQ_D" #x38) + ("SFUNE_D" #x39) + ("SFUGT_D" #x3a) + ("SFUGE_D" #x3b) + ("SFULT_D" #x3c) + ("SFULE_D" #x3d) + ("SFUN_D" #x3e) ("CUST1_S" #xd0) ("CUST1_D" #xe0) )
@@ -252,14 +266,14 @@ () ) -(define-pmacro (float-setflag-insn mnemonic) +(define-pmacro (float-setflag-insn-base mnemonic rtx-mnemonic symantics) (begin (dni (.sym lf- mnemonic -s) (.str "lf.sf" mnemonic ".s reg/reg") ((MACH ORFPX32-MACHS)) (.str "lf.sf" mnemonic ".s $rASF,$rBSF") (+ OPC_FLOAT (f-r1 0) rASF rBSF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _S)) - (set BI sys-sr-f (mnemonic SF rASF rBSF)) + (symantics rtx-mnemonic SF rASF rBSF) () ) (dni (.sym lf- mnemonic -d)
@@ -267,7 +281,7 @@ ((MACH ORFPX64-MACHS)) (.str "lf.sf" mnemonic ".d $rADF,$rBDF") (+ OPC_FLOAT (f-r1 0) rADF rBDF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _D)) - (set BI sys-sr-f (mnemonic DF rADF rBDF)) + (symantics rtx-mnemonic DF rADF rBDF) () ) (dni (.sym lf- mnemonic -d32)
@@ -275,18 +289,43 @@ ((MACH ORFPX64A32-MACHS)) (.str "lf.sf" mnemonic ".d $rAD32F,$rBD32F") (+ OPC_FLOAT (f-r1 0) rAD32F rBD32F (f-resv-10-1 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _D)) - (set BI sys-sr-f (mnemonic DF rAD32F rBD32F)) + (symantics rtx-mnemonic DF rAD32F rBD32F) () ) ) ) +(define-pmacro (float-setflag-symantics mnemonic mode r1 r2) + (set BI sys-sr-f (mnemonic mode r1 r2))) + +(define-pmacro (float-setflag-insn mnemonic) + (float-setflag-insn-base mnemonic mnemonic float-setflag-symantics)) + +(define-pmacro (float-setflag-unordered-cmp-symantics mnemonic mode r1 r2) + (set BI sys-sr-f (or (unordered mode r1 r2) + (mnemonic mode r1 r2)))) + +(define-pmacro (float-setflag-unordered-symantics mnemonic mode r1 r2) + (set BI sys-sr-f (unordered mode r1 r2))) + +(define-pmacro (float-setflag-unordered-insn mnemonic) + (float-setflag-insn-base (.str "u" mnemonic) + mnemonic + float-setflag-unordered-cmp-symantics)) + (float-setflag-insn eq) (float-setflag-insn ne) (float-setflag-insn ge) (float-setflag-insn gt) (float-setflag-insn lt) (float-setflag-insn le) +(float-setflag-unordered-insn eq) +(float-setflag-unordered-insn ne) +(float-setflag-unordered-insn gt) +(float-setflag-unordered-insn ge) +(float-setflag-unordered-insn lt) +(float-setflag-unordered-insn le) +(float-setflag-insn-base un () float-setflag-unordered-symantics) (dni lf-madd-s "lf.madd.s reg/reg/reg"
Signature · 1 line
2.21.0
PATCH v3 3/11 cpu/or1k: Document no branch delay slot architectures and l.adrp
In reply to Stafford HorneThe 'nd' architectures did not mention what the 'nd' stands for. Document that these mean 'no brach delay slot'.
cpu/ChangeLog:
yyyy-mm-dd Stafford Horne <[email protected]>
* or1k.cpu (or64nd, or32nd, or1200nd): Update comment.a (l-adrp): Improve comment.
--- cpu/or1k.cpu | 6 +++--- cpu/or1korbis.cpu | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
cpu/or1k.cpu +3 -3
@@ -77,7 +77,7 @@ (define-mach (name or32nd) - (comment "Generic OpenRISC 1000 32-bit CPU") + (comment "Generic OpenRISC 1000 32-bit CPU with no branch delay slot") (cpu or1k32bf) (bfd-name "or1knd") )
@@ -92,7 +92,7 @@ ; OpenRISC 1200 - 32-bit or1k CPU implementation (define-model - (name or1200nd) (comment "OpenRISC 1200 model") + (name or1200nd) (comment "OpenRISC 1200 model with no branch delay slot") (attrs NO-DELAY-SLOT) (mach or32nd) (unit u-exec "Execution Unit" () 1 1 () () () ())
@@ -120,7 +120,7 @@ (define-mach (name or64nd) - (comment "Generic OpenRISC 1000 ND 64-bit CPU") + (comment "Generic OpenRISC 1000 ND 64-bit CPU with no branch delay slot") (cpu or1k64bf) (bfd-name "or1k64nd") )
cpu/or1korbis.cpu +1 -1
@@ -433,7 +433,7 @@ ) ) -(dni l-adrp "adrp reg/disp21" +(dni l-adrp "load pc-relative page address" ((MACH ORBIS-MACHS)) "l.adrp $rD,${disp21}" (+ OPC_ADRP rD disp21)
Signature · 1 line
2.21.0
PATCH v3 4/11 cpu/or1k: Update fpu compare symbols to imply set flag
In reply to Stafford HorneThe fpu compare symbols where not including 'sf' in the mnemonic. So instead of lf-sfeq (implying set flag if operands are equal) we were
having lf-eq. This patch adds the 'sf'. This helps with making the
generated CGEN documentation consistent and ordered correctly.
cpu/ChangeLog:
yyyy-mm-dd Stafford Horne <[email protected]>
* or1korfpx.cpu (float-setflag-insn-base): Add 'sf' to symbol.
--- cpu/or1korfpx.cpu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
cpu/or1korfpx.cpu +3 -3
@@ -268,7 +268,7 @@ (define-pmacro (float-setflag-insn-base mnemonic rtx-mnemonic symantics) (begin - (dni (.sym lf- mnemonic -s) + (dni (.sym lf-sf mnemonic -s) (.str "lf.sf" mnemonic ".s reg/reg") ((MACH ORFPX32-MACHS)) (.str "lf.sf" mnemonic ".s $rASF,$rBSF")
@@ -276,7 +276,7 @@ (symantics rtx-mnemonic SF rASF rBSF) () ) - (dni (.sym lf- mnemonic -d) + (dni (.sym lf-sf mnemonic -d) (.str "lf.sf" mnemonic ".d reg/reg") ((MACH ORFPX64-MACHS)) (.str "lf.sf" mnemonic ".d $rADF,$rBDF")
@@ -284,7 +284,7 @@ (symantics rtx-mnemonic DF rADF rBDF) () ) - (dni (.sym lf- mnemonic -d32) + (dni (.sym lf-sf mnemonic -d32) (.str "lf.sf" mnemonic ".d regpair/regpair") ((MACH ORFPX64A32-MACHS)) (.str "lf.sf" mnemonic ".d $rAD32F,$rBD32F")
Signature · 1 line
2.21.0
PATCH v3 5/11 opcodes/or1k: Regenerate opcodes
In reply to Stafford HorneThis picks up changes for:
- new orfpx64a32 spec additions
- new unordered instructions
- symbol and documentation updates
opcodes/ChangeLog:
* or1k-asm.c: Regenerated.
* or1k-desc.c: Regenerated.
* or1k-desc.h: Regenerated.
* or1k-dis.c: Regenerated.
* or1k-ibld.c: Regenerated.
* or1k-opc.c: Regenerated.
* or1k-opc.h: Regenerated.
* or1k-opinst.c: Regenerated.
---
Changes since v2:
- Now regenerating for new unordered instructions and documentation.
opcodes/or1k-asm.c | 72 ++++++++- opcodes/or1k-desc.c | 309 +++++++++++++++++++++++++++++++++----- opcodes/or1k-desc.h | 341 +++++++++++++++++++++--------------------- opcodes/or1k-dis.c | 43 +++++- opcodes/or1k-ibld.c | 234 +++++++++++++++++++++++++++-- opcodes/or1k-opc.c | 319 +++++++++++++++++++++++++++++++++++---- opcodes/or1k-opc.h | 39 +++-- opcodes/or1k-opinst.c | 100 +++++++++++-- 8 files changed, 1184 insertions(+), 273 deletions(-)
opcodes/or1k-asm.c +70 -2
@@ -419,6 +419,56 @@ parse_uimm16_split (CGEN_CPU_DESC cd, const char **strp, int opindex,return errmsg; } +/* Parse register pairs with syntax rA,rB to a flag + rA value. */ + +static const char * +parse_regpair (CGEN_CPU_DESC cd,const char **strp, + int opindex ATTRIBUTE_UNUSED, unsigned long *valuep) +{ +long reg1_index; +long reg2_index; +const char *errmsg; + +/* The first part should just be a register. */ + errmsg =cgen_parse_keyword (cd, strp, &or1k_cgen_opval_h_gpr, + ®1_index); + +/* If that worked skip the comma separator. */ +if (errmsg ==NULL ) + { +if (**strp ==',' ) + ++*strp; +else + errmsg ="Unexpected character, expected ','" ; + } + +/* If that worked the next part is just another register. */ +if (errmsg ==NULL ) + errmsg =cgen_parse_keyword (cd, strp, &or1k_cgen_opval_h_gpr, + ®2_index); + +/* Validate the register pair is valid and create the output value. */ +if (errmsg ==NULL ) + { +int regoffset = reg2_index - reg1_index; + +if (regoffset ==1 || regoffset ==2 ) + { +unsigned short offsetmask; +unsigned short value; + + offsetmask = ((regoffset ==2 ?1 :0 ) <<5 ); + value = offsetmask | reg1_index; + + *valuep = value; + } +else + errmsg ="Invalid register pair, offset not 1 or 2." ; + } + +return errmsg; +} +/* -- */ const char * or1k_cgen_parse_operand
@@ -466,8 +516,14 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,case OR1K_OPERAND_RA : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_gpr, & fields->f_r2);break ; +case OR1K_OPERAND_RAD32F : + errmsg =parse_regpair (cd, strp,OR1K_OPERAND_RAD32F , (unsigned long *) (& fields->f_rad32)); +break ;case OR1K_OPERAND_RADF : - errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r1); + errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r2); +break ; +case OR1K_OPERAND_RADI : + errmsg =parse_regpair (cd, strp,OR1K_OPERAND_RADI , (unsigned long *) (& fields->f_rad32));break ;case OR1K_OPERAND_RASF : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fsr, & fields->f_r2);
@@ -475,8 +531,14 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,case OR1K_OPERAND_RB : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_gpr, & fields->f_r3);break ; +case OR1K_OPERAND_RBD32F : + errmsg =parse_regpair (cd, strp,OR1K_OPERAND_RBD32F , (unsigned long *) (& fields->f_rbd32)); +break ;case OR1K_OPERAND_RBDF : - errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r1); + errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r3); +break ; +case OR1K_OPERAND_RBDI : + errmsg =parse_regpair (cd, strp,OR1K_OPERAND_RBDI , (unsigned long *) (& fields->f_rbd32));break ;case OR1K_OPERAND_RBSF : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fsr, & fields->f_r3);
@@ -484,9 +546,15 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,case OR1K_OPERAND_RD : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_gpr, & fields->f_r1);break ; +case OR1K_OPERAND_RDD32F : + errmsg =parse_regpair (cd, strp,OR1K_OPERAND_RDD32F , (unsigned long *) (& fields->f_rdd32)); +break ;case OR1K_OPERAND_RDDF : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r1);break ; +case OR1K_OPERAND_RDDI : + errmsg =parse_regpair (cd, strp,OR1K_OPERAND_RDDI , (unsigned long *) (& fields->f_rdd32)); +break ;case OR1K_OPERAND_RDSF : errmsg =cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fsr, & fields->f_r1);break ;
opcodes/or1k-desc.c +272 -37
492 lines not on this page · raw message
opcodes/or1k-desc.h +174 -167
376 lines not on this page · raw message
opcodes/or1k-dis.c +41 -2
72 lines not on this page · raw message
opcodes/or1k-ibld.c +222 -12
372 lines not on this page · raw message
opcodes/or1k-opc.c +289 -30
456 lines not on this page · raw message
opcodes/or1k-opc.h +30 -9
@@ -37,6 +37,11 @@ extern "C" {#undef CGEN_DIS_HASH#define CGEN_DIS_HASH (buffer, value) (((unsigned char *) (buffer))[0] >> 2) +/* Check applicability of instructions against machines. */ +#define CGEN_VALIDATE_INSN_SUPPORTED + +extern int or1k_cgen_insn_supported (CGEN_CPU_DESC ,const CGEN_INSN *); +/* -- */ /* Enum declaration for or1k instruction types. */ typedef enum cgen_insn_type {
@@ -65,21 +70,30 @@ typedef enum cgen_insn_type { , OR1K_INSN_L_MACU, OR1K_INSN_L_MSB, OR1K_INSN_L_MSBU, OR1K_INSN_L_CUST1 ,OR1K_INSN_L_CUST2 ,OR1K_INSN_L_CUST3 ,OR1K_INSN_L_CUST4 ,OR1K_INSN_L_CUST5 ,OR1K_INSN_L_CUST6 ,OR1K_INSN_L_CUST7 ,OR1K_INSN_L_CUST8 ,OR1K_INSN_LF_ADD_S - ,OR1K_INSN_LF_ADD_D ,OR1K_INSN_LF_SUB_S ,OR1K_INSN_LF_SUB_D ,OR1K_INSN_LF_MUL_S - ,OR1K_INSN_LF_MUL_D ,OR1K_INSN_LF_DIV_S ,OR1K_INSN_LF_DIV_D ,OR1K_INSN_LF_REM_S - ,OR1K_INSN_LF_REM_D ,OR1K_INSN_LF_ITOF_S ,OR1K_INSN_LF_ITOF_D ,OR1K_INSN_LF_FTOI_S - ,OR1K_INSN_LF_FTOI_D ,OR1K_INSN_LF_EQ_S ,OR1K_INSN_LF_EQ_D ,OR1K_INSN_LF_NE_S - ,OR1K_INSN_LF_NE_D ,OR1K_INSN_LF_GE_S ,OR1K_INSN_LF_GE_D ,OR1K_INSN_LF_GT_S - ,OR1K_INSN_LF_GT_D ,OR1K_INSN_LF_LT_S ,OR1K_INSN_LF_LT_D ,OR1K_INSN_LF_LE_S - ,OR1K_INSN_LF_LE_D ,OR1K_INSN_LF_MADD_S ,OR1K_INSN_LF_MADD_D ,OR1K_INSN_LF_CUST1_S - ,OR1K_INSN_LF_CUST1_D + ,OR1K_INSN_LF_ADD_D ,OR1K_INSN_LF_ADD_D32 ,OR1K_INSN_LF_SUB_S ,OR1K_INSN_LF_SUB_D + ,OR1K_INSN_LF_SUB_D32 ,OR1K_INSN_LF_MUL_S ,OR1K_INSN_LF_MUL_D ,OR1K_INSN_LF_MUL_D32 + ,OR1K_INSN_LF_DIV_S ,OR1K_INSN_LF_DIV_D ,OR1K_INSN_LF_DIV_D32 ,OR1K_INSN_LF_REM_S + ,OR1K_INSN_LF_REM_D ,OR1K_INSN_LF_REM_D32 ,OR1K_INSN_LF_ITOF_S ,OR1K_INSN_LF_ITOF_D + ,OR1K_INSN_LF_ITOF_D32 ,OR1K_INSN_LF_FTOI_S ,OR1K_INSN_LF_FTOI_D ,OR1K_INSN_LF_FTOI_D32 + ,OR1K_INSN_LF_SFEQ_S ,OR1K_INSN_LF_SFEQ_D ,OR1K_INSN_LF_SFEQ_D32 ,OR1K_INSN_LF_SFNE_S + ,OR1K_INSN_LF_SFNE_D ,OR1K_INSN_LF_SFNE_D32 ,OR1K_INSN_LF_SFGE_S ,OR1K_INSN_LF_SFGE_D + ,OR1K_INSN_LF_SFGE_D32 ,OR1K_INSN_LF_SFGT_S ,OR1K_INSN_LF_SFGT_D ,OR1K_INSN_LF_SFGT_D32 + ,OR1K_INSN_LF_SFLT_S ,OR1K_INSN_LF_SFLT_D ,OR1K_INSN_LF_SFLT_D32 ,OR1K_INSN_LF_SFLE_S + ,OR1K_INSN_LF_SFLE_D ,OR1K_INSN_LF_SFLE_D32 ,OR1K_INSN_LF_SFUEQ_S ,OR1K_INSN_LF_SFUEQ_D + ,OR1K_INSN_LF_SFUEQ_D32 ,OR1K_INSN_LF_SFUNE_S ,OR1K_INSN_LF_SFUNE_D ,OR1K_INSN_LF_SFUNE_D32 + ,OR1K_INSN_LF_SFUGT_S ,OR1K_INSN_LF_SFUGT_D ,OR1K_INSN_LF_SFUGT_D32 ,OR1K_INSN_LF_SFUGE_S + ,OR1K_INSN_LF_SFUGE_D ,OR1K_INSN_LF_SFUGE_D32 ,OR1K_INSN_LF_SFULT_S ,OR1K_INSN_LF_SFULT_D + ,OR1K_INSN_LF_SFULT_D32 ,OR1K_INSN_LF_SFULE_S ,OR1K_INSN_LF_SFULE_D ,OR1K_INSN_LF_SFULE_D32 + ,OR1K_INSN_LF_SFUN_S ,OR1K_INSN_LF_SFUN_D ,OR1K_INSN_LF_SFUN_D32 ,OR1K_INSN_LF_MADD_S + ,OR1K_INSN_LF_MADD_D ,OR1K_INSN_LF_MADD_D32 ,OR1K_INSN_LF_CUST1_S ,OR1K_INSN_LF_CUST1_D + ,OR1K_INSN_LF_CUST1_D32 } CGEN_INSN_TYPE;/* Index of `invalid' insn place holder. */ #define CGEN_INSN_INVALID OR1K_INSN_INVALID/* Total number of insns in table. */ -#define MAX_INSNS ((int) OR1K_INSN_LF_CUST1_D + 1) +#define MAX_INSNS ((int) OR1K_INSN_LF_CUST1_D32 + 1)/* This struct records data prior to insertion or after extraction. */ struct cgen_fields
@@ -113,6 +127,7 @@ struct cgen_fieldslong f_resv_10_7;long f_resv_10_3;long f_resv_10_1; +long f_resv_8_1;long f_resv_7_4;long f_resv_5_2;long f_imm16_25_5;
@@ -124,6 +139,12 @@ struct cgen_fieldslong f_uimm6;long f_uimm16_split;long f_simm16_split; +long f_rdoff_10_1; +long f_raoff_9_1; +long f_rboff_8_1; +long f_rdd32; +long f_rad32; +long f_rbd32; };#define CGEN_INIT_PARSE (od) \
opcodes/or1k-opinst.c +86 -14
156 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 6/11 sim/or1k: Regenerate sim
In reply to Stafford HorneThis picks up changes for:
- new orfpx64a32 spec
- new unordered instructions
- documentation and symbol updates
sim/ChangeLog:
* or1k/cpu.c: Regenerate.
* or1k/cpu.h: Regenerate.
* or1k/decode.c: Regenerate.
* or1k/decode.h: Regenerate.
* or1k/model.c: Regenerate.
* or1k/sem-switch.c: Regenerate.
* or1k/sem.c: Regenerate.
---
Changes since v2:
- Now regenerating for new unordered instructions and documentation.
sim/or1k/arch.c | 2 +- sim/or1k/arch.h | 2 +- sim/or1k/cpu.c | 78 ++- sim/or1k/cpu.h | 174 ++++- sim/or1k/cpuall.h | 2 +- sim/or1k/decode.c | 568 +++++++++++++--- sim/or1k/decode.h | 21 +- sim/or1k/model.c | 1456 ++++++++++++++++++++++++++++++++++------- sim/or1k/sem-switch.c | 602 ++++++++++++++++- sim/or1k/sem.c | 672 ++++++++++++++++++- 10 files changed, 3188 insertions(+), 389 deletions(-)
sim/or1k/arch.c +1 -1
@@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996-2019 Free Software Foundation, Inc. +Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU simulators.
sim/or1k/arch.h +1 -1
@@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996-2019 Free Software Foundation, Inc. +Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU simulators.
sim/or1k/cpu.c +63 -15
118 lines not on this page · raw message
sim/or1k/cpu.h +166 -8
256 lines not on this page · raw message
sim/or1k/cpuall.h +1 -1
@@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996-2019 Free Software Foundation, Inc. +Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU simulators.
sim/or1k/decode.c +478 -90
708 lines not on this page · raw message
sim/or1k/decode.h +15 -6
@@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996-2019 Free Software Foundation, Inc. +Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU simulators.
@@ -60,10 +60,17 @@ typedef enum or1k32bf_insn_type { , OR1K32BF_INSN_L_MACU, OR1K32BF_INSN_L_MSB, OR1K32BF_INSN_L_MSBU, OR1K32BF_INSN_L_CUST1 ,OR1K32BF_INSN_L_CUST2 ,OR1K32BF_INSN_L_CUST3 ,OR1K32BF_INSN_L_CUST4 ,OR1K32BF_INSN_L_CUST5 ,OR1K32BF_INSN_L_CUST6 ,OR1K32BF_INSN_L_CUST7 ,OR1K32BF_INSN_L_CUST8 ,OR1K32BF_INSN_LF_ADD_S - ,OR1K32BF_INSN_LF_SUB_S ,OR1K32BF_INSN_LF_MUL_S ,OR1K32BF_INSN_LF_DIV_S ,OR1K32BF_INSN_LF_REM_S - ,OR1K32BF_INSN_LF_ITOF_S ,OR1K32BF_INSN_LF_FTOI_S ,OR1K32BF_INSN_LF_EQ_S ,OR1K32BF_INSN_LF_NE_S - ,OR1K32BF_INSN_LF_GE_S ,OR1K32BF_INSN_LF_GT_S ,OR1K32BF_INSN_LF_LT_S ,OR1K32BF_INSN_LF_LE_S - ,OR1K32BF_INSN_LF_MADD_S ,OR1K32BF_INSN_LF_CUST1_S ,OR1K32BF_INSN__MAX + ,OR1K32BF_INSN_LF_ADD_D32 ,OR1K32BF_INSN_LF_SUB_S ,OR1K32BF_INSN_LF_SUB_D32 ,OR1K32BF_INSN_LF_MUL_S + ,OR1K32BF_INSN_LF_MUL_D32 ,OR1K32BF_INSN_LF_DIV_S ,OR1K32BF_INSN_LF_DIV_D32 ,OR1K32BF_INSN_LF_REM_S + ,OR1K32BF_INSN_LF_REM_D32 ,OR1K32BF_INSN_LF_ITOF_S ,OR1K32BF_INSN_LF_ITOF_D32 ,OR1K32BF_INSN_LF_FTOI_S + ,OR1K32BF_INSN_LF_FTOI_D32 ,OR1K32BF_INSN_LF_SFEQ_S ,OR1K32BF_INSN_LF_SFEQ_D32 ,OR1K32BF_INSN_LF_SFNE_S + ,OR1K32BF_INSN_LF_SFNE_D32 ,OR1K32BF_INSN_LF_SFGE_S ,OR1K32BF_INSN_LF_SFGE_D32 ,OR1K32BF_INSN_LF_SFGT_S + ,OR1K32BF_INSN_LF_SFGT_D32 ,OR1K32BF_INSN_LF_SFLT_S ,OR1K32BF_INSN_LF_SFLT_D32 ,OR1K32BF_INSN_LF_SFLE_S + ,OR1K32BF_INSN_LF_SFLE_D32 ,OR1K32BF_INSN_LF_SFUEQ_S ,OR1K32BF_INSN_LF_SFUEQ_D32 ,OR1K32BF_INSN_LF_SFUNE_S + ,OR1K32BF_INSN_LF_SFUNE_D32 ,OR1K32BF_INSN_LF_SFUGT_S ,OR1K32BF_INSN_LF_SFUGT_D32 ,OR1K32BF_INSN_LF_SFUGE_S + ,OR1K32BF_INSN_LF_SFUGE_D32 ,OR1K32BF_INSN_LF_SFULT_S ,OR1K32BF_INSN_LF_SFULT_D32 ,OR1K32BF_INSN_LF_SFULE_S + ,OR1K32BF_INSN_LF_SFULE_D32 ,OR1K32BF_INSN_LF_SFUN_S ,OR1K32BF_INSN_LF_SFUN_D32 ,OR1K32BF_INSN_LF_MADD_S + ,OR1K32BF_INSN_LF_MADD_D32 ,OR1K32BF_INSN_LF_CUST1_S ,OR1K32BF_INSN_LF_CUST1_D32 ,OR1K32BF_INSN__MAX } OR1K32BF_INSN_TYPE;/* Enum declaration for semantic formats in cpu family or1k32bf. */
@@ -80,7 +87,9 @@ typedef enum or1k32bf_sfmt_type { , OR1K32BF_SFMT_L_XORI, OR1K32BF_SFMT_L_ADDI, OR1K32BF_SFMT_L_ADDIC, OR1K32BF_SFMT_L_MULI ,OR1K32BF_SFMT_L_EXTHS ,OR1K32BF_SFMT_L_CMOV ,OR1K32BF_SFMT_L_SFGTS ,OR1K32BF_SFMT_L_SFGTSI ,OR1K32BF_SFMT_L_MAC ,OR1K32BF_SFMT_L_MACI ,OR1K32BF_SFMT_L_MACU ,OR1K32BF_SFMT_LF_ADD_S - ,OR1K32BF_SFMT_LF_ITOF_S ,OR1K32BF_SFMT_LF_FTOI_S ,OR1K32BF_SFMT_LF_EQ_S ,OR1K32BF_SFMT_LF_MADD_S + ,OR1K32BF_SFMT_LF_ADD_D32 ,OR1K32BF_SFMT_LF_ITOF_S ,OR1K32BF_SFMT_LF_ITOF_D32 ,OR1K32BF_SFMT_LF_FTOI_S + ,OR1K32BF_SFMT_LF_FTOI_D32 ,OR1K32BF_SFMT_LF_SFEQ_S ,OR1K32BF_SFMT_LF_SFEQ_D32 ,OR1K32BF_SFMT_LF_MADD_S + ,OR1K32BF_SFMT_LF_MADD_D32 } OR1K32BF_SFMT_TYPE;/* Function unit handlers (user written). */
sim/or1k/model.c +1221 -235
1,855 lines not on this page · raw message
sim/or1k/sem-switch.c +589 -13
602 lines not on this page · raw message
sim/or1k/sem.c +653 -19
672 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0
Part of the diff is not shown here. View the raw message.
PATCH v3 7/11 sim/common: Wire in df/di conversion
In reply to Stafford HorneUp until now these have not been used in any CGEN targets, add them as they are now used by OpenRISC.
sim/common/ChangeLog:
* cgen-accfp.c (floatdidf, fixdfdi): New functions. (cgen_init_accurate_fpu): Add floatdidf and fixdfdi.
---
Changes since v2:
- none
sim/common/cgen-accfp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
sim/common/cgen-accfp.c +24 -0
@@ -349,6 +349,17 @@ floatsidf (CGEN_FPU* fpu, int how UNUSED, SI x)return res; } +static DF +floatdidf (CGEN_FPU* fpu, int how UNUSED, DI x) +{ +sim_fpu ans; +unsigned64 res; + +sim_fpu_i64to (&ans, x, sim_fpu_round_near); +sim_fpu_to64 (&res, &ans); +return res; +} +static SF ufloatsisf (CGEN_FPU* fpu, int how UNUSED, USI x) {
@@ -382,6 +393,17 @@ fixdfsi (CGEN_FPU* fpu, int how UNUSED, DF x)return res; } +static DI +fixdfdi (CGEN_FPU* fpu, int how UNUSED, DF x) +{ +sim_fpu op1; +unsigned64 res; + +sim_fpu_64to (&op1, x); +sim_fpu_to64i (&res, &op1, sim_fpu_round_near); +return res; +} +static USI ufixsfsi (CGEN_FPU* fpu, int how UNUSED, SF x) {
@@ -739,8 +761,10 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error) o->ftruncdfsf = ftruncdfsf; o->floatsisf = floatsisf; o->floatsidf = floatsidf; + o->floatdidf = floatdidf; o->ufloatsisf = ufloatsisf; o->fixsfsi = fixsfsi; o->fixdfsi = fixdfsi; + o->fixdfdi = fixdfdi; o->ufixsfsi = ufixsfsi; }
Signature · 1 line
2.21.0
PATCH v3 8/11 sim/common: wire up new unordered comparisons
In reply to Stafford HorneDefine and wire up unordered floating point comparison operations for cgen targets. This patch depends on my posted cgen patches[0].
[0] https://www.sourceware.org/ml/cgen/2019-q2/msg00013.html
sim/common/ChangeLog:
yyyy-mm-dd Stafford Horne <[email protected]>
* cgen-accfp.c (unorderedsf, unordereddf): New functions. (cgen_init_accurate_fpu): Wire up unorderedsf and unordereddf.
* cgen-fpu.h (cgen_fp_ops): Define fields unorderedsf and unordereddf.
---
Changes from v2:
- new patch
sim/common/cgen-accfp.c | 25 +++++++++++++++++++++++++ sim/common/cgen-fpu.h | 2 ++ 2 files changed, 27 insertions(+)
sim/common/cgen-accfp.c +25 -0
@@ -303,6 +303,18 @@ gesf (CGEN_FPU* fpu, SF x, SF y)return sim_fpu_is_ge (&op1, &op2); } +static int +unorderedsf (CGEN_FPU * fpu,SF x,SF y) +{ +sim_fpu op1; +sim_fpu op2; + +sim_fpu_32to (&op1, x); +sim_fpu_32to (&op2, y); +return sim_fpu_is_nan (&op1) ||sim_fpu_is_nan (&op2); +} + +static DF fextsfdf (CGEN_FPU* fpu, int how UNUSED, SF x) {
@@ -703,6 +715,17 @@ gedf (CGEN_FPU* fpu, DF x, DF y)sim_fpu_64to (&op2, y);return sim_fpu_is_ge (&op1, &op2); } + +static int +unordereddf (CGEN_FPU * fpu,DF x,DF y) +{ +sim_fpu op1; +sim_fpu op2; + +sim_fpu_64to (&op1, x); +sim_fpu_64to (&op2, y); +return sim_fpu_is_nan (&op1) ||sim_fpu_is_nan (&op2); +}/* Initialize FP_OPS to use accurate library. */
@@ -738,6 +761,7 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error) o->lesf = lesf; o->gtsf = gtsf; o->gesf = gesf; + o->unorderedsf = unorderedsf; o->adddf = adddf; o->subdf = subdf;
@@ -757,6 +781,7 @@ cgen_init_accurate_fpu (SIM_CPU* cpu, CGEN_FPU* fpu, CGEN_FPU_ERROR_FN* error) o->ledf = ledf; o->gtdf = gtdf; o->gedf = gedf; + o->unordereddf = unordereddf; o->fextsfdf = fextsfdf; o->ftruncdfsf = ftruncdfsf; o->floatsisf = floatsisf;
sim/common/cgen-fpu.h +2 -0
@@ -87,6 +87,7 @@ struct cgen_fp_ops {int (*lesf) (CGEN_FPU *,SF ,SF );int (*gtsf) (CGEN_FPU *,SF ,SF );int (*gesf) (CGEN_FPU *,SF ,SF ); +int (*unorderedsf) (CGEN_FPU *,SF ,SF );/* basic DF ops */
@@ -112,6 +113,7 @@ struct cgen_fp_ops {int (*ledf) (CGEN_FPU *,DF ,DF );int (*gtdf) (CGEN_FPU *,DF ,DF );int (*gedf) (CGEN_FPU *,DF ,DF ); +int (*unordereddf) (CGEN_FPU *,DF ,DF );/* SF/DF conversion ops */
Signature · 1 line
2.21.0
PATCH v3 9/11 sim/testsuite/or1k: Add test for 64-bit fpu operations
In reply to Stafford HorneThis is a very basic test but it ensure the machine is wired up correctly and that the assembler works.
sim/testsuite/sim/or1k/ChangeLog:
yyyy-mm-dd Stafford Horne <[email protected]>
* fpu64a32.S: New file.
---
Changes from v2:
- use explicit register pairs.
sim/testsuite/sim/or1k/fpu64a32.S | 172 ++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 sim/testsuite/sim/or1k/fpu64a32.S
sim/testsuite/sim/or1k/fpu64a32.S new file +172 -0
@@ -0,0 +1,172 @@ +/* Tests some basic fpu instructions. + + Copyright (C) 2017-2019 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +# mach: or1k +# output: report(0x400921f9);\n +# output: report(0xf01b866e);\n +# output: report(0x4005bf09);\n +# output: report(0x95aaf790);\n +# output: report(0x00000000);\n +# output: report(0x00001234);\n +# output: \n +# output: report(0x40b23400);\n +# output: report(0x00000000);\n +# output: report(0x40b23400);\n +# output: report(0x00000000);\n +# output: \n +# output: report(0x40177081);\n +# output: report(0xc2e33eff);\n +# output: report(0x400921f9);\n +# output: report(0xf01b866e);\n +# output: \n +# output: report(0x40211456);\n +# output: report(0x587dfabf);\n +# output: report(0x400921f9);\n +# output: report(0xf01b866d);\n +# output: \n +# output: report(0x00000001);\n +# output: \n +# output: WARNING: ignoring fpu error caught in fast mode.\n +# output: report(0x00000000);\n +# output: \n +# output: exit(0)\n + +#include "or1k-asm-test-helpers.h" + + STANDARD_TEST_ENVIRONMENT + + .section .exception_vectors + + /* Floating point exception. */ + .org 0xd00 + + /* The handling is a bit dubious at present. We just patch the + instruction with l.nop and restart. This will go wrong in branch + delay slots. But we don't have those in this test. */ + l.addi r1, r1, -EXCEPTION_STACK_SKIP_SIZE + PUSH r2 + PUSH r3 + /* Save the address of the instruction that caused the problem. */ + MOVE_FROM_SPR r2, SPR_EPCR_BASE + LOAD_IMMEDIATE r3, 0x15000000 /* Opcode for l.nop */ + l.sw -4(r2), r3 + POP r3 + POP r2 + l.addi r1, r1, EXCEPTION_STACK_SKIP_SIZE + l.rfe + + .section .data + .align 4 + .type pi, @object + .size pi, 8 +anchor: +pi: + .double 3.14159 + + .type e, @object + .size e, 8 +e: + .double 2.71828 + + .type large, @object + .size large, 8 +large: + .long 0 + .long 0x1234 + + .section .text +start_tests: + PUSH LINK_REGISTER_R9 + + /* Test lf.itof.d int to double conversion. Setting up: + * r11 pointer to data + * r12,r13 pi as double + * r14,r15 e as double + * r16,r17 a long long + */ + l.ori r11, r0, ha(anchor) + l.addi r11, r11, lo(anchor) + l.lwz r12, 0(r11) + l.lwz r13, 4(r11) + + l.lwz r14, 8(r11) + l.lwz r15, 12(r11) + + l.lwz r16, 16(r11) + l.lwz r18, 20(r11) + + /* Output to ensure we loaded it correctly. */ + REPORT_REG_TO_CONSOLE r12 + REPORT_REG_TO_CONSOLE r13 + + REPORT_REG_TO_CONSOLE r14 + REPORT_REG_TO_CONSOLE r15 + + REPORT_REG_TO_CONSOLE r16 + REPORT_REG_TO_CONSOLE r18 + PRINT_NEWLINE_TO_CONSOLE + + /* Convert the big long to a double. */ + lf.itof.d r16,r18, r16,r18 + REPORT_REG_TO_CONSOLE r16 + REPORT_REG_TO_CONSOLE r18 + + /* Convert the double back to a long, it should match before. */ + lf.ftoi.d r16,r18, r16,r18 + lf.itof.d r16,r18, r16,r18 + + REPORT_REG_TO_CONSOLE r16 + REPORT_REG_TO_CONSOLE r18 + + PRINT_NEWLINE_TO_CONSOLE + + /* Add and subtract some double values. */ + lf.add.d r12,r13, r12,r13, r14,r15 + REPORT_REG_TO_CONSOLE r12 + REPORT_REG_TO_CONSOLE r13 + + lf.sub.d r12,r13, r12,r13, r14,r15 + REPORT_REG_TO_CONSOLE r12 + REPORT_REG_TO_CONSOLE r13 + PRINT_NEWLINE_TO_CONSOLE + + /* Multiply and divide double values. */ + lf.mul.d r12,r13, r12,r13, r14,r15 + REPORT_REG_TO_CONSOLE r12 + REPORT_REG_TO_CONSOLE r13 + + lf.div.d r12,r13, r12,r13, r14,r15 + REPORT_REG_TO_CONSOLE r12 + REPORT_REG_TO_CONSOLE r13 + PRINT_NEWLINE_TO_CONSOLE + + /* Test lf.sfge.s set flag if r6 >= r10. */ + lf.sfge.d r12,r13, r14,r15 + MOVE_FROM_SPR r2, SPR_SR + REPORT_BIT_TO_CONSOLE r2, SPR_SR_F + PRINT_NEWLINE_TO_CONSOLE + + /* Test raising an exception by dividing by 0. */ + MOVE_FROM_SPR r2, SPR_FPCSR + l.ori r2, r2, 0x1 + MOVE_TO_SPR SPR_FPCSR, r2 +div0: lf.div.d r2,r3, r12,r13, r0,r1 + REPORT_EXCEPTION div0 + PRINT_NEWLINE_TO_CONSOLE + + POP LINK_REGISTER_R9 + RETURN_TO_LINK_REGISTER_R9
Signature · 1 line
2.21.0
v3 cover OpenRISC orfpx64a32 and openrisc spec 1.3 support
In reply to Stafford HorneHi Stafford,
Quoted 3 lines
Its been a while since v2, but we have been busy changing direction a bit. Instead of just adding the orfpx64a32 extension support we have created a new architecture specification [0] and this series includes some of those changes.
I am just starting to look at this patch series, but I need to check one thing first. The number suggests that there should be 11 patches, but I see only 9. Are two missing, or is the numbering wrong ?
Cheers
Nick
v3 cover OpenRISC orfpx64a32 and openrisc spec 1.3 support
Quoted 9 lines · Nick Clifton
Hi Stafford,
Quoted 3 lines
Its been a while since v2, but we have been busy changing direction a bit. Instead of just adding the orfpx64a32 extension support we have created a new architecture specification [0] and this series includes some of those changes.
I am just starting to look at this patch series, but I need to check one thing first. The number suggests that there should be 11 patches, but I see only 9. Are two missing, or is the numbering wrong ?
Hello,
Thanks for having a look. Sorry, 2 were missing I just sent them.
-Stafford
v3 cover OpenRISC orfpx64a32 and openrisc spec 1.3 support
In reply to Stafford HorneHi Stafford,
Quoted 3 lines
Its been a while since v2, but we have been busy changing direction a bit. Instead of just adding the orfpx64a32 extension support we have created a new architecture specification [0] and this series includes some of those changes.
The binutils parts of the patch series are approved - please apply.
Cheers
Nick
v3 cover OpenRISC orfpx64a32 and openrisc spec 1.3 support
Quoted 7 lines · Nick Clifton
Hi Stafford,
Quoted 3 lines
Its been a while since v2, but we have been busy changing direction a bit. Instead of just adding the orfpx64a32 extension support we have created a new architecture specification [0] and this series includes some of those changes.
The binutils parts of the patch series are approved - please apply.
Thanks for the review,
I will apply once I get the go ahead on the cgen patches.
-Stafford
v3 cover OpenRISC orfpx64a32 and openrisc spec 1.3 support
Quoted 8 lines · Stafford Horne
Quoted 6 lines · Nick Clifton
Hi Stafford,
Quoted 3 lines
Its been a while since v2, but we have been busy changing direction a bit. Instead of just adding the orfpx64a32 extension support we have created a new architecture specification [0] and this series includes some of those changes.
Quoted 5 lines
Quoted 1 line
The binutils parts of the patch series are approved - please apply.
Thanks for the review,
I will apply once I get the go ahead on the cgen patches.
Note, the cgen changes were applied in cgen. The binutils portion has been applied
now.
Thanks,
-Stafford