Skip to contentSkip to conversation

OpenRISC Remove 64-bit support to fit 32-bit hosts (PR 25184)

PATCH New Stafford Horne 1 participant 4 messages Dec 10, 2019 – Dec 11, 2019

lore
Share & tools
lore
#0 lore raw

cover OpenRISC Remove 64-bit support to fit 32-bit hosts (PR 25184)

The issue was reported by Rich Felker, OpenRISC gas fails to calculate negative offsets when running on 32-bit hosts. I traced this back to having 64-bit address space support in the CPU definitions. It seems we could fix this by either adding some fixes for cgen to support this case or by adding some custom C to do the jump offset calculations.

However, realizing that OpenRISC 64-bit support is not tested, not used and no hardware or simulators exist I am deciding removing it is easiest.

Stafford Horne (2):
or1k: Remove 64-bit support, it's not used and it breaks 32-bit hosts
or1k: Regnerate opcode files after removing 64-bit support

 cpu/or1k.cpu          |   35 +-
 cpu/or1kcommon.cpu    |   14 -
 cpu/or1korfpx.cpu     |   64 --
 opcodes/or1k-asm.c    |    9 -
 opcodes/or1k-desc.c   | 1811 +++++++++++++++++++----------------------
 opcodes/or1k-desc.h   |  332 ++++----
 opcodes/or1k-dis.c    |    9 -
 opcodes/or1k-ibld.c   |   60 +-
 opcodes/or1k-opc.c    |  152 ----
 opcodes/or1k-opc.h    |   28 +-
 opcodes/or1k-opinst.c |  428 +++++-----
 11 files changed, 1185 insertions(+), 1757 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 or1k: Remove 64-bit support, it's not used and it breaks 32-bit hosts

Reported by Rich Felker when building on 32-bit hosts. Backwards jump negative offsets were not calculated correctly due to improper 32-bit to 64-bit zero-extension. The 64-bit fields are present because we are mixing 32-bit and 64-bit architectures in our cpu descriptions.

Removing 64-bit fixes the issue. We don't use 64-bit, there is an architecture spec for 64-bit but no implementations or simulators. My thought is if we need them in the future we should do the proper work to support both 32-bit and 64-bit implementations co-existing then.

cpu/ChangeLog:

yyyy-mm-dd Stafford Horne <[email protected]>

PR 25184
* or1k.cpu (arch or1k): Remove or64 and or64nd machs. (ORBIS-MACHS, ORFPX32-MACHS): Remove pmacros.
(cpu or1k64bf, mach or64, mach or64nd): Remove definitions.
* or1kcommon.cpu (h-fdr): Remove hardware.
* or1korfpx.cpu (rDDF, rADF, rBDF): Remove operand definitions. (float-regreg-insn): Remove lf- mnemonic -d instruction pattern. (float-setflag-insn-base): Remove lf-sf mnemonic -d pattern. (float-cust-insn): Remove "lf-cust" cust-num "-d" pattern. (lf-rem-d, lf-itof-d, lf-ftoi-d, lf-madd-d): Remove.

---
 cpu/or1k.cpu       | 35 +++----------------------
 cpu/or1kcommon.cpu | 14 ----------
 cpu/or1korfpx.cpu  | 64 ----------------------------------------------
 3 files changed, 3 insertions(+), 110 deletions(-)
cpu/or1k.cpu +3 -32
index b796862d1b..9784f7a0fa 100644
@@ -31,7 +31,7 @@
   (comment "OpenRISC 1000")
   (default-alignment aligned)
   (insn-lsb0? #t)
-  (machs or32 or32nd or64 or64nd)
+  (machs or32 or32nd)
   (isas openrisc)
 )
 
@@ -44,10 +44,8 @@
   )
 
 (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 ORBIS-MACHS      or32,or32nd)
+(define-pmacro ORFPX32-MACHS    or32,or32nd)
 (define-pmacro ORFPX64A32-MACHS or32,or32nd) ; float64 for 32-bit machs
 
 (define-attr
@@ -100,33 +98,6 @@
       )
     )
 
-(if (keep-mach? (or64 or64nd))
-    (begin
-      (define-cpu
-        (name or1k64bf)
-        (comment "OpenRISC 1000 64-bit CPU family")
-        (insn-endian big)
-        (data-endian big)
-        (word-bitsize 64)
-        (file-transform "64")
-        )
-
-      (define-mach
-        (name or64)
-        (comment "Generic OpenRISC 1000 64-bit CPU")
-        (cpu or1k64bf)
-        (bfd-name "or1k64")
-        )
-
-      (define-mach
-        (name or64nd)
-        (comment "Generic OpenRISC 1000 ND 64-bit CPU with no branch delay slot")
-        (cpu or1k64bf)
-        (bfd-name "or1k64nd")
-        )
-      )
-    )
-
 (include "or1kcommon.cpu")
 (include "or1korbis.cpu")
 (include "or1korfpx.cpu")
cpu/or1kcommon.cpu +0 -14
index 65154407df..9f102c93a1 100644
@@ -114,20 +114,6 @@
   (set (index newval) (set UWI (reg h-gpr index) (zext UWI (subword SI newval 0))))
   )
 
