comparison gcc/doc/md.texi @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 @c Copyright (C) 1988-2018 Free Software Foundation, Inc. 1 @c Copyright (C) 1988-2020 Free Software Foundation, Inc.
2 @c This is part of the GCC manual. 2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi. 3 @c For copying conditions, see the file gcc.texi.
4 4
5 @ifset INTERNALS 5 @ifset INTERNALS
6 @node Machine Desc 6 @node Machine Desc
1746 The stack pointer register (@code{SP}) 1746 The stack pointer register (@code{SP})
1747 1747
1748 @item w 1748 @item w
1749 Floating point register, Advanced SIMD vector register or SVE vector register 1749 Floating point register, Advanced SIMD vector register or SVE vector register
1750 1750
1751 @item x
1752 Like @code{w}, but restricted to registers 0 to 15 inclusive.
1753
1754 @item y
1755 Like @code{w}, but restricted to registers 0 to 7 inclusive.
1756
1751 @item Upl 1757 @item Upl
1752 One of the low eight SVE predicate registers (@code{P0} to @code{P7}) 1758 One of the low eight SVE predicate registers (@code{P0} to @code{P7})
1753 1759
1754 @item Upa 1760 @item Upa
1755 Any of the SVE predicate registers (@code{P0} to @code{P15}) 1761 Any of the SVE predicate registers (@code{P0} to @code{P15})
1794 A memory address which uses a single base register with no offset 1800 A memory address which uses a single base register with no offset
1795 1801
1796 @item Ump 1802 @item Ump
1797 A memory address suitable for a load/store pair instruction in SI, DI, SF and 1803 A memory address suitable for a load/store pair instruction in SI, DI, SF and
1798 DF modes 1804 DF modes
1805
1806 @end table
1807
1808
1809 @item AMD GCN ---@file{config/gcn/constraints.md}
1810 @table @code
1811 @item I
1812 Immediate integer in the range @minus{}16 to 64
1813
1814 @item J
1815 Immediate 16-bit signed integer
1816
1817 @item Kf
1818 Immediate constant @minus{}1
1819
1820 @item L
1821 Immediate 15-bit unsigned integer
1822
1823 @item A
1824 Immediate constant that can be inlined in an instruction encoding: integer
1825 @minus{}16..64, or float 0.0, +/@minus{}0.5, +/@minus{}1.0, +/@minus{}2.0,
1826 +/@minus{}4.0, 1.0/(2.0*PI)
1827
1828 @item B
1829 Immediate 32-bit signed integer that can be attached to an instruction encoding
1830
1831 @item C
1832 Immediate 32-bit integer in range @minus{}16..4294967295 (i.e. 32-bit unsigned
1833 integer or @samp{A} constraint)
1834
1835 @item DA
1836 Immediate 64-bit constant that can be split into two @samp{A} constants
1837
1838 @item DB
1839 Immediate 64-bit constant that can be split into two @samp{B} constants
1840
1841 @item U
1842 Any @code{unspec}
1843
1844 @item Y
1845 Any @code{symbol_ref} or @code{label_ref}
1846
1847 @item v
1848 VGPR register
1849
1850 @item Sg
1851 SGPR register
1852
1853 @item SD
1854 SGPR registers valid for instruction destinations, including VCC, M0 and EXEC
1855
1856 @item SS
1857 SGPR registers valid for instruction sources, including VCC, M0, EXEC and SCC
1858
1859 @item Sm
1860 SGPR registers valid as a source for scalar memory instructions (excludes M0
1861 and EXEC)
1862
1863 @item Sv
1864 SGPR registers valid as a source or destination for vector instructions
1865 (excludes EXEC)
1866
1867 @item ca
1868 All condition registers: SCC, VCCZ, EXECZ
1869
1870 @item cs
1871 Scalar condition register: SCC
1872
1873 @item cV
1874 Vector condition register: VCC, VCC_LO, VCC_HI
1875
1876 @item e
1877 EXEC register (EXEC_LO and EXEC_HI)
1878
1879 @item RB
1880 Memory operand with address space suitable for @code{buffer_*} instructions
1881
1882 @item RF
1883 Memory operand with address space suitable for @code{flat_*} instructions
1884
1885 @item RS
1886 Memory operand with address space suitable for @code{s_*} instructions
1887
1888 @item RL
1889 Memory operand with address space suitable for @code{ds_*} LDS instructions
1890
1891 @item RG
1892 Memory operand with address space suitable for @code{ds_*} GDS instructions
1893
1894 @item RD
1895 Memory operand with address space suitable for any @code{ds_*} instructions
1896
1897 @item RM
1898 Memory operand with address space suitable for @code{global_*} instructions
1799 1899
1800 @end table 1900 @end table
1801 1901
1802 1902
1803 @item ARC ---@file{config/arc/constraints.md} 1903 @item ARC ---@file{config/arc/constraints.md}
2019 2119
2020 @item f 2120 @item f
2021 M register 2121 M register
2022 2122
2023 @item c 2123 @item c
2024 Registers used for circular buffering, i.e. I, B, or L registers. 2124 Registers used for circular buffering, i.e.@: I, B, or L registers.
2025 2125
2026 @item C 2126 @item C
2027 The CC register. 2127 The CC register.
2028 2128
2029 @item t 2129 @item t
3001 representing a supported PIC or TLS relocation. 3101 representing a supported PIC or TLS relocation.
3002 @end ifset 3102 @end ifset
3003 3103
3004 @end table 3104 @end table
3005 3105
3106 @item OpenRISC---@file{config/or1k/constraints.md}
3107 @table @code
3108 @item I
3109 Integer that is valid as an immediate operand in an
3110 instruction taking a signed 16-bit number. Range
3111 @minus{}32768 to 32767.
3112
3113 @item K
3114 Integer that is valid as an immediate operand in an
3115 instruction taking an unsigned 16-bit number. Range
3116 0 to 65535.
3117
3118 @item M
3119 Signed 16-bit constant shifted left 16 bits. (Used with @code{l.movhi})
3120
3121 @item O
3122 Zero
3123
3124 @ifset INTERNALS
3125 @item c
3126 Register usable for sibcalls.
3127 @end ifset
3128
3129 @end table
3130
3006 @item PDP-11---@file{config/pdp11/constraints.md} 3131 @item PDP-11---@file{config/pdp11/constraints.md}
3007 @table @code 3132 @table @code
3008 @item a 3133 @item a
3009 Floating point registers AC0 through AC3. These can be loaded from/to 3134 Floating point registers AC0 through AC3. These can be loaded from/to
3010 memory with a single instruction. 3135 memory with a single instruction.
3060 3185
3061 @end table 3186 @end table
3062 3187
3063 @item PowerPC and IBM RS6000---@file{config/rs6000/constraints.md} 3188 @item PowerPC and IBM RS6000---@file{config/rs6000/constraints.md}
3064 @table @code 3189 @table @code
3190 @item r
3191 A general purpose register (GPR), @code{r0}@dots{}@code{r31}.
3192
3065 @item b 3193 @item b
3066 Address base register 3194 A base register. Like @code{r}, but @code{r0} is not allowed, so
3195 @code{r1}@dots{}@code{r31}.
3196
3197 @item f
3198 A floating point register (FPR), @code{f0}@dots{}@code{f31}.
3067 3199
3068 @item d 3200 @item d
3069 Floating point register (containing 64-bit value) 3201 A floating point register. This is the same as @code{f} nowadays;
3070 3202 historically @code{f} was for single-precision and @code{d} was for
3071 @item f 3203 double-precision floating point.
3072 Floating point register (containing 32-bit value)
3073 3204
3074 @item v 3205 @item v
3075 Altivec vector register 3206 An Altivec vector register (VR), @code{v0}@dots{}@code{v31}.
3076 3207
3077 @item wa 3208 @item wa
3078 Any VSX register if the @option{-mvsx} option was used or NO_REGS. 3209 A VSX register (VSR), @code{vs0}@dots{}@code{vs63}. This is either an
3079 3210 FPR (@code{vs0}@dots{}@code{vs31} are @code{f0}@dots{}@code{f31}) or a VR
3080 When using any of the register constraints (@code{wa}, @code{wd}, 3211 (@code{vs32}@dots{}@code{vs63} are @code{v0}@dots{}@code{v31}).
3081 @code{wf}, @code{wg}, @code{wh}, @code{wi}, @code{wj}, @code{wk}, 3212
3082 @code{wl}, @code{wm}, @code{wo}, @code{wp}, @code{wq}, @code{ws}, 3213 When using @code{wa}, you should use the @code{%x} output modifier, so that
3083 @code{wt}, @code{wu}, @code{wv}, @code{ww}, or @code{wy}) 3214 the correct register number is printed. For example:
3084 that take VSX registers, you must use @code{%x<n>} in the template so
3085 that the correct register is used. Otherwise the register number
3086 output in the assembly file will be incorrect if an Altivec register
3087 is an operand of a VSX instruction that expects VSX register
3088 numbering.
3089 3215
3090 @smallexample 3216 @smallexample
3091 asm ("xvadddp %x0,%x1,%x2" 3217 asm ("xvadddp %x0,%x1,%x2"
3092 : "=wa" (v1) 3218 : "=wa" (v1)
3093 : "wa" (v2), "wa" (v3)); 3219 : "wa" (v2), "wa" (v3));
3094 @end smallexample 3220 @end smallexample
3095 3221
3096 @noindent 3222 You should not use @code{%x} for @code{v} operands:
3097 is correct, but:
3098
3099 @smallexample
3100 asm ("xvadddp %0,%1,%2"
3101 : "=wa" (v1)
3102 : "wa" (v2), "wa" (v3));
3103 @end smallexample
3104
3105 @noindent
3106 is not correct.
3107
3108 If an instruction only takes Altivec registers, you do not want to use
3109 @code{%x<n>}.
3110 3223
3111 @smallexample 3224 @smallexample
3112 asm ("xsaddqp %0,%1,%2" 3225 asm ("xsaddqp %0,%1,%2"
3113 : "=v" (v1) 3226 : "=v" (v1)
3114 : "v" (v2), "v" (v3)); 3227 : "v" (v2), "v" (v3));
3115 @end smallexample 3228 @end smallexample
3116 3229
3117 @noindent 3230 @ifset INTERNALS
3118 is correct because the @code{xsaddqp} instruction only takes Altivec 3231 @item h
3119 registers, while: 3232 A special register (@code{vrsave}, @code{ctr}, or @code{lr}).
3120 3233 @end ifset
3121 @smallexample 3234
3122 asm ("xsaddqp %x0,%x1,%x2" 3235 @item c
3123 : "=v" (v1) 3236 The count register, @code{ctr}.
3124 : "v" (v2), "v" (v3)); 3237
3125 @end smallexample 3238 @item l
3126 3239 The link register, @code{lr}.
3127 @noindent 3240
3128 is incorrect. 3241 @item x
3129 3242 Condition register field 0, @code{cr0}.
3130 @item wb 3243
3131 Altivec register if @option{-mcpu=power9} is used or NO_REGS. 3244 @item y
3132 3245 Any condition register field, @code{cr0}@dots{}@code{cr7}.
3133 @item wd 3246
3134 VSX vector register to hold vector double data or NO_REGS. 3247 @ifset INTERNALS
3248 @item z
3249 The carry bit, @code{XER[CA]}.
3135 3250
3136 @item we 3251 @item we
3137 VSX register if the @option{-mcpu=power9} and @option{-m64} options 3252 Like @code{wa}, if @option{-mpower9-vector} and @option{-m64} are used;
3138 were used or NO_REGS. 3253 otherwise, @code{NO_REGS}.
3139
3140 @item wf
3141 VSX vector register to hold vector float data or NO_REGS.
3142
3143 @item wg
3144 If @option{-mmfpgpr} was used, a floating point register or NO_REGS.
3145
3146 @item wh
3147 Floating point register if direct moves are available, or NO_REGS.
3148
3149 @item wi
3150 FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS.
3151
3152 @item wj
3153 FP or VSX register to hold 64-bit integers for direct moves or NO_REGS.
3154
3155 @item wk
3156 FP or VSX register to hold 64-bit doubles for direct moves or NO_REGS.
3157
3158 @item wl
3159 Floating point register if the LFIWAX instruction is enabled or NO_REGS.
3160
3161 @item wm
3162 VSX register if direct move instructions are enabled, or NO_REGS.
3163 3254
3164 @item wn 3255 @item wn
3165 No register (NO_REGS). 3256 No register (@code{NO_REGS}).
3166
3167 @item wo
3168 VSX register to use for ISA 3.0 vector instructions, or NO_REGS.
3169
3170 @item wp
3171 VSX register to use for IEEE 128-bit floating point TFmode, or NO_REGS.
3172
3173 @item wq
3174 VSX register to use for IEEE 128-bit floating point, or NO_REGS.
3175 3257
3176 @item wr 3258 @item wr
3177 General purpose register if 64-bit instructions are enabled or NO_REGS. 3259 Like @code{r}, if @option{-mpowerpc64} is used; otherwise, @code{NO_REGS}.
3178
3179 @item ws
3180 VSX vector register to hold scalar double values or NO_REGS.
3181
3182 @item wt
3183 VSX vector register to hold 128 bit integer or NO_REGS.
3184
3185 @item wu
3186 Altivec register to use for float/32-bit int loads/stores or NO_REGS.
3187
3188 @item wv
3189 Altivec register to use for double loads/stores or NO_REGS.
3190
3191 @item ww
3192 FP or VSX register to perform float operations under @option{-mvsx} or NO_REGS.
3193 3260
3194 @item wx 3261 @item wx
3195 Floating point register if the STFIWX instruction is enabled or NO_REGS. 3262 Like @code{d}, if @option{-mpowerpc-gfxopt} is used; otherwise, @code{NO_REGS}.
3196
3197 @item wy
3198 FP or VSX register to perform ISA 2.07 float ops or NO_REGS.
3199
3200 @item wz
3201 Floating point register if the LFIWZX instruction is enabled or NO_REGS.
3202 3263
3203 @item wA 3264 @item wA
3204 Address base register if 64-bit instructions are enabled or NO_REGS. 3265 Like @code{b}, if @option{-mpowerpc64} is used; otherwise, @code{NO_REGS}.
3205 3266
3206 @item wB 3267 @item wB
3207 Signed 5-bit constant integer that can be loaded into an altivec register. 3268 Signed 5-bit constant integer that can be loaded into an Altivec register.
3208 3269
3209 @item wD 3270 @item wD
3210 Int constant that is the element number of the 64-bit scalar in a vector. 3271 Int constant that is the element number of the 64-bit scalar in a vector.
3211 3272
3212 @item wE 3273 @item wE
3213 Vector constant that can be loaded with the XXSPLTIB instruction. 3274 Vector constant that can be loaded with the XXSPLTIB instruction.
3214 3275
3215 @item wF 3276 @item wF
3216 Memory operand suitable for power9 fusion load/stores. 3277 Memory operand suitable for power8 GPR load fusion.
3217
3218 @item wG
3219 Memory operand suitable for TOC fusion memory references.
3220
3221 @item wH
3222 Altivec register if @option{-mvsx-small-integer}.
3223
3224 @item wI
3225 Floating point register if @option{-mvsx-small-integer}.
3226
3227 @item wJ
3228 FP register if @option{-mvsx-small-integer} and @option{-mpower9-vector}.
3229
3230 @item wK
3231 Altivec register if @option{-mvsx-small-integer} and @option{-mpower9-vector}.
3232 3278
3233 @item wL 3279 @item wL
3234 Int constant that is the element number that the MFVSRLD instruction. 3280 Int constant that is the element number mfvsrld accesses in a vector.
3235 targets.
3236 3281
3237 @item wM 3282 @item wM
3238 Match vector constant with all 1's if the XXLORC instruction is available. 3283 Match vector constant with all 1's if the XXLORC instruction is available.
3239 3284
3240 @item wO 3285 @item wO
3241 A memory operand suitable for the ISA 3.0 vector d-form instructions. 3286 Memory operand suitable for the ISA 3.0 vector d-form instructions.
3242 3287
3243 @item wQ 3288 @item wQ
3244 A memory address that will work with the @code{lq} and @code{stq} 3289 Memory operand suitable for the load/store quad instructions.
3245 instructions.
3246 3290
3247 @item wS 3291 @item wS
3248 Vector constant that can be loaded with XXSPLTIB & sign extension. 3292 Vector constant that can be loaded with XXSPLTIB & sign extension.
3249 3293
3250 @item h 3294 @item wY
3251 @samp{MQ}, @samp{CTR}, or @samp{LINK} register 3295 A memory operand for a DS-form instruction.
3252 3296
3253 @item c 3297 @item wZ
3254 @samp{CTR} register 3298 An indexed or indirect memory operand, ignoring the bottom 4 bits.
3255 3299 @end ifset
3256 @item l
3257 @samp{LINK} register
3258
3259 @item x
3260 @samp{CR} register (condition register) number 0
3261
3262 @item y
3263 @samp{CR} register (condition register)
3264
3265 @item z
3266 @samp{XER[CA]} carry bit (part of the XER register)
3267 3300
3268 @item I 3301 @item I
3269 Signed 16-bit constant 3302 A signed 16-bit constant.
3270 3303
3271 @item J 3304 @item J
3272 Unsigned 16-bit constant shifted left 16 bits (use @samp{L} instead for 3305 An unsigned 16-bit constant shifted left 16 bits (use @code{L} instead
3273 @code{SImode} constants) 3306 for @code{SImode} constants).
3274 3307
3275 @item K 3308 @item K
3276 Unsigned 16-bit constant 3309 An unsigned 16-bit constant.
3277 3310
3278 @item L 3311 @item L
3279 Signed 16-bit constant shifted left 16 bits 3312 A signed 16-bit constant shifted left 16 bits.
3280 3313
3314 @ifset INTERNALS
3281 @item M 3315 @item M
3282 Constant larger than 31 3316 An integer constant greater than 31.
3283 3317
3284 @item N 3318 @item N
3285 Exact power of 2 3319 An exact power of 2.
3286 3320
3287 @item O 3321 @item O
3288 Zero 3322 The integer constant zero.
3289 3323
3290 @item P 3324 @item P
3291 Constant whose negation is a signed 16-bit constant 3325 A constant whose negation is a signed 16-bit constant.
3292 3326 @end ifset
3327
3328 @item eI
3329 A signed 34-bit integer constant if prefixed instructions are supported.
3330
3331 @ifset INTERNALS
3293 @item G 3332 @item G
3294 Floating point constant that can be loaded into a register with one 3333 A floating point constant that can be loaded into a register with one
3295 instruction per word 3334 instruction per word.
3296 3335
3297 @item H 3336 @item H
3298 Integer/Floating point constant that can be loaded into a register using 3337 A floating point constant that can be loaded into a register using
3299 three instructions 3338 three instructions.
3339 @end ifset
3300 3340
3301 @item m 3341 @item m
3302 Memory operand. 3342 A memory operand.
3303 Normally, @code{m} does not allow addresses that update the base register. 3343 Normally, @code{m} does not allow addresses that update the base register.
3304 If @samp{<} or @samp{>} constraint is also used, they are allowed and 3344 If the @code{<} or @code{>} constraint is also used, they are allowed and
3305 therefore on PowerPC targets in that case it is only safe 3345 therefore on PowerPC targets in that case it is only safe
3306 to use @samp{m<>} in an @code{asm} statement if that @code{asm} statement 3346 to use @code{m<>} in an @code{asm} statement if that @code{asm} statement
3307 accesses the operand exactly once. The @code{asm} statement must also 3347 accesses the operand exactly once. The @code{asm} statement must also
3308 use @samp{%U@var{<opno>}} as a placeholder for the ``update'' flag in the 3348 use @code{%U@var{<opno>}} as a placeholder for the ``update'' flag in the
3309 corresponding load or store instruction. For example: 3349 corresponding load or store instruction. For example:
3310 3350
3311 @smallexample 3351 @smallexample
3312 asm ("st%U0 %1,%0" : "=m<>" (mem) : "r" (val)); 3352 asm ("st%U0 %1,%0" : "=m<>" (mem) : "r" (val));
3313 @end smallexample 3353 @end smallexample
3318 asm ("st %1,%0" : "=m<>" (mem) : "r" (val)); 3358 asm ("st %1,%0" : "=m<>" (mem) : "r" (val));
3319 @end smallexample 3359 @end smallexample
3320 3360
3321 is not. 3361 is not.
3322 3362
3363 @ifset INTERNALS
3323 @item es 3364 @item es
3324 A ``stable'' memory operand; that is, one which does not include any 3365 A ``stable'' memory operand; that is, one which does not include any
3325 automodification of the base register. This used to be useful when 3366 automodification of the base register. This used to be useful when
3326 @samp{m} allowed automodification of the base register, but as those are now only 3367 @code{m} allowed automodification of the base register, but as those
3327 allowed when @samp{<} or @samp{>} is used, @samp{es} is basically the same 3368 are now only allowed when @code{<} or @code{>} is used, @code{es} is
3328 as @samp{m} without @samp{<} and @samp{>}. 3369 basically the same as @code{m} without @code{<} and @code{>}.
3370 @end ifset
3329 3371
3330 @item Q 3372 @item Q
3331 Memory operand that is an offset from a register (it is usually better 3373 A memory operand addressed by just a base register.
3332 to use @samp{m} or @samp{es} in @code{asm} statements) 3374
3375 @ifset INTERNALS
3376 @item Y
3377 A memory operand for a DQ-form instruction.
3378 @end ifset
3333 3379
3334 @item Z 3380 @item Z
3335 Memory operand that is an indexed or indirect from a register (it is 3381 A memory operand accessed with indexed or indirect addressing.
3336 usually better to use @samp{m} or @samp{es} in @code{asm} statements) 3382
3337 3383 @ifset INTERNALS
3338 @item R 3384 @item R
3339 AIX TOC entry 3385 An AIX TOC entry.
3386 @end ifset
3340 3387
3341 @item a 3388 @item a
3342 Address operand that is an indexed or indirect from a register (@samp{p} is 3389 An indexed or indirect address.
3343 preferable for @code{asm} statements) 3390
3344 3391 @ifset INTERNALS
3345 @item U 3392 @item U
3346 System V Release 4 small data area reference 3393 A V.4 small data reference.
3347 3394
3348 @item W 3395 @item W
3349 Vector constant that does not require memory 3396 A vector constant that does not require memory.
3350 3397
3351 @item j 3398 @item j
3352 Vector constant that is all zeros. 3399 The zero vector constant.
3400 @end ifset
3401
3402 @end table
3403
3404 @item PRU---@file{config/pru/constraints.md}
3405 @table @code
3406 @item I
3407 An unsigned 8-bit integer constant.
3408
3409 @item J
3410 An unsigned 16-bit integer constant.
3411
3412 @item L
3413 An unsigned 5-bit integer constant (for shift counts).
3414
3415 @item T
3416 A text segment (program memory) constant label.
3417
3418 @item Z
3419 Integer constant zero.
3353 3420
3354 @end table 3421 @end table
3355 3422
3356 @item RL78---@file{config/rl78/constraints.md} 3423 @item RL78---@file{config/rl78/constraints.md}
3357 @table @code 3424 @table @code
3445 3512
3446 @item RISC-V---@file{config/riscv/constraints.md} 3513 @item RISC-V---@file{config/riscv/constraints.md}
3447 @table @code 3514 @table @code
3448 3515
3449 @item f 3516 @item f
3450 A floating-point register (if availiable). 3517 A floating-point register (if available).
3451 3518
3452 @item I 3519 @item I
3453 An I-type 12-bit signed immediate. 3520 An I-type 12-bit signed immediate.
3454 3521
3455 @item J 3522 @item J
3659 @item w 3726 @item w
3660 Memory address with only a base register 3727 Memory address with only a base register
3661 3728
3662 @item Y 3729 @item Y
3663 Vector zero 3730 Vector zero
3664
3665 @end table
3666
3667 @item SPU---@file{config/spu/spu.h}
3668 @table @code
3669 @item a
3670 An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is treated as a 64 bit value.
3671
3672 @item c
3673 An immediate for and/xor/or instructions. const_int is treated as a 64 bit value.
3674
3675 @item d
3676 An immediate for the @code{iohl} instruction. const_int is treated as a 64 bit value.
3677
3678 @item f
3679 An immediate which can be loaded with @code{fsmbi}.
3680
3681 @item A
3682 An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is treated as a 32 bit value.
3683
3684 @item B
3685 An immediate for most arithmetic instructions. const_int is treated as a 32 bit value.
3686
3687 @item C
3688 An immediate for and/xor/or instructions. const_int is treated as a 32 bit value.
3689
3690 @item D
3691 An immediate for the @code{iohl} instruction. const_int is treated as a 32 bit value.
3692
3693 @item I
3694 A constant in the range [@minus{}64, 63] for shift/rotate instructions.
3695
3696 @item J
3697 An unsigned 7-bit constant for conversion/nop/channel instructions.
3698
3699 @item K
3700 A signed 10-bit constant for most arithmetic instructions.
3701
3702 @item M
3703 A signed 16 bit immediate for @code{stop}.
3704
3705 @item N
3706 An unsigned 16-bit constant for @code{iohl} and @code{fsmbi}.
3707
3708 @item O
3709 An unsigned 7-bit constant whose 3 least significant bits are 0.
3710
3711 @item P
3712 An unsigned 3-bit constant for 16-byte rotates and shifts
3713
3714 @item R
3715 Call operand, reg, for indirect calls
3716
3717 @item S
3718 Call operand, symbol, for relative calls.
3719
3720 @item T
3721 Call operand, const_int, for absolute calls.
3722
3723 @item U
3724 An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is sign extended to 128 bit.
3725
3726 @item W
3727 An immediate for shift and rotate instructions. const_int is treated as a 32 bit value.
3728
3729 @item Y
3730 An immediate for and/xor/or instructions. const_int is sign extended as a 128 bit.
3731
3732 @item Z
3733 An immediate for the @code{iohl} instruction. const_int is sign extended to 128 bit.
3734 3731
3735 @end table 3732 @end table
3736 3733
3737 @item TI C6X family---@file{config/c6x/constraints.md} 3734 @item TI C6X family---@file{config/c6x/constraints.md}
3738 @table @code 3735 @table @code
4093 @item u 4090 @item u
4094 Second from top of 80387 floating-point stack (@code{%st(1)}). 4091 Second from top of 80387 floating-point stack (@code{%st(1)}).
4095 4092
4096 @ifset INTERNALS 4093 @ifset INTERNALS
4097 @item Yk 4094 @item Yk
4098 Any mask register that can be used as a predicate, i.e. @code{k1-k7}. 4095 Any mask register that can be used as a predicate, i.e.@: @code{k1-k7}.
4099 4096
4100 @item k 4097 @item k
4101 Any mask register. 4098 Any mask register.
4102 @end ifset 4099 @end ifset
4103 4100
4556 @code{define_constraint}. 4553 @code{define_constraint}.
4557 @end deffn 4554 @end deffn
4558 4555
4559 @deffn {MD Expression} define_special_memory_constraint name docstring exp 4556 @deffn {MD Expression} define_special_memory_constraint name docstring exp
4560 Use this expression for constraints that match a subset of all memory 4557 Use this expression for constraints that match a subset of all memory
4561 operands: that is, @code{reload} can not make them match by reloading 4558 operands: that is, @code{reload} cannot make them match by reloading
4562 the address as it is described for @code{define_memory_constraint} or 4559 the address as it is described for @code{define_memory_constraint} or
4563 such address reload is undesirable with the performance point of view. 4560 such address reload is undesirable with the performance point of view.
4564 4561
4565 For example, @code{define_special_memory_constraint} can be useful if 4562 For example, @code{define_special_memory_constraint} can be useful if
4566 specifically aligned memory is necessary or desirable for some insn 4563 specifically aligned memory is necessary or desirable for some insn
4955 operand0[j * c + i] = operand1[i][j]; 4952 operand0[j * c + i] = operand1[i][j];
4956 @end smallexample 4953 @end smallexample
4957 4954
4958 This pattern is not allowed to @code{FAIL}. 4955 This pattern is not allowed to @code{FAIL}.
4959 4956
4960 @cindex @code{gather_load@var{m}} instruction pattern 4957 @cindex @code{gather_load@var{m}@var{n}} instruction pattern
4961 @item @samp{gather_load@var{m}} 4958 @item @samp{gather_load@var{m}@var{n}}
4962 Load several separate memory locations into a vector of mode @var{m}. 4959 Load several separate memory locations into a vector of mode @var{m}.
4963 Operand 1 is a scalar base address and operand 2 is a vector of 4960 Operand 1 is a scalar base address and operand 2 is a vector of mode @var{n}
4964 offsets from that base. Operand 0 is a destination vector with the 4961 containing offsets from that base. Operand 0 is a destination vector with
4965 same number of elements as the offset. For each element index @var{i}: 4962 the same number of elements as @var{n}. For each element index @var{i}:
4966 4963
4967 @itemize @bullet 4964 @itemize @bullet
4968 @item 4965 @item
4969 extend the offset element @var{i} to address width, using zero 4966 extend the offset element @var{i} to address width, using zero
4970 extension if operand 3 is 1 and sign extension if operand 3 is zero; 4967 extension if operand 3 is 1 and sign extension if operand 3 is zero;
4977 @end itemize 4974 @end itemize
4978 4975
4979 The value of operand 3 does not matter if the offsets are already 4976 The value of operand 3 does not matter if the offsets are already
4980 address width. 4977 address width.
4981 4978
4982 @cindex @code{mask_gather_load@var{m}} instruction pattern 4979 @cindex @code{mask_gather_load@var{m}@var{n}} instruction pattern
4983 @item @samp{mask_gather_load@var{m}} 4980 @item @samp{mask_gather_load@var{m}@var{n}}
4984 Like @samp{gather_load@var{m}}, but takes an extra mask operand as 4981 Like @samp{gather_load@var{m}@var{n}}, but takes an extra mask operand as
4985 operand 5. Bit @var{i} of the mask is set if element @var{i} 4982 operand 5. Bit @var{i} of the mask is set if element @var{i}
4986 of the result should be loaded from memory and clear if element @var{i} 4983 of the result should be loaded from memory and clear if element @var{i}
4987 of the result should be set to zero. 4984 of the result should be set to zero.
4988 4985
4989 @cindex @code{scatter_store@var{m}} instruction pattern 4986 @cindex @code{scatter_store@var{m}@var{n}} instruction pattern
4990 @item @samp{scatter_store@var{m}} 4987 @item @samp{scatter_store@var{m}@var{n}}
4991 Store a vector of mode @var{m} into several distinct memory locations. 4988 Store a vector of mode @var{m} into several distinct memory locations.
4992 Operand 0 is a scalar base address and operand 1 is a vector of offsets 4989 Operand 0 is a scalar base address and operand 1 is a vector of mode
4993 from that base. Operand 4 is the vector of values that should be stored, 4990 @var{n} containing offsets from that base. Operand 4 is the vector of
4994 which has the same number of elements as the offset. For each element 4991 values that should be stored, which has the same number of elements as
4995 index @var{i}: 4992 @var{n}. For each element index @var{i}:
4996 4993
4997 @itemize @bullet 4994 @itemize @bullet
4998 @item 4995 @item
4999 extend the offset element @var{i} to address width, using zero 4996 extend the offset element @var{i} to address width, using zero
5000 extension if operand 2 is 1 and sign extension if operand 2 is zero; 4997 extension if operand 2 is 1 and sign extension if operand 2 is zero;
5007 @end itemize 5004 @end itemize
5008 5005
5009 The value of operand 2 does not matter if the offsets are already 5006 The value of operand 2 does not matter if the offsets are already
5010 address width. 5007 address width.
5011 5008
5012 @cindex @code{mask_scatter_store@var{m}} instruction pattern 5009 @cindex @code{mask_scatter_store@var{m}@var{n}} instruction pattern
5013 @item @samp{mask_scatter_store@var{m}} 5010 @item @samp{mask_scatter_store@var{m}@var{n}}
5014 Like @samp{scatter_store@var{m}}, but takes an extra mask operand as 5011 Like @samp{scatter_store@var{m}@var{n}}, but takes an extra mask operand as
5015 operand 5. Bit @var{i} of the mask is set if element @var{i} 5012 operand 5. Bit @var{i} of the mask is set if element @var{i}
5016 of the result should be stored to memory. 5013 of the result should be stored to memory.
5017 5014
5018 @cindex @code{vec_set@var{m}} instruction pattern 5015 @cindex @code{vec_set@var{m}} instruction pattern
5019 @item @samp{vec_set@var{m}} 5016 @item @samp{vec_set@var{m}}
5070 5067
5071 @smallexample 5068 @smallexample
5072 operand0[0] = operand1 < operand2; 5069 operand0[0] = operand1 < operand2;
5073 for (i = 1; i < GET_MODE_NUNITS (@var{n}); i++) 5070 for (i = 1; i < GET_MODE_NUNITS (@var{n}); i++)
5074 operand0[i] = operand0[i - 1] && (operand1 + i < operand2); 5071 operand0[i] = operand0[i - 1] && (operand1 + i < operand2);
5072 @end smallexample
5073
5074 @cindex @code{check_raw_ptrs@var{m}} instruction pattern
5075 @item @samp{check_raw_ptrs@var{m}}
5076 Check whether, given two pointers @var{a} and @var{b} and a length @var{len},
5077 a write of @var{len} bytes at @var{a} followed by a read of @var{len} bytes
5078 at @var{b} can be split into interleaved byte accesses
5079 @samp{@var{a}[0], @var{b}[0], @var{a}[1], @var{b}[1], @dots{}}
5080 without affecting the dependencies between the bytes. Set operand 0
5081 to true if the split is possible and false otherwise.
5082
5083 Operands 1, 2 and 3 provide the values of @var{a}, @var{b} and @var{len}
5084 respectively. Operand 4 is a constant integer that provides the known
5085 common alignment of @var{a} and @var{b}. All inputs have mode @var{m}.
5086
5087 This split is possible if:
5088
5089 @smallexample
5090 @var{a} == @var{b} || @var{a} + @var{len} <= @var{b} || @var{b} + @var{len} <= @var{a}
5091 @end smallexample
5092
5093 You should only define this pattern if the target has a way of accelerating
5094 the test without having to do the individual comparisons.
5095
5096 @cindex @code{check_war_ptrs@var{m}} instruction pattern
5097 @item @samp{check_war_ptrs@var{m}}
5098 Like @samp{check_raw_ptrs@var{m}}, but with the read and write swapped round.
5099 The split is possible in this case if:
5100
5101 @smallexample
5102 @var{b} <= @var{a} || @var{a} + @var{len} <= @var{b}
5075 @end smallexample 5103 @end smallexample
5076 5104
5077 @cindex @code{vec_cmp@var{m}@var{n}} instruction pattern 5105 @cindex @code{vec_cmp@var{m}@var{n}} instruction pattern
5078 @item @samp{vec_cmp@var{m}@var{n}} 5106 @item @samp{vec_cmp@var{m}@var{n}}
5079 Output a vector comparison. Operand 0 of mode @var{n} is the destination for 5107 Output a vector comparison. Operand 0 of mode @var{n} is the destination for
5232 Like @code{add@var{m}3} but is guaranteed to only be used for address 5260 Like @code{add@var{m}3} but is guaranteed to only be used for address
5233 calculations. The expanded code is not allowed to clobber the 5261 calculations. The expanded code is not allowed to clobber the
5234 condition code. It only needs to be defined if @code{add@var{m}3} 5262 condition code. It only needs to be defined if @code{add@var{m}3}
5235 sets the condition code. If adds used for address calculations and 5263 sets the condition code. If adds used for address calculations and
5236 normal adds are not compatible it is required to expand a distinct 5264 normal adds are not compatible it is required to expand a distinct
5237 pattern (e.g. using an unspec). The pattern is used by LRA to emit 5265 pattern (e.g.@: using an unspec). The pattern is used by LRA to emit
5238 address calculations. @code{add@var{m}3} is used if 5266 address calculations. @code{add@var{m}3} is used if
5239 @code{addptr@var{m}3} is not defined. 5267 @code{addptr@var{m}3} is not defined.
5240 5268
5241 @cindex @code{fma@var{m}4} instruction pattern 5269 @cindex @code{fma@var{m}4} instruction pattern
5242 @item @samp{fma@var{m}4} 5270 @item @samp{fma@var{m}4}
5349 operand 2. Store the result in scalar operand 0. The vector has 5377 operand 2. Store the result in scalar operand 0. The vector has
5350 mode @var{m} and the scalars have the mode appropriate for one 5378 mode @var{m} and the scalars have the mode appropriate for one
5351 element of @var{m}. The operation is strictly in-order: there is 5379 element of @var{m}. The operation is strictly in-order: there is
5352 no reassociation. 5380 no reassociation.
5353 5381
5382 @cindex @code{mask_fold_left_plus_@var{m}} instruction pattern
5383 @item @code{mask_fold_left_plus_@var{m}}
5384 Like @samp{fold_left_plus_@var{m}}, but takes an additional mask operand
5385 (operand 3) that specifies which elements of the source vector should be added.
5386
5354 @cindex @code{sdot_prod@var{m}} instruction pattern 5387 @cindex @code{sdot_prod@var{m}} instruction pattern
5355 @item @samp{sdot_prod@var{m}} 5388 @item @samp{sdot_prod@var{m}}
5356 @cindex @code{udot_prod@var{m}} instruction pattern 5389 @cindex @code{udot_prod@var{m}} instruction pattern
5357 @itemx @samp{udot_prod@var{m}} 5390 @itemx @samp{udot_prod@var{m}}
5358 Compute the sum of the products of two signed/unsigned elements. 5391 Compute the sum of the products of two signed/unsigned elements.
5378 Operands 0 and 2 are of the same mode, which is wider than the mode of 5411 Operands 0 and 2 are of the same mode, which is wider than the mode of
5379 operand 1. Add operand 1 to operand 2 and place the widened result in 5412 operand 1. Add operand 1 to operand 2 and place the widened result in
5380 operand 0. (This is used express accumulation of elements into an accumulator 5413 operand 0. (This is used express accumulation of elements into an accumulator
5381 of a wider mode.) 5414 of a wider mode.)
5382 5415
5416 @cindex @code{smulhs@var{m3}} instruction pattern
5417 @item @samp{smulhs@var{m3}}
5418 @cindex @code{umulhs@var{m3}} instruction pattern
5419 @itemx @samp{umulhs@var{m3}}
5420 Signed/unsigned multiply high with scale. This is equivalent to the C code:
5421 @smallexample
5422 narrow op0, op1, op2;
5423 @dots{}
5424 op0 = (narrow) (((wide) op1 * (wide) op2) >> (N / 2 - 1));
5425 @end smallexample
5426 where the sign of @samp{narrow} determines whether this is a signed
5427 or unsigned operation, and @var{N} is the size of @samp{wide} in bits.
5428
5429 @cindex @code{smulhrs@var{m3}} instruction pattern
5430 @item @samp{smulhrs@var{m3}}
5431 @cindex @code{umulhrs@var{m3}} instruction pattern
5432 @itemx @samp{umulhrs@var{m3}}
5433 Signed/unsigned multiply high with round and scale. This is
5434 equivalent to the C code:
5435 @smallexample
5436 narrow op0, op1, op2;
5437 @dots{}
5438 op0 = (narrow) (((((wide) op1 * (wide) op2) >> (N / 2 - 2)) + 1) >> 1);
5439 @end smallexample
5440 where the sign of @samp{narrow} determines whether this is a signed
5441 or unsigned operation, and @var{N} is the size of @samp{wide} in bits.
5442
5443 @cindex @code{sdiv_pow2@var{m3}} instruction pattern
5444 @item @samp{sdiv_pow2@var{m3}}
5445 @cindex @code{sdiv_pow2@var{m3}} instruction pattern
5446 @itemx @samp{sdiv_pow2@var{m3}}
5447 Signed division by power-of-2 immediate. Equivalent to:
5448 @smallexample
5449 signed op0, op1;
5450 @dots{}
5451 op0 = op1 / (1 << imm);
5452 @end smallexample
5453
5383 @cindex @code{vec_shl_insert_@var{m}} instruction pattern 5454 @cindex @code{vec_shl_insert_@var{m}} instruction pattern
5384 @item @samp{vec_shl_insert_@var{m}} 5455 @item @samp{vec_shl_insert_@var{m}}
5385 Shift the elements in vector input operand 1 left one element (i.e. 5456 Shift the elements in vector input operand 1 left one element (i.e.@:
5386 away from element 0) and fill the vacated element 0 with the scalar 5457 away from element 0) and fill the vacated element 0 with the scalar
5387 in operand 2. Store the result in vector output operand 0. Operands 5458 in operand 2. Store the result in vector output operand 0. Operands
5388 0 and 1 have mode @var{m} and operand 2 has the mode appropriate for 5459 0 and 1 have mode @var{m} and operand 2 has the mode appropriate for
5389 one element of @var{m}. 5460 one element of @var{m}.
5390 5461
5462 @cindex @code{vec_shl_@var{m}} instruction pattern
5463 @item @samp{vec_shl_@var{m}}
5464 Whole vector left shift in bits, i.e.@: away from element 0.
5465 Operand 1 is a vector to be shifted.
5466 Operand 2 is an integer shift amount in bits.
5467 Operand 0 is where the resulting shifted vector is stored.
5468 The output and input vectors should have the same modes.
5469
5391 @cindex @code{vec_shr_@var{m}} instruction pattern 5470 @cindex @code{vec_shr_@var{m}} instruction pattern
5392 @item @samp{vec_shr_@var{m}} 5471 @item @samp{vec_shr_@var{m}}
5393 Whole vector right shift in bits, i.e. towards element 0. 5472 Whole vector right shift in bits, i.e.@: towards element 0.
5394 Operand 1 is a vector to be shifted. 5473 Operand 1 is a vector to be shifted.
5395 Operand 2 is an integer shift amount in bits. 5474 Operand 2 is an integer shift amount in bits.
5396 Operand 0 is where the resulting shifted vector is stored. 5475 Operand 0 is where the resulting shifted vector is stored.
5397 The output and input vectors should have the same modes. 5476 The output and input vectors should have the same modes.
5398 5477
5399 @cindex @code{vec_pack_trunc_@var{m}} instruction pattern 5478 @cindex @code{vec_pack_trunc_@var{m}} instruction pattern
5400 @item @samp{vec_pack_trunc_@var{m}} 5479 @item @samp{vec_pack_trunc_@var{m}}
5401 Narrow (demote) and merge the elements of two vectors. Operands 1 and 2 5480 Narrow (demote) and merge the elements of two vectors. Operands 1 and 2
5402 are vectors of the same mode having N integral or floating point elements 5481 are vectors of the same mode having N integral or floating point elements
5403 of size S@. Operand 0 is the resulting vector in which 2*N elements of 5482 of size S@. Operand 0 is the resulting vector in which 2*N elements of
5404 size N/2 are concatenated after narrowing them down using truncation. 5483 size S/2 are concatenated after narrowing them down using truncation.
5484
5485 @cindex @code{vec_pack_sbool_trunc_@var{m}} instruction pattern
5486 @item @samp{vec_pack_sbool_trunc_@var{m}}
5487 Narrow and merge the elements of two vectors. Operands 1 and 2 are vectors
5488 of the same type having N boolean elements. Operand 0 is the resulting
5489 vector in which 2*N elements are concatenated. The last operand (operand 3)
5490 is the number of elements in the output vector 2*N as a @code{CONST_INT}.
5491 This instruction pattern is used when all the vector input and output
5492 operands have the same scalar mode @var{m} and thus using
5493 @code{vec_pack_trunc_@var{m}} would be ambiguous.
5405 5494
5406 @cindex @code{vec_pack_ssat_@var{m}} instruction pattern 5495 @cindex @code{vec_pack_ssat_@var{m}} instruction pattern
5407 @cindex @code{vec_pack_usat_@var{m}} instruction pattern 5496 @cindex @code{vec_pack_usat_@var{m}} instruction pattern
5408 @item @samp{vec_pack_ssat_@var{m}}, @samp{vec_pack_usat_@var{m}} 5497 @item @samp{vec_pack_ssat_@var{m}}, @samp{vec_pack_usat_@var{m}}
5409 Narrow (demote) and merge the elements of two vectors. Operands 1 and 2 5498 Narrow (demote) and merge the elements of two vectors. Operands 1 and 2
5416 @cindex @code{vec_pack_ufix_trunc_@var{m}} instruction pattern 5505 @cindex @code{vec_pack_ufix_trunc_@var{m}} instruction pattern
5417 @item @samp{vec_pack_sfix_trunc_@var{m}}, @samp{vec_pack_ufix_trunc_@var{m}} 5506 @item @samp{vec_pack_sfix_trunc_@var{m}}, @samp{vec_pack_ufix_trunc_@var{m}}
5418 Narrow, convert to signed/unsigned integral type and merge the elements 5507 Narrow, convert to signed/unsigned integral type and merge the elements
5419 of two vectors. Operands 1 and 2 are vectors of the same mode having N 5508 of two vectors. Operands 1 and 2 are vectors of the same mode having N
5420 floating point elements of size S@. Operand 0 is the resulting vector 5509 floating point elements of size S@. Operand 0 is the resulting vector
5421 in which 2*N elements of size N/2 are concatenated. 5510 in which 2*N elements of size S/2 are concatenated.
5422 5511
5423 @cindex @code{vec_packs_float_@var{m}} instruction pattern 5512 @cindex @code{vec_packs_float_@var{m}} instruction pattern
5424 @cindex @code{vec_packu_float_@var{m}} instruction pattern 5513 @cindex @code{vec_packu_float_@var{m}} instruction pattern
5425 @item @samp{vec_packs_float_@var{m}}, @samp{vec_packu_float_@var{m}} 5514 @item @samp{vec_packs_float_@var{m}}, @samp{vec_packu_float_@var{m}}
5426 Narrow, convert to floating point type and merge the elements 5515 Narrow, convert to floating point type and merge the elements
5427 of two vectors. Operands 1 and 2 are vectors of the same mode having N 5516 of two vectors. Operands 1 and 2 are vectors of the same mode having N
5428 signed/unsigned integral elements of size S@. Operand 0 is the resulting vector 5517 signed/unsigned integral elements of size S@. Operand 0 is the resulting vector
5429 in which 2*N elements of size N/2 are concatenated. 5518 in which 2*N elements of size S/2 are concatenated.
5430 5519
5431 @cindex @code{vec_unpacks_hi_@var{m}} instruction pattern 5520 @cindex @code{vec_unpacks_hi_@var{m}} instruction pattern
5432 @cindex @code{vec_unpacks_lo_@var{m}} instruction pattern 5521 @cindex @code{vec_unpacks_lo_@var{m}} instruction pattern
5433 @item @samp{vec_unpacks_hi_@var{m}}, @samp{vec_unpacks_lo_@var{m}} 5522 @item @samp{vec_unpacks_hi_@var{m}}, @samp{vec_unpacks_lo_@var{m}}
5434 Extract and widen (promote) the high/low part of a vector of signed 5523 Extract and widen (promote) the high/low part of a vector of signed
5442 @item @samp{vec_unpacku_hi_@var{m}}, @samp{vec_unpacku_lo_@var{m}} 5531 @item @samp{vec_unpacku_hi_@var{m}}, @samp{vec_unpacku_lo_@var{m}}
5443 Extract and widen (promote) the high/low part of a vector of unsigned 5532 Extract and widen (promote) the high/low part of a vector of unsigned
5444 integral elements. The input vector (operand 1) has N elements of size S. 5533 integral elements. The input vector (operand 1) has N elements of size S.
5445 Widen (promote) the high/low elements of the vector using zero extension and 5534 Widen (promote) the high/low elements of the vector using zero extension and
5446 place the resulting N/2 values of size 2*S in the output vector (operand 0). 5535 place the resulting N/2 values of size 2*S in the output vector (operand 0).
5536
5537 @cindex @code{vec_unpacks_sbool_hi_@var{m}} instruction pattern
5538 @cindex @code{vec_unpacks_sbool_lo_@var{m}} instruction pattern
5539 @item @samp{vec_unpacks_sbool_hi_@var{m}}, @samp{vec_unpacks_sbool_lo_@var{m}}
5540 Extract the high/low part of a vector of boolean elements that have scalar
5541 mode @var{m}. The input vector (operand 1) has N elements, the output
5542 vector (operand 0) has N/2 elements. The last operand (operand 2) is the
5543 number of elements of the input vector N as a @code{CONST_INT}. These
5544 patterns are used if both the input and output vectors have the same scalar
5545 mode @var{m} and thus using @code{vec_unpacks_hi_@var{m}} or
5546 @code{vec_unpacks_lo_@var{m}} would be ambiguous.
5447 5547
5448 @cindex @code{vec_unpacks_float_hi_@var{m}} instruction pattern 5548 @cindex @code{vec_unpacks_float_hi_@var{m}} instruction pattern
5449 @cindex @code{vec_unpacks_float_lo_@var{m}} instruction pattern 5549 @cindex @code{vec_unpacks_float_lo_@var{m}} instruction pattern
5450 @cindex @code{vec_unpacku_float_hi_@var{m}} instruction pattern 5550 @cindex @code{vec_unpacku_float_hi_@var{m}} instruction pattern
5451 @cindex @code{vec_unpacku_float_lo_@var{m}} instruction pattern 5551 @cindex @code{vec_unpacku_float_lo_@var{m}} instruction pattern
5995 2 into operand 0. All operands have mode @var{m}, which is a scalar or 6095 2 into operand 0. All operands have mode @var{m}, which is a scalar or
5996 vector floating-point mode. 6096 vector floating-point mode.
5997 6097
5998 This pattern is not allowed to @code{FAIL}. 6098 This pattern is not allowed to @code{FAIL}.
5999 6099
6100 @cindex @code{xorsign@var{m}3} instruction pattern
6101 @item @samp{xorsign@var{m}3}
6102 Equivalent to @samp{op0 = op1 * copysign (1.0, op2)}: store a value with
6103 the magnitude of operand 1 and the sign of operand 2 into operand 0.
6104 All operands have mode @var{m}, which is a scalar or vector
6105 floating-point mode.
6106
6107 This pattern is not allowed to @code{FAIL}.
6108
6000 @cindex @code{ffs@var{m}2} instruction pattern 6109 @cindex @code{ffs@var{m}2} instruction pattern
6001 @item @samp{ffs@var{m}2} 6110 @item @samp{ffs@var{m}2}
6002 Store into operand 0 one plus the index of the least significant 1-bit 6111 Store into operand 0 one plus the index of the least significant 1-bit
6003 of operand 1. If operand 1 is zero, store zero. 6112 of operand 1. If operand 1 is zero, store zero.
6004 6113
6089 6198
6090 @cindex @code{one_cmpl@var{m}2} instruction pattern 6199 @cindex @code{one_cmpl@var{m}2} instruction pattern
6091 @item @samp{one_cmpl@var{m}2} 6200 @item @samp{one_cmpl@var{m}2}
6092 Store the bitwise-complement of operand 1 into operand 0. 6201 Store the bitwise-complement of operand 1 into operand 0.
6093 6202
6094 @cindex @code{movmem@var{m}} instruction pattern 6203 @cindex @code{cpymem@var{m}} instruction pattern
6095 @item @samp{movmem@var{m}} 6204 @item @samp{cpymem@var{m}}
6096 Block move instruction. The destination and source blocks of memory 6205 Block copy instruction. The destination and source blocks of memory
6097 are the first two operands, and both are @code{mem:BLK}s with an 6206 are the first two operands, and both are @code{mem:BLK}s with an
6098 address in mode @code{Pmode}. 6207 address in mode @code{Pmode}.
6099 6208
6100 The number of bytes to move is the third operand, in mode @var{m}. 6209 The number of bytes to copy is the third operand, in mode @var{m}.
6101 Usually, you specify @code{Pmode} for @var{m}. However, if you can 6210 Usually, you specify @code{Pmode} for @var{m}. However, if you can
6102 generate better code knowing the range of valid lengths is smaller than 6211 generate better code knowing the range of valid lengths is smaller than
6103 those representable in a full Pmode pointer, you should provide 6212 those representable in a full Pmode pointer, you should provide
6104 a pattern with a 6213 a pattern with a
6105 mode corresponding to the range of values you can handle efficiently 6214 mode corresponding to the range of values you can handle efficiently
6115 respectively. The expected alignment differs from alignment in operand 4 6224 respectively. The expected alignment differs from alignment in operand 4
6116 in a way that the blocks are not required to be aligned according to it in 6225 in a way that the blocks are not required to be aligned according to it in
6117 all cases. This expected alignment is also in bytes, just like operand 4. 6226 all cases. This expected alignment is also in bytes, just like operand 4.
6118 Expected size, when unknown, is set to @code{(const_int -1)}. 6227 Expected size, when unknown, is set to @code{(const_int -1)}.
6119 6228
6229 Descriptions of multiple @code{cpymem@var{m}} patterns can only be
6230 beneficial if the patterns for smaller modes have fewer restrictions
6231 on their first, second and fourth operands. Note that the mode @var{m}
6232 in @code{cpymem@var{m}} does not impose any restriction on the mode of
6233 individually copied data units in the block.
6234
6235 The @code{cpymem@var{m}} patterns need not give special consideration
6236 to the possibility that the source and destination strings might
6237 overlap. These patterns are used to do inline expansion of
6238 @code{__builtin_memcpy}.
6239
6240 @cindex @code{movmem@var{m}} instruction pattern
6241 @item @samp{movmem@var{m}}
6242 Block move instruction. The destination and source blocks of memory
6243 are the first two operands, and both are @code{mem:BLK}s with an
6244 address in mode @code{Pmode}.
6245
6246 The number of bytes to copy is the third operand, in mode @var{m}.
6247 Usually, you specify @code{Pmode} for @var{m}. However, if you can
6248 generate better code knowing the range of valid lengths is smaller than
6249 those representable in a full Pmode pointer, you should provide
6250 a pattern with a
6251 mode corresponding to the range of values you can handle efficiently
6252 (e.g., @code{QImode} for values in the range 0--127; note we avoid numbers
6253 that appear negative) and also a pattern with @code{Pmode}.
6254
6255 The fourth operand is the known shared alignment of the source and
6256 destination, in the form of a @code{const_int} rtx. Thus, if the
6257 compiler knows that both source and destination are word-aligned,
6258 it may provide the value 4 for this operand.
6259
6260 Optional operands 5 and 6 specify expected alignment and size of block
6261 respectively. The expected alignment differs from alignment in operand 4
6262 in a way that the blocks are not required to be aligned according to it in
6263 all cases. This expected alignment is also in bytes, just like operand 4.
6264 Expected size, when unknown, is set to @code{(const_int -1)}.
6265
6120 Descriptions of multiple @code{movmem@var{m}} patterns can only be 6266 Descriptions of multiple @code{movmem@var{m}} patterns can only be
6121 beneficial if the patterns for smaller modes have fewer restrictions 6267 beneficial if the patterns for smaller modes have fewer restrictions
6122 on their first, second and fourth operands. Note that the mode @var{m} 6268 on their first, second and fourth operands. Note that the mode @var{m}
6123 in @code{movmem@var{m}} does not impose any restriction on the mode of 6269 in @code{movmem@var{m}} does not impose any restriction on the mode of
6124 individually moved data units in the block. 6270 individually copied data units in the block.
6125 6271
6126 These patterns need not give special consideration to the possibility 6272 The @code{movmem@var{m}} patterns must correctly handle the case where
6127 that the source and destination strings might overlap. 6273 the source and destination strings overlap. These patterns are used to
6274 do inline expansion of @code{__builtin_memmove}.
6128 6275
6129 @cindex @code{movstr} instruction pattern 6276 @cindex @code{movstr} instruction pattern
6130 @item @samp{movstr} 6277 @item @samp{movstr}
6131 String copy instruction, with @code{stpcpy} semantics. Operand 0 is 6278 String copy instruction, with @code{stpcpy} semantics. Operand 0 is
6132 an output operand in mode @code{Pmode}. The addresses of the 6279 an output operand in mode @code{Pmode}. The addresses of the
6133 destination and source strings are operands 1 and 2, and both are 6280 destination and source strings are operands 1 and 2, and both are
6134 @code{mem:BLK}s with addresses in mode @code{Pmode}. The execution of 6281 @code{mem:BLK}s with addresses in mode @code{Pmode}. The execution of
6135 the expansion of this pattern should store in operand 0 the address in 6282 the expansion of this pattern should store in operand 0 the address in
6136 which the @code{NUL} terminator was stored in the destination string. 6283 which the @code{NUL} terminator was stored in the destination string.
6137 6284
6138 This patern has also several optional operands that are same as in 6285 This pattern has also several optional operands that are same as in
6139 @code{setmem}. 6286 @code{setmem}.
6140 6287
6141 @cindex @code{setmem@var{m}} instruction pattern 6288 @cindex @code{setmem@var{m}} instruction pattern
6142 @item @samp{setmem@var{m}} 6289 @item @samp{setmem@var{m}}
6143 Block set instruction. The destination string is the first operand, 6290 Block set instruction. The destination string is the first operand,
6144 given as a @code{mem:BLK} whose address is in mode @code{Pmode}. The 6291 given as a @code{mem:BLK} whose address is in mode @code{Pmode}. The
6145 number of bytes to set is the second operand, in mode @var{m}. The value to 6292 number of bytes to set is the second operand, in mode @var{m}. The value to
6146 initialize the memory with is the third operand. Targets that only support the 6293 initialize the memory with is the third operand. Targets that only support the
6147 clearing of memory should reject any value that is not the constant 0. See 6294 clearing of memory should reject any value that is not the constant 0. See
6148 @samp{movmem@var{m}} for a discussion of the choice of mode. 6295 @samp{cpymem@var{m}} for a discussion of the choice of mode.
6149 6296
6150 The fourth operand is the known alignment of the destination, in the form 6297 The fourth operand is the known alignment of the destination, in the form
6151 of a @code{const_int} rtx. Thus, if the compiler knows that the 6298 of a @code{const_int} rtx. Thus, if the compiler knows that the
6152 destination is word-aligned, it may provide the value 4 for this 6299 destination is word-aligned, it may provide the value 4 for this
6153 operand. 6300 operand.
6156 respectively. The expected alignment differs from alignment in operand 4 6303 respectively. The expected alignment differs from alignment in operand 4
6157 in a way that the blocks are not required to be aligned according to it in 6304 in a way that the blocks are not required to be aligned according to it in
6158 all cases. This expected alignment is also in bytes, just like operand 4. 6305 all cases. This expected alignment is also in bytes, just like operand 4.
6159 Expected size, when unknown, is set to @code{(const_int -1)}. 6306 Expected size, when unknown, is set to @code{(const_int -1)}.
6160 Operand 7 is the minimal size of the block and operand 8 is the 6307 Operand 7 is the minimal size of the block and operand 8 is the
6161 maximal size of the block (NULL if it can not be represented as CONST_INT). 6308 maximal size of the block (NULL if it cannot be represented as CONST_INT).
6162 Operand 9 is the probable maximal size (i.e. we can not rely on it for correctness, 6309 Operand 9 is the probable maximal size (i.e.@: we cannot rely on it for
6163 but it can be used for choosing proper code sequence for a given size). 6310 correctness, but it can be used for choosing proper code sequence for a
6164 6311 given size).
6165 The use for multiple @code{setmem@var{m}} is as for @code{movmem@var{m}}. 6312
6313 The use for multiple @code{setmem@var{m}} is as for @code{cpymem@var{m}}.
6166 6314
6167 @cindex @code{cmpstrn@var{m}} instruction pattern 6315 @cindex @code{cmpstrn@var{m}} instruction pattern
6168 @item @samp{cmpstrn@var{m}} 6316 @item @samp{cmpstrn@var{m}}
6169 String compare instruction, with five operands. Operand 0 is the output; 6317 String compare instruction, with five operands. Operand 0 is the output;
6170 it has mode @var{m}. The remaining four operands are like the operands 6318 it has mode @var{m}. The remaining four operands are like the operands
6171 of @samp{movmem@var{m}}. The two memory blocks specified are compared 6319 of @samp{cpymem@var{m}}. The two memory blocks specified are compared
6172 byte by byte in lexicographic order starting at the beginning of each 6320 byte by byte in lexicographic order starting at the beginning of each
6173 string. The instruction is not allowed to prefetch more than one byte 6321 string. The instruction is not allowed to prefetch more than one byte
6174 at a time since either string may end in the first byte and reading past 6322 at a time since either string may end in the first byte and reading past
6175 that may access an invalid page or segment and cause a fault. The 6323 that may access an invalid page or segment and cause a fault. The
6176 comparison terminates early if the fetched bytes are different or if 6324 comparison terminates early if the fetched bytes are different or if
6476 @end smallexample 6624 @end smallexample
6477 6625
6478 where, for example, @var{op} is @code{+} for @samp{cond_add@var{mode}}. 6626 where, for example, @var{op} is @code{+} for @samp{cond_add@var{mode}}.
6479 6627
6480 When defined for floating-point modes, the contents of @samp{op3[i]} 6628 When defined for floating-point modes, the contents of @samp{op3[i]}
6481 are not interpreted if @var{op1[i]} is false, just like they would not 6629 are not interpreted if @samp{op1[i]} is false, just like they would not
6482 be in a normal C @samp{?:} condition. 6630 be in a normal C @samp{?:} condition.
6483 6631
6484 Operands 0, 2, 3 and 4 all have mode @var{m}. Operand 1 is a scalar 6632 Operands 0, 2, 3 and 4 all have mode @var{m}. Operand 1 is a scalar
6485 integer if @var{m} is scalar, otherwise it has the mode returned by 6633 integer if @var{m} is scalar, otherwise it has the mode returned by
6486 @code{TARGET_VECTORIZE_GET_MASK_MODE}. 6634 @code{TARGET_VECTORIZE_GET_MASK_MODE}.
7422 builtins. 7570 builtins.
7423 7571
7424 The get/set patterns have a single output/input operand respectively, 7572 The get/set patterns have a single output/input operand respectively,
7425 with @var{mode} intended to be @code{Pmode}. 7573 with @var{mode} intended to be @code{Pmode}.
7426 7574
7575 @cindex @code{stack_protect_combined_set} instruction pattern
7576 @item @samp{stack_protect_combined_set}
7577 This pattern, if defined, moves a @code{ptr_mode} value from an address
7578 whose declaration RTX is given in operand 1 to the memory in operand 0
7579 without leaving the value in a register afterward. If several
7580 instructions are needed by the target to perform the operation (eg. to
7581 load the address from a GOT entry then load the @code{ptr_mode} value
7582 and finally store it), it is the backend's responsibility to ensure no
7583 intermediate result gets spilled. This is to avoid leaking the value
7584 some place that an attacker might use to rewrite the stack guard slot
7585 after having clobbered it.
7586
7587 If this pattern is not defined, then the address declaration is
7588 expanded first in the standard way and a @code{stack_protect_set}
7589 pattern is then generated to move the value from that address to the
7590 address in operand 0.
7591
7427 @cindex @code{stack_protect_set} instruction pattern 7592 @cindex @code{stack_protect_set} instruction pattern
7428 @item @samp{stack_protect_set} 7593 @item @samp{stack_protect_set}
7429 This pattern, if defined, moves a @code{ptr_mode} value from the memory 7594 This pattern, if defined, moves a @code{ptr_mode} value from the valid
7430 in operand 1 to the memory in operand 0 without leaving the value in 7595 memory location in operand 1 to the memory in operand 0 without leaving
7431 a register afterward. This is to avoid leaking the value some place 7596 the value in a register afterward. This is to avoid leaking the value
7432 that an attacker might use to rewrite the stack guard slot after 7597 some place that an attacker might use to rewrite the stack guard slot
7433 having clobbered it. 7598 after having clobbered it.
7599
7600 Note: on targets where the addressing modes do not allow to load
7601 directly from stack guard address, the address is expanded in a standard
7602 way first which could cause some spills.
7434 7603
7435 If this pattern is not defined, then a plain move pattern is generated. 7604 If this pattern is not defined, then a plain move pattern is generated.
7605
7606 @cindex @code{stack_protect_combined_test} instruction pattern
7607 @item @samp{stack_protect_combined_test}
7608 This pattern, if defined, compares a @code{ptr_mode} value from an
7609 address whose declaration RTX is given in operand 1 with the memory in
7610 operand 0 without leaving the value in a register afterward and
7611 branches to operand 2 if the values were equal. If several
7612 instructions are needed by the target to perform the operation (eg. to
7613 load the address from a GOT entry then load the @code{ptr_mode} value
7614 and finally store it), it is the backend's responsibility to ensure no
7615 intermediate result gets spilled. This is to avoid leaking the value
7616 some place that an attacker might use to rewrite the stack guard slot
7617 after having clobbered it.
7618
7619 If this pattern is not defined, then the address declaration is
7620 expanded first in the standard way and a @code{stack_protect_test}
7621 pattern is then generated to compare the value from that address to the
7622 value at the memory in operand 0.
7436 7623
7437 @cindex @code{stack_protect_test} instruction pattern 7624 @cindex @code{stack_protect_test} instruction pattern
7438 @item @samp{stack_protect_test} 7625 @item @samp{stack_protect_test}
7439 This pattern, if defined, compares a @code{ptr_mode} value from the 7626 This pattern, if defined, compares a @code{ptr_mode} value from the
7440 memory in operand 1 with the memory in operand 0 without leaving the 7627 valid memory location in operand 1 with the memory in operand 0 without
7441 value in a register afterward and branches to operand 2 if the values 7628 leaving the value in a register afterward and branches to operand 2 if
7442 were equal. 7629 the values were equal.
7443 7630
7444 If this pattern is not defined, then a plain compare pattern and 7631 If this pattern is not defined, then a plain compare pattern and
7445 conditional branch pattern is used. 7632 conditional branch pattern is used.
7446 7633
7447 @cindex @code{clear_cache} instruction pattern 7634 @cindex @code{clear_cache} instruction pattern
7541 separating compares and branches is limiting, which is why the 7728 separating compares and branches is limiting, which is why the
7542 more flexible approach with one @code{define_expand} is used in GCC. 7729 more flexible approach with one @code{define_expand} is used in GCC.
7543 The machine description becomes clearer for architectures that 7730 The machine description becomes clearer for architectures that
7544 have compare-and-branch instructions but no condition code. It also 7731 have compare-and-branch instructions but no condition code. It also
7545 works better when different sets of comparison operators are supported 7732 works better when different sets of comparison operators are supported
7546 by different kinds of conditional branches (e.g. integer vs. floating-point), 7733 by different kinds of conditional branches (e.g.@: integer vs.@:
7547 or by conditional branches with respect to conditional stores. 7734 floating-point), or by conditional branches with respect to conditional stores.
7548 7735
7549 Two separate insns are always used if the machine description represents 7736 Two separate insns are always used if the machine description represents
7550 a condition code register using the legacy RTL expression @code{(cc0)}, 7737 a condition code register using the legacy RTL expression @code{(cc0)},
7551 and on most machines that use a separate condition code register 7738 and on most machines that use a separate condition code register
7552 (@pxref{Condition Code}). For machines that use @code{(cc0)}, in 7739 (@pxref{Condition Code}). For machines that use @code{(cc0)}, in
8208 When the combiner phase tries to split an insn pattern, it is always the 8395 When the combiner phase tries to split an insn pattern, it is always the
8209 case that the pattern is @emph{not} matched by any @code{define_insn}. 8396 case that the pattern is @emph{not} matched by any @code{define_insn}.
8210 The combiner pass first tries to split a single @code{set} expression 8397 The combiner pass first tries to split a single @code{set} expression
8211 and then the same @code{set} expression inside a @code{parallel}, but 8398 and then the same @code{set} expression inside a @code{parallel}, but
8212 followed by a @code{clobber} of a pseudo-reg to use as a scratch 8399 followed by a @code{clobber} of a pseudo-reg to use as a scratch
8213 register. In these cases, the combiner expects exactly two new insn 8400 register. In these cases, the combiner expects exactly one or two new insn
8214 patterns to be generated. It will verify that these patterns match some 8401 patterns to be generated. It will verify that these patterns match some
8215 @code{define_insn} definitions, so you need not do this test in the 8402 @code{define_insn} definitions, so you need not do this test in the
8216 @code{define_split} (of course, there is no point in writing a 8403 @code{define_split} (of course, there is no point in writing a
8217 @code{define_split} that will never produce insns that match). 8404 @code{define_split} that will never produce insns that match).
8218 8405
8345 8532
8346 The @code{define_insn_and_split} construction provides exactly the same 8533 The @code{define_insn_and_split} construction provides exactly the same
8347 functionality as two separate @code{define_insn} and @code{define_split} 8534 functionality as two separate @code{define_insn} and @code{define_split}
8348 patterns. It exists for compactness, and as a maintenance tool to prevent 8535 patterns. It exists for compactness, and as a maintenance tool to prevent
8349 having to ensure the two patterns' templates match. 8536 having to ensure the two patterns' templates match.
8537
8538 @findex define_insn_and_rewrite
8539 It is sometimes useful to have a @code{define_insn_and_split}
8540 that replaces specific operands of an instruction but leaves the
8541 rest of the instruction pattern unchanged. You can do this directly
8542 with a @code{define_insn_and_split}, but it requires a
8543 @var{new-insn-pattern-1} that repeats most of the original @var{insn-pattern}.
8544 There is also the complication that an implicit @code{parallel} in
8545 @var{insn-pattern} must become an explicit @code{parallel} in
8546 @var{new-insn-pattern-1}, which is easy to overlook.
8547 A simpler alternative is to use @code{define_insn_and_rewrite}, which
8548 is a form of @code{define_insn_and_split} that automatically generates
8549 @var{new-insn-pattern-1} by replacing each @code{match_operand}
8550 in @var{insn-pattern} with a corresponding @code{match_dup}, and each
8551 @code{match_operator} in the pattern with a corresponding @code{match_op_dup}.
8552 The arguments are otherwise identical to @code{define_insn_and_split}:
8553
8554 @smallexample
8555 (define_insn_and_rewrite
8556 [@var{insn-pattern}]
8557 "@var{condition}"
8558 "@var{output-template}"
8559 "@var{split-condition}"
8560 "@var{preparation-statements}"
8561 [@var{insn-attributes}])
8562 @end smallexample
8563
8564 The @code{match_dup}s and @code{match_op_dup}s in the new
8565 instruction pattern use any new operand values that the
8566 @var{preparation-statements} store in the @code{operands} array,
8567 as for a normal @code{define_insn_and_split}. @var{preparation-statements}
8568 can also emit additional instructions before the new instruction.
8569 They can even emit an entirely different sequence of instructions and
8570 use @code{DONE} to avoid emitting a new form of the original
8571 instruction.
8572
8573 The split in a @code{define_insn_and_rewrite} is only intended
8574 to apply to existing instructions that match @var{insn-pattern}.
8575 @var{split-condition} must therefore start with @code{&&},
8576 so that the split condition applies on top of @var{condition}.
8577
8578 Here is an example from the AArch64 SVE port, in which operand 1 is
8579 known to be equivalent to an all-true constant and isn't used by the
8580 output template:
8581
8582 @smallexample
8583 (define_insn_and_rewrite "*while_ult<GPI:mode><PRED_ALL:mode>_cc"
8584 [(set (reg:CC CC_REGNUM)
8585 (compare:CC
8586 (unspec:SI [(match_operand:PRED_ALL 1)
8587 (unspec:PRED_ALL
8588 [(match_operand:GPI 2 "aarch64_reg_or_zero" "rZ")
8589 (match_operand:GPI 3 "aarch64_reg_or_zero" "rZ")]
8590 UNSPEC_WHILE_LO)]
8591 UNSPEC_PTEST_PTRUE)
8592 (const_int 0)))
8593 (set (match_operand:PRED_ALL 0 "register_operand" "=Upa")
8594 (unspec:PRED_ALL [(match_dup 2)
8595 (match_dup 3)]
8596 UNSPEC_WHILE_LO))]
8597 "TARGET_SVE"
8598 "whilelo\t%0.<PRED_ALL:Vetype>, %<w>2, %<w>3"
8599 ;; Force the compiler to drop the unused predicate operand, so that we
8600 ;; don't have an unnecessary PTRUE.
8601 "&& !CONSTANT_P (operands[1])"
8602 @{
8603 operands[1] = CONSTM1_RTX (<MODE>mode);
8604 @}
8605 )
8606 @end smallexample
8607
8608 The splitter in this case simply replaces operand 1 with the constant
8609 value that it is known to have. The equivalent @code{define_insn_and_split}
8610 would be:
8611
8612 @smallexample
8613 (define_insn_and_split "*while_ult<GPI:mode><PRED_ALL:mode>_cc"
8614 [(set (reg:CC CC_REGNUM)
8615 (compare:CC
8616 (unspec:SI [(match_operand:PRED_ALL 1)
8617 (unspec:PRED_ALL
8618 [(match_operand:GPI 2 "aarch64_reg_or_zero" "rZ")
8619 (match_operand:GPI 3 "aarch64_reg_or_zero" "rZ")]
8620 UNSPEC_WHILE_LO)]
8621 UNSPEC_PTEST_PTRUE)
8622 (const_int 0)))
8623 (set (match_operand:PRED_ALL 0 "register_operand" "=Upa")
8624 (unspec:PRED_ALL [(match_dup 2)
8625 (match_dup 3)]
8626 UNSPEC_WHILE_LO))]
8627 "TARGET_SVE"
8628 "whilelo\t%0.<PRED_ALL:Vetype>, %<w>2, %<w>3"
8629 ;; Force the compiler to drop the unused predicate operand, so that we
8630 ;; don't have an unnecessary PTRUE.
8631 "&& !CONSTANT_P (operands[1])"
8632 [(parallel
8633 [(set (reg:CC CC_REGNUM)
8634 (compare:CC
8635 (unspec:SI [(match_dup 1)
8636 (unspec:PRED_ALL [(match_dup 2)
8637 (match_dup 3)]
8638 UNSPEC_WHILE_LO)]
8639 UNSPEC_PTEST_PTRUE)
8640 (const_int 0)))
8641 (set (match_dup 0)
8642 (unspec:PRED_ALL [(match_dup 2)
8643 (match_dup 3)]
8644 UNSPEC_WHILE_LO))])]
8645 @{
8646 operands[1] = CONSTM1_RTX (<MODE>mode);
8647 @}
8648 )
8649 @end smallexample
8350 8650
8351 @end ifset 8651 @end ifset
8352 @ifset INTERNALS 8652 @ifset INTERNALS
8353 @node Including Patterns 8653 @node Including Patterns
8354 @section Including Patterns in Machine Descriptions. 8654 @section Including Patterns in Machine Descriptions.
8879 alternatives of an insn definition from being used during code 9179 alternatives of an insn definition from being used during code
8880 generation. @xref{Disable Insn Alternatives}. 9180 generation. @xref{Disable Insn Alternatives}.
8881 9181
8882 @item mnemonic 9182 @item mnemonic
8883 The @code{mnemonic} attribute can be defined to implement instruction 9183 The @code{mnemonic} attribute can be defined to implement instruction
8884 specific checks in e.g. the pipeline description. 9184 specific checks in e.g.@: the pipeline description.
8885 @xref{Mnemonic Attribute}. 9185 @xref{Mnemonic Attribute}.
8886 @end table 9186 @end table
8887 9187
8888 For each of these special attributes, the corresponding 9188 For each of these special attributes, the corresponding
8889 @samp{HAVE_ATTR_@var{name}} @samp{#define} is also written when the 9189 @samp{HAVE_ATTR_@var{name}} @samp{#define} is also written when the
9804 @end smallexample 10104 @end smallexample
9805 10105
9806 @var{reservation-name} is a string giving name of @var{regexp}. 10106 @var{reservation-name} is a string giving name of @var{regexp}.
9807 Functional unit names and reservation names are in the same name 10107 Functional unit names and reservation names are in the same name
9808 space. So the reservation names should be different from the 10108 space. So the reservation names should be different from the
9809 functional unit names and can not be the reserved name @samp{nothing}. 10109 functional unit names and cannot be the reserved name @samp{nothing}.
9810 10110
9811 @findex define_bypass 10111 @findex define_bypass
9812 @cindex instruction latency time 10112 @cindex instruction latency time
9813 @cindex data bypass 10113 @cindex data bypass
9814 The following construction is used to describe exceptions in the 10114 The following construction is used to describe exceptions in the
9870 @var{patterns} is a string giving patterns of functional units 10170 @var{patterns} is a string giving patterns of functional units
9871 separated by comma. Currently pattern is one unit or units 10171 separated by comma. Currently pattern is one unit or units
9872 separated by white-spaces. 10172 separated by white-spaces.
9873 10173
9874 The first construction (@samp{exclusion_set}) means that each 10174 The first construction (@samp{exclusion_set}) means that each
9875 functional unit in the first string can not be reserved simultaneously 10175 functional unit in the first string cannot be reserved simultaneously
9876 with a unit whose name is in the second string and vice versa. For 10176 with a unit whose name is in the second string and vice versa. For
9877 example, the construction is useful for describing processors 10177 example, the construction is useful for describing processors
9878 (e.g.@: some SPARC processors) with a fully pipelined floating point 10178 (e.g.@: some SPARC processors) with a fully pipelined floating point
9879 functional unit which can execute simultaneously only single floating 10179 functional unit which can execute simultaneously only single floating
9880 point insns or only double floating point insns. 10180 point insns or only double floating point insns.
9881 10181
9882 The second construction (@samp{presence_set}) means that each 10182 The second construction (@samp{presence_set}) means that each
9883 functional unit in the first string can not be reserved unless at 10183 functional unit in the first string cannot be reserved unless at
9884 least one of pattern of units whose names are in the second string is 10184 least one of pattern of units whose names are in the second string is
9885 reserved. This is an asymmetric relation. For example, it is useful 10185 reserved. This is an asymmetric relation. For example, it is useful
9886 for description that @acronym{VLIW} @samp{slot1} is reserved after 10186 for description that @acronym{VLIW} @samp{slot1} is reserved after
9887 @samp{slot0} reservation. We could describe it by the following 10187 @samp{slot0} reservation. We could describe it by the following
9888 construction 10188 construction
9933 10233
9934 @smallexample 10234 @smallexample
9935 (absence_set "slot0" "slot1, slot2") 10235 (absence_set "slot0" "slot1, slot2")
9936 @end smallexample 10236 @end smallexample
9937 10237
9938 Or @samp{slot2} can not be reserved if @samp{slot0} and unit @samp{b0} 10238 Or @samp{slot2} cannot be reserved if @samp{slot0} and unit @samp{b0}
9939 are reserved or @samp{slot1} and unit @samp{b1} are reserved. In 10239 are reserved or @samp{slot1} and unit @samp{b1} are reserved. In
9940 this case we could write 10240 this case we could write
9941 10241
9942 @smallexample 10242 @smallexample
9943 (absence_set "slot2" "slot0 b0, slot1 b1") 10243 (absence_set "slot2" "slot0 b0, slot1 b1")
10036 issued into the first pipeline unless it is reserved, otherwise they 10336 issued into the first pipeline unless it is reserved, otherwise they
10037 are issued into the second pipeline. Integer division and 10337 are issued into the second pipeline. Integer division and
10038 multiplication insns can be executed only in the second integer 10338 multiplication insns can be executed only in the second integer
10039 pipeline and their results are ready correspondingly in 9 and 4 10339 pipeline and their results are ready correspondingly in 9 and 4
10040 cycles. The integer division is not pipelined, i.e.@: the subsequent 10340 cycles. The integer division is not pipelined, i.e.@: the subsequent
10041 integer division insn can not be issued until the current division 10341 integer division insn cannot be issued until the current division
10042 insn finished. Floating point insns are fully pipelined and their 10342 insn finished. Floating point insns are fully pipelined and their
10043 results are ready in 3 cycles. Where the result of a floating point 10343 results are ready in 3 cycles. Where the result of a floating point
10044 insn is used by an integer insn, an additional delay of one cycle is 10344 insn is used by an integer insn, an additional delay of one cycle is
10045 incurred. To describe all of this we could specify 10345 incurred. To describe all of this we could specify
10046 10346
10212 case when the source RTL template is not matched against the 10512 case when the source RTL template is not matched against the
10213 input-template of the @code{define_subst}. In such case the copy is 10513 input-template of the @code{define_subst}. In such case the copy is
10214 deleted. 10514 deleted.
10215 10515
10216 @code{define_subst} can be used only in @code{define_insn} and 10516 @code{define_subst} can be used only in @code{define_insn} and
10217 @code{define_expand}, it cannot be used in other expressions (e.g. in 10517 @code{define_expand}, it cannot be used in other expressions (e.g.@: in
10218 @code{define_insn_and_split}). 10518 @code{define_insn_and_split}).
10219 10519
10220 @menu 10520 @menu
10221 * Define Subst Example:: Example of @code{define_subst} work. 10521 * Define Subst Example:: Example of @code{define_subst} work.
10222 * Define Subst Pattern Matching:: Process of template comparison. 10522 * Define Subst Pattern Matching:: Process of template comparison.
10239 [(set (match_operand:SI 0 "" "") 10539 [(set (match_operand:SI 0 "" "")
10240 (match_operand:SI 1 "" ""))] 10540 (match_operand:SI 1 "" ""))]
10241 "" 10541 ""
10242 [(set (match_dup 0) 10542 [(set (match_dup 0)
10243 (match_dup 1)) 10543 (match_dup 1))
10244 (clobber (reg:CC FLAGS_REG))] 10544 (clobber (reg:CC FLAGS_REG))])
10245 @end smallexample 10545 @end smallexample
10246 10546
10247 This @code{define_subst} can be applied to any RTL pattern containing 10547 This @code{define_subst} can be applied to any RTL pattern containing
10248 @code{set} of mode SI and generates a copy with clobber when it is 10548 @code{set} of mode SI and generates a copy with clobber when it is
10249 applied. 10549 applied.
10788 11088
10789 @smallexample 11089 @smallexample
10790 (define_code_attr @var{name} [(@var{code1} "@var{value1}") @dots{} (@var{coden} "@var{valuen}")]) 11090 (define_code_attr @var{name} [(@var{code1} "@var{value1}") @dots{} (@var{coden} "@var{valuen}")])
10791 @end smallexample 11091 @end smallexample
10792 11092
11093 Instruction patterns can use code attributes as rtx codes, which can be
11094 useful if two sets of codes act in tandem. For example, the following
11095 @code{define_insn} defines two patterns, one calculating a signed absolute
11096 difference and another calculating an unsigned absolute difference:
11097
11098 @smallexample
11099 (define_code_iterator any_max [smax umax])
11100 (define_code_attr paired_min [(smax "smin") (umax "umin")])
11101 (define_insn @dots{}
11102 [(set (match_operand:SI 0 @dots{})
11103 (minus:SI (any_max:SI (match_operand:SI 1 @dots{})
11104 (match_operand:SI 2 @dots{}))
11105 (<paired_min>:SI (match_dup 1) (match_dup 2))))]
11106 @dots{})
11107 @end smallexample
11108
11109 The signed version of the instruction uses @code{smax} and @code{smin}
11110 while the unsigned version uses @code{umax} and @code{umin}. There
11111 are no versions that pair @code{smax} with @code{umin} or @code{umax}
11112 with @code{smin}.
11113
10793 Here's an example of code iterators in action, taken from the MIPS port: 11114 Here's an example of code iterators in action, taken from the MIPS port:
10794 11115
10795 @smallexample 11116 @smallexample
10796 (define_code_iterator any_cond [unordered ordered unlt unge uneq ltgt unle ungt 11117 (define_code_iterator any_cond [unordered ordered unlt unge uneq ltgt unle ungt
10797 eq ne gt ge lt le gtu geu ltu leu]) 11118 eq ne gt ge lt le gtu geu ltu leu])
11058 @end smallexample 11379 @end smallexample
11059 11380
11060 would produce a single set of functions that handles both 11381 would produce a single set of functions that handles both
11061 @code{INTEGER_MODES} and @code{FLOAT_MODES}. 11382 @code{INTEGER_MODES} and @code{FLOAT_MODES}.
11062 11383
11384 It is also possible for these @samp{@@} patterns to have different
11385 numbers of operands from each other. For example, patterns with
11386 a binary rtl code might take three operands (one output and two inputs)
11387 while patterns with a ternary rtl code might take four operands (one
11388 output and three inputs). This combination would produce separate
11389 @samp{maybe_gen_@var{name}} and @samp{gen_@var{name}} functions for
11390 each operand count, but it would still produce a single
11391 @samp{maybe_code_for_@var{name}} and a single @samp{code_for_@var{name}}.
11392
11063 @end ifset 11393 @end ifset