Arithmetic.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Arithmetic</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Arithmetic">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Arithmetic">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="RTL.html#RTL" rel="up" title="RTL">
  30. <link href="Comparisons.html#Comparisons" rel="next" title="Comparisons">
  31. <link href="Regs-and-Memory.html#Regs-and-Memory" rel="prev" title="Regs and Memory">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Arithmetic"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Comparisons.html#Comparisons" accesskey="n" rel="next">Comparisons</a>, Previous: <a href="Regs-and-Memory.html#Regs-and-Memory" accesskey="p" rel="prev">Regs and Memory</a>, Up: <a href="RTL.html#RTL" accesskey="u" rel="up">RTL</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="RTL-Expressions-for-Arithmetic"></a>
  69. <h3 class="section">13.9 RTL Expressions for Arithmetic</h3>
  70. <a name="index-arithmetic_002c-in-RTL"></a>
  71. <a name="index-math_002c-in-RTL"></a>
  72. <a name="index-RTL-expressions-for-arithmetic"></a>
  73. <p>Unless otherwise specified, all the operands of arithmetic expressions
  74. must be valid for mode <var>m</var>. An operand is valid for mode <var>m</var>
  75. if it has mode <var>m</var>, or if it is a <code>const_int</code> or
  76. <code>const_double</code> and <var>m</var> is a mode of class <code>MODE_INT</code>.
  77. </p>
  78. <p>For commutative binary operations, constants should be placed in the
  79. second operand.
  80. </p>
  81. <dl compact="compact">
  82. <dd><a name="index-plus"></a>
  83. <a name="index-ss_005fplus"></a>
  84. <a name="index-us_005fplus"></a>
  85. <a name="index-RTL-sum"></a>
  86. <a name="index-RTL-addition"></a>
  87. <a name="index-RTL-addition-with-signed-saturation"></a>
  88. <a name="index-RTL-addition-with-unsigned-saturation"></a>
  89. </dd>
  90. <dt><code>(plus:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  91. <dt><code>(ss_plus:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  92. <dt><code>(us_plus:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  93. <dd>
  94. <p>These three expressions all represent the sum of the values
  95. represented by <var>x</var> and <var>y</var> carried out in machine mode
  96. <var>m</var>. They differ in their behavior on overflow of integer modes.
  97. <code>plus</code> wraps round modulo the width of <var>m</var>; <code>ss_plus</code>
  98. saturates at the maximum signed value representable in <var>m</var>;
  99. <code>us_plus</code> saturates at the maximum unsigned value.
  100. </p>
  101. <a name="index-lo_005fsum"></a>
  102. </dd>
  103. <dt><code>(lo_sum:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  104. <dd>
  105. <p>This expression represents the sum of <var>x</var> and the low-order bits
  106. of <var>y</var>. It is used with <code>high</code> (see <a href="Constants.html#Constants">Constants</a>) to
  107. represent the typical two-instruction sequence used in RISC machines
  108. to reference a global memory location.
  109. </p>
  110. <p>The number of low order bits is machine-dependent but is
  111. normally the number of bits in a <code>Pmode</code> item minus the number of
  112. bits set by <code>high</code>.
  113. </p>
  114. <p><var>m</var> should be <code>Pmode</code>.
  115. </p>
  116. <a name="index-minus"></a>
  117. <a name="index-ss_005fminus"></a>
  118. <a name="index-us_005fminus"></a>
  119. <a name="index-RTL-difference"></a>
  120. <a name="index-RTL-subtraction"></a>
  121. <a name="index-RTL-subtraction-with-signed-saturation"></a>
  122. <a name="index-RTL-subtraction-with-unsigned-saturation"></a>
  123. </dd>
  124. <dt><code>(minus:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  125. <dt><code>(ss_minus:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  126. <dt><code>(us_minus:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  127. <dd>
  128. <p>These three expressions represent the result of subtracting <var>y</var>
  129. from <var>x</var>, carried out in mode <var>M</var>. Behavior on overflow is
  130. the same as for the three variants of <code>plus</code> (see above).
  131. </p>
  132. <a name="index-compare"></a>
  133. <a name="index-RTL-comparison"></a>
  134. </dd>
  135. <dt><code>(compare:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  136. <dd><p>Represents the result of subtracting <var>y</var> from <var>x</var> for purposes
  137. of comparison. The result is computed without overflow, as if with
  138. infinite precision.
  139. </p>
  140. <p>Of course, machines cannot really subtract with infinite precision.
  141. However, they can pretend to do so when only the sign of the result will
  142. be used, which is the case when the result is stored in the condition
  143. code. And that is the <em>only</em> way this kind of expression may
  144. validly be used: as a value to be stored in the condition codes, either
  145. <code>(cc0)</code> or a register. See <a href="Comparisons.html#Comparisons">Comparisons</a>.
  146. </p>
  147. <p>The mode <var>m</var> is not related to the modes of <var>x</var> and <var>y</var>, but
  148. instead is the mode of the condition code value. If <code>(cc0)</code> is
  149. used, it is <code>VOIDmode</code>. Otherwise it is some mode in class
  150. <code>MODE_CC</code>, often <code>CCmode</code>. See <a href="Condition-Code.html#Condition-Code">Condition Code</a>. If <var>m</var>
  151. is <code>VOIDmode</code> or <code>CCmode</code>, the operation returns sufficient
  152. information (in an unspecified format) so that any comparison operator
  153. can be applied to the result of the <code>COMPARE</code> operation. For other
  154. modes in class <code>MODE_CC</code>, the operation only returns a subset of
  155. this information.
  156. </p>
  157. <p>Normally, <var>x</var> and <var>y</var> must have the same mode. Otherwise,
  158. <code>compare</code> is valid only if the mode of <var>x</var> is in class
  159. <code>MODE_INT</code> and <var>y</var> is a <code>const_int</code> or
  160. <code>const_double</code> with mode <code>VOIDmode</code>. The mode of <var>x</var>
  161. determines what mode the comparison is to be done in; thus it must not
  162. be <code>VOIDmode</code>.
  163. </p>
  164. <p>If one of the operands is a constant, it should be placed in the
  165. second operand and the comparison code adjusted as appropriate.
  166. </p>
  167. <p>A <code>compare</code> specifying two <code>VOIDmode</code> constants is not valid
  168. since there is no way to know in what mode the comparison is to be
  169. performed; the comparison must either be folded during the compilation
  170. or the first operand must be loaded into a register while its mode is
  171. still known.
  172. </p>
  173. <a name="index-neg"></a>
  174. <a name="index-ss_005fneg"></a>
  175. <a name="index-us_005fneg"></a>
  176. <a name="index-negation"></a>
  177. <a name="index-negation-with-signed-saturation"></a>
  178. <a name="index-negation-with-unsigned-saturation"></a>
  179. </dd>
  180. <dt><code>(neg:<var>m</var> <var>x</var>)</code></dt>
  181. <dt><code>(ss_neg:<var>m</var> <var>x</var>)</code></dt>
  182. <dt><code>(us_neg:<var>m</var> <var>x</var>)</code></dt>
  183. <dd><p>These two expressions represent the negation (subtraction from zero) of
  184. the value represented by <var>x</var>, carried out in mode <var>m</var>. They
  185. differ in the behavior on overflow of integer modes. In the case of
  186. <code>neg</code>, the negation of the operand may be a number not representable
  187. in mode <var>m</var>, in which case it is truncated to <var>m</var>. <code>ss_neg</code>
  188. and <code>us_neg</code> ensure that an out-of-bounds result saturates to the
  189. maximum or minimum signed or unsigned value.
  190. </p>
  191. <a name="index-mult"></a>
  192. <a name="index-ss_005fmult"></a>
  193. <a name="index-us_005fmult"></a>
  194. <a name="index-multiplication"></a>
  195. <a name="index-product"></a>
  196. <a name="index-multiplication-with-signed-saturation"></a>
  197. <a name="index-multiplication-with-unsigned-saturation"></a>
  198. </dd>
  199. <dt><code>(mult:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  200. <dt><code>(ss_mult:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  201. <dt><code>(us_mult:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  202. <dd><p>Represents the signed product of the values represented by <var>x</var> and
  203. <var>y</var> carried out in machine mode <var>m</var>.
  204. <code>ss_mult</code> and <code>us_mult</code> ensure that an out-of-bounds result
  205. saturates to the maximum or minimum signed or unsigned value.
  206. </p>
  207. <p>Some machines support a multiplication that generates a product wider
  208. than the operands. Write the pattern for this as
  209. </p>
  210. <div class="smallexample">
  211. <pre class="smallexample">(mult:<var>m</var> (sign_extend:<var>m</var> <var>x</var>) (sign_extend:<var>m</var> <var>y</var>))
  212. </pre></div>
  213. <p>where <var>m</var> is wider than the modes of <var>x</var> and <var>y</var>, which need
  214. not be the same.
  215. </p>
  216. <p>For unsigned widening multiplication, use the same idiom, but with
  217. <code>zero_extend</code> instead of <code>sign_extend</code>.
  218. </p>
  219. <a name="index-fma"></a>
  220. </dd>
  221. <dt><code>(fma:<var>m</var> <var>x</var> <var>y</var> <var>z</var>)</code></dt>
  222. <dd><p>Represents the <code>fma</code>, <code>fmaf</code>, and <code>fmal</code> builtin
  223. functions, which compute &lsquo;<samp><var>x</var> * <var>y</var> + <var>z</var></samp>&rsquo;
  224. without doing an intermediate rounding step.
  225. </p>
  226. <a name="index-div"></a>
  227. <a name="index-ss_005fdiv"></a>
  228. <a name="index-division"></a>
  229. <a name="index-signed-division"></a>
  230. <a name="index-signed-division-with-signed-saturation"></a>
  231. <a name="index-quotient"></a>
  232. </dd>
  233. <dt><code>(div:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  234. <dt><code>(ss_div:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  235. <dd><p>Represents the quotient in signed division of <var>x</var> by <var>y</var>,
  236. carried out in machine mode <var>m</var>. If <var>m</var> is a floating point
  237. mode, it represents the exact quotient; otherwise, the integerized
  238. quotient.
  239. <code>ss_div</code> ensures that an out-of-bounds result saturates to the maximum
  240. or minimum signed value.
  241. </p>
  242. <p>Some machines have division instructions in which the operands and
  243. quotient widths are not all the same; you should represent
  244. such instructions using <code>truncate</code> and <code>sign_extend</code> as in,
  245. </p>
  246. <div class="smallexample">
  247. <pre class="smallexample">(truncate:<var>m1</var> (div:<var>m2</var> <var>x</var> (sign_extend:<var>m2</var> <var>y</var>)))
  248. </pre></div>
  249. <a name="index-udiv"></a>
  250. <a name="index-unsigned-division"></a>
  251. <a name="index-unsigned-division-with-unsigned-saturation"></a>
  252. <a name="index-division-1"></a>
  253. </dd>
  254. <dt><code>(udiv:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  255. <dt><code>(us_div:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  256. <dd><p>Like <code>div</code> but represents unsigned division.
  257. <code>us_div</code> ensures that an out-of-bounds result saturates to the maximum
  258. or minimum unsigned value.
  259. </p>
  260. <a name="index-mod"></a>
  261. <a name="index-umod"></a>
  262. <a name="index-remainder"></a>
  263. <a name="index-division-2"></a>
  264. </dd>
  265. <dt><code>(mod:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  266. <dt><code>(umod:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  267. <dd><p>Like <code>div</code> and <code>udiv</code> but represent the remainder instead of
  268. the quotient.
  269. </p>
  270. <a name="index-smin"></a>
  271. <a name="index-smax"></a>
  272. <a name="index-signed-minimum"></a>
  273. <a name="index-signed-maximum"></a>
  274. </dd>
  275. <dt><code>(smin:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  276. <dt><code>(smax:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  277. <dd><p>Represents the smaller (for <code>smin</code>) or larger (for <code>smax</code>) of
  278. <var>x</var> and <var>y</var>, interpreted as signed values in mode <var>m</var>.
  279. When used with floating point, if both operands are zeros, or if either
  280. operand is <code>NaN</code>, then it is unspecified which of the two operands
  281. is returned as the result.
  282. </p>
  283. <a name="index-umin"></a>
  284. <a name="index-umax"></a>
  285. <a name="index-unsigned-minimum-and-maximum"></a>
  286. </dd>
  287. <dt><code>(umin:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  288. <dt><code>(umax:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  289. <dd><p>Like <code>smin</code> and <code>smax</code>, but the values are interpreted as unsigned
  290. integers.
  291. </p>
  292. <a name="index-not"></a>
  293. <a name="index-complement_002c-bitwise"></a>
  294. <a name="index-bitwise-complement"></a>
  295. </dd>
  296. <dt><code>(not:<var>m</var> <var>x</var>)</code></dt>
  297. <dd><p>Represents the bitwise complement of the value represented by <var>x</var>,
  298. carried out in mode <var>m</var>, which must be a fixed-point machine mode.
  299. </p>
  300. <a name="index-and"></a>
  301. <a name="index-logical_002dand_002c-bitwise"></a>
  302. <a name="index-bitwise-logical_002dand"></a>
  303. </dd>
  304. <dt><code>(and:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  305. <dd><p>Represents the bitwise logical-and of the values represented by
  306. <var>x</var> and <var>y</var>, carried out in machine mode <var>m</var>, which must be
  307. a fixed-point machine mode.
  308. </p>
  309. <a name="index-ior"></a>
  310. <a name="index-inclusive_002dor_002c-bitwise"></a>
  311. <a name="index-bitwise-inclusive_002dor"></a>
  312. </dd>
  313. <dt><code>(ior:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  314. <dd><p>Represents the bitwise inclusive-or of the values represented by <var>x</var>
  315. and <var>y</var>, carried out in machine mode <var>m</var>, which must be a
  316. fixed-point mode.
  317. </p>
  318. <a name="index-xor"></a>
  319. <a name="index-exclusive_002dor_002c-bitwise"></a>
  320. <a name="index-bitwise-exclusive_002dor"></a>
  321. </dd>
  322. <dt><code>(xor:<var>m</var> <var>x</var> <var>y</var>)</code></dt>
  323. <dd><p>Represents the bitwise exclusive-or of the values represented by <var>x</var>
  324. and <var>y</var>, carried out in machine mode <var>m</var>, which must be a
  325. fixed-point mode.
  326. </p>
  327. <a name="index-ashift"></a>
  328. <a name="index-ss_005fashift"></a>
  329. <a name="index-us_005fashift"></a>
  330. <a name="index-left-shift"></a>
  331. <a name="index-shift"></a>
  332. <a name="index-arithmetic-shift"></a>
  333. <a name="index-arithmetic-shift-with-signed-saturation"></a>
  334. <a name="index-arithmetic-shift-with-unsigned-saturation"></a>
  335. </dd>
  336. <dt><code>(ashift:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  337. <dt><code>(ss_ashift:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  338. <dt><code>(us_ashift:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  339. <dd><p>These three expressions represent the result of arithmetically shifting <var>x</var>
  340. left by <var>c</var> places. They differ in their behavior on overflow of integer
  341. modes. An <code>ashift</code> operation is a plain shift with no special behavior
  342. in case of a change in the sign bit; <code>ss_ashift</code> and <code>us_ashift</code>
  343. saturates to the minimum or maximum representable value if any of the bits
  344. shifted out differs from the final sign bit.
  345. </p>
  346. <p><var>x</var> have mode <var>m</var>, a fixed-point machine mode. <var>c</var>
  347. be a fixed-point mode or be a constant with mode <code>VOIDmode</code>; which
  348. mode is determined by the mode called for in the machine description
  349. entry for the left-shift instruction. For example, on the VAX, the mode
  350. of <var>c</var> is <code>QImode</code> regardless of <var>m</var>.
  351. </p>
  352. <a name="index-lshiftrt"></a>
  353. <a name="index-right-shift"></a>
  354. <a name="index-ashiftrt"></a>
  355. </dd>
  356. <dt><code>(lshiftrt:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  357. <dt><code>(ashiftrt:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  358. <dd><p>Like <code>ashift</code> but for right shift. Unlike the case for left shift,
  359. these two operations are distinct.
  360. </p>
  361. <a name="index-rotate-1"></a>
  362. <a name="index-rotate"></a>
  363. <a name="index-left-rotate"></a>
  364. <a name="index-rotatert"></a>
  365. <a name="index-right-rotate"></a>
  366. </dd>
  367. <dt><code>(rotate:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  368. <dt><code>(rotatert:<var>m</var> <var>x</var> <var>c</var>)</code></dt>
  369. <dd><p>Similar but represent left and right rotate. If <var>c</var> is a constant,
  370. use <code>rotate</code>.
  371. </p>
  372. <a name="index-abs"></a>
  373. <a name="index-ss_005fabs"></a>
  374. <a name="index-absolute-value"></a>
  375. </dd>
  376. <dt><code>(abs:<var>m</var> <var>x</var>)</code></dt>
  377. <dt><code>(ss_abs:<var>m</var> <var>x</var>)</code></dt>
  378. <dd><p>Represents the absolute value of <var>x</var>, computed in mode <var>m</var>.
  379. <code>ss_abs</code> ensures that an out-of-bounds result saturates to the
  380. maximum signed value.
  381. </p>
  382. <a name="index-sqrt"></a>
  383. <a name="index-square-root"></a>
  384. </dd>
  385. <dt><code>(sqrt:<var>m</var> <var>x</var>)</code></dt>
  386. <dd><p>Represents the square root of <var>x</var>, computed in mode <var>m</var>.
  387. Most often <var>m</var> will be a floating point mode.
  388. </p>
  389. <a name="index-ffs"></a>
  390. </dd>
  391. <dt><code>(ffs:<var>m</var> <var>x</var>)</code></dt>
  392. <dd><p>Represents one plus the index of the least significant 1-bit in
  393. <var>x</var>, represented as an integer of mode <var>m</var>. (The value is
  394. zero if <var>x</var> is zero.) The mode of <var>x</var> must be <var>m</var>
  395. or <code>VOIDmode</code>.
  396. </p>
  397. <a name="index-clrsb"></a>
  398. </dd>
  399. <dt><code>(clrsb:<var>m</var> <var>x</var>)</code></dt>
  400. <dd><p>Represents the number of redundant leading sign bits in <var>x</var>,
  401. represented as an integer of mode <var>m</var>, starting at the most
  402. significant bit position. This is one less than the number of leading
  403. sign bits (either 0 or 1), with no special cases. The mode of <var>x</var>
  404. must be <var>m</var> or <code>VOIDmode</code>.
  405. </p>
  406. <a name="index-clz"></a>
  407. </dd>
  408. <dt><code>(clz:<var>m</var> <var>x</var>)</code></dt>
  409. <dd><p>Represents the number of leading 0-bits in <var>x</var>, represented as an
  410. integer of mode <var>m</var>, starting at the most significant bit position.
  411. If <var>x</var> is zero, the value is determined by
  412. <code>CLZ_DEFINED_VALUE_AT_ZERO</code> (see <a href="Misc.html#Misc">Misc</a>). Note that this is one of
  413. the few expressions that is not invariant under widening. The mode of
  414. <var>x</var> must be <var>m</var> or <code>VOIDmode</code>.
  415. </p>
  416. <a name="index-ctz"></a>
  417. </dd>
  418. <dt><code>(ctz:<var>m</var> <var>x</var>)</code></dt>
  419. <dd><p>Represents the number of trailing 0-bits in <var>x</var>, represented as an
  420. integer of mode <var>m</var>, starting at the least significant bit position.
  421. If <var>x</var> is zero, the value is determined by
  422. <code>CTZ_DEFINED_VALUE_AT_ZERO</code> (see <a href="Misc.html#Misc">Misc</a>). Except for this case,
  423. <code>ctz(x)</code> is equivalent to <code>ffs(<var>x</var>) - 1</code>. The mode of
  424. <var>x</var> must be <var>m</var> or <code>VOIDmode</code>.
  425. </p>
  426. <a name="index-popcount"></a>
  427. </dd>
  428. <dt><code>(popcount:<var>m</var> <var>x</var>)</code></dt>
  429. <dd><p>Represents the number of 1-bits in <var>x</var>, represented as an integer of
  430. mode <var>m</var>. The mode of <var>x</var> must be <var>m</var> or <code>VOIDmode</code>.
  431. </p>
  432. <a name="index-parity"></a>
  433. </dd>
  434. <dt><code>(parity:<var>m</var> <var>x</var>)</code></dt>
  435. <dd><p>Represents the number of 1-bits modulo 2 in <var>x</var>, represented as an
  436. integer of mode <var>m</var>. The mode of <var>x</var> must be <var>m</var> or
  437. <code>VOIDmode</code>.
  438. </p>
  439. <a name="index-bswap"></a>
  440. </dd>
  441. <dt><code>(bswap:<var>m</var> <var>x</var>)</code></dt>
  442. <dd><p>Represents the value <var>x</var> with the order of bytes reversed, carried out
  443. in mode <var>m</var>, which must be a fixed-point machine mode.
  444. The mode of <var>x</var> must be <var>m</var> or <code>VOIDmode</code>.
  445. </p></dd>
  446. </dl>
  447. <hr>
  448. <div class="header">
  449. <p>
  450. Next: <a href="Comparisons.html#Comparisons" accesskey="n" rel="next">Comparisons</a>, Previous: <a href="Regs-and-Memory.html#Regs-and-Memory" accesskey="p" rel="prev">Regs and Memory</a>, Up: <a href="RTL.html#RTL" accesskey="u" rel="up">RTL</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  451. </div>
  452. </body>
  453. </html>