2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. _powerpc-function-attributes:
8 PowerPC Function Attributes
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 These function attributes are supported by the PowerPC back end:
13 .. index:: indirect calls, PowerPC, longcall function attribute, PowerPC, shortcall function attribute, PowerPC
15 .. powerpc-fn-attr:: longcall, shortcall
17 The :powerpc-fn-attr:`longcall` attribute
18 indicates that the function might be far away from the call site and
19 require a different (more expensive) calling sequence. The
20 ``shortcall`` attribute indicates that the function is always close
21 enough for the shorter calling sequence to be used. These attributes
22 override both the :option:`-mlongcall` switch and
23 the ``#pragma longcall`` setting.
25 See :ref:`rs-6000-and-powerpc-options`, for more information on whether long
28 .. index:: target function attribute
30 .. powerpc-fn-attr:: target (options)
32 As discussed in :ref:`common-function-attributes`, this attribute
33 allows specification of target-specific compilation options.
35 On the PowerPC, the following options are allowed:
37 :samp:`altivec` :samp:`no-altivec`
39 .. index:: target("altivec") function attribute, PowerPC
41 Generate code that uses (does not use) AltiVec instructions. In
42 32-bit code, you cannot enable AltiVec instructions unless
43 :option:`-mabi=altivec` is used on the command line.
45 :samp:`cmpb` :samp:`no-cmpb`
47 .. index:: target("cmpb") function attribute, PowerPC
49 Generate code that uses (does not use) the compare bytes instruction
50 implemented on the POWER6 processor and other processors that support
51 the PowerPC V2.05 architecture.
53 :samp:`dlmzb` :samp:`no-dlmzb`
55 .. index:: target("dlmzb") function attribute, PowerPC
57 Generate code that uses (does not use) the string-search :samp:`dlmzb`
58 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
59 generated by default when targeting those processors.
61 :samp:`fprnd` :samp:`no-fprnd`
63 .. index:: target("fprnd") function attribute, PowerPC
65 Generate code that uses (does not use) the FP round to integer
66 instructions implemented on the POWER5+ processor and other processors
67 that support the PowerPC V2.03 architecture.
69 :samp:`hard-dfp` :samp:`no-hard-dfp`
71 .. index:: target("hard-dfp") function attribute, PowerPC
73 Generate code that uses (does not use) the decimal floating-point
74 instructions implemented on some POWER processors.
76 :samp:`isel` :samp:`no-isel`
78 .. index:: target("isel") function attribute, PowerPC
80 Generate code that uses (does not use) ISEL instruction.
82 :samp:`mfcrf` :samp:`no-mfcrf`
84 .. index:: target("mfcrf") function attribute, PowerPC
86 Generate code that uses (does not use) the move from condition
87 register field instruction implemented on the POWER4 processor and
88 other processors that support the PowerPC V2.01 architecture.
90 :samp:`mulhw` :samp:`no-mulhw`
92 .. index:: target("mulhw") function attribute, PowerPC
94 Generate code that uses (does not use) the half-word multiply and
95 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
96 These instructions are generated by default when targeting those
99 :samp:`multiple` :samp:`no-multiple`
101 .. index:: target("multiple") function attribute, PowerPC
103 Generate code that uses (does not use) the load multiple word
104 instructions and the store multiple word instructions.
106 :samp:`update` :samp:`no-update`
108 .. index:: target("update") function attribute, PowerPC
110 Generate code that uses (does not use) the load or store instructions
111 that update the base register to the address of the calculated memory
114 :samp:`popcntb` :samp:`no-popcntb`
116 .. index:: target("popcntb") function attribute, PowerPC
118 Generate code that uses (does not use) the popcount and double-precision
119 FP reciprocal estimate instruction implemented on the POWER5
120 processor and other processors that support the PowerPC V2.02
123 :samp:`popcntd` :samp:`no-popcntd`
125 .. index:: target("popcntd") function attribute, PowerPC
127 Generate code that uses (does not use) the popcount instruction
128 implemented on the POWER7 processor and other processors that support
129 the PowerPC V2.06 architecture.
131 :samp:`powerpc-gfxopt` :samp:`no-powerpc-gfxopt`
133 .. index:: target("powerpc-gfxopt") function attribute, PowerPC
135 Generate code that uses (does not use) the optional PowerPC
136 architecture instructions in the Graphics group, including
137 floating-point select.
139 :samp:`powerpc-gpopt` :samp:`no-powerpc-gpopt`
141 .. index:: target("powerpc-gpopt") function attribute, PowerPC
143 Generate code that uses (does not use) the optional PowerPC
144 architecture instructions in the General Purpose group, including
145 floating-point square root.
147 :samp:`recip-precision` :samp:`no-recip-precision`
149 .. index:: target("recip-precision") function attribute, PowerPC
151 Assume (do not assume) that the reciprocal estimate instructions
152 provide higher-precision estimates than is mandated by the PowerPC
155 :samp:`string` :samp:`no-string`
157 .. index:: target("string") function attribute, PowerPC
159 Generate code that uses (does not use) the load string instructions
160 and the store string word instructions to save multiple registers and
161 do small block moves.
163 :samp:`vsx` :samp:`no-vsx`
165 .. index:: target("vsx") function attribute, PowerPC
167 Generate code that uses (does not use) vector/scalar (VSX)
168 instructions, and also enable the use of built-in functions that allow
169 more direct access to the VSX instruction set. In 32-bit code, you
170 cannot enable VSX or AltiVec instructions unless
171 :option:`-mabi=altivec` is used on the command line.
173 :samp:`friz` :samp:`no-friz`
175 .. index:: target("friz") function attribute, PowerPC
177 Generate (do not generate) the ``friz`` instruction when the
178 :option:`-funsafe-math-optimizations` option is used to optimize
179 rounding a floating-point value to 64-bit integer and back to floating
180 point. The ``friz`` instruction does not return the same value if
181 the floating-point number is too large to fit in an integer.
183 :samp:`avoid-indexed-addresses` :samp:`no-avoid-indexed-addresses`
185 .. index:: target("avoid-indexed-addresses") function attribute, PowerPC
187 Generate code that tries to avoid (not avoid) the use of indexed load
188 or store instructions.
190 :samp:`paired` :samp:`no-paired`
192 .. index:: target("paired") function attribute, PowerPC
194 Generate code that uses (does not use) the generation of PAIRED simd
197 :samp:`longcall` :samp:`no-longcall`
199 .. index:: target("longcall") function attribute, PowerPC
201 Generate code that assumes (does not assume) that all calls are far
202 away so that a longer more expensive calling sequence is required.
206 .. index:: target("cpu=CPU") function attribute, PowerPC
208 Specify the architecture to generate code for when compiling the
209 function. If you select the ``target("cpu=power7")`` attribute when
210 generating 32-bit code, VSX and AltiVec instructions are not generated
211 unless you use the :option:`-mabi=altivec` option on the command line.
215 .. index:: target("tune=TUNE") function attribute, PowerPC
217 Specify the architecture to tune for when compiling the function. If
218 you do not specify the ``target("tune=TUNE")`` attribute and
219 you do specify the ``target("cpu=CPU")`` attribute,
220 compilation tunes for the :samp:`{CPU}` architecture, and not the
221 default tuning specified on the command line.
223 On the PowerPC, the inliner does not inline a
224 function that has different target options than the caller, unless the
225 callee has a subset of the target options of the caller.