s390-modes.def 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /* Definitions of target machine for GNU compiler, for IBM S/390
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. Contributed by Hartmut Penner (hpenner@de.ibm.com) and
  4. Ulrich Weigand (uweigand@de.ibm.com).
  5. This file is part of GCC.
  6. GCC is free software; you can redistribute it and/or modify it under
  7. the terms of the GNU General Public License as published by the Free
  8. Software Foundation; either version 3, or (at your option) any later
  9. version.
  10. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with GCC; see the file COPYING3. If not see
  16. <http://www.gnu.org/licenses/>. */
  17. /* 256-bit integer mode is needed for STACK_SAVEAREA_MODE. */
  18. INT_MODE (OI, 32);
  19. /* Define TFmode to work around reload problem PR 20927. */
  20. FLOAT_MODE (TF, 16, ieee_quad_format);
  21. /* Add any extra modes needed to represent the condition code. */
  22. /*
  23. Condition Codes
  24. Check for zero
  25. CCZ: EQ NE NE NE
  26. CCZ1: EQ NE (CS)
  27. Unsigned compares
  28. CCU: EQ LTU GTU NE (CLG/R, CL/R/Y, CLM/Y, CLI/Y)
  29. CCUR: EQ GTU LTU NE (CLGF/R)
  30. Signed compares
  31. CCS: EQ LT GT UNORDERED (LTGFR, LTGR, LTR, ICM/Y,
  32. LTDBR, LTDR, LTEBR, LTER,
  33. CG/R, C/R/Y, CGHI, CHI,
  34. CDB/R, CD/R, CEB/R, CE/R,
  35. ADB/R, AEB/R, SDB/R, SEB/R,
  36. SRAG, SRA, SRDA)
  37. CCSR: EQ GT LT UNORDERED (CGF/R, CH/Y)
  38. Condition codes resulting from add with overflow
  39. CCA: EQ LT GT Overflow
  40. CCAP: EQ LT GT LT (AGHI, AHI)
  41. CCAN: EQ LT GT GT (AGHI, AHI)
  42. Condition codes of unsigned adds and subs
  43. CCL: EQ NE EQ NE (ALGF/R, ALG/R, AL/R/Y,
  44. ALCG/R, ALC/R,
  45. SLGF/R, SLG/R, SL/R/Y,
  46. SLBG/R, SLB/R)
  47. CCL1: GEU GEU LTU LTU (ALG/R, AL/R/Y)
  48. CCL2: GTU GTU LEU LEU (SLG/R, SL/R/Y)
  49. CCL3: EQ LTU EQ GTU (SLG/R, SL/R/Y)
  50. Test under mask checks
  51. CCT: EQ NE NE NE (ICM/Y, TML, CG/R, CGHI,
  52. C/R/Y, CHI, NG/R, N/R/Y,
  53. OG/R, O/R/Y, XG/R, X/R/Y)
  54. CCT1: NE EQ NE NE (TMH, TML)
  55. CCT2: NE NE EQ NE (TMH, TML)
  56. CCT3: NE NE NE EQ (TMH, TML)
  57. CCA and CCT modes are request only modes. These modes are never returned by
  58. s390_select_cc_mode. They are only intended to match other modes.
  59. Requested mode -> Destination CC register mode
  60. CCS, CCU, CCT, CCSR, CCUR -> CCZ
  61. CCA -> CCAP, CCAN
  62. Vector comparison modes
  63. CCVEQ EQ - - NE (VCEQ)
  64. CCVEQANY EQ EQ - NE (VCEQ)
  65. CCVH GT - - LE (VCH)
  66. CCVHANY GT GT - LE (VCH)
  67. CCVHU GTU - - LEU (VCHL)
  68. CCVHUANY GTU GTU - LEU (VCHL)
  69. CCVFH GT - - UNLE (VFCH)
  70. CCVFHANY GT GT - UNLE (VFCH)
  71. CCVFHE GE - - UNLT (VFCHE)
  72. CCVFHEANY GE GE - UNLT (VFCHE)
  73. *** Comments ***
  74. CCAP, CCAN
  75. The CC obtained from add instruction usually can't be used for comparisons
  76. because its coupling with overflow flag. In case of an overflow the
  77. less than/greater than data are lost. Nevertheless a comparison can be done
  78. whenever immediate values are involved because they are known at compile time.
  79. If you know whether the used constant is positive or negative you can predict
  80. the sign of the result even in case of an overflow.
  81. CCT, CCT1, CCT2, CCT3
  82. If bits of an integer masked with an AND instruction are checked, the test under
  83. mask instructions turn out to be very handy for a set of special cases.
  84. The simple cases are checks whether all masked bits are zero or ones:
  85. int a;
  86. if ((a & (16 + 128)) == 0) -> CCT/CCZ
  87. if ((a & (16 + 128)) == 16 + 128) -> CCT3
  88. Using two extra modes makes it possible to do complete checks on two bits of an
  89. integer (This is possible on register operands only. TM does not provide the
  90. information necessary for CCT1 and CCT2 modes.):
  91. int a;
  92. if ((a & (16 + 128)) == 16) -> CCT1
  93. if ((a & (16 + 128)) == 128) -> CCT2
  94. CCSR, CCUR
  95. There are several instructions comparing 32 bit with 64-bit unsigned/signed
  96. values. Such instructions can be considered to have a builtin zero/sign_extend.
  97. The problem is that in the RTL (to be canonical) the zero/sign extended operand
  98. has to be the first one but the machine instructions like it the other way
  99. around. The following both modes can be considered as CCS and CCU modes with
  100. exchanged operands.
  101. CCL1, CCL2
  102. These modes represent the result of overflow checks.
  103. if (a + b < a) -> CCL1 state of the carry bit (CC2 | CC3)
  104. if (a - b > a) -> CCL2 state of the borrow bit (CC0 | CC1)
  105. They are used when multi word numbers are computed dealing one SImode part after
  106. another or whenever manual overflow checks like the examples above are
  107. compiled.
  108. CCL3
  109. A logical subtract instruction sets the borrow bit in case of an overflow.
  110. The resulting condition code of those instructions is represented by the
  111. CCL3 mode. Together with the CCU mode this mode is used for jumpless
  112. implementations of several if-constructs - see s390_expand_addcc for more
  113. details.
  114. CCZ1
  115. The compare and swap instructions sets the condition code to 0/1 if the
  116. operands were equal/unequal. The CCZ1 mode ensures the result can be
  117. effectively placed into a register.
  118. CCV*
  119. The variants with and without ANY are generated by the same
  120. instructions and therefore are holding the same information. However,
  121. when generating a condition code mask they require checking different
  122. bits of CC. In that case the variants without ANY represent the
  123. results for *all* elements.
  124. CCRAW
  125. The cc mode generated by a non-compare instruction. The condition
  126. code mask for the CC consumer is determined by the comparison operator
  127. (only EQ and NE allowed) and the immediate value given as second
  128. operand to the operator. For the other CC modes this value used to be
  129. 0.
  130. */
  131. CC_MODE (CCZ);
  132. CC_MODE (CCZ1);
  133. CC_MODE (CCA);
  134. CC_MODE (CCAP);
  135. CC_MODE (CCAN);
  136. CC_MODE (CCL);
  137. CC_MODE (CCL1);
  138. CC_MODE (CCL2);
  139. CC_MODE (CCL3);
  140. CC_MODE (CCU);
  141. CC_MODE (CCUR);
  142. CC_MODE (CCS);
  143. CC_MODE (CCSR);
  144. CC_MODE (CCT);
  145. CC_MODE (CCT1);
  146. CC_MODE (CCT2);
  147. CC_MODE (CCT3);
  148. CC_MODE (CCRAW);
  149. CC_MODE (CCVEQ);
  150. CC_MODE (CCVEQANY);
  151. CC_MODE (CCVH);
  152. CC_MODE (CCVHANY);
  153. CC_MODE (CCVHU);
  154. CC_MODE (CCVHUANY);
  155. CC_MODE (CCVFH);
  156. CC_MODE (CCVFHANY);
  157. CC_MODE (CCVFHE);
  158. CC_MODE (CCVFHEANY);
  159. /* Vector modes. */
  160. VECTOR_MODES (INT, 2); /* V2QI */
  161. VECTOR_MODES (INT, 4); /* V4QI V2HI */
  162. VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
  163. VECTOR_MODES (INT, 16); /* V16QI V8HI V4SI V2DI */
  164. VECTOR_MODE (FLOAT, SF, 2); /* V2SF */
  165. VECTOR_MODE (FLOAT, SF, 4); /* V4SF */
  166. VECTOR_MODE (FLOAT, DF, 2); /* V2DF */
  167. VECTOR_MODE (INT, QI, 1); /* V1QI */
  168. VECTOR_MODE (INT, HI, 1); /* V1HI */
  169. VECTOR_MODE (INT, SI, 1); /* V1SI */
  170. VECTOR_MODE (INT, DI, 1); /* V1DI */
  171. VECTOR_MODE (INT, TI, 1); /* V1TI */
  172. VECTOR_MODE (FLOAT, SF, 1); /* V1SF */
  173. VECTOR_MODE (FLOAT, DF, 1); /* V1DF */
  174. VECTOR_MODE (FLOAT, TF, 1); /* V1TF */