-;
-; Hardware: virtual registerts for FPU (double precision)
-;           mapped to GPRs
-;
-(define-hardware
-  (name h-fdr)
-  (comment "or64 floating point registers (double, virtual)")
-  (attrs VIRTUAL (MACH ORFPX64-MACHS))
-  (type register DF (32))
-  (indices keyword "" REG-INDICES)
-  (get (index) (subword DF (trunc DI (reg h-gpr index)) 0))
-  (set (index newval) (set UDI (reg h-gpr index) (zext UDI (subword DI newval 0))))
-  )
-
 ;
 ; Register pairs are offset by 2 for registers r16 and above.  This is to
 ; be able to allow registers to be call saved in GCC across function calls.
cpu/or1korfpx.cpu +0 -64

112 lines not on this page · raw message

Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/2 or1k: Regnerate opcode files after removing 64-bit support

In reply to Stafford Horne

opcodes/ChangeLog:

yyyy-mm-dd Stafford Horne <[email protected]>

* or1k-asm.c: Regenerate.
* or1k-desc.c: Regenerate.
* or1k-desc.h: Regenerate.
* or1k-dis.c: Regenerate.
* or1k-ibld.c: Regenerate.
* or1k-opc.c: Regenerate.
* or1k-opc.h: Regenerate.
* or1k-opinst.c: Regenerate.

---
 opcodes/or1k-asm.c    |    9 -
 opcodes/or1k-desc.c   | 1811 +++++++++++++++++++----------------------
 opcodes/or1k-desc.h   |  332 ++++----
 opcodes/or1k-dis.c    |    9 -
 opcodes/or1k-ibld.c   |   60 +-
 opcodes/or1k-opc.c    |  152 ----
 opcodes/or1k-opc.h    |   28 +-
 opcodes/or1k-opinst.c |  428 +++++-----
 8 files changed, 1182 insertions(+), 1647 deletions(-)
opcodes/or1k-asm.c +0 -9
index 55668afee5..11f25868bb 100644
@@ -519,9 +519,6 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,
     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_r2);
-      break;
     case OR1K_OPERAND_RADI :
       errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RADI, (unsigned long *) (& fields->f_rad32));
       break;
@@ -534,9 +531,6 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,
     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_r3);
-      break;
     case OR1K_OPERAND_RBDI :
       errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RBDI, (unsigned long *) (& fields->f_rbd32));
       break;
@@ -549,9 +543,6 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd,
     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;
opcodes/or1k-desc.c +819 -992

2,454 lines not on this page · raw message

opcodes/or1k-desc.h +164 -168

365 lines not on this page · raw message

opcodes/or1k-dis.c +0 -9
index dce00b3f28..47c0a69843 100644
@@ -123,9 +123,6 @@ or1k_cgen_print_operand (CGEN_CPU_DESC cd,
     case OR1K_OPERAND_RAD32F :
       print_regpair (cd, info, fields->f_rad32, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
       break;
-    case OR1K_OPERAND_RADF :
-      print_keyword (cd, info, & or1k_cgen_opval_h_fdr, fields->f_r2, 0);
-      break;
     case OR1K_OPERAND_RADI :
       print_regpair (cd, info, fields->f_rad32, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
       break;
@@ -138,9 +135,6 @@ or1k_cgen_print_operand (CGEN_CPU_DESC cd,
     case OR1K_OPERAND_RBD32F :
       print_regpair (cd, info, fields->f_rbd32, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
       break;
-    case OR1K_OPERAND_RBDF :
-      print_keyword (cd, info, & or1k_cgen_opval_h_fdr, fields->f_r3, 0);
-      break;
     case OR1K_OPERAND_RBDI :
       print_regpair (cd, info, fields->f_rbd32, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
       break;
@@ -153,9 +147,6 @@ or1k_cgen_print_operand (CGEN_CPU_DESC cd,
     case OR1K_OPERAND_RDD32F :
       print_regpair (cd, info, fields->f_rdd32, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
       break;
-    case OR1K_OPERAND_RDDF :
-      print_keyword (cd, info, & or1k_cgen_opval_h_fdr, fields->f_r1, 0);
-      break;
     case OR1K_OPERAND_RDDI :
       print_regpair (cd, info, fields->f_rdd32, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
       break;
opcodes/or1k-ibld.c +3 -57

127 lines not on this page · raw message

opcodes/or1k-opc.c +0 -152

152 lines not on this page · raw message

opcodes/or1k-opc.h +11 -17
index 2ec4b4b323..0c392274a2 100644

Lines of this file are not shown. View the raw message.

opcodes/or1k-opinst.c +185 -243

428 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.

#3 lore raw

PATCH 2/2 or1k: Regnerate opcode files after removing 64-bit support

Note subject will be updated to spell Regenerate correctly.

-Stafford

Quoted 23 lines · Stafford Horne

opcodes/ChangeLog:

yyyy-mm-dd Stafford Horne <[email protected]>

* or1k-asm.c: Regenerate.
* or1k-desc.c: Regenerate.
* or1k-desc.h: Regenerate.
* or1k-dis.c: Regenerate.
* or1k-ibld.c: Regenerate.
* or1k-opc.c: Regenerate.
* or1k-opc.h: Regenerate.
* or1k-opinst.c: Regenerate.

---
 opcodes/or1k-asm.c    |    9 -
 opcodes/or1k-desc.c   | 1811 +++++++++++++++++++----------------------
 opcodes/or1k-desc.h   |  332 ++++----
 opcodes/or1k-dis.c    |    9 -
 opcodes/or1k-ibld.c   |   60 +-
 opcodes/or1k-opc.c    |  152 ----
 opcodes/or1k-opc.h    |   28 +-
 opcodes/or1k-opinst.c |  428 +++++-----
 8 files changed, 1182 insertions(+), 1647 deletions(-)