0002-or1k-32bithost-1.diff 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. From: Stafford Horne <[email protected]>
  2. To: GNU Binutils <[email protected]>
  3. Cc: Openrisc <[email protected]>, [email protected], Stafford Horne <[email protected]>
  4. Subject: [PATCH 1/2] or1k: Remove 64-bit support, it's not used and it breaks 32-bit hosts
  5. Date: Wed, 11 Dec 2019 06:49:05 +0900
  6. Reported by Rich Felker when building on 32-bit hosts. Backwards jump
  7. negative offsets were not calculated correctly due to improper 32-bit
  8. to 64-bit zero-extension. The 64-bit fields are present because we
  9. are mixing 32-bit and 64-bit architectures in our cpu descriptions.
  10. Removing 64-bit fixes the issue. We don't use 64-bit, there is an architecture
  11. spec for 64-bit but no implementations or simulators. My thought is if
  12. we need them in the future we should do the proper work to support both
  13. 32-bit and 64-bit implementations co-existing then.
  14. cpu/ChangeLog:
  15. yyyy-mm-dd Stafford Horne <[email protected]>
  16. PR 25184
  17. * or1k.cpu (arch or1k): Remove or64 and or64nd machs.
  18. (ORBIS-MACHS, ORFPX32-MACHS): Remove pmacros.
  19. (cpu or1k64bf, mach or64, mach or64nd): Remove definitions.
  20. * or1kcommon.cpu (h-fdr): Remove hardware.
  21. * or1korfpx.cpu (rDDF, rADF, rBDF): Remove operand definitions.
  22. (float-regreg-insn): Remove lf- mnemonic -d instruction pattern.
  23. (float-setflag-insn-base): Remove lf-sf mnemonic -d pattern.
  24. (float-cust-insn): Remove "lf-cust" cust-num "-d" pattern.
  25. (lf-rem-d, lf-itof-d, lf-ftoi-d, lf-madd-d): Remove.
  26. ---
  27. cpu/or1k.cpu | 35 +++----------------------
  28. cpu/or1kcommon.cpu | 14 ----------
  29. cpu/or1korfpx.cpu | 64 ----------------------------------------------
  30. 3 files changed, 3 insertions(+), 110 deletions(-)
  31. diff --git a/cpu/or1k.cpu b/cpu/or1k.cpu
  32. index b796862d1b..9784f7a0fa 100644
  33. --- a/cpu/or1k.cpu
  34. +++ b/cpu/or1k.cpu
  35. @@ -31,7 +31,7 @@
  36. (comment "OpenRISC 1000")
  37. (default-alignment aligned)
  38. (insn-lsb0? #t)
  39. - (machs or32 or32nd or64 or64nd)
  40. + (machs or32 or32nd)
  41. (isas openrisc)
  42. )
  43. @@ -44,10 +44,8 @@
  44. )
  45. (define-pmacro OR32-MACHS or32,or32nd)
  46. -(define-pmacro OR64-MACHS or64,or64nd)
  47. -(define-pmacro ORBIS-MACHS or32,or32nd,or64,or64nd)
  48. -(define-pmacro ORFPX32-MACHS or32,or32nd,or64,or64nd)
  49. -(define-pmacro ORFPX64-MACHS or64,or64nd)
  50. +(define-pmacro ORBIS-MACHS or32,or32nd)
  51. +(define-pmacro ORFPX32-MACHS or32,or32nd)
  52. (define-pmacro ORFPX64A32-MACHS or32,or32nd) ; float64 for 32-bit machs
  53. (define-attr
  54. @@ -100,33 +98,6 @@
  55. )
  56. )
  57. -(if (keep-mach? (or64 or64nd))
  58. - (begin
  59. - (define-cpu
  60. - (name or1k64bf)
  61. - (comment "OpenRISC 1000 64-bit CPU family")
  62. - (insn-endian big)
  63. - (data-endian big)
  64. - (word-bitsize 64)
  65. - (file-transform "64")
  66. - )
  67. -
  68. - (define-mach
  69. - (name or64)
  70. - (comment "Generic OpenRISC 1000 64-bit CPU")
  71. - (cpu or1k64bf)
  72. - (bfd-name "or1k64")
  73. - )
  74. -
  75. - (define-mach
  76. - (name or64nd)
  77. - (comment "Generic OpenRISC 1000 ND 64-bit CPU with no branch delay slot")
  78. - (cpu or1k64bf)
  79. - (bfd-name "or1k64nd")
  80. - )
  81. - )
  82. - )
  83. -
  84. (include "or1kcommon.cpu")
  85. (include "or1korbis.cpu")
  86. (include "or1korfpx.cpu")
  87. diff --git a/cpu/or1kcommon.cpu b/cpu/or1kcommon.cpu
  88. index 65154407df..9f102c93a1 100644
  89. --- a/cpu/or1kcommon.cpu
  90. +++ b/cpu/or1kcommon.cpu
  91. @@ -114,20 +114,6 @@
  92. (set (index newval) (set UWI (reg h-gpr index) (zext UWI (subword SI newval 0))))
  93. )
  94. -;
  95. -; Hardware: virtual registerts for FPU (double precision)
  96. -; mapped to GPRs
  97. -;
  98. -(define-hardware
  99. - (name h-fdr)
  100. - (comment "or64 floating point registers (double, virtual)")
  101. - (attrs VIRTUAL (MACH ORFPX64-MACHS))
  102. - (type register DF (32))
  103. - (indices keyword "" REG-INDICES)
  104. - (get (index) (subword DF (trunc DI (reg h-gpr index)) 0))
  105. - (set (index newval) (set UDI (reg h-gpr index) (zext UDI (subword DI newval 0))))
  106. - )
  107. -
  108. ;
  109. ; Register pairs are offset by 2 for registers r16 and above. This is to
  110. ; be able to allow registers to be call saved in GCC across function calls.
  111. diff --git a/cpu/or1korfpx.cpu b/cpu/or1korfpx.cpu
  112. index f43522f2e6..0bd469cff5 100644
  113. --- a/cpu/or1korfpx.cpu
  114. +++ b/cpu/or1korfpx.cpu
  115. @@ -84,10 +84,6 @@
  116. (dnop rASF "source register A (single floating point mode)" ((MACH ORFPX32-MACHS)) h-fsr f-r2)
  117. (dnop rBSF "source register B (single floating point mode)" ((MACH ORFPX32-MACHS)) h-fsr f-r3)
  118. -(dnop rDDF "or64 destination register (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r1)
  119. -(dnop rADF "or64 source register A (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r2)
  120. -(dnop rBDF "or64 source register B (double floating point mode)" ((MACH ORFPX64-MACHS)) h-fdr f-r3)
  121. -
  122. (define-pmacro (double-field-and-ops mnemonic reg offbit op-comment)
  123. (begin
  124. (define-multi-ifield
  125. @@ -152,14 +148,6 @@
  126. (set SF rDSF (mnemonic SF rASF rBSF))
  127. ()
  128. )
  129. - (dni (.sym lf- mnemonic -d)
  130. - (.str "lf." mnemonic ".d reg/reg/reg")
  131. - ((MACH ORFPX64-MACHS))
  132. - (.str "lf." mnemonic ".d $rDDF,$rADF,$rBDF")
  133. - (+ OPC_FLOAT rDDF rADF rBDF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_ (.upcase mnemonic) _D))
  134. - (set DF rDDF (mnemonic DF rADF rBDF))
  135. - ()
  136. - )
  137. (dni (.sym lf- mnemonic -d32)
  138. (.str "lf." mnemonic ".d regpair/regpair/regpair")
  139. ((MACH ORFPX64A32-MACHS))
  140. @@ -185,15 +173,6 @@
  141. ()
  142. )
  143. -(dni lf-rem-d
  144. - "lf.rem.d reg/reg/reg"
  145. - ((MACH ORFPX64-MACHS))
  146. - "lf.rem.d $rDDF,$rADF,$rBDF"
  147. - (+ OPC_FLOAT rDDF rADF rBDF (f-resv-10-3 0) OPC_FLOAT_REGREG_REM_D)
  148. - (set DF rDDF (rem DF rADF rBDF))
  149. - ()
  150. - )
  151. -
  152. (dni lf-rem-d32
  153. "lf.rem.d regpair/regpair/regpair"
  154. ((MACH ORFPX64A32-MACHS))
  155. @@ -221,15 +200,6 @@
  156. ()
  157. )
  158. -(dni lf-itof-d
  159. - "lf.itof.d reg/reg"
  160. - ((MACH ORFPX64-MACHS))
  161. - "lf.itof.d $rDDF,$rA"
  162. - (+ OPC_FLOAT rDDF rA (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_ITOF_D)
  163. - (set DF rDDF (float DF (get-rounding-mode) rA))
  164. - ()
  165. - )
  166. -
  167. (dni lf-itof-d32
  168. "lf.itof.d regpair/regpair"
  169. ((MACH ORFPX64A32-MACHS))
  170. @@ -248,15 +218,6 @@
  171. ()
  172. )
  173. -(dni lf-ftoi-d
  174. - "lf.ftoi.d reg/reg"
  175. - ((MACH ORFPX64-MACHS))
  176. - "lf.ftoi.d $rD,$rADF"
  177. - (+ OPC_FLOAT rD rADF (f-r3 0) (f-resv-10-3 0) OPC_FLOAT_REGREG_FTOI_D)
  178. - (set WI rD (fix WI (get-rounding-mode) rADF))
  179. - ()
  180. - )
  181. -
  182. (dni lf-ftoi-d32
  183. "lf.ftoi.d regpair/regpair"
  184. ((MACH ORFPX64A32-MACHS))
  185. @@ -276,14 +237,6 @@
  186. (symantics rtx-mnemonic SF rASF rBSF)
  187. ()
  188. )
  189. - (dni (.sym lf-sf mnemonic -d)
  190. - (.str "lf.sf" mnemonic ".d reg/reg")
  191. - ((MACH ORFPX64-MACHS))
  192. - (.str "lf.sf" mnemonic ".d $rADF,$rBDF")
  193. - (+ OPC_FLOAT (f-r1 0) rADF rBDF (f-resv-10-3 0) (.sym OPC_FLOAT_REGREG_SF (.upcase mnemonic) _D))
  194. - (symantics rtx-mnemonic DF rADF rBDF)
  195. - ()
  196. - )
  197. (dni (.sym lf-sf mnemonic -d32)
  198. (.str "lf.sf" mnemonic ".d regpair/regpair")
  199. ((MACH ORFPX64A32-MACHS))
  200. @@ -336,15 +289,6 @@
  201. ()
  202. )
  203. -(dni lf-madd-d
  204. - "lf.madd.d reg/reg/reg"
  205. - ((MACH ORFPX64-MACHS))
  206. - "lf.madd.d $rDDF,$rADF,$rBDF"
  207. - (+ OPC_FLOAT rDDF rADF rBDF (f-resv-10-3 0) OPC_FLOAT_REGREG_MADD_D)
  208. - (set DF rDDF (add DF (mul DF rADF rBDF) rDDF))
  209. - ()
  210. - )
  211. -
  212. (dni lf-madd-d32
  213. "lf.madd.d regpair/regpair/regpair"
  214. ((MACH ORFPX64A32-MACHS))
  215. @@ -364,14 +308,6 @@
  216. (nop)
  217. ()
  218. )
  219. - (dni (.sym "lf-cust" cust-num "-d")
  220. - (.str "lf.cust" cust-num ".d")
  221. - ((MACH ORFPX64-MACHS))
  222. - (.str "lf.cust" cust-num ".d")
  223. - (+ OPC_FLOAT (f-resv-25-5 0) rADF rBDF (f-resv-10-3 0) (.sym "OPC_FLOAT_REGREG_CUST" cust-num "_D"))
  224. - (nop)
  225. - ()
  226. - )
  227. (dni (.sym "lf-cust" cust-num "-d32")
  228. (.str "lf.cust" cust-num ".d")
  229. ((MACH ORFPX64A32-MACHS))
  230. --
  231. 2.21.0