NS32K.README 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. Copyright (C) 1987 Free Software Foundation, Inc.
  2. Contributed by Michael Tiemann (tiemann@mcc.com)
  3. This file is part of GNU CC.
  4. GNU CC is distributed in the hope that it will be useful,
  5. but WITHOUT ANY WARRANTY. No author or distributor
  6. accepts responsibility to anyone for the consequences of using it
  7. or for whether it serves any particular purpose or works at all,
  8. unless he says so in writing. Refer to the GNU CC General Public
  9. License for full details.
  10. Everyone is granted permission to copy, modify and redistribute
  11. GNU CC, but only under the conditions described in the
  12. GNU CC General Public License. A copy of this license is
  13. supposed to have been given to you along with GNU CC so you
  14. can know your rights and responsibilities. It should be in a
  15. file named COPYING. Among other things, the copyright notice
  16. and this notice must be preserved on all copies.
  17. This file describes the implementation notes of the GNU C Compiler for
  18. the National Semiconductor 32032 chip (and 32000 family).
  19. The 32032 machine description and configuration file for this compiler
  20. is, for NS32000 family machine, primarily machine independent.
  21. However, since this release still depends on vendor-supplied
  22. assemblers and linkers, the compiler must obey the existing
  23. conventions of the actual machine to which this compiler is targeted.
  24. In this case, the actual machine which this compiler was targeted to
  25. is a Sequent Balance 8000, running DYNIX 2.1.
  26. The assembler for DYNIX 2.1 (and DYNIX 3.0, alas) does not cope with
  27. the full generality of the addressing mode REGISTER RELATIVE.
  28. Specifically, it generates incorrect code for operands of the
  29. following form:
  30. sym(rn)
  31. Where `rn' is one of the general registers. Correct code is generated
  32. for operands of the form
  33. sym(pn)
  34. where `pn' is one of the special processor registers (sb, fp, or sp).
  35. An equivalent operand can be generated by the form
  36. sym[rn:b]
  37. although this addressing mode is about twice as slow on the 32032.
  38. The more efficient addressing mode is controlled by defining the
  39. constant SEQUENT_HAS_FIXED_THEIR_BUG to 1. It is currently defined to
  40. be 0.
  41. Another bug in the assembler makes it impossible to compute with
  42. explicit addresses. In order to compute with a symbolic address, it
  43. is necessary to load that address into a register using the "addr"
  44. instruction. For example, it is not possible to say
  45. cmpd _p,@_x
  46. Rather one must say
  47. addr _x,rn
  48. cmpd _p,rn
  49. The ns32032 chip has a number of known bugs. Any attempt to make the
  50. compiler unaware of these deficiencies will surely bring disaster.
  51. The current list of know bugs are as follows (list provided by Richard
  52. Stallman):
  53. 1) instructions with two overlapping operands in memory
  54. (unlikely in C code, perhaps impossible).
  55. 2) floating point conversion instructions with constant
  56. operands (these may never happen, but I'm not certain).
  57. 3) operands crossing a page boundary. These can be prevented
  58. by setting the flag in tm.h that requires strict alignment.
  59. 4) Scaled indexing in an insn following an insn that has a read-write
  60. operand in memory. This can be prevented by placing a no-op in
  61. between. I, Michael Tiemann, do not understand what exactly is meant
  62. by `read-write operand in memory'. If this is refering to the special
  63. TOS mode, for example "addd 5,tos" then one need not fear, since this
  64. will never be generated. However, is this includes "addd 5,-4(fp)"
  65. then there is room for disaster. The Sequent compiler does not insert
  66. a no-op for code involving the latter, and I have been informed that
  67. Sequent is aware of this list of bugs, so I must assume that it is not
  68. a problem.
  69. 5) The 32032 cannot shift by 32 bits. It shifts modulo the word size
  70. of the operand. Therefore, for 32-bit operations, 32-bit shifts are
  71. interpreted as zero bit shifts. 32-bit shifts have been removed from
  72. the compiler, but future hackers must be careful not to reintroduce
  73. them.
  74. 6) The ns32032 is a very slow chip; however, some instructions are
  75. still very much slower than one might expect. For example, it is
  76. almost always faster to double a quantity by adding it to itself than
  77. by shifting it by one, even if that quantity is deep in memory. The
  78. MOVM instruction has a 20-cycle setup time, after which it moves data
  79. at about the speed that normal moves would. It is also faster to use
  80. address generation instructions than shift instructions for left
  81. shifts less than 4. I do not claim that I generate optimal code for all
  82. given patterns, but where I did escape from National's "clean
  83. architecture", I did so because the timing specification from the data
  84. book says that I will win if I do. I suppose this is called the
  85. "performance gap".
  86. Signed bitfield extraction has not been implemented. It is not
  87. provided by the NS32032, and while it is most certainly possible to do
  88. better than the standard shift-left/shift-right sequence, it is also
  89. quite hairy. Also, since signed bitfields do not yet exist in C, this
  90. omission seems relatively harmless.
  91. Zero extractions could be better implemented if it were possible in
  92. GCC to provide sized zero extractions: i.e. a byte zero extraction
  93. would be allowed to yield a byte result. The current implementation
  94. of GCC manifests 68000-ist thinking, where bitfields are extracted
  95. into a register, and automatically sign/zero extended to fill the
  96. register. See comments in ns32k.md around the "extzv" insn for more
  97. details.
  98. It should be noted that while the NS32000 family was designed to
  99. provide odd-aligned addressing capability for multi-byte data (also
  100. provided by the 68020, but not by the 68000 or 68010), many machines
  101. do not opt to take advantage of this. For example, on the sequent,
  102. although there is no advantage to long-word aligning word data, shorts
  103. must be int-aligned in structs. This is an example of another
  104. machine-specific machine dependency.
  105. Because the ns32032 is has a coherent byte-order/bit-order
  106. architecture, many instructions which would be different for
  107. 68000-style machines, fold into the same instruction for the 32032.
  108. The classic case is push effective address, where it does not matter
  109. whether one is pushing a long, word, or byte address. They all will
  110. push the same address.
  111. The macro FUNCTION_VALUE_REGNO_P is probably not sufficient, what is
  112. needed is FUNCTION_VALUE_P, which also takes a MODE parameter. In
  113. this way it will be possible to determine more exactly whether a
  114. register is really a function value register, or just one that happens
  115. to look right.