| 1 |
;;- Machine description for ARM for GNU compiler |
| 2 |
;; Copyright (C) 1991-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Pieter `Tiggr' Schoenmakers ([email protected]) |
| 4 |
;; and Martin Simmons (@harleqn.co.uk). |
| 5 |
;; More major hacks by Richard Earnshaw ([email protected]). |
| 6 |
|
| 7 |
;; This file is part of GCC. |
| 8 |
|
| 9 |
;; GCC is free software; you can redistribute it and/or modify it |
| 10 |
;; under the terms of the GNU General Public License as published |
| 11 |
;; by the Free Software Foundation; either version 3, or (at your |
| 12 |
;; option) any later version. |
| 13 |
|
| 14 |
;; GCC is distributed in the hope that it will be useful, but WITHOUT |
| 15 |
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 16 |
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 17 |
;; License for more details. |
| 18 |
|
| 19 |
;; You should have received a copy of the GNU General Public License |
| 20 |
;; along with GCC; see the file COPYING3. If not see |
| 21 |
;; <http://www.gnu.org/licenses/>. |
| 22 |
|
| 23 |
;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. |
| 24 |
|
| 25 |
|
| 26 |
;;--------------------------------------------------------------------------- |
| 27 |
;; Constants |
| 28 |
|
| 29 |
;; Register numbers -- All machine registers should be defined here |
| 30 |
(define_constants |
| 31 |
[(R0_REGNUM 0) ; First CORE register |
| 32 |
(R1_REGNUM 1) ; Second CORE register |
| 33 |
(R4_REGNUM 4) ; Fifth CORE register |
| 34 |
(FDPIC_REGNUM 9) ; FDPIC register |
| 35 |
(IP_REGNUM 12) ; Scratch register |
| 36 |
(SP_REGNUM 13) ; Stack pointer |
| 37 |
(LR_REGNUM 14) ; Return address register |
| 38 |
(PC_REGNUM 15) ; Program counter |
| 39 |
(LAST_ARM_REGNUM 15) ; |
| 40 |
(CC_REGNUM 100) ; Condition code pseudo register |
| 41 |
(VFPCC_REGNUM 101) ; VFP Condition code pseudo register |
| 42 |
(APSRQ_REGNUM 104) ; Q bit pseudo register |
| 43 |
(APSRGE_REGNUM 105) ; GE bits pseudo register |
| 44 |
(VPR_REGNUM 106) ; Vector Predication Register - MVE register. |
| 45 |
(RA_AUTH_CODE 107) ; Pseudo register to save PAC. |
| 46 |
] |
| 47 |
) |
| 48 |
;; 3rd operand to select_dominance_cc_mode |
| 49 |
(define_constants |
| 50 |
[(DOM_CC_X_AND_Y 0) |
| 51 |
(DOM_CC_NX_OR_Y 1) |
| 52 |
(DOM_CC_X_OR_Y 2) |
| 53 |
] |
| 54 |
) |
| 55 |
;; conditional compare combination |
| 56 |
(define_constants |
| 57 |
[(CMP_CMP 0) |
| 58 |
(CMN_CMP 1) |
| 59 |
(CMP_CMN 2) |
| 60 |
(CMN_CMN 3) |
| 61 |
(NUM_OF_COND_CMP 4) |
| 62 |
] |
| 63 |
) |
| 64 |
|
| 65 |
|
| 66 |
;;--------------------------------------------------------------------------- |
| 67 |
;; Attributes |
| 68 |
|
| 69 |
;; Processor type. This is created automatically from arm-cores.def. |
| 70 |
(include "arm-tune.md") |
| 71 |
|
| 72 |
;; Instruction classification types |
| 73 |
(include "types.md") |
| 74 |
|
| 75 |
; IS_THUMB is set to 'yes' when we are generating Thumb code, and 'no' when |
| 76 |
; generating ARM code. This is used to control the length of some insn |
| 77 |
; patterns that share the same RTL in both ARM and Thumb code. |
| 78 |
(define_attr "is_thumb" "yes,no" |
| 79 |
(const (if_then_else (symbol_ref "TARGET_THUMB") |
| 80 |
(const_string "yes") (const_string "no")))) |
| 81 |
|
| 82 |
; IS_ARCH6 is set to 'yes' when we are generating code form ARMv6. |
| 83 |
(define_attr "is_arch6" "no,yes" (const (symbol_ref "arm_arch6"))) |
| 84 |
|
| 85 |
; IS_THUMB1 is set to 'yes' iff we are generating Thumb-1 code. |
| 86 |
(define_attr "is_thumb1" "yes,no" |
| 87 |
(const (if_then_else (symbol_ref "TARGET_THUMB1") |
| 88 |
(const_string "yes") (const_string "no")))) |
| 89 |
|
| 90 |
; Mark an instruction as suitable for "short IT" blocks in Thumb-2. |
| 91 |
; The arm_restrict_it flag enables the "short IT" feature which |
| 92 |
; restricts IT blocks to a single 16-bit instruction. |
| 93 |
; This attribute should only be used on 16-bit Thumb-2 instructions |
| 94 |
; which may be predicated (the "predicable" attribute must be set). |
| 95 |
(define_attr "predicable_short_it" "no,yes" (const_string "no")) |
| 96 |
|
| 97 |
; Mark an instruction as suitable for "short IT" blocks in Thumb-2. |
| 98 |
; This attribute should only be used on instructions which may emit |
| 99 |
; an IT block in their expansion which is not a short IT. |
| 100 |
(define_attr "enabled_for_short_it" "no,yes" (const_string "yes")) |
| 101 |
|
| 102 |
; Mark an instruction sequence as the required way of loading a |
| 103 |
; constant when -mpure-code is enabled (which implies |
| 104 |
; arm_disable_literal_pool) |
| 105 |
(define_attr "required_for_purecode" "no,yes" (const_string "no")) |
| 106 |
|
| 107 |
;; Operand number of an input operand that is shifted. Zero if the |
| 108 |
;; given instruction does not shift one of its input operands. |
| 109 |
(define_attr "shift" "" (const_int 0)) |
| 110 |
|
| 111 |
;; [For compatibility with AArch64 in pipeline models] |
| 112 |
;; Attribute that specifies whether or not the instruction touches fp |
| 113 |
;; registers. |
| 114 |
(define_attr "fp" "no,yes" (const_string "no")) |
| 115 |
|
| 116 |
; Floating Point Unit. If we only have floating point emulation, then there |
| 117 |
; is no point in scheduling the floating point insns. (Well, for best |
| 118 |
; performance we should try and group them together). |
| 119 |
(define_attr "fpu" "none,vfp" |
| 120 |
(const (symbol_ref "arm_fpu_attr"))) |
| 121 |
|
| 122 |
; Predicated means that the insn form is conditionally executed based on a |
| 123 |
; predicate. We default to 'no' because no Thumb patterns match this rule |
| 124 |
; and not all ARM insns do. |
| 125 |
(define_attr "predicated" "yes,no" (const_string "no")) |
| 126 |
|
| 127 |
; An attribute that encodes the CODE_FOR_<insn> of the MVE VPT unpredicated |
| 128 |
; version of a VPT-predicated instruction. For unpredicated instructions |
| 129 |
; that are predicable, encode the same pattern's CODE_FOR_<insn> as a way to |
| 130 |
; encode that it is a predicable instruction. |
| 131 |
(define_attr "mve_unpredicated_insn" "" (symbol_ref "CODE_FOR_nothing")) |
| 132 |
|
| 133 |
; An attribute used by the loop-doloop pass when determining whether it is |
| 134 |
; safe to predicate a MVE instruction, that operates across lanes, and was |
| 135 |
; previously not predicated. The pass will still check whether all inputs |
| 136 |
; are predicated by the VCTP predication mask. |
| 137 |
(define_attr "mve_safe_imp_xlane_pred" "yes,no" (const_string "no")) |
| 138 |
|
| 139 |
; LENGTH of an instruction (in bytes) |
| 140 |
(define_attr "length" "" |
| 141 |
(const_int 4)) |
| 142 |
|
| 143 |
; The architecture which supports the instruction (or alternative). |
| 144 |
; This can be "a" for ARM, "t" for either of the Thumbs, "32" for |
| 145 |
; TARGET_32BIT, "t1" or "t2" to specify a specific Thumb mode. "v6" |
| 146 |
; for ARM or Thumb-2 with arm_arch6, and nov6 for ARM without |
| 147 |
; arm_arch6. "v6t2" for Thumb-2 with arm_arch6 and "v8mb" for ARMv8-M |
| 148 |
; Baseline. "fix_vlldm" is for fixing the v8-m/v8.1-m VLLDM erratum. |
| 149 |
; This attribute is used to compute attribute "enabled", |
| 150 |
; use type "any" to enable an alternative in all cases. |
| 151 |
(define_attr "arch" "any, a, t, 32, t1, t2, v6,nov6, v6t2, \ |
| 152 |
v8mb, fix_vlldm, iwmmxt, iwmmxt2, armv6_or_vfpv3, \ |
| 153 |
neon, mve" |
| 154 |
(const_string "any")) |
| 155 |
|
| 156 |
(define_attr "arch_enabled" "no,yes" |
| 157 |
(cond [(eq_attr "arch" "any") |
| 158 |
(const_string "yes") |
| 159 |
|
| 160 |
(and (eq_attr "arch" "a") |
| 161 |
(match_test "TARGET_ARM")) |
| 162 |
(const_string "yes") |
| 163 |
|
| 164 |
(and (eq_attr "arch" "t") |
| 165 |
(match_test "TARGET_THUMB")) |
| 166 |
(const_string "yes") |
| 167 |
|
| 168 |
(and (eq_attr "arch" "t1") |
| 169 |
(match_test "TARGET_THUMB1")) |
| 170 |
(const_string "yes") |
| 171 |
|
| 172 |
(and (eq_attr "arch" "t2") |
| 173 |
(match_test "TARGET_THUMB2")) |
| 174 |
(const_string "yes") |
| 175 |
|
| 176 |
(and (eq_attr "arch" "32") |
| 177 |
(match_test "TARGET_32BIT")) |
| 178 |
(const_string "yes") |
| 179 |
|
| 180 |
(and (eq_attr "arch" "v6") |
| 181 |
(match_test "TARGET_32BIT && arm_arch6")) |
| 182 |
(const_string "yes") |
| 183 |
|
| 184 |
(and (eq_attr "arch" "nov6") |
| 185 |
(match_test "TARGET_32BIT && !arm_arch6")) |
| 186 |
(const_string "yes") |
| 187 |
|
| 188 |
(and (eq_attr "arch" "v6t2") |
| 189 |
(match_test "TARGET_32BIT && arm_arch6 && arm_arch_thumb2")) |
| 190 |
(const_string "yes") |
| 191 |
|
| 192 |
(and (eq_attr "arch" "v8mb") |
| 193 |
(match_test "TARGET_THUMB1 && arm_arch8")) |
| 194 |
(const_string "yes") |
| 195 |
|
| 196 |
(and (eq_attr "arch" "fix_vlldm") |
| 197 |
(match_test "fix_vlldm")) |
| 198 |
(const_string "yes") |
| 199 |
|
| 200 |
(and (eq_attr "arch" "iwmmxt2") |
| 201 |
(match_test "TARGET_REALLY_IWMMXT2")) |
| 202 |
(const_string "yes") |
| 203 |
|
| 204 |
(and (eq_attr "arch" "armv6_or_vfpv3") |
| 205 |
(match_test "arm_arch6 || TARGET_VFP3")) |
| 206 |
(const_string "yes") |
| 207 |
|
| 208 |
(and (eq_attr "arch" "neon") |
| 209 |
(match_test "TARGET_NEON")) |
| 210 |
(const_string "yes") |
| 211 |
|
| 212 |
(and (eq_attr "arch" "mve") |
| 213 |
(match_test "TARGET_HAVE_MVE")) |
| 214 |
(const_string "yes") |
| 215 |
] |
| 216 |
|
| 217 |
(const_string "no"))) |
| 218 |
|
| 219 |
(define_attr "opt" "any,speed,size" |
| 220 |
(const_string "any")) |
| 221 |
|
| 222 |
(define_attr "opt_enabled" "no,yes" |
| 223 |
(cond [(eq_attr "opt" "any") |
| 224 |
(const_string "yes") |
| 225 |
|
| 226 |
(and (eq_attr "opt" "speed") |
| 227 |
(match_test "optimize_function_for_speed_p (cfun)")) |
| 228 |
(const_string "yes") |
| 229 |
|
| 230 |
(and (eq_attr "opt" "size") |
| 231 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 232 |
(const_string "yes")] |
| 233 |
(const_string "no"))) |
| 234 |
|
| 235 |
(define_attr "use_literal_pool" "no,yes" |
| 236 |
(cond [(and (eq_attr "type" "f_loads,f_loadd") |
| 237 |
(match_test "CONSTANT_P (operands[1])")) |
| 238 |
(const_string "yes")] |
| 239 |
(const_string "no"))) |
| 240 |
|
| 241 |
; Enable all alternatives that are both arch_enabled and insn_enabled. |
| 242 |
; FIXME:: opt_enabled has been temporarily removed till the time we have |
| 243 |
; an attribute that allows the use of such alternatives. |
| 244 |
; This depends on caching of speed_p, size_p on a per |
| 245 |
; alternative basis. The problem is that the enabled attribute |
| 246 |
; cannot depend on any state that is not cached or is not constant |
| 247 |
; for a compilation unit. We probably need a generic "hot/cold" |
| 248 |
; alternative which if implemented can help with this. We disable this |
| 249 |
; until such a time as this is implemented and / or the improvements or |
| 250 |
; regressions with removing this attribute are double checked. |
| 251 |
; See ashldi3_neon and <shift>di3_neon in neon.md. |
| 252 |
|
| 253 |
(define_attr "enabled" "no,yes" |
| 254 |
(cond [(and (eq_attr "predicable_short_it" "no") |
| 255 |
(and (eq_attr "predicated" "yes") |
| 256 |
(match_test "arm_restrict_it"))) |
| 257 |
(const_string "no") |
| 258 |
|
| 259 |
(and (eq_attr "enabled_for_short_it" "no") |
| 260 |
(match_test "arm_restrict_it")) |
| 261 |
(const_string "no") |
| 262 |
|
| 263 |
(and (eq_attr "required_for_purecode" "yes") |
| 264 |
(not (match_test "arm_disable_literal_pool"))) |
| 265 |
(const_string "no") |
| 266 |
|
| 267 |
(eq_attr "arch_enabled" "no") |
| 268 |
(const_string "no")] |
| 269 |
(const_string "yes"))) |
| 270 |
|
| 271 |
; POOL_RANGE is how far away from a constant pool entry that this insn |
| 272 |
; can be placed. If the distance is zero, then this insn will never |
| 273 |
; reference the pool. |
| 274 |
; Note that for Thumb constant pools the PC value is rounded down to the |
| 275 |
; nearest multiple of four. Therefore, THUMB2_POOL_RANGE (and POOL_RANGE for |
| 276 |
; Thumb insns) should be set to <max_range> - 2. |
| 277 |
; NEG_POOL_RANGE is nonzero for insns that can reference a constant pool entry |
| 278 |
; before its address. It is set to <max_range> - (8 + <data_size>). |
| 279 |
(define_attr "arm_pool_range" "" (const_int 0)) |
| 280 |
(define_attr "thumb2_pool_range" "" (const_int 0)) |
| 281 |
(define_attr "arm_neg_pool_range" "" (const_int 0)) |
| 282 |
(define_attr "thumb2_neg_pool_range" "" (const_int 0)) |
| 283 |
|
| 284 |
(define_attr "pool_range" "" |
| 285 |
(cond [(eq_attr "is_thumb" "yes") (attr "thumb2_pool_range")] |
| 286 |
(attr "arm_pool_range"))) |
| 287 |
(define_attr "neg_pool_range" "" |
| 288 |
(cond [(eq_attr "is_thumb" "yes") (attr "thumb2_neg_pool_range")] |
| 289 |
(attr "arm_neg_pool_range"))) |
| 290 |
|
| 291 |
; An assembler sequence may clobber the condition codes without us knowing. |
| 292 |
; If such an insn references the pool, then we have no way of knowing how, |
| 293 |
; so use the most conservative value for pool_range. |
| 294 |
(define_asm_attributes |
| 295 |
[(set_attr "conds" "clob") |
| 296 |
(set_attr "length" "4") |
| 297 |
(set_attr "pool_range" "250")]) |
| 298 |
|
| 299 |
; Load scheduling, set from the arm_ld_sched variable |
| 300 |
; initialized by arm_option_override() |
| 301 |
(define_attr "ldsched" "no,yes" (const (symbol_ref "arm_ld_sched"))) |
| 302 |
|
| 303 |
; condition codes: this one is used by final_prescan_insn to speed up |
| 304 |
; conditionalizing instructions. It saves having to scan the rtl to see if |
| 305 |
; it uses or alters the condition codes. |
| 306 |
; |
| 307 |
; USE means that the condition codes are used by the insn in the process of |
| 308 |
; outputting code, this means (at present) that we can't use the insn in |
| 309 |
; inlined branches |
| 310 |
; |
| 311 |
; SET means that the purpose of the insn is to set the condition codes in a |
| 312 |
; well defined manner. |
| 313 |
; |
| 314 |
; CLOB means that the condition codes are altered in an undefined manner, if |
| 315 |
; they are altered at all |
| 316 |
; |
| 317 |
; UNCONDITIONAL means the instruction cannot be conditionally executed and |
| 318 |
; that the instruction does not use or alter the condition codes. |
| 319 |
; |
| 320 |
; NOCOND means that the instruction does not use or alter the condition |
| 321 |
; codes but can be converted into a conditionally exectuted instruction. |
| 322 |
; Given that NOCOND is the default for most instructions if omitted, |
| 323 |
; the attribute predicable must be set to yes as well. |
| 324 |
|
| 325 |
(define_attr "conds" "use,set,clob,unconditional,nocond" |
| 326 |
(if_then_else |
| 327 |
(ior (eq_attr "is_thumb1" "yes") |
| 328 |
(eq_attr "type" "call")) |
| 329 |
(const_string "clob") |
| 330 |
(if_then_else |
| 331 |
(ior (eq_attr "is_neon_type" "yes") |
| 332 |
(eq_attr "is_mve_type" "yes")) |
| 333 |
(const_string "unconditional") |
| 334 |
(const_string "nocond")))) |
| 335 |
|
| 336 |
; Predicable means that the insn can be conditionally executed based on |
| 337 |
; an automatically added predicate (additional patterns are generated by |
| 338 |
; gen...). We default to 'no' because no Thumb patterns match this rule |
| 339 |
; and not all ARM patterns do. |
| 340 |
(define_attr "predicable" "no,yes" (const_string "no")) |
| 341 |
|
| 342 |
; Only model the write buffer for ARM6 and ARM7. Earlier processors don't |
| 343 |
; have one. Later ones, such as StrongARM, have write-back caches, so don't |
| 344 |
; suffer blockages enough to warrant modelling this (and it can adversely |
| 345 |
; affect the schedule). |
| 346 |
(define_attr "model_wbuf" "no,yes" (const (symbol_ref "arm_tune_wbuf"))) |
| 347 |
|
| 348 |
; WRITE_CONFLICT implies that a read following an unrelated write is likely |
| 349 |
; to stall the processor. Used with model_wbuf above. |
| 350 |
(define_attr "write_conflict" "no,yes" |
| 351 |
(if_then_else (eq_attr "type" |
| 352 |
"block,call,load_4") |
| 353 |
(const_string "yes") |
| 354 |
(const_string "no"))) |
| 355 |
|
| 356 |
; Classify the insns into those that take one cycle and those that take more |
| 357 |
; than one on the main cpu execution unit. |
| 358 |
(define_attr "core_cycles" "single,multi" |
| 359 |
(if_then_else (eq_attr "type" |
| 360 |
"adc_imm, adc_reg, adcs_imm, adcs_reg, adr, alu_ext, alu_imm, alu_sreg,\ |
| 361 |
alu_shift_imm_lsl_1to4, alu_shift_imm_other, alu_shift_reg, alu_dsp_reg,\ |
| 362 |
alus_ext, alus_imm, alus_sreg,\ |
| 363 |
alus_shift_imm, alus_shift_reg, bfm, csel, rev, logic_imm, logic_reg,\ |
| 364 |
logic_shift_imm, logic_shift_reg, logics_imm, logics_reg,\ |
| 365 |
logics_shift_imm, logics_shift_reg, extend, shift_imm, float, fcsel,\ |
| 366 |
wmmx_wor, wmmx_wxor, wmmx_wand, wmmx_wandn, wmmx_wmov, wmmx_tmcrr,\ |
| 367 |
wmmx_tmrrc, wmmx_wldr, wmmx_wstr, wmmx_tmcr, wmmx_tmrc, wmmx_wadd,\ |
| 368 |
wmmx_wsub, wmmx_wmul, wmmx_wmac, wmmx_wavg2, wmmx_tinsr, wmmx_textrm,\ |
| 369 |
wmmx_wshufh, wmmx_wcmpeq, wmmx_wcmpgt, wmmx_wmax, wmmx_wmin, wmmx_wpack,\ |
| 370 |
wmmx_wunpckih, wmmx_wunpckil, wmmx_wunpckeh, wmmx_wunpckel, wmmx_wror,\ |
| 371 |
wmmx_wsra, wmmx_wsrl, wmmx_wsll, wmmx_wmadd, wmmx_tmia, wmmx_tmiaph,\ |
| 372 |
wmmx_tmiaxy, wmmx_tbcst, wmmx_tmovmsk, wmmx_wacc, wmmx_waligni,\ |
| 373 |
wmmx_walignr, wmmx_tandc, wmmx_textrc, wmmx_torc, wmmx_torvsc, wmmx_wsad,\ |
| 374 |
wmmx_wabs, wmmx_wabsdiff, wmmx_waddsubhx, wmmx_wsubaddhx, wmmx_wavg4,\ |
| 375 |
wmmx_wmulw, wmmx_wqmulm, wmmx_wqmulwm, wmmx_waddbhus, wmmx_wqmiaxy,\ |
| 376 |
wmmx_wmiaxy, wmmx_wmiawxy, wmmx_wmerge") |
| 377 |
(const_string "single") |
| 378 |
(const_string "multi"))) |
| 379 |
|
| 380 |
;; FAR_JUMP is "yes" if a BL instruction is used to generate a branch to a |
| 381 |
;; distant label. Only applicable to Thumb code. |
| 382 |
(define_attr "far_jump" "yes,no" (const_string "no")) |
| 383 |
|
| 384 |
|
| 385 |
;; The number of machine instructions this pattern expands to. |
| 386 |
;; Used for Thumb-2 conditional execution. |
| 387 |
(define_attr "ce_count" "" (const_int 1)) |
| 388 |
|
| 389 |
;;--------------------------------------------------------------------------- |
| 390 |
;; Unspecs |
| 391 |
|
| 392 |
(include "unspecs.md") |
| 393 |
|
| 394 |
;;--------------------------------------------------------------------------- |
| 395 |
;; Mode iterators |
| 396 |
|
| 397 |
(include "iterators.md") |
| 398 |
|
| 399 |
;;--------------------------------------------------------------------------- |
| 400 |
;; Predicates |
| 401 |
|
| 402 |
(include "predicates.md") |
| 403 |
(include "constraints.md") |
| 404 |
|
| 405 |
;;--------------------------------------------------------------------------- |
| 406 |
;; Pipeline descriptions |
| 407 |
|
| 408 |
(define_attr "tune_cortexr4" "yes,no" |
| 409 |
(const (if_then_else |
| 410 |
(eq_attr "tune" "cortexr4,cortexr4f,cortexr5") |
| 411 |
(const_string "yes") |
| 412 |
(const_string "no")))) |
| 413 |
|
| 414 |
;; True if the generic scheduling description should be used. |
| 415 |
|
| 416 |
(define_attr "generic_sched" "yes,no" |
| 417 |
(const (if_then_else |
| 418 |
(ior (eq_attr "tune" "fa526,fa626,fa606te,fa626te,fmp626,fa726te,\ |
| 419 |
arm926ejs,arm10e,arm1026ejs,arm1136js,\ |
| 420 |
arm1136jfs,cortexa5,cortexa7,cortexa8,\ |
| 421 |
cortexa9,cortexa12,cortexa15,cortexa17,\ |
| 422 |
cortexa53,cortexa57,cortexm4,cortexm7,\ |
| 423 |
exynosm1,marvell_pj4,xgene1") |
| 424 |
(eq_attr "tune_cortexr4" "yes")) |
| 425 |
(const_string "no") |
| 426 |
(const_string "yes")))) |
| 427 |
|
| 428 |
(define_attr "generic_vfp" "yes,no" |
| 429 |
(const (if_then_else |
| 430 |
(and (eq_attr "fpu" "vfp") |
| 431 |
(eq_attr "tune" "!arm10e,cortexa5,cortexa7,\ |
| 432 |
cortexa8,cortexa9,cortexa53,cortexm4,\ |
| 433 |
cortexm7,marvell_pj4,xgene1") |
| 434 |
(eq_attr "tune_cortexr4" "no")) |
| 435 |
(const_string "yes") |
| 436 |
(const_string "no")))) |
| 437 |
|
| 438 |
(include "marvell-f-iwmmxt.md") |
| 439 |
(include "arm-generic.md") |
| 440 |
(include "arm926ejs.md") |
| 441 |
(include "arm1020e.md") |
| 442 |
(include "arm1026ejs.md") |
| 443 |
(include "arm1136jfs.md") |
| 444 |
(include "fa526.md") |
| 445 |
(include "fa606te.md") |
| 446 |
(include "fa626te.md") |
| 447 |
(include "fmp626.md") |
| 448 |
(include "fa726te.md") |
| 449 |
(include "cortex-a5.md") |
| 450 |
(include "cortex-a7.md") |
| 451 |
(include "cortex-a8.md") |
| 452 |
(include "cortex-a9.md") |
| 453 |
(include "cortex-a15.md") |
| 454 |
(include "cortex-a17.md") |
| 455 |
(include "cortex-a53.md") |
| 456 |
(include "cortex-a57.md") |
| 457 |
(include "cortex-r4.md") |
| 458 |
(include "cortex-r4f.md") |
| 459 |
(include "cortex-m7.md") |
| 460 |
(include "cortex-m4.md") |
| 461 |
(include "cortex-m4-fpu.md") |
| 462 |
(include "exynos-m1.md") |
| 463 |
(include "vfp11.md") |
| 464 |
(include "marvell-pj4.md") |
| 465 |
(include "xgene1.md") |
| 466 |
|
| 467 |
;; define_subst and associated attributes |
| 468 |
|
| 469 |
(define_subst "add_setq" |
| 470 |
[(set (match_operand:SI 0 "" "") |
| 471 |
(match_operand:SI 1 "" ""))] |
| 472 |
"" |
| 473 |
[(set (match_dup 0) |
| 474 |
(match_dup 1)) |
| 475 |
(set (reg:CC APSRQ_REGNUM) |
| 476 |
(unspec:CC [(reg:CC APSRQ_REGNUM)] UNSPEC_Q_SET))]) |
| 477 |
|
| 478 |
(define_subst_attr "add_clobber_q_name" "add_setq" "" "_setq") |
| 479 |
(define_subst_attr "add_clobber_q_pred" "add_setq" "!ARM_Q_BIT_READ" |
| 480 |
"ARM_Q_BIT_READ") |
| 481 |
|
| 482 |
;;--------------------------------------------------------------------------- |
| 483 |
;; Insn patterns |
| 484 |
;; |
| 485 |
;; Addition insns. |
| 486 |
|
| 487 |
;; Note: For DImode insns, there is normally no reason why operands should |
| 488 |
;; not be in the same register, what we don't want is for something being |
| 489 |
;; written to partially overlap something that is an input. |
| 490 |
|
| 491 |
(define_expand "adddi3" |
| 492 |
[(parallel |
| 493 |
[(set (match_operand:DI 0 "s_register_operand") |
| 494 |
(plus:DI (match_operand:DI 1 "s_register_operand") |
| 495 |
(match_operand:DI 2 "reg_or_int_operand"))) |
| 496 |
(clobber (reg:CC CC_REGNUM))])] |
| 497 |
"TARGET_EITHER" |
| 498 |
" |
| 499 |
if (TARGET_THUMB1) |
| 500 |
{ |
| 501 |
if (!REG_P (operands[2])) |
| 502 |
operands[2] = force_reg (DImode, operands[2]); |
| 503 |
} |
| 504 |
else |
| 505 |
{ |
| 506 |
rtx lo_result, hi_result, lo_dest, hi_dest; |
| 507 |
rtx lo_op1, hi_op1, lo_op2, hi_op2; |
| 508 |
arm_decompose_di_binop (operands[1], operands[2], &lo_op1, &hi_op1, |
| 509 |
&lo_op2, &hi_op2); |
| 510 |
lo_result = lo_dest = gen_lowpart (SImode, operands[0]); |
| 511 |
hi_result = hi_dest = gen_highpart (SImode, operands[0]); |
| 512 |
|
| 513 |
if (lo_op2 == const0_rtx) |
| 514 |
{ |
| 515 |
lo_dest = lo_op1; |
| 516 |
if (!arm_add_operand (hi_op2, SImode)) |
| 517 |
hi_op2 = force_reg (SImode, hi_op2); |
| 518 |
/* Assume hi_op2 won't also be zero. */ |
| 519 |
emit_insn (gen_addsi3 (hi_dest, hi_op1, hi_op2)); |
| 520 |
} |
| 521 |
else |
| 522 |
{ |
| 523 |
if (!arm_add_operand (lo_op2, SImode)) |
| 524 |
lo_op2 = force_reg (SImode, lo_op2); |
| 525 |
if (!arm_not_operand (hi_op2, SImode)) |
| 526 |
hi_op2 = force_reg (SImode, hi_op2); |
| 527 |
|
| 528 |
emit_insn (gen_addsi3_compare_op1 (lo_dest, lo_op1, lo_op2)); |
| 529 |
rtx carry = gen_rtx_LTU (SImode, gen_rtx_REG (CC_Cmode, CC_REGNUM), |
| 530 |
const0_rtx); |
| 531 |
if (hi_op2 == const0_rtx) |
| 532 |
emit_insn (gen_add0si3_carryin (hi_dest, hi_op1, carry)); |
| 533 |
else |
| 534 |
emit_insn (gen_addsi3_carryin (hi_dest, hi_op1, hi_op2, carry)); |
| 535 |
} |
| 536 |
|
| 537 |
if (lo_result != lo_dest) |
| 538 |
emit_move_insn (lo_result, lo_dest); |
| 539 |
if (hi_result != hi_dest) |
| 540 |
emit_move_insn (gen_highpart (SImode, operands[0]), hi_dest); |
| 541 |
DONE; |
| 542 |
} |
| 543 |
" |
| 544 |
) |
| 545 |
|
| 546 |
(define_expand "addvsi4" |
| 547 |
[(match_operand:SI 0 "s_register_operand") |
| 548 |
(match_operand:SI 1 "s_register_operand") |
| 549 |
(match_operand:SI 2 "arm_add_operand") |
| 550 |
(match_operand 3 "")] |
| 551 |
"TARGET_32BIT" |
| 552 |
{ |
| 553 |
if (CONST_INT_P (operands[2])) |
| 554 |
emit_insn (gen_addsi3_compareV_imm (operands[0], operands[1], operands[2])); |
| 555 |
else |
| 556 |
emit_insn (gen_addsi3_compareV_reg (operands[0], operands[1], operands[2])); |
| 557 |
arm_gen_unlikely_cbranch (NE, CC_Vmode, operands[3]); |
| 558 |
|
| 559 |
DONE; |
| 560 |
}) |
| 561 |
|
| 562 |
(define_expand "addvdi4" |
| 563 |
[(match_operand:DI 0 "s_register_operand") |
| 564 |
(match_operand:DI 1 "s_register_operand") |
| 565 |
(match_operand:DI 2 "reg_or_int_operand") |
| 566 |
(match_operand 3 "")] |
| 567 |
"TARGET_32BIT" |
| 568 |
{ |
| 569 |
rtx lo_result, hi_result; |
| 570 |
rtx lo_op1, hi_op1, lo_op2, hi_op2; |
| 571 |
arm_decompose_di_binop (operands[1], operands[2], &lo_op1, &hi_op1, |
| 572 |
&lo_op2, &hi_op2); |
| 573 |
lo_result = gen_lowpart (SImode, operands[0]); |
| 574 |
hi_result = gen_highpart (SImode, operands[0]); |
| 575 |
|
| 576 |
if (lo_op2 == const0_rtx) |
| 577 |
{ |
| 578 |
emit_move_insn (lo_result, lo_op1); |
| 579 |
if (!arm_add_operand (hi_op2, SImode)) |
| 580 |
hi_op2 = force_reg (SImode, hi_op2); |
| 581 |
|
| 582 |
emit_insn (gen_addvsi4 (hi_result, hi_op1, hi_op2, operands[3])); |
| 583 |
} |
| 584 |
else |
| 585 |
{ |
| 586 |
if (!arm_add_operand (lo_op2, SImode)) |
| 587 |
lo_op2 = force_reg (SImode, lo_op2); |
| 588 |
if (!arm_not_operand (hi_op2, SImode)) |
| 589 |
hi_op2 = force_reg (SImode, hi_op2); |
| 590 |
|
| 591 |
emit_insn (gen_addsi3_compare_op1 (lo_result, lo_op1, lo_op2)); |
| 592 |
|
| 593 |
if (hi_op2 == const0_rtx) |
| 594 |
emit_insn (gen_addsi3_cin_vout_0 (hi_result, hi_op1)); |
| 595 |
else if (CONST_INT_P (hi_op2)) |
| 596 |
emit_insn (gen_addsi3_cin_vout_imm (hi_result, hi_op1, hi_op2)); |
| 597 |
else |
| 598 |
emit_insn (gen_addsi3_cin_vout_reg (hi_result, hi_op1, hi_op2)); |
| 599 |
|
| 600 |
arm_gen_unlikely_cbranch (NE, CC_Vmode, operands[3]); |
| 601 |
} |
| 602 |
|
| 603 |
DONE; |
| 604 |
}) |
| 605 |
|
| 606 |
(define_expand "addsi3_cin_vout_reg" |
| 607 |
[(parallel |
| 608 |
[(set (match_dup 3) |
| 609 |
(compare:CC_V |
| 610 |
(plus:DI |
| 611 |
(plus:DI (match_dup 4) |
| 612 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand"))) |
| 613 |
(sign_extend:DI (match_operand:SI 2 "s_register_operand"))) |
| 614 |
(sign_extend:DI (plus:SI (plus:SI (match_dup 5) (match_dup 1)) |
| 615 |
(match_dup 2))))) |
| 616 |
(set (match_operand:SI 0 "s_register_operand") |
| 617 |
(plus:SI (plus:SI (match_dup 5) (match_dup 1)) |
| 618 |
(match_dup 2)))])] |
| 619 |
"TARGET_32BIT" |
| 620 |
{ |
| 621 |
operands[3] = gen_rtx_REG (CC_Vmode, CC_REGNUM); |
| 622 |
rtx ccin = gen_rtx_REG (CC_Cmode, CC_REGNUM); |
| 623 |
operands[4] = gen_rtx_LTU (DImode, ccin, const0_rtx); |
| 624 |
operands[5] = gen_rtx_LTU (SImode, ccin, const0_rtx); |
| 625 |
} |
| 626 |
) |
| 627 |
|
| 628 |
(define_insn "*addsi3_cin_vout_reg_insn" |
| 629 |
[(set (reg:CC_V CC_REGNUM) |
| 630 |
(compare:CC_V |
| 631 |
(plus:DI |
| 632 |
(plus:DI |
| 633 |
(match_operand:DI 3 "arm_carry_operation" "") |
| 634 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand" "%0,r"))) |
| 635 |
(sign_extend:DI (match_operand:SI 2 "s_register_operand" "l,r"))) |
| 636 |
(sign_extend:DI |
| 637 |
(plus:SI (plus:SI (match_operand:SI 4 "arm_carry_operation" "") |
| 638 |
(match_dup 1)) |
| 639 |
(match_dup 2))))) |
| 640 |
(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 641 |
(plus:SI (plus:SI (match_dup 4) (match_dup 1)) |
| 642 |
(match_dup 2)))] |
| 643 |
"TARGET_32BIT" |
| 644 |
"@ |
| 645 |
adcs%?\\t%0, %0, %2 |
| 646 |
adcs%?\\t%0, %1, %2" |
| 647 |
[(set_attr "type" "alus_sreg") |
| 648 |
(set_attr "arch" "t2,*") |
| 649 |
(set_attr "length" "2,4")] |
| 650 |
) |
| 651 |
|
| 652 |
(define_expand "addsi3_cin_vout_imm" |
| 653 |
[(parallel |
| 654 |
[(set (match_dup 3) |
| 655 |
(compare:CC_V |
| 656 |
(plus:DI |
| 657 |
(plus:DI (match_dup 4) |
| 658 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand"))) |
| 659 |
(match_dup 2)) |
| 660 |
(sign_extend:DI (plus:SI (plus:SI (match_dup 5) (match_dup 1)) |
| 661 |
(match_dup 2))))) |
| 662 |
(set (match_operand:SI 0 "s_register_operand") |
| 663 |
(plus:SI (plus:SI (match_dup 5) (match_dup 1)) |
| 664 |
(match_operand 2 "arm_adcimm_operand")))])] |
| 665 |
"TARGET_32BIT" |
| 666 |
{ |
| 667 |
operands[3] = gen_rtx_REG (CC_Vmode, CC_REGNUM); |
| 668 |
rtx ccin = gen_rtx_REG (CC_Cmode, CC_REGNUM); |
| 669 |
operands[4] = gen_rtx_LTU (DImode, ccin, const0_rtx); |
| 670 |
operands[5] = gen_rtx_LTU (SImode, ccin, const0_rtx); |
| 671 |
} |
| 672 |
) |
| 673 |
|
| 674 |
(define_insn "*addsi3_cin_vout_imm_insn" |
| 675 |
[(set (reg:CC_V CC_REGNUM) |
| 676 |
(compare:CC_V |
| 677 |
(plus:DI |
| 678 |
(plus:DI |
| 679 |
(match_operand:DI 3 "arm_carry_operation" "") |
| 680 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand" "r,r"))) |
| 681 |
(match_operand 2 "arm_adcimm_operand" "I,K")) |
| 682 |
(sign_extend:DI |
| 683 |
(plus:SI (plus:SI (match_operand:SI 4 "arm_carry_operation" "") |
| 684 |
(match_dup 1)) |
| 685 |
(match_dup 2))))) |
| 686 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 687 |
(plus:SI (plus:SI (match_dup 4) (match_dup 1)) |
| 688 |
(match_dup 2)))] |
| 689 |
"TARGET_32BIT" |
| 690 |
"@ |
| 691 |
adcs%?\\t%0, %1, %2 |
| 692 |
sbcs%?\\t%0, %1, #%B2" |
| 693 |
[(set_attr "type" "alus_imm")] |
| 694 |
) |
| 695 |
|
| 696 |
(define_expand "addsi3_cin_vout_0" |
| 697 |
[(parallel |
| 698 |
[(set (match_dup 2) |
| 699 |
(compare:CC_V |
| 700 |
(plus:DI (match_dup 3) |
| 701 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand"))) |
| 702 |
(sign_extend:DI (plus:SI (match_dup 4) (match_dup 1))))) |
| 703 |
(set (match_operand:SI 0 "s_register_operand") |
| 704 |
(plus:SI (match_dup 4) (match_dup 1)))])] |
| 705 |
"TARGET_32BIT" |
| 706 |
{ |
| 707 |
operands[2] = gen_rtx_REG (CC_Vmode, CC_REGNUM); |
| 708 |
rtx ccin = gen_rtx_REG (CC_Cmode, CC_REGNUM); |
| 709 |
operands[3] = gen_rtx_LTU (DImode, ccin, const0_rtx); |
| 710 |
operands[4] = gen_rtx_LTU (SImode, ccin, const0_rtx); |
| 711 |
} |
| 712 |
) |
| 713 |
|
| 714 |
(define_insn "*addsi3_cin_vout_0_insn" |
| 715 |
[(set (reg:CC_V CC_REGNUM) |
| 716 |
(compare:CC_V |
| 717 |
(plus:DI |
| 718 |
(match_operand:DI 2 "arm_carry_operation" "") |
| 719 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand" "r"))) |
| 720 |
(sign_extend:DI (plus:SI |
| 721 |
(match_operand:SI 3 "arm_carry_operation" "") |
| 722 |
(match_dup 1))))) |
| 723 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 724 |
(plus:SI (match_dup 3) (match_dup 1)))] |
| 725 |
"TARGET_32BIT" |
| 726 |
"adcs%?\\t%0, %1, #0" |
| 727 |
[(set_attr "type" "alus_imm")] |
| 728 |
) |
| 729 |
|
| 730 |
(define_expand "uaddvsi4" |
| 731 |
[(match_operand:SI 0 "s_register_operand") |
| 732 |
(match_operand:SI 1 "s_register_operand") |
| 733 |
(match_operand:SI 2 "arm_add_operand") |
| 734 |
(match_operand 3 "")] |
| 735 |
"TARGET_32BIT" |
| 736 |
{ |
| 737 |
emit_insn (gen_addsi3_compare_op1 (operands[0], operands[1], operands[2])); |
| 738 |
arm_gen_unlikely_cbranch (LTU, CC_Cmode, operands[3]); |
| 739 |
|
| 740 |
DONE; |
| 741 |
}) |
| 742 |
|
| 743 |
(define_expand "uaddvdi4" |
| 744 |
[(match_operand:DI 0 "s_register_operand") |
| 745 |
(match_operand:DI 1 "s_register_operand") |
| 746 |
(match_operand:DI 2 "reg_or_int_operand") |
| 747 |
(match_operand 3 "")] |
| 748 |
"TARGET_32BIT" |
| 749 |
{ |
| 750 |
rtx lo_result, hi_result; |
| 751 |
rtx lo_op1, hi_op1, lo_op2, hi_op2; |
| 752 |
arm_decompose_di_binop (operands[1], operands[2], &lo_op1, &hi_op1, |
| 753 |
&lo_op2, &hi_op2); |
| 754 |
lo_result = gen_lowpart (SImode, operands[0]); |
| 755 |
hi_result = gen_highpart (SImode, operands[0]); |
| 756 |
|
| 757 |
if (lo_op2 == const0_rtx) |
| 758 |
{ |
| 759 |
emit_move_insn (lo_result, lo_op1); |
| 760 |
if (!arm_add_operand (hi_op2, SImode)) |
| 761 |
hi_op2 = force_reg (SImode, hi_op2); |
| 762 |
|
| 763 |
emit_insn (gen_uaddvsi4 (hi_result, hi_op1, hi_op2, operands[3])); |
| 764 |
} |
| 765 |
else |
| 766 |
{ |
| 767 |
if (!arm_add_operand (lo_op2, SImode)) |
| 768 |
lo_op2 = force_reg (SImode, lo_op2); |
| 769 |
if (!arm_not_operand (hi_op2, SImode)) |
| 770 |
hi_op2 = force_reg (SImode, hi_op2); |
| 771 |
|
| 772 |
emit_insn (gen_addsi3_compare_op1 (lo_result, lo_op1, lo_op2)); |
| 773 |
|
| 774 |
if (hi_op2 == const0_rtx) |
| 775 |
emit_insn (gen_addsi3_cin_cout_0 (hi_result, hi_op1)); |
| 776 |
else if (CONST_INT_P (hi_op2)) |
| 777 |
emit_insn (gen_addsi3_cin_cout_imm (hi_result, hi_op1, hi_op2)); |
| 778 |
else |
| 779 |
emit_insn (gen_addsi3_cin_cout_reg (hi_result, hi_op1, hi_op2)); |
| 780 |
|
| 781 |
arm_gen_unlikely_cbranch (GEU, CC_ADCmode, operands[3]); |
| 782 |
} |
| 783 |
|
| 784 |
DONE; |
| 785 |
}) |
| 786 |
|
| 787 |
(define_expand "addsi3_cin_cout_reg" |
| 788 |
[(parallel |
| 789 |
[(set (match_dup 3) |
| 790 |
(compare:CC_ADC |
| 791 |
(plus:DI |
| 792 |
(plus:DI (match_dup 4) |
| 793 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand"))) |
| 794 |
(zero_extend:DI (match_operand:SI 2 "s_register_operand"))) |
| 795 |
(const_int 4294967296))) |
| 796 |
(set (match_operand:SI 0 "s_register_operand") |
| 797 |
(plus:SI (plus:SI (match_dup 5) (match_dup 1)) |
| 798 |
(match_dup 2)))])] |
| 799 |
"TARGET_32BIT" |
| 800 |
{ |
| 801 |
operands[3] = gen_rtx_REG (CC_ADCmode, CC_REGNUM); |
| 802 |
rtx ccin = gen_rtx_REG (CC_Cmode, CC_REGNUM); |
| 803 |
operands[4] = gen_rtx_LTU (DImode, ccin, const0_rtx); |
| 804 |
operands[5] = gen_rtx_LTU (SImode, ccin, const0_rtx); |
| 805 |
} |
| 806 |
) |
| 807 |
|
| 808 |
(define_insn "*addsi3_cin_cout_reg_insn" |
| 809 |
[(set (reg:CC_ADC CC_REGNUM) |
| 810 |
(compare:CC_ADC |
| 811 |
(plus:DI |
| 812 |
(plus:DI |
| 813 |
(match_operand:DI 3 "arm_carry_operation" "") |
| 814 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand" "%0,r"))) |
| 815 |
(zero_extend:DI (match_operand:SI 2 "s_register_operand" "l,r"))) |
| 816 |
(const_int 4294967296))) |
| 817 |
(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 818 |
(plus:SI (plus:SI (match_operand:SI 4 "arm_carry_operation" "") |
| 819 |
(match_dup 1)) |
| 820 |
(match_dup 2)))] |
| 821 |
"TARGET_32BIT" |
| 822 |
"@ |
| 823 |
adcs%?\\t%0, %0, %2 |
| 824 |
adcs%?\\t%0, %1, %2" |
| 825 |
[(set_attr "type" "alus_sreg") |
| 826 |
(set_attr "arch" "t2,*") |
| 827 |
(set_attr "length" "2,4")] |
| 828 |
) |
| 829 |
|
| 830 |
(define_expand "addsi3_cin_cout_imm" |
| 831 |
[(parallel |
| 832 |
[(set (match_dup 3) |
| 833 |
(compare:CC_ADC |
| 834 |
(plus:DI |
| 835 |
(plus:DI (match_dup 4) |
| 836 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand"))) |
| 837 |
(match_dup 6)) |
| 838 |
(const_int 4294967296))) |
| 839 |
(set (match_operand:SI 0 "s_register_operand") |
| 840 |
(plus:SI (plus:SI (match_dup 5) (match_dup 1)) |
| 841 |
(match_operand:SI 2 "arm_adcimm_operand")))])] |
| 842 |
"TARGET_32BIT" |
| 843 |
{ |
| 844 |
operands[3] = gen_rtx_REG (CC_ADCmode, CC_REGNUM); |
| 845 |
rtx ccin = gen_rtx_REG (CC_Cmode, CC_REGNUM); |
| 846 |
operands[4] = gen_rtx_LTU (DImode, ccin, const0_rtx); |
| 847 |
operands[5] = gen_rtx_LTU (SImode, ccin, const0_rtx); |
| 848 |
operands[6] = GEN_INT (UINTVAL (operands[2]) & 0xffffffff); |
| 849 |
} |
| 850 |
) |
| 851 |
|
| 852 |
(define_insn "*addsi3_cin_cout_imm_insn" |
| 853 |
[(set (reg:CC_ADC CC_REGNUM) |
| 854 |
(compare:CC_ADC |
| 855 |
(plus:DI |
| 856 |
(plus:DI |
| 857 |
(match_operand:DI 3 "arm_carry_operation" "") |
| 858 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand" "r,r"))) |
| 859 |
(match_operand:DI 5 "const_int_operand" "n,n")) |
| 860 |
(const_int 4294967296))) |
| 861 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 862 |
(plus:SI (plus:SI (match_operand:SI 4 "arm_carry_operation" "") |
| 863 |
(match_dup 1)) |
| 864 |
(match_operand:SI 2 "arm_adcimm_operand" "I,K")))] |
| 865 |
"TARGET_32BIT |
| 866 |
&& (UINTVAL (operands[2]) & 0xffffffff) == UINTVAL (operands[5])" |
| 867 |
"@ |
| 868 |
adcs%?\\t%0, %1, %2 |
| 869 |
sbcs%?\\t%0, %1, #%B2" |
| 870 |
[(set_attr "type" "alus_imm")] |
| 871 |
) |
| 872 |
|
| 873 |
(define_expand "addsi3_cin_cout_0" |
| 874 |
[(parallel |
| 875 |
[(set (match_dup 2) |
| 876 |
(compare:CC_ADC |
| 877 |
(plus:DI (match_dup 3) |
| 878 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand"))) |
| 879 |
(const_int 4294967296))) |
| 880 |
(set (match_operand:SI 0 "s_register_operand") |
| 881 |
(plus:SI (match_dup 4) (match_dup 1)))])] |
| 882 |
"TARGET_32BIT" |
| 883 |
{ |
| 884 |
operands[2] = gen_rtx_REG (CC_ADCmode, CC_REGNUM); |
| 885 |
rtx ccin = gen_rtx_REG (CC_Cmode, CC_REGNUM); |
| 886 |
operands[3] = gen_rtx_LTU (DImode, ccin, const0_rtx); |
| 887 |
operands[4] = gen_rtx_LTU (SImode, ccin, const0_rtx); |
| 888 |
} |
| 889 |
) |
| 890 |
|
| 891 |
(define_insn "*addsi3_cin_cout_0_insn" |
| 892 |
[(set (reg:CC_ADC CC_REGNUM) |
| 893 |
(compare:CC_ADC |
| 894 |
(plus:DI |
| 895 |
(match_operand:DI 2 "arm_carry_operation" "") |
| 896 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand" "r"))) |
| 897 |
(const_int 4294967296))) |
| 898 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 899 |
(plus:SI (match_operand:SI 3 "arm_carry_operation" "") (match_dup 1)))] |
| 900 |
"TARGET_32BIT" |
| 901 |
"adcs%?\\t%0, %1, #0" |
| 902 |
[(set_attr "type" "alus_imm")] |
| 903 |
) |
| 904 |
|
| 905 |
(define_expand "addsi3" |
| 906 |
[(set (match_operand:SI 0 "s_register_operand") |
| 907 |
(plus:SI (match_operand:SI 1 "s_register_operand") |
| 908 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 909 |
"TARGET_EITHER" |
| 910 |
" |
| 911 |
if (TARGET_32BIT && CONST_INT_P (operands[2])) |
| 912 |
{ |
| 913 |
arm_split_constant (PLUS, SImode, NULL_RTX, |
| 914 |
INTVAL (operands[2]), operands[0], operands[1], |
| 915 |
optimize && can_create_pseudo_p ()); |
| 916 |
DONE; |
| 917 |
} |
| 918 |
" |
| 919 |
) |
| 920 |
|
| 921 |
; If there is a scratch available, this will be faster than synthesizing the |
| 922 |
; addition. |
| 923 |
(define_peephole2 |
| 924 |
[(match_scratch:SI 3 "r") |
| 925 |
(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 926 |
(plus:SI (match_operand:SI 1 "arm_general_register_operand" "") |
| 927 |
(match_operand:SI 2 "const_int_operand" "")))] |
| 928 |
"TARGET_32BIT && |
| 929 |
!(const_ok_for_arm (INTVAL (operands[2])) |
| 930 |
|| const_ok_for_arm (-INTVAL (operands[2]))) |
| 931 |
&& const_ok_for_arm (~INTVAL (operands[2]))" |
| 932 |
[(set (match_dup 3) (match_dup 2)) |
| 933 |
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))] |
| 934 |
"" |
| 935 |
) |
| 936 |
|
| 937 |
;; The r/r/k alternative is required when reloading the address |
| 938 |
;; (plus (reg rN) (reg sp)) into (reg rN). In this case reload will |
| 939 |
;; put the duplicated register first, and not try the commutative version. |
| 940 |
(define_insn_and_split "*arm_addsi3" |
| 941 |
[(set (match_operand:SI 0 "s_register_operand" "=rk,l,l ,l ,r ,k ,r,k ,r ,k ,r ,k,k,r ,k ,r") |
| 942 |
(plus:SI (match_operand:SI 1 "s_register_operand" "%0 ,l,0 ,l ,rk,k ,r,r ,rk,k ,rk,k,r,rk,k ,rk") |
| 943 |
(match_operand:SI 2 "reg_or_int_operand" "rk ,l,Py,Pd,rI,rI,k,rI,Pj,Pj,L ,L,L,PJ,PJ,?n")))] |
| 944 |
"TARGET_32BIT" |
| 945 |
"@ |
| 946 |
add%?\\t%0, %0, %2 |
| 947 |
add%?\\t%0, %1, %2 |
| 948 |
add%?\\t%0, %1, %2 |
| 949 |
add%?\\t%0, %1, %2 |
| 950 |
add%?\\t%0, %1, %2 |
| 951 |
add%?\\t%0, %1, %2 |
| 952 |
add%?\\t%0, %2, %1 |
| 953 |
add%?\\t%0, %1, %2 |
| 954 |
addw%?\\t%0, %1, %2 |
| 955 |
addw%?\\t%0, %1, %2 |
| 956 |
sub%?\\t%0, %1, #%n2 |
| 957 |
sub%?\\t%0, %1, #%n2 |
| 958 |
sub%?\\t%0, %1, #%n2 |
| 959 |
subw%?\\t%0, %1, #%n2 |
| 960 |
subw%?\\t%0, %1, #%n2 |
| 961 |
#" |
| 962 |
"TARGET_32BIT |
| 963 |
&& CONST_INT_P (operands[2]) |
| 964 |
&& !const_ok_for_op (INTVAL (operands[2]), PLUS) |
| 965 |
&& (reload_completed || !arm_eliminable_register (operands[1]))" |
| 966 |
[(clobber (const_int 0))] |
| 967 |
" |
| 968 |
arm_split_constant (PLUS, SImode, curr_insn, |
| 969 |
INTVAL (operands[2]), operands[0], |
| 970 |
operands[1], 0); |
| 971 |
DONE; |
| 972 |
" |
| 973 |
[(set_attr "length" "2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,16") |
| 974 |
(set_attr "predicable" "yes") |
| 975 |
(set_attr "predicable_short_it" "yes,yes,yes,yes,no,no,no,no,no,no,no,no,no,no,no,no") |
| 976 |
(set_attr "arch" "t2,t2,t2,t2,*,*,*,a,t2,t2,*,*,a,t2,t2,*") |
| 977 |
(set (attr "type") (if_then_else (match_operand 2 "const_int_operand" "") |
| 978 |
(const_string "alu_imm") |
| 979 |
(const_string "alu_sreg"))) |
| 980 |
] |
| 981 |
) |
| 982 |
|
| 983 |
(define_insn "addsi3_compareV_reg" |
| 984 |
[(set (reg:CC_V CC_REGNUM) |
| 985 |
(compare:CC_V |
| 986 |
(plus:DI |
| 987 |
(sign_extend:DI (match_operand:SI 1 "register_operand" "%l,0,r")) |
| 988 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "l,r,r"))) |
| 989 |
(sign_extend:DI (plus:SI (match_dup 1) (match_dup 2))))) |
| 990 |
(set (match_operand:SI 0 "register_operand" "=l,r,r") |
| 991 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 992 |
"TARGET_32BIT" |
| 993 |
"adds%?\\t%0, %1, %2" |
| 994 |
[(set_attr "conds" "set") |
| 995 |
(set_attr "arch" "t2,t2,*") |
| 996 |
(set_attr "length" "2,2,4") |
| 997 |
(set_attr "type" "alus_sreg")] |
| 998 |
) |
| 999 |
|
| 1000 |
(define_insn "*addsi3_compareV_reg_nosum" |
| 1001 |
[(set (reg:CC_V CC_REGNUM) |
| 1002 |
(compare:CC_V |
| 1003 |
(plus:DI |
| 1004 |
(sign_extend:DI (match_operand:SI 0 "register_operand" "%l,r")) |
| 1005 |
(sign_extend:DI (match_operand:SI 1 "register_operand" "l,r"))) |
| 1006 |
(sign_extend:DI (plus:SI (match_dup 0) (match_dup 1)))))] |
| 1007 |
"TARGET_32BIT" |
| 1008 |
"cmn%?\\t%0, %1" |
| 1009 |
[(set_attr "conds" "set") |
| 1010 |
(set_attr "arch" "t2,*") |
| 1011 |
(set_attr "length" "2,4") |
| 1012 |
(set_attr "type" "alus_sreg")] |
| 1013 |
) |
| 1014 |
|
| 1015 |
(define_insn "sub_cmpVsi3_intmin" |
| 1016 |
[(set (reg:CC_V CC_REGNUM) |
| 1017 |
(compare:CC_V |
| 1018 |
(plus:DI |
| 1019 |
(sign_extend:DI |
| 1020 |
(match_operand:SI 1 "register_operand" "r")) |
| 1021 |
(const_int 2147483648)) |
| 1022 |
(sign_extend:DI (plus:SI (match_dup 1) (const_int -2147483648))))) |
| 1023 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 1024 |
(plus:SI (match_dup 1) (const_int -2147483648)))] |
| 1025 |
"TARGET_32BIT" |
| 1026 |
"subs%?\\t%0, %1, #-2147483648" |
| 1027 |
[(set_attr "conds" "set") |
| 1028 |
(set_attr "type" "alus_imm")] |
| 1029 |
) |
| 1030 |
|
| 1031 |
(define_insn "addsi3_compareV_imm" |
| 1032 |
[(set (reg:CC_V CC_REGNUM) |
| 1033 |
(compare:CC_V |
| 1034 |
(plus:DI |
| 1035 |
(sign_extend:DI |
| 1036 |
(match_operand:SI 1 "register_operand" "l,0,l,0,r,r")) |
| 1037 |
(match_operand 2 "arm_addimm_operand" "Pd,Py,Px,Pw,I,L")) |
| 1038 |
(sign_extend:DI (plus:SI (match_dup 1) (match_dup 2))))) |
| 1039 |
(set (match_operand:SI 0 "register_operand" "=l,l,l,l,r,r") |
| 1040 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 1041 |
"TARGET_32BIT |
| 1042 |
&& INTVAL (operands[2]) == ARM_SIGN_EXTEND (INTVAL (operands[2]))" |
| 1043 |
"@ |
| 1044 |
adds%?\\t%0, %1, %2 |
| 1045 |
adds%?\\t%0, %0, %2 |
| 1046 |
subs%?\\t%0, %1, #%n2 |
| 1047 |
subs%?\\t%0, %0, #%n2 |
| 1048 |
adds%?\\t%0, %1, %2 |
| 1049 |
subs%?\\t%0, %1, #%n2" |
| 1050 |
[(set_attr "conds" "set") |
| 1051 |
(set_attr "arch" "t2,t2,t2,t2,*,*") |
| 1052 |
(set_attr "length" "2,2,2,2,4,4") |
| 1053 |
(set_attr "type" "alus_imm")] |
| 1054 |
) |
| 1055 |
|
| 1056 |
(define_insn "addsi3_compareV_imm_nosum" |
| 1057 |
[(set (reg:CC_V CC_REGNUM) |
| 1058 |
(compare:CC_V |
| 1059 |
(plus:DI |
| 1060 |
(sign_extend:DI |
| 1061 |
(match_operand:SI 0 "register_operand" "l,r,r")) |
| 1062 |
(match_operand 1 "arm_addimm_operand" "Pw,I,L")) |
| 1063 |
(sign_extend:DI (plus:SI (match_dup 0) (match_dup 1)))))] |
| 1064 |
"TARGET_32BIT |
| 1065 |
&& INTVAL (operands[1]) == ARM_SIGN_EXTEND (INTVAL (operands[1]))" |
| 1066 |
"@ |
| 1067 |
cmp%?\\t%0, #%n1 |
| 1068 |
cmn%?\\t%0, %1 |
| 1069 |
cmp%?\\t%0, #%n1" |
| 1070 |
[(set_attr "conds" "set") |
| 1071 |
(set_attr "arch" "t2,*,*") |
| 1072 |
(set_attr "length" "2,4,4") |
| 1073 |
(set_attr "type" "alus_imm")] |
| 1074 |
) |
| 1075 |
|
| 1076 |
;; We can handle more constants efficently if we can clobber either a scratch |
| 1077 |
;; or the other source operand. We deliberately leave this late as in |
| 1078 |
;; high register pressure situations it's not worth forcing any reloads. |
| 1079 |
(define_peephole2 |
| 1080 |
[(match_scratch:SI 2 "l") |
| 1081 |
(set (reg:CC_V CC_REGNUM) |
| 1082 |
(compare:CC_V |
| 1083 |
(plus:DI |
| 1084 |
(sign_extend:DI |
| 1085 |
(match_operand:SI 0 "low_register_operand")) |
| 1086 |
(match_operand 1 "const_int_operand")) |
| 1087 |
(sign_extend:DI (plus:SI (match_dup 0) (match_dup 1)))))] |
| 1088 |
"TARGET_THUMB2 |
| 1089 |
&& satisfies_constraint_Pd (operands[1])" |
| 1090 |
[(parallel[ |
| 1091 |
(set (reg:CC_V CC_REGNUM) |
| 1092 |
(compare:CC_V |
| 1093 |
(plus:DI (sign_extend:DI (match_dup 0)) |
| 1094 |
(sign_extend:DI (match_dup 1))) |
| 1095 |
(sign_extend:DI (plus:SI (match_dup 0) (match_dup 1))))) |
| 1096 |
(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))])] |
| 1097 |
) |
| 1098 |
|
| 1099 |
(define_peephole2 |
| 1100 |
[(set (reg:CC_V CC_REGNUM) |
| 1101 |
(compare:CC_V |
| 1102 |
(plus:DI |
| 1103 |
(sign_extend:DI |
| 1104 |
(match_operand:SI 0 "low_register_operand")) |
| 1105 |
(match_operand 1 "const_int_operand")) |
| 1106 |
(sign_extend:DI (plus:SI (match_dup 0) (match_dup 1)))))] |
| 1107 |
"TARGET_THUMB2 |
| 1108 |
&& dead_or_set_p (peep2_next_insn (0), operands[0]) |
| 1109 |
&& satisfies_constraint_Py (operands[1])" |
| 1110 |
[(parallel[ |
| 1111 |
(set (reg:CC_V CC_REGNUM) |
| 1112 |
(compare:CC_V |
| 1113 |
(plus:DI (sign_extend:DI (match_dup 0)) |
| 1114 |
(sign_extend:DI (match_dup 1))) |
| 1115 |
(sign_extend:DI (plus:SI (match_dup 0) (match_dup 1))))) |
| 1116 |
(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))])] |
| 1117 |
) |
| 1118 |
|
| 1119 |
(define_insn "addsi3_compare0" |
| 1120 |
[(set (reg:CC_NZ CC_REGNUM) |
| 1121 |
(compare:CC_NZ |
| 1122 |
(plus:SI (match_operand:SI 1 "s_register_operand" "r, r,r") |
| 1123 |
(match_operand:SI 2 "arm_add_operand" "I,L,r")) |
| 1124 |
(const_int 0))) |
| 1125 |
(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 1126 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 1127 |
"TARGET_ARM" |
| 1128 |
"@ |
| 1129 |
adds%?\\t%0, %1, %2 |
| 1130 |
subs%?\\t%0, %1, #%n2 |
| 1131 |
adds%?\\t%0, %1, %2" |
| 1132 |
[(set_attr "conds" "set") |
| 1133 |
(set_attr "type" "alus_imm,alus_imm,alus_sreg")] |
| 1134 |
) |
| 1135 |
|
| 1136 |
(define_insn "*addsi3_compare0_scratch" |
| 1137 |
[(set (reg:CC_NZ CC_REGNUM) |
| 1138 |
(compare:CC_NZ |
| 1139 |
(plus:SI (match_operand:SI 0 "s_register_operand" "r, r, r") |
| 1140 |
(match_operand:SI 1 "arm_add_operand" "I,L, r")) |
| 1141 |
(const_int 0)))] |
| 1142 |
"TARGET_ARM" |
| 1143 |
"@ |
| 1144 |
cmn%?\\t%0, %1 |
| 1145 |
cmp%?\\t%0, #%n1 |
| 1146 |
cmn%?\\t%0, %1" |
| 1147 |
[(set_attr "conds" "set") |
| 1148 |
(set_attr "predicable" "yes") |
| 1149 |
(set_attr "type" "alus_imm,alus_imm,alus_sreg")] |
| 1150 |
) |
| 1151 |
|
| 1152 |
(define_insn "*compare_negsi_si" |
| 1153 |
[(set (reg:CC_Z CC_REGNUM) |
| 1154 |
(compare:CC_Z |
| 1155 |
(neg:SI (match_operand:SI 0 "s_register_operand" "l,r")) |
| 1156 |
(match_operand:SI 1 "s_register_operand" "l,r")))] |
| 1157 |
"TARGET_32BIT" |
| 1158 |
"cmn%?\\t%1, %0" |
| 1159 |
[(set_attr "conds" "set") |
| 1160 |
(set_attr "predicable" "yes") |
| 1161 |
(set_attr "arch" "t2,*") |
| 1162 |
(set_attr "length" "2,4") |
| 1163 |
(set_attr "predicable_short_it" "yes,no") |
| 1164 |
(set_attr "type" "alus_sreg")] |
| 1165 |
) |
| 1166 |
|
| 1167 |
;; This is the canonicalization of subsi3_compare when the |
| 1168 |
;; addend is a constant. |
| 1169 |
(define_insn "cmpsi2_addneg" |
| 1170 |
[(set (reg:CC CC_REGNUM) |
| 1171 |
(compare:CC |
| 1172 |
(match_operand:SI 1 "s_register_operand" "r,r") |
| 1173 |
(match_operand:SI 2 "arm_addimm_operand" "I,L"))) |
| 1174 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1175 |
(plus:SI (match_dup 1) |
| 1176 |
(match_operand:SI 3 "arm_addimm_operand" "L,I")))] |
| 1177 |
"TARGET_32BIT |
| 1178 |
&& (INTVAL (operands[2]) |
| 1179 |
== trunc_int_for_mode (-INTVAL (operands[3]), SImode))" |
| 1180 |
{ |
| 1181 |
/* For 0 and INT_MIN it is essential that we use subs, as adds will result |
| 1182 |
in different condition codes (like cmn rather than like cmp), so that |
| 1183 |
alternative comes first. Both alternatives can match for any 0x??000000 |
| 1184 |
where except for 0 and INT_MIN it doesn't matter what we choose, and also |
| 1185 |
for -1 and 1 with TARGET_THUMB2, in that case prefer instruction with #1 |
| 1186 |
as it is shorter. */ |
| 1187 |
if (which_alternative == 0 && operands[3] != const1_rtx) |
| 1188 |
return "subs%?\\t%0, %1, #%n3"; |
| 1189 |
else |
| 1190 |
return "adds%?\\t%0, %1, %3"; |
| 1191 |
} |
| 1192 |
[(set_attr "conds" "set") |
| 1193 |
(set_attr "type" "alus_sreg")] |
| 1194 |
) |
| 1195 |
|
| 1196 |
;; Convert the sequence |
| 1197 |
;; sub rd, rn, #1 |
| 1198 |
;; cmn rd, #1 (equivalent to cmp rd, #-1) |
| 1199 |
;; bne dest |
| 1200 |
;; into |
| 1201 |
;; subs rd, rn, #1 |
| 1202 |
;; bcs dest ((unsigned)rn >= 1) |
| 1203 |
;; similarly for the beq variant using bcc. |
| 1204 |
;; This is a common looping idiom (while (n--)) |
| 1205 |
(define_peephole2 |
| 1206 |
[(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 1207 |
(plus:SI (match_operand:SI 1 "arm_general_register_operand" "") |
| 1208 |
(const_int -1))) |
| 1209 |
(set (match_operand 2 "cc_register" "") |
| 1210 |
(compare (match_dup 0) (const_int -1))) |
| 1211 |
(set (pc) |
| 1212 |
(if_then_else (match_operator 3 "equality_operator" |
| 1213 |
[(match_dup 2) (const_int 0)]) |
| 1214 |
(match_operand 4 "" "") |
| 1215 |
(match_operand 5 "" "")))] |
| 1216 |
"TARGET_32BIT && peep2_reg_dead_p (3, operands[2])" |
| 1217 |
[(parallel[ |
| 1218 |
(set (match_dup 2) |
| 1219 |
(compare:CC |
| 1220 |
(match_dup 1) (const_int 1))) |
| 1221 |
(set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))]) |
| 1222 |
(set (pc) |
| 1223 |
(if_then_else (match_op_dup 3 [(match_dup 2) (const_int 0)]) |
| 1224 |
(match_dup 4) |
| 1225 |
(match_dup 5)))] |
| 1226 |
"operands[2] = gen_rtx_REG (CCmode, CC_REGNUM); |
| 1227 |
operands[3] = gen_rtx_fmt_ee ((GET_CODE (operands[3]) == NE |
| 1228 |
? GEU : LTU), |
| 1229 |
VOIDmode, |
| 1230 |
operands[2], const0_rtx);" |
| 1231 |
) |
| 1232 |
|
| 1233 |
;; The next four insns work because they compare the result with one of |
| 1234 |
;; the operands, and we know that the use of the condition code is |
| 1235 |
;; either GEU or LTU, so we can use the carry flag from the addition |
| 1236 |
;; instead of doing the compare a second time. |
| 1237 |
(define_insn "addsi3_compare_op1" |
| 1238 |
[(set (reg:CC_C CC_REGNUM) |
| 1239 |
(compare:CC_C |
| 1240 |
(plus:SI (match_operand:SI 1 "s_register_operand" "l,0,l,0,rk,rk") |
| 1241 |
(match_operand:SI 2 "arm_add_operand" "lPd,Py,lPx,Pw,rkI,L")) |
| 1242 |
(match_dup 1))) |
| 1243 |
(set (match_operand:SI 0 "s_register_operand" "=l,l,l,l,rk,rk") |
| 1244 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 1245 |
"TARGET_32BIT" |
| 1246 |
"@ |
| 1247 |
adds%?\\t%0, %1, %2 |
| 1248 |
adds%?\\t%0, %0, %2 |
| 1249 |
subs%?\\t%0, %1, #%n2 |
| 1250 |
subs%?\\t%0, %0, #%n2 |
| 1251 |
adds%?\\t%0, %1, %2 |
| 1252 |
subs%?\\t%0, %1, #%n2" |
| 1253 |
[(set_attr "conds" "set") |
| 1254 |
(set_attr "arch" "t2,t2,t2,t2,*,*") |
| 1255 |
(set_attr "length" "2,2,2,2,4,4") |
| 1256 |
(set (attr "type") |
| 1257 |
(if_then_else (match_operand 2 "const_int_operand") |
| 1258 |
(const_string "alu_imm") |
| 1259 |
(const_string "alu_sreg")))] |
| 1260 |
) |
| 1261 |
|
| 1262 |
(define_insn "*addsi3_compare_op2" |
| 1263 |
[(set (reg:CC_C CC_REGNUM) |
| 1264 |
(compare:CC_C |
| 1265 |
(plus:SI (match_operand:SI 1 "s_register_operand" "l,0,l,0,r,r") |
| 1266 |
(match_operand:SI 2 "arm_add_operand" "lPd,Py,lPx,Pw,rI,L")) |
| 1267 |
(match_dup 2))) |
| 1268 |
(set (match_operand:SI 0 "s_register_operand" "=l,l,l,l,r,r") |
| 1269 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 1270 |
"TARGET_32BIT" |
| 1271 |
"@ |
| 1272 |
adds%?\\t%0, %1, %2 |
| 1273 |
adds%?\\t%0, %0, %2 |
| 1274 |
subs%?\\t%0, %1, #%n2 |
| 1275 |
subs%?\\t%0, %0, #%n2 |
| 1276 |
adds%?\\t%0, %1, %2 |
| 1277 |
subs%?\\t%0, %1, #%n2" |
| 1278 |
[(set_attr "conds" "set") |
| 1279 |
(set_attr "arch" "t2,t2,t2,t2,*,*") |
| 1280 |
(set_attr "length" "2,2,2,2,4,4") |
| 1281 |
(set (attr "type") |
| 1282 |
(if_then_else (match_operand 2 "const_int_operand") |
| 1283 |
(const_string "alu_imm") |
| 1284 |
(const_string "alu_sreg")))] |
| 1285 |
) |
| 1286 |
|
| 1287 |
(define_insn "*compare_addsi2_op0" |
| 1288 |
[(set (reg:CC_C CC_REGNUM) |
| 1289 |
(compare:CC_C |
| 1290 |
(plus:SI (match_operand:SI 0 "s_register_operand" "l,l,r,r") |
| 1291 |
(match_operand:SI 1 "arm_add_operand" "l,Pw,rI,L")) |
| 1292 |
(match_dup 0)))] |
| 1293 |
"TARGET_32BIT" |
| 1294 |
"@ |
| 1295 |
cmn%?\\t%0, %1 |
| 1296 |
cmp%?\\t%0, #%n1 |
| 1297 |
cmn%?\\t%0, %1 |
| 1298 |
cmp%?\\t%0, #%n1" |
| 1299 |
[(set_attr "conds" "set") |
| 1300 |
(set_attr "predicable" "yes") |
| 1301 |
(set_attr "arch" "t2,t2,*,*") |
| 1302 |
(set_attr "predicable_short_it" "yes,yes,no,no") |
| 1303 |
(set_attr "length" "2,2,4,4") |
| 1304 |
(set (attr "type") |
| 1305 |
(if_then_else (match_operand 1 "const_int_operand") |
| 1306 |
(const_string "alu_imm") |
| 1307 |
(const_string "alu_sreg")))] |
| 1308 |
) |
| 1309 |
|
| 1310 |
(define_insn "*compare_addsi2_op1" |
| 1311 |
[(set (reg:CC_C CC_REGNUM) |
| 1312 |
(compare:CC_C |
| 1313 |
(plus:SI (match_operand:SI 0 "s_register_operand" "l,l,r,r") |
| 1314 |
(match_operand:SI 1 "arm_add_operand" "l,Pw,rI,L")) |
| 1315 |
(match_dup 1)))] |
| 1316 |
"TARGET_32BIT" |
| 1317 |
"@ |
| 1318 |
cmn%?\\t%0, %1 |
| 1319 |
cmp%?\\t%0, #%n1 |
| 1320 |
cmn%?\\t%0, %1 |
| 1321 |
cmp%?\\t%0, #%n1" |
| 1322 |
[(set_attr "conds" "set") |
| 1323 |
(set_attr "predicable" "yes") |
| 1324 |
(set_attr "arch" "t2,t2,*,*") |
| 1325 |
(set_attr "predicable_short_it" "yes,yes,no,no") |
| 1326 |
(set_attr "length" "2,2,4,4") |
| 1327 |
(set (attr "type") |
| 1328 |
(if_then_else (match_operand 1 "const_int_operand") |
| 1329 |
(const_string "alu_imm") |
| 1330 |
(const_string "alu_sreg")))] |
| 1331 |
) |
| 1332 |
|
| 1333 |
(define_insn "addsi3_carryin" |
| 1334 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r,r") |
| 1335 |
(plus:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%l,r,r") |
| 1336 |
(match_operand:SI 2 "arm_not_operand" "0,rI,K")) |
| 1337 |
(match_operand:SI 3 "arm_carry_operation" "")))] |
| 1338 |
"TARGET_32BIT" |
| 1339 |
"@ |
| 1340 |
adc%?\\t%0, %1, %2 |
| 1341 |
adc%?\\t%0, %1, %2 |
| 1342 |
sbc%?\\t%0, %1, #%B2" |
| 1343 |
[(set_attr "conds" "use") |
| 1344 |
(set_attr "predicable" "yes") |
| 1345 |
(set_attr "arch" "t2,*,*") |
| 1346 |
(set_attr "length" "4") |
| 1347 |
(set_attr "predicable_short_it" "yes,no,no") |
| 1348 |
(set_attr "type" "adc_reg,adc_reg,adc_imm")] |
| 1349 |
) |
| 1350 |
|
| 1351 |
;; Canonicalization of the above when the immediate is zero. |
| 1352 |
(define_insn "add0si3_carryin" |
| 1353 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 1354 |
(plus:SI (match_operand:SI 2 "arm_carry_operation" "") |
| 1355 |
(match_operand:SI 1 "arm_not_operand" "r")))] |
| 1356 |
"TARGET_32BIT" |
| 1357 |
"adc%?\\t%0, %1, #0" |
| 1358 |
[(set_attr "conds" "use") |
| 1359 |
(set_attr "predicable" "yes") |
| 1360 |
(set_attr "length" "4") |
| 1361 |
(set_attr "type" "adc_imm")] |
| 1362 |
) |
| 1363 |
|
| 1364 |
(define_insn "*addsi3_carryin_alt2" |
| 1365 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r,r") |
| 1366 |
(plus:SI (plus:SI (match_operand:SI 3 "arm_carry_operation" "") |
| 1367 |
(match_operand:SI 1 "s_register_operand" "%l,r,r")) |
| 1368 |
(match_operand:SI 2 "arm_not_operand" "l,rI,K")))] |
| 1369 |
"TARGET_32BIT" |
| 1370 |
"@ |
| 1371 |
adc%?\\t%0, %1, %2 |
| 1372 |
adc%?\\t%0, %1, %2 |
| 1373 |
sbc%?\\t%0, %1, #%B2" |
| 1374 |
[(set_attr "conds" "use") |
| 1375 |
(set_attr "predicable" "yes") |
| 1376 |
(set_attr "arch" "t2,*,*") |
| 1377 |
(set_attr "length" "4") |
| 1378 |
(set_attr "predicable_short_it" "yes,no,no") |
| 1379 |
(set_attr "type" "adc_reg,adc_reg,adc_imm")] |
| 1380 |
) |
| 1381 |
|
| 1382 |
(define_insn "*addsi3_carryin_shift" |
| 1383 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1384 |
(plus:SI (plus:SI |
| 1385 |
(match_operator:SI 2 "shift_operator" |
| 1386 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 1387 |
(match_operand:SI 4 "shift_amount_operand" "M,r")]) |
| 1388 |
(match_operand:SI 5 "arm_carry_operation" "")) |
| 1389 |
(match_operand:SI 1 "s_register_operand" "r,r")))] |
| 1390 |
"TARGET_32BIT" |
| 1391 |
"adc%?\\t%0, %1, %3%S2" |
| 1392 |
[(set_attr "conds" "use") |
| 1393 |
(set_attr "arch" "32,a") |
| 1394 |
(set_attr "shift" "3") |
| 1395 |
(set_attr "predicable" "yes") |
| 1396 |
(set_attr "autodetect_type" "alu_shift_operator2")] |
| 1397 |
) |
| 1398 |
|
| 1399 |
(define_insn "*addsi3_carryin_clobercc" |
| 1400 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 1401 |
(plus:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%r") |
| 1402 |
(match_operand:SI 2 "arm_rhs_operand" "rI")) |
| 1403 |
(match_operand:SI 3 "arm_carry_operation" ""))) |
| 1404 |
(clobber (reg:CC CC_REGNUM))] |
| 1405 |
"TARGET_32BIT" |
| 1406 |
"adcs%?\\t%0, %1, %2" |
| 1407 |
[(set_attr "conds" "set") |
| 1408 |
(set_attr "type" "adcs_reg")] |
| 1409 |
) |
| 1410 |
|
| 1411 |
(define_expand "subvsi4" |
| 1412 |
[(match_operand:SI 0 "s_register_operand") |
| 1413 |
(match_operand:SI 1 "arm_rhs_operand") |
| 1414 |
(match_operand:SI 2 "arm_add_operand") |
| 1415 |
(match_operand 3 "")] |
| 1416 |
"TARGET_32BIT" |
| 1417 |
{ |
| 1418 |
if (CONST_INT_P (operands[1]) && CONST_INT_P (operands[2])) |
| 1419 |
{ |
| 1420 |
/* If both operands are constants we can decide the result statically. */ |
| 1421 |
wi::overflow_type overflow; |
| 1422 |
wide_int val = wi::sub (rtx_mode_t (operands[1], SImode), |
| 1423 |
rtx_mode_t (operands[2], SImode), |
| 1424 |
SIGNED, &overflow); |
| 1425 |
emit_move_insn (operands[0], GEN_INT (val.to_shwi ())); |
| 1426 |
if (overflow != wi::OVF_NONE) |
| 1427 |
emit_jump_insn (gen_jump (operands[3])); |
| 1428 |
DONE; |
| 1429 |
} |
| 1430 |
else if (CONST_INT_P (operands[2])) |
| 1431 |
{ |
| 1432 |
operands[2] = GEN_INT (-INTVAL (operands[2])); |
| 1433 |
/* Special case for INT_MIN. */ |
| 1434 |
if (INTVAL (operands[2]) == 0x80000000) |
| 1435 |
emit_insn (gen_sub_cmpVsi3_intmin (operands[0], operands[1])); |
| 1436 |
else |
| 1437 |
emit_insn (gen_addsi3_compareV_imm (operands[0], operands[1], |
| 1438 |
operands[2])); |
| 1439 |
} |
| 1440 |
else if (CONST_INT_P (operands[1])) |
| 1441 |
emit_insn (gen_sub_cmpVsi3_imm1 (operands[0], operands[1], operands[2])); |
| 1442 |
else |
| 1443 |
emit_insn (gen_sub_cmpVsi3 (operands[0], operands[1], operands[2])); |
| 1444 |
|
| 1445 |
arm_gen_unlikely_cbranch (NE, CC_Vmode, operands[3]); |
| 1446 |
DONE; |
| 1447 |
}) |
| 1448 |
|
| 1449 |
(define_expand "subvdi4" |
| 1450 |
[(match_operand:DI 0 "s_register_operand") |
| 1451 |
(match_operand:DI 1 "reg_or_int_operand") |
| 1452 |
(match_operand:DI 2 "reg_or_int_operand") |
| 1453 |
(match_operand 3 "")] |
| 1454 |
"TARGET_32BIT" |
| 1455 |
{ |
| 1456 |
rtx lo_result, hi_result; |
| 1457 |
rtx lo_op1, hi_op1, lo_op2, hi_op2; |
| 1458 |
lo_result = gen_lowpart (SImode, operands[0]); |
| 1459 |
hi_result = gen_highpart (SImode, operands[0]); |
| 1460 |
machine_mode mode = CCmode; |
| 1461 |
|
| 1462 |
if (CONST_INT_P (operands[1]) && CONST_INT_P (operands[2])) |
| 1463 |
{ |
| 1464 |
/* If both operands are constants we can decide the result statically. */ |
| 1465 |
wi::overflow_type overflow; |
| 1466 |
wide_int val = wi::sub (rtx_mode_t (operands[1], DImode), |
| 1467 |
rtx_mode_t (operands[2], DImode), |
| 1468 |
SIGNED, &overflow); |
| 1469 |
emit_move_insn (operands[0], GEN_INT (val.to_shwi ())); |
| 1470 |
if (overflow != wi::OVF_NONE) |
| 1471 |
emit_jump_insn (gen_jump (operands[3])); |
| 1472 |
DONE; |
| 1473 |
} |
| 1474 |
else if (CONST_INT_P (operands[1])) |
| 1475 |
{ |
| 1476 |
arm_decompose_di_binop (operands[2], operands[1], &lo_op2, &hi_op2, |
| 1477 |
&lo_op1, &hi_op1); |
| 1478 |
if (const_ok_for_arm (INTVAL (lo_op1))) |
| 1479 |
{ |
| 1480 |
emit_insn (gen_rsb_imm_compare (lo_result, lo_op1, lo_op2, |
| 1481 |
GEN_INT (~UINTVAL (lo_op1)))); |
| 1482 |
/* We could potentially use RSC here in Arm state, but not |
| 1483 |
in Thumb, so it's probably not worth the effort of handling |
| 1484 |
this. */ |
| 1485 |
hi_op1 = force_reg (SImode, hi_op1); |
| 1486 |
mode = CC_RSBmode; |
| 1487 |
goto highpart; |
| 1488 |
} |
| 1489 |
operands[1] = force_reg (DImode, operands[1]); |
| 1490 |
} |
| 1491 |
|
| 1492 |
arm_decompose_di_binop (operands[1], operands[2], &lo_op1, &hi_op1, |
| 1493 |
&lo_op2, &hi_op2); |
| 1494 |
if (lo_op2 == const0_rtx) |
| 1495 |
{ |
| 1496 |
emit_move_insn (lo_result, lo_op1); |
| 1497 |
if (!arm_add_operand (hi_op2, SImode)) |
| 1498 |
hi_op2 = force_reg (SImode, hi_op2); |
| 1499 |
emit_insn (gen_subvsi4 (hi_result, hi_op1, hi_op2, operands[3])); |
| 1500 |
DONE; |
| 1501 |
} |
| 1502 |
|
| 1503 |
if (CONST_INT_P (lo_op2) && !arm_addimm_operand (lo_op2, SImode)) |
| 1504 |
lo_op2 = force_reg (SImode, lo_op2); |
| 1505 |
if (CONST_INT_P (lo_op2)) |
| 1506 |
emit_insn (gen_cmpsi2_addneg (lo_result, lo_op1, lo_op2, |
| 1507 |
gen_int_mode (-INTVAL (lo_op2), SImode))); |
| 1508 |
else |
| 1509 |
emit_insn (gen_subsi3_compare1 (lo_result, lo_op1, lo_op2)); |
| 1510 |
|
| 1511 |
highpart: |
| 1512 |
if (!arm_not_operand (hi_op2, SImode)) |
| 1513 |
hi_op2 = force_reg (SImode, hi_op2); |
| 1514 |
rtx ccreg = gen_rtx_REG (mode, CC_REGNUM); |
| 1515 |
if (CONST_INT_P (hi_op2)) |
| 1516 |
emit_insn (gen_sub_cmpVsi3_borrow_imm (hi_result, hi_op1, hi_op2, |
| 1517 |
gen_rtx_LTU (SImode, ccreg, |
| 1518 |
const0_rtx), |
| 1519 |
gen_rtx_LTU (DImode, ccreg, |
| 1520 |
const0_rtx))); |
| 1521 |
else |
| 1522 |
emit_insn (gen_sub_cmpVsi3_borrow (hi_result, hi_op1, hi_op2, |
| 1523 |
gen_rtx_LTU (SImode, ccreg, const0_rtx), |
| 1524 |
gen_rtx_LTU (DImode, ccreg, |
| 1525 |
const0_rtx))); |
| 1526 |
arm_gen_unlikely_cbranch (NE, CC_Vmode, operands[3]); |
| 1527 |
|
| 1528 |
DONE; |
| 1529 |
}) |
| 1530 |
|
| 1531 |
(define_expand "usubvsi4" |
| 1532 |
[(match_operand:SI 0 "s_register_operand") |
| 1533 |
(match_operand:SI 1 "arm_rhs_operand") |
| 1534 |
(match_operand:SI 2 "arm_add_operand") |
| 1535 |
(match_operand 3 "")] |
| 1536 |
"TARGET_32BIT" |
| 1537 |
{ |
| 1538 |
machine_mode mode = CCmode; |
| 1539 |
if (CONST_INT_P (operands[1]) && CONST_INT_P (operands[2])) |
| 1540 |
{ |
| 1541 |
/* If both operands are constants we can decide the result statically. */ |
| 1542 |
wi::overflow_type overflow; |
| 1543 |
wide_int val = wi::sub (rtx_mode_t (operands[1], SImode), |
| 1544 |
rtx_mode_t (operands[2], SImode), |
| 1545 |
UNSIGNED, &overflow); |
| 1546 |
emit_move_insn (operands[0], GEN_INT (val.to_shwi ())); |
| 1547 |
if (overflow != wi::OVF_NONE) |
| 1548 |
emit_jump_insn (gen_jump (operands[3])); |
| 1549 |
DONE; |
| 1550 |
} |
| 1551 |
else if (CONST_INT_P (operands[2])) |
| 1552 |
emit_insn (gen_cmpsi2_addneg (operands[0], operands[1], operands[2], |
| 1553 |
gen_int_mode (-INTVAL (operands[2]), |
| 1554 |
SImode))); |
| 1555 |
else if (CONST_INT_P (operands[1])) |
| 1556 |
{ |
| 1557 |
mode = CC_RSBmode; |
| 1558 |
emit_insn (gen_rsb_imm_compare (operands[0], operands[1], operands[2], |
| 1559 |
GEN_INT (~UINTVAL (operands[1])))); |
| 1560 |
} |
| 1561 |
else |
| 1562 |
emit_insn (gen_subsi3_compare1 (operands[0], operands[1], operands[2])); |
| 1563 |
arm_gen_unlikely_cbranch (LTU, mode, operands[3]); |
| 1564 |
|
| 1565 |
DONE; |
| 1566 |
}) |
| 1567 |
|
| 1568 |
(define_expand "usubvdi4" |
| 1569 |
[(match_operand:DI 0 "s_register_operand") |
| 1570 |
(match_operand:DI 1 "reg_or_int_operand") |
| 1571 |
(match_operand:DI 2 "reg_or_int_operand") |
| 1572 |
(match_operand 3 "")] |
| 1573 |
"TARGET_32BIT" |
| 1574 |
{ |
| 1575 |
rtx lo_result, hi_result; |
| 1576 |
rtx lo_op1, hi_op1, lo_op2, hi_op2; |
| 1577 |
lo_result = gen_lowpart (SImode, operands[0]); |
| 1578 |
hi_result = gen_highpart (SImode, operands[0]); |
| 1579 |
machine_mode mode = CCmode; |
| 1580 |
|
| 1581 |
if (CONST_INT_P (operands[1]) && CONST_INT_P (operands[2])) |
| 1582 |
{ |
| 1583 |
/* If both operands are constants we can decide the result statically. */ |
| 1584 |
wi::overflow_type overflow; |
| 1585 |
wide_int val = wi::sub (rtx_mode_t (operands[1], DImode), |
| 1586 |
rtx_mode_t (operands[2], DImode), |
| 1587 |
UNSIGNED, &overflow); |
| 1588 |
emit_move_insn (operands[0], GEN_INT (val.to_shwi ())); |
| 1589 |
if (overflow != wi::OVF_NONE) |
| 1590 |
emit_jump_insn (gen_jump (operands[3])); |
| 1591 |
DONE; |
| 1592 |
} |
| 1593 |
else if (CONST_INT_P (operands[1])) |
| 1594 |
{ |
| 1595 |
arm_decompose_di_binop (operands[2], operands[1], &lo_op2, &hi_op2, |
| 1596 |
&lo_op1, &hi_op1); |
| 1597 |
if (const_ok_for_arm (INTVAL (lo_op1))) |
| 1598 |
{ |
| 1599 |
emit_insn (gen_rsb_imm_compare (lo_result, lo_op1, lo_op2, |
| 1600 |
GEN_INT (~UINTVAL (lo_op1)))); |
| 1601 |
/* We could potentially use RSC here in Arm state, but not |
| 1602 |
in Thumb, so it's probably not worth the effort of handling |
| 1603 |
this. */ |
| 1604 |
hi_op1 = force_reg (SImode, hi_op1); |
| 1605 |
mode = CC_RSBmode; |
| 1606 |
goto highpart; |
| 1607 |
} |
| 1608 |
operands[1] = force_reg (DImode, operands[1]); |
| 1609 |
} |
| 1610 |
|
| 1611 |
arm_decompose_di_binop (operands[1], operands[2], &lo_op1, &hi_op1, |
| 1612 |
&lo_op2, &hi_op2); |
| 1613 |
if (lo_op2 == const0_rtx) |
| 1614 |
{ |
| 1615 |
emit_move_insn (lo_result, lo_op1); |
| 1616 |
if (!arm_add_operand (hi_op2, SImode)) |
| 1617 |
hi_op2 = force_reg (SImode, hi_op2); |
| 1618 |
emit_insn (gen_usubvsi4 (hi_result, hi_op1, hi_op2, operands[3])); |
| 1619 |
DONE; |
| 1620 |
} |
| 1621 |
|
| 1622 |
if (CONST_INT_P (lo_op2) && !arm_addimm_operand (lo_op2, SImode)) |
| 1623 |
lo_op2 = force_reg (SImode, lo_op2); |
| 1624 |
if (CONST_INT_P (lo_op2)) |
| 1625 |
emit_insn (gen_cmpsi2_addneg (lo_result, lo_op1, lo_op2, |
| 1626 |
gen_int_mode (-INTVAL (lo_op2), SImode))); |
| 1627 |
else |
| 1628 |
emit_insn (gen_subsi3_compare1 (lo_result, lo_op1, lo_op2)); |
| 1629 |
|
| 1630 |
highpart: |
| 1631 |
if (!arm_not_operand (hi_op2, SImode)) |
| 1632 |
hi_op2 = force_reg (SImode, hi_op2); |
| 1633 |
rtx ccreg = gen_rtx_REG (mode, CC_REGNUM); |
| 1634 |
if (CONST_INT_P (hi_op2)) |
| 1635 |
emit_insn (gen_usub_cmpVsi3_borrow_imm (hi_result, hi_op1, hi_op2, |
| 1636 |
GEN_INT (UINTVAL (hi_op2) |
| 1637 |
& 0xffffffff), |
| 1638 |
gen_rtx_LTU (SImode, ccreg, |
| 1639 |
const0_rtx), |
| 1640 |
gen_rtx_LTU (DImode, ccreg, |
| 1641 |
const0_rtx))); |
| 1642 |
else |
| 1643 |
emit_insn (gen_usub_cmpVsi3_borrow (hi_result, hi_op1, hi_op2, |
| 1644 |
gen_rtx_LTU (SImode, ccreg, const0_rtx), |
| 1645 |
gen_rtx_LTU (DImode, ccreg, |
| 1646 |
const0_rtx))); |
| 1647 |
arm_gen_unlikely_cbranch (LTU, CC_Bmode, operands[3]); |
| 1648 |
|
| 1649 |
DONE; |
| 1650 |
}) |
| 1651 |
|
| 1652 |
(define_insn "subsi3_compare1" |
| 1653 |
[(set (reg:CC CC_REGNUM) |
| 1654 |
(compare:CC |
| 1655 |
(match_operand:SI 1 "register_operand" "r") |
| 1656 |
(match_operand:SI 2 "register_operand" "r"))) |
| 1657 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 1658 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 1659 |
"TARGET_32BIT" |
| 1660 |
"subs%?\\t%0, %1, %2" |
| 1661 |
[(set_attr "conds" "set") |
| 1662 |
(set_attr "type" "alus_sreg")] |
| 1663 |
) |
| 1664 |
|
| 1665 |
(define_insn "sub_cmpVsi3" |
| 1666 |
[(set (reg:CC_V CC_REGNUM) |
| 1667 |
(compare:CC_V |
| 1668 |
(minus:DI |
| 1669 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand" "l,r")) |
| 1670 |
(sign_extend:DI (match_operand:SI 2 "s_register_operand" "l,r"))) |
| 1671 |
(sign_extend:DI (minus:SI (match_dup 1) (match_dup 2))))) |
| 1672 |
(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 1673 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 1674 |
"TARGET_32BIT" |
| 1675 |
"subs%?\\t%0, %1, %2" |
| 1676 |
[(set_attr "conds" "set") |
| 1677 |
(set_attr "arch" "t2,*") |
| 1678 |
(set_attr "length" "2,4") |
| 1679 |
(set_attr "type" "alus_sreg")] |
| 1680 |
) |
| 1681 |
|
| 1682 |
(define_insn "sub_cmpVsi3_imm1" |
| 1683 |
[(set (reg:CC_V CC_REGNUM) |
| 1684 |
(compare:CC_V |
| 1685 |
(minus:DI |
| 1686 |
(match_operand 1 "arm_immediate_operand" "I") |
| 1687 |
(sign_extend:DI (match_operand:SI 2 "s_register_operand" "r"))) |
| 1688 |
(sign_extend:DI (minus:SI (match_dup 1) (match_dup 2))))) |
| 1689 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 1690 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 1691 |
"TARGET_32BIT" |
| 1692 |
"rsbs%?\\t%0, %2, %1" |
| 1693 |
[(set_attr "conds" "set") |
| 1694 |
(set_attr "type" "alus_imm")] |
| 1695 |
) |
| 1696 |
|
| 1697 |
(define_insn "subsi3_carryin" |
| 1698 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 1699 |
(minus:SI (minus:SI (match_operand:SI 1 "reg_or_int_operand" "r,I,Pz") |
| 1700 |
(match_operand:SI 2 "s_register_operand" "r,r,r")) |
| 1701 |
(match_operand:SI 3 "arm_borrow_operation" "")))] |
| 1702 |
"TARGET_32BIT" |
| 1703 |
"@ |
| 1704 |
sbc%?\\t%0, %1, %2 |
| 1705 |
rsc%?\\t%0, %2, %1 |
| 1706 |
sbc%?\\t%0, %2, %2, lsl #1" |
| 1707 |
[(set_attr "conds" "use") |
| 1708 |
(set_attr "arch" "*,a,t2") |
| 1709 |
(set_attr "predicable" "yes") |
| 1710 |
(set_attr "type" "adc_reg,adc_imm,alu_shift_imm_lsl_1to4")] |
| 1711 |
) |
| 1712 |
|
| 1713 |
;; Special canonicalization of the above when operand1 == (const_int 1): |
| 1714 |
;; in this case the 'borrow' needs to treated like subtracting from the carry. |
| 1715 |
(define_insn "rsbsi_carryin_reg" |
| 1716 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 1717 |
(minus:SI (match_operand:SI 1 "arm_carry_operation" "") |
| 1718 |
(match_operand:SI 2 "s_register_operand" "r")))] |
| 1719 |
"TARGET_ARM" |
| 1720 |
"rsc%?\\t%0, %2, #1" |
| 1721 |
[(set_attr "conds" "use") |
| 1722 |
(set_attr "predicable" "yes") |
| 1723 |
(set_attr "type" "adc_imm")] |
| 1724 |
) |
| 1725 |
|
| 1726 |
;; SBC performs Rn - Rm - ~C, but -Rm = ~Rm + 1 => Rn + ~Rm + 1 - ~C |
| 1727 |
;; => Rn + ~Rm + C, which is essentially ADC Rd, Rn, ~Rm |
| 1728 |
(define_insn "*add_not_cin" |
| 1729 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1730 |
(plus:SI |
| 1731 |
(plus:SI (not:SI (match_operand:SI 1 "s_register_operand" "r,r")) |
| 1732 |
(match_operand:SI 3 "arm_carry_operation" "")) |
| 1733 |
(match_operand:SI 2 "arm_rhs_operand" "r,I")))] |
| 1734 |
"TARGET_ARM || (TARGET_THUMB2 && !CONST_INT_P (operands[2]))" |
| 1735 |
"@ |
| 1736 |
sbc%?\\t%0, %2, %1 |
| 1737 |
rsc%?\\t%0, %1, %2" |
| 1738 |
[(set_attr "conds" "use") |
| 1739 |
(set_attr "predicable" "yes") |
| 1740 |
(set_attr "arch" "*,a") |
| 1741 |
(set_attr "type" "adc_reg,adc_imm")] |
| 1742 |
) |
| 1743 |
|
| 1744 |
;; On Arm we can also use the same trick when the non-inverted operand is |
| 1745 |
;; shifted, using RSC. |
| 1746 |
(define_insn "add_not_shift_cin" |
| 1747 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1748 |
(plus:SI |
| 1749 |
(plus:SI (match_operator:SI 3 "shift_operator" |
| 1750 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 1751 |
(match_operand:SI 2 "shift_amount_operand" "M,r")]) |
| 1752 |
(not:SI (match_operand:SI 4 "s_register_operand" "r,r"))) |
| 1753 |
(match_operand:SI 5 "arm_carry_operation" "")))] |
| 1754 |
"TARGET_ARM" |
| 1755 |
"rsc%?\\t%0, %4, %1%S3" |
| 1756 |
[(set_attr "conds" "use") |
| 1757 |
(set_attr "predicable" "yes") |
| 1758 |
(set_attr "autodetect_type" "alu_shift_operator3")] |
| 1759 |
) |
| 1760 |
|
| 1761 |
(define_insn "cmpsi3_carryin_<CC_EXTEND>out" |
| 1762 |
[(set (reg:<CC_EXTEND> CC_REGNUM) |
| 1763 |
(compare:<CC_EXTEND> |
| 1764 |
(SE:DI (match_operand:SI 1 "s_register_operand" "0,r")) |
| 1765 |
(plus:DI (match_operand:DI 3 "arm_borrow_operation" "") |
| 1766 |
(SE:DI (match_operand:SI 2 "s_register_operand" "l,r"))))) |
| 1767 |
(clobber (match_scratch:SI 0 "=l,r"))] |
| 1768 |
"TARGET_32BIT" |
| 1769 |
"sbcs\\t%0, %1, %2" |
| 1770 |
[(set_attr "conds" "set") |
| 1771 |
(set_attr "arch" "t2,*") |
| 1772 |
(set_attr "length" "2,4") |
| 1773 |
(set_attr "type" "adc_reg")] |
| 1774 |
) |
| 1775 |
|
| 1776 |
;; Similar to the above, but handling a constant which has a different |
| 1777 |
;; canonicalization. |
| 1778 |
(define_insn "cmpsi3_imm_carryin_<CC_EXTEND>out" |
| 1779 |
[(set (reg:<CC_EXTEND> CC_REGNUM) |
| 1780 |
(compare:<CC_EXTEND> |
| 1781 |
(SE:DI (match_operand:SI 1 "s_register_operand" "r,r")) |
| 1782 |
(plus:DI (match_operand:DI 3 "arm_borrow_operation" "") |
| 1783 |
(match_operand:DI 2 "arm_adcimm_operand" "I,K")))) |
| 1784 |
(clobber (match_scratch:SI 0 "=l,r"))] |
| 1785 |
"TARGET_32BIT" |
| 1786 |
"@ |
| 1787 |
sbcs\\t%0, %1, %2 |
| 1788 |
adcs\\t%0, %1, #%B2" |
| 1789 |
[(set_attr "conds" "set") |
| 1790 |
(set_attr "type" "adc_imm")] |
| 1791 |
) |
| 1792 |
|
| 1793 |
;; Further canonicalization when the constant is zero. |
| 1794 |
(define_insn "cmpsi3_0_carryin_<CC_EXTEND>out" |
| 1795 |
[(set (reg:<CC_EXTEND> CC_REGNUM) |
| 1796 |
(compare:<CC_EXTEND> |
| 1797 |
(SE:DI (match_operand:SI 1 "s_register_operand" "r,r")) |
| 1798 |
(match_operand:DI 2 "arm_borrow_operation" ""))) |
| 1799 |
(clobber (match_scratch:SI 0 "=l,r"))] |
| 1800 |
"TARGET_32BIT" |
| 1801 |
"sbcs\\t%0, %1, #0" |
| 1802 |
[(set_attr "conds" "set") |
| 1803 |
(set_attr "type" "adc_imm")] |
| 1804 |
) |
| 1805 |
|
| 1806 |
(define_insn "*subsi3_carryin_const" |
| 1807 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 1808 |
(minus:SI (plus:SI |
| 1809 |
(match_operand:SI 1 "s_register_operand" "r") |
| 1810 |
(match_operand:SI 2 "arm_neg_immediate_operand" "L")) |
| 1811 |
(match_operand:SI 3 "arm_borrow_operation" "")))] |
| 1812 |
"TARGET_32BIT" |
| 1813 |
"sbc\\t%0, %1, #%n2" |
| 1814 |
[(set_attr "conds" "use") |
| 1815 |
(set_attr "type" "adc_imm")] |
| 1816 |
) |
| 1817 |
|
| 1818 |
(define_insn "*subsi3_carryin_const0" |
| 1819 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 1820 |
(minus:SI (match_operand:SI 1 "s_register_operand" "r") |
| 1821 |
(match_operand:SI 2 "arm_borrow_operation" "")))] |
| 1822 |
"TARGET_32BIT" |
| 1823 |
"sbc\\t%0, %1, #0" |
| 1824 |
[(set_attr "conds" "use") |
| 1825 |
(set_attr "type" "adc_imm")] |
| 1826 |
) |
| 1827 |
|
| 1828 |
(define_insn "*subsi3_carryin_shift" |
| 1829 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1830 |
(minus:SI (minus:SI |
| 1831 |
(match_operand:SI 1 "s_register_operand" "r,r") |
| 1832 |
(match_operator:SI 2 "shift_operator" |
| 1833 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 1834 |
(match_operand:SI 4 "shift_amount_operand" "M,r")])) |
| 1835 |
(match_operand:SI 5 "arm_borrow_operation" "")))] |
| 1836 |
"TARGET_32BIT" |
| 1837 |
"sbc%?\\t%0, %1, %3%S2" |
| 1838 |
[(set_attr "conds" "use") |
| 1839 |
(set_attr "arch" "32,a") |
| 1840 |
(set_attr "shift" "3") |
| 1841 |
(set_attr "predicable" "yes") |
| 1842 |
(set_attr "autodetect_type" "alu_shift_operator2")] |
| 1843 |
) |
| 1844 |
|
| 1845 |
(define_insn "*subsi3_carryin_shift_alt" |
| 1846 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1847 |
(minus:SI (minus:SI |
| 1848 |
(match_operand:SI 1 "s_register_operand" "r,r") |
| 1849 |
(match_operand:SI 5 "arm_borrow_operation" "")) |
| 1850 |
(match_operator:SI 2 "shift_operator" |
| 1851 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 1852 |
(match_operand:SI 4 "shift_amount_operand" "M,r")])))] |
| 1853 |
"TARGET_32BIT" |
| 1854 |
"sbc%?\\t%0, %1, %3%S2" |
| 1855 |
[(set_attr "conds" "use") |
| 1856 |
(set_attr "arch" "32,a") |
| 1857 |
(set_attr "shift" "3") |
| 1858 |
(set_attr "predicable" "yes") |
| 1859 |
(set_attr "autodetect_type" "alu_shift_operator2")] |
| 1860 |
) |
| 1861 |
|
| 1862 |
;; No RSC in Thumb2 |
| 1863 |
(define_insn "*rsbsi3_carryin_shift" |
| 1864 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1865 |
(minus:SI (minus:SI |
| 1866 |
(match_operator:SI 2 "shift_operator" |
| 1867 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 1868 |
(match_operand:SI 4 "shift_amount_operand" "M,r")]) |
| 1869 |
(match_operand:SI 1 "s_register_operand" "r,r")) |
| 1870 |
(match_operand:SI 5 "arm_borrow_operation" "")))] |
| 1871 |
"TARGET_ARM" |
| 1872 |
"rsc%?\\t%0, %1, %3%S2" |
| 1873 |
[(set_attr "conds" "use") |
| 1874 |
(set_attr "predicable" "yes") |
| 1875 |
(set_attr "autodetect_type" "alu_shift_operator2")] |
| 1876 |
) |
| 1877 |
|
| 1878 |
(define_insn "*rsbsi3_carryin_shift_alt" |
| 1879 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 1880 |
(minus:SI (minus:SI |
| 1881 |
(match_operator:SI 2 "shift_operator" |
| 1882 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 1883 |
(match_operand:SI 4 "shift_amount_operand" "M,r")]) |
| 1884 |
(match_operand:SI 5 "arm_borrow_operation" "")) |
| 1885 |
(match_operand:SI 1 "s_register_operand" "r,r")))] |
| 1886 |
"TARGET_ARM" |
| 1887 |
"rsc%?\\t%0, %1, %3%S2" |
| 1888 |
[(set_attr "conds" "use") |
| 1889 |
(set_attr "predicable" "yes") |
| 1890 |
(set_attr "autodetect_type" "alu_shift_operator2")] |
| 1891 |
) |
| 1892 |
|
| 1893 |
; transform ((x << y) - 1) to ~(~(x-1) << y) Where X is a constant. |
| 1894 |
(define_split |
| 1895 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 1896 |
(plus:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "") |
| 1897 |
(match_operand:SI 2 "s_register_operand" "")) |
| 1898 |
(const_int -1))) |
| 1899 |
(clobber (match_operand:SI 3 "s_register_operand" ""))] |
| 1900 |
"TARGET_32BIT" |
| 1901 |
[(set (match_dup 3) (match_dup 1)) |
| 1902 |
(set (match_dup 0) (not:SI (ashift:SI (match_dup 3) (match_dup 2))))] |
| 1903 |
" |
| 1904 |
operands[1] = GEN_INT (~(INTVAL (operands[1]) - 1)); |
| 1905 |
") |
| 1906 |
|
| 1907 |
(define_expand "addsf3" |
| 1908 |
[(set (match_operand:SF 0 "s_register_operand") |
| 1909 |
(plus:SF (match_operand:SF 1 "s_register_operand") |
| 1910 |
(match_operand:SF 2 "s_register_operand")))] |
| 1911 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 1912 |
" |
| 1913 |
") |
| 1914 |
|
| 1915 |
(define_expand "adddf3" |
| 1916 |
[(set (match_operand:DF 0 "s_register_operand") |
| 1917 |
(plus:DF (match_operand:DF 1 "s_register_operand") |
| 1918 |
(match_operand:DF 2 "s_register_operand")))] |
| 1919 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 1920 |
" |
| 1921 |
") |
| 1922 |
|
| 1923 |
(define_expand "subdi3" |
| 1924 |
[(parallel |
| 1925 |
[(set (match_operand:DI 0 "s_register_operand") |
| 1926 |
(minus:DI (match_operand:DI 1 "reg_or_int_operand") |
| 1927 |
(match_operand:DI 2 "s_register_operand"))) |
| 1928 |
(clobber (reg:CC CC_REGNUM))])] |
| 1929 |
"TARGET_EITHER" |
| 1930 |
" |
| 1931 |
if (TARGET_THUMB1) |
| 1932 |
{ |
| 1933 |
if (!REG_P (operands[1])) |
| 1934 |
operands[1] = force_reg (DImode, operands[1]); |
| 1935 |
} |
| 1936 |
else |
| 1937 |
{ |
| 1938 |
rtx lo_result, hi_result, lo_dest, hi_dest; |
| 1939 |
rtx lo_op1, hi_op1, lo_op2, hi_op2; |
| 1940 |
rtx condition; |
| 1941 |
|
| 1942 |
/* Since operands[1] may be an integer, pass it second, so that |
| 1943 |
any necessary simplifications will be done on the decomposed |
| 1944 |
constant. */ |
| 1945 |
arm_decompose_di_binop (operands[2], operands[1], &lo_op2, &hi_op2, |
| 1946 |
&lo_op1, &hi_op1); |
| 1947 |
lo_result = lo_dest = gen_lowpart (SImode, operands[0]); |
| 1948 |
hi_result = hi_dest = gen_highpart (SImode, operands[0]); |
| 1949 |
|
| 1950 |
if (!arm_rhs_operand (lo_op1, SImode)) |
| 1951 |
lo_op1 = force_reg (SImode, lo_op1); |
| 1952 |
|
| 1953 |
if ((TARGET_THUMB2 && ! s_register_operand (hi_op1, SImode)) |
| 1954 |
|| !arm_rhs_operand (hi_op1, SImode)) |
| 1955 |
hi_op1 = force_reg (SImode, hi_op1); |
| 1956 |
|
| 1957 |
rtx cc_reg; |
| 1958 |
if (lo_op1 == const0_rtx) |
| 1959 |
{ |
| 1960 |
cc_reg = gen_rtx_REG (CC_RSBmode, CC_REGNUM); |
| 1961 |
emit_insn (gen_negsi2_0compare (lo_dest, lo_op2)); |
| 1962 |
} |
| 1963 |
else if (CONST_INT_P (lo_op1)) |
| 1964 |
{ |
| 1965 |
cc_reg = gen_rtx_REG (CC_RSBmode, CC_REGNUM); |
| 1966 |
emit_insn (gen_rsb_imm_compare (lo_dest, lo_op1, lo_op2, |
| 1967 |
GEN_INT (~UINTVAL (lo_op1)))); |
| 1968 |
} |
| 1969 |
else |
| 1970 |
{ |
| 1971 |
cc_reg = gen_rtx_REG (CCmode, CC_REGNUM); |
| 1972 |
emit_insn (gen_subsi3_compare (lo_dest, lo_op1, lo_op2)); |
| 1973 |
} |
| 1974 |
|
| 1975 |
condition = gen_rtx_LTU (SImode, cc_reg, const0_rtx); |
| 1976 |
|
| 1977 |
if (hi_op1 == const0_rtx) |
| 1978 |
emit_insn (gen_negsi2_carryin (hi_dest, hi_op2, condition)); |
| 1979 |
else |
| 1980 |
emit_insn (gen_subsi3_carryin (hi_dest, hi_op1, hi_op2, condition)); |
| 1981 |
|
| 1982 |
if (lo_result != lo_dest) |
| 1983 |
emit_move_insn (lo_result, lo_dest); |
| 1984 |
|
| 1985 |
if (hi_result != hi_dest) |
| 1986 |
emit_move_insn (hi_result, hi_dest); |
| 1987 |
|
| 1988 |
DONE; |
| 1989 |
} |
| 1990 |
" |
| 1991 |
) |
| 1992 |
|
| 1993 |
(define_expand "subsi3" |
| 1994 |
[(set (match_operand:SI 0 "s_register_operand") |
| 1995 |
(minus:SI (match_operand:SI 1 "reg_or_int_operand") |
| 1996 |
(match_operand:SI 2 "s_register_operand")))] |
| 1997 |
"TARGET_EITHER" |
| 1998 |
" |
| 1999 |
if (CONST_INT_P (operands[1])) |
| 2000 |
{ |
| 2001 |
if (TARGET_32BIT) |
| 2002 |
{ |
| 2003 |
if (DONT_EARLY_SPLIT_CONSTANT (INTVAL (operands[1]), MINUS)) |
| 2004 |
operands[1] = force_reg (SImode, operands[1]); |
| 2005 |
else |
| 2006 |
{ |
| 2007 |
arm_split_constant (MINUS, SImode, NULL_RTX, |
| 2008 |
INTVAL (operands[1]), operands[0], |
| 2009 |
operands[2], |
| 2010 |
optimize && can_create_pseudo_p ()); |
| 2011 |
DONE; |
| 2012 |
} |
| 2013 |
} |
| 2014 |
else /* TARGET_THUMB1 */ |
| 2015 |
operands[1] = force_reg (SImode, operands[1]); |
| 2016 |
} |
| 2017 |
" |
| 2018 |
) |
| 2019 |
|
| 2020 |
; ??? Check Thumb-2 split length |
| 2021 |
(define_insn_and_split "*arm_subsi3_insn" |
| 2022 |
[(set (match_operand:SI 0 "s_register_operand" "=l,l ,l ,l ,r,r,r,rk,r") |
| 2023 |
(minus:SI (match_operand:SI 1 "reg_or_int_operand" "l ,0 ,l ,Pz,I,r,r,k ,?n") |
| 2024 |
(match_operand:SI 2 "reg_or_int_operand" "l ,Py,Pd,l ,r,I,r,r ,r")))] |
| 2025 |
"TARGET_32BIT" |
| 2026 |
"@ |
| 2027 |
sub%?\\t%0, %1, %2 |
| 2028 |
sub%?\\t%0, %2 |
| 2029 |
sub%?\\t%0, %1, %2 |
| 2030 |
rsb%?\\t%0, %2, %1 |
| 2031 |
rsb%?\\t%0, %2, %1 |
| 2032 |
sub%?\\t%0, %1, %2 |
| 2033 |
sub%?\\t%0, %1, %2 |
| 2034 |
sub%?\\t%0, %1, %2 |
| 2035 |
#" |
| 2036 |
"&& (CONST_INT_P (operands[1]) |
| 2037 |
&& !const_ok_for_arm (INTVAL (operands[1])))" |
| 2038 |
[(clobber (const_int 0))] |
| 2039 |
" |
| 2040 |
arm_split_constant (MINUS, SImode, curr_insn, |
| 2041 |
INTVAL (operands[1]), operands[0], operands[2], 0); |
| 2042 |
DONE; |
| 2043 |
" |
| 2044 |
[(set_attr "length" "4,4,4,4,4,4,4,4,16") |
| 2045 |
(set_attr "arch" "t2,t2,t2,t2,*,*,*,*,*") |
| 2046 |
(set_attr "predicable" "yes") |
| 2047 |
(set_attr "predicable_short_it" "yes,yes,yes,yes,no,no,no,no,no") |
| 2048 |
(set_attr "type" "alu_sreg,alu_sreg,alu_sreg,alu_sreg,alu_imm,alu_imm,alu_sreg,alu_sreg,multiple")] |
| 2049 |
) |
| 2050 |
|
| 2051 |
(define_peephole2 |
| 2052 |
[(match_scratch:SI 3 "r") |
| 2053 |
(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 2054 |
(minus:SI (match_operand:SI 1 "const_int_operand" "") |
| 2055 |
(match_operand:SI 2 "arm_general_register_operand" "")))] |
| 2056 |
"TARGET_32BIT |
| 2057 |
&& !const_ok_for_arm (INTVAL (operands[1])) |
| 2058 |
&& const_ok_for_arm (~INTVAL (operands[1]))" |
| 2059 |
[(set (match_dup 3) (match_dup 1)) |
| 2060 |
(set (match_dup 0) (minus:SI (match_dup 3) (match_dup 2)))] |
| 2061 |
"" |
| 2062 |
) |
| 2063 |
|
| 2064 |
(define_insn "subsi3_compare0" |
| 2065 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2066 |
(compare:CC_NZ |
| 2067 |
(minus:SI (match_operand:SI 1 "arm_rhs_operand" "r,r,I") |
| 2068 |
(match_operand:SI 2 "arm_rhs_operand" "I,r,r")) |
| 2069 |
(const_int 0))) |
| 2070 |
(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 2071 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 2072 |
"TARGET_32BIT" |
| 2073 |
"@ |
| 2074 |
subs%?\\t%0, %1, %2 |
| 2075 |
subs%?\\t%0, %1, %2 |
| 2076 |
rsbs%?\\t%0, %2, %1" |
| 2077 |
[(set_attr "conds" "set") |
| 2078 |
(set_attr "type" "alus_imm,alus_sreg,alus_sreg")] |
| 2079 |
) |
| 2080 |
|
| 2081 |
(define_insn "subsi3_compare" |
| 2082 |
[(set (reg:CC CC_REGNUM) |
| 2083 |
(compare:CC (match_operand:SI 1 "arm_rhs_operand" "r,r,I") |
| 2084 |
(match_operand:SI 2 "arm_rhs_operand" "I,r,r"))) |
| 2085 |
(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 2086 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 2087 |
"TARGET_32BIT" |
| 2088 |
"@ |
| 2089 |
subs%?\\t%0, %1, %2 |
| 2090 |
subs%?\\t%0, %1, %2 |
| 2091 |
rsbs%?\\t%0, %2, %1" |
| 2092 |
[(set_attr "conds" "set") |
| 2093 |
(set_attr "type" "alus_imm,alus_sreg,alus_imm")] |
| 2094 |
) |
| 2095 |
|
| 2096 |
;; To keep the comparison in canonical form we express it as (~reg cmp ~0) |
| 2097 |
;; rather than (0 cmp reg). This gives the same results for unsigned |
| 2098 |
;; and equality compares which is what we mostly need here. |
| 2099 |
(define_insn "rsb_imm_compare" |
| 2100 |
[(set (reg:CC_RSB CC_REGNUM) |
| 2101 |
(compare:CC_RSB (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
| 2102 |
(match_operand 3 "const_int_operand" ""))) |
| 2103 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2104 |
(minus:SI (match_operand 1 "arm_immediate_operand" "I") |
| 2105 |
(match_dup 2)))] |
| 2106 |
"TARGET_32BIT && ~UINTVAL (operands[1]) == UINTVAL (operands[3])" |
| 2107 |
"rsbs\\t%0, %2, %1" |
| 2108 |
[(set_attr "conds" "set") |
| 2109 |
(set_attr "type" "alus_imm")] |
| 2110 |
) |
| 2111 |
|
| 2112 |
;; Similarly, but the result is unused. |
| 2113 |
(define_insn "rsb_imm_compare_scratch" |
| 2114 |
[(set (reg:CC_RSB CC_REGNUM) |
| 2115 |
(compare:CC_RSB (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
| 2116 |
(match_operand 1 "arm_not_immediate_operand" "K"))) |
| 2117 |
(clobber (match_scratch:SI 0 "=r"))] |
| 2118 |
"TARGET_32BIT" |
| 2119 |
"rsbs\\t%0, %2, #%B1" |
| 2120 |
[(set_attr "conds" "set") |
| 2121 |
(set_attr "type" "alus_imm")] |
| 2122 |
) |
| 2123 |
|
| 2124 |
;; Compare the sum of a value plus a carry against a constant. Uses |
| 2125 |
;; RSC, so the result is swapped. Only available on Arm |
| 2126 |
(define_insn "rscsi3_<CC_EXTEND>out_scratch" |
| 2127 |
[(set (reg:CC_SWP CC_REGNUM) |
| 2128 |
(compare:CC_SWP |
| 2129 |
(plus:DI (SE:DI (match_operand:SI 2 "s_register_operand" "r")) |
| 2130 |
(match_operand:DI 3 "arm_borrow_operation" "")) |
| 2131 |
(match_operand 1 "arm_immediate_operand" "I"))) |
| 2132 |
(clobber (match_scratch:SI 0 "=r"))] |
| 2133 |
"TARGET_ARM" |
| 2134 |
"rscs\\t%0, %2, %1" |
| 2135 |
[(set_attr "conds" "set") |
| 2136 |
(set_attr "type" "alus_imm")] |
| 2137 |
) |
| 2138 |
|
| 2139 |
(define_insn "usub_cmpVsi3_borrow" |
| 2140 |
[(set (reg:CC_B CC_REGNUM) |
| 2141 |
(compare:CC_B |
| 2142 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand" "0,r")) |
| 2143 |
(plus:DI (match_operand:DI 4 "arm_borrow_operation" "") |
| 2144 |
(zero_extend:DI |
| 2145 |
(match_operand:SI 2 "s_register_operand" "l,r"))))) |
| 2146 |
(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 2147 |
(minus:SI (match_dup 1) |
| 2148 |
(plus:SI (match_operand:SI 3 "arm_borrow_operation" "") |
| 2149 |
(match_dup 2))))] |
| 2150 |
"TARGET_32BIT" |
| 2151 |
"sbcs%?\\t%0, %1, %2" |
| 2152 |
[(set_attr "conds" "set") |
| 2153 |
(set_attr "arch" "t2,*") |
| 2154 |
(set_attr "length" "2,4")] |
| 2155 |
) |
| 2156 |
|
| 2157 |
(define_insn "usub_cmpVsi3_borrow_imm" |
| 2158 |
[(set (reg:CC_B CC_REGNUM) |
| 2159 |
(compare:CC_B |
| 2160 |
(zero_extend:DI (match_operand:SI 1 "s_register_operand" "r,r")) |
| 2161 |
(plus:DI (match_operand:DI 5 "arm_borrow_operation" "") |
| 2162 |
(match_operand:DI 3 "const_int_operand" "n,n")))) |
| 2163 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 2164 |
(minus:SI (match_dup 1) |
| 2165 |
(plus:SI (match_operand:SI 4 "arm_borrow_operation" "") |
| 2166 |
(match_operand:SI 2 "arm_adcimm_operand" "I,K"))))] |
| 2167 |
"TARGET_32BIT |
| 2168 |
&& (UINTVAL (operands[2]) & 0xffffffff) == UINTVAL (operands[3])" |
| 2169 |
"@ |
| 2170 |
sbcs%?\\t%0, %1, %2 |
| 2171 |
adcs%?\\t%0, %1, #%B2" |
| 2172 |
[(set_attr "conds" "set") |
| 2173 |
(set_attr "type" "alus_imm")] |
| 2174 |
) |
| 2175 |
|
| 2176 |
(define_insn "sub_cmpVsi3_borrow" |
| 2177 |
[(set (reg:CC_V CC_REGNUM) |
| 2178 |
(compare:CC_V |
| 2179 |
(minus:DI |
| 2180 |
(minus:DI |
| 2181 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand" "0,r")) |
| 2182 |
(sign_extend:DI (match_operand:SI 2 "s_register_operand" "l,r"))) |
| 2183 |
(match_operand:DI 4 "arm_borrow_operation" "")) |
| 2184 |
(sign_extend:DI |
| 2185 |
(minus:SI (minus:SI (match_dup 1) (match_dup 2)) |
| 2186 |
(match_operand:SI 3 "arm_borrow_operation" ""))))) |
| 2187 |
(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 2188 |
(minus:SI (minus:SI (match_dup 1) (match_dup 2)) |
| 2189 |
(match_dup 3)))] |
| 2190 |
"TARGET_32BIT" |
| 2191 |
"sbcs%?\\t%0, %1, %2" |
| 2192 |
[(set_attr "conds" "set") |
| 2193 |
(set_attr "arch" "t2,*") |
| 2194 |
(set_attr "length" "2,4")] |
| 2195 |
) |
| 2196 |
|
| 2197 |
(define_insn "sub_cmpVsi3_borrow_imm" |
| 2198 |
[(set (reg:CC_V CC_REGNUM) |
| 2199 |
(compare:CC_V |
| 2200 |
(minus:DI |
| 2201 |
(minus:DI |
| 2202 |
(sign_extend:DI (match_operand:SI 1 "s_register_operand" "r,r")) |
| 2203 |
(match_operand 2 "arm_adcimm_operand" "I,K")) |
| 2204 |
(match_operand:DI 4 "arm_borrow_operation" "")) |
| 2205 |
(sign_extend:DI |
| 2206 |
(minus:SI (minus:SI (match_dup 1) (match_dup 2)) |
| 2207 |
(match_operand:SI 3 "arm_borrow_operation" ""))))) |
| 2208 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 2209 |
(minus:SI (minus:SI (match_dup 1) (match_dup 2)) |
| 2210 |
(match_dup 3)))] |
| 2211 |
"TARGET_32BIT |
| 2212 |
&& INTVAL (operands[2]) == ARM_SIGN_EXTEND (INTVAL (operands[2]))" |
| 2213 |
"@ |
| 2214 |
sbcs%?\\t%0, %1, %2 |
| 2215 |
adcs%?\\t%0, %1, #%B2" |
| 2216 |
[(set_attr "conds" "set") |
| 2217 |
(set_attr "type" "alus_imm")] |
| 2218 |
) |
| 2219 |
|
| 2220 |
(define_expand "subsf3" |
| 2221 |
[(set (match_operand:SF 0 "s_register_operand") |
| 2222 |
(minus:SF (match_operand:SF 1 "s_register_operand") |
| 2223 |
(match_operand:SF 2 "s_register_operand")))] |
| 2224 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 2225 |
" |
| 2226 |
") |
| 2227 |
|
| 2228 |
(define_expand "subdf3" |
| 2229 |
[(set (match_operand:DF 0 "s_register_operand") |
| 2230 |
(minus:DF (match_operand:DF 1 "s_register_operand") |
| 2231 |
(match_operand:DF 2 "s_register_operand")))] |
| 2232 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 2233 |
" |
| 2234 |
") |
| 2235 |
|
| 2236 |
|
| 2237 |
;; Multiplication insns |
| 2238 |
|
| 2239 |
(define_expand "mulhi3" |
| 2240 |
[(set (match_operand:HI 0 "s_register_operand") |
| 2241 |
(mult:HI (match_operand:HI 1 "s_register_operand") |
| 2242 |
(match_operand:HI 2 "s_register_operand")))] |
| 2243 |
"TARGET_DSP_MULTIPLY" |
| 2244 |
" |
| 2245 |
{ |
| 2246 |
rtx result = gen_reg_rtx (SImode); |
| 2247 |
emit_insn (gen_mulhisi3 (result, operands[1], operands[2])); |
| 2248 |
emit_move_insn (operands[0], gen_lowpart (HImode, result)); |
| 2249 |
DONE; |
| 2250 |
}" |
| 2251 |
) |
| 2252 |
|
| 2253 |
(define_expand "mulsi3" |
| 2254 |
[(set (match_operand:SI 0 "s_register_operand") |
| 2255 |
(mult:SI (match_operand:SI 2 "s_register_operand") |
| 2256 |
(match_operand:SI 1 "s_register_operand")))] |
| 2257 |
"TARGET_EITHER" |
| 2258 |
"" |
| 2259 |
) |
| 2260 |
|
| 2261 |
;; Use `&' and then `0' to prevent operands 0 and 2 being the same |
| 2262 |
(define_insn "*mul" |
| 2263 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r,&r,&r") |
| 2264 |
(mult:SI (match_operand:SI 2 "s_register_operand" "l,r,r,r") |
| 2265 |
(match_operand:SI 1 "s_register_operand" "%0,r,0,r")))] |
| 2266 |
"TARGET_32BIT" |
| 2267 |
"mul%?\\t%0, %2, %1" |
| 2268 |
[(set_attr "type" "mul") |
| 2269 |
(set_attr "predicable" "yes") |
| 2270 |
(set_attr "arch" "t2,v6,nov6,nov6") |
| 2271 |
(set_attr "length" "4") |
| 2272 |
(set_attr "predicable_short_it" "yes,no,*,*")] |
| 2273 |
) |
| 2274 |
|
| 2275 |
;; MLA and MLS instruction. Use operand 1 for the accumulator to prefer |
| 2276 |
;; reusing the same register. |
| 2277 |
|
| 2278 |
(define_insn "*mla" |
| 2279 |
[(set (match_operand:SI 0 "s_register_operand" "=r,&r,&r,&r") |
| 2280 |
(plus:SI |
| 2281 |
(mult:SI (match_operand:SI 3 "s_register_operand" "r,r,r,r") |
| 2282 |
(match_operand:SI 2 "s_register_operand" "%r,r,0,r")) |
| 2283 |
(match_operand:SI 1 "s_register_operand" "r,0,r,r")))] |
| 2284 |
"TARGET_32BIT" |
| 2285 |
"mla%?\\t%0, %3, %2, %1" |
| 2286 |
[(set_attr "type" "mla") |
| 2287 |
(set_attr "predicable" "yes") |
| 2288 |
(set_attr "arch" "v6,nov6,nov6,nov6")] |
| 2289 |
) |
| 2290 |
|
| 2291 |
(define_insn "*mls" |
| 2292 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2293 |
(minus:SI |
| 2294 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2295 |
(mult:SI (match_operand:SI 3 "s_register_operand" "r") |
| 2296 |
(match_operand:SI 2 "s_register_operand" "r"))))] |
| 2297 |
"TARGET_32BIT && arm_arch_thumb2" |
| 2298 |
"mls%?\\t%0, %3, %2, %1" |
| 2299 |
[(set_attr "type" "mla") |
| 2300 |
(set_attr "predicable" "yes")] |
| 2301 |
) |
| 2302 |
|
| 2303 |
(define_insn "*mulsi3_compare0" |
| 2304 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2305 |
(compare:CC_NZ (mult:SI |
| 2306 |
(match_operand:SI 2 "s_register_operand" "r,r") |
| 2307 |
(match_operand:SI 1 "s_register_operand" "%0,r")) |
| 2308 |
(const_int 0))) |
| 2309 |
(set (match_operand:SI 0 "s_register_operand" "=&r,&r") |
| 2310 |
(mult:SI (match_dup 2) (match_dup 1)))] |
| 2311 |
"TARGET_ARM && !arm_arch6" |
| 2312 |
"muls%?\\t%0, %2, %1" |
| 2313 |
[(set_attr "conds" "set") |
| 2314 |
(set_attr "type" "muls")] |
| 2315 |
) |
| 2316 |
|
| 2317 |
(define_insn "*mulsi3_compare0_v6" |
| 2318 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2319 |
(compare:CC_NZ (mult:SI |
| 2320 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2321 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 2322 |
(const_int 0))) |
| 2323 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2324 |
(mult:SI (match_dup 2) (match_dup 1)))] |
| 2325 |
"TARGET_ARM && arm_arch6 && optimize_size" |
| 2326 |
"muls%?\\t%0, %2, %1" |
| 2327 |
[(set_attr "conds" "set") |
| 2328 |
(set_attr "type" "muls")] |
| 2329 |
) |
| 2330 |
|
| 2331 |
(define_insn "*mulsi_compare0_scratch" |
| 2332 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2333 |
(compare:CC_NZ (mult:SI |
| 2334 |
(match_operand:SI 2 "s_register_operand" "r,r") |
| 2335 |
(match_operand:SI 1 "s_register_operand" "%0,r")) |
| 2336 |
(const_int 0))) |
| 2337 |
(clobber (match_scratch:SI 0 "=&r,&r"))] |
| 2338 |
"TARGET_ARM && !arm_arch6" |
| 2339 |
"muls%?\\t%0, %2, %1" |
| 2340 |
[(set_attr "conds" "set") |
| 2341 |
(set_attr "type" "muls")] |
| 2342 |
) |
| 2343 |
|
| 2344 |
(define_insn "*mulsi_compare0_scratch_v6" |
| 2345 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2346 |
(compare:CC_NZ (mult:SI |
| 2347 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2348 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 2349 |
(const_int 0))) |
| 2350 |
(clobber (match_scratch:SI 0 "=r"))] |
| 2351 |
"TARGET_ARM && arm_arch6 && optimize_size" |
| 2352 |
"muls%?\\t%0, %2, %1" |
| 2353 |
[(set_attr "conds" "set") |
| 2354 |
(set_attr "type" "muls")] |
| 2355 |
) |
| 2356 |
|
| 2357 |
(define_insn "*mulsi3addsi_compare0" |
| 2358 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2359 |
(compare:CC_NZ |
| 2360 |
(plus:SI (mult:SI |
| 2361 |
(match_operand:SI 2 "s_register_operand" "r,r,r,r") |
| 2362 |
(match_operand:SI 1 "s_register_operand" "%0,r,0,r")) |
| 2363 |
(match_operand:SI 3 "s_register_operand" "r,r,0,0")) |
| 2364 |
(const_int 0))) |
| 2365 |
(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r,&r") |
| 2366 |
(plus:SI (mult:SI (match_dup 2) (match_dup 1)) |
| 2367 |
(match_dup 3)))] |
| 2368 |
"TARGET_ARM && arm_arch6" |
| 2369 |
"mlas%?\\t%0, %2, %1, %3" |
| 2370 |
[(set_attr "conds" "set") |
| 2371 |
(set_attr "type" "mlas")] |
| 2372 |
) |
| 2373 |
|
| 2374 |
(define_insn "*mulsi3addsi_compare0_v6" |
| 2375 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2376 |
(compare:CC_NZ |
| 2377 |
(plus:SI (mult:SI |
| 2378 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2379 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 2380 |
(match_operand:SI 3 "s_register_operand" "r")) |
| 2381 |
(const_int 0))) |
| 2382 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2383 |
(plus:SI (mult:SI (match_dup 2) (match_dup 1)) |
| 2384 |
(match_dup 3)))] |
| 2385 |
"TARGET_ARM && arm_arch6 && optimize_size" |
| 2386 |
"mlas%?\\t%0, %2, %1, %3" |
| 2387 |
[(set_attr "conds" "set") |
| 2388 |
(set_attr "type" "mlas")] |
| 2389 |
) |
| 2390 |
|
| 2391 |
(define_insn "*mulsi3addsi_compare0_scratch" |
| 2392 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2393 |
(compare:CC_NZ |
| 2394 |
(plus:SI (mult:SI |
| 2395 |
(match_operand:SI 2 "s_register_operand" "r,r,r,r") |
| 2396 |
(match_operand:SI 1 "s_register_operand" "%0,r,0,r")) |
| 2397 |
(match_operand:SI 3 "s_register_operand" "?r,r,0,0")) |
| 2398 |
(const_int 0))) |
| 2399 |
(clobber (match_scratch:SI 0 "=&r,&r,&r,&r"))] |
| 2400 |
"TARGET_ARM && !arm_arch6" |
| 2401 |
"mlas%?\\t%0, %2, %1, %3" |
| 2402 |
[(set_attr "conds" "set") |
| 2403 |
(set_attr "type" "mlas")] |
| 2404 |
) |
| 2405 |
|
| 2406 |
(define_insn "*mulsi3addsi_compare0_scratch_v6" |
| 2407 |
[(set (reg:CC_NZ CC_REGNUM) |
| 2408 |
(compare:CC_NZ |
| 2409 |
(plus:SI (mult:SI |
| 2410 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2411 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 2412 |
(match_operand:SI 3 "s_register_operand" "r")) |
| 2413 |
(const_int 0))) |
| 2414 |
(clobber (match_scratch:SI 0 "=r"))] |
| 2415 |
"TARGET_ARM && arm_arch6 && optimize_size" |
| 2416 |
"mlas%?\\t%0, %2, %1, %3" |
| 2417 |
[(set_attr "conds" "set") |
| 2418 |
(set_attr "type" "mlas")] |
| 2419 |
) |
| 2420 |
|
| 2421 |
;; 32x32->64 widening multiply. |
| 2422 |
;; The only difference between the v3-5 and v6+ versions is the requirement |
| 2423 |
;; that the output does not overlap with either input. |
| 2424 |
|
| 2425 |
(define_expand "<Us>mulsidi3" |
| 2426 |
[(set (match_operand:DI 0 "s_register_operand") |
| 2427 |
(mult:DI |
| 2428 |
(SE:DI (match_operand:SI 1 "s_register_operand")) |
| 2429 |
(SE:DI (match_operand:SI 2 "s_register_operand"))))] |
| 2430 |
"TARGET_32BIT" |
| 2431 |
{ |
| 2432 |
emit_insn (gen_<US>mull (gen_lowpart (SImode, operands[0]), |
| 2433 |
gen_highpart (SImode, operands[0]), |
| 2434 |
operands[1], operands[2])); |
| 2435 |
DONE; |
| 2436 |
} |
| 2437 |
) |
| 2438 |
|
| 2439 |
(define_insn "<US>mull" |
| 2440 |
[(set (match_operand:SI 0 "s_register_operand" "=r,&r,&r,&r") |
| 2441 |
(mult:SI |
| 2442 |
(match_operand:SI 2 "s_register_operand" "%r,r,r,r") |
| 2443 |
(match_operand:SI 3 "s_register_operand" "r,r,0,1"))) |
| 2444 |
(set (match_operand:SI 1 "s_register_operand" "=r,&r,&r,&r") |
| 2445 |
(truncate:SI |
| 2446 |
(lshiftrt:DI |
| 2447 |
(mult:DI (SE:DI (match_dup 2)) (SE:DI (match_dup 3))) |
| 2448 |
(const_int 32))))] |
| 2449 |
"TARGET_32BIT" |
| 2450 |
"<US>mull%?\\t%0, %1, %2, %3" |
| 2451 |
[(set_attr "type" "umull") |
| 2452 |
(set_attr "predicable" "yes") |
| 2453 |
(set_attr "arch" "v6,nov6,nov6,nov6")] |
| 2454 |
) |
| 2455 |
|
| 2456 |
(define_expand "<Us>maddsidi4" |
| 2457 |
[(set (match_operand:DI 0 "s_register_operand") |
| 2458 |
(plus:DI |
| 2459 |
(mult:DI |
| 2460 |
(SE:DI (match_operand:SI 1 "s_register_operand")) |
| 2461 |
(SE:DI (match_operand:SI 2 "s_register_operand"))) |
| 2462 |
(match_operand:DI 3 "s_register_operand")))] |
| 2463 |
"TARGET_32BIT" |
| 2464 |
{ |
| 2465 |
emit_insn (gen_<US>mlal (gen_lowpart (SImode, operands[0]), |
| 2466 |
gen_lowpart (SImode, operands[3]), |
| 2467 |
gen_highpart (SImode, operands[0]), |
| 2468 |
gen_highpart (SImode, operands[3]), |
| 2469 |
operands[1], operands[2])); |
| 2470 |
DONE; |
| 2471 |
} |
| 2472 |
) |
| 2473 |
|
| 2474 |
(define_insn "<US>mlal" |
| 2475 |
[(set (match_operand:SI 0 "s_register_operand" "=r,&r") |
| 2476 |
(plus:SI |
| 2477 |
(mult:SI |
| 2478 |
(match_operand:SI 4 "s_register_operand" "%r,r") |
| 2479 |
(match_operand:SI 5 "s_register_operand" "r,r")) |
| 2480 |
(match_operand:SI 1 "s_register_operand" "0,0"))) |
| 2481 |
(set (match_operand:SI 2 "s_register_operand" "=r,&r") |
| 2482 |
(plus:SI |
| 2483 |
(truncate:SI |
| 2484 |
(lshiftrt:DI |
| 2485 |
(plus:DI |
| 2486 |
(mult:DI (SE:DI (match_dup 4)) (SE:DI (match_dup 5))) |
| 2487 |
(zero_extend:DI (match_dup 1))) |
| 2488 |
(const_int 32))) |
| 2489 |
(match_operand:SI 3 "s_register_operand" "2,2")))] |
| 2490 |
"TARGET_32BIT" |
| 2491 |
"<US>mlal%?\\t%0, %2, %4, %5" |
| 2492 |
[(set_attr "type" "umlal") |
| 2493 |
(set_attr "predicable" "yes") |
| 2494 |
(set_attr "arch" "v6,nov6")] |
| 2495 |
) |
| 2496 |
|
| 2497 |
(define_expand "<US>mulsi3_highpart" |
| 2498 |
[(parallel |
| 2499 |
[(set (match_operand:SI 0 "s_register_operand") |
| 2500 |
(truncate:SI |
| 2501 |
(lshiftrt:DI |
| 2502 |
(mult:DI |
| 2503 |
(SE:DI (match_operand:SI 1 "s_register_operand")) |
| 2504 |
(SE:DI (match_operand:SI 2 "s_register_operand"))) |
| 2505 |
(const_int 32)))) |
| 2506 |
(clobber (match_scratch:SI 3 ""))])] |
| 2507 |
"TARGET_32BIT" |
| 2508 |
"" |
| 2509 |
) |
| 2510 |
|
| 2511 |
(define_insn "*<US>mull_high" |
| 2512 |
[(set (match_operand:SI 0 "s_register_operand" "=r,&r,&r") |
| 2513 |
(truncate:SI |
| 2514 |
(lshiftrt:DI |
| 2515 |
(mult:DI |
| 2516 |
(SE:DI (match_operand:SI 1 "s_register_operand" "%r,0,r")) |
| 2517 |
(SE:DI (match_operand:SI 2 "s_register_operand" "r,r,r"))) |
| 2518 |
(const_int 32)))) |
| 2519 |
(clobber (match_scratch:SI 3 "=r,&r,&r"))] |
| 2520 |
"TARGET_32BIT" |
| 2521 |
"<US>mull%?\\t%3, %0, %2, %1" |
| 2522 |
[(set_attr "type" "umull") |
| 2523 |
(set_attr "predicable" "yes") |
| 2524 |
(set_attr "arch" "v6,nov6,nov6")] |
| 2525 |
) |
| 2526 |
|
| 2527 |
(define_insn "mulhisi3" |
| 2528 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2529 |
(mult:SI (sign_extend:SI |
| 2530 |
(match_operand:HI 1 "s_register_operand" "%r")) |
| 2531 |
(sign_extend:SI |
| 2532 |
(match_operand:HI 2 "s_register_operand" "r"))))] |
| 2533 |
"TARGET_DSP_MULTIPLY" |
| 2534 |
"smulbb%?\\t%0, %1, %2" |
| 2535 |
[(set_attr "type" "smulxy") |
| 2536 |
(set_attr "predicable" "yes")] |
| 2537 |
) |
| 2538 |
|
| 2539 |
(define_insn "*mulhisi3tb" |
| 2540 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2541 |
(mult:SI (ashiftrt:SI |
| 2542 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2543 |
(const_int 16)) |
| 2544 |
(sign_extend:SI |
| 2545 |
(match_operand:HI 2 "s_register_operand" "r"))))] |
| 2546 |
"TARGET_DSP_MULTIPLY" |
| 2547 |
"smultb%?\\t%0, %1, %2" |
| 2548 |
[(set_attr "type" "smulxy") |
| 2549 |
(set_attr "predicable" "yes")] |
| 2550 |
) |
| 2551 |
|
| 2552 |
(define_insn "*mulhisi3bt" |
| 2553 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2554 |
(mult:SI (sign_extend:SI |
| 2555 |
(match_operand:HI 1 "s_register_operand" "r")) |
| 2556 |
(ashiftrt:SI |
| 2557 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2558 |
(const_int 16))))] |
| 2559 |
"TARGET_DSP_MULTIPLY" |
| 2560 |
"smulbt%?\\t%0, %1, %2" |
| 2561 |
[(set_attr "type" "smulxy") |
| 2562 |
(set_attr "predicable" "yes")] |
| 2563 |
) |
| 2564 |
|
| 2565 |
(define_insn "*mulhisi3tt" |
| 2566 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2567 |
(mult:SI (ashiftrt:SI |
| 2568 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2569 |
(const_int 16)) |
| 2570 |
(ashiftrt:SI |
| 2571 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2572 |
(const_int 16))))] |
| 2573 |
"TARGET_DSP_MULTIPLY" |
| 2574 |
"smultt%?\\t%0, %1, %2" |
| 2575 |
[(set_attr "type" "smulxy") |
| 2576 |
(set_attr "predicable" "yes")] |
| 2577 |
) |
| 2578 |
|
| 2579 |
(define_expand "maddhisi4" |
| 2580 |
[(set (match_operand:SI 0 "s_register_operand") |
| 2581 |
(plus:SI (mult:SI (sign_extend:SI |
| 2582 |
(match_operand:HI 1 "s_register_operand")) |
| 2583 |
(sign_extend:SI |
| 2584 |
(match_operand:HI 2 "s_register_operand"))) |
| 2585 |
(match_operand:SI 3 "s_register_operand")))] |
| 2586 |
"TARGET_DSP_MULTIPLY" |
| 2587 |
{ |
| 2588 |
/* If this function reads the Q bit from ACLE intrinsics break up the |
| 2589 |
multiplication and accumulation as an overflow during accumulation will |
| 2590 |
clobber the Q flag. */ |
| 2591 |
if (ARM_Q_BIT_READ) |
| 2592 |
{ |
| 2593 |
rtx tmp = gen_reg_rtx (SImode); |
| 2594 |
emit_insn (gen_mulhisi3 (tmp, operands[1], operands[2])); |
| 2595 |
emit_insn (gen_addsi3 (operands[0], tmp, operands[3])); |
| 2596 |
DONE; |
| 2597 |
} |
| 2598 |
} |
| 2599 |
) |
| 2600 |
|
| 2601 |
(define_insn "*arm_maddhisi4" |
| 2602 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2603 |
(plus:SI (mult:SI (sign_extend:SI |
| 2604 |
(match_operand:HI 1 "s_register_operand" "r")) |
| 2605 |
(sign_extend:SI |
| 2606 |
(match_operand:HI 2 "s_register_operand" "r"))) |
| 2607 |
(match_operand:SI 3 "s_register_operand" "r")))] |
| 2608 |
"TARGET_DSP_MULTIPLY && !ARM_Q_BIT_READ" |
| 2609 |
"smlabb%?\\t%0, %1, %2, %3" |
| 2610 |
[(set_attr "type" "smlaxy") |
| 2611 |
(set_attr "predicable" "yes")] |
| 2612 |
) |
| 2613 |
|
| 2614 |
(define_insn "arm_smlabb_setq" |
| 2615 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2616 |
(plus:SI (mult:SI (sign_extend:SI |
| 2617 |
(match_operand:HI 1 "s_register_operand" "r")) |
| 2618 |
(sign_extend:SI |
| 2619 |
(match_operand:HI 2 "s_register_operand" "r"))) |
| 2620 |
(match_operand:SI 3 "s_register_operand" "r"))) |
| 2621 |
(set (reg:CC APSRQ_REGNUM) |
| 2622 |
(unspec:CC [(reg:CC APSRQ_REGNUM)] UNSPEC_Q_SET))] |
| 2623 |
"TARGET_DSP_MULTIPLY" |
| 2624 |
"smlabb%?\\t%0, %1, %2, %3" |
| 2625 |
[(set_attr "type" "smlaxy") |
| 2626 |
(set_attr "predicable" "yes")] |
| 2627 |
) |
| 2628 |
|
| 2629 |
(define_expand "arm_smlabb" |
| 2630 |
[(match_operand:SI 0 "s_register_operand") |
| 2631 |
(match_operand:SI 1 "s_register_operand") |
| 2632 |
(match_operand:SI 2 "s_register_operand") |
| 2633 |
(match_operand:SI 3 "s_register_operand")] |
| 2634 |
"TARGET_DSP_MULTIPLY" |
| 2635 |
{ |
| 2636 |
rtx mult1 = gen_lowpart (HImode, operands[1]); |
| 2637 |
rtx mult2 = gen_lowpart (HImode, operands[2]); |
| 2638 |
if (ARM_Q_BIT_READ) |
| 2639 |
emit_insn (gen_arm_smlabb_setq (operands[0], mult1, mult2, operands[3])); |
| 2640 |
else |
| 2641 |
emit_insn (gen_maddhisi4 (operands[0], mult1, mult2, operands[3])); |
| 2642 |
DONE; |
| 2643 |
} |
| 2644 |
) |
| 2645 |
|
| 2646 |
;; Note: there is no maddhisi4ibt because this one is canonical form |
| 2647 |
(define_insn "maddhisi4tb" |
| 2648 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2649 |
(plus:SI (mult:SI (ashiftrt:SI |
| 2650 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2651 |
(const_int 16)) |
| 2652 |
(sign_extend:SI |
| 2653 |
(match_operand:HI 2 "s_register_operand" "r"))) |
| 2654 |
(match_operand:SI 3 "s_register_operand" "r")))] |
| 2655 |
"TARGET_DSP_MULTIPLY && !ARM_Q_BIT_READ" |
| 2656 |
"smlatb%?\\t%0, %1, %2, %3" |
| 2657 |
[(set_attr "type" "smlaxy") |
| 2658 |
(set_attr "predicable" "yes")] |
| 2659 |
) |
| 2660 |
|
| 2661 |
(define_insn "arm_smlatb_setq" |
| 2662 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2663 |
(plus:SI (mult:SI (ashiftrt:SI |
| 2664 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2665 |
(const_int 16)) |
| 2666 |
(sign_extend:SI |
| 2667 |
(match_operand:HI 2 "s_register_operand" "r"))) |
| 2668 |
(match_operand:SI 3 "s_register_operand" "r"))) |
| 2669 |
(set (reg:CC APSRQ_REGNUM) |
| 2670 |
(unspec:CC [(reg:CC APSRQ_REGNUM)] UNSPEC_Q_SET))] |
| 2671 |
"TARGET_DSP_MULTIPLY" |
| 2672 |
"smlatb%?\\t%0, %1, %2, %3" |
| 2673 |
[(set_attr "type" "smlaxy") |
| 2674 |
(set_attr "predicable" "yes")] |
| 2675 |
) |
| 2676 |
|
| 2677 |
(define_expand "arm_smlatb" |
| 2678 |
[(match_operand:SI 0 "s_register_operand") |
| 2679 |
(match_operand:SI 1 "s_register_operand") |
| 2680 |
(match_operand:SI 2 "s_register_operand") |
| 2681 |
(match_operand:SI 3 "s_register_operand")] |
| 2682 |
"TARGET_DSP_MULTIPLY" |
| 2683 |
{ |
| 2684 |
rtx mult2 = gen_lowpart (HImode, operands[2]); |
| 2685 |
if (ARM_Q_BIT_READ) |
| 2686 |
emit_insn (gen_arm_smlatb_setq (operands[0], operands[1], |
| 2687 |
mult2, operands[3])); |
| 2688 |
else |
| 2689 |
emit_insn (gen_maddhisi4tb (operands[0], operands[1], |
| 2690 |
mult2, operands[3])); |
| 2691 |
DONE; |
| 2692 |
} |
| 2693 |
) |
| 2694 |
|
| 2695 |
(define_insn "maddhisi4tt" |
| 2696 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2697 |
(plus:SI (mult:SI (ashiftrt:SI |
| 2698 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2699 |
(const_int 16)) |
| 2700 |
(ashiftrt:SI |
| 2701 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2702 |
(const_int 16))) |
| 2703 |
(match_operand:SI 3 "s_register_operand" "r")))] |
| 2704 |
"TARGET_DSP_MULTIPLY && !ARM_Q_BIT_READ" |
| 2705 |
"smlatt%?\\t%0, %1, %2, %3" |
| 2706 |
[(set_attr "type" "smlaxy") |
| 2707 |
(set_attr "predicable" "yes")] |
| 2708 |
) |
| 2709 |
|
| 2710 |
(define_insn "arm_smlatt_setq" |
| 2711 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2712 |
(plus:SI (mult:SI (ashiftrt:SI |
| 2713 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2714 |
(const_int 16)) |
| 2715 |
(ashiftrt:SI |
| 2716 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2717 |
(const_int 16))) |
| 2718 |
(match_operand:SI 3 "s_register_operand" "r"))) |
| 2719 |
(set (reg:CC APSRQ_REGNUM) |
| 2720 |
(unspec:CC [(reg:CC APSRQ_REGNUM)] UNSPEC_Q_SET))] |
| 2721 |
"TARGET_DSP_MULTIPLY" |
| 2722 |
"smlatt%?\\t%0, %1, %2, %3" |
| 2723 |
[(set_attr "type" "smlaxy") |
| 2724 |
(set_attr "predicable" "yes")] |
| 2725 |
) |
| 2726 |
|
| 2727 |
(define_expand "arm_smlatt" |
| 2728 |
[(match_operand:SI 0 "s_register_operand") |
| 2729 |
(match_operand:SI 1 "s_register_operand") |
| 2730 |
(match_operand:SI 2 "s_register_operand") |
| 2731 |
(match_operand:SI 3 "s_register_operand")] |
| 2732 |
"TARGET_DSP_MULTIPLY" |
| 2733 |
{ |
| 2734 |
if (ARM_Q_BIT_READ) |
| 2735 |
emit_insn (gen_arm_smlatt_setq (operands[0], operands[1], |
| 2736 |
operands[2], operands[3])); |
| 2737 |
else |
| 2738 |
emit_insn (gen_maddhisi4tt (operands[0], operands[1], |
| 2739 |
operands[2], operands[3])); |
| 2740 |
DONE; |
| 2741 |
} |
| 2742 |
) |
| 2743 |
|
| 2744 |
(define_insn "maddhidi4" |
| 2745 |
[(set (match_operand:DI 0 "s_register_operand" "=r") |
| 2746 |
(plus:DI |
| 2747 |
(mult:DI (sign_extend:DI |
| 2748 |
(match_operand:HI 1 "s_register_operand" "r")) |
| 2749 |
(sign_extend:DI |
| 2750 |
(match_operand:HI 2 "s_register_operand" "r"))) |
| 2751 |
(match_operand:DI 3 "s_register_operand" "0")))] |
| 2752 |
"TARGET_DSP_MULTIPLY" |
| 2753 |
"smlalbb%?\\t%Q0, %R0, %1, %2" |
| 2754 |
[(set_attr "type" "smlalxy") |
| 2755 |
(set_attr "predicable" "yes")]) |
| 2756 |
|
| 2757 |
;; Note: there is no maddhidi4ibt because this one is canonical form |
| 2758 |
(define_insn "*maddhidi4tb" |
| 2759 |
[(set (match_operand:DI 0 "s_register_operand" "=r") |
| 2760 |
(plus:DI |
| 2761 |
(mult:DI (sign_extend:DI |
| 2762 |
(ashiftrt:SI |
| 2763 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2764 |
(const_int 16))) |
| 2765 |
(sign_extend:DI |
| 2766 |
(match_operand:HI 2 "s_register_operand" "r"))) |
| 2767 |
(match_operand:DI 3 "s_register_operand" "0")))] |
| 2768 |
"TARGET_DSP_MULTIPLY" |
| 2769 |
"smlaltb%?\\t%Q0, %R0, %1, %2" |
| 2770 |
[(set_attr "type" "smlalxy") |
| 2771 |
(set_attr "predicable" "yes")]) |
| 2772 |
|
| 2773 |
(define_insn "*maddhidi4tt" |
| 2774 |
[(set (match_operand:DI 0 "s_register_operand" "=r") |
| 2775 |
(plus:DI |
| 2776 |
(mult:DI (sign_extend:DI |
| 2777 |
(ashiftrt:SI |
| 2778 |
(match_operand:SI 1 "s_register_operand" "r") |
| 2779 |
(const_int 16))) |
| 2780 |
(sign_extend:DI |
| 2781 |
(ashiftrt:SI |
| 2782 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2783 |
(const_int 16)))) |
| 2784 |
(match_operand:DI 3 "s_register_operand" "0")))] |
| 2785 |
"TARGET_DSP_MULTIPLY" |
| 2786 |
"smlaltt%?\\t%Q0, %R0, %1, %2" |
| 2787 |
[(set_attr "type" "smlalxy") |
| 2788 |
(set_attr "predicable" "yes")]) |
| 2789 |
|
| 2790 |
(define_insn "arm_<smlaw_op><add_clobber_q_name>_insn" |
| 2791 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 2792 |
(unspec:SI |
| 2793 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 2794 |
(match_operand:SI 2 "s_register_operand" "r") |
| 2795 |
(match_operand:SI 3 "s_register_operand" "r")] |
| 2796 |
SMLAWBT))] |
| 2797 |
"TARGET_DSP_MULTIPLY && <add_clobber_q_pred>" |
| 2798 |
"<smlaw_op>%?\\t%0, %1, %2, %3" |
| 2799 |
[(set_attr "type" "smlaxy") |
| 2800 |
(set_attr "predicable" "yes")] |
| 2801 |
) |
| 2802 |
|
| 2803 |
(define_expand "arm_<smlaw_op>" |
| 2804 |
[(set (match_operand:SI 0 "s_register_operand") |
| 2805 |
(unspec:SI |
| 2806 |
[(match_operand:SI 1 "s_register_operand") |
| 2807 |
(match_operand:SI 2 "s_register_operand") |
| 2808 |
(match_operand:SI 3 "s_register_operand")] |
| 2809 |
SMLAWBT))] |
| 2810 |
"TARGET_DSP_MULTIPLY" |
| 2811 |
{ |
| 2812 |
if (ARM_Q_BIT_READ) |
| 2813 |
emit_insn (gen_arm_<smlaw_op>_setq_insn (operands[0], operands[1], |
| 2814 |
operands[2], operands[3])); |
| 2815 |
else |
| 2816 |
emit_insn (gen_arm_<smlaw_op>_insn (operands[0], operands[1], |
| 2817 |
operands[2], operands[3])); |
| 2818 |
DONE; |
| 2819 |
} |
| 2820 |
) |
| 2821 |
|
| 2822 |
(define_expand "mulsf3" |
| 2823 |
[(set (match_operand:SF 0 "s_register_operand") |
| 2824 |
(mult:SF (match_operand:SF 1 "s_register_operand") |
| 2825 |
(match_operand:SF 2 "s_register_operand")))] |
| 2826 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 2827 |
" |
| 2828 |
") |
| 2829 |
|
| 2830 |
(define_expand "muldf3" |
| 2831 |
[(set (match_operand:DF 0 "s_register_operand") |
| 2832 |
(mult:DF (match_operand:DF 1 "s_register_operand") |
| 2833 |
(match_operand:DF 2 "s_register_operand")))] |
| 2834 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 2835 |
" |
| 2836 |
") |
| 2837 |
|
| 2838 |
;; Division insns |
| 2839 |
|
| 2840 |
(define_expand "divsf3" |
| 2841 |
[(set (match_operand:SF 0 "s_register_operand") |
| 2842 |
(div:SF (match_operand:SF 1 "s_register_operand") |
| 2843 |
(match_operand:SF 2 "s_register_operand")))] |
| 2844 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 2845 |
"") |
| 2846 |
|
| 2847 |
(define_expand "divdf3" |
| 2848 |
[(set (match_operand:DF 0 "s_register_operand") |
| 2849 |
(div:DF (match_operand:DF 1 "s_register_operand") |
| 2850 |
(match_operand:DF 2 "s_register_operand")))] |
| 2851 |
"TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE" |
| 2852 |
"") |
| 2853 |
|
| 2854 |
|
| 2855 |
; Expand logical operations. The mid-end expander does not split off memory |
| 2856 |
; operands or complex immediates, which leads to fewer LDRD/STRD instructions. |
| 2857 |
; So an explicit expander is needed to generate better code. |
| 2858 |
|
| 2859 |
(define_expand "<LOGICAL:optab>di3" |
| 2860 |
[(set (match_operand:DI 0 "s_register_operand") |
| 2861 |
(LOGICAL:DI (match_operand:DI 1 "s_register_operand") |
| 2862 |
(match_operand:DI 2 "arm_<optab>di_operand")))] |
| 2863 |
"TARGET_32BIT" |
| 2864 |
{ |
| 2865 |
rtx low = simplify_gen_binary (<CODE>, SImode, |
| 2866 |
gen_lowpart (SImode, operands[1]), |
| 2867 |
gen_lowpart (SImode, operands[2])); |
| 2868 |
rtx high = simplify_gen_binary (<CODE>, SImode, |
| 2869 |
gen_highpart (SImode, operands[1]), |
| 2870 |
gen_highpart_mode (SImode, DImode, |
| 2871 |
operands[2])); |
| 2872 |
|
| 2873 |
emit_insn (gen_rtx_SET (gen_lowpart (SImode, operands[0]), low)); |
| 2874 |
emit_insn (gen_rtx_SET (gen_highpart (SImode, operands[0]), high)); |
| 2875 |
DONE; |
| 2876 |
} |
| 2877 |
) |
| 2878 |
|
| 2879 |
(define_expand "one_cmpldi2" |
| 2880 |
[(set (match_operand:DI 0 "s_register_operand") |
| 2881 |
(not:DI (match_operand:DI 1 "s_register_operand")))] |
| 2882 |
"TARGET_32BIT" |
| 2883 |
{ |
| 2884 |
rtx low = simplify_gen_unary (NOT, SImode, |
| 2885 |
gen_lowpart (SImode, operands[1]), |
| 2886 |
SImode); |
| 2887 |
rtx high = simplify_gen_unary (NOT, SImode, |
| 2888 |
gen_highpart_mode (SImode, DImode, |
| 2889 |
operands[1]), |
| 2890 |
SImode); |
| 2891 |
|
| 2892 |
emit_insn (gen_rtx_SET (gen_lowpart (SImode, operands[0]), low)); |
| 2893 |
emit_insn (gen_rtx_SET (gen_highpart (SImode, operands[0]), high)); |
| 2894 |
DONE; |
| 2895 |
} |
| 2896 |
) |
| 2897 |
|
| 2898 |
;; Split DImode and, ior, xor operations. Simply perform the logical |
| 2899 |
;; operation on the upper and lower halves of the registers. |
| 2900 |
;; This is needed for atomic operations in arm_split_atomic_op. |
| 2901 |
;; Avoid splitting IWMMXT instructions. |
| 2902 |
(define_split |
| 2903 |
[(set (match_operand:DI 0 "s_register_operand" "") |
| 2904 |
(match_operator:DI 6 "logical_binary_operator" |
| 2905 |
[(match_operand:DI 1 "s_register_operand" "") |
| 2906 |
(match_operand:DI 2 "s_register_operand" "")]))] |
| 2907 |
"TARGET_32BIT && reload_completed |
| 2908 |
&& ! IS_IWMMXT_REGNUM (REGNO (operands[0]))" |
| 2909 |
[(set (match_dup 0) (match_op_dup:SI 6 [(match_dup 1) (match_dup 2)])) |
| 2910 |
(set (match_dup 3) (match_op_dup:SI 6 [(match_dup 4) (match_dup 5)]))] |
| 2911 |
" |
| 2912 |
{ |
| 2913 |
operands[3] = gen_highpart (SImode, operands[0]); |
| 2914 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 2915 |
operands[4] = gen_highpart (SImode, operands[1]); |
| 2916 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 2917 |
operands[5] = gen_highpart (SImode, operands[2]); |
| 2918 |
operands[2] = gen_lowpart (SImode, operands[2]); |
| 2919 |
}" |
| 2920 |
) |
| 2921 |
|
| 2922 |
;; Split DImode not (needed for atomic operations in arm_split_atomic_op). |
| 2923 |
;; Unconditionally split since there is no SIMD DImode NOT pattern. |
| 2924 |
(define_split |
| 2925 |
[(set (match_operand:DI 0 "s_register_operand") |
| 2926 |
(not:DI (match_operand:DI 1 "s_register_operand")))] |
| 2927 |
"TARGET_32BIT" |
| 2928 |
[(set (match_dup 0) (not:SI (match_dup 1))) |
| 2929 |
(set (match_dup 2) (not:SI (match_dup 3)))] |
| 2930 |
" |
| 2931 |
{ |
| 2932 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 2933 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 2934 |
operands[3] = gen_highpart (SImode, operands[1]); |
| 2935 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 2936 |
}" |
| 2937 |
) |
| 2938 |
|
| 2939 |
(define_expand "andsi3" |
| 2940 |
[(set (match_operand:SI 0 "s_register_operand") |
| 2941 |
(and:SI (match_operand:SI 1 "s_register_operand") |
| 2942 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 2943 |
"TARGET_EITHER" |
| 2944 |
" |
| 2945 |
if (TARGET_32BIT) |
| 2946 |
{ |
| 2947 |
if (CONST_INT_P (operands[2])) |
| 2948 |
{ |
| 2949 |
if (INTVAL (operands[2]) == 255 && arm_arch6) |
| 2950 |
{ |
| 2951 |
operands[1] = convert_to_mode (QImode, operands[1], 1); |
| 2952 |
emit_insn (gen_thumb2_zero_extendqisi2_v6 (operands[0], |
| 2953 |
operands[1])); |
| 2954 |
DONE; |
| 2955 |
} |
| 2956 |
else if (DONT_EARLY_SPLIT_CONSTANT (INTVAL (operands[2]), AND)) |
| 2957 |
operands[2] = force_reg (SImode, operands[2]); |
| 2958 |
else |
| 2959 |
{ |
| 2960 |
arm_split_constant (AND, SImode, NULL_RTX, |
| 2961 |
INTVAL (operands[2]), operands[0], |
| 2962 |
operands[1], |
| 2963 |
optimize && can_create_pseudo_p ()); |
| 2964 |
|
| 2965 |
DONE; |
| 2966 |
} |
| 2967 |
} |
| 2968 |
} |
| 2969 |
else /* TARGET_THUMB1 */ |
| 2970 |
{ |
| 2971 |
if (!CONST_INT_P (operands[2])) |
| 2972 |
{ |
| 2973 |
rtx tmp = force_reg (SImode, operands[2]); |
| 2974 |
if (rtx_equal_p (operands[0], operands[1])) |
| 2975 |
operands[2] = tmp; |
| 2976 |
else |
| 2977 |
{ |
| 2978 |
operands[2] = operands[1]; |
| 2979 |
operands[1] = tmp; |
| 2980 |
} |
| 2981 |
} |
| 2982 |
else |
| 2983 |
{ |
| 2984 |
int i; |
| 2985 |
|
| 2986 |
if (((unsigned HOST_WIDE_INT) ~INTVAL (operands[2])) < 256) |
| 2987 |
{ |
| 2988 |
operands[2] = force_reg (SImode, |
| 2989 |
GEN_INT (~INTVAL (operands[2]))); |
| 2990 |
|
| 2991 |
emit_insn (gen_thumb1_bicsi3 (operands[0], operands[2], operands[1])); |
| 2992 |
|
| 2993 |
DONE; |
| 2994 |
} |
| 2995 |
|
| 2996 |
for (i = 9; i <= 31; i++) |
| 2997 |
{ |
| 2998 |
if ((HOST_WIDE_INT_1 << i) - 1 == INTVAL (operands[2])) |
| 2999 |
{ |
| 3000 |
emit_insn (gen_extzv (operands[0], operands[1], GEN_INT (i), |
| 3001 |
const0_rtx)); |
| 3002 |
DONE; |
| 3003 |
} |
| 3004 |
else if ((HOST_WIDE_INT_1 << i) - 1 |
| 3005 |
== ~INTVAL (operands[2])) |
| 3006 |
{ |
| 3007 |
rtx shift = GEN_INT (i); |
| 3008 |
rtx reg = gen_reg_rtx (SImode); |
| 3009 |
|
| 3010 |
emit_insn (gen_lshrsi3 (reg, operands[1], shift)); |
| 3011 |
emit_insn (gen_ashlsi3 (operands[0], reg, shift)); |
| 3012 |
|
| 3013 |
DONE; |
| 3014 |
} |
| 3015 |
} |
| 3016 |
|
| 3017 |
operands[2] = force_reg (SImode, operands[2]); |
| 3018 |
} |
| 3019 |
} |
| 3020 |
" |
| 3021 |
) |
| 3022 |
|
| 3023 |
; ??? Check split length for Thumb-2 |
| 3024 |
(define_insn_and_split "*arm_andsi3_insn" |
| 3025 |
[(set (match_operand:SI 0 "s_register_operand" "=r,l,r,r,r,r") |
| 3026 |
(and:SI (match_operand:SI 1 "s_register_operand" "%r,0,r,r,0,r") |
| 3027 |
(match_operand:SI 2 "reg_or_int_operand" "I,l,K,r,Dj,?n")))] |
| 3028 |
"TARGET_32BIT" |
| 3029 |
"@ |
| 3030 |
and%?\\t%0, %1, %2 |
| 3031 |
and%?\\t%0, %1, %2 |
| 3032 |
bic%?\\t%0, %1, #%B2 |
| 3033 |
and%?\\t%0, %1, %2 |
| 3034 |
bfc%?\\t%0, %V2 |
| 3035 |
#" |
| 3036 |
"TARGET_32BIT |
| 3037 |
&& CONST_INT_P (operands[2]) |
| 3038 |
&& !(const_ok_for_arm (INTVAL (operands[2])) |
| 3039 |
|| const_ok_for_arm (~INTVAL (operands[2])) |
| 3040 |
|| (arm_arch_thumb2 |
| 3041 |
&& satisfies_constraint_Dj (operands[2]) |
| 3042 |
&& (rtx_equal_p (operands[0], operands[1]) |
| 3043 |
|| !reload_completed)))" |
| 3044 |
[(clobber (const_int 0))] |
| 3045 |
" |
| 3046 |
arm_split_constant (AND, SImode, curr_insn, |
| 3047 |
INTVAL (operands[2]), operands[0], operands[1], 0); |
| 3048 |
DONE; |
| 3049 |
" |
| 3050 |
[(set_attr "length" "4,4,4,4,4,16") |
| 3051 |
(set_attr "predicable" "yes") |
| 3052 |
(set_attr "predicable_short_it" "no,yes,no,no,no,no") |
| 3053 |
(set_attr "arch" "*,*,*,*,v6t2,*") |
| 3054 |
(set_attr "type" "logic_imm,logic_imm,logic_reg,logic_reg,bfm,logic_imm")] |
| 3055 |
) |
| 3056 |
|
| 3057 |
(define_insn "*andsi3_compare0" |
| 3058 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3059 |
(compare:CC_NZ |
| 3060 |
(and:SI (match_operand:SI 1 "s_register_operand" "r,r,r") |
| 3061 |
(match_operand:SI 2 "arm_not_operand" "I,K,r")) |
| 3062 |
(const_int 0))) |
| 3063 |
(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 3064 |
(and:SI (match_dup 1) (match_dup 2)))] |
| 3065 |
"TARGET_32BIT" |
| 3066 |
"@ |
| 3067 |
ands%?\\t%0, %1, %2 |
| 3068 |
bics%?\\t%0, %1, #%B2 |
| 3069 |
ands%?\\t%0, %1, %2" |
| 3070 |
[(set_attr "conds" "set") |
| 3071 |
(set_attr "type" "logics_imm,logics_imm,logics_reg")] |
| 3072 |
) |
| 3073 |
|
| 3074 |
(define_insn "*andsi3_compare0_scratch" |
| 3075 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3076 |
(compare:CC_NZ |
| 3077 |
(and:SI (match_operand:SI 0 "s_register_operand" "r,r,r") |
| 3078 |
(match_operand:SI 1 "arm_not_operand" "I,K,r")) |
| 3079 |
(const_int 0))) |
| 3080 |
(clobber (match_scratch:SI 2 "=X,r,X"))] |
| 3081 |
"TARGET_32BIT" |
| 3082 |
"@ |
| 3083 |
tst%?\\t%0, %1 |
| 3084 |
bics%?\\t%2, %0, #%B1 |
| 3085 |
tst%?\\t%0, %1" |
| 3086 |
[(set_attr "conds" "set") |
| 3087 |
(set_attr "type" "logics_imm,logics_imm,logics_reg")] |
| 3088 |
) |
| 3089 |
|
| 3090 |
(define_insn "*zeroextractsi_compare0_scratch" |
| 3091 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3092 |
(compare:CC_NZ (zero_extract:SI |
| 3093 |
(match_operand:SI 0 "s_register_operand" "r") |
| 3094 |
(match_operand 1 "const_int_operand" "n") |
| 3095 |
(match_operand 2 "const_int_operand" "n")) |
| 3096 |
(const_int 0)))] |
| 3097 |
"TARGET_32BIT |
| 3098 |
&& (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32 |
| 3099 |
&& INTVAL (operands[1]) > 0 |
| 3100 |
&& INTVAL (operands[1]) + (INTVAL (operands[2]) & 1) <= 8 |
| 3101 |
&& INTVAL (operands[1]) + INTVAL (operands[2]) <= 32)" |
| 3102 |
"* |
| 3103 |
operands[1] = GEN_INT (((1 << INTVAL (operands[1])) - 1) |
| 3104 |
<< INTVAL (operands[2])); |
| 3105 |
output_asm_insn (\"tst%?\\t%0, %1\", operands); |
| 3106 |
return \"\"; |
| 3107 |
" |
| 3108 |
[(set_attr "conds" "set") |
| 3109 |
(set_attr "predicable" "yes") |
| 3110 |
(set_attr "type" "logics_imm")] |
| 3111 |
) |
| 3112 |
|
| 3113 |
(define_insn_and_split "*ne_zeroextractsi" |
| 3114 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3115 |
(ne:SI (zero_extract:SI |
| 3116 |
(match_operand:SI 1 "s_register_operand" "r") |
| 3117 |
(match_operand:SI 2 "const_int_operand" "n") |
| 3118 |
(match_operand:SI 3 "const_int_operand" "n")) |
| 3119 |
(const_int 0))) |
| 3120 |
(clobber (reg:CC CC_REGNUM))] |
| 3121 |
"TARGET_32BIT |
| 3122 |
&& (INTVAL (operands[3]) >= 0 && INTVAL (operands[3]) < 32 |
| 3123 |
&& INTVAL (operands[2]) > 0 |
| 3124 |
&& INTVAL (operands[2]) + (INTVAL (operands[3]) & 1) <= 8 |
| 3125 |
&& INTVAL (operands[2]) + INTVAL (operands[3]) <= 32)" |
| 3126 |
"#" |
| 3127 |
"TARGET_32BIT |
| 3128 |
&& (INTVAL (operands[3]) >= 0 && INTVAL (operands[3]) < 32 |
| 3129 |
&& INTVAL (operands[2]) > 0 |
| 3130 |
&& INTVAL (operands[2]) + (INTVAL (operands[3]) & 1) <= 8 |
| 3131 |
&& INTVAL (operands[2]) + INTVAL (operands[3]) <= 32)" |
| 3132 |
[(parallel [(set (reg:CC_NZ CC_REGNUM) |
| 3133 |
(compare:CC_NZ (and:SI (match_dup 1) (match_dup 2)) |
| 3134 |
(const_int 0))) |
| 3135 |
(set (match_dup 0) (and:SI (match_dup 1) (match_dup 2)))]) |
| 3136 |
(set (match_dup 0) |
| 3137 |
(if_then_else:SI (eq (reg:CC_NZ CC_REGNUM) (const_int 0)) |
| 3138 |
(match_dup 0) (const_int 1)))] |
| 3139 |
" |
| 3140 |
operands[2] = GEN_INT (((1 << INTVAL (operands[2])) - 1) |
| 3141 |
<< INTVAL (operands[3])); |
| 3142 |
" |
| 3143 |
[(set_attr "conds" "clob") |
| 3144 |
(set (attr "length") |
| 3145 |
(if_then_else (eq_attr "is_thumb" "yes") |
| 3146 |
(const_int 12) |
| 3147 |
(const_int 8))) |
| 3148 |
(set_attr "type" "multiple")] |
| 3149 |
) |
| 3150 |
|
| 3151 |
(define_insn_and_split "*ne_zeroextractsi_shifted" |
| 3152 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3153 |
(ne:SI (zero_extract:SI |
| 3154 |
(match_operand:SI 1 "s_register_operand" "r") |
| 3155 |
(match_operand:SI 2 "const_int_operand" "n") |
| 3156 |
(const_int 0)) |
| 3157 |
(const_int 0))) |
| 3158 |
(clobber (reg:CC CC_REGNUM))] |
| 3159 |
"TARGET_ARM" |
| 3160 |
"#" |
| 3161 |
"TARGET_ARM" |
| 3162 |
[(parallel [(set (reg:CC_NZ CC_REGNUM) |
| 3163 |
(compare:CC_NZ (ashift:SI (match_dup 1) (match_dup 2)) |
| 3164 |
(const_int 0))) |
| 3165 |
(set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2)))]) |
| 3166 |
(set (match_dup 0) |
| 3167 |
(if_then_else:SI (eq (reg:CC_NZ CC_REGNUM) (const_int 0)) |
| 3168 |
(match_dup 0) (const_int 1)))] |
| 3169 |
" |
| 3170 |
operands[2] = GEN_INT (32 - INTVAL (operands[2])); |
| 3171 |
" |
| 3172 |
[(set_attr "conds" "clob") |
| 3173 |
(set_attr "length" "8") |
| 3174 |
(set_attr "type" "multiple")] |
| 3175 |
) |
| 3176 |
|
| 3177 |
(define_insn_and_split "*ite_ne_zeroextractsi" |
| 3178 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3179 |
(if_then_else:SI (ne (zero_extract:SI |
| 3180 |
(match_operand:SI 1 "s_register_operand" "r") |
| 3181 |
(match_operand:SI 2 "const_int_operand" "n") |
| 3182 |
(match_operand:SI 3 "const_int_operand" "n")) |
| 3183 |
(const_int 0)) |
| 3184 |
(match_operand:SI 4 "arm_not_operand" "rIK") |
| 3185 |
(const_int 0))) |
| 3186 |
(clobber (reg:CC CC_REGNUM))] |
| 3187 |
"TARGET_ARM |
| 3188 |
&& (INTVAL (operands[3]) >= 0 && INTVAL (operands[3]) < 32 |
| 3189 |
&& INTVAL (operands[2]) > 0 |
| 3190 |
&& INTVAL (operands[2]) + (INTVAL (operands[3]) & 1) <= 8 |
| 3191 |
&& INTVAL (operands[2]) + INTVAL (operands[3]) <= 32) |
| 3192 |
&& !reg_overlap_mentioned_p (operands[0], operands[4])" |
| 3193 |
"#" |
| 3194 |
"TARGET_ARM |
| 3195 |
&& (INTVAL (operands[3]) >= 0 && INTVAL (operands[3]) < 32 |
| 3196 |
&& INTVAL (operands[2]) > 0 |
| 3197 |
&& INTVAL (operands[2]) + (INTVAL (operands[3]) & 1) <= 8 |
| 3198 |
&& INTVAL (operands[2]) + INTVAL (operands[3]) <= 32) |
| 3199 |
&& !reg_overlap_mentioned_p (operands[0], operands[4])" |
| 3200 |
[(parallel [(set (reg:CC_NZ CC_REGNUM) |
| 3201 |
(compare:CC_NZ (and:SI (match_dup 1) (match_dup 2)) |
| 3202 |
(const_int 0))) |
| 3203 |
(set (match_dup 0) (and:SI (match_dup 1) (match_dup 2)))]) |
| 3204 |
(set (match_dup 0) |
| 3205 |
(if_then_else:SI (eq (reg:CC_NZ CC_REGNUM) (const_int 0)) |
| 3206 |
(match_dup 0) (match_dup 4)))] |
| 3207 |
" |
| 3208 |
operands[2] = GEN_INT (((1 << INTVAL (operands[2])) - 1) |
| 3209 |
<< INTVAL (operands[3])); |
| 3210 |
" |
| 3211 |
[(set_attr "conds" "clob") |
| 3212 |
(set_attr "length" "8") |
| 3213 |
(set_attr "type" "multiple")] |
| 3214 |
) |
| 3215 |
|
| 3216 |
(define_insn_and_split "*ite_ne_zeroextractsi_shifted" |
| 3217 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3218 |
(if_then_else:SI (ne (zero_extract:SI |
| 3219 |
(match_operand:SI 1 "s_register_operand" "r") |
| 3220 |
(match_operand:SI 2 "const_int_operand" "n") |
| 3221 |
(const_int 0)) |
| 3222 |
(const_int 0)) |
| 3223 |
(match_operand:SI 3 "arm_not_operand" "rIK") |
| 3224 |
(const_int 0))) |
| 3225 |
(clobber (reg:CC CC_REGNUM))] |
| 3226 |
"TARGET_ARM && !reg_overlap_mentioned_p (operands[0], operands[3])" |
| 3227 |
"#" |
| 3228 |
"TARGET_ARM && !reg_overlap_mentioned_p (operands[0], operands[3])" |
| 3229 |
[(parallel [(set (reg:CC_NZ CC_REGNUM) |
| 3230 |
(compare:CC_NZ (ashift:SI (match_dup 1) (match_dup 2)) |
| 3231 |
(const_int 0))) |
| 3232 |
(set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2)))]) |
| 3233 |
(set (match_dup 0) |
| 3234 |
(if_then_else:SI (eq (reg:CC_NZ CC_REGNUM) (const_int 0)) |
| 3235 |
(match_dup 0) (match_dup 3)))] |
| 3236 |
" |
| 3237 |
operands[2] = GEN_INT (32 - INTVAL (operands[2])); |
| 3238 |
" |
| 3239 |
[(set_attr "conds" "clob") |
| 3240 |
(set_attr "length" "8") |
| 3241 |
(set_attr "type" "multiple")] |
| 3242 |
) |
| 3243 |
|
| 3244 |
;; ??? Use Thumb-2 has bitfield insert/extract instructions. |
| 3245 |
(define_split |
| 3246 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 3247 |
(match_operator:SI 1 "shiftable_operator" |
| 3248 |
[(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") |
| 3249 |
(match_operand:SI 3 "const_int_operand" "") |
| 3250 |
(match_operand:SI 4 "const_int_operand" "")) |
| 3251 |
(match_operand:SI 5 "s_register_operand" "")])) |
| 3252 |
(clobber (match_operand:SI 6 "s_register_operand" ""))] |
| 3253 |
"TARGET_ARM" |
| 3254 |
[(set (match_dup 6) (ashift:SI (match_dup 2) (match_dup 3))) |
| 3255 |
(set (match_dup 0) |
| 3256 |
(match_op_dup 1 |
| 3257 |
[(lshiftrt:SI (match_dup 6) (match_dup 4)) |
| 3258 |
(match_dup 5)]))] |
| 3259 |
"{ |
| 3260 |
HOST_WIDE_INT temp = INTVAL (operands[3]); |
| 3261 |
|
| 3262 |
operands[3] = GEN_INT (32 - temp - INTVAL (operands[4])); |
| 3263 |
operands[4] = GEN_INT (32 - temp); |
| 3264 |
}" |
| 3265 |
) |
| 3266 |
|
| 3267 |
(define_split |
| 3268 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 3269 |
(match_operator:SI 1 "shiftable_operator" |
| 3270 |
[(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") |
| 3271 |
(match_operand:SI 3 "const_int_operand" "") |
| 3272 |
(match_operand:SI 4 "const_int_operand" "")) |
| 3273 |
(match_operand:SI 5 "s_register_operand" "")])) |
| 3274 |
(clobber (match_operand:SI 6 "s_register_operand" ""))] |
| 3275 |
"TARGET_ARM" |
| 3276 |
[(set (match_dup 6) (ashift:SI (match_dup 2) (match_dup 3))) |
| 3277 |
(set (match_dup 0) |
| 3278 |
(match_op_dup 1 |
| 3279 |
[(ashiftrt:SI (match_dup 6) (match_dup 4)) |
| 3280 |
(match_dup 5)]))] |
| 3281 |
"{ |
| 3282 |
HOST_WIDE_INT temp = INTVAL (operands[3]); |
| 3283 |
|
| 3284 |
operands[3] = GEN_INT (32 - temp - INTVAL (operands[4])); |
| 3285 |
operands[4] = GEN_INT (32 - temp); |
| 3286 |
}" |
| 3287 |
) |
| 3288 |
|
| 3289 |
;;; ??? This pattern is bogus. If operand3 has bits outside the range |
| 3290 |
;;; represented by the bitfield, then this will produce incorrect results. |
| 3291 |
;;; Somewhere, the value needs to be truncated. On targets like the m68k, |
| 3292 |
;;; which have a real bit-field insert instruction, the truncation happens |
| 3293 |
;;; in the bit-field insert instruction itself. Since arm does not have a |
| 3294 |
;;; bit-field insert instruction, we would have to emit code here to truncate |
| 3295 |
;;; the value before we insert. This loses some of the advantage of having |
| 3296 |
;;; this insv pattern, so this pattern needs to be reevalutated. |
| 3297 |
|
| 3298 |
(define_expand "insv" |
| 3299 |
[(set (zero_extract (match_operand 0 "nonimmediate_operand") |
| 3300 |
(match_operand 1 "general_operand") |
| 3301 |
(match_operand 2 "general_operand")) |
| 3302 |
(match_operand 3 "reg_or_int_operand"))] |
| 3303 |
"TARGET_ARM || arm_arch_thumb2" |
| 3304 |
" |
| 3305 |
{ |
| 3306 |
int start_bit = INTVAL (operands[2]); |
| 3307 |
int width = INTVAL (operands[1]); |
| 3308 |
HOST_WIDE_INT mask = (HOST_WIDE_INT_1 << width) - 1; |
| 3309 |
rtx target, subtarget; |
| 3310 |
|
| 3311 |
if (arm_arch_thumb2) |
| 3312 |
{ |
| 3313 |
if (unaligned_access && MEM_P (operands[0]) |
| 3314 |
&& s_register_operand (operands[3], GET_MODE (operands[3])) |
| 3315 |
&& (width == 16 || width == 32) && (start_bit % BITS_PER_UNIT) == 0) |
| 3316 |
{ |
| 3317 |
rtx base_addr; |
| 3318 |
|
| 3319 |
if (BYTES_BIG_ENDIAN) |
| 3320 |
start_bit = GET_MODE_BITSIZE (GET_MODE (operands[3])) - width |
| 3321 |
- start_bit; |
| 3322 |
|
| 3323 |
if (width == 32) |
| 3324 |
{ |
| 3325 |
base_addr = adjust_address (operands[0], SImode, |
| 3326 |
start_bit / BITS_PER_UNIT); |
| 3327 |
emit_insn (gen_unaligned_storesi (base_addr, operands[3])); |
| 3328 |
} |
| 3329 |
else |
| 3330 |
{ |
| 3331 |
rtx tmp = gen_reg_rtx (HImode); |
| 3332 |
|
| 3333 |
base_addr = adjust_address (operands[0], HImode, |
| 3334 |
start_bit / BITS_PER_UNIT); |
| 3335 |
emit_move_insn (tmp, gen_lowpart (HImode, operands[3])); |
| 3336 |
emit_insn (gen_unaligned_storehi (base_addr, tmp)); |
| 3337 |
} |
| 3338 |
DONE; |
| 3339 |
} |
| 3340 |
else if (s_register_operand (operands[0], GET_MODE (operands[0]))) |
| 3341 |
{ |
| 3342 |
bool use_bfi = TRUE; |
| 3343 |
|
| 3344 |
if (CONST_INT_P (operands[3])) |
| 3345 |
{ |
| 3346 |
HOST_WIDE_INT val = INTVAL (operands[3]) & mask; |
| 3347 |
|
| 3348 |
if (val == 0) |
| 3349 |
{ |
| 3350 |
emit_insn (gen_insv_zero (operands[0], operands[1], |
| 3351 |
operands[2])); |
| 3352 |
DONE; |
| 3353 |
} |
| 3354 |
|
| 3355 |
/* See if the set can be done with a single orr instruction. */ |
| 3356 |
if (val == mask && const_ok_for_arm (val << start_bit)) |
| 3357 |
use_bfi = FALSE; |
| 3358 |
} |
| 3359 |
|
| 3360 |
if (use_bfi) |
| 3361 |
{ |
| 3362 |
if (!REG_P (operands[3])) |
| 3363 |
operands[3] = force_reg (SImode, operands[3]); |
| 3364 |
|
| 3365 |
emit_insn (gen_insv_t2 (operands[0], operands[1], operands[2], |
| 3366 |
operands[3])); |
| 3367 |
DONE; |
| 3368 |
} |
| 3369 |
} |
| 3370 |
else |
| 3371 |
FAIL; |
| 3372 |
} |
| 3373 |
|
| 3374 |
if (!s_register_operand (operands[0], GET_MODE (operands[0]))) |
| 3375 |
FAIL; |
| 3376 |
|
| 3377 |
target = copy_rtx (operands[0]); |
| 3378 |
/* Avoid using a subreg as a subtarget, and avoid writing a paradoxical |
| 3379 |
subreg as the final target. */ |
| 3380 |
if (GET_CODE (target) == SUBREG) |
| 3381 |
{ |
| 3382 |
subtarget = gen_reg_rtx (SImode); |
| 3383 |
if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (target))) |
| 3384 |
< GET_MODE_SIZE (SImode)) |
| 3385 |
target = SUBREG_REG (target); |
| 3386 |
} |
| 3387 |
else |
| 3388 |
subtarget = target; |
| 3389 |
|
| 3390 |
if (CONST_INT_P (operands[3])) |
| 3391 |
{ |
| 3392 |
/* Since we are inserting a known constant, we may be able to |
| 3393 |
reduce the number of bits that we have to clear so that |
| 3394 |
the mask becomes simple. */ |
| 3395 |
/* ??? This code does not check to see if the new mask is actually |
| 3396 |
simpler. It may not be. */ |
| 3397 |
rtx op1 = gen_reg_rtx (SImode); |
| 3398 |
/* ??? Truncate operand3 to fit in the bitfield. See comment before |
| 3399 |
start of this pattern. */ |
| 3400 |
HOST_WIDE_INT op3_value = mask & INTVAL (operands[3]); |
| 3401 |
HOST_WIDE_INT mask2 = ((mask & ~op3_value) << start_bit); |
| 3402 |
|
| 3403 |
emit_insn (gen_andsi3 (op1, operands[0], |
| 3404 |
gen_int_mode (~mask2, SImode))); |
| 3405 |
emit_insn (gen_iorsi3 (subtarget, op1, |
| 3406 |
gen_int_mode (op3_value << start_bit, SImode))); |
| 3407 |
} |
| 3408 |
else if (start_bit == 0 |
| 3409 |
&& !(const_ok_for_arm (mask) |
| 3410 |
|| const_ok_for_arm (~mask))) |
| 3411 |
{ |
| 3412 |
/* A Trick, since we are setting the bottom bits in the word, |
| 3413 |
we can shift operand[3] up, operand[0] down, OR them together |
| 3414 |
and rotate the result back again. This takes 3 insns, and |
| 3415 |
the third might be mergeable into another op. */ |
| 3416 |
/* The shift up copes with the possibility that operand[3] is |
| 3417 |
wider than the bitfield. */ |
| 3418 |
rtx op0 = gen_reg_rtx (SImode); |
| 3419 |
rtx op1 = gen_reg_rtx (SImode); |
| 3420 |
|
| 3421 |
emit_insn (gen_ashlsi3 (op0, operands[3], GEN_INT (32 - width))); |
| 3422 |
emit_insn (gen_lshrsi3 (op1, operands[0], operands[1])); |
| 3423 |
emit_insn (gen_iorsi3 (op1, op1, op0)); |
| 3424 |
emit_insn (gen_rotlsi3 (subtarget, op1, operands[1])); |
| 3425 |
} |
| 3426 |
else if ((width + start_bit == 32) |
| 3427 |
&& !(const_ok_for_arm (mask) |
| 3428 |
|| const_ok_for_arm (~mask))) |
| 3429 |
{ |
| 3430 |
/* Similar trick, but slightly less efficient. */ |
| 3431 |
|
| 3432 |
rtx op0 = gen_reg_rtx (SImode); |
| 3433 |
rtx op1 = gen_reg_rtx (SImode); |
| 3434 |
|
| 3435 |
emit_insn (gen_ashlsi3 (op0, operands[3], GEN_INT (32 - width))); |
| 3436 |
emit_insn (gen_ashlsi3 (op1, operands[0], operands[1])); |
| 3437 |
emit_insn (gen_lshrsi3 (op1, op1, operands[1])); |
| 3438 |
emit_insn (gen_iorsi3 (subtarget, op1, op0)); |
| 3439 |
} |
| 3440 |
else |
| 3441 |
{ |
| 3442 |
rtx op0 = gen_int_mode (mask, SImode); |
| 3443 |
rtx op1 = gen_reg_rtx (SImode); |
| 3444 |
rtx op2 = gen_reg_rtx (SImode); |
| 3445 |
|
| 3446 |
if (!(const_ok_for_arm (mask) || const_ok_for_arm (~mask))) |
| 3447 |
{ |
| 3448 |
rtx tmp = gen_reg_rtx (SImode); |
| 3449 |
|
| 3450 |
emit_insn (gen_movsi (tmp, op0)); |
| 3451 |
op0 = tmp; |
| 3452 |
} |
| 3453 |
|
| 3454 |
/* Mask out any bits in operand[3] that are not needed. */ |
| 3455 |
emit_insn (gen_andsi3 (op1, operands[3], op0)); |
| 3456 |
|
| 3457 |
if (CONST_INT_P (op0) |
| 3458 |
&& (const_ok_for_arm (mask << start_bit) |
| 3459 |
|| const_ok_for_arm (~(mask << start_bit)))) |
| 3460 |
{ |
| 3461 |
op0 = gen_int_mode (~(mask << start_bit), SImode); |
| 3462 |
emit_insn (gen_andsi3 (op2, operands[0], op0)); |
| 3463 |
} |
| 3464 |
else |
| 3465 |
{ |
| 3466 |
if (CONST_INT_P (op0)) |
| 3467 |
{ |
| 3468 |
rtx tmp = gen_reg_rtx (SImode); |
| 3469 |
|
| 3470 |
emit_insn (gen_movsi (tmp, op0)); |
| 3471 |
op0 = tmp; |
| 3472 |
} |
| 3473 |
|
| 3474 |
if (start_bit != 0) |
| 3475 |
emit_insn (gen_ashlsi3 (op0, op0, operands[2])); |
| 3476 |
|
| 3477 |
emit_insn (gen_andsi_notsi_si (op2, operands[0], op0)); |
| 3478 |
} |
| 3479 |
|
| 3480 |
if (start_bit != 0) |
| 3481 |
emit_insn (gen_ashlsi3 (op1, op1, operands[2])); |
| 3482 |
|
| 3483 |
emit_insn (gen_iorsi3 (subtarget, op1, op2)); |
| 3484 |
} |
| 3485 |
|
| 3486 |
if (subtarget != target) |
| 3487 |
{ |
| 3488 |
/* If TARGET is still a SUBREG, then it must be wider than a word, |
| 3489 |
so we must be careful only to set the subword we were asked to. */ |
| 3490 |
if (GET_CODE (target) == SUBREG) |
| 3491 |
emit_move_insn (target, subtarget); |
| 3492 |
else |
| 3493 |
emit_move_insn (target, gen_lowpart (GET_MODE (target), subtarget)); |
| 3494 |
} |
| 3495 |
|
| 3496 |
DONE; |
| 3497 |
}" |
| 3498 |
) |
| 3499 |
|
| 3500 |
(define_insn_and_split "insv_zero" |
| 3501 |
[(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r") |
| 3502 |
(match_operand:SI 1 "const_int_M_operand" "M") |
| 3503 |
(match_operand:SI 2 "const_int_M_operand" "M")) |
| 3504 |
(const_int 0))] |
| 3505 |
"arm_arch_thumb2" |
| 3506 |
"bfc%?\t%0, %2, %1" |
| 3507 |
"" |
| 3508 |
[(set (match_dup 0) (and:SI (match_dup 0) (match_dup 1)))] |
| 3509 |
{ |
| 3510 |
/* Convert back to a normal AND operation, so that we can take advantage |
| 3511 |
of BIC and AND when appropriate; we'll still emit BFC if that's the |
| 3512 |
right thing to do. */ |
| 3513 |
unsigned HOST_WIDE_INT width = UINTVAL (operands[1]); |
| 3514 |
unsigned HOST_WIDE_INT lsb = UINTVAL (operands[2]); |
| 3515 |
unsigned HOST_WIDE_INT mask = (HOST_WIDE_INT_1U << width) - 1; |
| 3516 |
|
| 3517 |
operands[1] = gen_int_mode (~(mask << lsb), SImode); |
| 3518 |
} |
| 3519 |
[(set_attr "length" "4") |
| 3520 |
(set_attr "predicable" "yes") |
| 3521 |
(set_attr "type" "bfm")] |
| 3522 |
) |
| 3523 |
|
| 3524 |
(define_insn "insv_t2" |
| 3525 |
[(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r") |
| 3526 |
(match_operand:SI 1 "const_int_M_operand" "M") |
| 3527 |
(match_operand:SI 2 "const_int_M_operand" "M")) |
| 3528 |
(match_operand:SI 3 "s_register_operand" "r"))] |
| 3529 |
"arm_arch_thumb2" |
| 3530 |
"bfi%?\t%0, %3, %2, %1" |
| 3531 |
[(set_attr "length" "4") |
| 3532 |
(set_attr "predicable" "yes") |
| 3533 |
(set_attr "type" "bfm")] |
| 3534 |
) |
| 3535 |
|
| 3536 |
(define_insn "*bfi" |
| 3537 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3538 |
(ior:SI (and:SI (match_operand:SI 1 "s_register_operand" "0") |
| 3539 |
(match_operand 2 "const_int_operand" "Dj")) |
| 3540 |
(and:SI (ashift:SI |
| 3541 |
(match_operand:SI 3 "s_register_operand" "r") |
| 3542 |
(match_operand 4 "const_int_operand" "i")) |
| 3543 |
(match_operand 5 "const_int_operand" "i"))))] |
| 3544 |
"arm_arch_thumb2 |
| 3545 |
&& UINTVAL (operands[4]) < 32 |
| 3546 |
&& UINTVAL (operands[2]) == ~UINTVAL (operands[5]) |
| 3547 |
&& (exact_log2 (UINTVAL (operands[5]) |
| 3548 |
+ (HOST_WIDE_INT_1U << UINTVAL (operands[4]))) |
| 3549 |
>= 0)" |
| 3550 |
"bfi%?\t%0, %3, %V2" |
| 3551 |
[(set_attr "length" "4") |
| 3552 |
(set_attr "predicable" "yes") |
| 3553 |
(set_attr "type" "bfm")] |
| 3554 |
) |
| 3555 |
|
| 3556 |
(define_insn "*bfi_alt1" |
| 3557 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3558 |
(ior:SI (and:SI (ashift:SI |
| 3559 |
(match_operand:SI 3 "s_register_operand" "r") |
| 3560 |
(match_operand 4 "const_int_operand" "i")) |
| 3561 |
(match_operand 5 "const_int_operand" "i")) |
| 3562 |
(and:SI (match_operand:SI 1 "s_register_operand" "0") |
| 3563 |
(match_operand 2 "const_int_operand" "Dj"))))] |
| 3564 |
"arm_arch_thumb2 |
| 3565 |
&& UINTVAL (operands[4]) < 32 |
| 3566 |
&& UINTVAL (operands[2]) == ~UINTVAL (operands[5]) |
| 3567 |
&& (exact_log2 (UINTVAL (operands[5]) |
| 3568 |
+ (HOST_WIDE_INT_1U << UINTVAL (operands[4]))) |
| 3569 |
>= 0)" |
| 3570 |
"bfi%?\t%0, %3, %V2" |
| 3571 |
[(set_attr "length" "4") |
| 3572 |
(set_attr "predicable" "yes") |
| 3573 |
(set_attr "type" "bfm")] |
| 3574 |
) |
| 3575 |
|
| 3576 |
(define_insn "*bfi_alt2" |
| 3577 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3578 |
(ior:SI (and:SI (match_operand:SI 1 "s_register_operand" "0") |
| 3579 |
(match_operand 2 "const_int_operand" "i")) |
| 3580 |
(and:SI (match_operand:SI 3 "s_register_operand" "r") |
| 3581 |
(match_operand 4 "const_int_operand" "i"))))] |
| 3582 |
"arm_arch_thumb2 |
| 3583 |
&& UINTVAL (operands[2]) == ~UINTVAL (operands[4]) |
| 3584 |
&& exact_log2 (UINTVAL (operands[4]) + 1) >= 0" |
| 3585 |
"bfi%?\t%0, %3, %V2" |
| 3586 |
[(set_attr "length" "4") |
| 3587 |
(set_attr "predicable" "yes") |
| 3588 |
(set_attr "type" "bfm")] |
| 3589 |
) |
| 3590 |
|
| 3591 |
(define_insn "*bfi_alt3" |
| 3592 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3593 |
(ior:SI (and:SI (match_operand:SI 3 "s_register_operand" "r") |
| 3594 |
(match_operand 4 "const_int_operand" "i")) |
| 3595 |
(and:SI (match_operand:SI 1 "s_register_operand" "0") |
| 3596 |
(match_operand 2 "const_int_operand" "i"))))] |
| 3597 |
"arm_arch_thumb2 |
| 3598 |
&& UINTVAL (operands[2]) == ~UINTVAL (operands[4]) |
| 3599 |
&& exact_log2 (UINTVAL (operands[4]) + 1) >= 0" |
| 3600 |
"bfi%?\t%0, %3, %V2" |
| 3601 |
[(set_attr "length" "4") |
| 3602 |
(set_attr "predicable" "yes") |
| 3603 |
(set_attr "type" "bfm")] |
| 3604 |
) |
| 3605 |
|
| 3606 |
(define_insn "andsi_notsi_si" |
| 3607 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3608 |
(and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
| 3609 |
(match_operand:SI 1 "s_register_operand" "r")))] |
| 3610 |
"TARGET_32BIT" |
| 3611 |
"bic%?\\t%0, %1, %2" |
| 3612 |
[(set_attr "predicable" "yes") |
| 3613 |
(set_attr "type" "logic_reg")] |
| 3614 |
) |
| 3615 |
|
| 3616 |
(define_insn "andsi_not_shiftsi_si" |
| 3617 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 3618 |
(and:SI (not:SI (match_operator:SI 4 "shift_operator" |
| 3619 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 3620 |
(match_operand:SI 3 "shift_amount_operand" "M,r")])) |
| 3621 |
(match_operand:SI 1 "s_register_operand" "r,r")))] |
| 3622 |
"TARGET_32BIT" |
| 3623 |
"bic%?\\t%0, %1, %2%S4" |
| 3624 |
[(set_attr "predicable" "yes") |
| 3625 |
(set_attr "shift" "2") |
| 3626 |
(set_attr "arch" "32,a") |
| 3627 |
(set_attr "type" "logic_shift_imm,logic_shift_reg")] |
| 3628 |
) |
| 3629 |
|
| 3630 |
;; Shifted bics pattern used to set up CC status register and not reusing |
| 3631 |
;; bics output. Pattern restricts Thumb2 shift operand as bics for Thumb2 |
| 3632 |
;; does not support shift by register. |
| 3633 |
(define_insn "andsi_not_shiftsi_si_scc_no_reuse" |
| 3634 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3635 |
(compare:CC_NZ |
| 3636 |
(and:SI (not:SI (match_operator:SI 0 "shift_operator" |
| 3637 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 3638 |
(match_operand:SI 2 "shift_amount_operand" "M,r")])) |
| 3639 |
(match_operand:SI 3 "s_register_operand" "r,r")) |
| 3640 |
(const_int 0))) |
| 3641 |
(clobber (match_scratch:SI 4 "=r,r"))] |
| 3642 |
"TARGET_32BIT" |
| 3643 |
"bics%?\\t%4, %3, %1%S0" |
| 3644 |
[(set_attr "predicable" "yes") |
| 3645 |
(set_attr "arch" "32,a") |
| 3646 |
(set_attr "conds" "set") |
| 3647 |
(set_attr "shift" "1") |
| 3648 |
(set_attr "type" "logic_shift_imm,logic_shift_reg")] |
| 3649 |
) |
| 3650 |
|
| 3651 |
;; Same as andsi_not_shiftsi_si_scc_no_reuse, but the bics result is also |
| 3652 |
;; getting reused later. |
| 3653 |
(define_insn "andsi_not_shiftsi_si_scc" |
| 3654 |
[(parallel [(set (reg:CC_NZ CC_REGNUM) |
| 3655 |
(compare:CC_NZ |
| 3656 |
(and:SI (not:SI (match_operator:SI 0 "shift_operator" |
| 3657 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 3658 |
(match_operand:SI 2 "shift_amount_operand" "M,r")])) |
| 3659 |
(match_operand:SI 3 "s_register_operand" "r,r")) |
| 3660 |
(const_int 0))) |
| 3661 |
(set (match_operand:SI 4 "s_register_operand" "=r,r") |
| 3662 |
(and:SI (not:SI (match_op_dup 0 |
| 3663 |
[(match_dup 1) |
| 3664 |
(match_dup 2)])) |
| 3665 |
(match_dup 3)))])] |
| 3666 |
"TARGET_32BIT" |
| 3667 |
"bics%?\\t%4, %3, %1%S0" |
| 3668 |
[(set_attr "predicable" "yes") |
| 3669 |
(set_attr "arch" "32,a") |
| 3670 |
(set_attr "conds" "set") |
| 3671 |
(set_attr "shift" "1") |
| 3672 |
(set_attr "type" "logic_shift_imm,logic_shift_reg")] |
| 3673 |
) |
| 3674 |
|
| 3675 |
(define_insn "*andsi_notsi_si_compare0" |
| 3676 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3677 |
(compare:CC_NZ |
| 3678 |
(and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
| 3679 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 3680 |
(const_int 0))) |
| 3681 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3682 |
(and:SI (not:SI (match_dup 2)) (match_dup 1)))] |
| 3683 |
"TARGET_32BIT" |
| 3684 |
"bics\\t%0, %1, %2" |
| 3685 |
[(set_attr "conds" "set") |
| 3686 |
(set_attr "type" "logics_shift_reg")] |
| 3687 |
) |
| 3688 |
|
| 3689 |
(define_insn "*andsi_notsi_si_compare0_scratch" |
| 3690 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3691 |
(compare:CC_NZ |
| 3692 |
(and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r")) |
| 3693 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 3694 |
(const_int 0))) |
| 3695 |
(clobber (match_scratch:SI 0 "=r"))] |
| 3696 |
"TARGET_32BIT" |
| 3697 |
"bics\\t%0, %1, %2" |
| 3698 |
[(set_attr "conds" "set") |
| 3699 |
(set_attr "type" "logics_shift_reg")] |
| 3700 |
) |
| 3701 |
|
| 3702 |
(define_expand "iorsi3" |
| 3703 |
[(set (match_operand:SI 0 "s_register_operand") |
| 3704 |
(ior:SI (match_operand:SI 1 "s_register_operand") |
| 3705 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 3706 |
"TARGET_EITHER" |
| 3707 |
" |
| 3708 |
if (CONST_INT_P (operands[2])) |
| 3709 |
{ |
| 3710 |
if (TARGET_32BIT) |
| 3711 |
{ |
| 3712 |
if (DONT_EARLY_SPLIT_CONSTANT (INTVAL (operands[2]), IOR)) |
| 3713 |
operands[2] = force_reg (SImode, operands[2]); |
| 3714 |
else |
| 3715 |
{ |
| 3716 |
arm_split_constant (IOR, SImode, NULL_RTX, |
| 3717 |
INTVAL (operands[2]), operands[0], |
| 3718 |
operands[1], |
| 3719 |
optimize && can_create_pseudo_p ()); |
| 3720 |
DONE; |
| 3721 |
} |
| 3722 |
} |
| 3723 |
else /* TARGET_THUMB1 */ |
| 3724 |
{ |
| 3725 |
rtx tmp = force_reg (SImode, operands[2]); |
| 3726 |
if (rtx_equal_p (operands[0], operands[1])) |
| 3727 |
operands[2] = tmp; |
| 3728 |
else |
| 3729 |
{ |
| 3730 |
operands[2] = operands[1]; |
| 3731 |
operands[1] = tmp; |
| 3732 |
} |
| 3733 |
} |
| 3734 |
} |
| 3735 |
" |
| 3736 |
) |
| 3737 |
|
| 3738 |
(define_insn_and_split "*iorsi3_insn" |
| 3739 |
[(set (match_operand:SI 0 "s_register_operand" "=r,l,r,r,r") |
| 3740 |
(ior:SI (match_operand:SI 1 "s_register_operand" "%r,0,r,r,r") |
| 3741 |
(match_operand:SI 2 "reg_or_int_operand" "I,l,K,r,?n")))] |
| 3742 |
"TARGET_32BIT" |
| 3743 |
"@ |
| 3744 |
orr%?\\t%0, %1, %2 |
| 3745 |
orr%?\\t%0, %1, %2 |
| 3746 |
orn%?\\t%0, %1, #%B2 |
| 3747 |
orr%?\\t%0, %1, %2 |
| 3748 |
#" |
| 3749 |
"TARGET_32BIT |
| 3750 |
&& CONST_INT_P (operands[2]) |
| 3751 |
&& !(const_ok_for_arm (INTVAL (operands[2])) |
| 3752 |
|| (TARGET_THUMB2 && const_ok_for_arm (~INTVAL (operands[2]))))" |
| 3753 |
[(clobber (const_int 0))] |
| 3754 |
{ |
| 3755 |
arm_split_constant (IOR, SImode, curr_insn, |
| 3756 |
INTVAL (operands[2]), operands[0], operands[1], 0); |
| 3757 |
DONE; |
| 3758 |
} |
| 3759 |
[(set_attr "length" "4,4,4,4,16") |
| 3760 |
(set_attr "arch" "32,t2,t2,32,32") |
| 3761 |
(set_attr "predicable" "yes") |
| 3762 |
(set_attr "predicable_short_it" "no,yes,no,no,no") |
| 3763 |
(set_attr "type" "logic_imm,logic_reg,logic_imm,logic_reg,logic_reg")] |
| 3764 |
) |
| 3765 |
|
| 3766 |
(define_peephole2 |
| 3767 |
[(match_scratch:SI 3 "r") |
| 3768 |
(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 3769 |
(ior:SI (match_operand:SI 1 "arm_general_register_operand" "") |
| 3770 |
(match_operand:SI 2 "const_int_operand" "")))] |
| 3771 |
"TARGET_ARM |
| 3772 |
&& !const_ok_for_arm (INTVAL (operands[2])) |
| 3773 |
&& const_ok_for_arm (~INTVAL (operands[2]))" |
| 3774 |
[(set (match_dup 3) (match_dup 2)) |
| 3775 |
(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))] |
| 3776 |
"" |
| 3777 |
) |
| 3778 |
|
| 3779 |
(define_insn "*iorsi3_compare0" |
| 3780 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3781 |
(compare:CC_NZ |
| 3782 |
(ior:SI (match_operand:SI 1 "s_register_operand" "%r,0,r") |
| 3783 |
(match_operand:SI 2 "arm_rhs_operand" "I,l,r")) |
| 3784 |
(const_int 0))) |
| 3785 |
(set (match_operand:SI 0 "s_register_operand" "=r,l,r") |
| 3786 |
(ior:SI (match_dup 1) (match_dup 2)))] |
| 3787 |
"TARGET_32BIT" |
| 3788 |
"orrs%?\\t%0, %1, %2" |
| 3789 |
[(set_attr "conds" "set") |
| 3790 |
(set_attr "arch" "*,t2,*") |
| 3791 |
(set_attr "length" "4,2,4") |
| 3792 |
(set_attr "type" "logics_imm,logics_reg,logics_reg")] |
| 3793 |
) |
| 3794 |
|
| 3795 |
(define_insn "*iorsi3_compare0_scratch" |
| 3796 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3797 |
(compare:CC_NZ |
| 3798 |
(ior:SI (match_operand:SI 1 "s_register_operand" "%r,0,r") |
| 3799 |
(match_operand:SI 2 "arm_rhs_operand" "I,l,r")) |
| 3800 |
(const_int 0))) |
| 3801 |
(clobber (match_scratch:SI 0 "=r,l,r"))] |
| 3802 |
"TARGET_32BIT" |
| 3803 |
"orrs%?\\t%0, %1, %2" |
| 3804 |
[(set_attr "conds" "set") |
| 3805 |
(set_attr "arch" "*,t2,*") |
| 3806 |
(set_attr "length" "4,2,4") |
| 3807 |
(set_attr "type" "logics_imm,logics_reg,logics_reg")] |
| 3808 |
) |
| 3809 |
|
| 3810 |
(define_expand "xorsi3" |
| 3811 |
[(set (match_operand:SI 0 "s_register_operand") |
| 3812 |
(xor:SI (match_operand:SI 1 "s_register_operand") |
| 3813 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 3814 |
"TARGET_EITHER" |
| 3815 |
"if (CONST_INT_P (operands[2])) |
| 3816 |
{ |
| 3817 |
if (TARGET_32BIT) |
| 3818 |
{ |
| 3819 |
if (DONT_EARLY_SPLIT_CONSTANT (INTVAL (operands[2]), XOR)) |
| 3820 |
operands[2] = force_reg (SImode, operands[2]); |
| 3821 |
else |
| 3822 |
{ |
| 3823 |
arm_split_constant (XOR, SImode, NULL_RTX, |
| 3824 |
INTVAL (operands[2]), operands[0], |
| 3825 |
operands[1], |
| 3826 |
optimize && can_create_pseudo_p ()); |
| 3827 |
DONE; |
| 3828 |
} |
| 3829 |
} |
| 3830 |
else /* TARGET_THUMB1 */ |
| 3831 |
{ |
| 3832 |
rtx tmp = force_reg (SImode, operands[2]); |
| 3833 |
if (rtx_equal_p (operands[0], operands[1])) |
| 3834 |
operands[2] = tmp; |
| 3835 |
else |
| 3836 |
{ |
| 3837 |
operands[2] = operands[1]; |
| 3838 |
operands[1] = tmp; |
| 3839 |
} |
| 3840 |
} |
| 3841 |
}" |
| 3842 |
) |
| 3843 |
|
| 3844 |
(define_insn_and_split "*arm_xorsi3" |
| 3845 |
[(set (match_operand:SI 0 "s_register_operand" "=r,l,r,r") |
| 3846 |
(xor:SI (match_operand:SI 1 "s_register_operand" "%r,0,r,r") |
| 3847 |
(match_operand:SI 2 "reg_or_int_operand" "I,l,r,?n")))] |
| 3848 |
"TARGET_32BIT" |
| 3849 |
"@ |
| 3850 |
eor%?\\t%0, %1, %2 |
| 3851 |
eor%?\\t%0, %1, %2 |
| 3852 |
eor%?\\t%0, %1, %2 |
| 3853 |
#" |
| 3854 |
"TARGET_32BIT |
| 3855 |
&& CONST_INT_P (operands[2]) |
| 3856 |
&& !const_ok_for_arm (INTVAL (operands[2]))" |
| 3857 |
[(clobber (const_int 0))] |
| 3858 |
{ |
| 3859 |
arm_split_constant (XOR, SImode, curr_insn, |
| 3860 |
INTVAL (operands[2]), operands[0], operands[1], 0); |
| 3861 |
DONE; |
| 3862 |
} |
| 3863 |
[(set_attr "length" "4,4,4,16") |
| 3864 |
(set_attr "predicable" "yes") |
| 3865 |
(set_attr "predicable_short_it" "no,yes,no,no") |
| 3866 |
(set_attr "type" "logic_imm,logic_reg,logic_reg,multiple")] |
| 3867 |
) |
| 3868 |
|
| 3869 |
(define_insn "*xorsi3_compare0" |
| 3870 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3871 |
(compare:CC_NZ (xor:SI (match_operand:SI 1 "s_register_operand" "r,r") |
| 3872 |
(match_operand:SI 2 "arm_rhs_operand" "I,r")) |
| 3873 |
(const_int 0))) |
| 3874 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 3875 |
(xor:SI (match_dup 1) (match_dup 2)))] |
| 3876 |
"TARGET_32BIT" |
| 3877 |
"eors%?\\t%0, %1, %2" |
| 3878 |
[(set_attr "conds" "set") |
| 3879 |
(set_attr "type" "logics_imm,logics_reg")] |
| 3880 |
) |
| 3881 |
|
| 3882 |
(define_insn "*xorsi3_compare0_scratch" |
| 3883 |
[(set (reg:CC_NZ CC_REGNUM) |
| 3884 |
(compare:CC_NZ (xor:SI (match_operand:SI 0 "s_register_operand" "r,r") |
| 3885 |
(match_operand:SI 1 "arm_rhs_operand" "I,r")) |
| 3886 |
(const_int 0)))] |
| 3887 |
"TARGET_32BIT" |
| 3888 |
"teq%?\\t%0, %1" |
| 3889 |
[(set_attr "conds" "set") |
| 3890 |
(set_attr "type" "logics_imm,logics_reg")] |
| 3891 |
) |
| 3892 |
|
| 3893 |
; By splitting (IOR (AND (NOT A) (NOT B)) C) as D = AND (IOR A B) (NOT C), |
| 3894 |
; (NOT D) we can sometimes merge the final NOT into one of the following |
| 3895 |
; insns. |
| 3896 |
|
| 3897 |
(define_split |
| 3898 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 3899 |
(ior:SI (and:SI (not:SI (match_operand:SI 1 "s_register_operand" "")) |
| 3900 |
(not:SI (match_operand:SI 2 "arm_rhs_operand" ""))) |
| 3901 |
(match_operand:SI 3 "arm_rhs_operand" ""))) |
| 3902 |
(clobber (match_operand:SI 4 "s_register_operand" ""))] |
| 3903 |
"TARGET_32BIT" |
| 3904 |
[(set (match_dup 4) (and:SI (ior:SI (match_dup 1) (match_dup 2)) |
| 3905 |
(not:SI (match_dup 3)))) |
| 3906 |
(set (match_dup 0) (not:SI (match_dup 4)))] |
| 3907 |
"" |
| 3908 |
) |
| 3909 |
|
| 3910 |
(define_insn_and_split "*andsi_iorsi3_notsi" |
| 3911 |
[(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r") |
| 3912 |
(and:SI (ior:SI (match_operand:SI 1 "s_register_operand" "%0,r,r") |
| 3913 |
(match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")) |
| 3914 |
(not:SI (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI"))))] |
| 3915 |
"TARGET_32BIT" |
| 3916 |
"#" ; "orr%?\\t%0, %1, %2\;bic%?\\t%0, %0, %3" |
| 3917 |
"&& reload_completed" |
| 3918 |
[(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 2))) |
| 3919 |
(set (match_dup 0) (and:SI (match_dup 4) (match_dup 5)))] |
| 3920 |
{ |
| 3921 |
/* If operands[3] is a constant make sure to fold the NOT into it |
| 3922 |
to avoid creating a NOT of a CONST_INT. */ |
| 3923 |
rtx not_rtx = simplify_gen_unary (NOT, SImode, operands[3], SImode); |
| 3924 |
if (CONST_INT_P (not_rtx)) |
| 3925 |
{ |
| 3926 |
operands[4] = operands[0]; |
| 3927 |
operands[5] = not_rtx; |
| 3928 |
} |
| 3929 |
else |
| 3930 |
{ |
| 3931 |
operands[5] = operands[0]; |
| 3932 |
operands[4] = not_rtx; |
| 3933 |
} |
| 3934 |
} |
| 3935 |
[(set_attr "length" "8") |
| 3936 |
(set_attr "ce_count" "2") |
| 3937 |
(set_attr "predicable" "yes") |
| 3938 |
(set_attr "type" "multiple")] |
| 3939 |
) |
| 3940 |
|
| 3941 |
; ??? Are these four splitters still beneficial when the Thumb-2 bitfield |
| 3942 |
; insns are available? |
| 3943 |
(define_split |
| 3944 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 3945 |
(match_operator:SI 1 "logical_binary_operator" |
| 3946 |
[(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") |
| 3947 |
(match_operand:SI 3 "const_int_operand" "") |
| 3948 |
(match_operand:SI 4 "const_int_operand" "")) |
| 3949 |
(match_operator:SI 9 "logical_binary_operator" |
| 3950 |
[(lshiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
| 3951 |
(match_operand:SI 6 "const_int_operand" "")) |
| 3952 |
(match_operand:SI 7 "s_register_operand" "")])])) |
| 3953 |
(clobber (match_operand:SI 8 "s_register_operand" ""))] |
| 3954 |
"TARGET_32BIT |
| 3955 |
&& GET_CODE (operands[1]) == GET_CODE (operands[9]) |
| 3956 |
&& INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
| 3957 |
[(set (match_dup 8) |
| 3958 |
(match_op_dup 1 |
| 3959 |
[(ashift:SI (match_dup 2) (match_dup 4)) |
| 3960 |
(match_dup 5)])) |
| 3961 |
(set (match_dup 0) |
| 3962 |
(match_op_dup 1 |
| 3963 |
[(lshiftrt:SI (match_dup 8) (match_dup 6)) |
| 3964 |
(match_dup 7)]))] |
| 3965 |
" |
| 3966 |
operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
| 3967 |
") |
| 3968 |
|
| 3969 |
(define_split |
| 3970 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 3971 |
(match_operator:SI 1 "logical_binary_operator" |
| 3972 |
[(match_operator:SI 9 "logical_binary_operator" |
| 3973 |
[(lshiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
| 3974 |
(match_operand:SI 6 "const_int_operand" "")) |
| 3975 |
(match_operand:SI 7 "s_register_operand" "")]) |
| 3976 |
(zero_extract:SI (match_operand:SI 2 "s_register_operand" "") |
| 3977 |
(match_operand:SI 3 "const_int_operand" "") |
| 3978 |
(match_operand:SI 4 "const_int_operand" ""))])) |
| 3979 |
(clobber (match_operand:SI 8 "s_register_operand" ""))] |
| 3980 |
"TARGET_32BIT |
| 3981 |
&& GET_CODE (operands[1]) == GET_CODE (operands[9]) |
| 3982 |
&& INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
| 3983 |
[(set (match_dup 8) |
| 3984 |
(match_op_dup 1 |
| 3985 |
[(ashift:SI (match_dup 2) (match_dup 4)) |
| 3986 |
(match_dup 5)])) |
| 3987 |
(set (match_dup 0) |
| 3988 |
(match_op_dup 1 |
| 3989 |
[(lshiftrt:SI (match_dup 8) (match_dup 6)) |
| 3990 |
(match_dup 7)]))] |
| 3991 |
" |
| 3992 |
operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
| 3993 |
") |
| 3994 |
|
| 3995 |
(define_split |
| 3996 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 3997 |
(match_operator:SI 1 "logical_binary_operator" |
| 3998 |
[(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") |
| 3999 |
(match_operand:SI 3 "const_int_operand" "") |
| 4000 |
(match_operand:SI 4 "const_int_operand" "")) |
| 4001 |
(match_operator:SI 9 "logical_binary_operator" |
| 4002 |
[(ashiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
| 4003 |
(match_operand:SI 6 "const_int_operand" "")) |
| 4004 |
(match_operand:SI 7 "s_register_operand" "")])])) |
| 4005 |
(clobber (match_operand:SI 8 "s_register_operand" ""))] |
| 4006 |
"TARGET_32BIT |
| 4007 |
&& GET_CODE (operands[1]) == GET_CODE (operands[9]) |
| 4008 |
&& INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
| 4009 |
[(set (match_dup 8) |
| 4010 |
(match_op_dup 1 |
| 4011 |
[(ashift:SI (match_dup 2) (match_dup 4)) |
| 4012 |
(match_dup 5)])) |
| 4013 |
(set (match_dup 0) |
| 4014 |
(match_op_dup 1 |
| 4015 |
[(ashiftrt:SI (match_dup 8) (match_dup 6)) |
| 4016 |
(match_dup 7)]))] |
| 4017 |
" |
| 4018 |
operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
| 4019 |
") |
| 4020 |
|
| 4021 |
(define_split |
| 4022 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 4023 |
(match_operator:SI 1 "logical_binary_operator" |
| 4024 |
[(match_operator:SI 9 "logical_binary_operator" |
| 4025 |
[(ashiftrt:SI (match_operand:SI 5 "s_register_operand" "") |
| 4026 |
(match_operand:SI 6 "const_int_operand" "")) |
| 4027 |
(match_operand:SI 7 "s_register_operand" "")]) |
| 4028 |
(sign_extract:SI (match_operand:SI 2 "s_register_operand" "") |
| 4029 |
(match_operand:SI 3 "const_int_operand" "") |
| 4030 |
(match_operand:SI 4 "const_int_operand" ""))])) |
| 4031 |
(clobber (match_operand:SI 8 "s_register_operand" ""))] |
| 4032 |
"TARGET_32BIT |
| 4033 |
&& GET_CODE (operands[1]) == GET_CODE (operands[9]) |
| 4034 |
&& INTVAL (operands[3]) == 32 - INTVAL (operands[6])" |
| 4035 |
[(set (match_dup 8) |
| 4036 |
(match_op_dup 1 |
| 4037 |
[(ashift:SI (match_dup 2) (match_dup 4)) |
| 4038 |
(match_dup 5)])) |
| 4039 |
(set (match_dup 0) |
| 4040 |
(match_op_dup 1 |
| 4041 |
[(ashiftrt:SI (match_dup 8) (match_dup 6)) |
| 4042 |
(match_dup 7)]))] |
| 4043 |
" |
| 4044 |
operands[4] = GEN_INT (32 - (INTVAL (operands[3]) + INTVAL (operands[4]))); |
| 4045 |
") |
| 4046 |
|
| 4047 |
|
| 4048 |
;; Minimum and maximum insns |
| 4049 |
|
| 4050 |
(define_expand "smaxsi3" |
| 4051 |
[(parallel [ |
| 4052 |
(set (match_operand:SI 0 "s_register_operand") |
| 4053 |
(smax:SI (match_operand:SI 1 "s_register_operand") |
| 4054 |
(match_operand:SI 2 "arm_rhs_operand"))) |
| 4055 |
(clobber (reg:CC CC_REGNUM))])] |
| 4056 |
"TARGET_32BIT" |
| 4057 |
" |
| 4058 |
if (operands[2] == const0_rtx || operands[2] == constm1_rtx) |
| 4059 |
{ |
| 4060 |
/* No need for a clobber of the condition code register here. */ |
| 4061 |
emit_insn (gen_rtx_SET (operands[0], |
| 4062 |
gen_rtx_SMAX (SImode, operands[1], |
| 4063 |
operands[2]))); |
| 4064 |
DONE; |
| 4065 |
} |
| 4066 |
") |
| 4067 |
|
| 4068 |
(define_insn "*smax_0" |
| 4069 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4070 |
(smax:SI (match_operand:SI 1 "s_register_operand" "r") |
| 4071 |
(const_int 0)))] |
| 4072 |
"TARGET_32BIT" |
| 4073 |
"bic%?\\t%0, %1, %1, asr #31" |
| 4074 |
[(set_attr "predicable" "yes") |
| 4075 |
(set_attr "type" "logic_shift_reg")] |
| 4076 |
) |
| 4077 |
|
| 4078 |
(define_insn "*smax_m1" |
| 4079 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4080 |
(smax:SI (match_operand:SI 1 "s_register_operand" "r") |
| 4081 |
(const_int -1)))] |
| 4082 |
"TARGET_32BIT" |
| 4083 |
"orr%?\\t%0, %1, %1, asr #31" |
| 4084 |
[(set_attr "predicable" "yes") |
| 4085 |
(set_attr "type" "logic_shift_reg")] |
| 4086 |
) |
| 4087 |
|
| 4088 |
(define_insn_and_split "*arm_smax_insn" |
| 4089 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 4090 |
(smax:SI (match_operand:SI 1 "s_register_operand" "%0,?r") |
| 4091 |
(match_operand:SI 2 "arm_rhs_operand" "rI,rI"))) |
| 4092 |
(clobber (reg:CC CC_REGNUM))] |
| 4093 |
"TARGET_ARM" |
| 4094 |
"#" |
| 4095 |
; cmp\\t%1, %2\;movlt\\t%0, %2 |
| 4096 |
; cmp\\t%1, %2\;movge\\t%0, %1\;movlt\\t%0, %2" |
| 4097 |
"TARGET_ARM" |
| 4098 |
[(set (reg:CC CC_REGNUM) |
| 4099 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 4100 |
(set (match_dup 0) |
| 4101 |
(if_then_else:SI (ge:SI (reg:CC CC_REGNUM) (const_int 0)) |
| 4102 |
(match_dup 1) |
| 4103 |
(match_dup 2)))] |
| 4104 |
"" |
| 4105 |
[(set_attr "conds" "clob") |
| 4106 |
(set_attr "length" "8,12") |
| 4107 |
(set_attr "type" "multiple")] |
| 4108 |
) |
| 4109 |
|
| 4110 |
(define_expand "sminsi3" |
| 4111 |
[(parallel [ |
| 4112 |
(set (match_operand:SI 0 "s_register_operand") |
| 4113 |
(smin:SI (match_operand:SI 1 "s_register_operand") |
| 4114 |
(match_operand:SI 2 "arm_rhs_operand"))) |
| 4115 |
(clobber (reg:CC CC_REGNUM))])] |
| 4116 |
"TARGET_32BIT" |
| 4117 |
" |
| 4118 |
if (operands[2] == const0_rtx) |
| 4119 |
{ |
| 4120 |
/* No need for a clobber of the condition code register here. */ |
| 4121 |
emit_insn (gen_rtx_SET (operands[0], |
| 4122 |
gen_rtx_SMIN (SImode, operands[1], |
| 4123 |
operands[2]))); |
| 4124 |
DONE; |
| 4125 |
} |
| 4126 |
") |
| 4127 |
|
| 4128 |
(define_insn "*smin_0" |
| 4129 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4130 |
(smin:SI (match_operand:SI 1 "s_register_operand" "r") |
| 4131 |
(const_int 0)))] |
| 4132 |
"TARGET_32BIT" |
| 4133 |
"and%?\\t%0, %1, %1, asr #31" |
| 4134 |
[(set_attr "predicable" "yes") |
| 4135 |
(set_attr "type" "logic_shift_reg")] |
| 4136 |
) |
| 4137 |
|
| 4138 |
(define_insn_and_split "*arm_smin_insn" |
| 4139 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 4140 |
(smin:SI (match_operand:SI 1 "s_register_operand" "%0,?r") |
| 4141 |
(match_operand:SI 2 "arm_rhs_operand" "rI,rI"))) |
| 4142 |
(clobber (reg:CC CC_REGNUM))] |
| 4143 |
"TARGET_ARM" |
| 4144 |
"#" |
| 4145 |
; cmp\\t%1, %2\;movge\\t%0, %2 |
| 4146 |
; cmp\\t%1, %2\;movlt\\t%0, %1\;movge\\t%0, %2" |
| 4147 |
"TARGET_ARM" |
| 4148 |
[(set (reg:CC CC_REGNUM) |
| 4149 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 4150 |
(set (match_dup 0) |
| 4151 |
(if_then_else:SI (lt:SI (reg:CC CC_REGNUM) (const_int 0)) |
| 4152 |
(match_dup 1) |
| 4153 |
(match_dup 2)))] |
| 4154 |
"" |
| 4155 |
[(set_attr "conds" "clob") |
| 4156 |
(set_attr "length" "8,12") |
| 4157 |
(set_attr "type" "multiple,multiple")] |
| 4158 |
) |
| 4159 |
|
| 4160 |
(define_expand "umaxsi3" |
| 4161 |
[(parallel [ |
| 4162 |
(set (match_operand:SI 0 "s_register_operand") |
| 4163 |
(umax:SI (match_operand:SI 1 "s_register_operand") |
| 4164 |
(match_operand:SI 2 "arm_rhs_operand"))) |
| 4165 |
(clobber (reg:CC CC_REGNUM))])] |
| 4166 |
"TARGET_32BIT" |
| 4167 |
"" |
| 4168 |
) |
| 4169 |
|
| 4170 |
(define_insn_and_split "*arm_umaxsi3" |
| 4171 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 4172 |
(umax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r") |
| 4173 |
(match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) |
| 4174 |
(clobber (reg:CC CC_REGNUM))] |
| 4175 |
"TARGET_ARM" |
| 4176 |
"#" |
| 4177 |
; cmp\\t%1, %2\;movcc\\t%0, %2 |
| 4178 |
; cmp\\t%1, %2\;movcs\\t%0, %1 |
| 4179 |
; cmp\\t%1, %2\;movcs\\t%0, %1\;movcc\\t%0, %2" |
| 4180 |
"TARGET_ARM" |
| 4181 |
[(set (reg:CC CC_REGNUM) |
| 4182 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 4183 |
(set (match_dup 0) |
| 4184 |
(if_then_else:SI (geu:SI (reg:CC CC_REGNUM) (const_int 0)) |
| 4185 |
(match_dup 1) |
| 4186 |
(match_dup 2)))] |
| 4187 |
"" |
| 4188 |
[(set_attr "conds" "clob") |
| 4189 |
(set_attr "length" "8,8,12") |
| 4190 |
(set_attr "type" "store_4")] |
| 4191 |
) |
| 4192 |
|
| 4193 |
(define_expand "uminsi3" |
| 4194 |
[(parallel [ |
| 4195 |
(set (match_operand:SI 0 "s_register_operand") |
| 4196 |
(umin:SI (match_operand:SI 1 "s_register_operand") |
| 4197 |
(match_operand:SI 2 "arm_rhs_operand"))) |
| 4198 |
(clobber (reg:CC CC_REGNUM))])] |
| 4199 |
"TARGET_32BIT" |
| 4200 |
"" |
| 4201 |
) |
| 4202 |
|
| 4203 |
(define_insn_and_split "*arm_uminsi3" |
| 4204 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 4205 |
(umin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r") |
| 4206 |
(match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) |
| 4207 |
(clobber (reg:CC CC_REGNUM))] |
| 4208 |
"TARGET_ARM" |
| 4209 |
"#" |
| 4210 |
; cmp\\t%1, %2\;movcs\\t%0, %2 |
| 4211 |
; cmp\\t%1, %2\;movcc\\t%0, %1 |
| 4212 |
; cmp\\t%1, %2\;movcc\\t%0, %1\;movcs\\t%0, %2" |
| 4213 |
"TARGET_ARM" |
| 4214 |
[(set (reg:CC CC_REGNUM) |
| 4215 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 4216 |
(set (match_dup 0) |
| 4217 |
(if_then_else:SI (ltu:SI (reg:CC CC_REGNUM) (const_int 0)) |
| 4218 |
(match_dup 1) |
| 4219 |
(match_dup 2)))] |
| 4220 |
"" |
| 4221 |
[(set_attr "conds" "clob") |
| 4222 |
(set_attr "length" "8,8,12") |
| 4223 |
(set_attr "type" "store_4")] |
| 4224 |
) |
| 4225 |
|
| 4226 |
(define_insn "*store_minmaxsi" |
| 4227 |
[(set (match_operand:SI 0 "memory_operand" "=m") |
| 4228 |
(match_operator:SI 3 "minmax_operator" |
| 4229 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 4230 |
(match_operand:SI 2 "s_register_operand" "r")])) |
| 4231 |
(clobber (reg:CC CC_REGNUM))] |
| 4232 |
"TARGET_32BIT && optimize_function_for_size_p (cfun) && !arm_restrict_it" |
| 4233 |
"* |
| 4234 |
operands[3] = gen_rtx_fmt_ee (minmax_code (operands[3]), SImode, |
| 4235 |
operands[1], operands[2]); |
| 4236 |
output_asm_insn (\"cmp\\t%1, %2\", operands); |
| 4237 |
if (TARGET_THUMB2) |
| 4238 |
output_asm_insn (\"ite\t%d3\", operands); |
| 4239 |
output_asm_insn (\"str%d3\\t%1, %0\", operands); |
| 4240 |
output_asm_insn (\"str%D3\\t%2, %0\", operands); |
| 4241 |
return \"\"; |
| 4242 |
" |
| 4243 |
[(set_attr "conds" "clob") |
| 4244 |
(set (attr "length") |
| 4245 |
(if_then_else (eq_attr "is_thumb" "yes") |
| 4246 |
(const_int 14) |
| 4247 |
(const_int 12))) |
| 4248 |
(set_attr "type" "store_4")] |
| 4249 |
) |
| 4250 |
|
| 4251 |
; Reject the frame pointer in operand[1], since reloading this after |
| 4252 |
; it has been eliminated can cause carnage. |
| 4253 |
(define_insn "*minmax_arithsi" |
| 4254 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 4255 |
(match_operator:SI 4 "shiftable_operator" |
| 4256 |
[(match_operator:SI 5 "minmax_operator" |
| 4257 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 4258 |
(match_operand:SI 3 "arm_rhs_operand" "rI,rI")]) |
| 4259 |
(match_operand:SI 1 "s_register_operand" "0,?r")])) |
| 4260 |
(clobber (reg:CC CC_REGNUM))] |
| 4261 |
"TARGET_32BIT && !arm_eliminable_register (operands[1]) && !arm_restrict_it" |
| 4262 |
"* |
| 4263 |
{ |
| 4264 |
enum rtx_code code = GET_CODE (operands[4]); |
| 4265 |
bool need_else; |
| 4266 |
|
| 4267 |
if (which_alternative != 0 || operands[3] != const0_rtx |
| 4268 |
|| (code != PLUS && code != IOR && code != XOR)) |
| 4269 |
need_else = true; |
| 4270 |
else |
| 4271 |
need_else = false; |
| 4272 |
|
| 4273 |
operands[5] = gen_rtx_fmt_ee (minmax_code (operands[5]), SImode, |
| 4274 |
operands[2], operands[3]); |
| 4275 |
output_asm_insn (\"cmp\\t%2, %3\", operands); |
| 4276 |
if (TARGET_THUMB2) |
| 4277 |
{ |
| 4278 |
if (need_else) |
| 4279 |
output_asm_insn (\"ite\\t%d5\", operands); |
| 4280 |
else |
| 4281 |
output_asm_insn (\"it\\t%d5\", operands); |
| 4282 |
} |
| 4283 |
output_asm_insn (\"%i4%d5\\t%0, %1, %2\", operands); |
| 4284 |
if (need_else) |
| 4285 |
output_asm_insn (\"%i4%D5\\t%0, %1, %3\", operands); |
| 4286 |
return \"\"; |
| 4287 |
}" |
| 4288 |
[(set_attr "conds" "clob") |
| 4289 |
(set (attr "length") |
| 4290 |
(if_then_else (eq_attr "is_thumb" "yes") |
| 4291 |
(const_int 14) |
| 4292 |
(const_int 12))) |
| 4293 |
(set_attr "type" "multiple")] |
| 4294 |
) |
| 4295 |
|
| 4296 |
; Reject the frame pointer in operand[1], since reloading this after |
| 4297 |
; it has been eliminated can cause carnage. |
| 4298 |
(define_insn_and_split "*minmax_arithsi_non_canon" |
| 4299 |
[(set (match_operand:SI 0 "s_register_operand" "=Ts,Ts") |
| 4300 |
(minus:SI |
| 4301 |
(match_operand:SI 1 "s_register_operand" "0,?Ts") |
| 4302 |
(match_operator:SI 4 "minmax_operator" |
| 4303 |
[(match_operand:SI 2 "s_register_operand" "Ts,Ts") |
| 4304 |
(match_operand:SI 3 "arm_rhs_operand" "TsI,TsI")]))) |
| 4305 |
(clobber (reg:CC CC_REGNUM))] |
| 4306 |
"TARGET_32BIT && !arm_eliminable_register (operands[1]) |
| 4307 |
&& !(arm_restrict_it && CONST_INT_P (operands[3]))" |
| 4308 |
"#" |
| 4309 |
"TARGET_32BIT && !arm_eliminable_register (operands[1]) && reload_completed" |
| 4310 |
[(set (reg:CC CC_REGNUM) |
| 4311 |
(compare:CC (match_dup 2) (match_dup 3))) |
| 4312 |
|
| 4313 |
(cond_exec (match_op_dup 4 [(reg:CC CC_REGNUM) (const_int 0)]) |
| 4314 |
(set (match_dup 0) |
| 4315 |
(minus:SI (match_dup 1) |
| 4316 |
(match_dup 2)))) |
| 4317 |
(cond_exec (match_op_dup 5 [(reg:CC CC_REGNUM) (const_int 0)]) |
| 4318 |
(set (match_dup 0) |
| 4319 |
(match_dup 6)))] |
| 4320 |
{ |
| 4321 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), |
| 4322 |
operands[2], operands[3]); |
| 4323 |
enum rtx_code rc = minmax_code (operands[4]); |
| 4324 |
operands[4] = gen_rtx_fmt_ee (rc, VOIDmode, |
| 4325 |
operands[2], operands[3]); |
| 4326 |
|
| 4327 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 4328 |
rc = reverse_condition_maybe_unordered (rc); |
| 4329 |
else |
| 4330 |
rc = reverse_condition (rc); |
| 4331 |
operands[5] = gen_rtx_fmt_ee (rc, SImode, operands[2], operands[3]); |
| 4332 |
if (CONST_INT_P (operands[3])) |
| 4333 |
operands[6] = plus_constant (SImode, operands[1], -INTVAL (operands[3])); |
| 4334 |
else |
| 4335 |
operands[6] = gen_rtx_MINUS (SImode, operands[1], operands[3]); |
| 4336 |
} |
| 4337 |
[(set_attr "conds" "clob") |
| 4338 |
(set (attr "length") |
| 4339 |
(if_then_else (eq_attr "is_thumb" "yes") |
| 4340 |
(const_int 14) |
| 4341 |
(const_int 12))) |
| 4342 |
(set_attr "type" "multiple")] |
| 4343 |
) |
| 4344 |
|
| 4345 |
|
| 4346 |
(define_expand "arm_<ss_op>" |
| 4347 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4348 |
(SSPLUSMINUS:SI (match_operand:SI 1 "s_register_operand") |
| 4349 |
(match_operand:SI 2 "s_register_operand")))] |
| 4350 |
"TARGET_DSP_MULTIPLY" |
| 4351 |
{ |
| 4352 |
if (ARM_Q_BIT_READ) |
| 4353 |
emit_insn (gen_arm_<ss_op>_setq_insn (operands[0], |
| 4354 |
operands[1], operands[2])); |
| 4355 |
else |
| 4356 |
emit_insn (gen_arm_<ss_op>_insn (operands[0], operands[1], operands[2])); |
| 4357 |
DONE; |
| 4358 |
} |
| 4359 |
) |
| 4360 |
|
| 4361 |
(define_insn "arm_<ss_op><add_clobber_q_name>_insn" |
| 4362 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4363 |
(SSPLUSMINUS:SI (match_operand:SI 1 "s_register_operand" "r") |
| 4364 |
(match_operand:SI 2 "s_register_operand" "r")))] |
| 4365 |
"TARGET_DSP_MULTIPLY && <add_clobber_q_pred>" |
| 4366 |
"<ss_op>%?\t%0, %1, %2" |
| 4367 |
[(set_attr "predicable" "yes") |
| 4368 |
(set_attr "type" "alu_dsp_reg")] |
| 4369 |
) |
| 4370 |
|
| 4371 |
(define_code_iterator SAT [smin smax]) |
| 4372 |
(define_code_attr SATrev [(smin "smax") (smax "smin")]) |
| 4373 |
(define_code_attr SATlo [(smin "1") (smax "2")]) |
| 4374 |
(define_code_attr SAThi [(smin "2") (smax "1")]) |
| 4375 |
|
| 4376 |
(define_expand "arm_ssat" |
| 4377 |
[(match_operand:SI 0 "s_register_operand") |
| 4378 |
(match_operand:SI 1 "s_register_operand") |
| 4379 |
(match_operand:SI 2 "const_int_operand")] |
| 4380 |
"TARGET_32BIT && arm_arch6" |
| 4381 |
{ |
| 4382 |
HOST_WIDE_INT val = INTVAL (operands[2]); |
| 4383 |
/* The builtin checking code should have ensured the right |
| 4384 |
range for the immediate. */ |
| 4385 |
gcc_assert (IN_RANGE (val, 1, 32)); |
| 4386 |
HOST_WIDE_INT upper_bound = (HOST_WIDE_INT_1 << (val - 1)) - 1; |
| 4387 |
HOST_WIDE_INT lower_bound = -upper_bound - 1; |
| 4388 |
rtx up_rtx = gen_int_mode (upper_bound, SImode); |
| 4389 |
rtx lo_rtx = gen_int_mode (lower_bound, SImode); |
| 4390 |
if (ARM_Q_BIT_READ) |
| 4391 |
emit_insn (gen_satsi_smin_setq (operands[0], lo_rtx, |
| 4392 |
up_rtx, operands[1])); |
| 4393 |
else |
| 4394 |
emit_insn (gen_satsi_smin (operands[0], lo_rtx, up_rtx, operands[1])); |
| 4395 |
DONE; |
| 4396 |
} |
| 4397 |
) |
| 4398 |
|
| 4399 |
(define_expand "arm_usat" |
| 4400 |
[(match_operand:SI 0 "s_register_operand") |
| 4401 |
(match_operand:SI 1 "s_register_operand") |
| 4402 |
(match_operand:SI 2 "const_int_operand")] |
| 4403 |
"TARGET_32BIT && arm_arch6" |
| 4404 |
{ |
| 4405 |
HOST_WIDE_INT val = INTVAL (operands[2]); |
| 4406 |
/* The builtin checking code should have ensured the right |
| 4407 |
range for the immediate. */ |
| 4408 |
gcc_assert (IN_RANGE (val, 0, 31)); |
| 4409 |
HOST_WIDE_INT upper_bound = (HOST_WIDE_INT_1 << val) - 1; |
| 4410 |
rtx up_rtx = gen_int_mode (upper_bound, SImode); |
| 4411 |
rtx lo_rtx = CONST0_RTX (SImode); |
| 4412 |
if (ARM_Q_BIT_READ) |
| 4413 |
emit_insn (gen_satsi_smin_setq (operands[0], lo_rtx, up_rtx, |
| 4414 |
operands[1])); |
| 4415 |
else |
| 4416 |
emit_insn (gen_satsi_smin (operands[0], lo_rtx, up_rtx, operands[1])); |
| 4417 |
DONE; |
| 4418 |
} |
| 4419 |
) |
| 4420 |
|
| 4421 |
(define_insn "arm_get_apsr" |
| 4422 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4423 |
(unspec:SI [(reg:CC APSRQ_REGNUM)] UNSPEC_APSR_READ))] |
| 4424 |
"TARGET_ARM_QBIT" |
| 4425 |
"mrs%?\t%0, APSR" |
| 4426 |
[(set_attr "predicable" "yes") |
| 4427 |
(set_attr "conds" "use")] |
| 4428 |
) |
| 4429 |
|
| 4430 |
(define_insn "arm_set_apsr" |
| 4431 |
[(set (reg:CC APSRQ_REGNUM) |
| 4432 |
(unspec_volatile:CC |
| 4433 |
[(match_operand:SI 0 "s_register_operand" "r")] VUNSPEC_APSR_WRITE))] |
| 4434 |
"TARGET_ARM_QBIT" |
| 4435 |
"msr%?\tAPSR_nzcvq, %0" |
| 4436 |
[(set_attr "predicable" "yes") |
| 4437 |
(set_attr "conds" "set")] |
| 4438 |
) |
| 4439 |
|
| 4440 |
;; Read the APSR and extract the Q bit (bit 27) |
| 4441 |
(define_expand "arm_saturation_occurred" |
| 4442 |
[(match_operand:SI 0 "s_register_operand")] |
| 4443 |
"TARGET_ARM_QBIT" |
| 4444 |
{ |
| 4445 |
rtx apsr = gen_reg_rtx (SImode); |
| 4446 |
emit_insn (gen_arm_get_apsr (apsr)); |
| 4447 |
emit_insn (gen_extzv (operands[0], apsr, CONST1_RTX (SImode), |
| 4448 |
gen_int_mode (27, SImode))); |
| 4449 |
DONE; |
| 4450 |
} |
| 4451 |
) |
| 4452 |
|
| 4453 |
;; Read the APSR and set the Q bit (bit position 27) according to operand 0 |
| 4454 |
(define_expand "arm_set_saturation" |
| 4455 |
[(match_operand:SI 0 "reg_or_int_operand")] |
| 4456 |
"TARGET_ARM_QBIT" |
| 4457 |
{ |
| 4458 |
rtx apsr = gen_reg_rtx (SImode); |
| 4459 |
emit_insn (gen_arm_get_apsr (apsr)); |
| 4460 |
rtx to_insert = gen_reg_rtx (SImode); |
| 4461 |
if (CONST_INT_P (operands[0])) |
| 4462 |
emit_move_insn (to_insert, operands[0] == CONST0_RTX (SImode) |
| 4463 |
? CONST0_RTX (SImode) : CONST1_RTX (SImode)); |
| 4464 |
else |
| 4465 |
{ |
| 4466 |
rtx cmp = gen_rtx_NE (SImode, operands[0], CONST0_RTX (SImode)); |
| 4467 |
emit_insn (gen_cstoresi4 (to_insert, cmp, operands[0], |
| 4468 |
CONST0_RTX (SImode))); |
| 4469 |
} |
| 4470 |
emit_insn (gen_insv (apsr, CONST1_RTX (SImode), |
| 4471 |
gen_int_mode (27, SImode), to_insert)); |
| 4472 |
emit_insn (gen_arm_set_apsr (apsr)); |
| 4473 |
DONE; |
| 4474 |
} |
| 4475 |
) |
| 4476 |
|
| 4477 |
(define_insn "satsi_<SAT:code><add_clobber_q_name>" |
| 4478 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4479 |
(SAT:SI (<SATrev>:SI (match_operand:SI 3 "s_register_operand" "r") |
| 4480 |
(match_operand:SI 1 "const_int_operand" "i")) |
| 4481 |
(match_operand:SI 2 "const_int_operand" "i")))] |
| 4482 |
"TARGET_32BIT && arm_arch6 && <add_clobber_q_pred> |
| 4483 |
&& arm_sat_operator_match (operands[<SAT:SATlo>], operands[<SAT:SAThi>], NULL, NULL)" |
| 4484 |
{ |
| 4485 |
int mask; |
| 4486 |
bool signed_sat; |
| 4487 |
if (!arm_sat_operator_match (operands[<SAT:SATlo>], operands[<SAT:SAThi>], |
| 4488 |
&mask, &signed_sat)) |
| 4489 |
gcc_unreachable (); |
| 4490 |
|
| 4491 |
operands[1] = GEN_INT (mask); |
| 4492 |
if (signed_sat) |
| 4493 |
return "ssat%?\t%0, %1, %3"; |
| 4494 |
else |
| 4495 |
return "usat%?\t%0, %1, %3"; |
| 4496 |
} |
| 4497 |
[(set_attr "predicable" "yes") |
| 4498 |
(set_attr "type" "alus_imm")] |
| 4499 |
) |
| 4500 |
|
| 4501 |
(define_insn "*satsi_<SAT:code>_shift" |
| 4502 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 4503 |
(SAT:SI (<SATrev>:SI (match_operator:SI 3 "sat_shift_operator" |
| 4504 |
[(match_operand:SI 4 "s_register_operand" "r") |
| 4505 |
(match_operand:SI 5 "const_int_operand" "i")]) |
| 4506 |
(match_operand:SI 1 "const_int_operand" "i")) |
| 4507 |
(match_operand:SI 2 "const_int_operand" "i")))] |
| 4508 |
"TARGET_32BIT && arm_arch6 && !ARM_Q_BIT_READ |
| 4509 |
&& arm_sat_operator_match (operands[<SAT:SATlo>], operands[<SAT:SAThi>], NULL, NULL)" |
| 4510 |
{ |
| 4511 |
int mask; |
| 4512 |
bool signed_sat; |
| 4513 |
if (!arm_sat_operator_match (operands[<SAT:SATlo>], operands[<SAT:SAThi>], |
| 4514 |
&mask, &signed_sat)) |
| 4515 |
gcc_unreachable (); |
| 4516 |
|
| 4517 |
operands[1] = GEN_INT (mask); |
| 4518 |
if (signed_sat) |
| 4519 |
return "ssat%?\t%0, %1, %4%S3"; |
| 4520 |
else |
| 4521 |
return "usat%?\t%0, %1, %4%S3"; |
| 4522 |
} |
| 4523 |
[(set_attr "predicable" "yes") |
| 4524 |
(set_attr "shift" "3") |
| 4525 |
(set_attr "type" "logic_shift_reg")]) |
| 4526 |
|
| 4527 |
;; Custom Datapath Extension insns. |
| 4528 |
(define_insn "arm_cx1<mode>" |
| 4529 |
[(set (match_operand:SIDI 0 "s_register_operand" "=r") |
| 4530 |
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i") |
| 4531 |
(match_operand:SI 2 "const_int_ccde1_operand" "i")] |
| 4532 |
UNSPEC_CDE))] |
| 4533 |
"TARGET_CDE" |
| 4534 |
"cx1<cde_suffix>\\tp%c1, <cde_dest>, %2" |
| 4535 |
[(set_attr "type" "coproc")] |
| 4536 |
) |
| 4537 |
|
| 4538 |
(define_insn "arm_cx1a<mode>" |
| 4539 |
[(set (match_operand:SIDI 0 "s_register_operand" "=r") |
| 4540 |
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i") |
| 4541 |
(match_operand:SIDI 2 "s_register_operand" "0") |
| 4542 |
(match_operand:SI 3 "const_int_ccde1_operand" "i")] |
| 4543 |
UNSPEC_CDEA))] |
| 4544 |
"TARGET_CDE" |
| 4545 |
"cx1<cde_suffix>a\\tp%c1, <cde_dest>, %3" |
| 4546 |
[(set_attr "type" "coproc")] |
| 4547 |
) |
| 4548 |
|
| 4549 |
(define_insn "arm_cx2<mode>" |
| 4550 |
[(set (match_operand:SIDI 0 "s_register_operand" "=r") |
| 4551 |
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i") |
| 4552 |
(match_operand:SI 2 "s_register_operand" "r") |
| 4553 |
(match_operand:SI 3 "const_int_ccde2_operand" "i")] |
| 4554 |
UNSPEC_CDE))] |
| 4555 |
"TARGET_CDE" |
| 4556 |
"cx2<cde_suffix>\\tp%c1, <cde_dest>, %2, %3" |
| 4557 |
[(set_attr "type" "coproc")] |
| 4558 |
) |
| 4559 |
|
| 4560 |
(define_insn "arm_cx2a<mode>" |
| 4561 |
[(set (match_operand:SIDI 0 "s_register_operand" "=r") |
| 4562 |
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i") |
| 4563 |
(match_operand:SIDI 2 "s_register_operand" "0") |
| 4564 |
(match_operand:SI 3 "s_register_operand" "r") |
| 4565 |
(match_operand:SI 4 "const_int_ccde2_operand" "i")] |
| 4566 |
UNSPEC_CDEA))] |
| 4567 |
"TARGET_CDE" |
| 4568 |
"cx2<cde_suffix>a\\tp%c1, <cde_dest>, %3, %4" |
| 4569 |
[(set_attr "type" "coproc")] |
| 4570 |
) |
| 4571 |
|
| 4572 |
(define_insn "arm_cx3<mode>" |
| 4573 |
[(set (match_operand:SIDI 0 "s_register_operand" "=r") |
| 4574 |
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i") |
| 4575 |
(match_operand:SI 2 "s_register_operand" "r") |
| 4576 |
(match_operand:SI 3 "s_register_operand" "r") |
| 4577 |
(match_operand:SI 4 "const_int_ccde3_operand" "i")] |
| 4578 |
UNSPEC_CDE))] |
| 4579 |
"TARGET_CDE" |
| 4580 |
"cx3<cde_suffix>\\tp%c1, <cde_dest>, %2, %3, %4" |
| 4581 |
[(set_attr "type" "coproc")] |
| 4582 |
) |
| 4583 |
|
| 4584 |
(define_insn "arm_cx3a<mode>" |
| 4585 |
[(set (match_operand:SIDI 0 "s_register_operand" "=r") |
| 4586 |
(unspec:SIDI [(match_operand:SI 1 "const_int_coproc_operand" "i") |
| 4587 |
(match_operand:SIDI 2 "s_register_operand" "0") |
| 4588 |
(match_operand:SI 3 "s_register_operand" "r") |
| 4589 |
(match_operand:SI 4 "s_register_operand" "r") |
| 4590 |
(match_operand:SI 5 "const_int_ccde3_operand" "i")] |
| 4591 |
UNSPEC_CDEA))] |
| 4592 |
"TARGET_CDE" |
| 4593 |
"cx3<cde_suffix>a\\tp%c1, <cde_dest>, %3, %4, %5" |
| 4594 |
[(set_attr "type" "coproc")] |
| 4595 |
) |
| 4596 |
|
| 4597 |
;; Shift and rotation insns |
| 4598 |
|
| 4599 |
(define_expand "ashldi3" |
| 4600 |
[(set (match_operand:DI 0 "s_register_operand") |
| 4601 |
(ashift:DI (match_operand:DI 1 "s_register_operand") |
| 4602 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 4603 |
"TARGET_32BIT" |
| 4604 |
" |
| 4605 |
if (TARGET_HAVE_MVE && !BYTES_BIG_ENDIAN) |
| 4606 |
{ |
| 4607 |
if (!reg_or_int_operand (operands[2], SImode)) |
| 4608 |
operands[2] = force_reg (SImode, operands[2]); |
| 4609 |
|
| 4610 |
/* Armv8.1-M Mainline double shifts are not expanded. */ |
| 4611 |
if (arm_reg_or_long_shift_imm (operands[2], GET_MODE (operands[2])) |
| 4612 |
&& (REG_P (operands[2]) || INTVAL(operands[2]) != 32)) |
| 4613 |
{ |
| 4614 |
operands[2] = convert_modes (QImode, SImode, operands[2], 0); |
| 4615 |
emit_insn (gen_mve_lsll (operands[0], operands[1], operands[2])); |
| 4616 |
DONE; |
| 4617 |
} |
| 4618 |
} |
| 4619 |
|
| 4620 |
arm_emit_coreregs_64bit_shift (ASHIFT, operands[0], operands[1], |
| 4621 |
operands[2], gen_reg_rtx (SImode), |
| 4622 |
gen_reg_rtx (SImode)); |
| 4623 |
DONE; |
| 4624 |
") |
| 4625 |
|
| 4626 |
(define_expand "ashlsi3" |
| 4627 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4628 |
(ashift:SI (match_operand:SI 1 "s_register_operand") |
| 4629 |
(match_operand:SI 2 "arm_rhs_operand")))] |
| 4630 |
"TARGET_EITHER" |
| 4631 |
" |
| 4632 |
if (CONST_INT_P (operands[2]) |
| 4633 |
&& (UINTVAL (operands[2])) > 31) |
| 4634 |
{ |
| 4635 |
emit_insn (gen_movsi (operands[0], const0_rtx)); |
| 4636 |
DONE; |
| 4637 |
} |
| 4638 |
" |
| 4639 |
) |
| 4640 |
|
| 4641 |
(define_expand "ashrdi3" |
| 4642 |
[(set (match_operand:DI 0 "s_register_operand") |
| 4643 |
(ashiftrt:DI (match_operand:DI 1 "s_register_operand") |
| 4644 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 4645 |
"TARGET_32BIT" |
| 4646 |
" |
| 4647 |
/* Armv8.1-M Mainline double shifts are not expanded. */ |
| 4648 |
if (TARGET_HAVE_MVE && !BYTES_BIG_ENDIAN |
| 4649 |
&& arm_reg_or_long_shift_imm (operands[2], GET_MODE (operands[2]))) |
| 4650 |
{ |
| 4651 |
operands[2] = convert_modes (QImode, SImode, operands[2], 0); |
| 4652 |
emit_insn (gen_mve_asrl (operands[0], operands[1], operands[2])); |
| 4653 |
DONE; |
| 4654 |
} |
| 4655 |
|
| 4656 |
arm_emit_coreregs_64bit_shift (ASHIFTRT, operands[0], operands[1], |
| 4657 |
operands[2], gen_reg_rtx (SImode), |
| 4658 |
gen_reg_rtx (SImode)); |
| 4659 |
DONE; |
| 4660 |
") |
| 4661 |
|
| 4662 |
(define_expand "ashrsi3" |
| 4663 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4664 |
(ashiftrt:SI (match_operand:SI 1 "s_register_operand") |
| 4665 |
(match_operand:SI 2 "arm_rhs_operand")))] |
| 4666 |
"TARGET_EITHER" |
| 4667 |
" |
| 4668 |
if (CONST_INT_P (operands[2]) |
| 4669 |
&& UINTVAL (operands[2]) > 31) |
| 4670 |
operands[2] = GEN_INT (31); |
| 4671 |
" |
| 4672 |
) |
| 4673 |
|
| 4674 |
(define_expand "lshrdi3" |
| 4675 |
[(set (match_operand:DI 0 "s_register_operand") |
| 4676 |
(lshiftrt:DI (match_operand:DI 1 "s_register_operand") |
| 4677 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 4678 |
"TARGET_32BIT" |
| 4679 |
" |
| 4680 |
/* Armv8.1-M Mainline double shifts are not expanded. */ |
| 4681 |
if (TARGET_HAVE_MVE && !BYTES_BIG_ENDIAN |
| 4682 |
&& long_shift_imm (operands[2], GET_MODE (operands[2]))) |
| 4683 |
{ |
| 4684 |
emit_insn (gen_mve_lsrl (operands[0], operands[1], operands[2])); |
| 4685 |
DONE; |
| 4686 |
} |
| 4687 |
|
| 4688 |
arm_emit_coreregs_64bit_shift (LSHIFTRT, operands[0], operands[1], |
| 4689 |
operands[2], gen_reg_rtx (SImode), |
| 4690 |
gen_reg_rtx (SImode)); |
| 4691 |
DONE; |
| 4692 |
") |
| 4693 |
|
| 4694 |
(define_expand "lshrsi3" |
| 4695 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4696 |
(lshiftrt:SI (match_operand:SI 1 "s_register_operand") |
| 4697 |
(match_operand:SI 2 "arm_rhs_operand")))] |
| 4698 |
"TARGET_EITHER" |
| 4699 |
" |
| 4700 |
if (CONST_INT_P (operands[2]) |
| 4701 |
&& (UINTVAL (operands[2])) > 31) |
| 4702 |
{ |
| 4703 |
emit_insn (gen_movsi (operands[0], const0_rtx)); |
| 4704 |
DONE; |
| 4705 |
} |
| 4706 |
" |
| 4707 |
) |
| 4708 |
|
| 4709 |
(define_expand "rotlsi3" |
| 4710 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4711 |
(rotatert:SI (match_operand:SI 1 "s_register_operand") |
| 4712 |
(match_operand:SI 2 "reg_or_int_operand")))] |
| 4713 |
"TARGET_32BIT" |
| 4714 |
" |
| 4715 |
if (CONST_INT_P (operands[2])) |
| 4716 |
operands[2] = GEN_INT ((32 - INTVAL (operands[2])) % 32); |
| 4717 |
else |
| 4718 |
{ |
| 4719 |
rtx reg = gen_reg_rtx (SImode); |
| 4720 |
emit_insn (gen_subsi3 (reg, GEN_INT (32), operands[2])); |
| 4721 |
operands[2] = reg; |
| 4722 |
} |
| 4723 |
" |
| 4724 |
) |
| 4725 |
|
| 4726 |
(define_expand "rotrsi3" |
| 4727 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4728 |
(rotatert:SI (match_operand:SI 1 "s_register_operand") |
| 4729 |
(match_operand:SI 2 "arm_rhs_operand")))] |
| 4730 |
"TARGET_EITHER" |
| 4731 |
" |
| 4732 |
if (TARGET_32BIT) |
| 4733 |
{ |
| 4734 |
if (CONST_INT_P (operands[2]) |
| 4735 |
&& UINTVAL (operands[2]) > 31) |
| 4736 |
operands[2] = GEN_INT (INTVAL (operands[2]) % 32); |
| 4737 |
} |
| 4738 |
else /* TARGET_THUMB1 */ |
| 4739 |
{ |
| 4740 |
if (CONST_INT_P (operands [2])) |
| 4741 |
operands [2] = force_reg (SImode, operands[2]); |
| 4742 |
} |
| 4743 |
" |
| 4744 |
) |
| 4745 |
|
| 4746 |
(define_insn "*arm_shiftsi3" |
| 4747 |
[(set (match_operand:SI 0 "s_register_operand" "=l,l,r,r") |
| 4748 |
(match_operator:SI 3 "shift_operator" |
| 4749 |
[(match_operand:SI 1 "s_register_operand" "0,l,r,r") |
| 4750 |
(match_operand:SI 2 "reg_or_int_operand" "l,M,M,r")]))] |
| 4751 |
"TARGET_32BIT" |
| 4752 |
"* return arm_output_shift(operands, 0);" |
| 4753 |
[(set_attr "predicable" "yes") |
| 4754 |
(set_attr "arch" "t2,t2,*,*") |
| 4755 |
(set_attr "predicable_short_it" "yes,yes,no,no") |
| 4756 |
(set_attr "length" "4") |
| 4757 |
(set_attr "shift" "1") |
| 4758 |
(set_attr "autodetect_type" "alu_shift_operator3")] |
| 4759 |
) |
| 4760 |
|
| 4761 |
(define_insn "*shiftsi3_compare0" |
| 4762 |
[(set (reg:CC_NZ CC_REGNUM) |
| 4763 |
(compare:CC_NZ (match_operator:SI 3 "shift_operator" |
| 4764 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 4765 |
(match_operand:SI 2 "arm_rhs_operand" "M,r")]) |
| 4766 |
(const_int 0))) |
| 4767 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 4768 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)]))] |
| 4769 |
"TARGET_32BIT" |
| 4770 |
"* return arm_output_shift(operands, 1);" |
| 4771 |
[(set_attr "conds" "set") |
| 4772 |
(set_attr "shift" "1") |
| 4773 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")] |
| 4774 |
) |
| 4775 |
|
| 4776 |
(define_insn "*shiftsi3_compare0_scratch" |
| 4777 |
[(set (reg:CC_NZ CC_REGNUM) |
| 4778 |
(compare:CC_NZ (match_operator:SI 3 "shift_operator" |
| 4779 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 4780 |
(match_operand:SI 2 "arm_rhs_operand" "M,r")]) |
| 4781 |
(const_int 0))) |
| 4782 |
(clobber (match_scratch:SI 0 "=r,r"))] |
| 4783 |
"TARGET_32BIT" |
| 4784 |
"* return arm_output_shift(operands, 1);" |
| 4785 |
[(set_attr "conds" "set") |
| 4786 |
(set_attr "shift" "1") |
| 4787 |
(set_attr "type" "shift_imm,shift_reg")] |
| 4788 |
) |
| 4789 |
|
| 4790 |
(define_insn "*not_shiftsi" |
| 4791 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 4792 |
(not:SI (match_operator:SI 3 "shift_operator" |
| 4793 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 4794 |
(match_operand:SI 2 "shift_amount_operand" "M,r")])))] |
| 4795 |
"TARGET_32BIT" |
| 4796 |
"mvn%?\\t%0, %1%S3" |
| 4797 |
[(set_attr "predicable" "yes") |
| 4798 |
(set_attr "shift" "1") |
| 4799 |
(set_attr "arch" "32,a") |
| 4800 |
(set_attr "type" "mvn_shift,mvn_shift_reg")]) |
| 4801 |
|
| 4802 |
(define_insn "*not_shiftsi_compare0" |
| 4803 |
[(set (reg:CC_NZ CC_REGNUM) |
| 4804 |
(compare:CC_NZ |
| 4805 |
(not:SI (match_operator:SI 3 "shift_operator" |
| 4806 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 4807 |
(match_operand:SI 2 "shift_amount_operand" "M,r")])) |
| 4808 |
(const_int 0))) |
| 4809 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 4810 |
(not:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])))] |
| 4811 |
"TARGET_32BIT" |
| 4812 |
"mvns%?\\t%0, %1%S3" |
| 4813 |
[(set_attr "conds" "set") |
| 4814 |
(set_attr "shift" "1") |
| 4815 |
(set_attr "arch" "32,a") |
| 4816 |
(set_attr "type" "mvn_shift,mvn_shift_reg")]) |
| 4817 |
|
| 4818 |
(define_insn "*not_shiftsi_compare0_scratch" |
| 4819 |
[(set (reg:CC_NZ CC_REGNUM) |
| 4820 |
(compare:CC_NZ |
| 4821 |
(not:SI (match_operator:SI 3 "shift_operator" |
| 4822 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 4823 |
(match_operand:SI 2 "shift_amount_operand" "M,r")])) |
| 4824 |
(const_int 0))) |
| 4825 |
(clobber (match_scratch:SI 0 "=r,r"))] |
| 4826 |
"TARGET_32BIT" |
| 4827 |
"mvns%?\\t%0, %1%S3" |
| 4828 |
[(set_attr "conds" "set") |
| 4829 |
(set_attr "shift" "1") |
| 4830 |
(set_attr "arch" "32,a") |
| 4831 |
(set_attr "type" "mvn_shift,mvn_shift_reg")]) |
| 4832 |
|
| 4833 |
;; We don't really have extzv, but defining this using shifts helps |
| 4834 |
;; to reduce register pressure later on. |
| 4835 |
|
| 4836 |
(define_expand "extzv" |
| 4837 |
[(set (match_operand 0 "s_register_operand") |
| 4838 |
(zero_extract (match_operand 1 "nonimmediate_operand") |
| 4839 |
(match_operand 2 "const_int_operand") |
| 4840 |
(match_operand 3 "const_int_operand")))] |
| 4841 |
"TARGET_THUMB1 || arm_arch_thumb2" |
| 4842 |
" |
| 4843 |
{ |
| 4844 |
HOST_WIDE_INT lshift = 32 - INTVAL (operands[2]) - INTVAL (operands[3]); |
| 4845 |
HOST_WIDE_INT rshift = 32 - INTVAL (operands[2]); |
| 4846 |
|
| 4847 |
if (arm_arch_thumb2) |
| 4848 |
{ |
| 4849 |
HOST_WIDE_INT width = INTVAL (operands[2]); |
| 4850 |
HOST_WIDE_INT bitpos = INTVAL (operands[3]); |
| 4851 |
|
| 4852 |
if (unaligned_access && MEM_P (operands[1]) |
| 4853 |
&& (width == 16 || width == 32) && (bitpos % BITS_PER_UNIT) == 0) |
| 4854 |
{ |
| 4855 |
rtx base_addr; |
| 4856 |
|
| 4857 |
if (BYTES_BIG_ENDIAN) |
| 4858 |
bitpos = GET_MODE_BITSIZE (GET_MODE (operands[0])) - width |
| 4859 |
- bitpos; |
| 4860 |
|
| 4861 |
if (width == 32) |
| 4862 |
{ |
| 4863 |
base_addr = adjust_address (operands[1], SImode, |
| 4864 |
bitpos / BITS_PER_UNIT); |
| 4865 |
emit_insn (gen_unaligned_loadsi (operands[0], base_addr)); |
| 4866 |
} |
| 4867 |
else |
| 4868 |
{ |
| 4869 |
rtx dest = operands[0]; |
| 4870 |
rtx tmp = gen_reg_rtx (SImode); |
| 4871 |
|
| 4872 |
/* We may get a paradoxical subreg here. Strip it off. */ |
| 4873 |
if (GET_CODE (dest) == SUBREG |
| 4874 |
&& GET_MODE (dest) == SImode |
| 4875 |
&& GET_MODE (SUBREG_REG (dest)) == HImode) |
| 4876 |
dest = SUBREG_REG (dest); |
| 4877 |
|
| 4878 |
if (GET_MODE_BITSIZE (GET_MODE (dest)) != width) |
| 4879 |
FAIL; |
| 4880 |
|
| 4881 |
base_addr = adjust_address (operands[1], HImode, |
| 4882 |
bitpos / BITS_PER_UNIT); |
| 4883 |
emit_insn (gen_unaligned_loadhiu (tmp, base_addr)); |
| 4884 |
emit_move_insn (gen_lowpart (SImode, dest), tmp); |
| 4885 |
} |
| 4886 |
DONE; |
| 4887 |
} |
| 4888 |
else if (s_register_operand (operands[1], GET_MODE (operands[1]))) |
| 4889 |
{ |
| 4890 |
emit_insn (gen_extzv_t2 (operands[0], operands[1], operands[2], |
| 4891 |
operands[3])); |
| 4892 |
DONE; |
| 4893 |
} |
| 4894 |
else |
| 4895 |
FAIL; |
| 4896 |
} |
| 4897 |
|
| 4898 |
if (!s_register_operand (operands[1], GET_MODE (operands[1]))) |
| 4899 |
FAIL; |
| 4900 |
|
| 4901 |
operands[3] = GEN_INT (rshift); |
| 4902 |
|
| 4903 |
if (lshift == 0) |
| 4904 |
{ |
| 4905 |
emit_insn (gen_lshrsi3 (operands[0], operands[1], operands[3])); |
| 4906 |
DONE; |
| 4907 |
} |
| 4908 |
|
| 4909 |
emit_insn (gen_extzv_t1 (operands[0], operands[1], GEN_INT (lshift), |
| 4910 |
operands[3], gen_reg_rtx (SImode))); |
| 4911 |
DONE; |
| 4912 |
}" |
| 4913 |
) |
| 4914 |
|
| 4915 |
;; Helper for extzv, for the Thumb-1 register-shifts case. |
| 4916 |
|
| 4917 |
(define_expand "extzv_t1" |
| 4918 |
[(set (match_operand:SI 4 "s_register_operand") |
| 4919 |
(ashift:SI (match_operand:SI 1 "nonimmediate_operand") |
| 4920 |
(match_operand:SI 2 "const_int_operand"))) |
| 4921 |
(set (match_operand:SI 0 "s_register_operand") |
| 4922 |
(lshiftrt:SI (match_dup 4) |
| 4923 |
(match_operand:SI 3 "const_int_operand")))] |
| 4924 |
"TARGET_THUMB1" |
| 4925 |
"") |
| 4926 |
|
| 4927 |
(define_expand "extv" |
| 4928 |
[(set (match_operand 0 "s_register_operand") |
| 4929 |
(sign_extract (match_operand 1 "nonimmediate_operand") |
| 4930 |
(match_operand 2 "const_int_operand") |
| 4931 |
(match_operand 3 "const_int_operand")))] |
| 4932 |
"arm_arch_thumb2" |
| 4933 |
{ |
| 4934 |
HOST_WIDE_INT width = INTVAL (operands[2]); |
| 4935 |
HOST_WIDE_INT bitpos = INTVAL (operands[3]); |
| 4936 |
|
| 4937 |
if (unaligned_access && MEM_P (operands[1]) && (width == 16 || width == 32) |
| 4938 |
&& (bitpos % BITS_PER_UNIT) == 0) |
| 4939 |
{ |
| 4940 |
rtx base_addr; |
| 4941 |
|
| 4942 |
if (BYTES_BIG_ENDIAN) |
| 4943 |
bitpos = GET_MODE_BITSIZE (GET_MODE (operands[0])) - width - bitpos; |
| 4944 |
|
| 4945 |
if (width == 32) |
| 4946 |
{ |
| 4947 |
base_addr = adjust_address (operands[1], SImode, |
| 4948 |
bitpos / BITS_PER_UNIT); |
| 4949 |
emit_insn (gen_unaligned_loadsi (operands[0], base_addr)); |
| 4950 |
} |
| 4951 |
else |
| 4952 |
{ |
| 4953 |
rtx dest = operands[0]; |
| 4954 |
rtx tmp = gen_reg_rtx (SImode); |
| 4955 |
|
| 4956 |
/* We may get a paradoxical subreg here. Strip it off. */ |
| 4957 |
if (GET_CODE (dest) == SUBREG |
| 4958 |
&& GET_MODE (dest) == SImode |
| 4959 |
&& GET_MODE (SUBREG_REG (dest)) == HImode) |
| 4960 |
dest = SUBREG_REG (dest); |
| 4961 |
|
| 4962 |
if (GET_MODE_BITSIZE (GET_MODE (dest)) != width) |
| 4963 |
FAIL; |
| 4964 |
|
| 4965 |
base_addr = adjust_address (operands[1], HImode, |
| 4966 |
bitpos / BITS_PER_UNIT); |
| 4967 |
emit_insn (gen_unaligned_loadhis (tmp, base_addr)); |
| 4968 |
emit_move_insn (gen_lowpart (SImode, dest), tmp); |
| 4969 |
} |
| 4970 |
|
| 4971 |
DONE; |
| 4972 |
} |
| 4973 |
else if (!s_register_operand (operands[1], GET_MODE (operands[1]))) |
| 4974 |
FAIL; |
| 4975 |
else if (GET_MODE (operands[0]) == SImode |
| 4976 |
&& GET_MODE (operands[1]) == SImode) |
| 4977 |
{ |
| 4978 |
emit_insn (gen_extv_regsi (operands[0], operands[1], operands[2], |
| 4979 |
operands[3])); |
| 4980 |
DONE; |
| 4981 |
} |
| 4982 |
|
| 4983 |
FAIL; |
| 4984 |
}) |
| 4985 |
|
| 4986 |
; Helper to expand register forms of extv with the proper modes. |
| 4987 |
|
| 4988 |
(define_expand "extv_regsi" |
| 4989 |
[(set (match_operand:SI 0 "s_register_operand") |
| 4990 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand") |
| 4991 |
(match_operand 2 "const_int_operand") |
| 4992 |
(match_operand 3 "const_int_operand")))] |
| 4993 |
"" |
| 4994 |
{ |
| 4995 |
}) |
| 4996 |
|
| 4997 |
; ARMv6+ unaligned load/store instructions (used for packed structure accesses). |
| 4998 |
|
| 4999 |
(define_insn "unaligned_loaddi" |
| 5000 |
[(set (match_operand:DI 0 "s_register_operand" "=r") |
| 5001 |
(unspec:DI [(match_operand:DI 1 "memory_operand" "m")] |
| 5002 |
UNSPEC_UNALIGNED_LOAD))] |
| 5003 |
"TARGET_32BIT && TARGET_LDRD" |
| 5004 |
"* |
| 5005 |
return output_move_double (operands, true, NULL); |
| 5006 |
" |
| 5007 |
[(set_attr "length" "8") |
| 5008 |
(set_attr "type" "load_8")]) |
| 5009 |
|
| 5010 |
(define_insn "unaligned_loadsi" |
| 5011 |
[(set (match_operand:SI 0 "s_register_operand" "=l,l,r") |
| 5012 |
(unspec:SI [(match_operand:SI 1 "mem_and_no_t1_wback_op" "Uw,Uw,m")] |
| 5013 |
UNSPEC_UNALIGNED_LOAD))] |
| 5014 |
"unaligned_access" |
| 5015 |
"@ |
| 5016 |
ldr\t%0, %1\t@ unaligned |
| 5017 |
ldr%?\t%0, %1\t@ unaligned |
| 5018 |
ldr%?\t%0, %1\t@ unaligned" |
| 5019 |
[(set_attr "arch" "t1,t2,32") |
| 5020 |
(set_attr "length" "2,2,4") |
| 5021 |
(set_attr "predicable" "no,yes,yes") |
| 5022 |
(set_attr "predicable_short_it" "no,yes,no") |
| 5023 |
(set_attr "type" "load_4")]) |
| 5024 |
|
| 5025 |
;; The 16-bit Thumb1 variant of ldrsh requires two registers in the |
| 5026 |
;; address (there's no immediate format). That's tricky to support |
| 5027 |
;; here and we don't really need this pattern for that case, so only |
| 5028 |
;; enable for 32-bit ISAs. |
| 5029 |
(define_insn "unaligned_loadhis" |
| 5030 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5031 |
(sign_extend:SI |
| 5032 |
(unspec:HI [(match_operand:HI 1 "memory_operand" "Uh")] |
| 5033 |
UNSPEC_UNALIGNED_LOAD)))] |
| 5034 |
"unaligned_access && TARGET_32BIT" |
| 5035 |
"ldrsh%?\t%0, %1\t@ unaligned" |
| 5036 |
[(set_attr "predicable" "yes") |
| 5037 |
(set_attr "type" "load_byte")]) |
| 5038 |
|
| 5039 |
(define_insn "unaligned_loadhiu" |
| 5040 |
[(set (match_operand:SI 0 "s_register_operand" "=l,l,r") |
| 5041 |
(zero_extend:SI |
| 5042 |
(unspec:HI [(match_operand:HI 1 "mem_and_no_t1_wback_op" "Uw,Uw,m")] |
| 5043 |
UNSPEC_UNALIGNED_LOAD)))] |
| 5044 |
"unaligned_access" |
| 5045 |
"@ |
| 5046 |
ldrh\t%0, %1\t@ unaligned |
| 5047 |
ldrh%?\t%0, %1\t@ unaligned |
| 5048 |
ldrh%?\t%0, %1\t@ unaligned" |
| 5049 |
[(set_attr "arch" "t1,t2,32") |
| 5050 |
(set_attr "length" "2,2,4") |
| 5051 |
(set_attr "predicable" "no,yes,yes") |
| 5052 |
(set_attr "predicable_short_it" "no,yes,no") |
| 5053 |
(set_attr "type" "load_byte")]) |
| 5054 |
|
| 5055 |
(define_insn "unaligned_storedi" |
| 5056 |
[(set (match_operand:DI 0 "memory_operand" "=m") |
| 5057 |
(unspec:DI [(match_operand:DI 1 "s_register_operand" "r")] |
| 5058 |
UNSPEC_UNALIGNED_STORE))] |
| 5059 |
"TARGET_32BIT && TARGET_LDRD" |
| 5060 |
"* |
| 5061 |
return output_move_double (operands, true, NULL); |
| 5062 |
" |
| 5063 |
[(set_attr "length" "8") |
| 5064 |
(set_attr "type" "store_8")]) |
| 5065 |
|
| 5066 |
(define_insn "unaligned_storesi" |
| 5067 |
[(set (match_operand:SI 0 "mem_and_no_t1_wback_op" "=Uw,Uw,m") |
| 5068 |
(unspec:SI [(match_operand:SI 1 "s_register_operand" "l,l,r")] |
| 5069 |
UNSPEC_UNALIGNED_STORE))] |
| 5070 |
"unaligned_access" |
| 5071 |
"@ |
| 5072 |
str\t%1, %0\t@ unaligned |
| 5073 |
str%?\t%1, %0\t@ unaligned |
| 5074 |
str%?\t%1, %0\t@ unaligned" |
| 5075 |
[(set_attr "arch" "t1,t2,32") |
| 5076 |
(set_attr "length" "2,2,4") |
| 5077 |
(set_attr "predicable" "no,yes,yes") |
| 5078 |
(set_attr "predicable_short_it" "no,yes,no") |
| 5079 |
(set_attr "type" "store_4")]) |
| 5080 |
|
| 5081 |
(define_insn "unaligned_storehi" |
| 5082 |
[(set (match_operand:HI 0 "mem_and_no_t1_wback_op" "=Uw,Uw,m") |
| 5083 |
(unspec:HI [(match_operand:HI 1 "s_register_operand" "l,l,r")] |
| 5084 |
UNSPEC_UNALIGNED_STORE))] |
| 5085 |
"unaligned_access" |
| 5086 |
"@ |
| 5087 |
strh\t%1, %0\t@ unaligned |
| 5088 |
strh%?\t%1, %0\t@ unaligned |
| 5089 |
strh%?\t%1, %0\t@ unaligned" |
| 5090 |
[(set_attr "arch" "t1,t2,32") |
| 5091 |
(set_attr "length" "2,2,4") |
| 5092 |
(set_attr "predicable" "no,yes,yes") |
| 5093 |
(set_attr "predicable_short_it" "no,yes,no") |
| 5094 |
(set_attr "type" "store_4")]) |
| 5095 |
|
| 5096 |
|
| 5097 |
(define_insn "*extv_reg" |
| 5098 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5099 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 5100 |
(match_operand:SI 2 "const_int_operand" "n") |
| 5101 |
(match_operand:SI 3 "const_int_operand" "n")))] |
| 5102 |
"arm_arch_thumb2 |
| 5103 |
&& IN_RANGE (INTVAL (operands[3]), 0, 31) |
| 5104 |
&& IN_RANGE (INTVAL (operands[2]), 1, 32 - INTVAL (operands[3]))" |
| 5105 |
"sbfx%?\t%0, %1, %3, %2" |
| 5106 |
[(set_attr "length" "4") |
| 5107 |
(set_attr "predicable" "yes") |
| 5108 |
(set_attr "type" "bfm")] |
| 5109 |
) |
| 5110 |
|
| 5111 |
(define_insn "extzv_t2" |
| 5112 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5113 |
(zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 5114 |
(match_operand:SI 2 "const_int_operand" "n") |
| 5115 |
(match_operand:SI 3 "const_int_operand" "n")))] |
| 5116 |
"arm_arch_thumb2 |
| 5117 |
&& IN_RANGE (INTVAL (operands[3]), 0, 31) |
| 5118 |
&& IN_RANGE (INTVAL (operands[2]), 1, 32 - INTVAL (operands[3]))" |
| 5119 |
"ubfx%?\t%0, %1, %3, %2" |
| 5120 |
[(set_attr "length" "4") |
| 5121 |
(set_attr "predicable" "yes") |
| 5122 |
(set_attr "type" "bfm")] |
| 5123 |
) |
| 5124 |
|
| 5125 |
|
| 5126 |
;; Division instructions |
| 5127 |
(define_insn "divsi3" |
| 5128 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5129 |
(div:SI (match_operand:SI 1 "s_register_operand" "r,r") |
| 5130 |
(match_operand:SI 2 "s_register_operand" "r,r")))] |
| 5131 |
"TARGET_IDIV" |
| 5132 |
"@ |
| 5133 |
sdiv%?\t%0, %1, %2 |
| 5134 |
sdiv\t%0, %1, %2" |
| 5135 |
[(set_attr "arch" "32,v8mb") |
| 5136 |
(set_attr "predicable" "yes") |
| 5137 |
(set_attr "type" "sdiv")] |
| 5138 |
) |
| 5139 |
|
| 5140 |
(define_insn "udivsi3" |
| 5141 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5142 |
(udiv:SI (match_operand:SI 1 "s_register_operand" "r,r") |
| 5143 |
(match_operand:SI 2 "s_register_operand" "r,r")))] |
| 5144 |
"TARGET_IDIV" |
| 5145 |
"@ |
| 5146 |
udiv%?\t%0, %1, %2 |
| 5147 |
udiv\t%0, %1, %2" |
| 5148 |
[(set_attr "arch" "32,v8mb") |
| 5149 |
(set_attr "predicable" "yes") |
| 5150 |
(set_attr "type" "udiv")] |
| 5151 |
) |
| 5152 |
|
| 5153 |
|
| 5154 |
;; Unary arithmetic insns |
| 5155 |
|
| 5156 |
(define_expand "negv<SIDI:mode>3" |
| 5157 |
[(match_operand:SIDI 0 "s_register_operand") |
| 5158 |
(match_operand:SIDI 1 "s_register_operand") |
| 5159 |
(match_operand 2 "")] |
| 5160 |
"TARGET_32BIT" |
| 5161 |
{ |
| 5162 |
emit_insn (gen_subv<mode>4 (operands[0], const0_rtx, operands[1], |
| 5163 |
operands[2])); |
| 5164 |
DONE; |
| 5165 |
}) |
| 5166 |
|
| 5167 |
(define_expand "negsi2" |
| 5168 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5169 |
(neg:SI (match_operand:SI 1 "s_register_operand")))] |
| 5170 |
"TARGET_EITHER" |
| 5171 |
"" |
| 5172 |
) |
| 5173 |
|
| 5174 |
(define_insn "*arm_negsi2" |
| 5175 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 5176 |
(neg:SI (match_operand:SI 1 "s_register_operand" "l,r")))] |
| 5177 |
"TARGET_32BIT" |
| 5178 |
"rsb%?\\t%0, %1, #0" |
| 5179 |
[(set_attr "predicable" "yes") |
| 5180 |
(set_attr "predicable_short_it" "yes,no") |
| 5181 |
(set_attr "arch" "t2,*") |
| 5182 |
(set_attr "length" "4") |
| 5183 |
(set_attr "type" "alu_imm")] |
| 5184 |
) |
| 5185 |
|
| 5186 |
;; To keep the comparison in canonical form we express it as (~reg cmp ~0) |
| 5187 |
;; rather than (0 cmp reg). This gives the same results for unsigned |
| 5188 |
;; and equality compares which is what we mostly need here. |
| 5189 |
(define_insn "negsi2_0compare" |
| 5190 |
[(set (reg:CC_RSB CC_REGNUM) |
| 5191 |
(compare:CC_RSB (not:SI (match_operand:SI 1 "s_register_operand" "l,r")) |
| 5192 |
(const_int -1))) |
| 5193 |
(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 5194 |
(neg:SI (match_dup 1)))] |
| 5195 |
"TARGET_32BIT" |
| 5196 |
"@ |
| 5197 |
negs\\t%0, %1 |
| 5198 |
rsbs\\t%0, %1, #0" |
| 5199 |
[(set_attr "conds" "set") |
| 5200 |
(set_attr "arch" "t2,*") |
| 5201 |
(set_attr "length" "2,*") |
| 5202 |
(set_attr "type" "alus_imm")] |
| 5203 |
) |
| 5204 |
|
| 5205 |
(define_insn "negsi2_carryin" |
| 5206 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5207 |
(minus:SI (neg:SI (match_operand:SI 1 "s_register_operand" "r,r")) |
| 5208 |
(match_operand:SI 2 "arm_borrow_operation" "")))] |
| 5209 |
"TARGET_32BIT" |
| 5210 |
"@ |
| 5211 |
rsc\\t%0, %1, #0 |
| 5212 |
sbc\\t%0, %1, %1, lsl #1" |
| 5213 |
[(set_attr "conds" "use") |
| 5214 |
(set_attr "arch" "a,t2") |
| 5215 |
(set_attr "type" "adc_imm,adc_reg")] |
| 5216 |
) |
| 5217 |
|
| 5218 |
(define_expand "negsf2" |
| 5219 |
[(set (match_operand:SF 0 "s_register_operand") |
| 5220 |
(neg:SF (match_operand:SF 1 "s_register_operand")))] |
| 5221 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 5222 |
"" |
| 5223 |
) |
| 5224 |
|
| 5225 |
(define_expand "negdf2" |
| 5226 |
[(set (match_operand:DF 0 "s_register_operand") |
| 5227 |
(neg:DF (match_operand:DF 1 "s_register_operand")))] |
| 5228 |
"TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE" |
| 5229 |
"") |
| 5230 |
|
| 5231 |
;; abssi2 doesn't really clobber the condition codes if a different register |
| 5232 |
;; is being set. To keep things simple, assume during rtl manipulations that |
| 5233 |
;; it does, but tell the final scan operator the truth. Similarly for |
| 5234 |
;; (neg (abs...)) |
| 5235 |
|
| 5236 |
(define_expand "abssi2" |
| 5237 |
[(parallel |
| 5238 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5239 |
(abs:SI (match_operand:SI 1 "s_register_operand"))) |
| 5240 |
(clobber (match_dup 2))])] |
| 5241 |
"TARGET_EITHER" |
| 5242 |
" |
| 5243 |
if (TARGET_THUMB1) |
| 5244 |
operands[2] = gen_rtx_SCRATCH (SImode); |
| 5245 |
else |
| 5246 |
operands[2] = gen_rtx_REG (CCmode, CC_REGNUM); |
| 5247 |
") |
| 5248 |
|
| 5249 |
(define_insn_and_split "*arm_abssi2" |
| 5250 |
[(set (match_operand:SI 0 "s_register_operand" "=r,&r") |
| 5251 |
(abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))) |
| 5252 |
(clobber (reg:CC CC_REGNUM))] |
| 5253 |
"TARGET_ARM" |
| 5254 |
"#" |
| 5255 |
"&& reload_completed" |
| 5256 |
[(const_int 0)] |
| 5257 |
{ |
| 5258 |
/* if (which_alternative == 0) */ |
| 5259 |
if (REGNO(operands[0]) == REGNO(operands[1])) |
| 5260 |
{ |
| 5261 |
/* Emit the pattern: |
| 5262 |
cmp\\t%0, #0\;rsblt\\t%0, %0, #0 |
| 5263 |
[(set (reg:CC CC_REGNUM) |
| 5264 |
(compare:CC (match_dup 0) (const_int 0))) |
| 5265 |
(cond_exec (lt:CC (reg:CC CC_REGNUM) (const_int 0)) |
| 5266 |
(set (match_dup 0) (minus:SI (const_int 0) (match_dup 1))))] |
| 5267 |
*/ |
| 5268 |
emit_insn (gen_rtx_SET (gen_rtx_REG (CCmode, CC_REGNUM), |
| 5269 |
gen_rtx_COMPARE (CCmode, operands[0], const0_rtx))); |
| 5270 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 5271 |
(gen_rtx_LT (SImode, |
| 5272 |
gen_rtx_REG (CCmode, CC_REGNUM), |
| 5273 |
const0_rtx)), |
| 5274 |
(gen_rtx_SET (operands[0], |
| 5275 |
(gen_rtx_MINUS (SImode, |
| 5276 |
const0_rtx, |
| 5277 |
operands[1])))))); |
| 5278 |
DONE; |
| 5279 |
} |
| 5280 |
else |
| 5281 |
{ |
| 5282 |
/* Emit the pattern: |
| 5283 |
alt1: eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31 |
| 5284 |
[(set (match_dup 0) |
| 5285 |
(xor:SI (match_dup 1) |
| 5286 |
(ashiftrt:SI (match_dup 1) (const_int 31)))) |
| 5287 |
(set (match_dup 0) |
| 5288 |
(minus:SI (match_dup 0) |
| 5289 |
(ashiftrt:SI (match_dup 1) (const_int 31))))] |
| 5290 |
*/ |
| 5291 |
emit_insn (gen_rtx_SET (operands[0], |
| 5292 |
gen_rtx_XOR (SImode, |
| 5293 |
gen_rtx_ASHIFTRT (SImode, |
| 5294 |
operands[1], |
| 5295 |
GEN_INT (31)), |
| 5296 |
operands[1]))); |
| 5297 |
emit_insn (gen_rtx_SET (operands[0], |
| 5298 |
gen_rtx_MINUS (SImode, |
| 5299 |
operands[0], |
| 5300 |
gen_rtx_ASHIFTRT (SImode, |
| 5301 |
operands[1], |
| 5302 |
GEN_INT (31))))); |
| 5303 |
DONE; |
| 5304 |
} |
| 5305 |
} |
| 5306 |
[(set_attr "conds" "clob,*") |
| 5307 |
(set_attr "shift" "1") |
| 5308 |
(set_attr "predicable" "no, yes") |
| 5309 |
(set_attr "length" "8") |
| 5310 |
(set_attr "type" "multiple")] |
| 5311 |
) |
| 5312 |
|
| 5313 |
(define_insn_and_split "*arm_neg_abssi2" |
| 5314 |
[(set (match_operand:SI 0 "s_register_operand" "=r,&r") |
| 5315 |
(neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))) |
| 5316 |
(clobber (reg:CC CC_REGNUM))] |
| 5317 |
"TARGET_ARM" |
| 5318 |
"#" |
| 5319 |
"&& reload_completed" |
| 5320 |
[(const_int 0)] |
| 5321 |
{ |
| 5322 |
/* if (which_alternative == 0) */ |
| 5323 |
if (REGNO (operands[0]) == REGNO (operands[1])) |
| 5324 |
{ |
| 5325 |
/* Emit the pattern: |
| 5326 |
cmp\\t%0, #0\;rsbgt\\t%0, %0, #0 |
| 5327 |
*/ |
| 5328 |
emit_insn (gen_rtx_SET (gen_rtx_REG (CCmode, CC_REGNUM), |
| 5329 |
gen_rtx_COMPARE (CCmode, operands[0], const0_rtx))); |
| 5330 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 5331 |
gen_rtx_GT (SImode, |
| 5332 |
gen_rtx_REG (CCmode, CC_REGNUM), |
| 5333 |
const0_rtx), |
| 5334 |
gen_rtx_SET (operands[0], |
| 5335 |
(gen_rtx_MINUS (SImode, |
| 5336 |
const0_rtx, |
| 5337 |
operands[1]))))); |
| 5338 |
} |
| 5339 |
else |
| 5340 |
{ |
| 5341 |
/* Emit the pattern: |
| 5342 |
eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31 |
| 5343 |
*/ |
| 5344 |
emit_insn (gen_rtx_SET (operands[0], |
| 5345 |
gen_rtx_XOR (SImode, |
| 5346 |
gen_rtx_ASHIFTRT (SImode, |
| 5347 |
operands[1], |
| 5348 |
GEN_INT (31)), |
| 5349 |
operands[1]))); |
| 5350 |
emit_insn (gen_rtx_SET (operands[0], |
| 5351 |
gen_rtx_MINUS (SImode, |
| 5352 |
gen_rtx_ASHIFTRT (SImode, |
| 5353 |
operands[1], |
| 5354 |
GEN_INT (31)), |
| 5355 |
operands[0]))); |
| 5356 |
} |
| 5357 |
DONE; |
| 5358 |
} |
| 5359 |
[(set_attr "conds" "clob,*") |
| 5360 |
(set_attr "shift" "1") |
| 5361 |
(set_attr "predicable" "no, yes") |
| 5362 |
(set_attr "length" "8") |
| 5363 |
(set_attr "type" "multiple")] |
| 5364 |
) |
| 5365 |
|
| 5366 |
(define_expand "abssf2" |
| 5367 |
[(set (match_operand:SF 0 "s_register_operand") |
| 5368 |
(abs:SF (match_operand:SF 1 "s_register_operand")))] |
| 5369 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 5370 |
"") |
| 5371 |
|
| 5372 |
(define_expand "absdf2" |
| 5373 |
[(set (match_operand:DF 0 "s_register_operand") |
| 5374 |
(abs:DF (match_operand:DF 1 "s_register_operand")))] |
| 5375 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 5376 |
"") |
| 5377 |
|
| 5378 |
(define_expand "sqrtsf2" |
| 5379 |
[(set (match_operand:SF 0 "s_register_operand") |
| 5380 |
(sqrt:SF (match_operand:SF 1 "s_register_operand")))] |
| 5381 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 5382 |
"") |
| 5383 |
|
| 5384 |
(define_expand "sqrtdf2" |
| 5385 |
[(set (match_operand:DF 0 "s_register_operand") |
| 5386 |
(sqrt:DF (match_operand:DF 1 "s_register_operand")))] |
| 5387 |
"TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE" |
| 5388 |
"") |
| 5389 |
|
| 5390 |
(define_expand "one_cmplsi2" |
| 5391 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5392 |
(not:SI (match_operand:SI 1 "s_register_operand")))] |
| 5393 |
"TARGET_EITHER" |
| 5394 |
"" |
| 5395 |
) |
| 5396 |
|
| 5397 |
(define_insn "*arm_one_cmplsi2" |
| 5398 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 5399 |
(not:SI (match_operand:SI 1 "s_register_operand" "l,r")))] |
| 5400 |
"TARGET_32BIT" |
| 5401 |
"mvn%?\\t%0, %1" |
| 5402 |
[(set_attr "predicable" "yes") |
| 5403 |
(set_attr "predicable_short_it" "yes,no") |
| 5404 |
(set_attr "arch" "t2,*") |
| 5405 |
(set_attr "length" "4") |
| 5406 |
(set_attr "type" "mvn_reg")] |
| 5407 |
) |
| 5408 |
|
| 5409 |
(define_insn "*notsi_compare0" |
| 5410 |
[(set (reg:CC_NZ CC_REGNUM) |
| 5411 |
(compare:CC_NZ (not:SI (match_operand:SI 1 "s_register_operand" "r")) |
| 5412 |
(const_int 0))) |
| 5413 |
(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5414 |
(not:SI (match_dup 1)))] |
| 5415 |
"TARGET_32BIT" |
| 5416 |
"mvns%?\\t%0, %1" |
| 5417 |
[(set_attr "conds" "set") |
| 5418 |
(set_attr "type" "mvn_reg")] |
| 5419 |
) |
| 5420 |
|
| 5421 |
(define_insn "*notsi_compare0_scratch" |
| 5422 |
[(set (reg:CC_NZ CC_REGNUM) |
| 5423 |
(compare:CC_NZ (not:SI (match_operand:SI 1 "s_register_operand" "r")) |
| 5424 |
(const_int 0))) |
| 5425 |
(clobber (match_scratch:SI 0 "=r"))] |
| 5426 |
"TARGET_32BIT" |
| 5427 |
"mvns%?\\t%0, %1" |
| 5428 |
[(set_attr "conds" "set") |
| 5429 |
(set_attr "type" "mvn_reg")] |
| 5430 |
) |
| 5431 |
|
| 5432 |
;; Fixed <--> Floating conversion insns |
| 5433 |
|
| 5434 |
(define_expand "floatsihf2" |
| 5435 |
[(set (match_operand:HF 0 "general_operand") |
| 5436 |
(float:HF (match_operand:SI 1 "general_operand")))] |
| 5437 |
"TARGET_EITHER" |
| 5438 |
" |
| 5439 |
{ |
| 5440 |
rtx op1 = gen_reg_rtx (SFmode); |
| 5441 |
expand_float (op1, operands[1], 0); |
| 5442 |
op1 = convert_to_mode (HFmode, op1, 0); |
| 5443 |
emit_move_insn (operands[0], op1); |
| 5444 |
DONE; |
| 5445 |
}" |
| 5446 |
) |
| 5447 |
|
| 5448 |
(define_expand "floatdihf2" |
| 5449 |
[(set (match_operand:HF 0 "general_operand") |
| 5450 |
(float:HF (match_operand:DI 1 "general_operand")))] |
| 5451 |
"TARGET_EITHER" |
| 5452 |
" |
| 5453 |
{ |
| 5454 |
rtx op1 = gen_reg_rtx (SFmode); |
| 5455 |
expand_float (op1, operands[1], 0); |
| 5456 |
op1 = convert_to_mode (HFmode, op1, 0); |
| 5457 |
emit_move_insn (operands[0], op1); |
| 5458 |
DONE; |
| 5459 |
}" |
| 5460 |
) |
| 5461 |
|
| 5462 |
(define_expand "floatsisf2" |
| 5463 |
[(set (match_operand:SF 0 "s_register_operand") |
| 5464 |
(float:SF (match_operand:SI 1 "s_register_operand")))] |
| 5465 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 5466 |
" |
| 5467 |
") |
| 5468 |
|
| 5469 |
(define_expand "floatsidf2" |
| 5470 |
[(set (match_operand:DF 0 "s_register_operand") |
| 5471 |
(float:DF (match_operand:SI 1 "s_register_operand")))] |
| 5472 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 5473 |
" |
| 5474 |
") |
| 5475 |
|
| 5476 |
(define_expand "fix_trunchfsi2" |
| 5477 |
[(set (match_operand:SI 0 "general_operand") |
| 5478 |
(fix:SI (fix:HF (match_operand:HF 1 "general_operand"))))] |
| 5479 |
"TARGET_EITHER" |
| 5480 |
" |
| 5481 |
{ |
| 5482 |
rtx op1 = convert_to_mode (SFmode, operands[1], 0); |
| 5483 |
expand_fix (operands[0], op1, 0); |
| 5484 |
DONE; |
| 5485 |
}" |
| 5486 |
) |
| 5487 |
|
| 5488 |
(define_expand "fix_trunchfdi2" |
| 5489 |
[(set (match_operand:DI 0 "general_operand") |
| 5490 |
(fix:DI (fix:HF (match_operand:HF 1 "general_operand"))))] |
| 5491 |
"TARGET_EITHER" |
| 5492 |
" |
| 5493 |
{ |
| 5494 |
rtx op1 = convert_to_mode (SFmode, operands[1], 0); |
| 5495 |
expand_fix (operands[0], op1, 0); |
| 5496 |
DONE; |
| 5497 |
}" |
| 5498 |
) |
| 5499 |
|
| 5500 |
(define_expand "fix_truncsfsi2" |
| 5501 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5502 |
(fix:SI (fix:SF (match_operand:SF 1 "s_register_operand"))))] |
| 5503 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 5504 |
" |
| 5505 |
") |
| 5506 |
|
| 5507 |
(define_expand "fix_truncdfsi2" |
| 5508 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5509 |
(fix:SI (fix:DF (match_operand:DF 1 "s_register_operand"))))] |
| 5510 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 5511 |
" |
| 5512 |
") |
| 5513 |
|
| 5514 |
;; Truncation insns |
| 5515 |
|
| 5516 |
(define_expand "truncdfsf2" |
| 5517 |
[(set (match_operand:SF 0 "s_register_operand") |
| 5518 |
(float_truncate:SF |
| 5519 |
(match_operand:DF 1 "s_register_operand")))] |
| 5520 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 5521 |
"" |
| 5522 |
) |
| 5523 |
|
| 5524 |
;; DFmode to HFmode conversions on targets without a single-step hardware |
| 5525 |
;; instruction for it would have to go through SFmode. This is dangerous |
| 5526 |
;; as it introduces double rounding. |
| 5527 |
;; |
| 5528 |
;; Disable this pattern unless we are in an unsafe math mode, or we have |
| 5529 |
;; a single-step instruction. |
| 5530 |
|
| 5531 |
(define_expand "truncdfhf2" |
| 5532 |
[(set (match_operand:HF 0 "s_register_operand") |
| 5533 |
(float_truncate:HF |
| 5534 |
(match_operand:DF 1 "s_register_operand")))] |
| 5535 |
"(TARGET_EITHER && flag_unsafe_math_optimizations) |
| 5536 |
|| (TARGET_32BIT && TARGET_FP16_TO_DOUBLE)" |
| 5537 |
{ |
| 5538 |
/* We don't have a direct instruction for this, so we must be in |
| 5539 |
an unsafe math mode, and going via SFmode. */ |
| 5540 |
|
| 5541 |
if (!(TARGET_32BIT && TARGET_FP16_TO_DOUBLE)) |
| 5542 |
{ |
| 5543 |
rtx op1; |
| 5544 |
op1 = convert_to_mode (SFmode, operands[1], 0); |
| 5545 |
op1 = convert_to_mode (HFmode, op1, 0); |
| 5546 |
emit_move_insn (operands[0], op1); |
| 5547 |
DONE; |
| 5548 |
} |
| 5549 |
/* Otherwise, we will pick this up as a single instruction with |
| 5550 |
no intermediary rounding. */ |
| 5551 |
} |
| 5552 |
) |
| 5553 |
|
| 5554 |
;; Zero and sign extension instructions. |
| 5555 |
|
| 5556 |
(define_expand "zero_extend<mode>di2" |
| 5557 |
[(set (match_operand:DI 0 "s_register_operand" "") |
| 5558 |
(zero_extend:DI (match_operand:QHSI 1 "<qhs_zextenddi_op>" "")))] |
| 5559 |
"TARGET_32BIT <qhs_zextenddi_cond>" |
| 5560 |
{ |
| 5561 |
rtx res_lo, res_hi, op0_lo, op0_hi; |
| 5562 |
res_lo = gen_lowpart (SImode, operands[0]); |
| 5563 |
res_hi = gen_highpart (SImode, operands[0]); |
| 5564 |
if (can_create_pseudo_p ()) |
| 5565 |
{ |
| 5566 |
op0_lo = <MODE>mode == SImode ? operands[1] : gen_reg_rtx (SImode); |
| 5567 |
op0_hi = gen_reg_rtx (SImode); |
| 5568 |
} |
| 5569 |
else |
| 5570 |
{ |
| 5571 |
op0_lo = <MODE>mode == SImode ? operands[1] : res_lo; |
| 5572 |
op0_hi = res_hi; |
| 5573 |
} |
| 5574 |
if (<MODE>mode != SImode) |
| 5575 |
emit_insn (gen_rtx_SET (op0_lo, |
| 5576 |
gen_rtx_ZERO_EXTEND (SImode, operands[1]))); |
| 5577 |
emit_insn (gen_movsi (op0_hi, const0_rtx)); |
| 5578 |
if (res_lo != op0_lo) |
| 5579 |
emit_move_insn (res_lo, op0_lo); |
| 5580 |
if (res_hi != op0_hi) |
| 5581 |
emit_move_insn (res_hi, op0_hi); |
| 5582 |
DONE; |
| 5583 |
} |
| 5584 |
) |
| 5585 |
|
| 5586 |
(define_expand "extend<mode>di2" |
| 5587 |
[(set (match_operand:DI 0 "s_register_operand" "") |
| 5588 |
(sign_extend:DI (match_operand:QHSI 1 "<qhs_extenddi_op>" "")))] |
| 5589 |
"TARGET_32BIT <qhs_sextenddi_cond>" |
| 5590 |
{ |
| 5591 |
rtx res_lo, res_hi, op0_lo, op0_hi; |
| 5592 |
res_lo = gen_lowpart (SImode, operands[0]); |
| 5593 |
res_hi = gen_highpart (SImode, operands[0]); |
| 5594 |
if (can_create_pseudo_p ()) |
| 5595 |
{ |
| 5596 |
op0_lo = <MODE>mode == SImode ? operands[1] : gen_reg_rtx (SImode); |
| 5597 |
op0_hi = gen_reg_rtx (SImode); |
| 5598 |
} |
| 5599 |
else |
| 5600 |
{ |
| 5601 |
op0_lo = <MODE>mode == SImode ? operands[1] : res_lo; |
| 5602 |
op0_hi = res_hi; |
| 5603 |
} |
| 5604 |
if (<MODE>mode != SImode) |
| 5605 |
emit_insn (gen_rtx_SET (op0_lo, |
| 5606 |
gen_rtx_SIGN_EXTEND (SImode, operands[1]))); |
| 5607 |
emit_insn (gen_ashrsi3 (op0_hi, op0_lo, GEN_INT (31))); |
| 5608 |
if (res_lo != op0_lo) |
| 5609 |
emit_move_insn (res_lo, op0_lo); |
| 5610 |
if (res_hi != op0_hi) |
| 5611 |
emit_move_insn (res_hi, op0_hi); |
| 5612 |
DONE; |
| 5613 |
} |
| 5614 |
) |
| 5615 |
|
| 5616 |
;; Splits for all extensions to DImode |
| 5617 |
(define_split |
| 5618 |
[(set (match_operand:DI 0 "s_register_operand" "") |
| 5619 |
(zero_extend:DI (match_operand 1 "nonimmediate_operand" "")))] |
| 5620 |
"TARGET_32BIT" |
| 5621 |
[(set (match_dup 0) (match_dup 1))] |
| 5622 |
{ |
| 5623 |
rtx lo_part = gen_lowpart (SImode, operands[0]); |
| 5624 |
machine_mode src_mode = GET_MODE (operands[1]); |
| 5625 |
|
| 5626 |
if (src_mode == SImode) |
| 5627 |
emit_move_insn (lo_part, operands[1]); |
| 5628 |
else |
| 5629 |
emit_insn (gen_rtx_SET (lo_part, |
| 5630 |
gen_rtx_ZERO_EXTEND (SImode, operands[1]))); |
| 5631 |
operands[0] = gen_highpart (SImode, operands[0]); |
| 5632 |
operands[1] = const0_rtx; |
| 5633 |
}) |
| 5634 |
|
| 5635 |
(define_split |
| 5636 |
[(set (match_operand:DI 0 "s_register_operand" "") |
| 5637 |
(sign_extend:DI (match_operand 1 "nonimmediate_operand" "")))] |
| 5638 |
"TARGET_32BIT" |
| 5639 |
[(set (match_dup 0) (ashiftrt:SI (match_dup 1) (const_int 31)))] |
| 5640 |
{ |
| 5641 |
rtx lo_part = gen_lowpart (SImode, operands[0]); |
| 5642 |
machine_mode src_mode = GET_MODE (operands[1]); |
| 5643 |
|
| 5644 |
if (src_mode == SImode) |
| 5645 |
emit_move_insn (lo_part, operands[1]); |
| 5646 |
else |
| 5647 |
emit_insn (gen_rtx_SET (lo_part, |
| 5648 |
gen_rtx_SIGN_EXTEND (SImode, operands[1]))); |
| 5649 |
operands[1] = lo_part; |
| 5650 |
operands[0] = gen_highpart (SImode, operands[0]); |
| 5651 |
}) |
| 5652 |
|
| 5653 |
(define_expand "zero_extendhisi2" |
| 5654 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5655 |
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand")))] |
| 5656 |
"TARGET_EITHER" |
| 5657 |
{ |
| 5658 |
if (TARGET_ARM && !arm_arch4 && MEM_P (operands[1])) |
| 5659 |
{ |
| 5660 |
emit_insn (gen_movhi_bytes (operands[0], operands[1])); |
| 5661 |
DONE; |
| 5662 |
} |
| 5663 |
if (!arm_arch6 && !MEM_P (operands[1])) |
| 5664 |
{ |
| 5665 |
rtx t = gen_lowpart (SImode, operands[1]); |
| 5666 |
rtx tmp = gen_reg_rtx (SImode); |
| 5667 |
emit_insn (gen_ashlsi3 (tmp, t, GEN_INT (16))); |
| 5668 |
emit_insn (gen_lshrsi3 (operands[0], tmp, GEN_INT (16))); |
| 5669 |
DONE; |
| 5670 |
} |
| 5671 |
}) |
| 5672 |
|
| 5673 |
(define_split |
| 5674 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 5675 |
(zero_extend:SI (match_operand:HI 1 "s_register_operand" "")))] |
| 5676 |
"!TARGET_THUMB2 && !arm_arch6" |
| 5677 |
[(set (match_dup 0) (ashift:SI (match_dup 2) (const_int 16))) |
| 5678 |
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 16)))] |
| 5679 |
{ |
| 5680 |
operands[2] = gen_lowpart (SImode, operands[1]); |
| 5681 |
}) |
| 5682 |
|
| 5683 |
(define_insn "*arm_zero_extendhisi2" |
| 5684 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5685 |
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] |
| 5686 |
"TARGET_ARM && arm_arch4 && !arm_arch6" |
| 5687 |
"@ |
| 5688 |
# |
| 5689 |
ldrh%?\\t%0, %1" |
| 5690 |
[(set_attr "type" "alu_shift_reg,load_byte") |
| 5691 |
(set_attr "predicable" "yes")] |
| 5692 |
) |
| 5693 |
|
| 5694 |
(define_insn "*arm_zero_extendhisi2_v6" |
| 5695 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5696 |
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] |
| 5697 |
"TARGET_ARM && arm_arch6" |
| 5698 |
"@ |
| 5699 |
uxth%?\\t%0, %1 |
| 5700 |
ldrh%?\\t%0, %1" |
| 5701 |
[(set_attr "predicable" "yes") |
| 5702 |
(set_attr "type" "extend,load_byte")] |
| 5703 |
) |
| 5704 |
|
| 5705 |
(define_insn "*arm_zero_extendhisi2addsi" |
| 5706 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5707 |
(plus:SI (zero_extend:SI (match_operand:HI 1 "s_register_operand" "r")) |
| 5708 |
(match_operand:SI 2 "s_register_operand" "r")))] |
| 5709 |
"TARGET_INT_SIMD" |
| 5710 |
"uxtah%?\\t%0, %2, %1" |
| 5711 |
[(set_attr "type" "alu_shift_reg") |
| 5712 |
(set_attr "predicable" "yes")] |
| 5713 |
) |
| 5714 |
|
| 5715 |
(define_expand "zero_extendqisi2" |
| 5716 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5717 |
(zero_extend:SI (match_operand:QI 1 "nonimmediate_operand")))] |
| 5718 |
"TARGET_EITHER" |
| 5719 |
{ |
| 5720 |
if (TARGET_ARM && !arm_arch6 && !MEM_P (operands[1])) |
| 5721 |
{ |
| 5722 |
emit_insn (gen_andsi3 (operands[0], |
| 5723 |
gen_lowpart (SImode, operands[1]), |
| 5724 |
GEN_INT (255))); |
| 5725 |
DONE; |
| 5726 |
} |
| 5727 |
if (!arm_arch6 && !MEM_P (operands[1])) |
| 5728 |
{ |
| 5729 |
rtx t = gen_lowpart (SImode, operands[1]); |
| 5730 |
rtx tmp = gen_reg_rtx (SImode); |
| 5731 |
emit_insn (gen_ashlsi3 (tmp, t, GEN_INT (24))); |
| 5732 |
emit_insn (gen_lshrsi3 (operands[0], tmp, GEN_INT (24))); |
| 5733 |
DONE; |
| 5734 |
} |
| 5735 |
}) |
| 5736 |
|
| 5737 |
(define_split |
| 5738 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 5739 |
(zero_extend:SI (match_operand:QI 1 "s_register_operand" "")))] |
| 5740 |
"!arm_arch6" |
| 5741 |
[(set (match_dup 0) (ashift:SI (match_dup 2) (const_int 24))) |
| 5742 |
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 24)))] |
| 5743 |
{ |
| 5744 |
operands[2] = simplify_gen_subreg (SImode, operands[1], QImode, 0); |
| 5745 |
if (TARGET_ARM) |
| 5746 |
{ |
| 5747 |
emit_insn (gen_andsi3 (operands[0], operands[2], GEN_INT (255))); |
| 5748 |
DONE; |
| 5749 |
} |
| 5750 |
}) |
| 5751 |
|
| 5752 |
(define_insn "*arm_zero_extendqisi2" |
| 5753 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5754 |
(zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] |
| 5755 |
"TARGET_ARM && !arm_arch6" |
| 5756 |
"@ |
| 5757 |
# |
| 5758 |
ldrb%?\\t%0, %1\\t%@ zero_extendqisi2" |
| 5759 |
[(set_attr "length" "8,4") |
| 5760 |
(set_attr "type" "alu_shift_reg,load_byte") |
| 5761 |
(set_attr "predicable" "yes")] |
| 5762 |
) |
| 5763 |
|
| 5764 |
(define_insn "*arm_zero_extendqisi2_v6" |
| 5765 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5766 |
(zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,Uh")))] |
| 5767 |
"TARGET_ARM && arm_arch6" |
| 5768 |
"@ |
| 5769 |
uxtb%?\\t%0, %1 |
| 5770 |
ldrb%?\\t%0, %1\\t%@ zero_extendqisi2" |
| 5771 |
[(set_attr "type" "extend,load_byte") |
| 5772 |
(set_attr "predicable" "yes")] |
| 5773 |
) |
| 5774 |
|
| 5775 |
(define_insn "*arm_zero_extendqisi2addsi" |
| 5776 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5777 |
(plus:SI (zero_extend:SI (match_operand:QI 1 "s_register_operand" "r")) |
| 5778 |
(match_operand:SI 2 "s_register_operand" "r")))] |
| 5779 |
"TARGET_INT_SIMD" |
| 5780 |
"uxtab%?\\t%0, %2, %1" |
| 5781 |
[(set_attr "predicable" "yes") |
| 5782 |
(set_attr "type" "alu_shift_reg")] |
| 5783 |
) |
| 5784 |
|
| 5785 |
(define_split |
| 5786 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 5787 |
(zero_extend:SI (subreg:QI (match_operand:SI 1 "" "") 0))) |
| 5788 |
(clobber (match_operand:SI 2 "s_register_operand" ""))] |
| 5789 |
"TARGET_32BIT && (!MEM_P (operands[1])) && ! BYTES_BIG_ENDIAN" |
| 5790 |
[(set (match_dup 2) (match_dup 1)) |
| 5791 |
(set (match_dup 0) (and:SI (match_dup 2) (const_int 255)))] |
| 5792 |
"" |
| 5793 |
) |
| 5794 |
|
| 5795 |
(define_split |
| 5796 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 5797 |
(zero_extend:SI (subreg:QI (match_operand:SI 1 "" "") 3))) |
| 5798 |
(clobber (match_operand:SI 2 "s_register_operand" ""))] |
| 5799 |
"TARGET_32BIT && (!MEM_P (operands[1])) && BYTES_BIG_ENDIAN" |
| 5800 |
[(set (match_dup 2) (match_dup 1)) |
| 5801 |
(set (match_dup 0) (and:SI (match_dup 2) (const_int 255)))] |
| 5802 |
"" |
| 5803 |
) |
| 5804 |
|
| 5805 |
|
| 5806 |
(define_split |
| 5807 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 5808 |
(IOR_XOR:SI (and:SI (ashift:SI |
| 5809 |
(match_operand:SI 1 "s_register_operand" "") |
| 5810 |
(match_operand:SI 2 "const_int_operand" "")) |
| 5811 |
(match_operand:SI 3 "const_int_operand" "")) |
| 5812 |
(zero_extend:SI |
| 5813 |
(match_operator 5 "subreg_lowpart_operator" |
| 5814 |
[(match_operand:SI 4 "s_register_operand" "")]))))] |
| 5815 |
"TARGET_32BIT |
| 5816 |
&& (UINTVAL (operands[3]) |
| 5817 |
== (GET_MODE_MASK (GET_MODE (operands[5])) |
| 5818 |
& (GET_MODE_MASK (GET_MODE (operands[5])) |
| 5819 |
<< (INTVAL (operands[2])))))" |
| 5820 |
[(set (match_dup 0) (IOR_XOR:SI (ashift:SI (match_dup 1) (match_dup 2)) |
| 5821 |
(match_dup 4))) |
| 5822 |
(set (match_dup 0) (zero_extend:SI (match_dup 5)))] |
| 5823 |
"operands[5] = gen_lowpart (GET_MODE (operands[5]), operands[0]);" |
| 5824 |
) |
| 5825 |
|
| 5826 |
(define_insn "*compareqi_eq0" |
| 5827 |
[(set (reg:CC_Z CC_REGNUM) |
| 5828 |
(compare:CC_Z (match_operand:QI 0 "s_register_operand" "r") |
| 5829 |
(const_int 0)))] |
| 5830 |
"TARGET_32BIT" |
| 5831 |
"tst%?\\t%0, #255" |
| 5832 |
[(set_attr "conds" "set") |
| 5833 |
(set_attr "predicable" "yes") |
| 5834 |
(set_attr "type" "logic_imm")] |
| 5835 |
) |
| 5836 |
|
| 5837 |
(define_expand "extendhisi2" |
| 5838 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5839 |
(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand")))] |
| 5840 |
"TARGET_EITHER" |
| 5841 |
{ |
| 5842 |
if (TARGET_THUMB1) |
| 5843 |
{ |
| 5844 |
emit_insn (gen_thumb1_extendhisi2 (operands[0], operands[1])); |
| 5845 |
DONE; |
| 5846 |
} |
| 5847 |
if (MEM_P (operands[1]) && TARGET_ARM && !arm_arch4) |
| 5848 |
{ |
| 5849 |
emit_insn (gen_extendhisi2_mem (operands[0], operands[1])); |
| 5850 |
DONE; |
| 5851 |
} |
| 5852 |
|
| 5853 |
if (!arm_arch6 && !MEM_P (operands[1])) |
| 5854 |
{ |
| 5855 |
rtx t = gen_lowpart (SImode, operands[1]); |
| 5856 |
rtx tmp = gen_reg_rtx (SImode); |
| 5857 |
emit_insn (gen_ashlsi3 (tmp, t, GEN_INT (16))); |
| 5858 |
emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (16))); |
| 5859 |
DONE; |
| 5860 |
} |
| 5861 |
}) |
| 5862 |
|
| 5863 |
(define_split |
| 5864 |
[(parallel |
| 5865 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5866 |
(sign_extend:SI (match_operand:HI 1 "register_operand" ""))) |
| 5867 |
(clobber (match_scratch:SI 2 ""))])] |
| 5868 |
"!arm_arch6" |
| 5869 |
[(set (match_dup 0) (ashift:SI (match_dup 2) (const_int 16))) |
| 5870 |
(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 16)))] |
| 5871 |
{ |
| 5872 |
operands[2] = simplify_gen_subreg (SImode, operands[1], HImode, 0); |
| 5873 |
}) |
| 5874 |
|
| 5875 |
;; This pattern will only be used when ldsh is not available |
| 5876 |
(define_expand "extendhisi2_mem" |
| 5877 |
[(set (match_dup 2) (zero_extend:SI (match_operand:HI 1 "" ""))) |
| 5878 |
(set (match_dup 3) |
| 5879 |
(zero_extend:SI (match_dup 7))) |
| 5880 |
(set (match_dup 6) (ashift:SI (match_dup 4) (const_int 24))) |
| 5881 |
(set (match_operand:SI 0 "" "") |
| 5882 |
(ior:SI (ashiftrt:SI (match_dup 6) (const_int 16)) (match_dup 5)))] |
| 5883 |
"TARGET_ARM" |
| 5884 |
" |
| 5885 |
{ |
| 5886 |
rtx mem1, mem2; |
| 5887 |
rtx addr = copy_to_mode_reg (SImode, XEXP (operands[1], 0)); |
| 5888 |
|
| 5889 |
mem1 = change_address (operands[1], QImode, addr); |
| 5890 |
mem2 = change_address (operands[1], QImode, |
| 5891 |
plus_constant (Pmode, addr, 1)); |
| 5892 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 5893 |
operands[1] = mem1; |
| 5894 |
operands[2] = gen_reg_rtx (SImode); |
| 5895 |
operands[3] = gen_reg_rtx (SImode); |
| 5896 |
operands[6] = gen_reg_rtx (SImode); |
| 5897 |
operands[7] = mem2; |
| 5898 |
|
| 5899 |
if (BYTES_BIG_ENDIAN) |
| 5900 |
{ |
| 5901 |
operands[4] = operands[2]; |
| 5902 |
operands[5] = operands[3]; |
| 5903 |
} |
| 5904 |
else |
| 5905 |
{ |
| 5906 |
operands[4] = operands[3]; |
| 5907 |
operands[5] = operands[2]; |
| 5908 |
} |
| 5909 |
}" |
| 5910 |
) |
| 5911 |
|
| 5912 |
(define_split |
| 5913 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5914 |
(sign_extend:SI (match_operand:HI 1 "register_operand" "")))] |
| 5915 |
"!arm_arch6" |
| 5916 |
[(set (match_dup 0) (ashift:SI (match_dup 2) (const_int 16))) |
| 5917 |
(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 16)))] |
| 5918 |
{ |
| 5919 |
operands[2] = simplify_gen_subreg (SImode, operands[1], HImode, 0); |
| 5920 |
}) |
| 5921 |
|
| 5922 |
(define_insn "*arm_extendhisi2" |
| 5923 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5924 |
(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] |
| 5925 |
"TARGET_ARM && arm_arch4 && !arm_arch6" |
| 5926 |
"@ |
| 5927 |
# |
| 5928 |
ldrsh%?\\t%0, %1" |
| 5929 |
[(set_attr "length" "8,4") |
| 5930 |
(set_attr "type" "alu_shift_reg,load_byte") |
| 5931 |
(set_attr "predicable" "yes")] |
| 5932 |
) |
| 5933 |
|
| 5934 |
;; ??? Check Thumb-2 pool range |
| 5935 |
(define_insn "*arm_extendhisi2_v6" |
| 5936 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 5937 |
(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] |
| 5938 |
"TARGET_32BIT && arm_arch6" |
| 5939 |
"@ |
| 5940 |
sxth%?\\t%0, %1 |
| 5941 |
ldrsh%?\\t%0, %1" |
| 5942 |
[(set_attr "type" "extend,load_byte") |
| 5943 |
(set_attr "predicable" "yes")] |
| 5944 |
) |
| 5945 |
|
| 5946 |
(define_insn "*arm_extendhisi2addsi" |
| 5947 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 5948 |
(plus:SI (sign_extend:SI (match_operand:HI 1 "s_register_operand" "r")) |
| 5949 |
(match_operand:SI 2 "s_register_operand" "r")))] |
| 5950 |
"TARGET_INT_SIMD" |
| 5951 |
"sxtah%?\\t%0, %2, %1" |
| 5952 |
[(set_attr "type" "alu_shift_reg")] |
| 5953 |
) |
| 5954 |
|
| 5955 |
(define_expand "extendqihi2" |
| 5956 |
[(set (match_dup 2) |
| 5957 |
(ashift:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op") |
| 5958 |
(const_int 24))) |
| 5959 |
(set (match_operand:HI 0 "s_register_operand") |
| 5960 |
(ashiftrt:SI (match_dup 2) |
| 5961 |
(const_int 24)))] |
| 5962 |
"TARGET_ARM" |
| 5963 |
" |
| 5964 |
{ |
| 5965 |
if (arm_arch4 && MEM_P (operands[1])) |
| 5966 |
{ |
| 5967 |
emit_insn (gen_rtx_SET (operands[0], |
| 5968 |
gen_rtx_SIGN_EXTEND (HImode, operands[1]))); |
| 5969 |
DONE; |
| 5970 |
} |
| 5971 |
if (!s_register_operand (operands[1], QImode)) |
| 5972 |
operands[1] = copy_to_mode_reg (QImode, operands[1]); |
| 5973 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 5974 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 5975 |
operands[2] = gen_reg_rtx (SImode); |
| 5976 |
}" |
| 5977 |
) |
| 5978 |
|
| 5979 |
(define_insn "*arm_extendqihi_insn" |
| 5980 |
[(set (match_operand:HI 0 "s_register_operand" "=r") |
| 5981 |
(sign_extend:HI (match_operand:QI 1 "arm_extendqisi_mem_op" "Uq")))] |
| 5982 |
"TARGET_ARM && arm_arch4" |
| 5983 |
"ldrsb%?\\t%0, %1" |
| 5984 |
[(set_attr "type" "load_byte") |
| 5985 |
(set_attr "predicable" "yes")] |
| 5986 |
) |
| 5987 |
|
| 5988 |
(define_expand "extendqisi2" |
| 5989 |
[(set (match_operand:SI 0 "s_register_operand") |
| 5990 |
(sign_extend:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op")))] |
| 5991 |
"TARGET_EITHER" |
| 5992 |
{ |
| 5993 |
if (!arm_arch4 && MEM_P (operands[1])) |
| 5994 |
operands[1] = copy_to_mode_reg (QImode, operands[1]); |
| 5995 |
|
| 5996 |
if (!arm_arch6 && !MEM_P (operands[1])) |
| 5997 |
{ |
| 5998 |
rtx t = gen_lowpart (SImode, operands[1]); |
| 5999 |
rtx tmp = gen_reg_rtx (SImode); |
| 6000 |
emit_insn (gen_ashlsi3 (tmp, t, GEN_INT (24))); |
| 6001 |
emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (24))); |
| 6002 |
DONE; |
| 6003 |
} |
| 6004 |
}) |
| 6005 |
|
| 6006 |
(define_split |
| 6007 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6008 |
(sign_extend:SI (match_operand:QI 1 "register_operand" "")))] |
| 6009 |
"!arm_arch6" |
| 6010 |
[(set (match_dup 0) (ashift:SI (match_dup 2) (const_int 24))) |
| 6011 |
(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 24)))] |
| 6012 |
{ |
| 6013 |
operands[2] = simplify_gen_subreg (SImode, operands[1], QImode, 0); |
| 6014 |
}) |
| 6015 |
|
| 6016 |
(define_insn "*arm_extendqisi" |
| 6017 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 6018 |
(sign_extend:SI (match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "r,Uq")))] |
| 6019 |
"TARGET_ARM && arm_arch4 && !arm_arch6" |
| 6020 |
"@ |
| 6021 |
# |
| 6022 |
ldrsb%?\\t%0, %1" |
| 6023 |
[(set_attr "length" "8,4") |
| 6024 |
(set_attr "type" "alu_shift_reg,load_byte") |
| 6025 |
(set_attr "predicable" "yes")] |
| 6026 |
) |
| 6027 |
|
| 6028 |
(define_insn "*arm_extendqisi_v6" |
| 6029 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 6030 |
(sign_extend:SI |
| 6031 |
(match_operand:QI 1 "arm_reg_or_extendqisi_mem_op" "r,Uq")))] |
| 6032 |
"TARGET_ARM && arm_arch6" |
| 6033 |
"@ |
| 6034 |
sxtb%?\\t%0, %1 |
| 6035 |
ldrsb%?\\t%0, %1" |
| 6036 |
[(set_attr "type" "extend,load_byte") |
| 6037 |
(set_attr "predicable" "yes")] |
| 6038 |
) |
| 6039 |
|
| 6040 |
(define_insn "*arm_extendqisi2addsi" |
| 6041 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6042 |
(plus:SI (sign_extend:SI (match_operand:QI 1 "s_register_operand" "r")) |
| 6043 |
(match_operand:SI 2 "s_register_operand" "r")))] |
| 6044 |
"TARGET_INT_SIMD" |
| 6045 |
"sxtab%?\\t%0, %2, %1" |
| 6046 |
[(set_attr "type" "alu_shift_reg") |
| 6047 |
(set_attr "predicable" "yes")] |
| 6048 |
) |
| 6049 |
|
| 6050 |
(define_insn "arm_<sup>xtb16" |
| 6051 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6052 |
(unspec:SI |
| 6053 |
[(match_operand:SI 1 "s_register_operand" "r")] USXTB16))] |
| 6054 |
"TARGET_INT_SIMD" |
| 6055 |
"<sup>xtb16%?\\t%0, %1" |
| 6056 |
[(set_attr "predicable" "yes") |
| 6057 |
(set_attr "type" "alu_dsp_reg")]) |
| 6058 |
|
| 6059 |
(define_insn "arm_<simd32_op>" |
| 6060 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6061 |
(unspec:SI |
| 6062 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6063 |
(match_operand:SI 2 "s_register_operand" "r")] SIMD32_NOGE_BINOP))] |
| 6064 |
"TARGET_INT_SIMD" |
| 6065 |
"<simd32_op>%?\\t%0, %1, %2" |
| 6066 |
[(set_attr "predicable" "yes") |
| 6067 |
(set_attr "type" "alu_dsp_reg")]) |
| 6068 |
|
| 6069 |
(define_insn "arm_usada8" |
| 6070 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6071 |
(unspec:SI |
| 6072 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6073 |
(match_operand:SI 2 "s_register_operand" "r") |
| 6074 |
(match_operand:SI 3 "s_register_operand" "r")] UNSPEC_USADA8))] |
| 6075 |
"TARGET_INT_SIMD" |
| 6076 |
"usada8%?\\t%0, %1, %2, %3" |
| 6077 |
[(set_attr "predicable" "yes") |
| 6078 |
(set_attr "type" "alu_dsp_reg")]) |
| 6079 |
|
| 6080 |
(define_insn "arm_<simd32_op>" |
| 6081 |
[(set (match_operand:DI 0 "s_register_operand" "=r") |
| 6082 |
(unspec:DI |
| 6083 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6084 |
(match_operand:SI 2 "s_register_operand" "r") |
| 6085 |
(match_operand:DI 3 "s_register_operand" "0")] SIMD32_DIMODE))] |
| 6086 |
"TARGET_INT_SIMD" |
| 6087 |
"<simd32_op>%?\\t%Q0, %R0, %1, %2" |
| 6088 |
[(set_attr "predicable" "yes") |
| 6089 |
(set_attr "type" "smlald")]) |
| 6090 |
|
| 6091 |
(define_insn "arm_<simd32_op>" |
| 6092 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6093 |
(unspec:SI |
| 6094 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6095 |
(match_operand:SI 2 "s_register_operand" "r")] SIMD32_GE)) |
| 6096 |
(set (reg:CC APSRGE_REGNUM) |
| 6097 |
(unspec:CC [(reg:CC APSRGE_REGNUM)] UNSPEC_GE_SET))] |
| 6098 |
"TARGET_INT_SIMD" |
| 6099 |
"<simd32_op>%?\\t%0, %1, %2" |
| 6100 |
[(set_attr "predicable" "yes") |
| 6101 |
(set_attr "type" "alu_sreg")]) |
| 6102 |
|
| 6103 |
(define_insn "arm_<simd32_op><add_clobber_q_name>_insn" |
| 6104 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6105 |
(unspec:SI |
| 6106 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6107 |
(match_operand:SI 2 "s_register_operand" "r") |
| 6108 |
(match_operand:SI 3 "s_register_operand" "r")] SIMD32_TERNOP_Q))] |
| 6109 |
"TARGET_INT_SIMD && <add_clobber_q_pred>" |
| 6110 |
"<simd32_op>%?\\t%0, %1, %2, %3" |
| 6111 |
[(set_attr "predicable" "yes") |
| 6112 |
(set_attr "type" "alu_sreg")]) |
| 6113 |
|
| 6114 |
(define_expand "arm_<simd32_op>" |
| 6115 |
[(set (match_operand:SI 0 "s_register_operand") |
| 6116 |
(unspec:SI |
| 6117 |
[(match_operand:SI 1 "s_register_operand") |
| 6118 |
(match_operand:SI 2 "s_register_operand") |
| 6119 |
(match_operand:SI 3 "s_register_operand")] SIMD32_TERNOP_Q))] |
| 6120 |
"TARGET_INT_SIMD" |
| 6121 |
{ |
| 6122 |
if (ARM_Q_BIT_READ) |
| 6123 |
emit_insn (gen_arm_<simd32_op>_setq_insn (operands[0], operands[1], |
| 6124 |
operands[2], operands[3])); |
| 6125 |
else |
| 6126 |
emit_insn (gen_arm_<simd32_op>_insn (operands[0], operands[1], |
| 6127 |
operands[2], operands[3])); |
| 6128 |
DONE; |
| 6129 |
} |
| 6130 |
) |
| 6131 |
|
| 6132 |
(define_insn "arm_<simd32_op><add_clobber_q_name>_insn" |
| 6133 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6134 |
(unspec:SI |
| 6135 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6136 |
(match_operand:SI 2 "s_register_operand" "r")] SIMD32_BINOP_Q))] |
| 6137 |
"TARGET_INT_SIMD && <add_clobber_q_pred>" |
| 6138 |
"<simd32_op>%?\\t%0, %1, %2" |
| 6139 |
[(set_attr "predicable" "yes") |
| 6140 |
(set_attr "type" "alu_sreg")]) |
| 6141 |
|
| 6142 |
(define_expand "arm_<simd32_op>" |
| 6143 |
[(set (match_operand:SI 0 "s_register_operand") |
| 6144 |
(unspec:SI |
| 6145 |
[(match_operand:SI 1 "s_register_operand") |
| 6146 |
(match_operand:SI 2 "s_register_operand")] SIMD32_BINOP_Q))] |
| 6147 |
"TARGET_INT_SIMD" |
| 6148 |
{ |
| 6149 |
if (ARM_Q_BIT_READ) |
| 6150 |
emit_insn (gen_arm_<simd32_op>_setq_insn (operands[0], operands[1], |
| 6151 |
operands[2])); |
| 6152 |
else |
| 6153 |
emit_insn (gen_arm_<simd32_op>_insn (operands[0], operands[1], |
| 6154 |
operands[2])); |
| 6155 |
DONE; |
| 6156 |
} |
| 6157 |
) |
| 6158 |
|
| 6159 |
(define_insn "arm_<simd32_op><add_clobber_q_name>_insn" |
| 6160 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6161 |
(unspec:SI |
| 6162 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6163 |
(match_operand:SI 2 "<sup>sat16_imm" "i")] USSAT16))] |
| 6164 |
"TARGET_INT_SIMD && <add_clobber_q_pred>" |
| 6165 |
"<simd32_op>%?\\t%0, %2, %1" |
| 6166 |
[(set_attr "predicable" "yes") |
| 6167 |
(set_attr "type" "alu_sreg")]) |
| 6168 |
|
| 6169 |
(define_expand "arm_<simd32_op>" |
| 6170 |
[(set (match_operand:SI 0 "s_register_operand") |
| 6171 |
(unspec:SI |
| 6172 |
[(match_operand:SI 1 "s_register_operand") |
| 6173 |
(match_operand:SI 2 "<sup>sat16_imm")] USSAT16))] |
| 6174 |
"TARGET_INT_SIMD" |
| 6175 |
{ |
| 6176 |
if (ARM_Q_BIT_READ) |
| 6177 |
emit_insn (gen_arm_<simd32_op>_setq_insn (operands[0], operands[1], |
| 6178 |
operands[2])); |
| 6179 |
else |
| 6180 |
emit_insn (gen_arm_<simd32_op>_insn (operands[0], operands[1], |
| 6181 |
operands[2])); |
| 6182 |
DONE; |
| 6183 |
} |
| 6184 |
) |
| 6185 |
|
| 6186 |
(define_insn "arm_sel" |
| 6187 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6188 |
(unspec:SI |
| 6189 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 6190 |
(match_operand:SI 2 "s_register_operand" "r") |
| 6191 |
(reg:CC APSRGE_REGNUM)] UNSPEC_SEL))] |
| 6192 |
"TARGET_INT_SIMD" |
| 6193 |
"sel%?\\t%0, %1, %2" |
| 6194 |
[(set_attr "predicable" "yes") |
| 6195 |
(set_attr "type" "alu_sreg")]) |
| 6196 |
|
| 6197 |
(define_expand "extendsfdf2" |
| 6198 |
[(set (match_operand:DF 0 "s_register_operand") |
| 6199 |
(float_extend:DF (match_operand:SF 1 "s_register_operand")))] |
| 6200 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 6201 |
"" |
| 6202 |
) |
| 6203 |
|
| 6204 |
;; HFmode -> DFmode conversions where we don't have an instruction for it |
| 6205 |
;; must go through SFmode. |
| 6206 |
;; |
| 6207 |
;; This is always safe for an extend. |
| 6208 |
|
| 6209 |
(define_expand "extendhfdf2" |
| 6210 |
[(set (match_operand:DF 0 "s_register_operand") |
| 6211 |
(float_extend:DF (match_operand:HF 1 "s_register_operand")))] |
| 6212 |
"TARGET_EITHER" |
| 6213 |
{ |
| 6214 |
/* We don't have a direct instruction for this, so go via SFmode. */ |
| 6215 |
if (!(TARGET_32BIT && TARGET_FP16_TO_DOUBLE)) |
| 6216 |
{ |
| 6217 |
rtx op1; |
| 6218 |
op1 = convert_to_mode (SFmode, operands[1], 0); |
| 6219 |
op1 = convert_to_mode (DFmode, op1, 0); |
| 6220 |
emit_insn (gen_movdf (operands[0], op1)); |
| 6221 |
DONE; |
| 6222 |
} |
| 6223 |
/* Otherwise, we're done producing RTL and will pick up the correct |
| 6224 |
pattern to do this with one rounding-step in a single instruction. */ |
| 6225 |
} |
| 6226 |
) |
| 6227 |
|
| 6228 |
;; Move insns (including loads and stores) |
| 6229 |
|
| 6230 |
;; XXX Just some ideas about movti. |
| 6231 |
;; I don't think these are a good idea on the arm, there just aren't enough |
| 6232 |
;; registers |
| 6233 |
;;(define_expand "loadti" |
| 6234 |
;; [(set (match_operand:TI 0 "s_register_operand") |
| 6235 |
;; (mem:TI (match_operand:SI 1 "address_operand")))] |
| 6236 |
;; "" "") |
| 6237 |
|
| 6238 |
;;(define_expand "storeti" |
| 6239 |
;; [(set (mem:TI (match_operand:TI 0 "address_operand")) |
| 6240 |
;; (match_operand:TI 1 "s_register_operand"))] |
| 6241 |
;; "" "") |
| 6242 |
|
| 6243 |
;;(define_expand "movti" |
| 6244 |
;; [(set (match_operand:TI 0 "general_operand") |
| 6245 |
;; (match_operand:TI 1 "general_operand"))] |
| 6246 |
;; "" |
| 6247 |
;; " |
| 6248 |
;;{ |
| 6249 |
;; rtx insn; |
| 6250 |
;; |
| 6251 |
;; if (MEM_P (operands[0]) && MEM_P (operands[1])) |
| 6252 |
;; operands[1] = copy_to_reg (operands[1]); |
| 6253 |
;; if (MEM_P (operands[0])) |
| 6254 |
;; insn = gen_storeti (XEXP (operands[0], 0), operands[1]); |
| 6255 |
;; else if (MEM_P (operands[1])) |
| 6256 |
;; insn = gen_loadti (operands[0], XEXP (operands[1], 0)); |
| 6257 |
;; else |
| 6258 |
;; FAIL; |
| 6259 |
;; |
| 6260 |
;; emit_insn (insn); |
| 6261 |
;; DONE; |
| 6262 |
;;}") |
| 6263 |
|
| 6264 |
;; Recognize garbage generated above. |
| 6265 |
|
| 6266 |
;;(define_insn "" |
| 6267 |
;; [(set (match_operand:TI 0 "general_operand" "=r,r,r,<,>,m") |
| 6268 |
;; (match_operand:TI 1 "general_operand" "<,>,m,r,r,r"))] |
| 6269 |
;; "" |
| 6270 |
;; "* |
| 6271 |
;; { |
| 6272 |
;; register mem = (which_alternative < 3); |
| 6273 |
;; register const char *template; |
| 6274 |
;; |
| 6275 |
;; operands[mem] = XEXP (operands[mem], 0); |
| 6276 |
;; switch (which_alternative) |
| 6277 |
;; { |
| 6278 |
;; case 0: template = \"ldmdb\\t%1!, %M0\"; break; |
| 6279 |
;; case 1: template = \"ldmia\\t%1!, %M0\"; break; |
| 6280 |
;; case 2: template = \"ldmia\\t%1, %M0\"; break; |
| 6281 |
;; case 3: template = \"stmdb\\t%0!, %M1\"; break; |
| 6282 |
;; case 4: template = \"stmia\\t%0!, %M1\"; break; |
| 6283 |
;; case 5: template = \"stmia\\t%0, %M1\"; break; |
| 6284 |
;; } |
| 6285 |
;; output_asm_insn (template, operands); |
| 6286 |
;; return \"\"; |
| 6287 |
;; }") |
| 6288 |
|
| 6289 |
(define_expand "movdi" |
| 6290 |
[(set (match_operand:DI 0 "general_operand") |
| 6291 |
(match_operand:DI 1 "general_operand"))] |
| 6292 |
"TARGET_EITHER" |
| 6293 |
" |
| 6294 |
gcc_checking_assert (aligned_operand (operands[0], DImode)); |
| 6295 |
gcc_checking_assert (aligned_operand (operands[1], DImode)); |
| 6296 |
if (can_create_pseudo_p ()) |
| 6297 |
{ |
| 6298 |
if (!REG_P (operands[0])) |
| 6299 |
operands[1] = force_reg (DImode, operands[1]); |
| 6300 |
} |
| 6301 |
if (REG_P (operands[0]) && REGNO (operands[0]) <= LAST_ARM_REGNUM |
| 6302 |
&& !targetm.hard_regno_mode_ok (REGNO (operands[0]), DImode)) |
| 6303 |
{ |
| 6304 |
/* Avoid LDRD's into an odd-numbered register pair in ARM state |
| 6305 |
when expanding function calls. */ |
| 6306 |
gcc_assert (can_create_pseudo_p ()); |
| 6307 |
if (MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1])) |
| 6308 |
{ |
| 6309 |
/* Perform load into legal reg pair first, then move. */ |
| 6310 |
rtx reg = gen_reg_rtx (DImode); |
| 6311 |
emit_insn (gen_movdi (reg, operands[1])); |
| 6312 |
operands[1] = reg; |
| 6313 |
} |
| 6314 |
emit_move_insn (gen_lowpart (SImode, operands[0]), |
| 6315 |
gen_lowpart (SImode, operands[1])); |
| 6316 |
emit_move_insn (gen_highpart (SImode, operands[0]), |
| 6317 |
gen_highpart (SImode, operands[1])); |
| 6318 |
DONE; |
| 6319 |
} |
| 6320 |
else if (REG_P (operands[1]) && REGNO (operands[1]) <= LAST_ARM_REGNUM |
| 6321 |
&& !targetm.hard_regno_mode_ok (REGNO (operands[1]), DImode)) |
| 6322 |
{ |
| 6323 |
/* Avoid STRD's from an odd-numbered register pair in ARM state |
| 6324 |
when expanding function prologue. */ |
| 6325 |
gcc_assert (can_create_pseudo_p ()); |
| 6326 |
rtx split_dest = (MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0])) |
| 6327 |
? gen_reg_rtx (DImode) |
| 6328 |
: operands[0]; |
| 6329 |
emit_move_insn (gen_lowpart (SImode, split_dest), |
| 6330 |
gen_lowpart (SImode, operands[1])); |
| 6331 |
emit_move_insn (gen_highpart (SImode, split_dest), |
| 6332 |
gen_highpart (SImode, operands[1])); |
| 6333 |
if (split_dest != operands[0]) |
| 6334 |
emit_insn (gen_movdi (operands[0], split_dest)); |
| 6335 |
DONE; |
| 6336 |
} |
| 6337 |
" |
| 6338 |
) |
| 6339 |
|
| 6340 |
(define_insn "*arm_movdi" |
| 6341 |
[(set (match_operand:DI 0 "nonimmediate_di_operand" "=r, r, r, r, m") |
| 6342 |
(match_operand:DI 1 "di_operand" "rDa,Db,Dc,mi,r"))] |
| 6343 |
"TARGET_32BIT |
| 6344 |
&& !(TARGET_HARD_FLOAT) |
| 6345 |
&& !(TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT) |
| 6346 |
&& !TARGET_IWMMXT |
| 6347 |
&& ( register_operand (operands[0], DImode) |
| 6348 |
|| register_operand (operands[1], DImode))" |
| 6349 |
"* |
| 6350 |
switch (which_alternative) |
| 6351 |
{ |
| 6352 |
case 0: |
| 6353 |
case 1: |
| 6354 |
case 2: |
| 6355 |
return \"#\"; |
| 6356 |
case 3: |
| 6357 |
/* Cannot load it directly, split to load it via MOV / MOVT. */ |
| 6358 |
if (!MEM_P (operands[1]) && arm_disable_literal_pool) |
| 6359 |
return \"#\"; |
| 6360 |
/* Fall through. */ |
| 6361 |
default: |
| 6362 |
return output_move_double (operands, true, NULL); |
| 6363 |
} |
| 6364 |
" |
| 6365 |
[(set_attr "length" "8,12,16,8,8") |
| 6366 |
(set_attr "type" "multiple,multiple,multiple,load_8,store_8") |
| 6367 |
(set_attr "arm_pool_range" "*,*,*,1020,*") |
| 6368 |
(set_attr "arm_neg_pool_range" "*,*,*,1004,*") |
| 6369 |
(set_attr "thumb2_pool_range" "*,*,*,4094,*") |
| 6370 |
(set_attr "thumb2_neg_pool_range" "*,*,*,0,*")] |
| 6371 |
) |
| 6372 |
|
| 6373 |
(define_split |
| 6374 |
[(set (match_operand:ANY64 0 "arm_general_register_operand" "") |
| 6375 |
(match_operand:ANY64 1 "immediate_operand" ""))] |
| 6376 |
"TARGET_32BIT |
| 6377 |
&& reload_completed |
| 6378 |
&& (arm_disable_literal_pool |
| 6379 |
|| (arm_const_double_inline_cost (operands[1]) |
| 6380 |
<= arm_max_const_double_inline_cost ()))" |
| 6381 |
[(const_int 0)] |
| 6382 |
" |
| 6383 |
arm_split_constant (SET, SImode, curr_insn, |
| 6384 |
INTVAL (gen_lowpart (SImode, operands[1])), |
| 6385 |
gen_lowpart (SImode, operands[0]), NULL_RTX, 0); |
| 6386 |
arm_split_constant (SET, SImode, curr_insn, |
| 6387 |
INTVAL (gen_highpart_mode (SImode, |
| 6388 |
GET_MODE (operands[0]), |
| 6389 |
operands[1])), |
| 6390 |
gen_highpart (SImode, operands[0]), NULL_RTX, 0); |
| 6391 |
DONE; |
| 6392 |
" |
| 6393 |
) |
| 6394 |
|
| 6395 |
; If optimizing for size, or if we have load delay slots, then |
| 6396 |
; we want to split the constant into two separate operations. |
| 6397 |
; In both cases this may split a trivial part into a single data op |
| 6398 |
; leaving a single complex constant to load. We can also get longer |
| 6399 |
; offsets in a LDR which means we get better chances of sharing the pool |
| 6400 |
; entries. Finally, we can normally do a better job of scheduling |
| 6401 |
; LDR instructions than we can with LDM. |
| 6402 |
; This pattern will only match if the one above did not. |
| 6403 |
(define_split |
| 6404 |
[(set (match_operand:ANY64 0 "arm_general_register_operand" "") |
| 6405 |
(match_operand:ANY64 1 "const_double_operand" ""))] |
| 6406 |
"TARGET_ARM && reload_completed |
| 6407 |
&& arm_const_double_by_parts (operands[1])" |
| 6408 |
[(set (match_dup 0) (match_dup 1)) |
| 6409 |
(set (match_dup 2) (match_dup 3))] |
| 6410 |
" |
| 6411 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 6412 |
operands[3] = gen_highpart_mode (SImode, GET_MODE (operands[0]), |
| 6413 |
operands[1]); |
| 6414 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 6415 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 6416 |
" |
| 6417 |
) |
| 6418 |
|
| 6419 |
(define_split |
| 6420 |
[(set (match_operand:ANY64_BF 0 "arm_general_register_operand" "") |
| 6421 |
(match_operand:ANY64_BF 1 "arm_general_register_operand" ""))] |
| 6422 |
"TARGET_EITHER && reload_completed" |
| 6423 |
[(set (match_dup 0) (match_dup 1)) |
| 6424 |
(set (match_dup 2) (match_dup 3))] |
| 6425 |
" |
| 6426 |
operands[2] = gen_highpart (SImode, operands[0]); |
| 6427 |
operands[3] = gen_highpart (SImode, operands[1]); |
| 6428 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 6429 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 6430 |
|
| 6431 |
/* Handle a partial overlap. */ |
| 6432 |
if (rtx_equal_p (operands[0], operands[3])) |
| 6433 |
{ |
| 6434 |
rtx tmp0 = operands[0]; |
| 6435 |
rtx tmp1 = operands[1]; |
| 6436 |
|
| 6437 |
operands[0] = operands[2]; |
| 6438 |
operands[1] = operands[3]; |
| 6439 |
operands[2] = tmp0; |
| 6440 |
operands[3] = tmp1; |
| 6441 |
} |
| 6442 |
" |
| 6443 |
) |
| 6444 |
|
| 6445 |
;; We can't actually do base+index doubleword loads if the index and |
| 6446 |
;; destination overlap. Split here so that we at least have chance to |
| 6447 |
;; schedule. |
| 6448 |
(define_split |
| 6449 |
[(set (match_operand:DI 0 "s_register_operand" "") |
| 6450 |
(mem:DI (plus:SI (match_operand:SI 1 "s_register_operand" "") |
| 6451 |
(match_operand:SI 2 "s_register_operand" ""))))] |
| 6452 |
"TARGET_LDRD |
| 6453 |
&& reg_overlap_mentioned_p (operands[0], operands[1]) |
| 6454 |
&& reg_overlap_mentioned_p (operands[0], operands[2])" |
| 6455 |
[(set (match_dup 4) |
| 6456 |
(plus:SI (match_dup 1) |
| 6457 |
(match_dup 2))) |
| 6458 |
(set (match_dup 0) |
| 6459 |
(mem:DI (match_dup 4)))] |
| 6460 |
" |
| 6461 |
operands[4] = gen_rtx_REG (SImode, REGNO(operands[0])); |
| 6462 |
" |
| 6463 |
) |
| 6464 |
|
| 6465 |
(define_expand "movsi" |
| 6466 |
[(set (match_operand:SI 0 "general_operand") |
| 6467 |
(match_operand:SI 1 "general_operand"))] |
| 6468 |
"TARGET_EITHER" |
| 6469 |
" |
| 6470 |
{ |
| 6471 |
rtx base, offset, tmp; |
| 6472 |
|
| 6473 |
gcc_checking_assert (aligned_operand (operands[0], SImode)); |
| 6474 |
gcc_checking_assert (aligned_operand (operands[1], SImode)); |
| 6475 |
if (TARGET_32BIT || TARGET_HAVE_MOVT) |
| 6476 |
{ |
| 6477 |
/* Everything except mem = const or mem = mem can be done easily. */ |
| 6478 |
if (MEM_P (operands[0])) |
| 6479 |
operands[1] = force_reg (SImode, operands[1]); |
| 6480 |
if (arm_general_register_operand (operands[0], SImode) |
| 6481 |
&& CONST_INT_P (operands[1]) |
| 6482 |
&& !(const_ok_for_arm (INTVAL (operands[1])) |
| 6483 |
|| const_ok_for_arm (~INTVAL (operands[1])))) |
| 6484 |
{ |
| 6485 |
if (DONT_EARLY_SPLIT_CONSTANT (INTVAL (operands[1]), SET)) |
| 6486 |
{ |
| 6487 |
emit_insn (gen_rtx_SET (operands[0], operands[1])); |
| 6488 |
DONE; |
| 6489 |
} |
| 6490 |
else |
| 6491 |
{ |
| 6492 |
arm_split_constant (SET, SImode, NULL_RTX, |
| 6493 |
INTVAL (operands[1]), operands[0], NULL_RTX, |
| 6494 |
optimize && can_create_pseudo_p ()); |
| 6495 |
DONE; |
| 6496 |
} |
| 6497 |
} |
| 6498 |
} |
| 6499 |
else /* Target doesn't have MOVT... */ |
| 6500 |
{ |
| 6501 |
if (can_create_pseudo_p ()) |
| 6502 |
{ |
| 6503 |
if (!REG_P (operands[0])) |
| 6504 |
operands[1] = force_reg (SImode, operands[1]); |
| 6505 |
} |
| 6506 |
} |
| 6507 |
|
| 6508 |
split_const (operands[1], &base, &offset); |
| 6509 |
if (INTVAL (offset) != 0 |
| 6510 |
&& targetm.cannot_force_const_mem (SImode, operands[1])) |
| 6511 |
{ |
| 6512 |
tmp = can_create_pseudo_p () ? gen_reg_rtx (SImode) : operands[0]; |
| 6513 |
emit_move_insn (tmp, base); |
| 6514 |
emit_insn (gen_addsi3 (operands[0], tmp, offset)); |
| 6515 |
DONE; |
| 6516 |
} |
| 6517 |
|
| 6518 |
tmp = can_create_pseudo_p () ? NULL_RTX : operands[0]; |
| 6519 |
|
| 6520 |
/* Recognize the case where operand[1] is a reference to thread-local |
| 6521 |
data and load its address to a register. Offsets have been split off |
| 6522 |
already. */ |
| 6523 |
if (arm_tls_referenced_p (operands[1])) |
| 6524 |
operands[1] = legitimize_tls_address (operands[1], tmp); |
| 6525 |
else if (flag_pic |
| 6526 |
&& (CONSTANT_P (operands[1]) |
| 6527 |
|| symbol_mentioned_p (operands[1]) |
| 6528 |
|| label_mentioned_p (operands[1]))) |
| 6529 |
operands[1] = |
| 6530 |
legitimize_pic_address (operands[1], SImode, tmp, NULL_RTX, false); |
| 6531 |
} |
| 6532 |
" |
| 6533 |
) |
| 6534 |
|
| 6535 |
;; The ARM LO_SUM and HIGH are backwards - HIGH sets the low bits, and |
| 6536 |
;; LO_SUM adds in the high bits. Fortunately these are opaque operations |
| 6537 |
;; so this does not matter. |
| 6538 |
(define_insn "*arm_movt" |
| 6539 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r") |
| 6540 |
(lo_sum:SI (match_operand:SI 1 "nonimmediate_operand" "0,0") |
| 6541 |
(match_operand:SI 2 "general_operand" "i,i")))] |
| 6542 |
"TARGET_HAVE_MOVT && arm_valid_symbolic_address_p (operands[2])" |
| 6543 |
"@ |
| 6544 |
movt%?\t%0, #:upper16:%c2 |
| 6545 |
movt\t%0, #:upper16:%c2" |
| 6546 |
[(set_attr "arch" "32,v8mb") |
| 6547 |
(set_attr "predicable" "yes") |
| 6548 |
(set_attr "length" "4") |
| 6549 |
(set_attr "type" "alu_sreg")] |
| 6550 |
) |
| 6551 |
|
| 6552 |
(define_insn "*arm_movsi_insn" |
| 6553 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=rk,r,r,r,rk,m") |
| 6554 |
(match_operand:SI 1 "general_operand" "rk, I,K,j,mi,rk"))] |
| 6555 |
"TARGET_ARM && !TARGET_IWMMXT && !TARGET_HARD_FLOAT |
| 6556 |
&& ( register_operand (operands[0], SImode) |
| 6557 |
|| register_operand (operands[1], SImode))" |
| 6558 |
"@ |
| 6559 |
mov%?\\t%0, %1 |
| 6560 |
mov%?\\t%0, %1 |
| 6561 |
mvn%?\\t%0, #%B1 |
| 6562 |
movw%?\\t%0, %1 |
| 6563 |
ldr%?\\t%0, %1 |
| 6564 |
str%?\\t%1, %0" |
| 6565 |
[(set_attr "type" "mov_reg,mov_imm,mvn_imm,mov_imm,load_4,store_4") |
| 6566 |
(set_attr "predicable" "yes") |
| 6567 |
(set_attr "arch" "*,*,*,v6t2,*,*") |
| 6568 |
(set_attr "pool_range" "*,*,*,*,4096,*") |
| 6569 |
(set_attr "neg_pool_range" "*,*,*,*,4084,*")] |
| 6570 |
) |
| 6571 |
|
| 6572 |
(define_split |
| 6573 |
[(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 6574 |
(match_operand:SI 1 "const_int_operand" ""))] |
| 6575 |
"(TARGET_32BIT || TARGET_HAVE_MOVT) |
| 6576 |
&& (!(const_ok_for_arm (INTVAL (operands[1])) |
| 6577 |
|| const_ok_for_arm (~INTVAL (operands[1]))))" |
| 6578 |
[(clobber (const_int 0))] |
| 6579 |
" |
| 6580 |
arm_split_constant (SET, SImode, NULL_RTX, |
| 6581 |
INTVAL (operands[1]), operands[0], NULL_RTX, 0); |
| 6582 |
DONE; |
| 6583 |
" |
| 6584 |
) |
| 6585 |
|
| 6586 |
;; A normal way to do (symbol + offset) requires three instructions at least |
| 6587 |
;; (depends on how big the offset is) as below: |
| 6588 |
;; movw r0, #:lower16:g |
| 6589 |
;; movw r0, #:upper16:g |
| 6590 |
;; adds r0, #4 |
| 6591 |
;; |
| 6592 |
;; A better way would be: |
| 6593 |
;; movw r0, #:lower16:g+4 |
| 6594 |
;; movw r0, #:upper16:g+4 |
| 6595 |
;; |
| 6596 |
;; The limitation of this way is that the length of offset should be a 16-bit |
| 6597 |
;; signed value, because current assembler only supports REL type relocation for |
| 6598 |
;; such case. If the more powerful RELA type is supported in future, we should |
| 6599 |
;; update this pattern to go with better way. |
| 6600 |
(define_split |
| 6601 |
[(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 6602 |
(const:SI (plus:SI (match_operand:SI 1 "general_operand" "") |
| 6603 |
(match_operand:SI 2 "const_int_operand" ""))))] |
| 6604 |
"TARGET_THUMB |
| 6605 |
&& TARGET_HAVE_MOVT |
| 6606 |
&& arm_disable_literal_pool |
| 6607 |
&& reload_completed |
| 6608 |
&& GET_CODE (operands[1]) == SYMBOL_REF" |
| 6609 |
[(clobber (const_int 0))] |
| 6610 |
" |
| 6611 |
int offset = INTVAL (operands[2]); |
| 6612 |
|
| 6613 |
if (offset < -0x8000 || offset > 0x7fff) |
| 6614 |
{ |
| 6615 |
arm_emit_movpair (operands[0], operands[1]); |
| 6616 |
emit_insn (gen_rtx_SET (operands[0], |
| 6617 |
gen_rtx_PLUS (SImode, operands[0], operands[2]))); |
| 6618 |
} |
| 6619 |
else |
| 6620 |
{ |
| 6621 |
rtx op = gen_rtx_CONST (SImode, |
| 6622 |
gen_rtx_PLUS (SImode, operands[1], operands[2])); |
| 6623 |
arm_emit_movpair (operands[0], op); |
| 6624 |
} |
| 6625 |
" |
| 6626 |
) |
| 6627 |
|
| 6628 |
;; Split symbol_refs at the later stage (after cprop), instead of generating |
| 6629 |
;; movt/movw pair directly at expand. Otherwise corresponding high_sum |
| 6630 |
;; and lo_sum would be merged back into memory load at cprop. However, |
| 6631 |
;; if the default is to prefer movt/movw rather than a load from the constant |
| 6632 |
;; pool, the performance is better. |
| 6633 |
(define_split |
| 6634 |
[(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 6635 |
(match_operand:SI 1 "general_operand" ""))] |
| 6636 |
"TARGET_USE_MOVT && GET_CODE (operands[1]) == SYMBOL_REF |
| 6637 |
&& !target_word_relocations |
| 6638 |
&& !arm_tls_referenced_p (operands[1])" |
| 6639 |
[(clobber (const_int 0))] |
| 6640 |
{ |
| 6641 |
arm_emit_movpair (operands[0], operands[1]); |
| 6642 |
DONE; |
| 6643 |
}) |
| 6644 |
|
| 6645 |
;; When generating pic, we need to load the symbol offset into a register. |
| 6646 |
;; So that the optimizer does not confuse this with a normal symbol load |
| 6647 |
;; we use an unspec. The offset will be loaded from a constant pool entry, |
| 6648 |
;; since that is the only type of relocation we can use. |
| 6649 |
|
| 6650 |
;; Wrap calculation of the whole PIC address in a single pattern for the |
| 6651 |
;; benefit of optimizers, particularly, PRE and HOIST. Calculation of |
| 6652 |
;; a PIC address involves two loads from memory, so we want to CSE it |
| 6653 |
;; as often as possible. |
| 6654 |
;; This pattern will be split into one of the pic_load_addr_* patterns |
| 6655 |
;; and a move after GCSE optimizations. |
| 6656 |
;; |
| 6657 |
;; Note: Update arm.cc: legitimize_pic_address() when changing this pattern. |
| 6658 |
(define_expand "calculate_pic_address" |
| 6659 |
[(set (match_operand:SI 0 "register_operand") |
| 6660 |
(mem:SI (plus:SI (match_operand:SI 1 "register_operand") |
| 6661 |
(unspec:SI [(match_operand:SI 2 "" "")] |
| 6662 |
UNSPEC_PIC_SYM))))] |
| 6663 |
"flag_pic" |
| 6664 |
) |
| 6665 |
|
| 6666 |
;; Split calculate_pic_address into pic_load_addr_* and a move. |
| 6667 |
(define_split |
| 6668 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6669 |
(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "") |
| 6670 |
(unspec:SI [(match_operand:SI 2 "" "")] |
| 6671 |
UNSPEC_PIC_SYM))))] |
| 6672 |
"flag_pic" |
| 6673 |
[(set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_PIC_SYM)) |
| 6674 |
(set (match_dup 0) (mem:SI (plus:SI (match_dup 1) (match_dup 3))))] |
| 6675 |
"operands[3] = can_create_pseudo_p () ? gen_reg_rtx (SImode) : operands[0];" |
| 6676 |
) |
| 6677 |
|
| 6678 |
;; operand1 is the memory address to go into |
| 6679 |
;; pic_load_addr_32bit. |
| 6680 |
;; operand2 is the PIC label to be emitted |
| 6681 |
;; from pic_add_dot_plus_eight. |
| 6682 |
;; We do this to allow hoisting of the entire insn. |
| 6683 |
(define_insn_and_split "pic_load_addr_unified" |
| 6684 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,l") |
| 6685 |
(unspec:SI [(match_operand:SI 1 "" "mX,mX,mX") |
| 6686 |
(match_operand:SI 2 "" "")] |
| 6687 |
UNSPEC_PIC_UNIFIED))] |
| 6688 |
"flag_pic" |
| 6689 |
"#" |
| 6690 |
"&& reload_completed" |
| 6691 |
[(set (match_dup 0) (unspec:SI [(match_dup 1)] UNSPEC_PIC_SYM)) |
| 6692 |
(set (match_dup 0) (unspec:SI [(match_dup 0) (match_dup 3) |
| 6693 |
(match_dup 2)] UNSPEC_PIC_BASE))] |
| 6694 |
"operands[3] = TARGET_THUMB ? GEN_INT (4) : GEN_INT (8);" |
| 6695 |
[(set_attr "type" "load_4,load_4,load_4") |
| 6696 |
(set_attr "pool_range" "4096,4094,1022") |
| 6697 |
(set_attr "neg_pool_range" "4084,0,0") |
| 6698 |
(set_attr "arch" "a,t2,t1") |
| 6699 |
(set_attr "length" "8,6,4")] |
| 6700 |
) |
| 6701 |
|
| 6702 |
;; The rather odd constraints on the following are to force reload to leave |
| 6703 |
;; the insn alone, and to force the minipool generation pass to then move |
| 6704 |
;; the GOT symbol to memory. |
| 6705 |
|
| 6706 |
(define_insn "pic_load_addr_32bit" |
| 6707 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 6708 |
(unspec:SI [(match_operand:SI 1 "" "mX")] UNSPEC_PIC_SYM))] |
| 6709 |
"TARGET_32BIT && flag_pic" |
| 6710 |
"ldr%?\\t%0, %1" |
| 6711 |
[(set_attr "type" "load_4") |
| 6712 |
(set (attr "pool_range") |
| 6713 |
(if_then_else (eq_attr "is_thumb" "no") |
| 6714 |
(const_int 4096) |
| 6715 |
(const_int 4094))) |
| 6716 |
(set (attr "neg_pool_range") |
| 6717 |
(if_then_else (eq_attr "is_thumb" "no") |
| 6718 |
(const_int 4084) |
| 6719 |
(const_int 0)))] |
| 6720 |
) |
| 6721 |
|
| 6722 |
(define_insn "pic_load_addr_thumb1" |
| 6723 |
[(set (match_operand:SI 0 "s_register_operand" "=l") |
| 6724 |
(unspec:SI [(match_operand:SI 1 "" "mX")] UNSPEC_PIC_SYM))] |
| 6725 |
"TARGET_THUMB1 && flag_pic" |
| 6726 |
"ldr\\t%0, %1" |
| 6727 |
[(set_attr "type" "load_4") |
| 6728 |
(set (attr "pool_range") (const_int 1018))] |
| 6729 |
) |
| 6730 |
|
| 6731 |
(define_insn "pic_add_dot_plus_four" |
| 6732 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6733 |
(unspec:SI [(match_operand:SI 1 "register_operand" "0") |
| 6734 |
(const_int 4) |
| 6735 |
(match_operand 2 "" "")] |
| 6736 |
UNSPEC_PIC_BASE))] |
| 6737 |
"TARGET_THUMB" |
| 6738 |
"* |
| 6739 |
(*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\", |
| 6740 |
INTVAL (operands[2])); |
| 6741 |
return \"add\\t%0, %|pc\"; |
| 6742 |
" |
| 6743 |
[(set_attr "length" "2") |
| 6744 |
(set_attr "type" "alu_sreg")] |
| 6745 |
) |
| 6746 |
|
| 6747 |
(define_insn "pic_add_dot_plus_eight" |
| 6748 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6749 |
(unspec:SI [(match_operand:SI 1 "register_operand" "r") |
| 6750 |
(const_int 8) |
| 6751 |
(match_operand 2 "" "")] |
| 6752 |
UNSPEC_PIC_BASE))] |
| 6753 |
"TARGET_ARM" |
| 6754 |
"* |
| 6755 |
(*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\", |
| 6756 |
INTVAL (operands[2])); |
| 6757 |
return \"add%?\\t%0, %|pc, %1\"; |
| 6758 |
" |
| 6759 |
[(set_attr "predicable" "yes") |
| 6760 |
(set_attr "type" "alu_sreg")] |
| 6761 |
) |
| 6762 |
|
| 6763 |
(define_insn "tls_load_dot_plus_eight" |
| 6764 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6765 |
(mem:SI (unspec:SI [(match_operand:SI 1 "register_operand" "r") |
| 6766 |
(const_int 8) |
| 6767 |
(match_operand 2 "" "")] |
| 6768 |
UNSPEC_PIC_BASE)))] |
| 6769 |
"TARGET_ARM" |
| 6770 |
"* |
| 6771 |
(*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\", |
| 6772 |
INTVAL (operands[2])); |
| 6773 |
return \"ldr%?\\t%0, [%|pc, %1]\t\t@ tls_load_dot_plus_eight\"; |
| 6774 |
" |
| 6775 |
[(set_attr "predicable" "yes") |
| 6776 |
(set_attr "type" "load_4")] |
| 6777 |
) |
| 6778 |
|
| 6779 |
;; PIC references to local variables can generate pic_add_dot_plus_eight |
| 6780 |
;; followed by a load. These sequences can be crunched down to |
| 6781 |
;; tls_load_dot_plus_eight by a peephole. |
| 6782 |
|
| 6783 |
(define_peephole2 |
| 6784 |
[(set (match_operand:SI 0 "register_operand" "") |
| 6785 |
(unspec:SI [(match_operand:SI 3 "register_operand" "") |
| 6786 |
(const_int 8) |
| 6787 |
(match_operand 1 "" "")] |
| 6788 |
UNSPEC_PIC_BASE)) |
| 6789 |
(set (match_operand:SI 2 "arm_general_register_operand" "") |
| 6790 |
(mem:SI (match_dup 0)))] |
| 6791 |
"TARGET_ARM && peep2_reg_dead_p (2, operands[0])" |
| 6792 |
[(set (match_dup 2) |
| 6793 |
(mem:SI (unspec:SI [(match_dup 3) |
| 6794 |
(const_int 8) |
| 6795 |
(match_dup 1)] |
| 6796 |
UNSPEC_PIC_BASE)))] |
| 6797 |
"" |
| 6798 |
) |
| 6799 |
|
| 6800 |
(define_insn "pic_offset_arm" |
| 6801 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6802 |
(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r") |
| 6803 |
(unspec:SI [(match_operand:SI 2 "" "X")] |
| 6804 |
UNSPEC_PIC_OFFSET))))] |
| 6805 |
"TARGET_VXWORKS_RTP && TARGET_ARM && flag_pic" |
| 6806 |
"ldr%?\\t%0, [%1,%2]" |
| 6807 |
[(set_attr "type" "load_4")] |
| 6808 |
) |
| 6809 |
|
| 6810 |
(define_expand "builtin_setjmp_receiver" |
| 6811 |
[(label_ref (match_operand 0 "" ""))] |
| 6812 |
"flag_pic" |
| 6813 |
" |
| 6814 |
{ |
| 6815 |
/* r3 is clobbered by set/longjmp, so we can use it as a scratch |
| 6816 |
register. */ |
| 6817 |
if (arm_pic_register != INVALID_REGNUM) |
| 6818 |
arm_load_pic_register (1UL << 3, NULL_RTX); |
| 6819 |
DONE; |
| 6820 |
}") |
| 6821 |
|
| 6822 |
;; If copying one reg to another we can set the condition codes according to |
| 6823 |
;; its value. Such a move is common after a return from subroutine and the |
| 6824 |
;; result is being tested against zero. |
| 6825 |
|
| 6826 |
(define_insn "*movsi_compare0" |
| 6827 |
[(set (reg:CC CC_REGNUM) |
| 6828 |
(compare:CC (match_operand:SI 1 "s_register_operand" "0,0,l,rk,rk") |
| 6829 |
(const_int 0))) |
| 6830 |
(set (match_operand:SI 0 "s_register_operand" "=l,rk,l,r,rk") |
| 6831 |
(match_dup 1))] |
| 6832 |
"TARGET_32BIT" |
| 6833 |
"@ |
| 6834 |
cmp%?\\t%0, #0 |
| 6835 |
cmp%?\\t%0, #0 |
| 6836 |
subs%?\\t%0, %1, #0 |
| 6837 |
subs%?\\t%0, %1, #0 |
| 6838 |
subs%?\\t%0, %1, #0" |
| 6839 |
[(set_attr "conds" "set") |
| 6840 |
(set_attr "arch" "t2,*,t2,t2,a") |
| 6841 |
(set_attr "type" "alus_imm") |
| 6842 |
(set_attr "length" "2,4,2,4,4")] |
| 6843 |
) |
| 6844 |
|
| 6845 |
;; Subroutine to store a half word from a register into memory. |
| 6846 |
;; Operand 0 is the source register (HImode) |
| 6847 |
;; Operand 1 is the destination address in a register (SImode) |
| 6848 |
|
| 6849 |
;; In both this routine and the next, we must be careful not to spill |
| 6850 |
;; a memory address of reg+large_const into a separate PLUS insn, since this |
| 6851 |
;; can generate unrecognizable rtl. |
| 6852 |
|
| 6853 |
(define_expand "storehi" |
| 6854 |
[;; store the low byte |
| 6855 |
(set (match_operand 1 "" "") (match_dup 3)) |
| 6856 |
;; extract the high byte |
| 6857 |
(set (match_dup 2) |
| 6858 |
(ashiftrt:SI (match_operand 0 "" "") (const_int 8))) |
| 6859 |
;; store the high byte |
| 6860 |
(set (match_dup 4) (match_dup 5))] |
| 6861 |
"TARGET_ARM" |
| 6862 |
" |
| 6863 |
{ |
| 6864 |
rtx op1 = operands[1]; |
| 6865 |
rtx addr = XEXP (op1, 0); |
| 6866 |
enum rtx_code code = GET_CODE (addr); |
| 6867 |
|
| 6868 |
if ((code == PLUS && !CONST_INT_P (XEXP (addr, 1))) |
| 6869 |
|| code == MINUS) |
| 6870 |
op1 = replace_equiv_address (operands[1], force_reg (SImode, addr)); |
| 6871 |
|
| 6872 |
operands[4] = adjust_address (op1, QImode, 1); |
| 6873 |
operands[1] = adjust_address (operands[1], QImode, 0); |
| 6874 |
operands[3] = gen_lowpart (QImode, operands[0]); |
| 6875 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 6876 |
operands[2] = gen_reg_rtx (SImode); |
| 6877 |
operands[5] = gen_lowpart (QImode, operands[2]); |
| 6878 |
}" |
| 6879 |
) |
| 6880 |
|
| 6881 |
(define_expand "storehi_bigend" |
| 6882 |
[(set (match_dup 4) (match_dup 3)) |
| 6883 |
(set (match_dup 2) |
| 6884 |
(ashiftrt:SI (match_operand 0 "" "") (const_int 8))) |
| 6885 |
(set (match_operand 1 "" "") (match_dup 5))] |
| 6886 |
"TARGET_ARM" |
| 6887 |
" |
| 6888 |
{ |
| 6889 |
rtx op1 = operands[1]; |
| 6890 |
rtx addr = XEXP (op1, 0); |
| 6891 |
enum rtx_code code = GET_CODE (addr); |
| 6892 |
|
| 6893 |
if ((code == PLUS && !CONST_INT_P (XEXP (addr, 1))) |
| 6894 |
|| code == MINUS) |
| 6895 |
op1 = replace_equiv_address (op1, force_reg (SImode, addr)); |
| 6896 |
|
| 6897 |
operands[4] = adjust_address (op1, QImode, 1); |
| 6898 |
operands[1] = adjust_address (operands[1], QImode, 0); |
| 6899 |
operands[3] = gen_lowpart (QImode, operands[0]); |
| 6900 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 6901 |
operands[2] = gen_reg_rtx (SImode); |
| 6902 |
operands[5] = gen_lowpart (QImode, operands[2]); |
| 6903 |
}" |
| 6904 |
) |
| 6905 |
|
| 6906 |
;; Subroutine to store a half word integer constant into memory. |
| 6907 |
(define_expand "storeinthi" |
| 6908 |
[(set (match_operand 0 "" "") |
| 6909 |
(match_operand 1 "" "")) |
| 6910 |
(set (match_dup 3) (match_dup 2))] |
| 6911 |
"TARGET_ARM" |
| 6912 |
" |
| 6913 |
{ |
| 6914 |
HOST_WIDE_INT value = INTVAL (operands[1]); |
| 6915 |
rtx addr = XEXP (operands[0], 0); |
| 6916 |
rtx op0 = operands[0]; |
| 6917 |
enum rtx_code code = GET_CODE (addr); |
| 6918 |
|
| 6919 |
if ((code == PLUS && !CONST_INT_P (XEXP (addr, 1))) |
| 6920 |
|| code == MINUS) |
| 6921 |
op0 = replace_equiv_address (op0, force_reg (SImode, addr)); |
| 6922 |
|
| 6923 |
operands[1] = gen_reg_rtx (SImode); |
| 6924 |
if (BYTES_BIG_ENDIAN) |
| 6925 |
{ |
| 6926 |
emit_insn (gen_movsi (operands[1], GEN_INT ((value >> 8) & 255))); |
| 6927 |
if ((value & 255) == ((value >> 8) & 255)) |
| 6928 |
operands[2] = operands[1]; |
| 6929 |
else |
| 6930 |
{ |
| 6931 |
operands[2] = gen_reg_rtx (SImode); |
| 6932 |
emit_insn (gen_movsi (operands[2], GEN_INT (value & 255))); |
| 6933 |
} |
| 6934 |
} |
| 6935 |
else |
| 6936 |
{ |
| 6937 |
emit_insn (gen_movsi (operands[1], GEN_INT (value & 255))); |
| 6938 |
if ((value & 255) == ((value >> 8) & 255)) |
| 6939 |
operands[2] = operands[1]; |
| 6940 |
else |
| 6941 |
{ |
| 6942 |
operands[2] = gen_reg_rtx (SImode); |
| 6943 |
emit_insn (gen_movsi (operands[2], GEN_INT ((value >> 8) & 255))); |
| 6944 |
} |
| 6945 |
} |
| 6946 |
|
| 6947 |
operands[3] = adjust_address (op0, QImode, 1); |
| 6948 |
operands[0] = adjust_address (operands[0], QImode, 0); |
| 6949 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 6950 |
operands[1] = gen_lowpart (QImode, operands[1]); |
| 6951 |
}" |
| 6952 |
) |
| 6953 |
|
| 6954 |
(define_expand "storehi_single_op" |
| 6955 |
[(set (match_operand:HI 0 "memory_operand") |
| 6956 |
(match_operand:HI 1 "general_operand"))] |
| 6957 |
"TARGET_32BIT && arm_arch4" |
| 6958 |
" |
| 6959 |
if (!s_register_operand (operands[1], HImode)) |
| 6960 |
operands[1] = copy_to_mode_reg (HImode, operands[1]); |
| 6961 |
" |
| 6962 |
) |
| 6963 |
|
| 6964 |
(define_expand "movhi" |
| 6965 |
[(set (match_operand:HI 0 "general_operand") |
| 6966 |
(match_operand:HI 1 "general_operand"))] |
| 6967 |
"TARGET_EITHER" |
| 6968 |
" |
| 6969 |
gcc_checking_assert (aligned_operand (operands[0], HImode)); |
| 6970 |
gcc_checking_assert (aligned_operand (operands[1], HImode)); |
| 6971 |
if (TARGET_ARM) |
| 6972 |
{ |
| 6973 |
if (can_create_pseudo_p ()) |
| 6974 |
{ |
| 6975 |
if (MEM_P (operands[0])) |
| 6976 |
{ |
| 6977 |
if (arm_arch4) |
| 6978 |
{ |
| 6979 |
emit_insn (gen_storehi_single_op (operands[0], operands[1])); |
| 6980 |
DONE; |
| 6981 |
} |
| 6982 |
if (CONST_INT_P (operands[1])) |
| 6983 |
emit_insn (gen_storeinthi (operands[0], operands[1])); |
| 6984 |
else |
| 6985 |
{ |
| 6986 |
if (MEM_P (operands[1])) |
| 6987 |
operands[1] = force_reg (HImode, operands[1]); |
| 6988 |
if (BYTES_BIG_ENDIAN) |
| 6989 |
emit_insn (gen_storehi_bigend (operands[1], operands[0])); |
| 6990 |
else |
| 6991 |
emit_insn (gen_storehi (operands[1], operands[0])); |
| 6992 |
} |
| 6993 |
DONE; |
| 6994 |
} |
| 6995 |
/* Sign extend a constant, and keep it in an SImode reg. */ |
| 6996 |
else if (CONST_INT_P (operands[1])) |
| 6997 |
{ |
| 6998 |
rtx reg = gen_reg_rtx (SImode); |
| 6999 |
HOST_WIDE_INT val = INTVAL (operands[1]) & 0xffff; |
| 7000 |
|
| 7001 |
/* If the constant is already valid, leave it alone. */ |
| 7002 |
if (!const_ok_for_arm (val)) |
| 7003 |
{ |
| 7004 |
/* If setting all the top bits will make the constant |
| 7005 |
loadable in a single instruction, then set them. |
| 7006 |
Otherwise, sign extend the number. */ |
| 7007 |
|
| 7008 |
if (const_ok_for_arm (~(val | ~0xffff))) |
| 7009 |
val |= ~0xffff; |
| 7010 |
else if (val & 0x8000) |
| 7011 |
val |= ~0xffff; |
| 7012 |
} |
| 7013 |
|
| 7014 |
emit_insn (gen_movsi (reg, GEN_INT (val))); |
| 7015 |
operands[1] = gen_lowpart (HImode, reg); |
| 7016 |
} |
| 7017 |
else if (arm_arch4 && optimize && can_create_pseudo_p () |
| 7018 |
&& MEM_P (operands[1])) |
| 7019 |
{ |
| 7020 |
rtx reg = gen_reg_rtx (SImode); |
| 7021 |
|
| 7022 |
emit_insn (gen_zero_extendhisi2 (reg, operands[1])); |
| 7023 |
operands[1] = gen_lowpart (HImode, reg); |
| 7024 |
} |
| 7025 |
else if (!arm_arch4) |
| 7026 |
{ |
| 7027 |
if (MEM_P (operands[1])) |
| 7028 |
{ |
| 7029 |
rtx base; |
| 7030 |
rtx offset = const0_rtx; |
| 7031 |
rtx reg = gen_reg_rtx (SImode); |
| 7032 |
|
| 7033 |
if ((REG_P (base = XEXP (operands[1], 0)) |
| 7034 |
|| (GET_CODE (base) == PLUS |
| 7035 |
&& (CONST_INT_P (offset = XEXP (base, 1))) |
| 7036 |
&& ((INTVAL(offset) & 1) != 1) |
| 7037 |
&& REG_P (base = XEXP (base, 0)))) |
| 7038 |
&& REGNO_POINTER_ALIGN (REGNO (base)) >= 32) |
| 7039 |
{ |
| 7040 |
rtx new_rtx; |
| 7041 |
|
| 7042 |
new_rtx = widen_memory_access (operands[1], SImode, |
| 7043 |
((INTVAL (offset) & ~3) |
| 7044 |
- INTVAL (offset))); |
| 7045 |
emit_insn (gen_movsi (reg, new_rtx)); |
| 7046 |
if (((INTVAL (offset) & 2) != 0) |
| 7047 |
^ (BYTES_BIG_ENDIAN ? 1 : 0)) |
| 7048 |
{ |
| 7049 |
rtx reg2 = gen_reg_rtx (SImode); |
| 7050 |
|
| 7051 |
emit_insn (gen_lshrsi3 (reg2, reg, GEN_INT (16))); |
| 7052 |
reg = reg2; |
| 7053 |
} |
| 7054 |
} |
| 7055 |
else |
| 7056 |
emit_insn (gen_movhi_bytes (reg, operands[1])); |
| 7057 |
|
| 7058 |
operands[1] = gen_lowpart (HImode, reg); |
| 7059 |
} |
| 7060 |
} |
| 7061 |
} |
| 7062 |
/* Handle loading a large integer during reload. */ |
| 7063 |
else if (CONST_INT_P (operands[1]) |
| 7064 |
&& !const_ok_for_arm (INTVAL (operands[1])) |
| 7065 |
&& !const_ok_for_arm (~INTVAL (operands[1]))) |
| 7066 |
{ |
| 7067 |
/* Writing a constant to memory needs a scratch, which should |
| 7068 |
be handled with SECONDARY_RELOADs. */ |
| 7069 |
gcc_assert (REG_P (operands[0])); |
| 7070 |
|
| 7071 |
operands[0] = gen_rtx_SUBREG (SImode, operands[0], 0); |
| 7072 |
emit_insn (gen_movsi (operands[0], operands[1])); |
| 7073 |
DONE; |
| 7074 |
} |
| 7075 |
} |
| 7076 |
else if (TARGET_THUMB2) |
| 7077 |
{ |
| 7078 |
/* Thumb-2 can do everything except mem=mem and mem=const easily. */ |
| 7079 |
if (can_create_pseudo_p ()) |
| 7080 |
{ |
| 7081 |
if (!REG_P (operands[0])) |
| 7082 |
operands[1] = force_reg (HImode, operands[1]); |
| 7083 |
/* Zero extend a constant, and keep it in an SImode reg. */ |
| 7084 |
else if (CONST_INT_P (operands[1])) |
| 7085 |
{ |
| 7086 |
rtx reg = gen_reg_rtx (SImode); |
| 7087 |
HOST_WIDE_INT val = INTVAL (operands[1]) & 0xffff; |
| 7088 |
|
| 7089 |
emit_insn (gen_movsi (reg, GEN_INT (val))); |
| 7090 |
operands[1] = gen_lowpart (HImode, reg); |
| 7091 |
} |
| 7092 |
} |
| 7093 |
} |
| 7094 |
else /* TARGET_THUMB1 */ |
| 7095 |
{ |
| 7096 |
if (can_create_pseudo_p ()) |
| 7097 |
{ |
| 7098 |
if (CONST_INT_P (operands[1])) |
| 7099 |
{ |
| 7100 |
rtx reg = gen_reg_rtx (SImode); |
| 7101 |
|
| 7102 |
emit_insn (gen_movsi (reg, operands[1])); |
| 7103 |
operands[1] = gen_lowpart (HImode, reg); |
| 7104 |
} |
| 7105 |
|
| 7106 |
/* ??? We shouldn't really get invalid addresses here, but this can |
| 7107 |
happen if we are passed a SP (never OK for HImode/QImode) or |
| 7108 |
virtual register (also rejected as illegitimate for HImode/QImode) |
| 7109 |
relative address. */ |
| 7110 |
/* ??? This should perhaps be fixed elsewhere, for instance, in |
| 7111 |
fixup_stack_1, by checking for other kinds of invalid addresses, |
| 7112 |
e.g. a bare reference to a virtual register. This may confuse the |
| 7113 |
alpha though, which must handle this case differently. */ |
| 7114 |
if (MEM_P (operands[0]) |
| 7115 |
&& !memory_address_p (GET_MODE (operands[0]), |
| 7116 |
XEXP (operands[0], 0))) |
| 7117 |
operands[0] |
| 7118 |
= replace_equiv_address (operands[0], |
| 7119 |
copy_to_reg (XEXP (operands[0], 0))); |
| 7120 |
|
| 7121 |
if (MEM_P (operands[1]) |
| 7122 |
&& !memory_address_p (GET_MODE (operands[1]), |
| 7123 |
XEXP (operands[1], 0))) |
| 7124 |
operands[1] |
| 7125 |
= replace_equiv_address (operands[1], |
| 7126 |
copy_to_reg (XEXP (operands[1], 0))); |
| 7127 |
|
| 7128 |
if (MEM_P (operands[1]) && optimize > 0) |
| 7129 |
{ |
| 7130 |
rtx reg = gen_reg_rtx (SImode); |
| 7131 |
|
| 7132 |
emit_insn (gen_zero_extendhisi2 (reg, operands[1])); |
| 7133 |
operands[1] = gen_lowpart (HImode, reg); |
| 7134 |
} |
| 7135 |
|
| 7136 |
if (MEM_P (operands[0])) |
| 7137 |
operands[1] = force_reg (HImode, operands[1]); |
| 7138 |
} |
| 7139 |
else if (CONST_INT_P (operands[1]) |
| 7140 |
&& !satisfies_constraint_I (operands[1])) |
| 7141 |
{ |
| 7142 |
/* Handle loading a large integer during reload. */ |
| 7143 |
|
| 7144 |
/* Writing a constant to memory needs a scratch, which should |
| 7145 |
be handled with SECONDARY_RELOADs. */ |
| 7146 |
gcc_assert (REG_P (operands[0])); |
| 7147 |
|
| 7148 |
operands[0] = gen_rtx_SUBREG (SImode, operands[0], 0); |
| 7149 |
emit_insn (gen_movsi (operands[0], operands[1])); |
| 7150 |
DONE; |
| 7151 |
} |
| 7152 |
} |
| 7153 |
" |
| 7154 |
) |
| 7155 |
|
| 7156 |
(define_expand "movhi_bytes" |
| 7157 |
[(set (match_dup 2) (zero_extend:SI (match_operand:HI 1 "" ""))) |
| 7158 |
(set (match_dup 3) |
| 7159 |
(zero_extend:SI (match_dup 6))) |
| 7160 |
(set (match_operand:SI 0 "" "") |
| 7161 |
(ior:SI (ashift:SI (match_dup 4) (const_int 8)) (match_dup 5)))] |
| 7162 |
"TARGET_ARM" |
| 7163 |
" |
| 7164 |
{ |
| 7165 |
rtx mem1, mem2; |
| 7166 |
rtx addr = copy_to_mode_reg (SImode, XEXP (operands[1], 0)); |
| 7167 |
|
| 7168 |
mem1 = change_address (operands[1], QImode, addr); |
| 7169 |
mem2 = change_address (operands[1], QImode, |
| 7170 |
plus_constant (Pmode, addr, 1)); |
| 7171 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 7172 |
operands[1] = mem1; |
| 7173 |
operands[2] = gen_reg_rtx (SImode); |
| 7174 |
operands[3] = gen_reg_rtx (SImode); |
| 7175 |
operands[6] = mem2; |
| 7176 |
|
| 7177 |
if (BYTES_BIG_ENDIAN) |
| 7178 |
{ |
| 7179 |
operands[4] = operands[2]; |
| 7180 |
operands[5] = operands[3]; |
| 7181 |
} |
| 7182 |
else |
| 7183 |
{ |
| 7184 |
operands[4] = operands[3]; |
| 7185 |
operands[5] = operands[2]; |
| 7186 |
} |
| 7187 |
}" |
| 7188 |
) |
| 7189 |
|
| 7190 |
(define_expand "movhi_bigend" |
| 7191 |
[(set (match_dup 2) |
| 7192 |
(rotate:SI (subreg:SI (match_operand:HI 1 "memory_operand") 0) |
| 7193 |
(const_int 16))) |
| 7194 |
(set (match_dup 3) |
| 7195 |
(ashiftrt:SI (match_dup 2) (const_int 16))) |
| 7196 |
(set (match_operand:HI 0 "s_register_operand") |
| 7197 |
(match_dup 4))] |
| 7198 |
"TARGET_ARM" |
| 7199 |
" |
| 7200 |
operands[2] = gen_reg_rtx (SImode); |
| 7201 |
operands[3] = gen_reg_rtx (SImode); |
| 7202 |
operands[4] = gen_lowpart (HImode, operands[3]); |
| 7203 |
" |
| 7204 |
) |
| 7205 |
|
| 7206 |
;; Pattern to recognize insn generated default case above |
| 7207 |
(define_insn "*movhi_insn_arch4" |
| 7208 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m,r") |
| 7209 |
(match_operand:HI 1 "general_operand" "rIk,K,n,r,mi"))] |
| 7210 |
"TARGET_ARM |
| 7211 |
&& arm_arch4 && !TARGET_HARD_FLOAT |
| 7212 |
&& (register_operand (operands[0], HImode) |
| 7213 |
|| register_operand (operands[1], HImode))" |
| 7214 |
"@ |
| 7215 |
mov%?\\t%0, %1\\t%@ movhi |
| 7216 |
mvn%?\\t%0, #%B1\\t%@ movhi |
| 7217 |
movw%?\\t%0, %L1\\t%@ movhi |
| 7218 |
strh%?\\t%1, %0\\t%@ movhi |
| 7219 |
ldrh%?\\t%0, %1\\t%@ movhi" |
| 7220 |
[(set_attr "predicable" "yes") |
| 7221 |
(set_attr "pool_range" "*,*,*,*,256") |
| 7222 |
(set_attr "neg_pool_range" "*,*,*,*,244") |
| 7223 |
(set_attr "arch" "*,*,v6t2,*,*") |
| 7224 |
(set_attr_alternative "type" |
| 7225 |
[(if_then_else (match_operand 1 "const_int_operand" "") |
| 7226 |
(const_string "mov_imm" ) |
| 7227 |
(const_string "mov_reg")) |
| 7228 |
(const_string "mvn_imm") |
| 7229 |
(const_string "mov_imm") |
| 7230 |
(const_string "store_4") |
| 7231 |
(const_string "load_4")])] |
| 7232 |
) |
| 7233 |
|
| 7234 |
(define_insn "*movhi_bytes" |
| 7235 |
[(set (match_operand:HI 0 "s_register_operand" "=r,r,r") |
| 7236 |
(match_operand:HI 1 "arm_rhs_operand" "I,rk,K"))] |
| 7237 |
"TARGET_ARM && !TARGET_HARD_FLOAT" |
| 7238 |
"@ |
| 7239 |
mov%?\\t%0, %1\\t%@ movhi |
| 7240 |
mov%?\\t%0, %1\\t%@ movhi |
| 7241 |
mvn%?\\t%0, #%B1\\t%@ movhi" |
| 7242 |
[(set_attr "predicable" "yes") |
| 7243 |
(set_attr "type" "mov_imm,mov_reg,mvn_imm")] |
| 7244 |
) |
| 7245 |
|
| 7246 |
;; We use a DImode scratch because we may occasionally need an additional |
| 7247 |
;; temporary if the address isn't offsettable -- push_reload doesn't seem |
| 7248 |
;; to take any notice of the "o" constraints on reload_memory_operand operand. |
| 7249 |
;; The reload_in<m> and reload_out<m> patterns require special constraints |
| 7250 |
;; to be correctly handled in default_secondary_reload function. |
| 7251 |
(define_expand "reload_outhi" |
| 7252 |
[(parallel [(match_operand:HI 0 "arm_reload_memory_operand" "=o") |
| 7253 |
(match_operand:HI 1 "s_register_operand" "r") |
| 7254 |
(match_operand:DI 2 "s_register_operand" "=&l")])] |
| 7255 |
"TARGET_EITHER" |
| 7256 |
"if (TARGET_ARM) |
| 7257 |
arm_reload_out_hi (operands); |
| 7258 |
else |
| 7259 |
thumb_reload_out_hi (operands); |
| 7260 |
DONE; |
| 7261 |
" |
| 7262 |
) |
| 7263 |
|
| 7264 |
(define_expand "reload_inhi" |
| 7265 |
[(parallel [(match_operand:HI 0 "s_register_operand" "=r") |
| 7266 |
(match_operand:HI 1 "arm_reload_memory_operand" "o") |
| 7267 |
(match_operand:DI 2 "s_register_operand" "=&r")])] |
| 7268 |
"TARGET_EITHER" |
| 7269 |
" |
| 7270 |
if (TARGET_ARM) |
| 7271 |
arm_reload_in_hi (operands); |
| 7272 |
else |
| 7273 |
thumb_reload_out_hi (operands); |
| 7274 |
DONE; |
| 7275 |
") |
| 7276 |
|
| 7277 |
(define_expand "movqi" |
| 7278 |
[(set (match_operand:QI 0 "general_operand") |
| 7279 |
(match_operand:QI 1 "general_operand"))] |
| 7280 |
"TARGET_EITHER" |
| 7281 |
" |
| 7282 |
/* Everything except mem = const or mem = mem can be done easily */ |
| 7283 |
|
| 7284 |
if (can_create_pseudo_p ()) |
| 7285 |
{ |
| 7286 |
if (CONST_INT_P (operands[1])) |
| 7287 |
{ |
| 7288 |
rtx reg = gen_reg_rtx (SImode); |
| 7289 |
|
| 7290 |
/* For thumb we want an unsigned immediate, then we are more likely |
| 7291 |
to be able to use a movs insn. */ |
| 7292 |
if (TARGET_THUMB) |
| 7293 |
operands[1] = GEN_INT (INTVAL (operands[1]) & 255); |
| 7294 |
|
| 7295 |
emit_insn (gen_movsi (reg, operands[1])); |
| 7296 |
operands[1] = gen_lowpart (QImode, reg); |
| 7297 |
} |
| 7298 |
|
| 7299 |
if (TARGET_THUMB) |
| 7300 |
{ |
| 7301 |
/* ??? We shouldn't really get invalid addresses here, but this can |
| 7302 |
happen if we are passed a SP (never OK for HImode/QImode) or |
| 7303 |
virtual register (also rejected as illegitimate for HImode/QImode) |
| 7304 |
relative address. */ |
| 7305 |
/* ??? This should perhaps be fixed elsewhere, for instance, in |
| 7306 |
fixup_stack_1, by checking for other kinds of invalid addresses, |
| 7307 |
e.g. a bare reference to a virtual register. This may confuse the |
| 7308 |
alpha though, which must handle this case differently. */ |
| 7309 |
if (MEM_P (operands[0]) |
| 7310 |
&& !memory_address_p (GET_MODE (operands[0]), |
| 7311 |
XEXP (operands[0], 0))) |
| 7312 |
operands[0] |
| 7313 |
= replace_equiv_address (operands[0], |
| 7314 |
copy_to_reg (XEXP (operands[0], 0))); |
| 7315 |
if (MEM_P (operands[1]) |
| 7316 |
&& !memory_address_p (GET_MODE (operands[1]), |
| 7317 |
XEXP (operands[1], 0))) |
| 7318 |
operands[1] |
| 7319 |
= replace_equiv_address (operands[1], |
| 7320 |
copy_to_reg (XEXP (operands[1], 0))); |
| 7321 |
} |
| 7322 |
|
| 7323 |
if (MEM_P (operands[1]) && optimize > 0) |
| 7324 |
{ |
| 7325 |
rtx reg = gen_reg_rtx (SImode); |
| 7326 |
|
| 7327 |
emit_insn (gen_zero_extendqisi2 (reg, operands[1])); |
| 7328 |
operands[1] = gen_lowpart (QImode, reg); |
| 7329 |
} |
| 7330 |
|
| 7331 |
if (MEM_P (operands[0])) |
| 7332 |
operands[1] = force_reg (QImode, operands[1]); |
| 7333 |
} |
| 7334 |
else if (TARGET_THUMB |
| 7335 |
&& CONST_INT_P (operands[1]) |
| 7336 |
&& !satisfies_constraint_I (operands[1])) |
| 7337 |
{ |
| 7338 |
/* Handle loading a large integer during reload. */ |
| 7339 |
|
| 7340 |
/* Writing a constant to memory needs a scratch, which should |
| 7341 |
be handled with SECONDARY_RELOADs. */ |
| 7342 |
gcc_assert (REG_P (operands[0])); |
| 7343 |
|
| 7344 |
operands[0] = gen_rtx_SUBREG (SImode, operands[0], 0); |
| 7345 |
emit_insn (gen_movsi (operands[0], operands[1])); |
| 7346 |
DONE; |
| 7347 |
} |
| 7348 |
" |
| 7349 |
) |
| 7350 |
|
| 7351 |
(define_insn "*arm_movqi_insn" |
| 7352 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,l,r,l,Uu,r,m") |
| 7353 |
(match_operand:QI 1 "general_operand" "rk,rk,I,Py,K,Uu,l,Uh,r"))] |
| 7354 |
"TARGET_32BIT |
| 7355 |
&& ( register_operand (operands[0], QImode) |
| 7356 |
|| register_operand (operands[1], QImode))" |
| 7357 |
"@ |
| 7358 |
mov%?\\t%0, %1 |
| 7359 |
mov%?\\t%0, %1 |
| 7360 |
mov%?\\t%0, %1 |
| 7361 |
mov%?\\t%0, %1 |
| 7362 |
mvn%?\\t%0, #%B1 |
| 7363 |
ldrb%?\\t%0, %1 |
| 7364 |
strb%?\\t%1, %0 |
| 7365 |
ldrb%?\\t%0, %1 |
| 7366 |
strb%?\\t%1, %0" |
| 7367 |
[(set_attr "type" "mov_reg,mov_reg,mov_imm,mov_imm,mvn_imm,load_4,store_4,load_4,store_4") |
| 7368 |
(set_attr "predicable" "yes") |
| 7369 |
(set_attr "predicable_short_it" "yes,yes,no,yes,no,no,no,no,no") |
| 7370 |
(set_attr "arch" "t2,any,any,t2,any,t2,t2,any,any") |
| 7371 |
(set_attr "length" "2,4,4,2,4,2,2,4,4")] |
| 7372 |
) |
| 7373 |
|
| 7374 |
;; HFmode and BFmode moves. |
| 7375 |
(define_expand "mov<mode>" |
| 7376 |
[(set (match_operand:HFBF 0 "general_operand") |
| 7377 |
(match_operand:HFBF 1 "general_operand"))] |
| 7378 |
"TARGET_EITHER" |
| 7379 |
" |
| 7380 |
gcc_checking_assert (aligned_operand (operands[0], <MODE>mode)); |
| 7381 |
gcc_checking_assert (aligned_operand (operands[1], <MODE>mode)); |
| 7382 |
if (TARGET_32BIT) |
| 7383 |
{ |
| 7384 |
if (MEM_P (operands[0])) |
| 7385 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 7386 |
} |
| 7387 |
else /* TARGET_THUMB1 */ |
| 7388 |
{ |
| 7389 |
if (can_create_pseudo_p ()) |
| 7390 |
{ |
| 7391 |
if (!REG_P (operands[0])) |
| 7392 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 7393 |
} |
| 7394 |
} |
| 7395 |
" |
| 7396 |
) |
| 7397 |
|
| 7398 |
(define_insn "*arm32_mov<mode>" |
| 7399 |
[(set (match_operand:HFBF 0 "nonimmediate_operand" "=r,m,r,r") |
| 7400 |
(match_operand:HFBF 1 "general_operand" " m,r,r,F"))] |
| 7401 |
"TARGET_32BIT |
| 7402 |
&& !TARGET_HARD_FLOAT |
| 7403 |
&& !TARGET_HAVE_MVE |
| 7404 |
&& ( s_register_operand (operands[0], <MODE>mode) |
| 7405 |
|| s_register_operand (operands[1], <MODE>mode))" |
| 7406 |
"* |
| 7407 |
switch (which_alternative) |
| 7408 |
{ |
| 7409 |
case 0: /* ARM register from memory */ |
| 7410 |
return \"ldrh%?\\t%0, %1\\t%@ __<fporbf>\"; |
| 7411 |
case 1: /* memory from ARM register */ |
| 7412 |
return \"strh%?\\t%1, %0\\t%@ __<fporbf>\"; |
| 7413 |
case 2: /* ARM register from ARM register */ |
| 7414 |
return \"mov%?\\t%0, %1\\t%@ __<fporbf>\"; |
| 7415 |
case 3: /* ARM register from constant */ |
| 7416 |
{ |
| 7417 |
long bits; |
| 7418 |
rtx ops[4]; |
| 7419 |
|
| 7420 |
bits = real_to_target (NULL, CONST_DOUBLE_REAL_VALUE (operands[1]), |
| 7421 |
<MODE>mode); |
| 7422 |
ops[0] = operands[0]; |
| 7423 |
ops[1] = GEN_INT (bits); |
| 7424 |
ops[2] = GEN_INT (bits & 0xff00); |
| 7425 |
ops[3] = GEN_INT (bits & 0x00ff); |
| 7426 |
|
| 7427 |
if (arm_arch_thumb2) |
| 7428 |
output_asm_insn (\"movw%?\\t%0, %1\", ops); |
| 7429 |
else |
| 7430 |
output_asm_insn (\"mov%?\\t%0, %2\;orr%?\\t%0, %0, %3\", ops); |
| 7431 |
return \"\"; |
| 7432 |
} |
| 7433 |
default: |
| 7434 |
gcc_unreachable (); |
| 7435 |
} |
| 7436 |
" |
| 7437 |
[(set_attr "conds" "unconditional") |
| 7438 |
(set_attr "type" "load_4,store_4,mov_reg,multiple") |
| 7439 |
(set_attr "length" "4,4,4,8") |
| 7440 |
(set_attr "predicable" "yes")] |
| 7441 |
) |
| 7442 |
|
| 7443 |
(define_expand "movsf" |
| 7444 |
[(set (match_operand:SF 0 "general_operand") |
| 7445 |
(match_operand:SF 1 "general_operand"))] |
| 7446 |
"TARGET_EITHER" |
| 7447 |
" |
| 7448 |
gcc_checking_assert (aligned_operand (operands[0], SFmode)); |
| 7449 |
gcc_checking_assert (aligned_operand (operands[1], SFmode)); |
| 7450 |
if (TARGET_32BIT) |
| 7451 |
{ |
| 7452 |
if (MEM_P (operands[0])) |
| 7453 |
operands[1] = force_reg (SFmode, operands[1]); |
| 7454 |
} |
| 7455 |
else /* TARGET_THUMB1 */ |
| 7456 |
{ |
| 7457 |
if (can_create_pseudo_p ()) |
| 7458 |
{ |
| 7459 |
if (!REG_P (operands[0])) |
| 7460 |
operands[1] = force_reg (SFmode, operands[1]); |
| 7461 |
} |
| 7462 |
} |
| 7463 |
|
| 7464 |
/* Cannot load it directly, generate a load with clobber so that it can be |
| 7465 |
loaded via GPR with MOV / MOVT. */ |
| 7466 |
if (arm_disable_literal_pool |
| 7467 |
&& (REG_P (operands[0]) || SUBREG_P (operands[0])) |
| 7468 |
&& CONST_DOUBLE_P (operands[1]) |
| 7469 |
&& TARGET_VFP_BASE |
| 7470 |
&& !vfp3_const_double_rtx (operands[1])) |
| 7471 |
{ |
| 7472 |
rtx clobreg = gen_reg_rtx (SFmode); |
| 7473 |
emit_insn (gen_no_literal_pool_sf_immediate (operands[0], operands[1], |
| 7474 |
clobreg)); |
| 7475 |
DONE; |
| 7476 |
} |
| 7477 |
" |
| 7478 |
) |
| 7479 |
|
| 7480 |
;; Transform a floating-point move of a constant into a core register into |
| 7481 |
;; an SImode operation. |
| 7482 |
(define_split |
| 7483 |
[(set (match_operand:SF 0 "arm_general_register_operand" "") |
| 7484 |
(match_operand:SF 1 "immediate_operand" ""))] |
| 7485 |
"TARGET_EITHER |
| 7486 |
&& reload_completed |
| 7487 |
&& CONST_DOUBLE_P (operands[1])" |
| 7488 |
[(set (match_dup 2) (match_dup 3))] |
| 7489 |
" |
| 7490 |
operands[2] = gen_lowpart (SImode, operands[0]); |
| 7491 |
operands[3] = gen_lowpart (SImode, operands[1]); |
| 7492 |
if (operands[2] == 0 || operands[3] == 0) |
| 7493 |
FAIL; |
| 7494 |
" |
| 7495 |
) |
| 7496 |
|
| 7497 |
(define_insn "*arm_movsf_soft_insn" |
| 7498 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m") |
| 7499 |
(match_operand:SF 1 "general_operand" "r,mE,r"))] |
| 7500 |
"TARGET_32BIT |
| 7501 |
&& TARGET_SOFT_FLOAT && !TARGET_HAVE_MVE |
| 7502 |
&& (!MEM_P (operands[0]) |
| 7503 |
|| register_operand (operands[1], SFmode))" |
| 7504 |
{ |
| 7505 |
switch (which_alternative) |
| 7506 |
{ |
| 7507 |
case 0: return \"mov%?\\t%0, %1\"; |
| 7508 |
case 1: |
| 7509 |
/* Cannot load it directly, split to load it via MOV / MOVT. */ |
| 7510 |
if (!MEM_P (operands[1]) && arm_disable_literal_pool) |
| 7511 |
return \"#\"; |
| 7512 |
return \"ldr%?\\t%0, %1\\t%@ float\"; |
| 7513 |
case 2: return \"str%?\\t%1, %0\\t%@ float\"; |
| 7514 |
default: gcc_unreachable (); |
| 7515 |
} |
| 7516 |
} |
| 7517 |
[(set_attr "predicable" "yes") |
| 7518 |
(set_attr "type" "mov_reg,load_4,store_4") |
| 7519 |
(set_attr "arm_pool_range" "*,4096,*") |
| 7520 |
(set_attr "thumb2_pool_range" "*,4094,*") |
| 7521 |
(set_attr "arm_neg_pool_range" "*,4084,*") |
| 7522 |
(set_attr "thumb2_neg_pool_range" "*,0,*")] |
| 7523 |
) |
| 7524 |
|
| 7525 |
;; Splitter for the above. |
| 7526 |
(define_split |
| 7527 |
[(set (match_operand:SF 0 "s_register_operand") |
| 7528 |
(match_operand:SF 1 "const_double_operand"))] |
| 7529 |
"arm_disable_literal_pool && TARGET_SOFT_FLOAT" |
| 7530 |
[(const_int 0)] |
| 7531 |
{ |
| 7532 |
long buf; |
| 7533 |
real_to_target (&buf, CONST_DOUBLE_REAL_VALUE (operands[1]), SFmode); |
| 7534 |
rtx cst = gen_int_mode (buf, SImode); |
| 7535 |
emit_move_insn (simplify_gen_subreg (SImode, operands[0], SFmode, 0), cst); |
| 7536 |
DONE; |
| 7537 |
} |
| 7538 |
) |
| 7539 |
|
| 7540 |
(define_expand "movdf" |
| 7541 |
[(set (match_operand:DF 0 "general_operand") |
| 7542 |
(match_operand:DF 1 "general_operand"))] |
| 7543 |
"TARGET_EITHER" |
| 7544 |
" |
| 7545 |
gcc_checking_assert (aligned_operand (operands[0], DFmode)); |
| 7546 |
gcc_checking_assert (aligned_operand (operands[1], DFmode)); |
| 7547 |
if (TARGET_32BIT) |
| 7548 |
{ |
| 7549 |
if (MEM_P (operands[0])) |
| 7550 |
operands[1] = force_reg (DFmode, operands[1]); |
| 7551 |
} |
| 7552 |
else /* TARGET_THUMB */ |
| 7553 |
{ |
| 7554 |
if (can_create_pseudo_p ()) |
| 7555 |
{ |
| 7556 |
if (!REG_P (operands[0])) |
| 7557 |
operands[1] = force_reg (DFmode, operands[1]); |
| 7558 |
} |
| 7559 |
} |
| 7560 |
|
| 7561 |
/* Cannot load it directly, generate a load with clobber so that it can be |
| 7562 |
loaded via GPR with MOV / MOVT. */ |
| 7563 |
if (arm_disable_literal_pool |
| 7564 |
&& (REG_P (operands[0]) || SUBREG_P (operands[0])) |
| 7565 |
&& CONSTANT_P (operands[1]) |
| 7566 |
&& TARGET_VFP_BASE |
| 7567 |
&& !arm_const_double_rtx (operands[1]) |
| 7568 |
&& !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1]))) |
| 7569 |
{ |
| 7570 |
rtx clobreg = gen_reg_rtx (DImode); |
| 7571 |
emit_insn (gen_no_literal_pool_df_immediate (operands[0], operands[1], |
| 7572 |
clobreg)); |
| 7573 |
DONE; |
| 7574 |
} |
| 7575 |
" |
| 7576 |
) |
| 7577 |
|
| 7578 |
;; Reloading a df mode value stored in integer regs to memory can require a |
| 7579 |
;; scratch reg. |
| 7580 |
;; Another reload_out<m> pattern that requires special constraints. |
| 7581 |
(define_expand "reload_outdf" |
| 7582 |
[(match_operand:DF 0 "arm_reload_memory_operand" "=o") |
| 7583 |
(match_operand:DF 1 "s_register_operand" "r") |
| 7584 |
(match_operand:SI 2 "s_register_operand" "=&r")] |
| 7585 |
"TARGET_THUMB2" |
| 7586 |
" |
| 7587 |
{ |
| 7588 |
enum rtx_code code = GET_CODE (XEXP (operands[0], 0)); |
| 7589 |
|
| 7590 |
if (code == REG) |
| 7591 |
operands[2] = XEXP (operands[0], 0); |
| 7592 |
else if (code == POST_INC || code == PRE_DEC) |
| 7593 |
{ |
| 7594 |
operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0); |
| 7595 |
operands[1] = gen_rtx_SUBREG (DImode, operands[1], 0); |
| 7596 |
emit_insn (gen_movdi (operands[0], operands[1])); |
| 7597 |
DONE; |
| 7598 |
} |
| 7599 |
else if (code == PRE_INC) |
| 7600 |
{ |
| 7601 |
rtx reg = XEXP (XEXP (operands[0], 0), 0); |
| 7602 |
|
| 7603 |
emit_insn (gen_addsi3 (reg, reg, GEN_INT (8))); |
| 7604 |
operands[2] = reg; |
| 7605 |
} |
| 7606 |
else if (code == POST_DEC) |
| 7607 |
operands[2] = XEXP (XEXP (operands[0], 0), 0); |
| 7608 |
else |
| 7609 |
emit_insn (gen_addsi3 (operands[2], XEXP (XEXP (operands[0], 0), 0), |
| 7610 |
XEXP (XEXP (operands[0], 0), 1))); |
| 7611 |
|
| 7612 |
emit_insn (gen_rtx_SET (replace_equiv_address (operands[0], operands[2]), |
| 7613 |
operands[1])); |
| 7614 |
|
| 7615 |
if (code == POST_DEC) |
| 7616 |
emit_insn (gen_addsi3 (operands[2], operands[2], GEN_INT (-8))); |
| 7617 |
|
| 7618 |
DONE; |
| 7619 |
}" |
| 7620 |
) |
| 7621 |
|
| 7622 |
(define_insn "*movdf_soft_insn" |
| 7623 |
[(set (match_operand:DF 0 "nonimmediate_soft_df_operand" "=r,r,r,r,m") |
| 7624 |
(match_operand:DF 1 "soft_df_operand" "rDa,Db,Dc,mF,r"))] |
| 7625 |
"TARGET_32BIT && TARGET_SOFT_FLOAT && !TARGET_HAVE_MVE |
| 7626 |
&& ( register_operand (operands[0], DFmode) |
| 7627 |
|| register_operand (operands[1], DFmode))" |
| 7628 |
"* |
| 7629 |
switch (which_alternative) |
| 7630 |
{ |
| 7631 |
case 0: |
| 7632 |
case 1: |
| 7633 |
case 2: |
| 7634 |
return \"#\"; |
| 7635 |
case 3: |
| 7636 |
/* Cannot load it directly, split to load it via MOV / MOVT. */ |
| 7637 |
if (!MEM_P (operands[1]) && arm_disable_literal_pool) |
| 7638 |
return \"#\"; |
| 7639 |
/* Fall through. */ |
| 7640 |
default: |
| 7641 |
return output_move_double (operands, true, NULL); |
| 7642 |
} |
| 7643 |
" |
| 7644 |
[(set_attr "length" "8,12,16,8,8") |
| 7645 |
(set_attr "type" "multiple,multiple,multiple,load_8,store_8") |
| 7646 |
(set_attr "arm_pool_range" "*,*,*,1020,*") |
| 7647 |
(set_attr "thumb2_pool_range" "*,*,*,1018,*") |
| 7648 |
(set_attr "arm_neg_pool_range" "*,*,*,1004,*") |
| 7649 |
(set_attr "thumb2_neg_pool_range" "*,*,*,0,*")] |
| 7650 |
) |
| 7651 |
|
| 7652 |
;; Splitter for the above. |
| 7653 |
(define_split |
| 7654 |
[(set (match_operand:DF 0 "s_register_operand") |
| 7655 |
(match_operand:DF 1 "const_double_operand"))] |
| 7656 |
"arm_disable_literal_pool && TARGET_SOFT_FLOAT" |
| 7657 |
[(const_int 0)] |
| 7658 |
{ |
| 7659 |
long buf[2]; |
| 7660 |
int order = BYTES_BIG_ENDIAN ? 1 : 0; |
| 7661 |
real_to_target (buf, CONST_DOUBLE_REAL_VALUE (operands[1]), DFmode); |
| 7662 |
unsigned HOST_WIDE_INT ival = zext_hwi (buf[order], 32); |
| 7663 |
ival |= (zext_hwi (buf[1 - order], 32) << 32); |
| 7664 |
rtx cst = gen_int_mode (ival, DImode); |
| 7665 |
emit_move_insn (simplify_gen_subreg (DImode, operands[0], DFmode, 0), cst); |
| 7666 |
DONE; |
| 7667 |
} |
| 7668 |
) |
| 7669 |
|
| 7670 |
|
| 7671 |
;; load- and store-multiple insns |
| 7672 |
;; The arm can load/store any set of registers, provided that they are in |
| 7673 |
;; ascending order, but these expanders assume a contiguous set. |
| 7674 |
|
| 7675 |
(define_expand "load_multiple" |
| 7676 |
[(match_par_dup 3 [(set (match_operand:SI 0 "" "") |
| 7677 |
(match_operand:SI 1 "" "")) |
| 7678 |
(use (match_operand:SI 2 "" ""))])] |
| 7679 |
"TARGET_32BIT" |
| 7680 |
{ |
| 7681 |
HOST_WIDE_INT offset = 0; |
| 7682 |
|
| 7683 |
/* Support only fixed point registers. */ |
| 7684 |
if (!CONST_INT_P (operands[2]) |
| 7685 |
|| INTVAL (operands[2]) > MAX_LDM_STM_OPS |
| 7686 |
|| INTVAL (operands[2]) < 2 |
| 7687 |
|| !MEM_P (operands[1]) |
| 7688 |
|| !REG_P (operands[0]) |
| 7689 |
|| REGNO (operands[0]) > (LAST_ARM_REGNUM - 1) |
| 7690 |
|| REGNO (operands[0]) + INTVAL (operands[2]) > LAST_ARM_REGNUM) |
| 7691 |
FAIL; |
| 7692 |
|
| 7693 |
operands[3] |
| 7694 |
= arm_gen_load_multiple (arm_regs_in_sequence + REGNO (operands[0]), |
| 7695 |
INTVAL (operands[2]), |
| 7696 |
force_reg (SImode, XEXP (operands[1], 0)), |
| 7697 |
FALSE, operands[1], &offset); |
| 7698 |
}) |
| 7699 |
|
| 7700 |
(define_expand "store_multiple" |
| 7701 |
[(match_par_dup 3 [(set (match_operand:SI 0 "" "") |
| 7702 |
(match_operand:SI 1 "" "")) |
| 7703 |
(use (match_operand:SI 2 "" ""))])] |
| 7704 |
"TARGET_32BIT" |
| 7705 |
{ |
| 7706 |
HOST_WIDE_INT offset = 0; |
| 7707 |
|
| 7708 |
/* Support only fixed point registers. */ |
| 7709 |
if (!CONST_INT_P (operands[2]) |
| 7710 |
|| INTVAL (operands[2]) > MAX_LDM_STM_OPS |
| 7711 |
|| INTVAL (operands[2]) < 2 |
| 7712 |
|| !REG_P (operands[1]) |
| 7713 |
|| !MEM_P (operands[0]) |
| 7714 |
|| REGNO (operands[1]) > (LAST_ARM_REGNUM - 1) |
| 7715 |
|| REGNO (operands[1]) + INTVAL (operands[2]) > LAST_ARM_REGNUM) |
| 7716 |
FAIL; |
| 7717 |
|
| 7718 |
operands[3] |
| 7719 |
= arm_gen_store_multiple (arm_regs_in_sequence + REGNO (operands[1]), |
| 7720 |
INTVAL (operands[2]), |
| 7721 |
force_reg (SImode, XEXP (operands[0], 0)), |
| 7722 |
FALSE, operands[0], &offset); |
| 7723 |
}) |
| 7724 |
|
| 7725 |
|
| 7726 |
(define_expand "setmemsi" |
| 7727 |
[(match_operand:BLK 0 "general_operand") |
| 7728 |
(match_operand:SI 1 "const_int_operand") |
| 7729 |
(match_operand:SI 2 "const_int_operand") |
| 7730 |
(match_operand:SI 3 "const_int_operand")] |
| 7731 |
"TARGET_32BIT" |
| 7732 |
{ |
| 7733 |
if (arm_gen_setmem (operands)) |
| 7734 |
DONE; |
| 7735 |
|
| 7736 |
FAIL; |
| 7737 |
}) |
| 7738 |
|
| 7739 |
|
| 7740 |
;; Move a block of memory if it is word aligned and MORE than 2 words long. |
| 7741 |
;; We could let this apply for blocks of less than this, but it clobbers so |
| 7742 |
;; many registers that there is then probably a better way. |
| 7743 |
|
| 7744 |
(define_expand "cpymemqi" |
| 7745 |
[(match_operand:BLK 0 "general_operand") |
| 7746 |
(match_operand:BLK 1 "general_operand") |
| 7747 |
(match_operand:SI 2 "const_int_operand") |
| 7748 |
(match_operand:SI 3 "const_int_operand")] |
| 7749 |
"" |
| 7750 |
" |
| 7751 |
if (TARGET_32BIT) |
| 7752 |
{ |
| 7753 |
if (TARGET_LDRD && current_tune->prefer_ldrd_strd |
| 7754 |
&& !optimize_function_for_size_p (cfun)) |
| 7755 |
{ |
| 7756 |
if (gen_cpymem_ldrd_strd (operands)) |
| 7757 |
DONE; |
| 7758 |
FAIL; |
| 7759 |
} |
| 7760 |
|
| 7761 |
if (arm_gen_cpymemqi (operands)) |
| 7762 |
DONE; |
| 7763 |
FAIL; |
| 7764 |
} |
| 7765 |
else /* TARGET_THUMB1 */ |
| 7766 |
{ |
| 7767 |
if ( INTVAL (operands[3]) != 4 |
| 7768 |
|| INTVAL (operands[2]) > 48) |
| 7769 |
FAIL; |
| 7770 |
|
| 7771 |
thumb_expand_cpymemqi (operands); |
| 7772 |
DONE; |
| 7773 |
} |
| 7774 |
" |
| 7775 |
) |
| 7776 |
|
| 7777 |
|
| 7778 |
;; Compare & branch insns |
| 7779 |
;; The range calculations are based as follows: |
| 7780 |
;; For forward branches, the address calculation returns the address of |
| 7781 |
;; the next instruction. This is 2 beyond the branch instruction. |
| 7782 |
;; For backward branches, the address calculation returns the address of |
| 7783 |
;; the first instruction in this pattern (cmp). This is 2 before the branch |
| 7784 |
;; instruction for the shortest sequence, and 4 before the branch instruction |
| 7785 |
;; if we have to jump around an unconditional branch. |
| 7786 |
;; To the basic branch range the PC offset must be added (this is +4). |
| 7787 |
;; So for forward branches we have |
| 7788 |
;; (pos_range - pos_base_offs + pc_offs) = (pos_range - 2 + 4). |
| 7789 |
;; And for backward branches we have |
| 7790 |
;; (neg_range - neg_base_offs + pc_offs) = (neg_range - (-2 or -4) + 4). |
| 7791 |
;; |
| 7792 |
;; In 16-bit Thumb these ranges are: |
| 7793 |
;; For a 'b' pos_range = 2046, neg_range = -2048 giving (-2040->2048). |
| 7794 |
;; For a 'b<cond>' pos_range = 254, neg_range = -256 giving (-250 ->256). |
| 7795 |
|
| 7796 |
;; In 32-bit Thumb these ranges are: |
| 7797 |
;; For a 'b' +/- 16MB is not checked for. |
| 7798 |
;; For a 'b<cond>' pos_range = 1048574, neg_range = -1048576 giving |
| 7799 |
;; (-1048568 -> 1048576). |
| 7800 |
|
| 7801 |
(define_expand "cbranchsi4" |
| 7802 |
[(set (pc) (if_then_else |
| 7803 |
(match_operator 0 "expandable_comparison_operator" |
| 7804 |
[(match_operand:SI 1 "s_register_operand") |
| 7805 |
(match_operand:SI 2 "nonmemory_operand")]) |
| 7806 |
(label_ref (match_operand 3 "" "")) |
| 7807 |
(pc)))] |
| 7808 |
"TARGET_EITHER" |
| 7809 |
" |
| 7810 |
if (!TARGET_THUMB1) |
| 7811 |
{ |
| 7812 |
if (!arm_validize_comparison (&operands[0], &operands[1], &operands[2])) |
| 7813 |
FAIL; |
| 7814 |
emit_jump_insn (gen_cbranch_cc (operands[0], operands[1], operands[2], |
| 7815 |
operands[3])); |
| 7816 |
DONE; |
| 7817 |
} |
| 7818 |
if (thumb1_cmpneg_operand (operands[2], SImode)) |
| 7819 |
{ |
| 7820 |
emit_jump_insn (gen_cbranchsi4_scratch (NULL, operands[1], operands[2], |
| 7821 |
operands[3], operands[0])); |
| 7822 |
DONE; |
| 7823 |
} |
| 7824 |
if (!thumb1_cmp_operand (operands[2], SImode)) |
| 7825 |
operands[2] = force_reg (SImode, operands[2]); |
| 7826 |
") |
| 7827 |
|
| 7828 |
(define_expand "cbranchsf4" |
| 7829 |
[(set (pc) (if_then_else |
| 7830 |
(match_operator 0 "expandable_comparison_operator" |
| 7831 |
[(match_operand:SF 1 "s_register_operand") |
| 7832 |
(match_operand:SF 2 "vfp_compare_operand")]) |
| 7833 |
(label_ref (match_operand 3 "" "")) |
| 7834 |
(pc)))] |
| 7835 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 7836 |
"emit_jump_insn (gen_cbranch_cc (operands[0], operands[1], operands[2], |
| 7837 |
operands[3])); DONE;" |
| 7838 |
) |
| 7839 |
|
| 7840 |
(define_expand "cbranchdf4" |
| 7841 |
[(set (pc) (if_then_else |
| 7842 |
(match_operator 0 "expandable_comparison_operator" |
| 7843 |
[(match_operand:DF 1 "s_register_operand") |
| 7844 |
(match_operand:DF 2 "vfp_compare_operand")]) |
| 7845 |
(label_ref (match_operand 3 "" "")) |
| 7846 |
(pc)))] |
| 7847 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 7848 |
"emit_jump_insn (gen_cbranch_cc (operands[0], operands[1], operands[2], |
| 7849 |
operands[3])); DONE;" |
| 7850 |
) |
| 7851 |
|
| 7852 |
(define_expand "cbranchdi4" |
| 7853 |
[(set (pc) (if_then_else |
| 7854 |
(match_operator 0 "expandable_comparison_operator" |
| 7855 |
[(match_operand:DI 1 "s_register_operand") |
| 7856 |
(match_operand:DI 2 "reg_or_int_operand")]) |
| 7857 |
(label_ref (match_operand 3 "" "")) |
| 7858 |
(pc)))] |
| 7859 |
"TARGET_32BIT" |
| 7860 |
"{ |
| 7861 |
if (!arm_validize_comparison (&operands[0], &operands[1], &operands[2])) |
| 7862 |
FAIL; |
| 7863 |
emit_jump_insn (gen_cbranch_cc (operands[0], operands[1], operands[2], |
| 7864 |
operands[3])); |
| 7865 |
DONE; |
| 7866 |
}" |
| 7867 |
) |
| 7868 |
|
| 7869 |
;; Comparison and test insns |
| 7870 |
|
| 7871 |
(define_insn "*arm_cmpsi_insn" |
| 7872 |
[(set (reg:CC CC_REGNUM) |
| 7873 |
(compare:CC (match_operand:SI 0 "s_register_operand" "l,r,r,r,r") |
| 7874 |
(match_operand:SI 1 "arm_add_operand" "Py,r,r,I,L")))] |
| 7875 |
"TARGET_32BIT" |
| 7876 |
"@ |
| 7877 |
cmp%?\\t%0, %1 |
| 7878 |
cmp%?\\t%0, %1 |
| 7879 |
cmp%?\\t%0, %1 |
| 7880 |
cmp%?\\t%0, %1 |
| 7881 |
cmn%?\\t%0, #%n1" |
| 7882 |
[(set_attr "conds" "set") |
| 7883 |
(set_attr "arch" "t2,t2,any,any,any") |
| 7884 |
(set_attr "length" "2,2,4,4,4") |
| 7885 |
(set_attr "predicable" "yes") |
| 7886 |
(set_attr "predicable_short_it" "yes,yes,yes,no,no") |
| 7887 |
(set_attr "type" "alus_imm,alus_sreg,alus_sreg,alus_imm,alus_imm")] |
| 7888 |
) |
| 7889 |
|
| 7890 |
(define_insn "*cmpsi_shiftsi" |
| 7891 |
[(set (reg:CC CC_REGNUM) |
| 7892 |
(compare:CC (match_operand:SI 0 "s_register_operand" "r,r") |
| 7893 |
(match_operator:SI 3 "shift_operator" |
| 7894 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 7895 |
(match_operand:SI 2 "shift_amount_operand" "M,r")])))] |
| 7896 |
"TARGET_32BIT" |
| 7897 |
"cmp\\t%0, %1%S3" |
| 7898 |
[(set_attr "conds" "set") |
| 7899 |
(set_attr "shift" "1") |
| 7900 |
(set_attr "arch" "32,a") |
| 7901 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 7902 |
|
| 7903 |
(define_insn "*cmpsi_shiftsi_swp" |
| 7904 |
[(set (reg:CC_SWP CC_REGNUM) |
| 7905 |
(compare:CC_SWP (match_operator:SI 3 "shift_operator" |
| 7906 |
[(match_operand:SI 1 "s_register_operand" "r,r") |
| 7907 |
(match_operand:SI 2 "shift_amount_operand" "M,r")]) |
| 7908 |
(match_operand:SI 0 "s_register_operand" "r,r")))] |
| 7909 |
"TARGET_32BIT" |
| 7910 |
"cmp%?\\t%0, %1%S3" |
| 7911 |
[(set_attr "conds" "set") |
| 7912 |
(set_attr "shift" "1") |
| 7913 |
(set_attr "arch" "32,a") |
| 7914 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 7915 |
|
| 7916 |
(define_insn "*arm_cmpsi_negshiftsi_si" |
| 7917 |
[(set (reg:CC_Z CC_REGNUM) |
| 7918 |
(compare:CC_Z |
| 7919 |
(neg:SI (match_operator:SI 1 "shift_operator" |
| 7920 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 7921 |
(match_operand:SI 3 "shift_amount_operand" "M,r")])) |
| 7922 |
(match_operand:SI 0 "s_register_operand" "r,r")))] |
| 7923 |
"TARGET_32BIT" |
| 7924 |
"cmn%?\\t%0, %2%S1" |
| 7925 |
[(set_attr "conds" "set") |
| 7926 |
(set_attr "arch" "32,a") |
| 7927 |
(set_attr "shift" "2") |
| 7928 |
(set_attr "type" "alus_shift_imm,alus_shift_reg") |
| 7929 |
(set_attr "predicable" "yes")] |
| 7930 |
) |
| 7931 |
|
| 7932 |
; This insn allows redundant compares to be removed by cse, nothing should |
| 7933 |
; ever appear in the output file since (set (reg x) (reg x)) is a no-op that |
| 7934 |
; is deleted later on. The match_dup will match the mode here, so that |
| 7935 |
; mode changes of the condition codes aren't lost by this even though we don't |
| 7936 |
; specify what they are. |
| 7937 |
|
| 7938 |
(define_insn "*deleted_compare" |
| 7939 |
[(set (match_operand 0 "cc_register" "") (match_dup 0))] |
| 7940 |
"TARGET_32BIT" |
| 7941 |
"\\t%@ deleted compare" |
| 7942 |
[(set_attr "conds" "set") |
| 7943 |
(set_attr "length" "0") |
| 7944 |
(set_attr "type" "no_insn")] |
| 7945 |
) |
| 7946 |
|
| 7947 |
|
| 7948 |
;; Conditional branch insns |
| 7949 |
|
| 7950 |
(define_expand "cbranch_cc" |
| 7951 |
[(set (pc) |
| 7952 |
(if_then_else (match_operator 0 "" [(match_operand 1 "" "") |
| 7953 |
(match_operand 2 "" "")]) |
| 7954 |
(label_ref (match_operand 3 "" "")) |
| 7955 |
(pc)))] |
| 7956 |
"TARGET_32BIT" |
| 7957 |
"operands[1] = arm_gen_compare_reg (GET_CODE (operands[0]), |
| 7958 |
operands[1], operands[2], NULL_RTX); |
| 7959 |
operands[2] = const0_rtx;" |
| 7960 |
) |
| 7961 |
|
| 7962 |
;; |
| 7963 |
;; Patterns to match conditional branch insns. |
| 7964 |
;; |
| 7965 |
|
| 7966 |
(define_insn "arm_cond_branch" |
| 7967 |
[(set (pc) |
| 7968 |
(if_then_else (match_operator 1 "arm_comparison_operator" |
| 7969 |
[(match_operand 2 "cc_register" "") (const_int 0)]) |
| 7970 |
(label_ref (match_operand 0 "" "")) |
| 7971 |
(pc)))] |
| 7972 |
"TARGET_32BIT" |
| 7973 |
{ |
| 7974 |
if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2) |
| 7975 |
{ |
| 7976 |
arm_ccfsm_state += 2; |
| 7977 |
return ""; |
| 7978 |
} |
| 7979 |
switch (get_attr_length (insn)) |
| 7980 |
{ |
| 7981 |
case 2: /* Thumb2 16-bit b{cond}. */ |
| 7982 |
case 4: /* Thumb2 32-bit b{cond} or A32 b{cond}. */ |
| 7983 |
return "b%d1\t%l0"; |
| 7984 |
break; |
| 7985 |
|
| 7986 |
/* Thumb2 b{cond} out of range. Use 16-bit b{cond} and |
| 7987 |
unconditional branch b. */ |
| 7988 |
default: return arm_gen_far_branch (operands, 0, "Lbcond", "b%D1\t"); |
| 7989 |
} |
| 7990 |
} |
| 7991 |
[(set_attr "conds" "use") |
| 7992 |
(set_attr "type" "branch") |
| 7993 |
(set (attr "length") |
| 7994 |
(if_then_else (match_test "!TARGET_THUMB2") |
| 7995 |
|
| 7996 |
;;Target is not Thumb2, therefore is A32. Generate b{cond}. |
| 7997 |
(const_int 4) |
| 7998 |
|
| 7999 |
;; Check if target is within 16-bit Thumb2 b{cond} range. |
| 8000 |
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -250)) |
| 8001 |
(le (minus (match_dup 0) (pc)) (const_int 256))) |
| 8002 |
|
| 8003 |
;; Target is Thumb2, within narrow range. |
| 8004 |
;; Generate b{cond}. |
| 8005 |
(const_int 2) |
| 8006 |
|
| 8007 |
;; Check if target is within 32-bit Thumb2 b{cond} range. |
| 8008 |
(if_then_else (and (ge (minus (match_dup 0) (pc))(const_int -1048568)) |
| 8009 |
(le (minus (match_dup 0) (pc)) (const_int 1048576))) |
| 8010 |
|
| 8011 |
;; Target is Thumb2, within wide range. |
| 8012 |
;; Generate b{cond} |
| 8013 |
(const_int 4) |
| 8014 |
;; Target is Thumb2, out of range. |
| 8015 |
;; Generate narrow b{cond} and unconditional branch b. |
| 8016 |
(const_int 6)))))] |
| 8017 |
) |
| 8018 |
|
| 8019 |
(define_insn "*arm_cond_branch_reversed" |
| 8020 |
[(set (pc) |
| 8021 |
(if_then_else (match_operator 1 "arm_comparison_operator" |
| 8022 |
[(match_operand 2 "cc_register" "") (const_int 0)]) |
| 8023 |
(pc) |
| 8024 |
(label_ref (match_operand 0 "" ""))))] |
| 8025 |
"TARGET_32BIT" |
| 8026 |
{ |
| 8027 |
if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2) |
| 8028 |
{ |
| 8029 |
arm_ccfsm_state += 2; |
| 8030 |
return ""; |
| 8031 |
} |
| 8032 |
switch (get_attr_length (insn)) |
| 8033 |
{ |
| 8034 |
case 2: /* Thumb2 16-bit b{cond}. */ |
| 8035 |
case 4: /* Thumb2 32-bit b{cond} or A32 b{cond}. */ |
| 8036 |
return "b%D1\t%l0"; |
| 8037 |
break; |
| 8038 |
|
| 8039 |
/* Thumb2 b{cond} out of range. Use 16-bit b{cond} and |
| 8040 |
unconditional branch b. */ |
| 8041 |
default: return arm_gen_far_branch (operands, 0, "Lbcond", "b%d1\t"); |
| 8042 |
} |
| 8043 |
} |
| 8044 |
[(set_attr "conds" "use") |
| 8045 |
(set_attr "type" "branch") |
| 8046 |
(set (attr "length") |
| 8047 |
(if_then_else (match_test "!TARGET_THUMB2") |
| 8048 |
|
| 8049 |
;;Target is not Thumb2, therefore is A32. Generate b{cond}. |
| 8050 |
(const_int 4) |
| 8051 |
|
| 8052 |
;; Check if target is within 16-bit Thumb2 b{cond} range. |
| 8053 |
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -250)) |
| 8054 |
(le (minus (match_dup 0) (pc)) (const_int 256))) |
| 8055 |
|
| 8056 |
;; Target is Thumb2, within narrow range. |
| 8057 |
;; Generate b{cond}. |
| 8058 |
(const_int 2) |
| 8059 |
|
| 8060 |
;; Check if target is within 32-bit Thumb2 b{cond} range. |
| 8061 |
(if_then_else (and (ge (minus (match_dup 0) (pc))(const_int -1048568)) |
| 8062 |
(le (minus (match_dup 0) (pc)) (const_int 1048576))) |
| 8063 |
|
| 8064 |
;; Target is Thumb2, within wide range. |
| 8065 |
;; Generate b{cond}. |
| 8066 |
(const_int 4) |
| 8067 |
;; Target is Thumb2, out of range. |
| 8068 |
;; Generate narrow b{cond} and unconditional branch b. |
| 8069 |
(const_int 6)))))] |
| 8070 |
) |
| 8071 |
|
| 8072 |
|
| 8073 |
|
| 8074 |
; scc insns |
| 8075 |
|
| 8076 |
(define_expand "cstore_cc" |
| 8077 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8078 |
(match_operator:SI 1 "" [(match_operand 2 "" "") |
| 8079 |
(match_operand 3 "" "")]))] |
| 8080 |
"TARGET_32BIT" |
| 8081 |
"operands[2] = arm_gen_compare_reg (GET_CODE (operands[1]), |
| 8082 |
operands[2], operands[3], NULL_RTX); |
| 8083 |
operands[3] = const0_rtx;" |
| 8084 |
) |
| 8085 |
|
| 8086 |
(define_insn_and_split "*mov_scc" |
| 8087 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 8088 |
(match_operator:SI 1 "arm_comparison_operator_mode" |
| 8089 |
[(match_operand 2 "cc_register" "") (const_int 0)]))] |
| 8090 |
"TARGET_ARM" |
| 8091 |
"#" ; "mov%D1\\t%0, #0\;mov%d1\\t%0, #1" |
| 8092 |
"TARGET_ARM" |
| 8093 |
[(set (match_dup 0) |
| 8094 |
(if_then_else:SI (match_dup 1) |
| 8095 |
(const_int 1) |
| 8096 |
(const_int 0)))] |
| 8097 |
"" |
| 8098 |
[(set_attr "conds" "use") |
| 8099 |
(set_attr "length" "8") |
| 8100 |
(set_attr "type" "multiple")] |
| 8101 |
) |
| 8102 |
|
| 8103 |
(define_insn "*negscc_borrow" |
| 8104 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 8105 |
(neg:SI (match_operand:SI 1 "arm_borrow_operation" "")))] |
| 8106 |
"TARGET_32BIT" |
| 8107 |
"sbc\\t%0, %0, %0" |
| 8108 |
[(set_attr "conds" "use") |
| 8109 |
(set_attr "length" "4") |
| 8110 |
(set_attr "type" "adc_reg")] |
| 8111 |
) |
| 8112 |
|
| 8113 |
(define_insn_and_split "*mov_negscc" |
| 8114 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 8115 |
(neg:SI (match_operator:SI 1 "arm_comparison_operator_mode" |
| 8116 |
[(match_operand 2 "cc_register" "") (const_int 0)])))] |
| 8117 |
"TARGET_ARM && !arm_borrow_operation (operands[1], SImode)" |
| 8118 |
"#" ; "mov%D1\\t%0, #0\;mvn%d1\\t%0, #0" |
| 8119 |
"&& true" |
| 8120 |
[(set (match_dup 0) |
| 8121 |
(if_then_else:SI (match_dup 1) |
| 8122 |
(match_dup 3) |
| 8123 |
(const_int 0)))] |
| 8124 |
{ |
| 8125 |
operands[3] = GEN_INT (~0); |
| 8126 |
} |
| 8127 |
[(set_attr "conds" "use") |
| 8128 |
(set_attr "length" "8") |
| 8129 |
(set_attr "type" "multiple")] |
| 8130 |
) |
| 8131 |
|
| 8132 |
(define_insn_and_split "*mov_notscc" |
| 8133 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 8134 |
(not:SI (match_operator:SI 1 "arm_comparison_operator" |
| 8135 |
[(match_operand 2 "cc_register" "") (const_int 0)])))] |
| 8136 |
"TARGET_ARM" |
| 8137 |
"#" ; "mvn%D1\\t%0, #0\;mvn%d1\\t%0, #1" |
| 8138 |
"TARGET_ARM" |
| 8139 |
[(set (match_dup 0) |
| 8140 |
(if_then_else:SI (match_dup 1) |
| 8141 |
(match_dup 3) |
| 8142 |
(match_dup 4)))] |
| 8143 |
{ |
| 8144 |
operands[3] = GEN_INT (~1); |
| 8145 |
operands[4] = GEN_INT (~0); |
| 8146 |
} |
| 8147 |
[(set_attr "conds" "use") |
| 8148 |
(set_attr "length" "8") |
| 8149 |
(set_attr "type" "multiple")] |
| 8150 |
) |
| 8151 |
|
| 8152 |
(define_expand "cstoresi4" |
| 8153 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8154 |
(match_operator:SI 1 "expandable_comparison_operator" |
| 8155 |
[(match_operand:SI 2 "s_register_operand") |
| 8156 |
(match_operand:SI 3 "reg_or_int_operand")]))] |
| 8157 |
"TARGET_32BIT || TARGET_THUMB1" |
| 8158 |
"{ |
| 8159 |
rtx op3, scratch, scratch2; |
| 8160 |
|
| 8161 |
if (!TARGET_THUMB1) |
| 8162 |
{ |
| 8163 |
if (!arm_add_operand (operands[3], SImode)) |
| 8164 |
operands[3] = force_reg (SImode, operands[3]); |
| 8165 |
emit_insn (gen_cstore_cc (operands[0], operands[1], |
| 8166 |
operands[2], operands[3])); |
| 8167 |
DONE; |
| 8168 |
} |
| 8169 |
|
| 8170 |
if (operands[3] == const0_rtx) |
| 8171 |
{ |
| 8172 |
switch (GET_CODE (operands[1])) |
| 8173 |
{ |
| 8174 |
case EQ: |
| 8175 |
emit_insn (gen_cstoresi_eq0_thumb1 (operands[0], operands[2])); |
| 8176 |
break; |
| 8177 |
|
| 8178 |
case NE: |
| 8179 |
emit_insn (gen_cstoresi_ne0_thumb1 (operands[0], operands[2])); |
| 8180 |
break; |
| 8181 |
|
| 8182 |
case LE: |
| 8183 |
scratch = expand_binop (SImode, add_optab, operands[2], constm1_rtx, |
| 8184 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8185 |
scratch = expand_binop (SImode, ior_optab, operands[2], scratch, |
| 8186 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8187 |
expand_binop (SImode, lshr_optab, scratch, GEN_INT (31), |
| 8188 |
operands[0], 1, OPTAB_WIDEN); |
| 8189 |
break; |
| 8190 |
|
| 8191 |
case GE: |
| 8192 |
scratch = expand_unop (SImode, one_cmpl_optab, operands[2], |
| 8193 |
NULL_RTX, 1); |
| 8194 |
expand_binop (SImode, lshr_optab, scratch, GEN_INT (31), |
| 8195 |
NULL_RTX, 1, OPTAB_WIDEN); |
| 8196 |
break; |
| 8197 |
|
| 8198 |
case GT: |
| 8199 |
scratch = expand_binop (SImode, ashr_optab, operands[2], |
| 8200 |
GEN_INT (31), NULL_RTX, 0, OPTAB_WIDEN); |
| 8201 |
scratch = expand_binop (SImode, sub_optab, scratch, operands[2], |
| 8202 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8203 |
expand_binop (SImode, lshr_optab, scratch, GEN_INT (31), operands[0], |
| 8204 |
0, OPTAB_WIDEN); |
| 8205 |
break; |
| 8206 |
|
| 8207 |
/* LT is handled by generic code. No need for unsigned with 0. */ |
| 8208 |
default: |
| 8209 |
FAIL; |
| 8210 |
} |
| 8211 |
DONE; |
| 8212 |
} |
| 8213 |
|
| 8214 |
switch (GET_CODE (operands[1])) |
| 8215 |
{ |
| 8216 |
case EQ: |
| 8217 |
scratch = expand_binop (SImode, sub_optab, operands[2], operands[3], |
| 8218 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8219 |
emit_insn (gen_cstoresi_eq0_thumb1 (operands[0], scratch)); |
| 8220 |
break; |
| 8221 |
|
| 8222 |
case NE: |
| 8223 |
scratch = expand_binop (SImode, sub_optab, operands[2], operands[3], |
| 8224 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8225 |
emit_insn (gen_cstoresi_ne0_thumb1 (operands[0], scratch)); |
| 8226 |
break; |
| 8227 |
|
| 8228 |
case LE: |
| 8229 |
op3 = force_reg (SImode, operands[3]); |
| 8230 |
|
| 8231 |
scratch = expand_binop (SImode, lshr_optab, operands[2], GEN_INT (31), |
| 8232 |
NULL_RTX, 1, OPTAB_WIDEN); |
| 8233 |
scratch2 = expand_binop (SImode, ashr_optab, op3, GEN_INT (31), |
| 8234 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8235 |
emit_insn (gen_thumb1_addsi3_addgeu (operands[0], scratch, scratch2, |
| 8236 |
op3, operands[2])); |
| 8237 |
break; |
| 8238 |
|
| 8239 |
case GE: |
| 8240 |
op3 = operands[3]; |
| 8241 |
if (!thumb1_cmp_operand (op3, SImode)) |
| 8242 |
op3 = force_reg (SImode, op3); |
| 8243 |
scratch = expand_binop (SImode, ashr_optab, operands[2], GEN_INT (31), |
| 8244 |
NULL_RTX, 0, OPTAB_WIDEN); |
| 8245 |
scratch2 = expand_binop (SImode, lshr_optab, op3, GEN_INT (31), |
| 8246 |
NULL_RTX, 1, OPTAB_WIDEN); |
| 8247 |
emit_insn (gen_thumb1_addsi3_addgeu (operands[0], scratch, scratch2, |
| 8248 |
operands[2], op3)); |
| 8249 |
break; |
| 8250 |
|
| 8251 |
case LEU: |
| 8252 |
op3 = force_reg (SImode, operands[3]); |
| 8253 |
scratch = force_reg (SImode, const0_rtx); |
| 8254 |
emit_insn (gen_thumb1_addsi3_addgeu (operands[0], scratch, scratch, |
| 8255 |
op3, operands[2])); |
| 8256 |
break; |
| 8257 |
|
| 8258 |
case GEU: |
| 8259 |
op3 = operands[3]; |
| 8260 |
if (!thumb1_cmp_operand (op3, SImode)) |
| 8261 |
op3 = force_reg (SImode, op3); |
| 8262 |
scratch = force_reg (SImode, const0_rtx); |
| 8263 |
emit_insn (gen_thumb1_addsi3_addgeu (operands[0], scratch, scratch, |
| 8264 |
operands[2], op3)); |
| 8265 |
break; |
| 8266 |
|
| 8267 |
case LTU: |
| 8268 |
op3 = operands[3]; |
| 8269 |
if (!thumb1_cmp_operand (op3, SImode)) |
| 8270 |
op3 = force_reg (SImode, op3); |
| 8271 |
scratch = gen_reg_rtx (SImode); |
| 8272 |
emit_insn (gen_cstoresi_ltu_thumb1 (operands[0], operands[2], op3)); |
| 8273 |
break; |
| 8274 |
|
| 8275 |
case GTU: |
| 8276 |
op3 = force_reg (SImode, operands[3]); |
| 8277 |
scratch = gen_reg_rtx (SImode); |
| 8278 |
emit_insn (gen_cstoresi_ltu_thumb1 (operands[0], op3, operands[2])); |
| 8279 |
break; |
| 8280 |
|
| 8281 |
/* No good sequences for GT, LT. */ |
| 8282 |
default: |
| 8283 |
FAIL; |
| 8284 |
} |
| 8285 |
DONE; |
| 8286 |
}") |
| 8287 |
|
| 8288 |
(define_expand "cstorehf4" |
| 8289 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8290 |
(match_operator:SI 1 "expandable_comparison_operator" |
| 8291 |
[(match_operand:HF 2 "s_register_operand") |
| 8292 |
(match_operand:HF 3 "vfp_compare_operand")]))] |
| 8293 |
"TARGET_VFP_FP16INST" |
| 8294 |
{ |
| 8295 |
if (!arm_validize_comparison (&operands[1], |
| 8296 |
&operands[2], |
| 8297 |
&operands[3])) |
| 8298 |
FAIL; |
| 8299 |
|
| 8300 |
emit_insn (gen_cstore_cc (operands[0], operands[1], |
| 8301 |
operands[2], operands[3])); |
| 8302 |
DONE; |
| 8303 |
} |
| 8304 |
) |
| 8305 |
|
| 8306 |
(define_expand "cstoresf4" |
| 8307 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8308 |
(match_operator:SI 1 "expandable_comparison_operator" |
| 8309 |
[(match_operand:SF 2 "s_register_operand") |
| 8310 |
(match_operand:SF 3 "vfp_compare_operand")]))] |
| 8311 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 8312 |
"emit_insn (gen_cstore_cc (operands[0], operands[1], |
| 8313 |
operands[2], operands[3])); DONE;" |
| 8314 |
) |
| 8315 |
|
| 8316 |
(define_expand "cstoredf4" |
| 8317 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8318 |
(match_operator:SI 1 "expandable_comparison_operator" |
| 8319 |
[(match_operand:DF 2 "s_register_operand") |
| 8320 |
(match_operand:DF 3 "vfp_compare_operand")]))] |
| 8321 |
"TARGET_32BIT && TARGET_HARD_FLOAT && !TARGET_VFP_SINGLE" |
| 8322 |
"emit_insn (gen_cstore_cc (operands[0], operands[1], |
| 8323 |
operands[2], operands[3])); DONE;" |
| 8324 |
) |
| 8325 |
|
| 8326 |
(define_expand "cstoredi4" |
| 8327 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8328 |
(match_operator:SI 1 "expandable_comparison_operator" |
| 8329 |
[(match_operand:DI 2 "s_register_operand") |
| 8330 |
(match_operand:DI 3 "reg_or_int_operand")]))] |
| 8331 |
"TARGET_32BIT" |
| 8332 |
"{ |
| 8333 |
if (!arm_validize_comparison (&operands[1], |
| 8334 |
&operands[2], |
| 8335 |
&operands[3])) |
| 8336 |
FAIL; |
| 8337 |
emit_insn (gen_cstore_cc (operands[0], operands[1], operands[2], |
| 8338 |
operands[3])); |
| 8339 |
DONE; |
| 8340 |
}" |
| 8341 |
) |
| 8342 |
|
| 8343 |
|
| 8344 |
;; Conditional move insns |
| 8345 |
|
| 8346 |
(define_expand "movsicc" |
| 8347 |
[(set (match_operand:SI 0 "s_register_operand") |
| 8348 |
(if_then_else:SI (match_operand 1 "expandable_comparison_operator") |
| 8349 |
(match_operand:SI 2 "arm_not_operand") |
| 8350 |
(match_operand:SI 3 "arm_not_operand")))] |
| 8351 |
"TARGET_32BIT" |
| 8352 |
" |
| 8353 |
{ |
| 8354 |
enum rtx_code code; |
| 8355 |
rtx ccreg; |
| 8356 |
|
| 8357 |
if (!arm_validize_comparison (&operands[1], &XEXP (operands[1], 0), |
| 8358 |
&XEXP (operands[1], 1))) |
| 8359 |
FAIL; |
| 8360 |
|
| 8361 |
code = GET_CODE (operands[1]); |
| 8362 |
ccreg = arm_gen_compare_reg (code, XEXP (operands[1], 0), |
| 8363 |
XEXP (operands[1], 1), NULL_RTX); |
| 8364 |
operands[1] = gen_rtx_fmt_ee (code, VOIDmode, ccreg, const0_rtx); |
| 8365 |
}" |
| 8366 |
) |
| 8367 |
|
| 8368 |
(define_expand "movhfcc" |
| 8369 |
[(set (match_operand:HF 0 "s_register_operand") |
| 8370 |
(if_then_else:HF (match_operand 1 "expandable_comparison_operator") |
| 8371 |
(match_operand:HF 2 "s_register_operand") |
| 8372 |
(match_operand:HF 3 "s_register_operand")))] |
| 8373 |
"TARGET_VFP_FP16INST" |
| 8374 |
" |
| 8375 |
{ |
| 8376 |
enum rtx_code code = GET_CODE (operands[1]); |
| 8377 |
rtx ccreg; |
| 8378 |
|
| 8379 |
if (!arm_validize_comparison (&operands[1], &XEXP (operands[1], 0), |
| 8380 |
&XEXP (operands[1], 1))) |
| 8381 |
FAIL; |
| 8382 |
|
| 8383 |
code = GET_CODE (operands[1]); |
| 8384 |
ccreg = arm_gen_compare_reg (code, XEXP (operands[1], 0), |
| 8385 |
XEXP (operands[1], 1), NULL_RTX); |
| 8386 |
operands[1] = gen_rtx_fmt_ee (code, VOIDmode, ccreg, const0_rtx); |
| 8387 |
}" |
| 8388 |
) |
| 8389 |
|
| 8390 |
(define_expand "movsfcc" |
| 8391 |
[(set (match_operand:SF 0 "s_register_operand") |
| 8392 |
(if_then_else:SF (match_operand 1 "expandable_comparison_operator") |
| 8393 |
(match_operand:SF 2 "s_register_operand") |
| 8394 |
(match_operand:SF 3 "s_register_operand")))] |
| 8395 |
"TARGET_32BIT && TARGET_HARD_FLOAT" |
| 8396 |
" |
| 8397 |
{ |
| 8398 |
enum rtx_code code = GET_CODE (operands[1]); |
| 8399 |
rtx ccreg; |
| 8400 |
|
| 8401 |
/* Perverse combinations of architecture options can't be supported |
| 8402 |
as they need conditional instructions. */ |
| 8403 |
if (TARGET_THUMB2 && arm_restrict_it && !TARGET_VFP5) |
| 8404 |
FAIL; |
| 8405 |
if (!arm_validize_comparison (&operands[1], &XEXP (operands[1], 0), |
| 8406 |
&XEXP (operands[1], 1))) |
| 8407 |
FAIL; |
| 8408 |
|
| 8409 |
code = GET_CODE (operands[1]); |
| 8410 |
ccreg = arm_gen_compare_reg (code, XEXP (operands[1], 0), |
| 8411 |
XEXP (operands[1], 1), NULL_RTX); |
| 8412 |
operands[1] = gen_rtx_fmt_ee (code, VOIDmode, ccreg, const0_rtx); |
| 8413 |
}" |
| 8414 |
) |
| 8415 |
|
| 8416 |
(define_expand "movdfcc" |
| 8417 |
[(set (match_operand:DF 0 "s_register_operand") |
| 8418 |
(if_then_else:DF (match_operand 1 "expandable_comparison_operator") |
| 8419 |
(match_operand:DF 2 "s_register_operand") |
| 8420 |
(match_operand:DF 3 "s_register_operand")))] |
| 8421 |
"TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP_DOUBLE" |
| 8422 |
" |
| 8423 |
{ |
| 8424 |
enum rtx_code code = GET_CODE (operands[1]); |
| 8425 |
rtx ccreg; |
| 8426 |
|
| 8427 |
/* Perverse combinations of architecture options can't be supported |
| 8428 |
as they need conditional instructions. */ |
| 8429 |
if (TARGET_THUMB2 && arm_restrict_it && !TARGET_VFP5) |
| 8430 |
FAIL; |
| 8431 |
if (!arm_validize_comparison (&operands[1], &XEXP (operands[1], 0), |
| 8432 |
&XEXP (operands[1], 1))) |
| 8433 |
FAIL; |
| 8434 |
code = GET_CODE (operands[1]); |
| 8435 |
ccreg = arm_gen_compare_reg (code, XEXP (operands[1], 0), |
| 8436 |
XEXP (operands[1], 1), NULL_RTX); |
| 8437 |
operands[1] = gen_rtx_fmt_ee (code, VOIDmode, ccreg, const0_rtx); |
| 8438 |
}" |
| 8439 |
) |
| 8440 |
|
| 8441 |
(define_insn "*cmov<mode>" |
| 8442 |
[(set (match_operand:SDF 0 "s_register_operand" "=<F_constraint>") |
| 8443 |
(if_then_else:SDF (match_operator 1 "arm_vsel_comparison_operator" |
| 8444 |
[(match_operand 2 "cc_register" "") (const_int 0)]) |
| 8445 |
(match_operand:SDF 3 "s_register_operand" |
| 8446 |
"<F_constraint>") |
| 8447 |
(match_operand:SDF 4 "s_register_operand" |
| 8448 |
"<F_constraint>")))] |
| 8449 |
"TARGET_HARD_FLOAT && TARGET_VFP5 <vfp_double_cond>" |
| 8450 |
"* |
| 8451 |
{ |
| 8452 |
enum arm_cond_code code = maybe_get_arm_condition_code (operands[1]); |
| 8453 |
switch (code) |
| 8454 |
{ |
| 8455 |
case ARM_GE: |
| 8456 |
case ARM_GT: |
| 8457 |
case ARM_EQ: |
| 8458 |
case ARM_VS: |
| 8459 |
return \"vsel%d1.<V_if_elem>\\t%<V_reg>0, %<V_reg>3, %<V_reg>4\"; |
| 8460 |
case ARM_LT: |
| 8461 |
case ARM_LE: |
| 8462 |
case ARM_NE: |
| 8463 |
case ARM_VC: |
| 8464 |
return \"vsel%D1.<V_if_elem>\\t%<V_reg>0, %<V_reg>4, %<V_reg>3\"; |
| 8465 |
default: |
| 8466 |
gcc_unreachable (); |
| 8467 |
} |
| 8468 |
return \"\"; |
| 8469 |
}" |
| 8470 |
[(set_attr "conds" "use") |
| 8471 |
(set_attr "type" "fcsel")] |
| 8472 |
) |
| 8473 |
|
| 8474 |
(define_insn "*cmovhf" |
| 8475 |
[(set (match_operand:HF 0 "s_register_operand" "=t") |
| 8476 |
(if_then_else:HF (match_operator 1 "arm_vsel_comparison_operator" |
| 8477 |
[(match_operand 2 "cc_register" "") (const_int 0)]) |
| 8478 |
(match_operand:HF 3 "s_register_operand" "t") |
| 8479 |
(match_operand:HF 4 "s_register_operand" "t")))] |
| 8480 |
"TARGET_VFP_FP16INST" |
| 8481 |
"* |
| 8482 |
{ |
| 8483 |
enum arm_cond_code code = maybe_get_arm_condition_code (operands[1]); |
| 8484 |
switch (code) |
| 8485 |
{ |
| 8486 |
case ARM_GE: |
| 8487 |
case ARM_GT: |
| 8488 |
case ARM_EQ: |
| 8489 |
case ARM_VS: |
| 8490 |
return \"vsel%d1.f16\\t%0, %3, %4\"; |
| 8491 |
case ARM_LT: |
| 8492 |
case ARM_LE: |
| 8493 |
case ARM_NE: |
| 8494 |
case ARM_VC: |
| 8495 |
return \"vsel%D1.f16\\t%0, %4, %3\"; |
| 8496 |
default: |
| 8497 |
gcc_unreachable (); |
| 8498 |
} |
| 8499 |
return \"\"; |
| 8500 |
}" |
| 8501 |
[(set_attr "conds" "use") |
| 8502 |
(set_attr "type" "fcsel")] |
| 8503 |
) |
| 8504 |
|
| 8505 |
(define_insn_and_split "*movsicc_insn" |
| 8506 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r,r,r,r,r") |
| 8507 |
(if_then_else:SI |
| 8508 |
(match_operator 3 "arm_comparison_operator" |
| 8509 |
[(match_operand 4 "cc_register" "") (const_int 0)]) |
| 8510 |
(match_operand:SI 1 "arm_not_operand" "0,0,rI,K,rI,rI,K,K") |
| 8511 |
(match_operand:SI 2 "arm_not_operand" "rI,K,0,0,rI,K,rI,K")))] |
| 8512 |
"TARGET_ARM" |
| 8513 |
"@ |
| 8514 |
mov%D3\\t%0, %2 |
| 8515 |
mvn%D3\\t%0, #%B2 |
| 8516 |
mov%d3\\t%0, %1 |
| 8517 |
mvn%d3\\t%0, #%B1 |
| 8518 |
# |
| 8519 |
# |
| 8520 |
# |
| 8521 |
#" |
| 8522 |
; alt4: mov%d3\\t%0, %1\;mov%D3\\t%0, %2 |
| 8523 |
; alt5: mov%d3\\t%0, %1\;mvn%D3\\t%0, #%B2 |
| 8524 |
; alt6: mvn%d3\\t%0, #%B1\;mov%D3\\t%0, %2 |
| 8525 |
; alt7: mvn%d3\\t%0, #%B1\;mvn%D3\\t%0, #%B2" |
| 8526 |
"&& reload_completed" |
| 8527 |
[(const_int 0)] |
| 8528 |
{ |
| 8529 |
enum rtx_code rev_code; |
| 8530 |
machine_mode mode; |
| 8531 |
rtx rev_cond; |
| 8532 |
|
| 8533 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 8534 |
operands[3], |
| 8535 |
gen_rtx_SET (operands[0], operands[1]))); |
| 8536 |
|
| 8537 |
rev_code = GET_CODE (operands[3]); |
| 8538 |
mode = GET_MODE (operands[4]); |
| 8539 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 8540 |
rev_code = reverse_condition_maybe_unordered (rev_code); |
| 8541 |
else |
| 8542 |
rev_code = reverse_condition (rev_code); |
| 8543 |
|
| 8544 |
rev_cond = gen_rtx_fmt_ee (rev_code, |
| 8545 |
VOIDmode, |
| 8546 |
operands[4], |
| 8547 |
const0_rtx); |
| 8548 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 8549 |
rev_cond, |
| 8550 |
gen_rtx_SET (operands[0], operands[2]))); |
| 8551 |
DONE; |
| 8552 |
} |
| 8553 |
[(set_attr "length" "4,4,4,4,8,8,8,8") |
| 8554 |
(set_attr "conds" "use") |
| 8555 |
(set_attr_alternative "type" |
| 8556 |
[(if_then_else (match_operand 2 "const_int_operand" "") |
| 8557 |
(const_string "mov_imm") |
| 8558 |
(const_string "mov_reg")) |
| 8559 |
(const_string "mvn_imm") |
| 8560 |
(if_then_else (match_operand 1 "const_int_operand" "") |
| 8561 |
(const_string "mov_imm") |
| 8562 |
(const_string "mov_reg")) |
| 8563 |
(const_string "mvn_imm") |
| 8564 |
(const_string "multiple") |
| 8565 |
(const_string "multiple") |
| 8566 |
(const_string "multiple") |
| 8567 |
(const_string "multiple")])] |
| 8568 |
) |
| 8569 |
|
| 8570 |
(define_insn "*movsfcc_soft_insn" |
| 8571 |
[(set (match_operand:SF 0 "s_register_operand" "=r,r") |
| 8572 |
(if_then_else:SF (match_operator 3 "arm_comparison_operator" |
| 8573 |
[(match_operand 4 "cc_register" "") (const_int 0)]) |
| 8574 |
(match_operand:SF 1 "s_register_operand" "0,r") |
| 8575 |
(match_operand:SF 2 "s_register_operand" "r,0")))] |
| 8576 |
"TARGET_ARM && TARGET_SOFT_FLOAT" |
| 8577 |
"@ |
| 8578 |
mov%D3\\t%0, %2 |
| 8579 |
mov%d3\\t%0, %1" |
| 8580 |
[(set_attr "conds" "use") |
| 8581 |
(set_attr "type" "mov_reg")] |
| 8582 |
) |
| 8583 |
|
| 8584 |
|
| 8585 |
;; Jump and linkage insns |
| 8586 |
|
| 8587 |
(define_expand "jump" |
| 8588 |
[(set (pc) |
| 8589 |
(label_ref (match_operand 0 "" "")))] |
| 8590 |
"TARGET_EITHER" |
| 8591 |
"" |
| 8592 |
) |
| 8593 |
|
| 8594 |
(define_insn "*arm_jump" |
| 8595 |
[(set (pc) |
| 8596 |
(label_ref (match_operand 0 "" "")))] |
| 8597 |
"TARGET_32BIT" |
| 8598 |
"* |
| 8599 |
{ |
| 8600 |
if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2) |
| 8601 |
{ |
| 8602 |
arm_ccfsm_state += 2; |
| 8603 |
return \"\"; |
| 8604 |
} |
| 8605 |
return \"b%?\\t%l0\"; |
| 8606 |
} |
| 8607 |
" |
| 8608 |
[(set_attr "predicable" "yes") |
| 8609 |
(set (attr "length") |
| 8610 |
(if_then_else |
| 8611 |
(and (match_test "TARGET_THUMB2") |
| 8612 |
(and (ge (minus (match_dup 0) (pc)) (const_int -2044)) |
| 8613 |
(le (minus (match_dup 0) (pc)) (const_int 2048)))) |
| 8614 |
(const_int 2) |
| 8615 |
(const_int 4))) |
| 8616 |
(set_attr "type" "branch")] |
| 8617 |
) |
| 8618 |
|
| 8619 |
(define_expand "call" |
| 8620 |
[(parallel [(call (match_operand 0 "memory_operand") |
| 8621 |
(match_operand 1 "general_operand")) |
| 8622 |
(use (match_operand 2 "" "")) |
| 8623 |
(clobber (reg:SI LR_REGNUM))])] |
| 8624 |
"TARGET_EITHER" |
| 8625 |
" |
| 8626 |
{ |
| 8627 |
rtx callee, pat; |
| 8628 |
tree addr = MEM_EXPR (operands[0]); |
| 8629 |
|
| 8630 |
/* In an untyped call, we can get NULL for operand 2. */ |
| 8631 |
if (operands[2] == NULL_RTX) |
| 8632 |
operands[2] = const0_rtx; |
| 8633 |
|
| 8634 |
/* Decide if we should generate indirect calls by loading the |
| 8635 |
32-bit address of the callee into a register before performing the |
| 8636 |
branch and link. */ |
| 8637 |
callee = XEXP (operands[0], 0); |
| 8638 |
if (GET_CODE (callee) == SYMBOL_REF |
| 8639 |
? arm_is_long_call_p (SYMBOL_REF_DECL (callee)) |
| 8640 |
: !REG_P (callee)) |
| 8641 |
XEXP (operands[0], 0) = force_reg (Pmode, callee); |
| 8642 |
|
| 8643 |
if (TARGET_FDPIC && !SYMBOL_REF_P (XEXP (operands[0], 0))) |
| 8644 |
/* Indirect call: set r9 with FDPIC value of callee. */ |
| 8645 |
XEXP (operands[0], 0) |
| 8646 |
= arm_load_function_descriptor (XEXP (operands[0], 0)); |
| 8647 |
|
| 8648 |
if (detect_cmse_nonsecure_call (addr)) |
| 8649 |
{ |
| 8650 |
pat = gen_nonsecure_call_internal (operands[0], operands[1], |
| 8651 |
operands[2]); |
| 8652 |
emit_call_insn (pat); |
| 8653 |
} |
| 8654 |
else |
| 8655 |
{ |
| 8656 |
pat = gen_call_internal (operands[0], operands[1], operands[2]); |
| 8657 |
arm_emit_call_insn (pat, XEXP (operands[0], 0), false); |
| 8658 |
} |
| 8659 |
|
| 8660 |
/* Restore FDPIC register (r9) after call. */ |
| 8661 |
if (TARGET_FDPIC) |
| 8662 |
{ |
| 8663 |
rtx fdpic_reg = gen_rtx_REG (Pmode, FDPIC_REGNUM); |
| 8664 |
rtx initial_fdpic_reg |
| 8665 |
= get_hard_reg_initial_val (Pmode, FDPIC_REGNUM); |
| 8666 |
|
| 8667 |
emit_insn (gen_restore_pic_register_after_call (fdpic_reg, |
| 8668 |
initial_fdpic_reg)); |
| 8669 |
} |
| 8670 |
|
| 8671 |
DONE; |
| 8672 |
}" |
| 8673 |
) |
| 8674 |
|
| 8675 |
(define_insn "restore_pic_register_after_call" |
| 8676 |
[(set (match_operand:SI 0 "s_register_operand" "+r,r") |
| 8677 |
(unspec:SI [(match_dup 0) |
| 8678 |
(match_operand:SI 1 "nonimmediate_operand" "r,m")] |
| 8679 |
UNSPEC_PIC_RESTORE))] |
| 8680 |
"" |
| 8681 |
"@ |
| 8682 |
mov\t%0, %1 |
| 8683 |
ldr\t%0, %1" |
| 8684 |
) |
| 8685 |
|
| 8686 |
(define_expand "call_internal" |
| 8687 |
[(parallel [(call (match_operand 0 "memory_operand") |
| 8688 |
(match_operand 1 "general_operand")) |
| 8689 |
(use (match_operand 2 "" "")) |
| 8690 |
(clobber (reg:SI LR_REGNUM))])]) |
| 8691 |
|
| 8692 |
(define_expand "nonsecure_call_internal" |
| 8693 |
[(parallel [(call (unspec:SI [(match_operand 0 "memory_operand")] |
| 8694 |
UNSPEC_NONSECURE_MEM) |
| 8695 |
(match_operand 1 "general_operand")) |
| 8696 |
(use (match_operand 2 "" "")) |
| 8697 |
(clobber (reg:SI LR_REGNUM))])] |
| 8698 |
"use_cmse" |
| 8699 |
{ |
| 8700 |
rtx addr = XEXP (operands[0], 0); |
| 8701 |
rtx tmp = REG_P (addr) ? addr : force_reg (SImode, addr); |
| 8702 |
|
| 8703 |
if (!TARGET_HAVE_FPCXT_CMSE) |
| 8704 |
{ |
| 8705 |
rtx r4 = gen_rtx_REG (SImode, R4_REGNUM); |
| 8706 |
emit_move_insn (r4, tmp); |
| 8707 |
tmp = r4; |
| 8708 |
} |
| 8709 |
|
| 8710 |
if (tmp != addr) |
| 8711 |
operands[0] = replace_equiv_address (operands[0], tmp); |
| 8712 |
} |
| 8713 |
) |
| 8714 |
|
| 8715 |
(define_insn "*call_reg_armv5" |
| 8716 |
[(call (mem:SI (match_operand:SI 0 "s_register_operand" "r")) |
| 8717 |
(match_operand 1 "" "")) |
| 8718 |
(use (match_operand 2 "" "")) |
| 8719 |
(clobber (reg:SI LR_REGNUM))] |
| 8720 |
"TARGET_ARM && arm_arch5t && !SIBLING_CALL_P (insn)" |
| 8721 |
"blx%?\\t%0" |
| 8722 |
[(set_attr "type" "call")] |
| 8723 |
) |
| 8724 |
|
| 8725 |
(define_insn "*call_reg_arm" |
| 8726 |
[(call (mem:SI (match_operand:SI 0 "s_register_operand" "r")) |
| 8727 |
(match_operand 1 "" "")) |
| 8728 |
(use (match_operand 2 "" "")) |
| 8729 |
(clobber (reg:SI LR_REGNUM))] |
| 8730 |
"TARGET_ARM && !arm_arch5t && !SIBLING_CALL_P (insn)" |
| 8731 |
"* |
| 8732 |
return output_call (operands); |
| 8733 |
" |
| 8734 |
;; length is worst case, normally it is only two |
| 8735 |
[(set_attr "length" "12") |
| 8736 |
(set_attr "type" "call")] |
| 8737 |
) |
| 8738 |
|
| 8739 |
|
| 8740 |
(define_expand "call_value" |
| 8741 |
[(parallel [(set (match_operand 0 "" "") |
| 8742 |
(call (match_operand 1 "memory_operand") |
| 8743 |
(match_operand 2 "general_operand"))) |
| 8744 |
(use (match_operand 3 "" "")) |
| 8745 |
(clobber (reg:SI LR_REGNUM))])] |
| 8746 |
"TARGET_EITHER" |
| 8747 |
" |
| 8748 |
{ |
| 8749 |
rtx pat, callee; |
| 8750 |
tree addr = MEM_EXPR (operands[1]); |
| 8751 |
|
| 8752 |
/* In an untyped call, we can get NULL for operand 2. */ |
| 8753 |
if (operands[3] == 0) |
| 8754 |
operands[3] = const0_rtx; |
| 8755 |
|
| 8756 |
/* Decide if we should generate indirect calls by loading the |
| 8757 |
32-bit address of the callee into a register before performing the |
| 8758 |
branch and link. */ |
| 8759 |
callee = XEXP (operands[1], 0); |
| 8760 |
if (GET_CODE (callee) == SYMBOL_REF |
| 8761 |
? arm_is_long_call_p (SYMBOL_REF_DECL (callee)) |
| 8762 |
: !REG_P (callee)) |
| 8763 |
XEXP (operands[1], 0) = force_reg (Pmode, callee); |
| 8764 |
|
| 8765 |
if (TARGET_FDPIC && !SYMBOL_REF_P (XEXP (operands[1], 0))) |
| 8766 |
/* Indirect call: set r9 with FDPIC value of callee. */ |
| 8767 |
XEXP (operands[1], 0) |
| 8768 |
= arm_load_function_descriptor (XEXP (operands[1], 0)); |
| 8769 |
|
| 8770 |
if (detect_cmse_nonsecure_call (addr)) |
| 8771 |
{ |
| 8772 |
pat = gen_nonsecure_call_value_internal (operands[0], operands[1], |
| 8773 |
operands[2], operands[3]); |
| 8774 |
emit_call_insn (pat); |
| 8775 |
} |
| 8776 |
else |
| 8777 |
{ |
| 8778 |
pat = gen_call_value_internal (operands[0], operands[1], |
| 8779 |
operands[2], operands[3]); |
| 8780 |
arm_emit_call_insn (pat, XEXP (operands[1], 0), false); |
| 8781 |
} |
| 8782 |
|
| 8783 |
/* Restore FDPIC register (r9) after call. */ |
| 8784 |
if (TARGET_FDPIC) |
| 8785 |
{ |
| 8786 |
rtx fdpic_reg = gen_rtx_REG (Pmode, FDPIC_REGNUM); |
| 8787 |
rtx initial_fdpic_reg |
| 8788 |
= get_hard_reg_initial_val (Pmode, FDPIC_REGNUM); |
| 8789 |
|
| 8790 |
emit_insn (gen_restore_pic_register_after_call (fdpic_reg, |
| 8791 |
initial_fdpic_reg)); |
| 8792 |
} |
| 8793 |
|
| 8794 |
DONE; |
| 8795 |
}" |
| 8796 |
) |
| 8797 |
|
| 8798 |
(define_expand "call_value_internal" |
| 8799 |
[(parallel [(set (match_operand 0 "" "") |
| 8800 |
(call (match_operand 1 "memory_operand") |
| 8801 |
(match_operand 2 "general_operand"))) |
| 8802 |
(use (match_operand 3 "" "")) |
| 8803 |
(clobber (reg:SI LR_REGNUM))])]) |
| 8804 |
|
| 8805 |
(define_expand "nonsecure_call_value_internal" |
| 8806 |
[(parallel [(set (match_operand 0 "" "") |
| 8807 |
(call (unspec:SI [(match_operand 1 "memory_operand")] |
| 8808 |
UNSPEC_NONSECURE_MEM) |
| 8809 |
(match_operand 2 "general_operand"))) |
| 8810 |
(use (match_operand 3 "" "")) |
| 8811 |
(clobber (reg:SI LR_REGNUM))])] |
| 8812 |
"use_cmse" |
| 8813 |
" |
| 8814 |
{ |
| 8815 |
if (!TARGET_HAVE_FPCXT_CMSE) |
| 8816 |
{ |
| 8817 |
rtx tmp = |
| 8818 |
copy_to_suggested_reg (XEXP (operands[1], 0), |
| 8819 |
gen_rtx_REG (SImode, R4_REGNUM), |
| 8820 |
SImode); |
| 8821 |
|
| 8822 |
operands[1] = replace_equiv_address (operands[1], tmp); |
| 8823 |
} |
| 8824 |
}") |
| 8825 |
|
| 8826 |
(define_insn "*call_value_reg_armv5" |
| 8827 |
[(set (match_operand 0 "" "") |
| 8828 |
(call (mem:SI (match_operand:SI 1 "s_register_operand" "r")) |
| 8829 |
(match_operand 2 "" ""))) |
| 8830 |
(use (match_operand 3 "" "")) |
| 8831 |
(clobber (reg:SI LR_REGNUM))] |
| 8832 |
"TARGET_ARM && arm_arch5t && !SIBLING_CALL_P (insn)" |
| 8833 |
"blx%?\\t%1" |
| 8834 |
[(set_attr "type" "call")] |
| 8835 |
) |
| 8836 |
|
| 8837 |
(define_insn "*call_value_reg_arm" |
| 8838 |
[(set (match_operand 0 "" "") |
| 8839 |
(call (mem:SI (match_operand:SI 1 "s_register_operand" "r")) |
| 8840 |
(match_operand 2 "" ""))) |
| 8841 |
(use (match_operand 3 "" "")) |
| 8842 |
(clobber (reg:SI LR_REGNUM))] |
| 8843 |
"TARGET_ARM && !arm_arch5t && !SIBLING_CALL_P (insn)" |
| 8844 |
"* |
| 8845 |
return output_call (&operands[1]); |
| 8846 |
" |
| 8847 |
[(set_attr "length" "12") |
| 8848 |
(set_attr "type" "call")] |
| 8849 |
) |
| 8850 |
|
| 8851 |
;; Allow calls to SYMBOL_REFs specially as they are not valid general addresses |
| 8852 |
;; The 'a' causes the operand to be treated as an address, i.e. no '#' output. |
| 8853 |
|
| 8854 |
(define_insn "*call_symbol" |
| 8855 |
[(call (mem:SI (match_operand:SI 0 "" "")) |
| 8856 |
(match_operand 1 "" "")) |
| 8857 |
(use (match_operand 2 "" "")) |
| 8858 |
(clobber (reg:SI LR_REGNUM))] |
| 8859 |
"TARGET_32BIT |
| 8860 |
&& !SIBLING_CALL_P (insn) |
| 8861 |
&& (GET_CODE (operands[0]) == SYMBOL_REF) |
| 8862 |
&& !arm_is_long_call_p (SYMBOL_REF_DECL (operands[0]))" |
| 8863 |
"* |
| 8864 |
{ |
| 8865 |
rtx op = operands[0]; |
| 8866 |
|
| 8867 |
/* Switch mode now when possible. */ |
| 8868 |
if (SYMBOL_REF_DECL (op) && !TREE_PUBLIC (SYMBOL_REF_DECL (op)) |
| 8869 |
&& arm_arch5t && arm_change_mode_p (SYMBOL_REF_DECL (op))) |
| 8870 |
return NEED_PLT_RELOC ? \"blx%?\\t%a0(PLT)\" : \"blx%?\\t(%a0)\"; |
| 8871 |
|
| 8872 |
return NEED_PLT_RELOC ? \"bl%?\\t%a0(PLT)\" : \"bl%?\\t%a0\"; |
| 8873 |
}" |
| 8874 |
[(set_attr "type" "call")] |
| 8875 |
) |
| 8876 |
|
| 8877 |
(define_insn "*call_value_symbol" |
| 8878 |
[(set (match_operand 0 "" "") |
| 8879 |
(call (mem:SI (match_operand:SI 1 "" "")) |
| 8880 |
(match_operand:SI 2 "" ""))) |
| 8881 |
(use (match_operand 3 "" "")) |
| 8882 |
(clobber (reg:SI LR_REGNUM))] |
| 8883 |
"TARGET_32BIT |
| 8884 |
&& !SIBLING_CALL_P (insn) |
| 8885 |
&& (GET_CODE (operands[1]) == SYMBOL_REF) |
| 8886 |
&& !arm_is_long_call_p (SYMBOL_REF_DECL (operands[1]))" |
| 8887 |
"* |
| 8888 |
{ |
| 8889 |
rtx op = operands[1]; |
| 8890 |
|
| 8891 |
/* Switch mode now when possible. */ |
| 8892 |
if (SYMBOL_REF_DECL (op) && !TREE_PUBLIC (SYMBOL_REF_DECL (op)) |
| 8893 |
&& arm_arch5t && arm_change_mode_p (SYMBOL_REF_DECL (op))) |
| 8894 |
return NEED_PLT_RELOC ? \"blx%?\\t%a1(PLT)\" : \"blx%?\\t(%a1)\"; |
| 8895 |
|
| 8896 |
return NEED_PLT_RELOC ? \"bl%?\\t%a1(PLT)\" : \"bl%?\\t%a1\"; |
| 8897 |
}" |
| 8898 |
[(set_attr "type" "call")] |
| 8899 |
) |
| 8900 |
|
| 8901 |
(define_expand "sibcall_internal" |
| 8902 |
[(parallel [(call (match_operand 0 "memory_operand") |
| 8903 |
(match_operand 1 "general_operand")) |
| 8904 |
(return) |
| 8905 |
(use (match_operand 2 "" ""))])]) |
| 8906 |
|
| 8907 |
;; We may also be able to do sibcalls for Thumb, but it's much harder... |
| 8908 |
(define_expand "sibcall" |
| 8909 |
[(parallel [(call (match_operand 0 "memory_operand") |
| 8910 |
(match_operand 1 "general_operand")) |
| 8911 |
(return) |
| 8912 |
(use (match_operand 2 "" ""))])] |
| 8913 |
"TARGET_32BIT" |
| 8914 |
" |
| 8915 |
{ |
| 8916 |
rtx pat; |
| 8917 |
|
| 8918 |
if ((!REG_P (XEXP (operands[0], 0)) |
| 8919 |
&& GET_CODE (XEXP (operands[0], 0)) != SYMBOL_REF) |
| 8920 |
|| (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF |
| 8921 |
&& arm_is_long_call_p (SYMBOL_REF_DECL (XEXP (operands[0], 0))))) |
| 8922 |
XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0)); |
| 8923 |
|
| 8924 |
if (operands[2] == NULL_RTX) |
| 8925 |
operands[2] = const0_rtx; |
| 8926 |
|
| 8927 |
pat = gen_sibcall_internal (operands[0], operands[1], operands[2]); |
| 8928 |
arm_emit_call_insn (pat, operands[0], true); |
| 8929 |
DONE; |
| 8930 |
}" |
| 8931 |
) |
| 8932 |
|
| 8933 |
(define_expand "sibcall_value_internal" |
| 8934 |
[(parallel [(set (match_operand 0 "" "") |
| 8935 |
(call (match_operand 1 "memory_operand") |
| 8936 |
(match_operand 2 "general_operand"))) |
| 8937 |
(return) |
| 8938 |
(use (match_operand 3 "" ""))])]) |
| 8939 |
|
| 8940 |
(define_expand "sibcall_value" |
| 8941 |
[(parallel [(set (match_operand 0 "" "") |
| 8942 |
(call (match_operand 1 "memory_operand") |
| 8943 |
(match_operand 2 "general_operand"))) |
| 8944 |
(return) |
| 8945 |
(use (match_operand 3 "" ""))])] |
| 8946 |
"TARGET_32BIT" |
| 8947 |
" |
| 8948 |
{ |
| 8949 |
rtx pat; |
| 8950 |
|
| 8951 |
if ((!REG_P (XEXP (operands[1], 0)) |
| 8952 |
&& GET_CODE (XEXP (operands[1], 0)) != SYMBOL_REF) |
| 8953 |
|| (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF |
| 8954 |
&& arm_is_long_call_p (SYMBOL_REF_DECL (XEXP (operands[1], 0))))) |
| 8955 |
XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0)); |
| 8956 |
|
| 8957 |
if (operands[3] == NULL_RTX) |
| 8958 |
operands[3] = const0_rtx; |
| 8959 |
|
| 8960 |
pat = gen_sibcall_value_internal (operands[0], operands[1], |
| 8961 |
operands[2], operands[3]); |
| 8962 |
arm_emit_call_insn (pat, operands[1], true); |
| 8963 |
DONE; |
| 8964 |
}" |
| 8965 |
) |
| 8966 |
|
| 8967 |
(define_insn "*sibcall_insn" |
| 8968 |
[(call (mem:SI (match_operand:SI 0 "call_insn_operand" "Cs, US")) |
| 8969 |
(match_operand 1 "" "")) |
| 8970 |
(return) |
| 8971 |
(use (match_operand 2 "" ""))] |
| 8972 |
"TARGET_32BIT && SIBLING_CALL_P (insn)" |
| 8973 |
"* |
| 8974 |
if (which_alternative == 1) |
| 8975 |
return NEED_PLT_RELOC ? \"b%?\\t%a0(PLT)\" : \"b%?\\t%a0\"; |
| 8976 |
else |
| 8977 |
{ |
| 8978 |
if (arm_arch5t || arm_arch4t) |
| 8979 |
return \"bx%?\\t%0\\t%@ indirect register sibling call\"; |
| 8980 |
else |
| 8981 |
return \"mov%?\\t%|pc, %0\\t%@ indirect register sibling call\"; |
| 8982 |
} |
| 8983 |
" |
| 8984 |
[(set_attr "type" "call")] |
| 8985 |
) |
| 8986 |
|
| 8987 |
(define_insn "*sibcall_value_insn" |
| 8988 |
[(set (match_operand 0 "" "") |
| 8989 |
(call (mem:SI (match_operand:SI 1 "call_insn_operand" "Cs,US")) |
| 8990 |
(match_operand 2 "" ""))) |
| 8991 |
(return) |
| 8992 |
(use (match_operand 3 "" ""))] |
| 8993 |
"TARGET_32BIT && SIBLING_CALL_P (insn)" |
| 8994 |
"* |
| 8995 |
if (which_alternative == 1) |
| 8996 |
return NEED_PLT_RELOC ? \"b%?\\t%a1(PLT)\" : \"b%?\\t%a1\"; |
| 8997 |
else |
| 8998 |
{ |
| 8999 |
if (arm_arch5t || arm_arch4t) |
| 9000 |
return \"bx%?\\t%1\"; |
| 9001 |
else |
| 9002 |
return \"mov%?\\t%|pc, %1\\t@ indirect sibling call \"; |
| 9003 |
} |
| 9004 |
" |
| 9005 |
[(set_attr "type" "call")] |
| 9006 |
) |
| 9007 |
|
| 9008 |
(define_expand "<return_str>return" |
| 9009 |
[(RETURNS)] |
| 9010 |
"(TARGET_ARM || (TARGET_THUMB2 |
| 9011 |
&& ARM_FUNC_TYPE (arm_current_func_type ()) == ARM_FT_NORMAL |
| 9012 |
&& !IS_STACKALIGN (arm_current_func_type ()))) |
| 9013 |
<return_cond_false>" |
| 9014 |
" |
| 9015 |
{ |
| 9016 |
if (TARGET_THUMB2) |
| 9017 |
{ |
| 9018 |
thumb2_expand_return (<return_simple_p>); |
| 9019 |
DONE; |
| 9020 |
} |
| 9021 |
} |
| 9022 |
" |
| 9023 |
) |
| 9024 |
|
| 9025 |
;; Often the return insn will be the same as loading from memory, so set attr |
| 9026 |
(define_insn "*arm_return" |
| 9027 |
[(return)] |
| 9028 |
"TARGET_ARM && USE_RETURN_INSN (FALSE)" |
| 9029 |
"* |
| 9030 |
{ |
| 9031 |
if (arm_ccfsm_state == 2) |
| 9032 |
{ |
| 9033 |
arm_ccfsm_state += 2; |
| 9034 |
return \"\"; |
| 9035 |
} |
| 9036 |
return output_return_instruction (const_true_rtx, true, false, false); |
| 9037 |
}" |
| 9038 |
[(set_attr "type" "load_4") |
| 9039 |
(set_attr "length" "12") |
| 9040 |
(set_attr "predicable" "yes")] |
| 9041 |
) |
| 9042 |
|
| 9043 |
(define_insn "*cond_<return_str>return" |
| 9044 |
[(set (pc) |
| 9045 |
(if_then_else (match_operator 0 "arm_comparison_operator" |
| 9046 |
[(match_operand 1 "cc_register" "") (const_int 0)]) |
| 9047 |
(RETURNS) |
| 9048 |
(pc)))] |
| 9049 |
"TARGET_ARM <return_cond_true>" |
| 9050 |
"* |
| 9051 |
{ |
| 9052 |
if (arm_ccfsm_state == 2) |
| 9053 |
{ |
| 9054 |
arm_ccfsm_state += 2; |
| 9055 |
return \"\"; |
| 9056 |
} |
| 9057 |
return output_return_instruction (operands[0], true, false, |
| 9058 |
<return_simple_p>); |
| 9059 |
}" |
| 9060 |
[(set_attr "conds" "use") |
| 9061 |
(set_attr "length" "12") |
| 9062 |
(set_attr "type" "load_4")] |
| 9063 |
) |
| 9064 |
|
| 9065 |
(define_insn "*cond_<return_str>return_inverted" |
| 9066 |
[(set (pc) |
| 9067 |
(if_then_else (match_operator 0 "arm_comparison_operator" |
| 9068 |
[(match_operand 1 "cc_register" "") (const_int 0)]) |
| 9069 |
(pc) |
| 9070 |
(RETURNS)))] |
| 9071 |
"TARGET_ARM <return_cond_true>" |
| 9072 |
"* |
| 9073 |
{ |
| 9074 |
if (arm_ccfsm_state == 2) |
| 9075 |
{ |
| 9076 |
arm_ccfsm_state += 2; |
| 9077 |
return \"\"; |
| 9078 |
} |
| 9079 |
return output_return_instruction (operands[0], true, true, |
| 9080 |
<return_simple_p>); |
| 9081 |
}" |
| 9082 |
[(set_attr "conds" "use") |
| 9083 |
(set_attr "length" "12") |
| 9084 |
(set_attr "type" "load_4")] |
| 9085 |
) |
| 9086 |
|
| 9087 |
(define_insn "*arm_simple_return" |
| 9088 |
[(simple_return)] |
| 9089 |
"TARGET_ARM" |
| 9090 |
"* |
| 9091 |
{ |
| 9092 |
if (arm_ccfsm_state == 2) |
| 9093 |
{ |
| 9094 |
arm_ccfsm_state += 2; |
| 9095 |
return \"\"; |
| 9096 |
} |
| 9097 |
return output_return_instruction (const_true_rtx, true, false, true); |
| 9098 |
}" |
| 9099 |
[(set_attr "type" "branch") |
| 9100 |
(set_attr "length" "4") |
| 9101 |
(set_attr "predicable" "yes")] |
| 9102 |
) |
| 9103 |
|
| 9104 |
;; Generate a sequence of instructions to determine if the processor is |
| 9105 |
;; in 26-bit or 32-bit mode, and return the appropriate return address |
| 9106 |
;; mask. |
| 9107 |
|
| 9108 |
(define_expand "return_addr_mask" |
| 9109 |
[(set (match_dup 1) |
| 9110 |
(compare:CC_NZ (unspec [(const_int 0)] UNSPEC_CHECK_ARCH) |
| 9111 |
(const_int 0))) |
| 9112 |
(set (match_operand:SI 0 "s_register_operand") |
| 9113 |
(if_then_else:SI (eq (match_dup 1) (const_int 0)) |
| 9114 |
(const_int -1) |
| 9115 |
(const_int 67108860)))] ; 0x03fffffc |
| 9116 |
"TARGET_ARM" |
| 9117 |
" |
| 9118 |
operands[1] = gen_rtx_REG (CC_NZmode, CC_REGNUM); |
| 9119 |
") |
| 9120 |
|
| 9121 |
(define_insn "*check_arch2" |
| 9122 |
[(set (match_operand:CC_NZ 0 "cc_register" "") |
| 9123 |
(compare:CC_NZ (unspec [(const_int 0)] UNSPEC_CHECK_ARCH) |
| 9124 |
(const_int 0)))] |
| 9125 |
"TARGET_ARM" |
| 9126 |
"teq\\t%|r0, %|r0\;teq\\t%|pc, %|pc" |
| 9127 |
[(set_attr "length" "8") |
| 9128 |
(set_attr "conds" "set") |
| 9129 |
(set_attr "type" "multiple")] |
| 9130 |
) |
| 9131 |
|
| 9132 |
;; Call subroutine returning any type. |
| 9133 |
|
| 9134 |
(define_expand "untyped_call" |
| 9135 |
[(parallel [(call (match_operand 0 "" "") |
| 9136 |
(const_int 0)) |
| 9137 |
(match_operand 1 "" "") |
| 9138 |
(match_operand 2 "" "")])] |
| 9139 |
"TARGET_EITHER && !TARGET_FDPIC" |
| 9140 |
" |
| 9141 |
{ |
| 9142 |
int i; |
| 9143 |
rtx par = gen_rtx_PARALLEL (VOIDmode, |
| 9144 |
rtvec_alloc (XVECLEN (operands[2], 0))); |
| 9145 |
rtx addr = gen_reg_rtx (Pmode); |
| 9146 |
rtx mem; |
| 9147 |
int size = 0; |
| 9148 |
|
| 9149 |
emit_move_insn (addr, XEXP (operands[1], 0)); |
| 9150 |
mem = change_address (operands[1], BLKmode, addr); |
| 9151 |
|
| 9152 |
for (i = 0; i < XVECLEN (operands[2], 0); i++) |
| 9153 |
{ |
| 9154 |
rtx src = SET_SRC (XVECEXP (operands[2], 0, i)); |
| 9155 |
|
| 9156 |
/* Default code only uses r0 as a return value, but we could |
| 9157 |
be using anything up to 4 registers. */ |
| 9158 |
if (REGNO (src) == R0_REGNUM) |
| 9159 |
src = gen_rtx_REG (TImode, R0_REGNUM); |
| 9160 |
|
| 9161 |
XVECEXP (par, 0, i) = gen_rtx_EXPR_LIST (VOIDmode, src, |
| 9162 |
GEN_INT (size)); |
| 9163 |
size += GET_MODE_SIZE (GET_MODE (src)); |
| 9164 |
} |
| 9165 |
|
| 9166 |
emit_call_insn (gen_call_value (par, operands[0], const0_rtx, NULL)); |
| 9167 |
|
| 9168 |
size = 0; |
| 9169 |
|
| 9170 |
for (i = 0; i < XVECLEN (par, 0); i++) |
| 9171 |
{ |
| 9172 |
HOST_WIDE_INT offset = 0; |
| 9173 |
rtx reg = XEXP (XVECEXP (par, 0, i), 0); |
| 9174 |
|
| 9175 |
if (size != 0) |
| 9176 |
emit_move_insn (addr, plus_constant (Pmode, addr, size)); |
| 9177 |
|
| 9178 |
mem = change_address (mem, GET_MODE (reg), NULL); |
| 9179 |
if (REGNO (reg) == R0_REGNUM) |
| 9180 |
{ |
| 9181 |
/* On thumb we have to use a write-back instruction. */ |
| 9182 |
emit_insn (arm_gen_store_multiple (arm_regs_in_sequence, 4, addr, |
| 9183 |
TARGET_THUMB ? TRUE : FALSE, mem, &offset)); |
| 9184 |
size = TARGET_ARM ? 16 : 0; |
| 9185 |
} |
| 9186 |
else |
| 9187 |
{ |
| 9188 |
emit_move_insn (mem, reg); |
| 9189 |
size = GET_MODE_SIZE (GET_MODE (reg)); |
| 9190 |
} |
| 9191 |
} |
| 9192 |
|
| 9193 |
/* The optimizer does not know that the call sets the function value |
| 9194 |
registers we stored in the result block. We avoid problems by |
| 9195 |
claiming that all hard registers are used and clobbered at this |
| 9196 |
point. */ |
| 9197 |
emit_insn (gen_blockage ()); |
| 9198 |
|
| 9199 |
DONE; |
| 9200 |
}" |
| 9201 |
) |
| 9202 |
|
| 9203 |
(define_expand "untyped_return" |
| 9204 |
[(match_operand:BLK 0 "memory_operand") |
| 9205 |
(match_operand 1 "" "")] |
| 9206 |
"TARGET_EITHER && !TARGET_FDPIC" |
| 9207 |
" |
| 9208 |
{ |
| 9209 |
int i; |
| 9210 |
rtx addr = gen_reg_rtx (Pmode); |
| 9211 |
rtx mem; |
| 9212 |
int size = 0; |
| 9213 |
|
| 9214 |
emit_move_insn (addr, XEXP (operands[0], 0)); |
| 9215 |
mem = change_address (operands[0], BLKmode, addr); |
| 9216 |
|
| 9217 |
for (i = 0; i < XVECLEN (operands[1], 0); i++) |
| 9218 |
{ |
| 9219 |
HOST_WIDE_INT offset = 0; |
| 9220 |
rtx reg = SET_DEST (XVECEXP (operands[1], 0, i)); |
| 9221 |
|
| 9222 |
if (size != 0) |
| 9223 |
emit_move_insn (addr, plus_constant (Pmode, addr, size)); |
| 9224 |
|
| 9225 |
mem = change_address (mem, GET_MODE (reg), NULL); |
| 9226 |
if (REGNO (reg) == R0_REGNUM) |
| 9227 |
{ |
| 9228 |
/* On thumb we have to use a write-back instruction. */ |
| 9229 |
emit_insn (arm_gen_load_multiple (arm_regs_in_sequence, 4, addr, |
| 9230 |
TARGET_THUMB ? TRUE : FALSE, mem, &offset)); |
| 9231 |
size = TARGET_ARM ? 16 : 0; |
| 9232 |
} |
| 9233 |
else |
| 9234 |
{ |
| 9235 |
emit_move_insn (reg, mem); |
| 9236 |
size = GET_MODE_SIZE (GET_MODE (reg)); |
| 9237 |
} |
| 9238 |
} |
| 9239 |
|
| 9240 |
/* Emit USE insns before the return. */ |
| 9241 |
for (i = 0; i < XVECLEN (operands[1], 0); i++) |
| 9242 |
emit_use (SET_DEST (XVECEXP (operands[1], 0, i))); |
| 9243 |
|
| 9244 |
/* Construct the return. */ |
| 9245 |
expand_naked_return (); |
| 9246 |
|
| 9247 |
DONE; |
| 9248 |
}" |
| 9249 |
) |
| 9250 |
|
| 9251 |
;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and |
| 9252 |
;; all of memory. This blocks insns from being moved across this point. |
| 9253 |
|
| 9254 |
(define_insn "blockage" |
| 9255 |
[(unspec_volatile [(const_int 0)] VUNSPEC_BLOCKAGE)] |
| 9256 |
"TARGET_EITHER" |
| 9257 |
"" |
| 9258 |
[(set_attr "length" "0") |
| 9259 |
(set_attr "type" "block")] |
| 9260 |
) |
| 9261 |
|
| 9262 |
;; Since we hard code r0 here use the 'o' constraint to prevent |
| 9263 |
;; provoking undefined behaviour in the hardware with putting out |
| 9264 |
;; auto-increment operations with potentially r0 as the base register. |
| 9265 |
(define_insn "probe_stack" |
| 9266 |
[(set (match_operand:SI 0 "memory_operand" "=o") |
| 9267 |
(unspec:SI [(const_int 0)] UNSPEC_PROBE_STACK))] |
| 9268 |
"TARGET_32BIT" |
| 9269 |
"str%?\\tr0, %0" |
| 9270 |
[(set_attr "type" "store_4") |
| 9271 |
(set_attr "predicable" "yes")] |
| 9272 |
) |
| 9273 |
|
| 9274 |
(define_insn "probe_stack_range" |
| 9275 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 9276 |
(unspec_volatile:SI [(match_operand:SI 1 "register_operand" "0") |
| 9277 |
(match_operand:SI 2 "register_operand" "r")] |
| 9278 |
VUNSPEC_PROBE_STACK_RANGE))] |
| 9279 |
"TARGET_32BIT" |
| 9280 |
{ |
| 9281 |
return output_probe_stack_range (operands[0], operands[2]); |
| 9282 |
} |
| 9283 |
[(set_attr "type" "multiple") |
| 9284 |
(set_attr "conds" "clob")] |
| 9285 |
) |
| 9286 |
|
| 9287 |
;; Named patterns for stack smashing protection. |
| 9288 |
(define_expand "stack_protect_combined_set" |
| 9289 |
[(parallel |
| 9290 |
[(set (match_operand:SI 0 "memory_operand") |
| 9291 |
(unspec:SI [(match_operand:SI 1 "guard_operand")] |
| 9292 |
UNSPEC_SP_SET)) |
| 9293 |
(clobber (match_scratch:SI 2 "")) |
| 9294 |
(clobber (match_scratch:SI 3 ""))])] |
| 9295 |
"arm_stack_protector_guard == SSP_GLOBAL" |
| 9296 |
"" |
| 9297 |
) |
| 9298 |
|
| 9299 |
;; Use a separate insn from the above expand to be able to have the mem outside |
| 9300 |
;; the operand #1 when register allocation comes. This is needed to avoid LRA |
| 9301 |
;; try to reload the guard since we need to control how PIC access is done in |
| 9302 |
;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling |
| 9303 |
;; legitimize_pic_address ()). |
| 9304 |
(define_insn_and_split "*stack_protect_combined_set_insn" |
| 9305 |
[(set (match_operand:SI 0 "memory_operand" "=m,m") |
| 9306 |
(unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))] |
| 9307 |
UNSPEC_SP_SET)) |
| 9308 |
(clobber (match_scratch:SI 2 "=&l,&r")) |
| 9309 |
(clobber (match_scratch:SI 3 "=&l,&r"))] |
| 9310 |
"" |
| 9311 |
"#" |
| 9312 |
"reload_completed" |
| 9313 |
[(parallel [(set (match_dup 0) (unspec:SI [(mem:SI (match_dup 2))] |
| 9314 |
UNSPEC_SP_SET)) |
| 9315 |
(clobber (match_dup 2))])] |
| 9316 |
" |
| 9317 |
{ |
| 9318 |
if (flag_pic) |
| 9319 |
{ |
| 9320 |
rtx pic_reg; |
| 9321 |
|
| 9322 |
if (TARGET_FDPIC) |
| 9323 |
pic_reg = gen_rtx_REG (Pmode, FDPIC_REGNUM); |
| 9324 |
else |
| 9325 |
pic_reg = operands[3]; |
| 9326 |
|
| 9327 |
/* Forces recomputing of GOT base now. */ |
| 9328 |
legitimize_pic_address (operands[1], SImode, operands[2], pic_reg, |
| 9329 |
true /*compute_now*/); |
| 9330 |
} |
| 9331 |
else |
| 9332 |
{ |
| 9333 |
if (address_operand (operands[1], SImode)) |
| 9334 |
operands[2] = operands[1]; |
| 9335 |
else |
| 9336 |
{ |
| 9337 |
rtx mem = force_const_mem (SImode, operands[1]); |
| 9338 |
if (!general_operand (mem, SImode)) |
| 9339 |
{ |
| 9340 |
emit_move_insn (operands[2], XEXP (mem, 0)); |
| 9341 |
mem = replace_equiv_address (mem, operands[2], false); |
| 9342 |
} |
| 9343 |
emit_move_insn (operands[2], mem); |
| 9344 |
} |
| 9345 |
} |
| 9346 |
}" |
| 9347 |
[(set_attr "arch" "t1,32")] |
| 9348 |
) |
| 9349 |
|
| 9350 |
;; DO NOT SPLIT THIS INSN. It's important for security reasons that the |
| 9351 |
;; canary value does not live beyond the life of this sequence. |
| 9352 |
(define_insn "*stack_protect_set_insn" |
| 9353 |
[(set (match_operand:SI 0 "memory_operand" "=m,m") |
| 9354 |
(unspec:SI [(mem:SI (match_operand:SI 1 "register_operand" "+&l,&r"))] |
| 9355 |
UNSPEC_SP_SET)) |
| 9356 |
(clobber (match_dup 1))] |
| 9357 |
"" |
| 9358 |
"@ |
| 9359 |
ldr\\t%1, [%1]\;str\\t%1, %0\;movs\t%1, #0 |
| 9360 |
ldr\\t%1, [%1]\;str\\t%1, %0\;mov\t%1, #0" |
| 9361 |
[(set_attr "length" "8,12") |
| 9362 |
(set_attr "conds" "clob,nocond") |
| 9363 |
(set_attr "type" "multiple") |
| 9364 |
(set_attr "arch" "t1,32")] |
| 9365 |
) |
| 9366 |
|
| 9367 |
(define_expand "stack_protect_combined_test" |
| 9368 |
[(parallel |
| 9369 |
[(set (pc) |
| 9370 |
(if_then_else |
| 9371 |
(eq (match_operand:SI 0 "memory_operand") |
| 9372 |
(unspec:SI [(match_operand:SI 1 "guard_operand")] |
| 9373 |
UNSPEC_SP_TEST)) |
| 9374 |
(label_ref (match_operand 2)) |
| 9375 |
(pc))) |
| 9376 |
(clobber (match_scratch:SI 3 "")) |
| 9377 |
(clobber (match_scratch:SI 4 "")) |
| 9378 |
(clobber (reg:CC CC_REGNUM))])] |
| 9379 |
"arm_stack_protector_guard == SSP_GLOBAL" |
| 9380 |
"" |
| 9381 |
) |
| 9382 |
|
| 9383 |
;; Use a separate insn from the above expand to be able to have the mem outside |
| 9384 |
;; the operand #1 when register allocation comes. This is needed to avoid LRA |
| 9385 |
;; try to reload the guard since we need to control how PIC access is done in |
| 9386 |
;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling |
| 9387 |
;; legitimize_pic_address ()). |
| 9388 |
(define_insn_and_split "*stack_protect_combined_test_insn" |
| 9389 |
[(set (pc) |
| 9390 |
(if_then_else |
| 9391 |
(eq (match_operand:SI 0 "memory_operand" "m,m") |
| 9392 |
(unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))] |
| 9393 |
UNSPEC_SP_TEST)) |
| 9394 |
(label_ref (match_operand 2)) |
| 9395 |
(pc))) |
| 9396 |
(clobber (match_scratch:SI 3 "=&l,&r")) |
| 9397 |
(clobber (match_scratch:SI 4 "=&l,&r")) |
| 9398 |
(clobber (reg:CC CC_REGNUM))] |
| 9399 |
"" |
| 9400 |
"#" |
| 9401 |
"reload_completed" |
| 9402 |
[(const_int 0)] |
| 9403 |
{ |
| 9404 |
rtx eq; |
| 9405 |
|
| 9406 |
if (flag_pic) |
| 9407 |
{ |
| 9408 |
rtx pic_reg; |
| 9409 |
|
| 9410 |
if (TARGET_FDPIC) |
| 9411 |
pic_reg = gen_rtx_REG (Pmode, FDPIC_REGNUM); |
| 9412 |
else |
| 9413 |
pic_reg = operands[4]; |
| 9414 |
|
| 9415 |
/* Forces recomputing of GOT base now. */ |
| 9416 |
legitimize_pic_address (operands[1], SImode, operands[3], pic_reg, |
| 9417 |
true /*compute_now*/); |
| 9418 |
} |
| 9419 |
else |
| 9420 |
{ |
| 9421 |
if (address_operand (operands[1], SImode)) |
| 9422 |
operands[3] = operands[1]; |
| 9423 |
else |
| 9424 |
{ |
| 9425 |
rtx mem = force_const_mem (SImode, operands[1]); |
| 9426 |
if (!general_operand (mem, SImode)) |
| 9427 |
{ |
| 9428 |
emit_move_insn (operands[3], XEXP (mem, 0)); |
| 9429 |
mem = replace_equiv_address (mem, operands[3], false); |
| 9430 |
} |
| 9431 |
emit_move_insn (operands[3], mem); |
| 9432 |
} |
| 9433 |
} |
| 9434 |
if (TARGET_32BIT) |
| 9435 |
{ |
| 9436 |
emit_insn (gen_arm_stack_protect_test_insn (operands[4], operands[0], |
| 9437 |
operands[3])); |
| 9438 |
rtx cc_reg = gen_rtx_REG (CC_Zmode, CC_REGNUM); |
| 9439 |
eq = gen_rtx_EQ (CC_Zmode, cc_reg, const0_rtx); |
| 9440 |
emit_jump_insn (gen_arm_cond_branch (operands[2], eq, cc_reg)); |
| 9441 |
} |
| 9442 |
else |
| 9443 |
{ |
| 9444 |
emit_insn (gen_thumb1_stack_protect_test_insn (operands[4], operands[0], |
| 9445 |
operands[3])); |
| 9446 |
eq = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx); |
| 9447 |
emit_jump_insn (gen_cbranchsi4 (eq, operands[4], const0_rtx, |
| 9448 |
operands[2])); |
| 9449 |
} |
| 9450 |
DONE; |
| 9451 |
} |
| 9452 |
[(set_attr "arch" "t1,32")] |
| 9453 |
) |
| 9454 |
|
| 9455 |
;; DO NOT SPLIT THIS PATTERN. It is important for security reasons that the |
| 9456 |
;; canary value does not live beyond the end of this sequence. |
| 9457 |
(define_insn "arm_stack_protect_test_insn" |
| 9458 |
[(set (reg:CC_Z CC_REGNUM) |
| 9459 |
(compare:CC_Z (unspec:SI [(match_operand:SI 1 "memory_operand" "m,m") |
| 9460 |
(mem:SI (match_operand:SI 2 "register_operand" "+l,r"))] |
| 9461 |
UNSPEC_SP_TEST) |
| 9462 |
(const_int 0))) |
| 9463 |
(clobber (match_operand:SI 0 "register_operand" "=&l,&r")) |
| 9464 |
(clobber (match_dup 2))] |
| 9465 |
"TARGET_32BIT" |
| 9466 |
"ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0\;mov\t%2, #0" |
| 9467 |
[(set_attr "length" "12,16") |
| 9468 |
(set_attr "conds" "set") |
| 9469 |
(set_attr "type" "multiple") |
| 9470 |
(set_attr "arch" "t,32")] |
| 9471 |
) |
| 9472 |
|
| 9473 |
(define_expand "stack_protect_set" |
| 9474 |
[(match_operand:SI 0 "memory_operand") |
| 9475 |
(match_operand:SI 1 "memory_operand")] |
| 9476 |
"arm_stack_protector_guard == SSP_TLSREG" |
| 9477 |
" |
| 9478 |
{ |
| 9479 |
operands[1] = arm_stack_protect_tls_canary_mem (false /* reload */); |
| 9480 |
emit_insn (gen_stack_protect_set_tls (operands[0], operands[1])); |
| 9481 |
DONE; |
| 9482 |
}" |
| 9483 |
) |
| 9484 |
|
| 9485 |
;; DO NOT SPLIT THIS PATTERN. It is important for security reasons that the |
| 9486 |
;; canary value does not live beyond the life of this sequence. |
| 9487 |
(define_insn "stack_protect_set_tls" |
| 9488 |
[(set (match_operand:SI 0 "memory_operand" "=m") |
| 9489 |
(unspec:SI [(match_operand:SI 1 "memory_operand" "m")] |
| 9490 |
UNSPEC_SP_SET)) |
| 9491 |
(set (match_scratch:SI 2 "=&r") (const_int 0))] |
| 9492 |
"" |
| 9493 |
"ldr\\t%2, %1\;str\\t%2, %0\;mov\t%2, #0" |
| 9494 |
[(set_attr "length" "12") |
| 9495 |
(set_attr "conds" "unconditional") |
| 9496 |
(set_attr "type" "multiple")] |
| 9497 |
) |
| 9498 |
|
| 9499 |
(define_expand "stack_protect_test" |
| 9500 |
[(match_operand:SI 0 "memory_operand") |
| 9501 |
(match_operand:SI 1 "memory_operand") |
| 9502 |
(match_operand:SI 2)] |
| 9503 |
"arm_stack_protector_guard == SSP_TLSREG" |
| 9504 |
" |
| 9505 |
{ |
| 9506 |
operands[1] = arm_stack_protect_tls_canary_mem (true /* reload */); |
| 9507 |
emit_insn (gen_stack_protect_test_tls (operands[0], operands[1])); |
| 9508 |
|
| 9509 |
rtx cc_reg = gen_rtx_REG (CC_Zmode, CC_REGNUM); |
| 9510 |
rtx eq = gen_rtx_EQ (CC_Zmode, cc_reg, const0_rtx); |
| 9511 |
emit_jump_insn (gen_arm_cond_branch (operands[2], eq, cc_reg)); |
| 9512 |
DONE; |
| 9513 |
}" |
| 9514 |
) |
| 9515 |
|
| 9516 |
(define_insn "stack_protect_test_tls" |
| 9517 |
[(set (reg:CC_Z CC_REGNUM) |
| 9518 |
(compare:CC_Z (unspec:SI [(match_operand:SI 0 "memory_operand" "m") |
| 9519 |
(match_operand:SI 1 "memory_operand" "m")] |
| 9520 |
UNSPEC_SP_TEST) |
| 9521 |
(const_int 0))) |
| 9522 |
(clobber (match_scratch:SI 2 "=&r")) |
| 9523 |
(clobber (match_scratch:SI 3 "=&r"))] |
| 9524 |
"" |
| 9525 |
"ldr\t%2, %0\;ldr\t%3, %1\;eors\t%2, %3, %2\;mov\t%3, #0" |
| 9526 |
[(set_attr "length" "16") |
| 9527 |
(set_attr "conds" "set") |
| 9528 |
(set_attr "type" "multiple")] |
| 9529 |
) |
| 9530 |
|
| 9531 |
(define_expand "casesi" |
| 9532 |
[(match_operand:SI 0 "s_register_operand") ; index to jump on |
| 9533 |
(match_operand:SI 1 "const_int_operand") ; lower bound |
| 9534 |
(match_operand:SI 2 "const_int_operand") ; total range |
| 9535 |
(match_operand:SI 3 "" "") ; table label |
| 9536 |
(match_operand:SI 4 "" "")] ; Out of range label |
| 9537 |
"(TARGET_ARM |
| 9538 |
|| (!target_pure_code |
| 9539 |
&& (TARGET_THUMB2 || optimize_size || flag_pic)))" |
| 9540 |
" |
| 9541 |
{ |
| 9542 |
enum insn_code code; |
| 9543 |
if (operands[1] != const0_rtx) |
| 9544 |
{ |
| 9545 |
rtx reg = gen_reg_rtx (SImode); |
| 9546 |
|
| 9547 |
emit_insn (gen_addsi3 (reg, operands[0], |
| 9548 |
gen_int_mode (-INTVAL (operands[1]), |
| 9549 |
SImode))); |
| 9550 |
operands[0] = reg; |
| 9551 |
} |
| 9552 |
|
| 9553 |
if (TARGET_ARM) |
| 9554 |
code = CODE_FOR_arm_casesi_internal; |
| 9555 |
else if (TARGET_THUMB1) |
| 9556 |
code = CODE_FOR_thumb1_casesi_internal_pic; |
| 9557 |
else if (flag_pic) |
| 9558 |
code = CODE_FOR_thumb2_casesi_internal_pic; |
| 9559 |
else |
| 9560 |
code = CODE_FOR_thumb2_casesi_internal; |
| 9561 |
|
| 9562 |
if (!insn_data[(int) code].operand[1].predicate(operands[2], SImode)) |
| 9563 |
operands[2] = force_reg (SImode, operands[2]); |
| 9564 |
|
| 9565 |
emit_jump_insn (GEN_FCN ((int) code) (operands[0], operands[2], |
| 9566 |
operands[3], operands[4])); |
| 9567 |
DONE; |
| 9568 |
}" |
| 9569 |
) |
| 9570 |
|
| 9571 |
;; The USE in this pattern is needed to tell flow analysis that this is |
| 9572 |
;; a CASESI insn. It has no other purpose. |
| 9573 |
(define_expand "arm_casesi_internal" |
| 9574 |
[(parallel [(set (pc) |
| 9575 |
(if_then_else |
| 9576 |
(leu (match_operand:SI 0 "s_register_operand") |
| 9577 |
(match_operand:SI 1 "arm_rhs_operand")) |
| 9578 |
(match_dup 4) |
| 9579 |
(label_ref:SI (match_operand 3 "")))) |
| 9580 |
(clobber (reg:CC CC_REGNUM)) |
| 9581 |
(clobber (match_scratch:SI 5)) |
| 9582 |
(use (label_ref:SI (match_operand 2 "")))])] |
| 9583 |
"TARGET_ARM" |
| 9584 |
{ |
| 9585 |
rtx vec_table_ref = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[2])); |
| 9586 |
rtx tmp = gen_rtx_MULT (SImode, operands[0], GEN_INT (4)); |
| 9587 |
tmp = gen_rtx_PLUS (SImode, tmp, |
| 9588 |
vec_table_ref); |
| 9589 |
operands[4] = gen_rtx_MEM (SImode, tmp); |
| 9590 |
MEM_READONLY_P (operands[4]) = 1; |
| 9591 |
MEM_NOTRAP_P (operands[4]) = 1; |
| 9592 |
}) |
| 9593 |
|
| 9594 |
(define_insn "*arm_casesi_internal" |
| 9595 |
[(parallel [(set (pc) |
| 9596 |
(if_then_else |
| 9597 |
(leu (match_operand:SI 0 "s_register_operand" "r") |
| 9598 |
(match_operand:SI 1 "arm_rhs_operand" "rI")) |
| 9599 |
(mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4)) |
| 9600 |
(match_operand:SI 5 "s_register_operand" "r"))) |
| 9601 |
(label_ref:SI (match_operand 3 "" "")))) |
| 9602 |
(clobber (reg:CC CC_REGNUM)) |
| 9603 |
(clobber (match_scratch:SI 4 "=r")) |
| 9604 |
(use (label_ref:SI (match_operand 2 "")))])] |
| 9605 |
"TARGET_ARM" |
| 9606 |
{ |
| 9607 |
return arm_output_casesi (operands); |
| 9608 |
} |
| 9609 |
[(set_attr "conds" "clob") |
| 9610 |
(set_attr "length" "24") |
| 9611 |
(set_attr "type" "multiple")] |
| 9612 |
) |
| 9613 |
|
| 9614 |
(define_expand "indirect_jump" |
| 9615 |
[(set (pc) |
| 9616 |
(match_operand:SI 0 "s_register_operand"))] |
| 9617 |
"TARGET_EITHER" |
| 9618 |
" |
| 9619 |
/* Thumb-2 doesn't have mov pc, reg. Explicitly set the low bit of the |
| 9620 |
address and use bx. */ |
| 9621 |
if (TARGET_THUMB2) |
| 9622 |
{ |
| 9623 |
rtx tmp; |
| 9624 |
tmp = gen_reg_rtx (SImode); |
| 9625 |
emit_insn (gen_iorsi3 (tmp, operands[0], GEN_INT(1))); |
| 9626 |
operands[0] = tmp; |
| 9627 |
} |
| 9628 |
" |
| 9629 |
) |
| 9630 |
|
| 9631 |
;; NB Never uses BX. |
| 9632 |
(define_insn "*arm_indirect_jump" |
| 9633 |
[(set (pc) |
| 9634 |
(match_operand:SI 0 "s_register_operand" "r"))] |
| 9635 |
"TARGET_ARM" |
| 9636 |
"mov%?\\t%|pc, %0\\t%@ indirect register jump" |
| 9637 |
[(set_attr "predicable" "yes") |
| 9638 |
(set_attr "type" "branch")] |
| 9639 |
) |
| 9640 |
|
| 9641 |
(define_insn "*load_indirect_jump" |
| 9642 |
[(set (pc) |
| 9643 |
(match_operand:SI 0 "memory_operand" "m"))] |
| 9644 |
"TARGET_ARM" |
| 9645 |
"ldr%?\\t%|pc, %0\\t%@ indirect memory jump" |
| 9646 |
[(set_attr "type" "load_4") |
| 9647 |
(set_attr "pool_range" "4096") |
| 9648 |
(set_attr "neg_pool_range" "4084") |
| 9649 |
(set_attr "predicable" "yes")] |
| 9650 |
) |
| 9651 |
|
| 9652 |
|
| 9653 |
;; Misc insns |
| 9654 |
|
| 9655 |
(define_insn "nop" |
| 9656 |
[(const_int 0)] |
| 9657 |
"TARGET_EITHER" |
| 9658 |
"nop" |
| 9659 |
[(set (attr "length") |
| 9660 |
(if_then_else (eq_attr "is_thumb" "yes") |
| 9661 |
(const_int 2) |
| 9662 |
(const_int 4))) |
| 9663 |
(set_attr "type" "mov_reg")] |
| 9664 |
) |
| 9665 |
|
| 9666 |
(define_insn "trap" |
| 9667 |
[(trap_if (const_int 1) (const_int 0))] |
| 9668 |
"" |
| 9669 |
"* |
| 9670 |
if (TARGET_ARM) |
| 9671 |
return \".inst\\t0xe7f000f0\"; |
| 9672 |
else |
| 9673 |
return \".inst\\t0xdeff\"; |
| 9674 |
" |
| 9675 |
[(set (attr "length") |
| 9676 |
(if_then_else (eq_attr "is_thumb" "yes") |
| 9677 |
(const_int 2) |
| 9678 |
(const_int 4))) |
| 9679 |
(set_attr "type" "trap") |
| 9680 |
(set_attr "conds" "unconditional")] |
| 9681 |
) |
| 9682 |
|
| 9683 |
|
| 9684 |
;; Patterns to allow combination of arithmetic, cond code and shifts |
| 9685 |
|
| 9686 |
(define_insn "*<arith_shift_insn>_multsi" |
| 9687 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 9688 |
(SHIFTABLE_OPS:SI |
| 9689 |
(mult:SI (match_operand:SI 2 "s_register_operand" "r,r") |
| 9690 |
(match_operand:SI 3 "power_of_two_operand" "")) |
| 9691 |
(match_operand:SI 1 "s_register_operand" "rk,<t2_binop0>")))] |
| 9692 |
"TARGET_32BIT" |
| 9693 |
"<arith_shift_insn>%?\\t%0, %1, %2, lsl %b3" |
| 9694 |
[(set_attr "predicable" "yes") |
| 9695 |
(set_attr "shift" "2") |
| 9696 |
(set_attr "arch" "a,t2") |
| 9697 |
(set_attr "autodetect_type" "alu_shift_mul_op3")]) |
| 9698 |
|
| 9699 |
(define_insn "*<arith_shift_insn>_shiftsi" |
| 9700 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 9701 |
(SHIFTABLE_OPS:SI |
| 9702 |
(match_operator:SI 2 "shift_nomul_operator" |
| 9703 |
[(match_operand:SI 3 "s_register_operand" "r,r,r") |
| 9704 |
(match_operand:SI 4 "shift_amount_operand" "M,M,r")]) |
| 9705 |
(match_operand:SI 1 "s_register_operand" "rk,<t2_binop0>,rk")))] |
| 9706 |
"TARGET_32BIT && GET_CODE (operands[2]) != MULT" |
| 9707 |
"<arith_shift_insn>%?\\t%0, %1, %3%S2" |
| 9708 |
[(set_attr "predicable" "yes") |
| 9709 |
(set_attr "shift" "3") |
| 9710 |
(set_attr "arch" "a,t2,a") |
| 9711 |
(set_attr "autodetect_type" "alu_shift_operator2")]) |
| 9712 |
|
| 9713 |
(define_split |
| 9714 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9715 |
(match_operator:SI 1 "shiftable_operator" |
| 9716 |
[(match_operator:SI 2 "shiftable_operator" |
| 9717 |
[(match_operator:SI 3 "shift_operator" |
| 9718 |
[(match_operand:SI 4 "s_register_operand" "") |
| 9719 |
(match_operand:SI 5 "reg_or_int_operand" "")]) |
| 9720 |
(match_operand:SI 6 "s_register_operand" "")]) |
| 9721 |
(match_operand:SI 7 "arm_rhs_operand" "")])) |
| 9722 |
(clobber (match_operand:SI 8 "s_register_operand" ""))] |
| 9723 |
"TARGET_32BIT" |
| 9724 |
[(set (match_dup 8) |
| 9725 |
(match_op_dup 2 [(match_op_dup 3 [(match_dup 4) (match_dup 5)]) |
| 9726 |
(match_dup 6)])) |
| 9727 |
(set (match_dup 0) |
| 9728 |
(match_op_dup 1 [(match_dup 8) (match_dup 7)]))] |
| 9729 |
"") |
| 9730 |
|
| 9731 |
(define_insn "*arith_shiftsi_compare0" |
| 9732 |
[(set (reg:CC_NZ CC_REGNUM) |
| 9733 |
(compare:CC_NZ |
| 9734 |
(match_operator:SI 1 "shiftable_operator" |
| 9735 |
[(match_operator:SI 3 "shift_operator" |
| 9736 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 9737 |
(match_operand:SI 5 "shift_amount_operand" "M,r")]) |
| 9738 |
(match_operand:SI 2 "s_register_operand" "r,r")]) |
| 9739 |
(const_int 0))) |
| 9740 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 9741 |
(match_op_dup 1 [(match_op_dup 3 [(match_dup 4) (match_dup 5)]) |
| 9742 |
(match_dup 2)]))] |
| 9743 |
"TARGET_32BIT" |
| 9744 |
"%i1s%?\\t%0, %2, %4%S3" |
| 9745 |
[(set_attr "conds" "set") |
| 9746 |
(set_attr "shift" "4") |
| 9747 |
(set_attr "arch" "32,a") |
| 9748 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 9749 |
|
| 9750 |
(define_insn "*arith_shiftsi_compare0_scratch" |
| 9751 |
[(set (reg:CC_NZ CC_REGNUM) |
| 9752 |
(compare:CC_NZ |
| 9753 |
(match_operator:SI 1 "shiftable_operator" |
| 9754 |
[(match_operator:SI 3 "shift_operator" |
| 9755 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 9756 |
(match_operand:SI 5 "shift_amount_operand" "M,r")]) |
| 9757 |
(match_operand:SI 2 "s_register_operand" "r,r")]) |
| 9758 |
(const_int 0))) |
| 9759 |
(clobber (match_scratch:SI 0 "=r,r"))] |
| 9760 |
"TARGET_32BIT" |
| 9761 |
"%i1s%?\\t%0, %2, %4%S3" |
| 9762 |
[(set_attr "conds" "set") |
| 9763 |
(set_attr "shift" "4") |
| 9764 |
(set_attr "arch" "32,a") |
| 9765 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 9766 |
|
| 9767 |
(define_insn "*sub_shiftsi" |
| 9768 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 9769 |
(minus:SI (match_operand:SI 1 "s_register_operand" "r,r") |
| 9770 |
(match_operator:SI 2 "shift_operator" |
| 9771 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 9772 |
(match_operand:SI 4 "shift_amount_operand" "M,r")])))] |
| 9773 |
"TARGET_32BIT" |
| 9774 |
"sub%?\\t%0, %1, %3%S2" |
| 9775 |
[(set_attr "predicable" "yes") |
| 9776 |
(set_attr "predicable_short_it" "no") |
| 9777 |
(set_attr "shift" "3") |
| 9778 |
(set_attr "arch" "32,a") |
| 9779 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 9780 |
|
| 9781 |
(define_insn "*sub_shiftsi_compare0" |
| 9782 |
[(set (reg:CC_NZ CC_REGNUM) |
| 9783 |
(compare:CC_NZ |
| 9784 |
(minus:SI (match_operand:SI 1 "s_register_operand" "r,r") |
| 9785 |
(match_operator:SI 2 "shift_operator" |
| 9786 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 9787 |
(match_operand:SI 4 "shift_amount_operand" "M,r")])) |
| 9788 |
(const_int 0))) |
| 9789 |
(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 9790 |
(minus:SI (match_dup 1) |
| 9791 |
(match_op_dup 2 [(match_dup 3) (match_dup 4)])))] |
| 9792 |
"TARGET_32BIT" |
| 9793 |
"subs%?\\t%0, %1, %3%S2" |
| 9794 |
[(set_attr "conds" "set") |
| 9795 |
(set_attr "shift" "3") |
| 9796 |
(set_attr "arch" "32,a") |
| 9797 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 9798 |
|
| 9799 |
(define_insn "*sub_shiftsi_compare0_scratch" |
| 9800 |
[(set (reg:CC_NZ CC_REGNUM) |
| 9801 |
(compare:CC_NZ |
| 9802 |
(minus:SI (match_operand:SI 1 "s_register_operand" "r,r") |
| 9803 |
(match_operator:SI 2 "shift_operator" |
| 9804 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 9805 |
(match_operand:SI 4 "shift_amount_operand" "M,r")])) |
| 9806 |
(const_int 0))) |
| 9807 |
(clobber (match_scratch:SI 0 "=r,r"))] |
| 9808 |
"TARGET_32BIT" |
| 9809 |
"subs%?\\t%0, %1, %3%S2" |
| 9810 |
[(set_attr "conds" "set") |
| 9811 |
(set_attr "shift" "3") |
| 9812 |
(set_attr "arch" "32,a") |
| 9813 |
(set_attr "type" "alus_shift_imm,alus_shift_reg")]) |
| 9814 |
|
| 9815 |
|
| 9816 |
(define_insn_and_split "*and_scc" |
| 9817 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 9818 |
(and:SI (match_operator:SI 1 "arm_comparison_operator" |
| 9819 |
[(match_operand 2 "cc_register" "") (const_int 0)]) |
| 9820 |
(match_operand:SI 3 "s_register_operand" "r")))] |
| 9821 |
"TARGET_ARM" |
| 9822 |
"#" ; "mov%D1\\t%0, #0\;and%d1\\t%0, %3, #1" |
| 9823 |
"&& reload_completed" |
| 9824 |
[(cond_exec (match_dup 5) (set (match_dup 0) (const_int 0))) |
| 9825 |
(cond_exec (match_dup 4) (set (match_dup 0) |
| 9826 |
(and:SI (match_dup 3) (const_int 1))))] |
| 9827 |
{ |
| 9828 |
machine_mode mode = GET_MODE (operands[2]); |
| 9829 |
enum rtx_code rc = GET_CODE (operands[1]); |
| 9830 |
|
| 9831 |
/* Note that operands[4] is the same as operands[1], |
| 9832 |
but with VOIDmode as the result. */ |
| 9833 |
operands[4] = gen_rtx_fmt_ee (rc, VOIDmode, operands[2], const0_rtx); |
| 9834 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 9835 |
rc = reverse_condition_maybe_unordered (rc); |
| 9836 |
else |
| 9837 |
rc = reverse_condition (rc); |
| 9838 |
operands[5] = gen_rtx_fmt_ee (rc, VOIDmode, operands[2], const0_rtx); |
| 9839 |
} |
| 9840 |
[(set_attr "conds" "use") |
| 9841 |
(set_attr "type" "multiple") |
| 9842 |
(set_attr "length" "8")] |
| 9843 |
) |
| 9844 |
|
| 9845 |
(define_insn_and_split "*ior_scc" |
| 9846 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 9847 |
(ior:SI (match_operator:SI 1 "arm_comparison_operator" |
| 9848 |
[(match_operand 2 "cc_register" "") (const_int 0)]) |
| 9849 |
(match_operand:SI 3 "s_register_operand" "0,?r")))] |
| 9850 |
"TARGET_ARM" |
| 9851 |
"@ |
| 9852 |
orr%d1\\t%0, %3, #1 |
| 9853 |
#" |
| 9854 |
"&& reload_completed |
| 9855 |
&& REGNO (operands [0]) != REGNO (operands[3])" |
| 9856 |
;; && which_alternative == 1 |
| 9857 |
; mov%D1\\t%0, %3\;orr%d1\\t%0, %3, #1 |
| 9858 |
[(cond_exec (match_dup 5) (set (match_dup 0) (match_dup 3))) |
| 9859 |
(cond_exec (match_dup 4) (set (match_dup 0) |
| 9860 |
(ior:SI (match_dup 3) (const_int 1))))] |
| 9861 |
{ |
| 9862 |
machine_mode mode = GET_MODE (operands[2]); |
| 9863 |
enum rtx_code rc = GET_CODE (operands[1]); |
| 9864 |
|
| 9865 |
/* Note that operands[4] is the same as operands[1], |
| 9866 |
but with VOIDmode as the result. */ |
| 9867 |
operands[4] = gen_rtx_fmt_ee (rc, VOIDmode, operands[2], const0_rtx); |
| 9868 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 9869 |
rc = reverse_condition_maybe_unordered (rc); |
| 9870 |
else |
| 9871 |
rc = reverse_condition (rc); |
| 9872 |
operands[5] = gen_rtx_fmt_ee (rc, VOIDmode, operands[2], const0_rtx); |
| 9873 |
} |
| 9874 |
[(set_attr "conds" "use") |
| 9875 |
(set_attr "length" "4,8") |
| 9876 |
(set_attr "type" "logic_imm,multiple")] |
| 9877 |
) |
| 9878 |
|
| 9879 |
; A series of splitters for the compare_scc pattern below. Note that |
| 9880 |
; order is important. |
| 9881 |
(define_split |
| 9882 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9883 |
(lt:SI (match_operand:SI 1 "s_register_operand" "") |
| 9884 |
(const_int 0))) |
| 9885 |
(clobber (reg:CC CC_REGNUM))] |
| 9886 |
"TARGET_32BIT && reload_completed" |
| 9887 |
[(set (match_dup 0) (lshiftrt:SI (match_dup 1) (const_int 31)))]) |
| 9888 |
|
| 9889 |
(define_split |
| 9890 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9891 |
(ge:SI (match_operand:SI 1 "s_register_operand" "") |
| 9892 |
(const_int 0))) |
| 9893 |
(clobber (reg:CC CC_REGNUM))] |
| 9894 |
"TARGET_32BIT && reload_completed" |
| 9895 |
[(set (match_dup 0) (not:SI (match_dup 1))) |
| 9896 |
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 31)))]) |
| 9897 |
|
| 9898 |
(define_split |
| 9899 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9900 |
(eq:SI (match_operand:SI 1 "s_register_operand" "") |
| 9901 |
(const_int 0))) |
| 9902 |
(clobber (reg:CC CC_REGNUM))] |
| 9903 |
"arm_arch5t && TARGET_32BIT" |
| 9904 |
[(set (match_dup 0) (clz:SI (match_dup 1))) |
| 9905 |
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 5)))] |
| 9906 |
) |
| 9907 |
|
| 9908 |
(define_split |
| 9909 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9910 |
(eq:SI (match_operand:SI 1 "s_register_operand" "") |
| 9911 |
(const_int 0))) |
| 9912 |
(clobber (reg:CC CC_REGNUM))] |
| 9913 |
"TARGET_32BIT && reload_completed" |
| 9914 |
[(parallel |
| 9915 |
[(set (reg:CC CC_REGNUM) |
| 9916 |
(compare:CC (const_int 1) (match_dup 1))) |
| 9917 |
(set (match_dup 0) |
| 9918 |
(minus:SI (const_int 1) (match_dup 1)))]) |
| 9919 |
(cond_exec (ltu:CC (reg:CC CC_REGNUM) (const_int 0)) |
| 9920 |
(set (match_dup 0) (const_int 0)))]) |
| 9921 |
|
| 9922 |
(define_split |
| 9923 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9924 |
(ne:SI (match_operand:SI 1 "s_register_operand" "") |
| 9925 |
(match_operand:SI 2 "const_int_operand" ""))) |
| 9926 |
(clobber (reg:CC CC_REGNUM))] |
| 9927 |
"TARGET_32BIT && reload_completed" |
| 9928 |
[(parallel |
| 9929 |
[(set (reg:CC CC_REGNUM) |
| 9930 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 9931 |
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))]) |
| 9932 |
(cond_exec (ne:CC (reg:CC CC_REGNUM) (const_int 0)) |
| 9933 |
(set (match_dup 0) (const_int 1)))] |
| 9934 |
{ |
| 9935 |
operands[3] = gen_int_mode (-INTVAL (operands[2]), SImode); |
| 9936 |
}) |
| 9937 |
|
| 9938 |
(define_split |
| 9939 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 9940 |
(ne:SI (match_operand:SI 1 "s_register_operand" "") |
| 9941 |
(match_operand:SI 2 "arm_add_operand" ""))) |
| 9942 |
(clobber (reg:CC CC_REGNUM))] |
| 9943 |
"TARGET_32BIT && reload_completed" |
| 9944 |
[(parallel |
| 9945 |
[(set (reg:CC_NZ CC_REGNUM) |
| 9946 |
(compare:CC_NZ (minus:SI (match_dup 1) (match_dup 2)) |
| 9947 |
(const_int 0))) |
| 9948 |
(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))]) |
| 9949 |
(cond_exec (ne:CC_NZ (reg:CC_NZ CC_REGNUM) (const_int 0)) |
| 9950 |
(set (match_dup 0) (const_int 1)))]) |
| 9951 |
|
| 9952 |
(define_insn_and_split "*compare_scc" |
| 9953 |
[(set (match_operand:SI 0 "s_register_operand" "=Ts,Ts") |
| 9954 |
(match_operator:SI 1 "arm_comparison_operator" |
| 9955 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 9956 |
(match_operand:SI 3 "arm_add_operand" "rI,L")])) |
| 9957 |
(clobber (reg:CC CC_REGNUM))] |
| 9958 |
"TARGET_32BIT" |
| 9959 |
"#" |
| 9960 |
"&& reload_completed" |
| 9961 |
[(set (reg:CC CC_REGNUM) (compare:CC (match_dup 2) (match_dup 3))) |
| 9962 |
(cond_exec (match_dup 4) (set (match_dup 0) (const_int 0))) |
| 9963 |
(cond_exec (match_dup 5) (set (match_dup 0) (const_int 1)))] |
| 9964 |
{ |
| 9965 |
rtx tmp1; |
| 9966 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), |
| 9967 |
operands[2], operands[3]); |
| 9968 |
enum rtx_code rc = GET_CODE (operands[1]); |
| 9969 |
|
| 9970 |
tmp1 = gen_rtx_REG (mode, CC_REGNUM); |
| 9971 |
|
| 9972 |
operands[5] = gen_rtx_fmt_ee (rc, VOIDmode, tmp1, const0_rtx); |
| 9973 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 9974 |
rc = reverse_condition_maybe_unordered (rc); |
| 9975 |
else |
| 9976 |
rc = reverse_condition (rc); |
| 9977 |
operands[4] = gen_rtx_fmt_ee (rc, VOIDmode, tmp1, const0_rtx); |
| 9978 |
} |
| 9979 |
[(set_attr "type" "multiple")] |
| 9980 |
) |
| 9981 |
|
| 9982 |
;; Attempt to improve the sequence generated by the compare_scc splitters |
| 9983 |
;; not to use conditional execution. |
| 9984 |
|
| 9985 |
;; Rd = (eq (reg1) (const_int0)) // ARMv5 |
| 9986 |
;; clz Rd, reg1 |
| 9987 |
;; lsr Rd, Rd, #5 |
| 9988 |
(define_peephole2 |
| 9989 |
[(set (reg:CC CC_REGNUM) |
| 9990 |
(compare:CC (match_operand:SI 1 "register_operand" "") |
| 9991 |
(const_int 0))) |
| 9992 |
(cond_exec (ne (reg:CC CC_REGNUM) (const_int 0)) |
| 9993 |
(set (match_operand:SI 0 "register_operand" "") (const_int 0))) |
| 9994 |
(cond_exec (eq (reg:CC CC_REGNUM) (const_int 0)) |
| 9995 |
(set (match_dup 0) (const_int 1)))] |
| 9996 |
"arm_arch5t && TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM)" |
| 9997 |
[(set (match_dup 0) (clz:SI (match_dup 1))) |
| 9998 |
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 5)))] |
| 9999 |
) |
| 10000 |
|
| 10001 |
;; Rd = (eq (reg1) (const_int0)) // !ARMv5 |
| 10002 |
;; negs Rd, reg1 |
| 10003 |
;; adc Rd, Rd, reg1 |
| 10004 |
(define_peephole2 |
| 10005 |
[(set (reg:CC CC_REGNUM) |
| 10006 |
(compare:CC (match_operand:SI 1 "register_operand" "") |
| 10007 |
(const_int 0))) |
| 10008 |
(cond_exec (ne (reg:CC CC_REGNUM) (const_int 0)) |
| 10009 |
(set (match_operand:SI 0 "register_operand" "") (const_int 0))) |
| 10010 |
(cond_exec (eq (reg:CC CC_REGNUM) (const_int 0)) |
| 10011 |
(set (match_dup 0) (const_int 1))) |
| 10012 |
(match_scratch:SI 2 "r")] |
| 10013 |
"TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM)" |
| 10014 |
[(parallel |
| 10015 |
[(set (reg:CC CC_REGNUM) |
| 10016 |
(compare:CC (const_int 0) (match_dup 1))) |
| 10017 |
(set (match_dup 2) (minus:SI (const_int 0) (match_dup 1)))]) |
| 10018 |
(set (match_dup 0) |
| 10019 |
(plus:SI (plus:SI (match_dup 1) (match_dup 2)) |
| 10020 |
(geu:SI (reg:CC CC_REGNUM) (const_int 0))))] |
| 10021 |
) |
| 10022 |
|
| 10023 |
;; Rd = (eq (reg1) (reg2/imm)) // ARMv5 and optimising for speed. |
| 10024 |
;; sub Rd, Reg1, reg2 |
| 10025 |
;; clz Rd, Rd |
| 10026 |
;; lsr Rd, Rd, #5 |
| 10027 |
(define_peephole2 |
| 10028 |
[(set (reg:CC CC_REGNUM) |
| 10029 |
(compare:CC (match_operand:SI 1 "register_operand" "") |
| 10030 |
(match_operand:SI 2 "arm_rhs_operand" ""))) |
| 10031 |
(cond_exec (ne (reg:CC CC_REGNUM) (const_int 0)) |
| 10032 |
(set (match_operand:SI 0 "register_operand" "") (const_int 0))) |
| 10033 |
(cond_exec (eq (reg:CC CC_REGNUM) (const_int 0)) |
| 10034 |
(set (match_dup 0) (const_int 1)))] |
| 10035 |
"arm_arch5t && TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM) |
| 10036 |
&& !(TARGET_THUMB2 && optimize_insn_for_size_p ())" |
| 10037 |
[(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2))) |
| 10038 |
(set (match_dup 0) (clz:SI (match_dup 0))) |
| 10039 |
(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 5)))] |
| 10040 |
) |
| 10041 |
|
| 10042 |
|
| 10043 |
;; Rd = (eq (reg1) (reg2)) // ! ARMv5 or optimising for size. |
| 10044 |
;; sub T1, Reg1, reg2 |
| 10045 |
;; negs Rd, T1 |
| 10046 |
;; adc Rd, Rd, T1 |
| 10047 |
(define_peephole2 |
| 10048 |
[(set (reg:CC CC_REGNUM) |
| 10049 |
(compare:CC (match_operand:SI 1 "register_operand" "") |
| 10050 |
(match_operand:SI 2 "arm_rhs_operand" ""))) |
| 10051 |
(cond_exec (ne (reg:CC CC_REGNUM) (const_int 0)) |
| 10052 |
(set (match_operand:SI 0 "register_operand" "") (const_int 0))) |
| 10053 |
(cond_exec (eq (reg:CC CC_REGNUM) (const_int 0)) |
| 10054 |
(set (match_dup 0) (const_int 1))) |
| 10055 |
(match_scratch:SI 3 "r")] |
| 10056 |
"TARGET_32BIT && peep2_regno_dead_p (3, CC_REGNUM)" |
| 10057 |
[(set (match_dup 3) (match_dup 4)) |
| 10058 |
(parallel |
| 10059 |
[(set (reg:CC CC_REGNUM) |
| 10060 |
(compare:CC (const_int 0) (match_dup 3))) |
| 10061 |
(set (match_dup 0) (minus:SI (const_int 0) (match_dup 3)))]) |
| 10062 |
(set (match_dup 0) |
| 10063 |
(plus:SI (plus:SI (match_dup 0) (match_dup 3)) |
| 10064 |
(geu:SI (reg:CC CC_REGNUM) (const_int 0))))] |
| 10065 |
" |
| 10066 |
if (CONST_INT_P (operands[2])) |
| 10067 |
operands[4] = plus_constant (SImode, operands[1], -INTVAL (operands[2])); |
| 10068 |
else |
| 10069 |
operands[4] = gen_rtx_MINUS (SImode, operands[1], operands[2]); |
| 10070 |
") |
| 10071 |
|
| 10072 |
(define_insn "*cond_move" |
| 10073 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 10074 |
(if_then_else:SI (match_operator 3 "equality_operator" |
| 10075 |
[(match_operator 4 "arm_comparison_operator" |
| 10076 |
[(match_operand 5 "cc_register" "") (const_int 0)]) |
| 10077 |
(const_int 0)]) |
| 10078 |
(match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI") |
| 10079 |
(match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))] |
| 10080 |
"TARGET_ARM" |
| 10081 |
"* |
| 10082 |
if (GET_CODE (operands[3]) == NE) |
| 10083 |
{ |
| 10084 |
if (which_alternative != 1) |
| 10085 |
output_asm_insn (\"mov%D4\\t%0, %2\", operands); |
| 10086 |
if (which_alternative != 0) |
| 10087 |
output_asm_insn (\"mov%d4\\t%0, %1\", operands); |
| 10088 |
return \"\"; |
| 10089 |
} |
| 10090 |
if (which_alternative != 0) |
| 10091 |
output_asm_insn (\"mov%D4\\t%0, %1\", operands); |
| 10092 |
if (which_alternative != 1) |
| 10093 |
output_asm_insn (\"mov%d4\\t%0, %2\", operands); |
| 10094 |
return \"\"; |
| 10095 |
" |
| 10096 |
[(set_attr "conds" "use") |
| 10097 |
(set_attr_alternative "type" |
| 10098 |
[(if_then_else (match_operand 2 "const_int_operand" "") |
| 10099 |
(const_string "mov_imm") |
| 10100 |
(const_string "mov_reg")) |
| 10101 |
(if_then_else (match_operand 1 "const_int_operand" "") |
| 10102 |
(const_string "mov_imm") |
| 10103 |
(const_string "mov_reg")) |
| 10104 |
(const_string "multiple")]) |
| 10105 |
(set_attr "length" "4,4,8")] |
| 10106 |
) |
| 10107 |
|
| 10108 |
(define_insn "*cond_arith" |
| 10109 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 10110 |
(match_operator:SI 5 "shiftable_operator" |
| 10111 |
[(match_operator:SI 4 "arm_comparison_operator" |
| 10112 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 10113 |
(match_operand:SI 3 "arm_rhs_operand" "rI,rI")]) |
| 10114 |
(match_operand:SI 1 "s_register_operand" "0,?r")])) |
| 10115 |
(clobber (reg:CC CC_REGNUM))] |
| 10116 |
"TARGET_ARM" |
| 10117 |
"* |
| 10118 |
if (GET_CODE (operands[4]) == LT && operands[3] == const0_rtx) |
| 10119 |
return \"%i5\\t%0, %1, %2, lsr #31\"; |
| 10120 |
|
| 10121 |
output_asm_insn (\"cmp\\t%2, %3\", operands); |
| 10122 |
if (GET_CODE (operands[5]) == AND) |
| 10123 |
output_asm_insn (\"mov%D4\\t%0, #0\", operands); |
| 10124 |
else if (GET_CODE (operands[5]) == MINUS) |
| 10125 |
output_asm_insn (\"rsb%D4\\t%0, %1, #0\", operands); |
| 10126 |
else if (which_alternative != 0) |
| 10127 |
output_asm_insn (\"mov%D4\\t%0, %1\", operands); |
| 10128 |
return \"%i5%d4\\t%0, %1, #1\"; |
| 10129 |
" |
| 10130 |
[(set_attr "conds" "clob") |
| 10131 |
(set_attr "length" "12") |
| 10132 |
(set_attr "type" "multiple")] |
| 10133 |
) |
| 10134 |
|
| 10135 |
(define_insn "*cond_sub" |
| 10136 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 10137 |
(minus:SI (match_operand:SI 1 "s_register_operand" "0,?r") |
| 10138 |
(match_operator:SI 4 "arm_comparison_operator" |
| 10139 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 10140 |
(match_operand:SI 3 "arm_rhs_operand" "rI,rI")]))) |
| 10141 |
(clobber (reg:CC CC_REGNUM))] |
| 10142 |
"TARGET_ARM" |
| 10143 |
"* |
| 10144 |
output_asm_insn (\"cmp\\t%2, %3\", operands); |
| 10145 |
if (which_alternative != 0) |
| 10146 |
output_asm_insn (\"mov%D4\\t%0, %1\", operands); |
| 10147 |
return \"sub%d4\\t%0, %1, #1\"; |
| 10148 |
" |
| 10149 |
[(set_attr "conds" "clob") |
| 10150 |
(set_attr "length" "8,12") |
| 10151 |
(set_attr "type" "multiple")] |
| 10152 |
) |
| 10153 |
|
| 10154 |
;; (pred4 && pred5) != 0 |
| 10155 |
(define_insn "*cmp_ite0" |
| 10156 |
[(set (match_operand 6 "dominant_cc_register" "") |
| 10157 |
(compare |
| 10158 |
(if_then_else:SI |
| 10159 |
(match_operator 4 "arm_comparison_operator" |
| 10160 |
[(match_operand:SI 0 "s_register_operand" |
| 10161 |
"l,l,l,r,r,r,r,r,r") |
| 10162 |
(match_operand:SI 1 "arm_add_operand" |
| 10163 |
"lPy,lPy,lPy,rI,L,rI,L,rI,L")]) |
| 10164 |
(match_operator:SI 5 "arm_comparison_operator" |
| 10165 |
[(match_operand:SI 2 "s_register_operand" |
| 10166 |
"l,r,r,l,l,r,r,r,r") |
| 10167 |
(match_operand:SI 3 "arm_add_operand" |
| 10168 |
"lPy,rI,L,lPy,lPy,rI,rI,L,L")]) |
| 10169 |
(const_int 0)) |
| 10170 |
(const_int 0)))] |
| 10171 |
"TARGET_32BIT |
| 10172 |
&& GET_MODE (operands[6]) != CCmode |
| 10173 |
&& (GET_MODE (operands[6]) |
| 10174 |
== arm_select_dominance_cc_mode (operands[4], operands[5], |
| 10175 |
DOM_CC_X_AND_Y))" |
| 10176 |
"* |
| 10177 |
{ |
| 10178 |
static const char * const cmp1[NUM_OF_COND_CMP][2] = |
| 10179 |
{ |
| 10180 |
{\"cmp%d5\\t%0, %1\", |
| 10181 |
\"cmp%d4\\t%2, %3\"}, |
| 10182 |
{\"cmn%d5\\t%0, #%n1\", |
| 10183 |
\"cmp%d4\\t%2, %3\"}, |
| 10184 |
{\"cmp%d5\\t%0, %1\", |
| 10185 |
\"cmn%d4\\t%2, #%n3\"}, |
| 10186 |
{\"cmn%d5\\t%0, #%n1\", |
| 10187 |
\"cmn%d4\\t%2, #%n3\"} |
| 10188 |
}; |
| 10189 |
static const char * const cmp2[NUM_OF_COND_CMP][2] = |
| 10190 |
{ |
| 10191 |
{\"cmp\\t%2, %3\", |
| 10192 |
\"cmp\\t%0, %1\"}, |
| 10193 |
{\"cmp\\t%2, %3\", |
| 10194 |
\"cmn\\t%0, #%n1\"}, |
| 10195 |
{\"cmn\\t%2, #%n3\", |
| 10196 |
\"cmp\\t%0, %1\"}, |
| 10197 |
{\"cmn\\t%2, #%n3\", |
| 10198 |
\"cmn\\t%0, #%n1\"} |
| 10199 |
}; |
| 10200 |
static const char * const ite[2] = |
| 10201 |
{ |
| 10202 |
\"it\\t%d5\", |
| 10203 |
\"it\\t%d4\" |
| 10204 |
}; |
| 10205 |
static const int cmp_idx[9] = {CMP_CMP, CMP_CMP, CMP_CMN, |
| 10206 |
CMP_CMP, CMN_CMP, CMP_CMP, |
| 10207 |
CMN_CMP, CMP_CMN, CMN_CMN}; |
| 10208 |
int swap = |
| 10209 |
comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[4])); |
| 10210 |
|
| 10211 |
output_asm_insn (cmp2[cmp_idx[which_alternative]][swap], operands); |
| 10212 |
if (TARGET_THUMB2) { |
| 10213 |
output_asm_insn (ite[swap], operands); |
| 10214 |
} |
| 10215 |
output_asm_insn (cmp1[cmp_idx[which_alternative]][swap], operands); |
| 10216 |
return \"\"; |
| 10217 |
}" |
| 10218 |
[(set_attr "conds" "set") |
| 10219 |
(set_attr "arch" "t2,t2,t2,t2,t2,any,any,any,any") |
| 10220 |
(set_attr "enabled_for_short_it" "yes,no,no,no,no,no,no,no,no") |
| 10221 |
(set_attr "type" "multiple") |
| 10222 |
(set_attr_alternative "length" |
| 10223 |
[(const_int 6) |
| 10224 |
(const_int 8) |
| 10225 |
(const_int 8) |
| 10226 |
(const_int 8) |
| 10227 |
(const_int 8) |
| 10228 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10229 |
(const_int 8) |
| 10230 |
(const_int 10)) |
| 10231 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10232 |
(const_int 8) |
| 10233 |
(const_int 10)) |
| 10234 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10235 |
(const_int 8) |
| 10236 |
(const_int 10)) |
| 10237 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10238 |
(const_int 8) |
| 10239 |
(const_int 10))])] |
| 10240 |
) |
| 10241 |
|
| 10242 |
;; (!pred4 || pred5) != 0 |
| 10243 |
(define_insn "*cmp_ite1" |
| 10244 |
[(set (match_operand 6 "dominant_cc_register" "") |
| 10245 |
(compare |
| 10246 |
(if_then_else:SI |
| 10247 |
(match_operator 4 "arm_comparison_operator" |
| 10248 |
[(match_operand:SI 0 "s_register_operand" |
| 10249 |
"l,l,l,r,r,r,r,r,r") |
| 10250 |
(match_operand:SI 1 "arm_add_operand" |
| 10251 |
"lPy,lPy,lPy,rI,L,rI,L,rI,L")]) |
| 10252 |
(match_operator:SI 5 "arm_comparison_operator" |
| 10253 |
[(match_operand:SI 2 "s_register_operand" |
| 10254 |
"l,r,r,l,l,r,r,r,r") |
| 10255 |
(match_operand:SI 3 "arm_add_operand" |
| 10256 |
"lPy,rI,L,lPy,lPy,rI,rI,L,L")]) |
| 10257 |
(const_int 1)) |
| 10258 |
(const_int 0)))] |
| 10259 |
"TARGET_32BIT |
| 10260 |
&& GET_MODE (operands[6]) != CCmode |
| 10261 |
&& (GET_MODE (operands[6]) |
| 10262 |
== arm_select_dominance_cc_mode (operands[4], operands[5], |
| 10263 |
DOM_CC_NX_OR_Y))" |
| 10264 |
"* |
| 10265 |
{ |
| 10266 |
static const char * const cmp1[NUM_OF_COND_CMP][2] = |
| 10267 |
{ |
| 10268 |
{\"cmp\\t%0, %1\", |
| 10269 |
\"cmp\\t%2, %3\"}, |
| 10270 |
{\"cmn\\t%0, #%n1\", |
| 10271 |
\"cmp\\t%2, %3\"}, |
| 10272 |
{\"cmp\\t%0, %1\", |
| 10273 |
\"cmn\\t%2, #%n3\"}, |
| 10274 |
{\"cmn\\t%0, #%n1\", |
| 10275 |
\"cmn\\t%2, #%n3\"} |
| 10276 |
}; |
| 10277 |
static const char * const cmp2[NUM_OF_COND_CMP][2] = |
| 10278 |
{ |
| 10279 |
{\"cmp%d4\\t%2, %3\", |
| 10280 |
\"cmp%D5\\t%0, %1\"}, |
| 10281 |
{\"cmp%d4\\t%2, %3\", |
| 10282 |
\"cmn%D5\\t%0, #%n1\"}, |
| 10283 |
{\"cmn%d4\\t%2, #%n3\", |
| 10284 |
\"cmp%D5\\t%0, %1\"}, |
| 10285 |
{\"cmn%d4\\t%2, #%n3\", |
| 10286 |
\"cmn%D5\\t%0, #%n1\"} |
| 10287 |
}; |
| 10288 |
static const char * const ite[2] = |
| 10289 |
{ |
| 10290 |
\"it\\t%d4\", |
| 10291 |
\"it\\t%D5\" |
| 10292 |
}; |
| 10293 |
static const int cmp_idx[9] = {CMP_CMP, CMP_CMP, CMP_CMN, |
| 10294 |
CMP_CMP, CMN_CMP, CMP_CMP, |
| 10295 |
CMN_CMP, CMP_CMN, CMN_CMN}; |
| 10296 |
int swap = |
| 10297 |
comparison_dominates_p (GET_CODE (operands[5]), |
| 10298 |
reverse_condition (GET_CODE (operands[4]))); |
| 10299 |
|
| 10300 |
output_asm_insn (cmp1[cmp_idx[which_alternative]][swap], operands); |
| 10301 |
if (TARGET_THUMB2) { |
| 10302 |
output_asm_insn (ite[swap], operands); |
| 10303 |
} |
| 10304 |
output_asm_insn (cmp2[cmp_idx[which_alternative]][swap], operands); |
| 10305 |
return \"\"; |
| 10306 |
}" |
| 10307 |
[(set_attr "conds" "set") |
| 10308 |
(set_attr "arch" "t2,t2,t2,t2,t2,any,any,any,any") |
| 10309 |
(set_attr "enabled_for_short_it" "yes,no,no,no,no,no,no,no,no") |
| 10310 |
(set_attr_alternative "length" |
| 10311 |
[(const_int 6) |
| 10312 |
(const_int 8) |
| 10313 |
(const_int 8) |
| 10314 |
(const_int 8) |
| 10315 |
(const_int 8) |
| 10316 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10317 |
(const_int 8) |
| 10318 |
(const_int 10)) |
| 10319 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10320 |
(const_int 8) |
| 10321 |
(const_int 10)) |
| 10322 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10323 |
(const_int 8) |
| 10324 |
(const_int 10)) |
| 10325 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10326 |
(const_int 8) |
| 10327 |
(const_int 10))]) |
| 10328 |
(set_attr "type" "multiple")] |
| 10329 |
) |
| 10330 |
|
| 10331 |
(define_insn "*cmp_and" |
| 10332 |
[(set (match_operand 6 "dominant_cc_register" "") |
| 10333 |
(compare |
| 10334 |
(and:SI |
| 10335 |
(match_operator 4 "arm_comparison_operator" |
| 10336 |
[(match_operand:SI 0 "s_register_operand" |
| 10337 |
"l,l,l,r,r,r,r,r,r,r") |
| 10338 |
(match_operand:SI 1 "arm_add_operand" |
| 10339 |
"lPy,lPy,lPy,rI,L,r,rI,L,rI,L")]) |
| 10340 |
(match_operator:SI 5 "arm_comparison_operator" |
| 10341 |
[(match_operand:SI 2 "s_register_operand" |
| 10342 |
"l,r,r,l,l,r,r,r,r,r") |
| 10343 |
(match_operand:SI 3 "arm_add_operand" |
| 10344 |
"lPy,rI,L,lPy,lPy,r,rI,rI,L,L")])) |
| 10345 |
(const_int 0)))] |
| 10346 |
"TARGET_32BIT |
| 10347 |
&& GET_MODE (operands[6]) != CCmode |
| 10348 |
&& (GET_MODE (operands[6]) |
| 10349 |
== arm_select_dominance_cc_mode (operands[4], operands[5], |
| 10350 |
DOM_CC_X_AND_Y))" |
| 10351 |
"* |
| 10352 |
{ |
| 10353 |
static const char *const cmp1[NUM_OF_COND_CMP][2] = |
| 10354 |
{ |
| 10355 |
{\"cmp%d5\\t%0, %1\", |
| 10356 |
\"cmp%d4\\t%2, %3\"}, |
| 10357 |
{\"cmn%d5\\t%0, #%n1\", |
| 10358 |
\"cmp%d4\\t%2, %3\"}, |
| 10359 |
{\"cmp%d5\\t%0, %1\", |
| 10360 |
\"cmn%d4\\t%2, #%n3\"}, |
| 10361 |
{\"cmn%d5\\t%0, #%n1\", |
| 10362 |
\"cmn%d4\\t%2, #%n3\"} |
| 10363 |
}; |
| 10364 |
static const char *const cmp2[NUM_OF_COND_CMP][2] = |
| 10365 |
{ |
| 10366 |
{\"cmp\\t%2, %3\", |
| 10367 |
\"cmp\\t%0, %1\"}, |
| 10368 |
{\"cmp\\t%2, %3\", |
| 10369 |
\"cmn\\t%0, #%n1\"}, |
| 10370 |
{\"cmn\\t%2, #%n3\", |
| 10371 |
\"cmp\\t%0, %1\"}, |
| 10372 |
{\"cmn\\t%2, #%n3\", |
| 10373 |
\"cmn\\t%0, #%n1\"} |
| 10374 |
}; |
| 10375 |
static const char *const ite[2] = |
| 10376 |
{ |
| 10377 |
\"it\\t%d5\", |
| 10378 |
\"it\\t%d4\" |
| 10379 |
}; |
| 10380 |
static const int cmp_idx[] = {CMP_CMP, CMP_CMP, CMP_CMN, |
| 10381 |
CMP_CMP, CMN_CMP, CMP_CMP, |
| 10382 |
CMP_CMP, CMN_CMP, CMP_CMN, |
| 10383 |
CMN_CMN}; |
| 10384 |
int swap = |
| 10385 |
comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[4])); |
| 10386 |
|
| 10387 |
output_asm_insn (cmp2[cmp_idx[which_alternative]][swap], operands); |
| 10388 |
if (TARGET_THUMB2) { |
| 10389 |
output_asm_insn (ite[swap], operands); |
| 10390 |
} |
| 10391 |
output_asm_insn (cmp1[cmp_idx[which_alternative]][swap], operands); |
| 10392 |
return \"\"; |
| 10393 |
}" |
| 10394 |
[(set_attr "conds" "set") |
| 10395 |
(set_attr "predicable" "no") |
| 10396 |
(set_attr "arch" "t2,t2,t2,t2,t2,t2,any,any,any,any") |
| 10397 |
(set_attr "enabled_for_short_it" "yes,no,no,no,no,yes,no,no,no,no") |
| 10398 |
(set_attr_alternative "length" |
| 10399 |
[(const_int 6) |
| 10400 |
(const_int 8) |
| 10401 |
(const_int 8) |
| 10402 |
(const_int 8) |
| 10403 |
(const_int 8) |
| 10404 |
(const_int 6) |
| 10405 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10406 |
(const_int 8) |
| 10407 |
(const_int 10)) |
| 10408 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10409 |
(const_int 8) |
| 10410 |
(const_int 10)) |
| 10411 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10412 |
(const_int 8) |
| 10413 |
(const_int 10)) |
| 10414 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10415 |
(const_int 8) |
| 10416 |
(const_int 10))]) |
| 10417 |
(set_attr "type" "multiple")] |
| 10418 |
) |
| 10419 |
|
| 10420 |
(define_insn "*cmp_ior" |
| 10421 |
[(set (match_operand 6 "dominant_cc_register" "") |
| 10422 |
(compare |
| 10423 |
(ior:SI |
| 10424 |
(match_operator 4 "arm_comparison_operator" |
| 10425 |
[(match_operand:SI 0 "s_register_operand" |
| 10426 |
"l,l,l,r,r,r,r,r,r,r") |
| 10427 |
(match_operand:SI 1 "arm_add_operand" |
| 10428 |
"lPy,lPy,lPy,rI,L,r,rI,L,rI,L")]) |
| 10429 |
(match_operator:SI 5 "arm_comparison_operator" |
| 10430 |
[(match_operand:SI 2 "s_register_operand" |
| 10431 |
"l,r,r,l,l,r,r,r,r,r") |
| 10432 |
(match_operand:SI 3 "arm_add_operand" |
| 10433 |
"lPy,rI,L,lPy,lPy,r,rI,rI,L,L")])) |
| 10434 |
(const_int 0)))] |
| 10435 |
"TARGET_32BIT |
| 10436 |
&& GET_MODE (operands[6]) != CCmode |
| 10437 |
&& (GET_MODE (operands[6]) |
| 10438 |
== arm_select_dominance_cc_mode (operands[4], operands[5], |
| 10439 |
DOM_CC_X_OR_Y))" |
| 10440 |
"* |
| 10441 |
{ |
| 10442 |
static const char *const cmp1[NUM_OF_COND_CMP][2] = |
| 10443 |
{ |
| 10444 |
{\"cmp\\t%0, %1\", |
| 10445 |
\"cmp\\t%2, %3\"}, |
| 10446 |
{\"cmn\\t%0, #%n1\", |
| 10447 |
\"cmp\\t%2, %3\"}, |
| 10448 |
{\"cmp\\t%0, %1\", |
| 10449 |
\"cmn\\t%2, #%n3\"}, |
| 10450 |
{\"cmn\\t%0, #%n1\", |
| 10451 |
\"cmn\\t%2, #%n3\"} |
| 10452 |
}; |
| 10453 |
static const char *const cmp2[NUM_OF_COND_CMP][2] = |
| 10454 |
{ |
| 10455 |
{\"cmp%D4\\t%2, %3\", |
| 10456 |
\"cmp%D5\\t%0, %1\"}, |
| 10457 |
{\"cmp%D4\\t%2, %3\", |
| 10458 |
\"cmn%D5\\t%0, #%n1\"}, |
| 10459 |
{\"cmn%D4\\t%2, #%n3\", |
| 10460 |
\"cmp%D5\\t%0, %1\"}, |
| 10461 |
{\"cmn%D4\\t%2, #%n3\", |
| 10462 |
\"cmn%D5\\t%0, #%n1\"} |
| 10463 |
}; |
| 10464 |
static const char *const ite[2] = |
| 10465 |
{ |
| 10466 |
\"it\\t%D4\", |
| 10467 |
\"it\\t%D5\" |
| 10468 |
}; |
| 10469 |
static const int cmp_idx[] = {CMP_CMP, CMP_CMP, CMP_CMN, |
| 10470 |
CMP_CMP, CMN_CMP, CMP_CMP, |
| 10471 |
CMP_CMP, CMN_CMP, CMP_CMN, |
| 10472 |
CMN_CMN}; |
| 10473 |
int swap = |
| 10474 |
comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[4])); |
| 10475 |
|
| 10476 |
output_asm_insn (cmp1[cmp_idx[which_alternative]][swap], operands); |
| 10477 |
if (TARGET_THUMB2) { |
| 10478 |
output_asm_insn (ite[swap], operands); |
| 10479 |
} |
| 10480 |
output_asm_insn (cmp2[cmp_idx[which_alternative]][swap], operands); |
| 10481 |
return \"\"; |
| 10482 |
} |
| 10483 |
" |
| 10484 |
[(set_attr "conds" "set") |
| 10485 |
(set_attr "arch" "t2,t2,t2,t2,t2,t2,any,any,any,any") |
| 10486 |
(set_attr "enabled_for_short_it" "yes,no,no,no,no,yes,no,no,no,no") |
| 10487 |
(set_attr_alternative "length" |
| 10488 |
[(const_int 6) |
| 10489 |
(const_int 8) |
| 10490 |
(const_int 8) |
| 10491 |
(const_int 8) |
| 10492 |
(const_int 8) |
| 10493 |
(const_int 6) |
| 10494 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10495 |
(const_int 8) |
| 10496 |
(const_int 10)) |
| 10497 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10498 |
(const_int 8) |
| 10499 |
(const_int 10)) |
| 10500 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10501 |
(const_int 8) |
| 10502 |
(const_int 10)) |
| 10503 |
(if_then_else (eq_attr "is_thumb" "no") |
| 10504 |
(const_int 8) |
| 10505 |
(const_int 10))]) |
| 10506 |
(set_attr "type" "multiple")] |
| 10507 |
) |
| 10508 |
|
| 10509 |
(define_insn_and_split "*ior_scc_scc" |
| 10510 |
[(set (match_operand:SI 0 "s_register_operand" "=Ts,Ts") |
| 10511 |
(ior:SI (match_operator:SI 3 "arm_comparison_operator" |
| 10512 |
[(match_operand:SI 1 "s_register_operand" "l,r") |
| 10513 |
(match_operand:SI 2 "arm_add_operand" "lPy,rIL")]) |
| 10514 |
(match_operator:SI 6 "arm_comparison_operator" |
| 10515 |
[(match_operand:SI 4 "s_register_operand" "l,r") |
| 10516 |
(match_operand:SI 5 "arm_add_operand" "lPy,rIL")]))) |
| 10517 |
(clobber (reg:CC CC_REGNUM))] |
| 10518 |
"TARGET_32BIT |
| 10519 |
&& (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_OR_Y) |
| 10520 |
!= CCmode)" |
| 10521 |
"#" |
| 10522 |
"TARGET_32BIT && reload_completed" |
| 10523 |
[(set (match_dup 7) |
| 10524 |
(compare |
| 10525 |
(ior:SI |
| 10526 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)]) |
| 10527 |
(match_op_dup 6 [(match_dup 4) (match_dup 5)])) |
| 10528 |
(const_int 0))) |
| 10529 |
(set (match_dup 0) (ne:SI (match_dup 7) (const_int 0)))] |
| 10530 |
"operands[7] |
| 10531 |
= gen_rtx_REG (arm_select_dominance_cc_mode (operands[3], operands[6], |
| 10532 |
DOM_CC_X_OR_Y), |
| 10533 |
CC_REGNUM);" |
| 10534 |
[(set_attr "conds" "clob") |
| 10535 |
(set_attr "enabled_for_short_it" "yes,no") |
| 10536 |
(set_attr "length" "16") |
| 10537 |
(set_attr "type" "multiple")] |
| 10538 |
) |
| 10539 |
|
| 10540 |
; If the above pattern is followed by a CMP insn, then the compare is |
| 10541 |
; redundant, since we can rework the conditional instruction that follows. |
| 10542 |
(define_insn_and_split "*ior_scc_scc_cmp" |
| 10543 |
[(set (match_operand 0 "dominant_cc_register" "") |
| 10544 |
(compare (ior:SI (match_operator:SI 3 "arm_comparison_operator" |
| 10545 |
[(match_operand:SI 1 "s_register_operand" "l,r") |
| 10546 |
(match_operand:SI 2 "arm_add_operand" "lPy,rIL")]) |
| 10547 |
(match_operator:SI 6 "arm_comparison_operator" |
| 10548 |
[(match_operand:SI 4 "s_register_operand" "l,r") |
| 10549 |
(match_operand:SI 5 "arm_add_operand" "lPy,rIL")])) |
| 10550 |
(const_int 0))) |
| 10551 |
(set (match_operand:SI 7 "s_register_operand" "=Ts,Ts") |
| 10552 |
(ior:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)]) |
| 10553 |
(match_op_dup 6 [(match_dup 4) (match_dup 5)])))] |
| 10554 |
"TARGET_32BIT" |
| 10555 |
"#" |
| 10556 |
"TARGET_32BIT && reload_completed" |
| 10557 |
[(set (match_dup 0) |
| 10558 |
(compare |
| 10559 |
(ior:SI |
| 10560 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)]) |
| 10561 |
(match_op_dup 6 [(match_dup 4) (match_dup 5)])) |
| 10562 |
(const_int 0))) |
| 10563 |
(set (match_dup 7) (ne:SI (match_dup 0) (const_int 0)))] |
| 10564 |
"" |
| 10565 |
[(set_attr "conds" "set") |
| 10566 |
(set_attr "enabled_for_short_it" "yes,no") |
| 10567 |
(set_attr "length" "16") |
| 10568 |
(set_attr "type" "multiple")] |
| 10569 |
) |
| 10570 |
|
| 10571 |
(define_insn_and_split "*and_scc_scc" |
| 10572 |
[(set (match_operand:SI 0 "s_register_operand" "=Ts,Ts") |
| 10573 |
(and:SI (match_operator:SI 3 "arm_comparison_operator" |
| 10574 |
[(match_operand:SI 1 "s_register_operand" "l,r") |
| 10575 |
(match_operand:SI 2 "arm_add_operand" "lPy,rIL")]) |
| 10576 |
(match_operator:SI 6 "arm_comparison_operator" |
| 10577 |
[(match_operand:SI 4 "s_register_operand" "l,r") |
| 10578 |
(match_operand:SI 5 "arm_add_operand" "lPy,rIL")]))) |
| 10579 |
(clobber (reg:CC CC_REGNUM))] |
| 10580 |
"TARGET_32BIT |
| 10581 |
&& (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y) |
| 10582 |
!= CCmode)" |
| 10583 |
"#" |
| 10584 |
"TARGET_32BIT && reload_completed |
| 10585 |
&& (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y) |
| 10586 |
!= CCmode)" |
| 10587 |
[(set (match_dup 7) |
| 10588 |
(compare |
| 10589 |
(and:SI |
| 10590 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)]) |
| 10591 |
(match_op_dup 6 [(match_dup 4) (match_dup 5)])) |
| 10592 |
(const_int 0))) |
| 10593 |
(set (match_dup 0) (ne:SI (match_dup 7) (const_int 0)))] |
| 10594 |
"operands[7] |
| 10595 |
= gen_rtx_REG (arm_select_dominance_cc_mode (operands[3], operands[6], |
| 10596 |
DOM_CC_X_AND_Y), |
| 10597 |
CC_REGNUM);" |
| 10598 |
[(set_attr "conds" "clob") |
| 10599 |
(set_attr "enabled_for_short_it" "yes,no") |
| 10600 |
(set_attr "length" "16") |
| 10601 |
(set_attr "type" "multiple")] |
| 10602 |
) |
| 10603 |
|
| 10604 |
; If the above pattern is followed by a CMP insn, then the compare is |
| 10605 |
; redundant, since we can rework the conditional instruction that follows. |
| 10606 |
(define_insn_and_split "*and_scc_scc_cmp" |
| 10607 |
[(set (match_operand 0 "dominant_cc_register" "") |
| 10608 |
(compare (and:SI (match_operator:SI 3 "arm_comparison_operator" |
| 10609 |
[(match_operand:SI 1 "s_register_operand" "l,r") |
| 10610 |
(match_operand:SI 2 "arm_add_operand" "lPy,rIL")]) |
| 10611 |
(match_operator:SI 6 "arm_comparison_operator" |
| 10612 |
[(match_operand:SI 4 "s_register_operand" "l,r") |
| 10613 |
(match_operand:SI 5 "arm_add_operand" "lPy,rIL")])) |
| 10614 |
(const_int 0))) |
| 10615 |
(set (match_operand:SI 7 "s_register_operand" "=Ts,Ts") |
| 10616 |
(and:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)]) |
| 10617 |
(match_op_dup 6 [(match_dup 4) (match_dup 5)])))] |
| 10618 |
"TARGET_32BIT" |
| 10619 |
"#" |
| 10620 |
"TARGET_32BIT && reload_completed" |
| 10621 |
[(set (match_dup 0) |
| 10622 |
(compare |
| 10623 |
(and:SI |
| 10624 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)]) |
| 10625 |
(match_op_dup 6 [(match_dup 4) (match_dup 5)])) |
| 10626 |
(const_int 0))) |
| 10627 |
(set (match_dup 7) (ne:SI (match_dup 0) (const_int 0)))] |
| 10628 |
"" |
| 10629 |
[(set_attr "conds" "set") |
| 10630 |
(set_attr "enabled_for_short_it" "yes,no") |
| 10631 |
(set_attr "length" "16") |
| 10632 |
(set_attr "type" "multiple")] |
| 10633 |
) |
| 10634 |
|
| 10635 |
;; If there is no dominance in the comparison, then we can still save an |
| 10636 |
;; instruction in the AND case, since we can know that the second compare |
| 10637 |
;; need only zero the value if false (if true, then the value is already |
| 10638 |
;; correct). |
| 10639 |
(define_insn_and_split "*and_scc_scc_nodom" |
| 10640 |
[(set (match_operand:SI 0 "s_register_operand" "=&Ts,&Ts,&Ts") |
| 10641 |
(and:SI (match_operator:SI 3 "arm_comparison_operator" |
| 10642 |
[(match_operand:SI 1 "s_register_operand" "r,r,0") |
| 10643 |
(match_operand:SI 2 "arm_add_operand" "rIL,0,rIL")]) |
| 10644 |
(match_operator:SI 6 "arm_comparison_operator" |
| 10645 |
[(match_operand:SI 4 "s_register_operand" "r,r,r") |
| 10646 |
(match_operand:SI 5 "arm_add_operand" "rIL,rIL,rIL")]))) |
| 10647 |
(clobber (reg:CC CC_REGNUM))] |
| 10648 |
"TARGET_32BIT |
| 10649 |
&& (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y) |
| 10650 |
== CCmode)" |
| 10651 |
"#" |
| 10652 |
"TARGET_32BIT && reload_completed" |
| 10653 |
[(parallel [(set (match_dup 0) |
| 10654 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)])) |
| 10655 |
(clobber (reg:CC CC_REGNUM))]) |
| 10656 |
(set (match_dup 7) (match_op_dup 8 [(match_dup 4) (match_dup 5)])) |
| 10657 |
(set (match_dup 0) |
| 10658 |
(if_then_else:SI (match_op_dup 6 [(match_dup 7) (const_int 0)]) |
| 10659 |
(match_dup 0) |
| 10660 |
(const_int 0)))] |
| 10661 |
"operands[7] = gen_rtx_REG (SELECT_CC_MODE (GET_CODE (operands[6]), |
| 10662 |
operands[4], operands[5]), |
| 10663 |
CC_REGNUM); |
| 10664 |
operands[8] = gen_rtx_COMPARE (GET_MODE (operands[7]), operands[4], |
| 10665 |
operands[5]);" |
| 10666 |
[(set_attr "conds" "clob") |
| 10667 |
(set_attr "length" "20") |
| 10668 |
(set_attr "type" "multiple")] |
| 10669 |
) |
| 10670 |
|
| 10671 |
(define_split |
| 10672 |
[(set (reg:CC_NZ CC_REGNUM) |
| 10673 |
(compare:CC_NZ (ior:SI |
| 10674 |
(and:SI (match_operand:SI 0 "s_register_operand" "") |
| 10675 |
(const_int 1)) |
| 10676 |
(match_operator:SI 1 "arm_comparison_operator" |
| 10677 |
[(match_operand:SI 2 "s_register_operand" "") |
| 10678 |
(match_operand:SI 3 "arm_add_operand" "")])) |
| 10679 |
(const_int 0))) |
| 10680 |
(clobber (match_operand:SI 4 "s_register_operand" ""))] |
| 10681 |
"TARGET_ARM" |
| 10682 |
[(set (match_dup 4) |
| 10683 |
(ior:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)]) |
| 10684 |
(match_dup 0))) |
| 10685 |
(set (reg:CC_NZ CC_REGNUM) |
| 10686 |
(compare:CC_NZ (and:SI (match_dup 4) (const_int 1)) |
| 10687 |
(const_int 0)))] |
| 10688 |
"") |
| 10689 |
|
| 10690 |
(define_split |
| 10691 |
[(set (reg:CC_NZ CC_REGNUM) |
| 10692 |
(compare:CC_NZ (ior:SI |
| 10693 |
(match_operator:SI 1 "arm_comparison_operator" |
| 10694 |
[(match_operand:SI 2 "s_register_operand" "") |
| 10695 |
(match_operand:SI 3 "arm_add_operand" "")]) |
| 10696 |
(and:SI (match_operand:SI 0 "s_register_operand" "") |
| 10697 |
(const_int 1))) |
| 10698 |
(const_int 0))) |
| 10699 |
(clobber (match_operand:SI 4 "s_register_operand" ""))] |
| 10700 |
"TARGET_ARM" |
| 10701 |
[(set (match_dup 4) |
| 10702 |
(ior:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)]) |
| 10703 |
(match_dup 0))) |
| 10704 |
(set (reg:CC_NZ CC_REGNUM) |
| 10705 |
(compare:CC_NZ (and:SI (match_dup 4) (const_int 1)) |
| 10706 |
(const_int 0)))] |
| 10707 |
"") |
| 10708 |
;; ??? The conditional patterns above need checking for Thumb-2 usefulness |
| 10709 |
|
| 10710 |
(define_insn_and_split "*negscc" |
| 10711 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 10712 |
(neg:SI (match_operator 3 "arm_comparison_operator" |
| 10713 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 10714 |
(match_operand:SI 2 "arm_rhs_operand" "rI")]))) |
| 10715 |
(clobber (reg:CC CC_REGNUM))] |
| 10716 |
"TARGET_ARM" |
| 10717 |
"#" |
| 10718 |
"&& reload_completed" |
| 10719 |
[(const_int 0)] |
| 10720 |
{ |
| 10721 |
rtx cc_reg = gen_rtx_REG (CCmode, CC_REGNUM); |
| 10722 |
|
| 10723 |
if (GET_CODE (operands[3]) == LT && operands[2] == const0_rtx) |
| 10724 |
{ |
| 10725 |
/* Emit mov\\t%0, %1, asr #31 */ |
| 10726 |
emit_insn (gen_rtx_SET (operands[0], |
| 10727 |
gen_rtx_ASHIFTRT (SImode, |
| 10728 |
operands[1], |
| 10729 |
GEN_INT (31)))); |
| 10730 |
DONE; |
| 10731 |
} |
| 10732 |
else if (GET_CODE (operands[3]) == NE) |
| 10733 |
{ |
| 10734 |
/* Emit subs\\t%0, %1, %2\;mvnne\\t%0, #0 */ |
| 10735 |
if (CONST_INT_P (operands[2])) |
| 10736 |
emit_insn (gen_cmpsi2_addneg (operands[0], operands[1], operands[2], |
| 10737 |
gen_int_mode (-INTVAL (operands[2]), |
| 10738 |
SImode))); |
| 10739 |
else |
| 10740 |
emit_insn (gen_subsi3_compare (operands[0], operands[1], operands[2])); |
| 10741 |
|
| 10742 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 10743 |
gen_rtx_NE (SImode, |
| 10744 |
cc_reg, |
| 10745 |
const0_rtx), |
| 10746 |
gen_rtx_SET (operands[0], |
| 10747 |
GEN_INT (~0)))); |
| 10748 |
DONE; |
| 10749 |
} |
| 10750 |
else |
| 10751 |
{ |
| 10752 |
/* Emit: cmp\\t%1, %2\;mov%D3\\t%0, #0\;mvn%d3\\t%0, #0 */ |
| 10753 |
emit_insn (gen_rtx_SET (cc_reg, |
| 10754 |
gen_rtx_COMPARE (CCmode, operands[1], operands[2]))); |
| 10755 |
enum rtx_code rc = GET_CODE (operands[3]); |
| 10756 |
|
| 10757 |
rc = reverse_condition (rc); |
| 10758 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 10759 |
gen_rtx_fmt_ee (rc, |
| 10760 |
VOIDmode, |
| 10761 |
cc_reg, |
| 10762 |
const0_rtx), |
| 10763 |
gen_rtx_SET (operands[0], const0_rtx))); |
| 10764 |
rc = GET_CODE (operands[3]); |
| 10765 |
emit_insn (gen_rtx_COND_EXEC (VOIDmode, |
| 10766 |
gen_rtx_fmt_ee (rc, |
| 10767 |
VOIDmode, |
| 10768 |
cc_reg, |
| 10769 |
const0_rtx), |
| 10770 |
gen_rtx_SET (operands[0], |
| 10771 |
GEN_INT (~0)))); |
| 10772 |
DONE; |
| 10773 |
} |
| 10774 |
FAIL; |
| 10775 |
} |
| 10776 |
[(set_attr "conds" "clob") |
| 10777 |
(set_attr "length" "12") |
| 10778 |
(set_attr "type" "multiple")] |
| 10779 |
) |
| 10780 |
|
| 10781 |
(define_insn_and_split "movcond_addsi" |
| 10782 |
[(set (match_operand:SI 0 "s_register_operand" "=r,l,r") |
| 10783 |
(if_then_else:SI |
| 10784 |
(match_operator 5 "comparison_operator" |
| 10785 |
[(plus:SI (match_operand:SI 3 "s_register_operand" "r,r,r") |
| 10786 |
(match_operand:SI 4 "arm_add_operand" "rIL,rIL,rIL")) |
| 10787 |
(const_int 0)]) |
| 10788 |
(match_operand:SI 1 "arm_rhs_operand" "rI,rPy,r") |
| 10789 |
(match_operand:SI 2 "arm_rhs_operand" "rI,rPy,r"))) |
| 10790 |
(clobber (reg:CC CC_REGNUM))] |
| 10791 |
"TARGET_32BIT" |
| 10792 |
"#" |
| 10793 |
"&& reload_completed" |
| 10794 |
[(set (reg:CC_NZ CC_REGNUM) |
| 10795 |
(compare:CC_NZ |
| 10796 |
(plus:SI (match_dup 3) |
| 10797 |
(match_dup 4)) |
| 10798 |
(const_int 0))) |
| 10799 |
(set (match_dup 0) (match_dup 1)) |
| 10800 |
(cond_exec (match_dup 6) |
| 10801 |
(set (match_dup 0) (match_dup 2)))] |
| 10802 |
" |
| 10803 |
{ |
| 10804 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[5]), |
| 10805 |
operands[3], operands[4]); |
| 10806 |
enum rtx_code rc = GET_CODE (operands[5]); |
| 10807 |
operands[6] = gen_rtx_REG (mode, CC_REGNUM); |
| 10808 |
gcc_assert (!(mode == CCFPmode || mode == CCFPEmode)); |
| 10809 |
if (!REG_P (operands[2]) || REGNO (operands[2]) != REGNO (operands[0])) |
| 10810 |
rc = reverse_condition (rc); |
| 10811 |
else |
| 10812 |
std::swap (operands[1], operands[2]); |
| 10813 |
|
| 10814 |
operands[6] = gen_rtx_fmt_ee (rc, VOIDmode, operands[6], const0_rtx); |
| 10815 |
} |
| 10816 |
" |
| 10817 |
[(set_attr "conds" "clob") |
| 10818 |
(set_attr "enabled_for_short_it" "no,yes,yes") |
| 10819 |
(set_attr "type" "multiple")] |
| 10820 |
) |
| 10821 |
|
| 10822 |
(define_insn "movcond" |
| 10823 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 10824 |
(if_then_else:SI |
| 10825 |
(match_operator 5 "arm_comparison_operator" |
| 10826 |
[(match_operand:SI 3 "s_register_operand" "r,r,r") |
| 10827 |
(match_operand:SI 4 "arm_add_operand" "rIL,rIL,rIL")]) |
| 10828 |
(match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI") |
| 10829 |
(match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))) |
| 10830 |
(clobber (reg:CC CC_REGNUM))] |
| 10831 |
"TARGET_ARM" |
| 10832 |
"* |
| 10833 |
if (GET_CODE (operands[5]) == LT |
| 10834 |
&& (operands[4] == const0_rtx)) |
| 10835 |
{ |
| 10836 |
if (which_alternative != 1 && REG_P (operands[1])) |
| 10837 |
{ |
| 10838 |
if (operands[2] == const0_rtx) |
| 10839 |
return \"and\\t%0, %1, %3, asr #31\"; |
| 10840 |
return \"ands\\t%0, %1, %3, asr #32\;movcc\\t%0, %2\"; |
| 10841 |
} |
| 10842 |
else if (which_alternative != 0 && REG_P (operands[2])) |
| 10843 |
{ |
| 10844 |
if (operands[1] == const0_rtx) |
| 10845 |
return \"bic\\t%0, %2, %3, asr #31\"; |
| 10846 |
return \"bics\\t%0, %2, %3, asr #32\;movcs\\t%0, %1\"; |
| 10847 |
} |
| 10848 |
/* The only case that falls through to here is when both ops 1 & 2 |
| 10849 |
are constants. */ |
| 10850 |
} |
| 10851 |
|
| 10852 |
if (GET_CODE (operands[5]) == GE |
| 10853 |
&& (operands[4] == const0_rtx)) |
| 10854 |
{ |
| 10855 |
if (which_alternative != 1 && REG_P (operands[1])) |
| 10856 |
{ |
| 10857 |
if (operands[2] == const0_rtx) |
| 10858 |
return \"bic\\t%0, %1, %3, asr #31\"; |
| 10859 |
return \"bics\\t%0, %1, %3, asr #32\;movcs\\t%0, %2\"; |
| 10860 |
} |
| 10861 |
else if (which_alternative != 0 && REG_P (operands[2])) |
| 10862 |
{ |
| 10863 |
if (operands[1] == const0_rtx) |
| 10864 |
return \"and\\t%0, %2, %3, asr #31\"; |
| 10865 |
return \"ands\\t%0, %2, %3, asr #32\;movcc\\t%0, %1\"; |
| 10866 |
} |
| 10867 |
/* The only case that falls through to here is when both ops 1 & 2 |
| 10868 |
are constants. */ |
| 10869 |
} |
| 10870 |
if (CONST_INT_P (operands[4]) |
| 10871 |
&& !const_ok_for_arm (INTVAL (operands[4]))) |
| 10872 |
output_asm_insn (\"cmn\\t%3, #%n4\", operands); |
| 10873 |
else |
| 10874 |
output_asm_insn (\"cmp\\t%3, %4\", operands); |
| 10875 |
if (which_alternative != 0) |
| 10876 |
output_asm_insn (\"mov%d5\\t%0, %1\", operands); |
| 10877 |
if (which_alternative != 1) |
| 10878 |
output_asm_insn (\"mov%D5\\t%0, %2\", operands); |
| 10879 |
return \"\"; |
| 10880 |
" |
| 10881 |
[(set_attr "conds" "clob") |
| 10882 |
(set_attr "length" "8,8,12") |
| 10883 |
(set_attr "type" "multiple")] |
| 10884 |
) |
| 10885 |
|
| 10886 |
;; ??? The patterns below need checking for Thumb-2 usefulness. |
| 10887 |
|
| 10888 |
(define_insn "*ifcompare_plus_move" |
| 10889 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 10890 |
(if_then_else:SI (match_operator 6 "arm_comparison_operator" |
| 10891 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 10892 |
(match_operand:SI 5 "arm_add_operand" "rIL,rIL")]) |
| 10893 |
(plus:SI |
| 10894 |
(match_operand:SI 2 "s_register_operand" "r,r") |
| 10895 |
(match_operand:SI 3 "arm_add_operand" "rIL,rIL")) |
| 10896 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI"))) |
| 10897 |
(clobber (reg:CC CC_REGNUM))] |
| 10898 |
"TARGET_ARM" |
| 10899 |
"#" |
| 10900 |
[(set_attr "conds" "clob") |
| 10901 |
(set_attr "length" "8,12") |
| 10902 |
(set_attr "type" "multiple")] |
| 10903 |
) |
| 10904 |
|
| 10905 |
(define_insn "*if_plus_move" |
| 10906 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r") |
| 10907 |
(if_then_else:SI |
| 10908 |
(match_operator 4 "arm_comparison_operator" |
| 10909 |
[(match_operand 5 "cc_register" "") (const_int 0)]) |
| 10910 |
(plus:SI |
| 10911 |
(match_operand:SI 2 "s_register_operand" "r,r,r,r") |
| 10912 |
(match_operand:SI 3 "arm_add_operand" "rI,L,rI,L")) |
| 10913 |
(match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI")))] |
| 10914 |
"TARGET_ARM" |
| 10915 |
"@ |
| 10916 |
add%d4\\t%0, %2, %3 |
| 10917 |
sub%d4\\t%0, %2, #%n3 |
| 10918 |
add%d4\\t%0, %2, %3\;mov%D4\\t%0, %1 |
| 10919 |
sub%d4\\t%0, %2, #%n3\;mov%D4\\t%0, %1" |
| 10920 |
[(set_attr "conds" "use") |
| 10921 |
(set_attr "length" "4,4,8,8") |
| 10922 |
(set_attr_alternative "type" |
| 10923 |
[(if_then_else (match_operand 3 "const_int_operand" "") |
| 10924 |
(const_string "alu_imm" ) |
| 10925 |
(const_string "alu_sreg")) |
| 10926 |
(const_string "alu_imm") |
| 10927 |
(const_string "multiple") |
| 10928 |
(const_string "multiple")])] |
| 10929 |
) |
| 10930 |
|
| 10931 |
(define_insn "*ifcompare_move_plus" |
| 10932 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 10933 |
(if_then_else:SI (match_operator 6 "arm_comparison_operator" |
| 10934 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 10935 |
(match_operand:SI 5 "arm_add_operand" "rIL,rIL")]) |
| 10936 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI") |
| 10937 |
(plus:SI |
| 10938 |
(match_operand:SI 2 "s_register_operand" "r,r") |
| 10939 |
(match_operand:SI 3 "arm_add_operand" "rIL,rIL")))) |
| 10940 |
(clobber (reg:CC CC_REGNUM))] |
| 10941 |
"TARGET_ARM" |
| 10942 |
"#" |
| 10943 |
[(set_attr "conds" "clob") |
| 10944 |
(set_attr "length" "8,12") |
| 10945 |
(set_attr "type" "multiple")] |
| 10946 |
) |
| 10947 |
|
| 10948 |
(define_insn "*if_move_plus" |
| 10949 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r") |
| 10950 |
(if_then_else:SI |
| 10951 |
(match_operator 4 "arm_comparison_operator" |
| 10952 |
[(match_operand 5 "cc_register" "") (const_int 0)]) |
| 10953 |
(match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI") |
| 10954 |
(plus:SI |
| 10955 |
(match_operand:SI 2 "s_register_operand" "r,r,r,r") |
| 10956 |
(match_operand:SI 3 "arm_add_operand" "rI,L,rI,L"))))] |
| 10957 |
"TARGET_ARM" |
| 10958 |
"@ |
| 10959 |
add%D4\\t%0, %2, %3 |
| 10960 |
sub%D4\\t%0, %2, #%n3 |
| 10961 |
add%D4\\t%0, %2, %3\;mov%d4\\t%0, %1 |
| 10962 |
sub%D4\\t%0, %2, #%n3\;mov%d4\\t%0, %1" |
| 10963 |
[(set_attr "conds" "use") |
| 10964 |
(set_attr "length" "4,4,8,8") |
| 10965 |
(set_attr_alternative "type" |
| 10966 |
[(if_then_else (match_operand 3 "const_int_operand" "") |
| 10967 |
(const_string "alu_imm" ) |
| 10968 |
(const_string "alu_sreg")) |
| 10969 |
(const_string "alu_imm") |
| 10970 |
(const_string "multiple") |
| 10971 |
(const_string "multiple")])] |
| 10972 |
) |
| 10973 |
|
| 10974 |
(define_insn "*ifcompare_arith_arith" |
| 10975 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 10976 |
(if_then_else:SI (match_operator 9 "arm_comparison_operator" |
| 10977 |
[(match_operand:SI 5 "s_register_operand" "r") |
| 10978 |
(match_operand:SI 6 "arm_add_operand" "rIL")]) |
| 10979 |
(match_operator:SI 8 "shiftable_operator" |
| 10980 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 10981 |
(match_operand:SI 2 "arm_rhs_operand" "rI")]) |
| 10982 |
(match_operator:SI 7 "shiftable_operator" |
| 10983 |
[(match_operand:SI 3 "s_register_operand" "r") |
| 10984 |
(match_operand:SI 4 "arm_rhs_operand" "rI")]))) |
| 10985 |
(clobber (reg:CC CC_REGNUM))] |
| 10986 |
"TARGET_ARM" |
| 10987 |
"#" |
| 10988 |
[(set_attr "conds" "clob") |
| 10989 |
(set_attr "length" "12") |
| 10990 |
(set_attr "type" "multiple")] |
| 10991 |
) |
| 10992 |
|
| 10993 |
(define_insn "*if_arith_arith" |
| 10994 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 10995 |
(if_then_else:SI (match_operator 5 "arm_comparison_operator" |
| 10996 |
[(match_operand 8 "cc_register" "") (const_int 0)]) |
| 10997 |
(match_operator:SI 6 "shiftable_operator" |
| 10998 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 10999 |
(match_operand:SI 2 "arm_rhs_operand" "rI")]) |
| 11000 |
(match_operator:SI 7 "shiftable_operator" |
| 11001 |
[(match_operand:SI 3 "s_register_operand" "r") |
| 11002 |
(match_operand:SI 4 "arm_rhs_operand" "rI")])))] |
| 11003 |
"TARGET_ARM" |
| 11004 |
"%I6%d5\\t%0, %1, %2\;%I7%D5\\t%0, %3, %4" |
| 11005 |
[(set_attr "conds" "use") |
| 11006 |
(set_attr "length" "8") |
| 11007 |
(set_attr "type" "multiple")] |
| 11008 |
) |
| 11009 |
|
| 11010 |
(define_insn "*ifcompare_arith_move" |
| 11011 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11012 |
(if_then_else:SI (match_operator 6 "arm_comparison_operator" |
| 11013 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 11014 |
(match_operand:SI 3 "arm_add_operand" "rIL,rIL")]) |
| 11015 |
(match_operator:SI 7 "shiftable_operator" |
| 11016 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 11017 |
(match_operand:SI 5 "arm_rhs_operand" "rI,rI")]) |
| 11018 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI"))) |
| 11019 |
(clobber (reg:CC CC_REGNUM))] |
| 11020 |
"TARGET_ARM" |
| 11021 |
"* |
| 11022 |
/* If we have an operation where (op x 0) is the identity operation and |
| 11023 |
the conditional operator is LT or GE and we are comparing against zero and |
| 11024 |
everything is in registers then we can do this in two instructions. */ |
| 11025 |
if (operands[3] == const0_rtx |
| 11026 |
&& GET_CODE (operands[7]) != AND |
| 11027 |
&& REG_P (operands[5]) |
| 11028 |
&& REG_P (operands[1]) |
| 11029 |
&& REGNO (operands[1]) == REGNO (operands[4]) |
| 11030 |
&& REGNO (operands[4]) != REGNO (operands[0])) |
| 11031 |
{ |
| 11032 |
if (GET_CODE (operands[6]) == LT) |
| 11033 |
return \"and\\t%0, %5, %2, asr #31\;%I7\\t%0, %4, %0\"; |
| 11034 |
else if (GET_CODE (operands[6]) == GE) |
| 11035 |
return \"bic\\t%0, %5, %2, asr #31\;%I7\\t%0, %4, %0\"; |
| 11036 |
} |
| 11037 |
if (CONST_INT_P (operands[3]) |
| 11038 |
&& !const_ok_for_arm (INTVAL (operands[3]))) |
| 11039 |
output_asm_insn (\"cmn\\t%2, #%n3\", operands); |
| 11040 |
else |
| 11041 |
output_asm_insn (\"cmp\\t%2, %3\", operands); |
| 11042 |
output_asm_insn (\"%I7%d6\\t%0, %4, %5\", operands); |
| 11043 |
if (which_alternative != 0) |
| 11044 |
return \"mov%D6\\t%0, %1\"; |
| 11045 |
return \"\"; |
| 11046 |
" |
| 11047 |
[(set_attr "conds" "clob") |
| 11048 |
(set_attr "length" "8,12") |
| 11049 |
(set_attr "type" "multiple")] |
| 11050 |
) |
| 11051 |
|
| 11052 |
(define_insn "*if_arith_move" |
| 11053 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11054 |
(if_then_else:SI (match_operator 4 "arm_comparison_operator" |
| 11055 |
[(match_operand 6 "cc_register" "") (const_int 0)]) |
| 11056 |
(match_operator:SI 5 "shiftable_operator" |
| 11057 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 11058 |
(match_operand:SI 3 "arm_rhs_operand" "rI,rI")]) |
| 11059 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI")))] |
| 11060 |
"TARGET_ARM" |
| 11061 |
"@ |
| 11062 |
%I5%d4\\t%0, %2, %3 |
| 11063 |
%I5%d4\\t%0, %2, %3\;mov%D4\\t%0, %1" |
| 11064 |
[(set_attr "conds" "use") |
| 11065 |
(set_attr "length" "4,8") |
| 11066 |
(set_attr_alternative "type" |
| 11067 |
[(if_then_else (match_operand 3 "const_int_operand" "") |
| 11068 |
(if_then_else (match_operand 5 "alu_shift_operator_lsl_1_to_4") |
| 11069 |
(const_string "alu_shift_imm_lsl_1to4") |
| 11070 |
(const_string "alu_shift_imm_other")) |
| 11071 |
(const_string "alu_shift_reg")) |
| 11072 |
(const_string "multiple")])] |
| 11073 |
) |
| 11074 |
|
| 11075 |
(define_insn "*ifcompare_move_arith" |
| 11076 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11077 |
(if_then_else:SI (match_operator 6 "arm_comparison_operator" |
| 11078 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 11079 |
(match_operand:SI 5 "arm_add_operand" "rIL,rIL")]) |
| 11080 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI") |
| 11081 |
(match_operator:SI 7 "shiftable_operator" |
| 11082 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 11083 |
(match_operand:SI 3 "arm_rhs_operand" "rI,rI")]))) |
| 11084 |
(clobber (reg:CC CC_REGNUM))] |
| 11085 |
"TARGET_ARM" |
| 11086 |
"* |
| 11087 |
/* If we have an operation where (op x 0) is the identity operation and |
| 11088 |
the conditional operator is LT or GE and we are comparing against zero and |
| 11089 |
everything is in registers then we can do this in two instructions */ |
| 11090 |
if (operands[5] == const0_rtx |
| 11091 |
&& GET_CODE (operands[7]) != AND |
| 11092 |
&& REG_P (operands[3]) |
| 11093 |
&& REG_P (operands[1]) |
| 11094 |
&& REGNO (operands[1]) == REGNO (operands[2]) |
| 11095 |
&& REGNO (operands[2]) != REGNO (operands[0])) |
| 11096 |
{ |
| 11097 |
if (GET_CODE (operands[6]) == GE) |
| 11098 |
return \"and\\t%0, %3, %4, asr #31\;%I7\\t%0, %2, %0\"; |
| 11099 |
else if (GET_CODE (operands[6]) == LT) |
| 11100 |
return \"bic\\t%0, %3, %4, asr #31\;%I7\\t%0, %2, %0\"; |
| 11101 |
} |
| 11102 |
|
| 11103 |
if (CONST_INT_P (operands[5]) |
| 11104 |
&& !const_ok_for_arm (INTVAL (operands[5]))) |
| 11105 |
output_asm_insn (\"cmn\\t%4, #%n5\", operands); |
| 11106 |
else |
| 11107 |
output_asm_insn (\"cmp\\t%4, %5\", operands); |
| 11108 |
|
| 11109 |
if (which_alternative != 0) |
| 11110 |
output_asm_insn (\"mov%d6\\t%0, %1\", operands); |
| 11111 |
return \"%I7%D6\\t%0, %2, %3\"; |
| 11112 |
" |
| 11113 |
[(set_attr "conds" "clob") |
| 11114 |
(set_attr "length" "8,12") |
| 11115 |
(set_attr "type" "multiple")] |
| 11116 |
) |
| 11117 |
|
| 11118 |
(define_insn "*if_move_arith" |
| 11119 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11120 |
(if_then_else:SI |
| 11121 |
(match_operator 4 "arm_comparison_operator" |
| 11122 |
[(match_operand 6 "cc_register" "") (const_int 0)]) |
| 11123 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI") |
| 11124 |
(match_operator:SI 5 "shiftable_operator" |
| 11125 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 11126 |
(match_operand:SI 3 "arm_rhs_operand" "rI,rI")])))] |
| 11127 |
"TARGET_ARM" |
| 11128 |
"@ |
| 11129 |
%I5%D4\\t%0, %2, %3 |
| 11130 |
%I5%D4\\t%0, %2, %3\;mov%d4\\t%0, %1" |
| 11131 |
[(set_attr "conds" "use") |
| 11132 |
(set_attr "length" "4,8") |
| 11133 |
(set_attr_alternative "type" |
| 11134 |
[(if_then_else (match_operand 3 "const_int_operand" "") |
| 11135 |
(if_then_else (match_operand 5 "alu_shift_operator_lsl_1_to_4") |
| 11136 |
(const_string "alu_shift_imm_lsl_1to4") |
| 11137 |
(const_string "alu_shift_imm_other")) |
| 11138 |
(const_string "alu_shift_reg")) |
| 11139 |
(const_string "multiple")])] |
| 11140 |
) |
| 11141 |
|
| 11142 |
(define_insn "*ifcompare_move_not" |
| 11143 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11144 |
(if_then_else:SI |
| 11145 |
(match_operator 5 "arm_comparison_operator" |
| 11146 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 11147 |
(match_operand:SI 4 "arm_add_operand" "rIL,rIL")]) |
| 11148 |
(match_operand:SI 1 "arm_not_operand" "0,?rIK") |
| 11149 |
(not:SI |
| 11150 |
(match_operand:SI 2 "s_register_operand" "r,r")))) |
| 11151 |
(clobber (reg:CC CC_REGNUM))] |
| 11152 |
"TARGET_ARM" |
| 11153 |
"#" |
| 11154 |
[(set_attr "conds" "clob") |
| 11155 |
(set_attr "length" "8,12") |
| 11156 |
(set_attr "type" "multiple")] |
| 11157 |
) |
| 11158 |
|
| 11159 |
(define_insn "*if_move_not" |
| 11160 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 11161 |
(if_then_else:SI |
| 11162 |
(match_operator 4 "arm_comparison_operator" |
| 11163 |
[(match_operand 3 "cc_register" "") (const_int 0)]) |
| 11164 |
(match_operand:SI 1 "arm_not_operand" "0,?rI,K") |
| 11165 |
(not:SI (match_operand:SI 2 "s_register_operand" "r,r,r"))))] |
| 11166 |
"TARGET_ARM" |
| 11167 |
"@ |
| 11168 |
mvn%D4\\t%0, %2 |
| 11169 |
mov%d4\\t%0, %1\;mvn%D4\\t%0, %2 |
| 11170 |
mvn%d4\\t%0, #%B1\;mvn%D4\\t%0, %2" |
| 11171 |
[(set_attr "conds" "use") |
| 11172 |
(set_attr "type" "mvn_reg") |
| 11173 |
(set_attr "length" "4,8,8") |
| 11174 |
(set_attr "type" "mvn_reg,multiple,multiple")] |
| 11175 |
) |
| 11176 |
|
| 11177 |
(define_insn "*ifcompare_not_move" |
| 11178 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11179 |
(if_then_else:SI |
| 11180 |
(match_operator 5 "arm_comparison_operator" |
| 11181 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 11182 |
(match_operand:SI 4 "arm_add_operand" "rIL,rIL")]) |
| 11183 |
(not:SI |
| 11184 |
(match_operand:SI 2 "s_register_operand" "r,r")) |
| 11185 |
(match_operand:SI 1 "arm_not_operand" "0,?rIK"))) |
| 11186 |
(clobber (reg:CC CC_REGNUM))] |
| 11187 |
"TARGET_ARM" |
| 11188 |
"#" |
| 11189 |
[(set_attr "conds" "clob") |
| 11190 |
(set_attr "length" "8,12") |
| 11191 |
(set_attr "type" "multiple")] |
| 11192 |
) |
| 11193 |
|
| 11194 |
(define_insn "*if_not_move" |
| 11195 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 11196 |
(if_then_else:SI |
| 11197 |
(match_operator 4 "arm_comparison_operator" |
| 11198 |
[(match_operand 3 "cc_register" "") (const_int 0)]) |
| 11199 |
(not:SI (match_operand:SI 2 "s_register_operand" "r,r,r")) |
| 11200 |
(match_operand:SI 1 "arm_not_operand" "0,?rI,K")))] |
| 11201 |
"TARGET_ARM" |
| 11202 |
"@ |
| 11203 |
mvn%d4\\t%0, %2 |
| 11204 |
mov%D4\\t%0, %1\;mvn%d4\\t%0, %2 |
| 11205 |
mvn%D4\\t%0, #%B1\;mvn%d4\\t%0, %2" |
| 11206 |
[(set_attr "conds" "use") |
| 11207 |
(set_attr "type" "mvn_reg,multiple,multiple") |
| 11208 |
(set_attr "length" "4,8,8")] |
| 11209 |
) |
| 11210 |
|
| 11211 |
(define_insn "*ifcompare_shift_move" |
| 11212 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11213 |
(if_then_else:SI |
| 11214 |
(match_operator 6 "arm_comparison_operator" |
| 11215 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 11216 |
(match_operand:SI 5 "arm_add_operand" "rIL,rIL")]) |
| 11217 |
(match_operator:SI 7 "shift_operator" |
| 11218 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 11219 |
(match_operand:SI 3 "arm_rhs_operand" "rM,rM")]) |
| 11220 |
(match_operand:SI 1 "arm_not_operand" "0,?rIK"))) |
| 11221 |
(clobber (reg:CC CC_REGNUM))] |
| 11222 |
"TARGET_ARM" |
| 11223 |
"#" |
| 11224 |
[(set_attr "conds" "clob") |
| 11225 |
(set_attr "length" "8,12") |
| 11226 |
(set_attr "type" "multiple")] |
| 11227 |
) |
| 11228 |
|
| 11229 |
(define_insn "*if_shift_move" |
| 11230 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 11231 |
(if_then_else:SI |
| 11232 |
(match_operator 5 "arm_comparison_operator" |
| 11233 |
[(match_operand 6 "cc_register" "") (const_int 0)]) |
| 11234 |
(match_operator:SI 4 "shift_operator" |
| 11235 |
[(match_operand:SI 2 "s_register_operand" "r,r,r") |
| 11236 |
(match_operand:SI 3 "arm_rhs_operand" "rM,rM,rM")]) |
| 11237 |
(match_operand:SI 1 "arm_not_operand" "0,?rI,K")))] |
| 11238 |
"TARGET_ARM" |
| 11239 |
"@ |
| 11240 |
mov%d5\\t%0, %2%S4 |
| 11241 |
mov%D5\\t%0, %1\;mov%d5\\t%0, %2%S4 |
| 11242 |
mvn%D5\\t%0, #%B1\;mov%d5\\t%0, %2%S4" |
| 11243 |
[(set_attr "conds" "use") |
| 11244 |
(set_attr "shift" "2") |
| 11245 |
(set_attr "length" "4,8,8") |
| 11246 |
(set_attr_alternative "type" |
| 11247 |
[(if_then_else (match_operand 3 "const_int_operand" "") |
| 11248 |
(const_string "mov_shift" ) |
| 11249 |
(const_string "mov_shift_reg")) |
| 11250 |
(const_string "multiple") |
| 11251 |
(const_string "multiple")])] |
| 11252 |
) |
| 11253 |
|
| 11254 |
(define_insn "*ifcompare_move_shift" |
| 11255 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11256 |
(if_then_else:SI |
| 11257 |
(match_operator 6 "arm_comparison_operator" |
| 11258 |
[(match_operand:SI 4 "s_register_operand" "r,r") |
| 11259 |
(match_operand:SI 5 "arm_add_operand" "rIL,rIL")]) |
| 11260 |
(match_operand:SI 1 "arm_not_operand" "0,?rIK") |
| 11261 |
(match_operator:SI 7 "shift_operator" |
| 11262 |
[(match_operand:SI 2 "s_register_operand" "r,r") |
| 11263 |
(match_operand:SI 3 "arm_rhs_operand" "rM,rM")]))) |
| 11264 |
(clobber (reg:CC CC_REGNUM))] |
| 11265 |
"TARGET_ARM" |
| 11266 |
"#" |
| 11267 |
[(set_attr "conds" "clob") |
| 11268 |
(set_attr "length" "8,12") |
| 11269 |
(set_attr "type" "multiple")] |
| 11270 |
) |
| 11271 |
|
| 11272 |
(define_insn "*if_move_shift" |
| 11273 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r,r") |
| 11274 |
(if_then_else:SI |
| 11275 |
(match_operator 5 "arm_comparison_operator" |
| 11276 |
[(match_operand 6 "cc_register" "") (const_int 0)]) |
| 11277 |
(match_operand:SI 1 "arm_not_operand" "0,?rI,K") |
| 11278 |
(match_operator:SI 4 "shift_operator" |
| 11279 |
[(match_operand:SI 2 "s_register_operand" "r,r,r") |
| 11280 |
(match_operand:SI 3 "arm_rhs_operand" "rM,rM,rM")])))] |
| 11281 |
"TARGET_ARM" |
| 11282 |
"@ |
| 11283 |
mov%D5\\t%0, %2%S4 |
| 11284 |
mov%d5\\t%0, %1\;mov%D5\\t%0, %2%S4 |
| 11285 |
mvn%d5\\t%0, #%B1\;mov%D5\\t%0, %2%S4" |
| 11286 |
[(set_attr "conds" "use") |
| 11287 |
(set_attr "shift" "2") |
| 11288 |
(set_attr "length" "4,8,8") |
| 11289 |
(set_attr_alternative "type" |
| 11290 |
[(if_then_else (match_operand 3 "const_int_operand" "") |
| 11291 |
(const_string "mov_shift" ) |
| 11292 |
(const_string "mov_shift_reg")) |
| 11293 |
(const_string "multiple") |
| 11294 |
(const_string "multiple")])] |
| 11295 |
) |
| 11296 |
|
| 11297 |
(define_insn "*ifcompare_shift_shift" |
| 11298 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11299 |
(if_then_else:SI |
| 11300 |
(match_operator 7 "arm_comparison_operator" |
| 11301 |
[(match_operand:SI 5 "s_register_operand" "r") |
| 11302 |
(match_operand:SI 6 "arm_add_operand" "rIL")]) |
| 11303 |
(match_operator:SI 8 "shift_operator" |
| 11304 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 11305 |
(match_operand:SI 2 "arm_rhs_operand" "rM")]) |
| 11306 |
(match_operator:SI 9 "shift_operator" |
| 11307 |
[(match_operand:SI 3 "s_register_operand" "r") |
| 11308 |
(match_operand:SI 4 "arm_rhs_operand" "rM")]))) |
| 11309 |
(clobber (reg:CC CC_REGNUM))] |
| 11310 |
"TARGET_ARM" |
| 11311 |
"#" |
| 11312 |
[(set_attr "conds" "clob") |
| 11313 |
(set_attr "length" "12") |
| 11314 |
(set_attr "type" "multiple")] |
| 11315 |
) |
| 11316 |
|
| 11317 |
(define_insn "*if_shift_shift" |
| 11318 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11319 |
(if_then_else:SI |
| 11320 |
(match_operator 5 "arm_comparison_operator" |
| 11321 |
[(match_operand 8 "cc_register" "") (const_int 0)]) |
| 11322 |
(match_operator:SI 6 "shift_operator" |
| 11323 |
[(match_operand:SI 1 "s_register_operand" "r") |
| 11324 |
(match_operand:SI 2 "arm_rhs_operand" "rM")]) |
| 11325 |
(match_operator:SI 7 "shift_operator" |
| 11326 |
[(match_operand:SI 3 "s_register_operand" "r") |
| 11327 |
(match_operand:SI 4 "arm_rhs_operand" "rM")])))] |
| 11328 |
"TARGET_ARM" |
| 11329 |
"mov%d5\\t%0, %1%S6\;mov%D5\\t%0, %3%S7" |
| 11330 |
[(set_attr "conds" "use") |
| 11331 |
(set_attr "shift" "1") |
| 11332 |
(set_attr "length" "8") |
| 11333 |
(set (attr "type") (if_then_else |
| 11334 |
(and (match_operand 2 "const_int_operand" "") |
| 11335 |
(match_operand 4 "const_int_operand" "")) |
| 11336 |
(const_string "mov_shift") |
| 11337 |
(const_string "mov_shift_reg")))] |
| 11338 |
) |
| 11339 |
|
| 11340 |
(define_insn "*ifcompare_not_arith" |
| 11341 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11342 |
(if_then_else:SI |
| 11343 |
(match_operator 6 "arm_comparison_operator" |
| 11344 |
[(match_operand:SI 4 "s_register_operand" "r") |
| 11345 |
(match_operand:SI 5 "arm_add_operand" "rIL")]) |
| 11346 |
(not:SI (match_operand:SI 1 "s_register_operand" "r")) |
| 11347 |
(match_operator:SI 7 "shiftable_operator" |
| 11348 |
[(match_operand:SI 2 "s_register_operand" "r") |
| 11349 |
(match_operand:SI 3 "arm_rhs_operand" "rI")]))) |
| 11350 |
(clobber (reg:CC CC_REGNUM))] |
| 11351 |
"TARGET_ARM" |
| 11352 |
"#" |
| 11353 |
[(set_attr "conds" "clob") |
| 11354 |
(set_attr "length" "12") |
| 11355 |
(set_attr "type" "multiple")] |
| 11356 |
) |
| 11357 |
|
| 11358 |
(define_insn "*if_not_arith" |
| 11359 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11360 |
(if_then_else:SI |
| 11361 |
(match_operator 5 "arm_comparison_operator" |
| 11362 |
[(match_operand 4 "cc_register" "") (const_int 0)]) |
| 11363 |
(not:SI (match_operand:SI 1 "s_register_operand" "r")) |
| 11364 |
(match_operator:SI 6 "shiftable_operator" |
| 11365 |
[(match_operand:SI 2 "s_register_operand" "r") |
| 11366 |
(match_operand:SI 3 "arm_rhs_operand" "rI")])))] |
| 11367 |
"TARGET_ARM" |
| 11368 |
"mvn%d5\\t%0, %1\;%I6%D5\\t%0, %2, %3" |
| 11369 |
[(set_attr "conds" "use") |
| 11370 |
(set_attr "type" "mvn_reg") |
| 11371 |
(set_attr "length" "8")] |
| 11372 |
) |
| 11373 |
|
| 11374 |
(define_insn "*ifcompare_arith_not" |
| 11375 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11376 |
(if_then_else:SI |
| 11377 |
(match_operator 6 "arm_comparison_operator" |
| 11378 |
[(match_operand:SI 4 "s_register_operand" "r") |
| 11379 |
(match_operand:SI 5 "arm_add_operand" "rIL")]) |
| 11380 |
(match_operator:SI 7 "shiftable_operator" |
| 11381 |
[(match_operand:SI 2 "s_register_operand" "r") |
| 11382 |
(match_operand:SI 3 "arm_rhs_operand" "rI")]) |
| 11383 |
(not:SI (match_operand:SI 1 "s_register_operand" "r")))) |
| 11384 |
(clobber (reg:CC CC_REGNUM))] |
| 11385 |
"TARGET_ARM" |
| 11386 |
"#" |
| 11387 |
[(set_attr "conds" "clob") |
| 11388 |
(set_attr "length" "12") |
| 11389 |
(set_attr "type" "multiple")] |
| 11390 |
) |
| 11391 |
|
| 11392 |
(define_insn "*if_arith_not" |
| 11393 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11394 |
(if_then_else:SI |
| 11395 |
(match_operator 5 "arm_comparison_operator" |
| 11396 |
[(match_operand 4 "cc_register" "") (const_int 0)]) |
| 11397 |
(match_operator:SI 6 "shiftable_operator" |
| 11398 |
[(match_operand:SI 2 "s_register_operand" "r") |
| 11399 |
(match_operand:SI 3 "arm_rhs_operand" "rI")]) |
| 11400 |
(not:SI (match_operand:SI 1 "s_register_operand" "r"))))] |
| 11401 |
"TARGET_ARM" |
| 11402 |
"mvn%D5\\t%0, %1\;%I6%d5\\t%0, %2, %3" |
| 11403 |
[(set_attr "conds" "use") |
| 11404 |
(set_attr "type" "multiple") |
| 11405 |
(set_attr "length" "8")] |
| 11406 |
) |
| 11407 |
|
| 11408 |
(define_insn "*ifcompare_neg_move" |
| 11409 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11410 |
(if_then_else:SI |
| 11411 |
(match_operator 5 "arm_comparison_operator" |
| 11412 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 11413 |
(match_operand:SI 4 "arm_add_operand" "rIL,rIL")]) |
| 11414 |
(neg:SI (match_operand:SI 2 "s_register_operand" "r,r")) |
| 11415 |
(match_operand:SI 1 "arm_not_operand" "0,?rIK"))) |
| 11416 |
(clobber (reg:CC CC_REGNUM))] |
| 11417 |
"TARGET_ARM" |
| 11418 |
"#" |
| 11419 |
[(set_attr "conds" "clob") |
| 11420 |
(set_attr "length" "8,12") |
| 11421 |
(set_attr "type" "multiple")] |
| 11422 |
) |
| 11423 |
|
| 11424 |
(define_insn_and_split "*if_neg_move" |
| 11425 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 11426 |
(if_then_else:SI |
| 11427 |
(match_operator 4 "arm_comparison_operator" |
| 11428 |
[(match_operand 3 "cc_register" "") (const_int 0)]) |
| 11429 |
(neg:SI (match_operand:SI 2 "s_register_operand" "l,r")) |
| 11430 |
(match_operand:SI 1 "s_register_operand" "0,0")))] |
| 11431 |
"TARGET_32BIT && !TARGET_COND_ARITH" |
| 11432 |
"#" |
| 11433 |
"&& reload_completed" |
| 11434 |
[(cond_exec (match_op_dup 4 [(match_dup 3) (const_int 0)]) |
| 11435 |
(set (match_dup 0) (neg:SI (match_dup 2))))] |
| 11436 |
"" |
| 11437 |
[(set_attr "conds" "use") |
| 11438 |
(set_attr "length" "4") |
| 11439 |
(set_attr "arch" "t2,32") |
| 11440 |
(set_attr "enabled_for_short_it" "yes,no") |
| 11441 |
(set_attr "type" "logic_shift_imm")] |
| 11442 |
) |
| 11443 |
|
| 11444 |
(define_insn "*ifcompare_move_neg" |
| 11445 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11446 |
(if_then_else:SI |
| 11447 |
(match_operator 5 "arm_comparison_operator" |
| 11448 |
[(match_operand:SI 3 "s_register_operand" "r,r") |
| 11449 |
(match_operand:SI 4 "arm_add_operand" "rIL,rIL")]) |
| 11450 |
(match_operand:SI 1 "arm_not_operand" "0,?rIK") |
| 11451 |
(neg:SI (match_operand:SI 2 "s_register_operand" "r,r")))) |
| 11452 |
(clobber (reg:CC CC_REGNUM))] |
| 11453 |
"TARGET_ARM" |
| 11454 |
"#" |
| 11455 |
[(set_attr "conds" "clob") |
| 11456 |
(set_attr "length" "8,12") |
| 11457 |
(set_attr "type" "multiple")] |
| 11458 |
) |
| 11459 |
|
| 11460 |
(define_insn_and_split "*if_move_neg" |
| 11461 |
[(set (match_operand:SI 0 "s_register_operand" "=l,r") |
| 11462 |
(if_then_else:SI |
| 11463 |
(match_operator 4 "arm_comparison_operator" |
| 11464 |
[(match_operand 3 "cc_register" "") (const_int 0)]) |
| 11465 |
(match_operand:SI 1 "s_register_operand" "0,0") |
| 11466 |
(neg:SI (match_operand:SI 2 "s_register_operand" "l,r"))))] |
| 11467 |
"TARGET_32BIT" |
| 11468 |
"#" |
| 11469 |
"&& reload_completed" |
| 11470 |
[(cond_exec (match_dup 5) |
| 11471 |
(set (match_dup 0) (neg:SI (match_dup 2))))] |
| 11472 |
{ |
| 11473 |
machine_mode mode = GET_MODE (operands[3]); |
| 11474 |
rtx_code rc = GET_CODE (operands[4]); |
| 11475 |
|
| 11476 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 11477 |
rc = reverse_condition_maybe_unordered (rc); |
| 11478 |
else |
| 11479 |
rc = reverse_condition (rc); |
| 11480 |
|
| 11481 |
operands[5] = gen_rtx_fmt_ee (rc, VOIDmode, operands[3], const0_rtx); |
| 11482 |
} |
| 11483 |
[(set_attr "conds" "use") |
| 11484 |
(set_attr "length" "4") |
| 11485 |
(set_attr "arch" "t2,32") |
| 11486 |
(set_attr "enabled_for_short_it" "yes,no") |
| 11487 |
(set_attr "type" "logic_shift_imm")] |
| 11488 |
) |
| 11489 |
|
| 11490 |
(define_insn "*arith_adjacentmem" |
| 11491 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11492 |
(match_operator:SI 1 "shiftable_operator" |
| 11493 |
[(match_operand:SI 2 "memory_operand" "m") |
| 11494 |
(match_operand:SI 3 "memory_operand" "m")])) |
| 11495 |
(clobber (match_scratch:SI 4 "=r"))] |
| 11496 |
"TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])" |
| 11497 |
"* |
| 11498 |
{ |
| 11499 |
rtx ldm[3]; |
| 11500 |
rtx arith[4]; |
| 11501 |
rtx base_reg; |
| 11502 |
HOST_WIDE_INT val1 = 0, val2 = 0; |
| 11503 |
|
| 11504 |
if (REGNO (operands[0]) > REGNO (operands[4])) |
| 11505 |
{ |
| 11506 |
ldm[1] = operands[4]; |
| 11507 |
ldm[2] = operands[0]; |
| 11508 |
} |
| 11509 |
else |
| 11510 |
{ |
| 11511 |
ldm[1] = operands[0]; |
| 11512 |
ldm[2] = operands[4]; |
| 11513 |
} |
| 11514 |
|
| 11515 |
base_reg = XEXP (operands[2], 0); |
| 11516 |
|
| 11517 |
if (!REG_P (base_reg)) |
| 11518 |
{ |
| 11519 |
val1 = INTVAL (XEXP (base_reg, 1)); |
| 11520 |
base_reg = XEXP (base_reg, 0); |
| 11521 |
} |
| 11522 |
|
| 11523 |
if (!REG_P (XEXP (operands[3], 0))) |
| 11524 |
val2 = INTVAL (XEXP (XEXP (operands[3], 0), 1)); |
| 11525 |
|
| 11526 |
arith[0] = operands[0]; |
| 11527 |
arith[3] = operands[1]; |
| 11528 |
|
| 11529 |
if (val1 < val2) |
| 11530 |
{ |
| 11531 |
arith[1] = ldm[1]; |
| 11532 |
arith[2] = ldm[2]; |
| 11533 |
} |
| 11534 |
else |
| 11535 |
{ |
| 11536 |
arith[1] = ldm[2]; |
| 11537 |
arith[2] = ldm[1]; |
| 11538 |
} |
| 11539 |
|
| 11540 |
ldm[0] = base_reg; |
| 11541 |
if (val1 !=0 && val2 != 0) |
| 11542 |
{ |
| 11543 |
rtx ops[3]; |
| 11544 |
|
| 11545 |
if (val1 == 4 || val2 == 4) |
| 11546 |
/* Other val must be 8, since we know they are adjacent and neither |
| 11547 |
is zero. */ |
| 11548 |
output_asm_insn (\"ldmib%?\\t%0, {%1, %2}\", ldm); |
| 11549 |
else if (const_ok_for_arm (val1) || const_ok_for_arm (-val1)) |
| 11550 |
{ |
| 11551 |
ldm[0] = ops[0] = operands[4]; |
| 11552 |
ops[1] = base_reg; |
| 11553 |
ops[2] = GEN_INT (val1); |
| 11554 |
output_add_immediate (ops); |
| 11555 |
if (val1 < val2) |
| 11556 |
output_asm_insn (\"ldmia%?\\t%0, {%1, %2}\", ldm); |
| 11557 |
else |
| 11558 |
output_asm_insn (\"ldmda%?\\t%0, {%1, %2}\", ldm); |
| 11559 |
} |
| 11560 |
else |
| 11561 |
{ |
| 11562 |
/* Offset is out of range for a single add, so use two ldr. */ |
| 11563 |
ops[0] = ldm[1]; |
| 11564 |
ops[1] = base_reg; |
| 11565 |
ops[2] = GEN_INT (val1); |
| 11566 |
output_asm_insn (\"ldr%?\\t%0, [%1, %2]\", ops); |
| 11567 |
ops[0] = ldm[2]; |
| 11568 |
ops[2] = GEN_INT (val2); |
| 11569 |
output_asm_insn (\"ldr%?\\t%0, [%1, %2]\", ops); |
| 11570 |
} |
| 11571 |
} |
| 11572 |
else if (val1 != 0) |
| 11573 |
{ |
| 11574 |
if (val1 < val2) |
| 11575 |
output_asm_insn (\"ldmda%?\\t%0, {%1, %2}\", ldm); |
| 11576 |
else |
| 11577 |
output_asm_insn (\"ldmia%?\\t%0, {%1, %2}\", ldm); |
| 11578 |
} |
| 11579 |
else |
| 11580 |
{ |
| 11581 |
if (val1 < val2) |
| 11582 |
output_asm_insn (\"ldmia%?\\t%0, {%1, %2}\", ldm); |
| 11583 |
else |
| 11584 |
output_asm_insn (\"ldmda%?\\t%0, {%1, %2}\", ldm); |
| 11585 |
} |
| 11586 |
output_asm_insn (\"%I3%?\\t%0, %1, %2\", arith); |
| 11587 |
return \"\"; |
| 11588 |
}" |
| 11589 |
[(set_attr "length" "12") |
| 11590 |
(set_attr "predicable" "yes") |
| 11591 |
(set_attr "type" "load_4")] |
| 11592 |
) |
| 11593 |
|
| 11594 |
; This pattern is never tried by combine, so do it as a peephole |
| 11595 |
|
| 11596 |
(define_peephole2 |
| 11597 |
[(set (match_operand:SI 0 "arm_general_register_operand" "") |
| 11598 |
(match_operand:SI 1 "arm_general_register_operand" "")) |
| 11599 |
(set (reg:CC CC_REGNUM) |
| 11600 |
(compare:CC (match_dup 1) (const_int 0)))] |
| 11601 |
"TARGET_ARM" |
| 11602 |
[(parallel [(set (reg:CC CC_REGNUM) (compare:CC (match_dup 1) (const_int 0))) |
| 11603 |
(set (match_dup 0) (match_dup 1))])] |
| 11604 |
"" |
| 11605 |
) |
| 11606 |
|
| 11607 |
(define_split |
| 11608 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 11609 |
(and:SI (ge:SI (match_operand:SI 1 "s_register_operand" "") |
| 11610 |
(const_int 0)) |
| 11611 |
(neg:SI (match_operator:SI 2 "arm_comparison_operator" |
| 11612 |
[(match_operand:SI 3 "s_register_operand" "") |
| 11613 |
(match_operand:SI 4 "arm_rhs_operand" "")])))) |
| 11614 |
(clobber (match_operand:SI 5 "s_register_operand" ""))] |
| 11615 |
"TARGET_ARM" |
| 11616 |
[(set (match_dup 5) (not:SI (ashiftrt:SI (match_dup 1) (const_int 31)))) |
| 11617 |
(set (match_dup 0) (and:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)]) |
| 11618 |
(match_dup 5)))] |
| 11619 |
"" |
| 11620 |
) |
| 11621 |
|
| 11622 |
;; This split can be used because CC_Z mode implies that the following |
| 11623 |
;; branch will be an equality, or an unsigned inequality, so the sign |
| 11624 |
;; extension is not needed. |
| 11625 |
|
| 11626 |
(define_split |
| 11627 |
[(set (reg:CC_Z CC_REGNUM) |
| 11628 |
(compare:CC_Z |
| 11629 |
(ashift:SI (subreg:SI (match_operand:QI 0 "memory_operand" "") 0) |
| 11630 |
(const_int 24)) |
| 11631 |
(match_operand 1 "const_int_operand" ""))) |
| 11632 |
(clobber (match_scratch:SI 2 ""))] |
| 11633 |
"TARGET_ARM |
| 11634 |
&& ((UINTVAL (operands[1])) |
| 11635 |
== ((UINTVAL (operands[1])) >> 24) << 24)" |
| 11636 |
[(set (match_dup 2) (zero_extend:SI (match_dup 0))) |
| 11637 |
(set (reg:CC CC_REGNUM) (compare:CC (match_dup 2) (match_dup 1)))] |
| 11638 |
" |
| 11639 |
operands[1] = GEN_INT (((unsigned long) INTVAL (operands[1])) >> 24); |
| 11640 |
" |
| 11641 |
) |
| 11642 |
;; ??? Check the patterns above for Thumb-2 usefulness |
| 11643 |
|
| 11644 |
(define_expand "prologue" |
| 11645 |
[(clobber (const_int 0))] |
| 11646 |
"TARGET_EITHER" |
| 11647 |
"if (TARGET_32BIT) |
| 11648 |
arm_expand_prologue (); |
| 11649 |
else |
| 11650 |
thumb1_expand_prologue (); |
| 11651 |
DONE; |
| 11652 |
" |
| 11653 |
) |
| 11654 |
|
| 11655 |
(define_expand "epilogue" |
| 11656 |
[(clobber (const_int 0))] |
| 11657 |
"TARGET_EITHER" |
| 11658 |
" |
| 11659 |
if (crtl->calls_eh_return) |
| 11660 |
emit_insn (gen_force_register_use (gen_rtx_REG (Pmode, 2))); |
| 11661 |
if (TARGET_THUMB1) |
| 11662 |
{ |
| 11663 |
thumb1_expand_epilogue (); |
| 11664 |
emit_jump_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, |
| 11665 |
gen_rtvec (1, ret_rtx), VUNSPEC_EPILOGUE)); |
| 11666 |
} |
| 11667 |
else if (HAVE_return) |
| 11668 |
{ |
| 11669 |
/* HAVE_return is testing for USE_RETURN_INSN (FALSE). Hence, |
| 11670 |
no need for explicit testing again. */ |
| 11671 |
emit_jump_insn (gen_return ()); |
| 11672 |
} |
| 11673 |
else if (TARGET_32BIT) |
| 11674 |
{ |
| 11675 |
arm_expand_epilogue (true); |
| 11676 |
} |
| 11677 |
DONE; |
| 11678 |
" |
| 11679 |
) |
| 11680 |
|
| 11681 |
;; Note - although unspec_volatile's USE all hard registers, |
| 11682 |
;; USEs are ignored after relaod has completed. Thus we need |
| 11683 |
;; to add an unspec of the link register to ensure that flow |
| 11684 |
;; does not think that it is unused by the sibcall branch that |
| 11685 |
;; will replace the standard function epilogue. |
| 11686 |
(define_expand "sibcall_epilogue" |
| 11687 |
[(parallel [(unspec:SI [(reg:SI LR_REGNUM)] UNSPEC_REGISTER_USE) |
| 11688 |
(unspec_volatile [(return)] VUNSPEC_EPILOGUE)])] |
| 11689 |
"TARGET_32BIT" |
| 11690 |
" |
| 11691 |
arm_expand_epilogue (false); |
| 11692 |
DONE; |
| 11693 |
" |
| 11694 |
) |
| 11695 |
|
| 11696 |
(define_expand "eh_epilogue" |
| 11697 |
[(use (match_operand:SI 0 "register_operand")) |
| 11698 |
(use (match_operand:SI 1 "register_operand")) |
| 11699 |
(use (match_operand:SI 2 "register_operand"))] |
| 11700 |
"TARGET_EITHER" |
| 11701 |
" |
| 11702 |
{ |
| 11703 |
cfun->machine->eh_epilogue_sp_ofs = operands[1]; |
| 11704 |
if (!REG_P (operands[2]) || REGNO (operands[2]) != 2) |
| 11705 |
{ |
| 11706 |
rtx ra = gen_rtx_REG (Pmode, 2); |
| 11707 |
|
| 11708 |
emit_move_insn (ra, operands[2]); |
| 11709 |
operands[2] = ra; |
| 11710 |
} |
| 11711 |
/* This is a hack -- we may have crystalized the function type too |
| 11712 |
early. */ |
| 11713 |
cfun->machine->func_type = 0; |
| 11714 |
}" |
| 11715 |
) |
| 11716 |
|
| 11717 |
;; This split is only used during output to reduce the number of patterns |
| 11718 |
;; that need assembler instructions adding to them. We allowed the setting |
| 11719 |
;; of the conditions to be implicit during rtl generation so that |
| 11720 |
;; the conditional compare patterns would work. However this conflicts to |
| 11721 |
;; some extent with the conditional data operations, so we have to split them |
| 11722 |
;; up again here. |
| 11723 |
|
| 11724 |
;; ??? Need to audit these splitters for Thumb-2. Why isn't normal |
| 11725 |
;; conditional execution sufficient? |
| 11726 |
|
| 11727 |
(define_split |
| 11728 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 11729 |
(if_then_else:SI (match_operator 1 "arm_comparison_operator" |
| 11730 |
[(match_operand 2 "" "") (match_operand 3 "" "")]) |
| 11731 |
(match_dup 0) |
| 11732 |
(match_operand 4 "" ""))) |
| 11733 |
(clobber (reg:CC CC_REGNUM))] |
| 11734 |
"TARGET_ARM && reload_completed" |
| 11735 |
[(set (match_dup 5) (match_dup 6)) |
| 11736 |
(cond_exec (match_dup 7) |
| 11737 |
(set (match_dup 0) (match_dup 4)))] |
| 11738 |
" |
| 11739 |
{ |
| 11740 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), |
| 11741 |
operands[2], operands[3]); |
| 11742 |
enum rtx_code rc = GET_CODE (operands[1]); |
| 11743 |
|
| 11744 |
operands[5] = gen_rtx_REG (mode, CC_REGNUM); |
| 11745 |
operands[6] = gen_rtx_COMPARE (mode, operands[2], operands[3]); |
| 11746 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 11747 |
rc = reverse_condition_maybe_unordered (rc); |
| 11748 |
else |
| 11749 |
rc = reverse_condition (rc); |
| 11750 |
|
| 11751 |
operands[7] = gen_rtx_fmt_ee (rc, VOIDmode, operands[5], const0_rtx); |
| 11752 |
}" |
| 11753 |
) |
| 11754 |
|
| 11755 |
(define_split |
| 11756 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 11757 |
(if_then_else:SI (match_operator 1 "arm_comparison_operator" |
| 11758 |
[(match_operand 2 "" "") (match_operand 3 "" "")]) |
| 11759 |
(match_operand 4 "" "") |
| 11760 |
(match_dup 0))) |
| 11761 |
(clobber (reg:CC CC_REGNUM))] |
| 11762 |
"TARGET_ARM && reload_completed" |
| 11763 |
[(set (match_dup 5) (match_dup 6)) |
| 11764 |
(cond_exec (match_op_dup 1 [(match_dup 5) (const_int 0)]) |
| 11765 |
(set (match_dup 0) (match_dup 4)))] |
| 11766 |
" |
| 11767 |
{ |
| 11768 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), |
| 11769 |
operands[2], operands[3]); |
| 11770 |
|
| 11771 |
operands[5] = gen_rtx_REG (mode, CC_REGNUM); |
| 11772 |
operands[6] = gen_rtx_COMPARE (mode, operands[2], operands[3]); |
| 11773 |
}" |
| 11774 |
) |
| 11775 |
|
| 11776 |
(define_split |
| 11777 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 11778 |
(if_then_else:SI (match_operator 1 "arm_comparison_operator" |
| 11779 |
[(match_operand 2 "" "") (match_operand 3 "" "")]) |
| 11780 |
(match_operand 4 "" "") |
| 11781 |
(match_operand 5 "" ""))) |
| 11782 |
(clobber (reg:CC CC_REGNUM))] |
| 11783 |
"TARGET_ARM && reload_completed" |
| 11784 |
[(set (match_dup 6) (match_dup 7)) |
| 11785 |
(cond_exec (match_op_dup 1 [(match_dup 6) (const_int 0)]) |
| 11786 |
(set (match_dup 0) (match_dup 4))) |
| 11787 |
(cond_exec (match_dup 8) |
| 11788 |
(set (match_dup 0) (match_dup 5)))] |
| 11789 |
" |
| 11790 |
{ |
| 11791 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), |
| 11792 |
operands[2], operands[3]); |
| 11793 |
enum rtx_code rc = GET_CODE (operands[1]); |
| 11794 |
|
| 11795 |
operands[6] = gen_rtx_REG (mode, CC_REGNUM); |
| 11796 |
operands[7] = gen_rtx_COMPARE (mode, operands[2], operands[3]); |
| 11797 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 11798 |
rc = reverse_condition_maybe_unordered (rc); |
| 11799 |
else |
| 11800 |
rc = reverse_condition (rc); |
| 11801 |
|
| 11802 |
operands[8] = gen_rtx_fmt_ee (rc, VOIDmode, operands[6], const0_rtx); |
| 11803 |
}" |
| 11804 |
) |
| 11805 |
|
| 11806 |
(define_split |
| 11807 |
[(set (match_operand:SI 0 "s_register_operand" "") |
| 11808 |
(if_then_else:SI (match_operator 1 "arm_comparison_operator" |
| 11809 |
[(match_operand:SI 2 "s_register_operand" "") |
| 11810 |
(match_operand:SI 3 "arm_add_operand" "")]) |
| 11811 |
(match_operand:SI 4 "arm_rhs_operand" "") |
| 11812 |
(not:SI |
| 11813 |
(match_operand:SI 5 "s_register_operand" "")))) |
| 11814 |
(clobber (reg:CC CC_REGNUM))] |
| 11815 |
"TARGET_ARM && reload_completed" |
| 11816 |
[(set (match_dup 6) (match_dup 7)) |
| 11817 |
(cond_exec (match_op_dup 1 [(match_dup 6) (const_int 0)]) |
| 11818 |
(set (match_dup 0) (match_dup 4))) |
| 11819 |
(cond_exec (match_dup 8) |
| 11820 |
(set (match_dup 0) (not:SI (match_dup 5))))] |
| 11821 |
" |
| 11822 |
{ |
| 11823 |
machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), |
| 11824 |
operands[2], operands[3]); |
| 11825 |
enum rtx_code rc = GET_CODE (operands[1]); |
| 11826 |
|
| 11827 |
operands[6] = gen_rtx_REG (mode, CC_REGNUM); |
| 11828 |
operands[7] = gen_rtx_COMPARE (mode, operands[2], operands[3]); |
| 11829 |
if (mode == CCFPmode || mode == CCFPEmode) |
| 11830 |
rc = reverse_condition_maybe_unordered (rc); |
| 11831 |
else |
| 11832 |
rc = reverse_condition (rc); |
| 11833 |
|
| 11834 |
operands[8] = gen_rtx_fmt_ee (rc, VOIDmode, operands[6], const0_rtx); |
| 11835 |
}" |
| 11836 |
) |
| 11837 |
|
| 11838 |
(define_insn "*cond_move_not" |
| 11839 |
[(set (match_operand:SI 0 "s_register_operand" "=r,r") |
| 11840 |
(if_then_else:SI (match_operator 4 "arm_comparison_operator" |
| 11841 |
[(match_operand 3 "cc_register" "") (const_int 0)]) |
| 11842 |
(match_operand:SI 1 "arm_rhs_operand" "0,?rI") |
| 11843 |
(not:SI |
| 11844 |
(match_operand:SI 2 "s_register_operand" "r,r"))))] |
| 11845 |
"TARGET_ARM" |
| 11846 |
"@ |
| 11847 |
mvn%D4\\t%0, %2 |
| 11848 |
mov%d4\\t%0, %1\;mvn%D4\\t%0, %2" |
| 11849 |
[(set_attr "conds" "use") |
| 11850 |
(set_attr "type" "mvn_reg,multiple") |
| 11851 |
(set_attr "length" "4,8")] |
| 11852 |
) |
| 11853 |
|
| 11854 |
;; The next two patterns occur when an AND operation is followed by a |
| 11855 |
;; scc insn sequence |
| 11856 |
|
| 11857 |
(define_insn "*sign_extract_onebit" |
| 11858 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11859 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 11860 |
(const_int 1) |
| 11861 |
(match_operand:SI 2 "const_int_operand" "n"))) |
| 11862 |
(clobber (reg:CC CC_REGNUM))] |
| 11863 |
"TARGET_ARM" |
| 11864 |
"* |
| 11865 |
operands[2] = GEN_INT (1 << INTVAL (operands[2])); |
| 11866 |
output_asm_insn (\"ands\\t%0, %1, %2\", operands); |
| 11867 |
return \"mvnne\\t%0, #0\"; |
| 11868 |
" |
| 11869 |
[(set_attr "conds" "clob") |
| 11870 |
(set_attr "length" "8") |
| 11871 |
(set_attr "type" "multiple")] |
| 11872 |
) |
| 11873 |
|
| 11874 |
(define_insn "*not_signextract_onebit" |
| 11875 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 11876 |
(not:SI |
| 11877 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 11878 |
(const_int 1) |
| 11879 |
(match_operand:SI 2 "const_int_operand" "n")))) |
| 11880 |
(clobber (reg:CC CC_REGNUM))] |
| 11881 |
"TARGET_ARM" |
| 11882 |
"* |
| 11883 |
operands[2] = GEN_INT (1 << INTVAL (operands[2])); |
| 11884 |
output_asm_insn (\"tst\\t%1, %2\", operands); |
| 11885 |
output_asm_insn (\"mvneq\\t%0, #0\", operands); |
| 11886 |
return \"movne\\t%0, #0\"; |
| 11887 |
" |
| 11888 |
[(set_attr "conds" "clob") |
| 11889 |
(set_attr "length" "12") |
| 11890 |
(set_attr "type" "multiple")] |
| 11891 |
) |
| 11892 |
;; ??? The above patterns need auditing for Thumb-2 |
| 11893 |
|
| 11894 |
;; Push multiple registers to the stack. Registers are in parallel (use ...) |
| 11895 |
;; expressions. For simplicity, the first register is also in the unspec |
| 11896 |
;; part. |
| 11897 |
;; To avoid the usage of GNU extension, the length attribute is computed |
| 11898 |
;; in a C function arm_attr_length_push_multi. |
| 11899 |
(define_insn "*push_multi" |
| 11900 |
[(match_parallel 2 "multi_register_push" |
| 11901 |
[(set (match_operand:BLK 0 "push_mult_memory_operand" "") |
| 11902 |
(unspec:BLK [(match_operand:SI 1 "s_register_operand" "")] |
| 11903 |
UNSPEC_PUSH_MULT))])] |
| 11904 |
"" |
| 11905 |
"* |
| 11906 |
{ |
| 11907 |
int num_saves = XVECLEN (operands[2], 0); |
| 11908 |
|
| 11909 |
/* For the StrongARM at least it is faster to |
| 11910 |
use STR to store only a single register. |
| 11911 |
In Thumb mode always use push, and the assembler will pick |
| 11912 |
something appropriate. */ |
| 11913 |
if (num_saves == 1 && TARGET_ARM) |
| 11914 |
output_asm_insn (\"str%?\\t%1, [%m0, #-4]!\", operands); |
| 11915 |
else |
| 11916 |
{ |
| 11917 |
int i; |
| 11918 |
char pattern[100]; |
| 11919 |
|
| 11920 |
if (TARGET_32BIT) |
| 11921 |
strcpy (pattern, \"push%?\\t{%1\"); |
| 11922 |
else |
| 11923 |
strcpy (pattern, \"push\\t{%1\"); |
| 11924 |
|
| 11925 |
for (i = 1; i < num_saves; i++) |
| 11926 |
{ |
| 11927 |
strcat (pattern, \", %|\"); |
| 11928 |
strcat (pattern, |
| 11929 |
reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i), 0))]); |
| 11930 |
} |
| 11931 |
|
| 11932 |
strcat (pattern, \"}\"); |
| 11933 |
output_asm_insn (pattern, operands); |
| 11934 |
} |
| 11935 |
|
| 11936 |
return \"\"; |
| 11937 |
}" |
| 11938 |
[(set_attr "type" "store_16") |
| 11939 |
(set (attr "length") |
| 11940 |
(symbol_ref "arm_attr_length_push_multi (operands[2], operands[1])"))] |
| 11941 |
) |
| 11942 |
|
| 11943 |
(define_insn "stack_tie" |
| 11944 |
[(set (mem:BLK (scratch)) |
| 11945 |
(unspec:BLK [(match_operand:SI 0 "s_register_operand" "rk") |
| 11946 |
(match_operand:SI 1 "s_register_operand" "rk")] |
| 11947 |
UNSPEC_PRLG_STK))] |
| 11948 |
"" |
| 11949 |
"" |
| 11950 |
[(set_attr "length" "0") |
| 11951 |
(set_attr "type" "block")] |
| 11952 |
) |
| 11953 |
|
| 11954 |
;; Pop (as used in epilogue RTL) |
| 11955 |
;; |
| 11956 |
(define_insn "*load_multiple_with_writeback" |
| 11957 |
[(match_parallel 0 "load_multiple_operation" |
| 11958 |
[(set (match_operand:SI 1 "s_register_operand" "+rk") |
| 11959 |
(plus:SI (match_dup 1) |
| 11960 |
(match_operand:SI 2 "const_int_I_operand" "I"))) |
| 11961 |
(set (match_operand:SI 3 "s_register_operand" "=rk") |
| 11962 |
(mem:SI (match_dup 1))) |
| 11963 |
])] |
| 11964 |
"TARGET_32BIT && (reload_in_progress || reload_completed)" |
| 11965 |
"* |
| 11966 |
{ |
| 11967 |
arm_output_multireg_pop (operands, /*return_pc=*/false, |
| 11968 |
/*cond=*/const_true_rtx, |
| 11969 |
/*reverse=*/false, |
| 11970 |
/*update=*/true); |
| 11971 |
return \"\"; |
| 11972 |
} |
| 11973 |
" |
| 11974 |
[(set_attr "type" "load_16") |
| 11975 |
(set_attr "predicable" "yes") |
| 11976 |
(set (attr "length") |
| 11977 |
(symbol_ref "arm_attr_length_pop_multi (operands, |
| 11978 |
/*return_pc=*/false, |
| 11979 |
/*write_back_p=*/true)"))] |
| 11980 |
) |
| 11981 |
|
| 11982 |
;; Pop with return (as used in epilogue RTL) |
| 11983 |
;; |
| 11984 |
;; This instruction is generated when the registers are popped at the end of |
| 11985 |
;; epilogue. Here, instead of popping the value into LR and then generating |
| 11986 |
;; jump to LR, value is popped into PC directly. Hence, the pattern is combined |
| 11987 |
;; with (return). |
| 11988 |
(define_insn "*pop_multiple_with_writeback_and_return" |
| 11989 |
[(match_parallel 0 "pop_multiple_return" |
| 11990 |
[(return) |
| 11991 |
(set (match_operand:SI 1 "register_operand" "") |
| 11992 |
(plus:SI (match_dup 1) |
| 11993 |
(match_operand:SI 2 "const_int_I_operand" ""))) |
| 11994 |
])] |
| 11995 |
"TARGET_32BIT && (reload_in_progress || reload_completed)" |
| 11996 |
"* |
| 11997 |
{ |
| 11998 |
arm_output_multireg_pop (operands, /*return_pc=*/true, |
| 11999 |
/*cond=*/const_true_rtx, |
| 12000 |
/*reverse=*/false, |
| 12001 |
/*update=*/true); |
| 12002 |
return \"\"; |
| 12003 |
} |
| 12004 |
" |
| 12005 |
[(set_attr "type" "load_16") |
| 12006 |
(set_attr "predicable" "yes") |
| 12007 |
(set (attr "length") |
| 12008 |
(symbol_ref "arm_attr_length_pop_multi (operands, /*return_pc=*/true, |
| 12009 |
/*write_back_p=*/true)"))] |
| 12010 |
) |
| 12011 |
|
| 12012 |
(define_insn "*pop_multiple_with_return" |
| 12013 |
[(match_parallel 0 "pop_multiple_return" |
| 12014 |
[(return) |
| 12015 |
(set (match_operand:SI 2 "s_register_operand" "=rk") |
| 12016 |
(mem:SI (match_operand:SI 1 "s_register_operand" "rk"))) |
| 12017 |
])] |
| 12018 |
"TARGET_32BIT && (reload_in_progress || reload_completed)" |
| 12019 |
"* |
| 12020 |
{ |
| 12021 |
arm_output_multireg_pop (operands, /*return_pc=*/true, |
| 12022 |
/*cond=*/const_true_rtx, |
| 12023 |
/*reverse=*/false, |
| 12024 |
/*update=*/false); |
| 12025 |
return \"\"; |
| 12026 |
} |
| 12027 |
" |
| 12028 |
[(set_attr "type" "load_16") |
| 12029 |
(set_attr "predicable" "yes") |
| 12030 |
(set (attr "length") |
| 12031 |
(symbol_ref "arm_attr_length_pop_multi (operands, /*return_pc=*/true, |
| 12032 |
/*write_back_p=*/false)"))] |
| 12033 |
) |
| 12034 |
|
| 12035 |
;; Load into PC and return |
| 12036 |
(define_insn "*ldr_with_return" |
| 12037 |
[(return) |
| 12038 |
(set (reg:SI PC_REGNUM) |
| 12039 |
(mem:SI (post_inc:SI (match_operand:SI 0 "s_register_operand" "+rk"))))] |
| 12040 |
"TARGET_32BIT && (reload_in_progress || reload_completed)" |
| 12041 |
"ldr%?\t%|pc, [%0], #4" |
| 12042 |
[(set_attr "type" "load_4") |
| 12043 |
(set_attr "predicable" "yes")] |
| 12044 |
) |
| 12045 |
;; Pop for floating point registers (as used in epilogue RTL) |
| 12046 |
(define_insn "*vfp_pop_multiple_with_writeback" |
| 12047 |
[(match_parallel 0 "pop_multiple_fp" |
| 12048 |
[(set (match_operand:SI 1 "s_register_operand" "+rk") |
| 12049 |
(plus:SI (match_dup 1) |
| 12050 |
(match_operand:SI 2 "const_int_I_operand" "I"))) |
| 12051 |
(set (match_operand:DF 3 "vfp_hard_register_operand" "") |
| 12052 |
(mem:DF (match_dup 1)))])] |
| 12053 |
"TARGET_32BIT && TARGET_VFP_BASE" |
| 12054 |
"* |
| 12055 |
{ |
| 12056 |
int num_regs = XVECLEN (operands[0], 0); |
| 12057 |
char pattern[100]; |
| 12058 |
rtx op_list[2]; |
| 12059 |
strcpy (pattern, \"vldm\\t\"); |
| 12060 |
strcat (pattern, reg_names[REGNO (SET_DEST (XVECEXP (operands[0], 0, 0)))]); |
| 12061 |
strcat (pattern, \"!, {\"); |
| 12062 |
op_list[0] = XEXP (XVECEXP (operands[0], 0, 1), 0); |
| 12063 |
strcat (pattern, \"%P0\"); |
| 12064 |
if ((num_regs - 1) > 1) |
| 12065 |
{ |
| 12066 |
strcat (pattern, \"-%P1\"); |
| 12067 |
op_list [1] = XEXP (XVECEXP (operands[0], 0, num_regs - 1), 0); |
| 12068 |
} |
| 12069 |
|
| 12070 |
strcat (pattern, \"}\"); |
| 12071 |
output_asm_insn (pattern, op_list); |
| 12072 |
return \"\"; |
| 12073 |
} |
| 12074 |
" |
| 12075 |
[(set_attr "type" "load_16") |
| 12076 |
(set_attr "conds" "unconditional") |
| 12077 |
(set_attr "predicable" "no")] |
| 12078 |
) |
| 12079 |
|
| 12080 |
;; Special patterns for dealing with the constant pool |
| 12081 |
|
| 12082 |
(define_insn "align_4" |
| 12083 |
[(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN)] |
| 12084 |
"TARGET_EITHER" |
| 12085 |
"* |
| 12086 |
assemble_align (32); |
| 12087 |
return \"\"; |
| 12088 |
" |
| 12089 |
[(set_attr "type" "no_insn")] |
| 12090 |
) |
| 12091 |
|
| 12092 |
(define_insn "align_8" |
| 12093 |
[(unspec_volatile [(const_int 0)] VUNSPEC_ALIGN8)] |
| 12094 |
"TARGET_EITHER" |
| 12095 |
"* |
| 12096 |
assemble_align (64); |
| 12097 |
return \"\"; |
| 12098 |
" |
| 12099 |
[(set_attr "type" "no_insn")] |
| 12100 |
) |
| 12101 |
|
| 12102 |
(define_insn "consttable_end" |
| 12103 |
[(unspec_volatile [(const_int 0)] VUNSPEC_POOL_END)] |
| 12104 |
"TARGET_EITHER" |
| 12105 |
"* |
| 12106 |
making_const_table = FALSE; |
| 12107 |
return \"\"; |
| 12108 |
" |
| 12109 |
[(set_attr "type" "no_insn")] |
| 12110 |
) |
| 12111 |
|
| 12112 |
(define_insn "consttable_1" |
| 12113 |
[(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_1)] |
| 12114 |
"TARGET_EITHER" |
| 12115 |
"* |
| 12116 |
making_const_table = TRUE; |
| 12117 |
assemble_integer (operands[0], 1, BITS_PER_WORD, 1); |
| 12118 |
assemble_zeros (3); |
| 12119 |
return \"\"; |
| 12120 |
" |
| 12121 |
[(set_attr "length" "4") |
| 12122 |
(set_attr "type" "no_insn")] |
| 12123 |
) |
| 12124 |
|
| 12125 |
(define_insn "consttable_2" |
| 12126 |
[(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_2)] |
| 12127 |
"TARGET_EITHER" |
| 12128 |
"* |
| 12129 |
{ |
| 12130 |
rtx x = operands[0]; |
| 12131 |
making_const_table = TRUE; |
| 12132 |
switch (GET_MODE_CLASS (GET_MODE (x))) |
| 12133 |
{ |
| 12134 |
case MODE_FLOAT: |
| 12135 |
arm_emit_fp16_const (x); |
| 12136 |
break; |
| 12137 |
default: |
| 12138 |
assemble_integer (operands[0], 2, BITS_PER_WORD, 1); |
| 12139 |
assemble_zeros (2); |
| 12140 |
break; |
| 12141 |
} |
| 12142 |
return \"\"; |
| 12143 |
}" |
| 12144 |
[(set_attr "length" "4") |
| 12145 |
(set_attr "type" "no_insn")] |
| 12146 |
) |
| 12147 |
|
| 12148 |
(define_insn "consttable_4" |
| 12149 |
[(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_4)] |
| 12150 |
"TARGET_EITHER" |
| 12151 |
"* |
| 12152 |
{ |
| 12153 |
rtx x = operands[0]; |
| 12154 |
making_const_table = TRUE; |
| 12155 |
scalar_float_mode float_mode; |
| 12156 |
if (is_a <scalar_float_mode> (GET_MODE (x), &float_mode)) |
| 12157 |
assemble_real (*CONST_DOUBLE_REAL_VALUE (x), float_mode, BITS_PER_WORD); |
| 12158 |
else |
| 12159 |
{ |
| 12160 |
/* XXX: Sometimes gcc does something really dumb and ends up with |
| 12161 |
a HIGH in a constant pool entry, usually because it's trying to |
| 12162 |
load into a VFP register. We know this will always be used in |
| 12163 |
combination with a LO_SUM which ignores the high bits, so just |
| 12164 |
strip off the HIGH. */ |
| 12165 |
if (GET_CODE (x) == HIGH) |
| 12166 |
x = XEXP (x, 0); |
| 12167 |
assemble_integer (x, 4, BITS_PER_WORD, 1); |
| 12168 |
mark_symbol_refs_as_used (x); |
| 12169 |
} |
| 12170 |
return \"\"; |
| 12171 |
}" |
| 12172 |
[(set_attr "length" "4") |
| 12173 |
(set_attr "type" "no_insn")] |
| 12174 |
) |
| 12175 |
|
| 12176 |
(define_insn "consttable_8" |
| 12177 |
[(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_8)] |
| 12178 |
"TARGET_EITHER" |
| 12179 |
"* |
| 12180 |
{ |
| 12181 |
making_const_table = TRUE; |
| 12182 |
scalar_float_mode float_mode; |
| 12183 |
if (is_a <scalar_float_mode> (GET_MODE (operands[0]), &float_mode)) |
| 12184 |
assemble_real (*CONST_DOUBLE_REAL_VALUE (operands[0]), |
| 12185 |
float_mode, BITS_PER_WORD); |
| 12186 |
else |
| 12187 |
assemble_integer (operands[0], 8, BITS_PER_WORD, 1); |
| 12188 |
return \"\"; |
| 12189 |
}" |
| 12190 |
[(set_attr "length" "8") |
| 12191 |
(set_attr "type" "no_insn")] |
| 12192 |
) |
| 12193 |
|
| 12194 |
(define_insn "consttable_16" |
| 12195 |
[(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_16)] |
| 12196 |
"TARGET_EITHER" |
| 12197 |
"* |
| 12198 |
{ |
| 12199 |
making_const_table = TRUE; |
| 12200 |
scalar_float_mode float_mode; |
| 12201 |
if (is_a <scalar_float_mode> (GET_MODE (operands[0]), &float_mode)) |
| 12202 |
assemble_real (*CONST_DOUBLE_REAL_VALUE (operands[0]), |
| 12203 |
float_mode, BITS_PER_WORD); |
| 12204 |
else |
| 12205 |
assemble_integer (operands[0], 16, BITS_PER_WORD, 1); |
| 12206 |
return \"\"; |
| 12207 |
}" |
| 12208 |
[(set_attr "length" "16") |
| 12209 |
(set_attr "type" "no_insn")] |
| 12210 |
) |
| 12211 |
|
| 12212 |
;; V5 Instructions, |
| 12213 |
|
| 12214 |
(define_insn "clzsi2" |
| 12215 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12216 |
(clz:SI (match_operand:SI 1 "s_register_operand" "r")))] |
| 12217 |
"TARGET_32BIT && arm_arch5t" |
| 12218 |
"clz%?\\t%0, %1" |
| 12219 |
[(set_attr "predicable" "yes") |
| 12220 |
(set_attr "type" "clz")]) |
| 12221 |
|
| 12222 |
(define_insn "arm_rbit" |
| 12223 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12224 |
(unspec:SI [(match_operand:SI 1 "s_register_operand" "r")] UNSPEC_RBIT))] |
| 12225 |
"TARGET_32BIT && arm_arch_thumb2" |
| 12226 |
"rbit%?\\t%0, %1" |
| 12227 |
[(set_attr "predicable" "yes") |
| 12228 |
(set_attr "type" "clz")]) |
| 12229 |
|
| 12230 |
;; Keep this as a CTZ expression until after reload and then split |
| 12231 |
;; into RBIT + CLZ. Since RBIT is represented as an UNSPEC it is unlikely |
| 12232 |
;; to fold with any other expression. |
| 12233 |
|
| 12234 |
(define_insn_and_split "ctzsi2" |
| 12235 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12236 |
(ctz:SI (match_operand:SI 1 "s_register_operand" "r")))] |
| 12237 |
"TARGET_32BIT && arm_arch_thumb2" |
| 12238 |
"#" |
| 12239 |
"&& reload_completed" |
| 12240 |
[(const_int 0)] |
| 12241 |
" |
| 12242 |
emit_insn (gen_arm_rbit (operands[0], operands[1])); |
| 12243 |
emit_insn (gen_clzsi2 (operands[0], operands[0])); |
| 12244 |
DONE; |
| 12245 |
") |
| 12246 |
|
| 12247 |
;; V5E instructions. |
| 12248 |
|
| 12249 |
(define_insn "prefetch" |
| 12250 |
[(prefetch (match_operand:SI 0 "address_operand" "p") |
| 12251 |
(match_operand:SI 1 "" "") |
| 12252 |
(match_operand:SI 2 "" ""))] |
| 12253 |
"TARGET_32BIT && arm_arch5te" |
| 12254 |
"pld\\t%a0" |
| 12255 |
[(set_attr "type" "load_4")] |
| 12256 |
) |
| 12257 |
|
| 12258 |
;; General predication pattern |
| 12259 |
|
| 12260 |
(define_cond_exec |
| 12261 |
[(match_operator 0 "arm_comparison_operator" |
| 12262 |
[(match_operand 1 "cc_register" "") |
| 12263 |
(const_int 0)])] |
| 12264 |
"TARGET_32BIT |
| 12265 |
&& (!TARGET_NO_VOLATILE_CE || !volatile_refs_p (PATTERN (insn)))" |
| 12266 |
"" |
| 12267 |
[(set_attr "predicated" "yes")] |
| 12268 |
) |
| 12269 |
|
| 12270 |
(define_insn "force_register_use" |
| 12271 |
[(unspec:SI [(match_operand:SI 0 "register_operand" "")] UNSPEC_REGISTER_USE)] |
| 12272 |
"" |
| 12273 |
"%@ %0 needed" |
| 12274 |
[(set_attr "length" "0") |
| 12275 |
(set_attr "type" "no_insn")] |
| 12276 |
) |
| 12277 |
|
| 12278 |
|
| 12279 |
;; Patterns for exception handling |
| 12280 |
|
| 12281 |
(define_expand "eh_return" |
| 12282 |
[(use (match_operand 0 "general_operand"))] |
| 12283 |
"TARGET_EITHER" |
| 12284 |
" |
| 12285 |
{ |
| 12286 |
if (TARGET_32BIT) |
| 12287 |
emit_insn (gen_arm_eh_return (operands[0])); |
| 12288 |
else |
| 12289 |
emit_insn (gen_thumb_eh_return (operands[0])); |
| 12290 |
DONE; |
| 12291 |
}" |
| 12292 |
) |
| 12293 |
|
| 12294 |
;; We can't expand this before we know where the link register is stored. |
| 12295 |
(define_insn_and_split "arm_eh_return" |
| 12296 |
[(unspec_volatile [(match_operand:SI 0 "s_register_operand" "r")] |
| 12297 |
VUNSPEC_EH_RETURN) |
| 12298 |
(clobber (match_scratch:SI 1 "=&r"))] |
| 12299 |
"TARGET_ARM" |
| 12300 |
"#" |
| 12301 |
"&& reload_completed" |
| 12302 |
[(const_int 0)] |
| 12303 |
" |
| 12304 |
{ |
| 12305 |
arm_set_return_address (operands[0], operands[1]); |
| 12306 |
DONE; |
| 12307 |
}" |
| 12308 |
) |
| 12309 |
|
| 12310 |
|
| 12311 |
;; TLS support |
| 12312 |
|
| 12313 |
(define_insn "load_tp_hard" |
| 12314 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 12315 |
(unspec:SI [(const_int 0)] UNSPEC_TLS))] |
| 12316 |
"TARGET_HARD_TP" |
| 12317 |
"* return arm_output_load_tpidr (operands[0], true);" |
| 12318 |
[(set_attr "predicable" "yes") |
| 12319 |
(set_attr "type" "mrs")] |
| 12320 |
) |
| 12321 |
|
| 12322 |
;; Used by the TLS register based stack protector |
| 12323 |
(define_insn "reload_tp_hard" |
| 12324 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 12325 |
(unspec_volatile:SI [(const_int 0)] VUNSPEC_MRC))] |
| 12326 |
"TARGET_HARD_TP" |
| 12327 |
"* return arm_output_load_tpidr (operands[0], false);" |
| 12328 |
[(set_attr "type" "mrs")] |
| 12329 |
) |
| 12330 |
|
| 12331 |
;; Doesn't clobber R1-R3. Must use r0 for the first operand. |
| 12332 |
(define_insn "load_tp_soft_fdpic" |
| 12333 |
[(set (reg:SI 0) (unspec:SI [(const_int 0)] UNSPEC_TLS)) |
| 12334 |
(clobber (reg:SI FDPIC_REGNUM)) |
| 12335 |
(clobber (reg:SI LR_REGNUM)) |
| 12336 |
(clobber (reg:SI IP_REGNUM)) |
| 12337 |
(clobber (reg:CC CC_REGNUM))] |
| 12338 |
"TARGET_SOFT_TP && TARGET_FDPIC" |
| 12339 |
"bl\\t__aeabi_read_tp\\t@ load_tp_soft" |
| 12340 |
[(set_attr "conds" "clob") |
| 12341 |
(set_attr "type" "branch")] |
| 12342 |
) |
| 12343 |
|
| 12344 |
;; Doesn't clobber R1-R3. Must use r0 for the first operand. |
| 12345 |
(define_insn "load_tp_soft" |
| 12346 |
[(set (reg:SI 0) (unspec:SI [(const_int 0)] UNSPEC_TLS)) |
| 12347 |
(clobber (reg:SI LR_REGNUM)) |
| 12348 |
(clobber (reg:SI IP_REGNUM)) |
| 12349 |
(clobber (reg:CC CC_REGNUM))] |
| 12350 |
"TARGET_SOFT_TP && !TARGET_FDPIC" |
| 12351 |
"bl\\t__aeabi_read_tp\\t@ load_tp_soft" |
| 12352 |
[(set_attr "conds" "clob") |
| 12353 |
(set_attr "type" "branch")] |
| 12354 |
) |
| 12355 |
|
| 12356 |
;; tls descriptor call |
| 12357 |
(define_insn "tlscall" |
| 12358 |
[(set (reg:SI R0_REGNUM) |
| 12359 |
(unspec:SI [(reg:SI R0_REGNUM) |
| 12360 |
(match_operand:SI 0 "" "X") |
| 12361 |
(match_operand 1 "" "")] UNSPEC_TLS)) |
| 12362 |
(clobber (reg:SI R1_REGNUM)) |
| 12363 |
(clobber (reg:SI LR_REGNUM)) |
| 12364 |
(clobber (reg:SI CC_REGNUM))] |
| 12365 |
"TARGET_GNU2_TLS" |
| 12366 |
{ |
| 12367 |
targetm.asm_out.internal_label (asm_out_file, "LPIC", |
| 12368 |
INTVAL (operands[1])); |
| 12369 |
return "bl\\t%c0(tlscall)"; |
| 12370 |
} |
| 12371 |
[(set_attr "conds" "clob") |
| 12372 |
(set_attr "length" "4") |
| 12373 |
(set_attr "type" "branch")] |
| 12374 |
) |
| 12375 |
|
| 12376 |
;; For thread pointer builtin |
| 12377 |
(define_expand "get_thread_pointersi" |
| 12378 |
[(match_operand:SI 0 "s_register_operand")] |
| 12379 |
"" |
| 12380 |
" |
| 12381 |
{ |
| 12382 |
arm_load_tp (operands[0]); |
| 12383 |
DONE; |
| 12384 |
}") |
| 12385 |
|
| 12386 |
;; |
| 12387 |
|
| 12388 |
;; We only care about the lower 16 bits of the constant |
| 12389 |
;; being inserted into the upper 16 bits of the register. |
| 12390 |
(define_insn "*arm_movtas_ze" |
| 12391 |
[(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "+r,r") |
| 12392 |
(const_int 16) |
| 12393 |
(const_int 16)) |
| 12394 |
(match_operand:SI 1 "const_int_operand" ""))] |
| 12395 |
"TARGET_HAVE_MOVT" |
| 12396 |
"@ |
| 12397 |
movt%?\t%0, %L1 |
| 12398 |
movt\t%0, %L1" |
| 12399 |
[(set_attr "arch" "32,v8mb") |
| 12400 |
(set_attr "predicable" "yes") |
| 12401 |
(set_attr "length" "4") |
| 12402 |
(set_attr "type" "alu_sreg")] |
| 12403 |
) |
| 12404 |
|
| 12405 |
(define_insn "*arm_rev" |
| 12406 |
[(set (match_operand:SI 0 "s_register_operand" "=l,l,r") |
| 12407 |
(bswap:SI (match_operand:SI 1 "s_register_operand" "l,l,r")))] |
| 12408 |
"arm_arch6" |
| 12409 |
"@ |
| 12410 |
rev\t%0, %1 |
| 12411 |
rev%?\t%0, %1 |
| 12412 |
rev%?\t%0, %1" |
| 12413 |
[(set_attr "arch" "t1,t2,32") |
| 12414 |
(set_attr "length" "2,2,4") |
| 12415 |
(set_attr "predicable" "no,yes,yes") |
| 12416 |
(set_attr "type" "rev")] |
| 12417 |
) |
| 12418 |
|
| 12419 |
(define_expand "arm_legacy_rev" |
| 12420 |
[(set (match_operand:SI 2 "s_register_operand") |
| 12421 |
(xor:SI (rotatert:SI (match_operand:SI 1 "s_register_operand") |
| 12422 |
(const_int 16)) |
| 12423 |
(match_dup 1))) |
| 12424 |
(set (match_dup 2) |
| 12425 |
(lshiftrt:SI (match_dup 2) |
| 12426 |
(const_int 8))) |
| 12427 |
(set (match_operand:SI 3 "s_register_operand") |
| 12428 |
(rotatert:SI (match_dup 1) |
| 12429 |
(const_int 8))) |
| 12430 |
(set (match_dup 2) |
| 12431 |
(and:SI (match_dup 2) |
| 12432 |
(const_int -65281))) |
| 12433 |
(set (match_operand:SI 0 "s_register_operand") |
| 12434 |
(xor:SI (match_dup 3) |
| 12435 |
(match_dup 2)))] |
| 12436 |
"TARGET_32BIT" |
| 12437 |
"" |
| 12438 |
) |
| 12439 |
|
| 12440 |
;; Reuse temporaries to keep register pressure down. |
| 12441 |
(define_expand "thumb_legacy_rev" |
| 12442 |
[(set (match_operand:SI 2 "s_register_operand") |
| 12443 |
(ashift:SI (match_operand:SI 1 "s_register_operand") |
| 12444 |
(const_int 24))) |
| 12445 |
(set (match_operand:SI 3 "s_register_operand") |
| 12446 |
(lshiftrt:SI (match_dup 1) |
| 12447 |
(const_int 24))) |
| 12448 |
(set (match_dup 3) |
| 12449 |
(ior:SI (match_dup 3) |
| 12450 |
(match_dup 2))) |
| 12451 |
(set (match_operand:SI 4 "s_register_operand") |
| 12452 |
(const_int 16)) |
| 12453 |
(set (match_operand:SI 5 "s_register_operand") |
| 12454 |
(rotatert:SI (match_dup 1) |
| 12455 |
(match_dup 4))) |
| 12456 |
(set (match_dup 2) |
| 12457 |
(ashift:SI (match_dup 5) |
| 12458 |
(const_int 24))) |
| 12459 |
(set (match_dup 5) |
| 12460 |
(lshiftrt:SI (match_dup 5) |
| 12461 |
(const_int 24))) |
| 12462 |
(set (match_dup 5) |
| 12463 |
(ior:SI (match_dup 5) |
| 12464 |
(match_dup 2))) |
| 12465 |
(set (match_dup 5) |
| 12466 |
(rotatert:SI (match_dup 5) |
| 12467 |
(match_dup 4))) |
| 12468 |
(set (match_operand:SI 0 "s_register_operand") |
| 12469 |
(ior:SI (match_dup 5) |
| 12470 |
(match_dup 3)))] |
| 12471 |
"TARGET_THUMB" |
| 12472 |
"" |
| 12473 |
) |
| 12474 |
|
| 12475 |
;; ARM-specific expansion of signed mod by power of 2 |
| 12476 |
;; using conditional negate. |
| 12477 |
;; For r0 % n where n is a power of 2 produce: |
| 12478 |
;; rsbs r1, r0, #0 |
| 12479 |
;; and r0, r0, #(n - 1) |
| 12480 |
;; and r1, r1, #(n - 1) |
| 12481 |
;; rsbpl r0, r1, #0 |
| 12482 |
|
| 12483 |
(define_expand "modsi3" |
| 12484 |
[(match_operand:SI 0 "register_operand") |
| 12485 |
(match_operand:SI 1 "register_operand") |
| 12486 |
(match_operand:SI 2 "const_int_operand")] |
| 12487 |
"TARGET_32BIT" |
| 12488 |
{ |
| 12489 |
HOST_WIDE_INT val = INTVAL (operands[2]); |
| 12490 |
|
| 12491 |
if (val <= 0 |
| 12492 |
|| exact_log2 (val) <= 0) |
| 12493 |
FAIL; |
| 12494 |
|
| 12495 |
rtx mask = GEN_INT (val - 1); |
| 12496 |
|
| 12497 |
/* In the special case of x0 % 2 we can do the even shorter: |
| 12498 |
cmp r0, #0 |
| 12499 |
and r0, r0, #1 |
| 12500 |
rsblt r0, r0, #0. */ |
| 12501 |
|
| 12502 |
if (val == 2) |
| 12503 |
{ |
| 12504 |
rtx cc_reg = arm_gen_compare_reg (LT, |
| 12505 |
operands[1], const0_rtx, NULL_RTX); |
| 12506 |
rtx cond = gen_rtx_LT (SImode, cc_reg, const0_rtx); |
| 12507 |
rtx masked = gen_reg_rtx (SImode); |
| 12508 |
|
| 12509 |
emit_insn (gen_andsi3 (masked, operands[1], mask)); |
| 12510 |
emit_move_insn (operands[0], |
| 12511 |
gen_rtx_IF_THEN_ELSE (SImode, cond, |
| 12512 |
gen_rtx_NEG (SImode, |
| 12513 |
masked), |
| 12514 |
masked)); |
| 12515 |
DONE; |
| 12516 |
} |
| 12517 |
|
| 12518 |
rtx neg_op = gen_reg_rtx (SImode); |
| 12519 |
rtx_insn *insn = emit_insn (gen_subsi3_compare0 (neg_op, const0_rtx, |
| 12520 |
operands[1])); |
| 12521 |
|
| 12522 |
/* Extract the condition register and mode. */ |
| 12523 |
rtx cmp = XVECEXP (PATTERN (insn), 0, 0); |
| 12524 |
rtx cc_reg = SET_DEST (cmp); |
| 12525 |
rtx cond = gen_rtx_GE (SImode, cc_reg, const0_rtx); |
| 12526 |
|
| 12527 |
emit_insn (gen_andsi3 (operands[0], operands[1], mask)); |
| 12528 |
|
| 12529 |
rtx masked_neg = gen_reg_rtx (SImode); |
| 12530 |
emit_insn (gen_andsi3 (masked_neg, neg_op, mask)); |
| 12531 |
|
| 12532 |
/* We want a conditional negate here, but emitting COND_EXEC rtxes |
| 12533 |
during expand does not always work. Do an IF_THEN_ELSE instead. */ |
| 12534 |
emit_move_insn (operands[0], |
| 12535 |
gen_rtx_IF_THEN_ELSE (SImode, cond, |
| 12536 |
gen_rtx_NEG (SImode, masked_neg), |
| 12537 |
operands[0])); |
| 12538 |
|
| 12539 |
|
| 12540 |
DONE; |
| 12541 |
} |
| 12542 |
) |
| 12543 |
|
| 12544 |
(define_expand "bswapsi2" |
| 12545 |
[(set (match_operand:SI 0 "s_register_operand") |
| 12546 |
(bswap:SI (match_operand:SI 1 "s_register_operand")))] |
| 12547 |
"TARGET_EITHER && (arm_arch6 || !optimize_size)" |
| 12548 |
" |
| 12549 |
if (!arm_arch6) |
| 12550 |
{ |
| 12551 |
rtx op2 = gen_reg_rtx (SImode); |
| 12552 |
rtx op3 = gen_reg_rtx (SImode); |
| 12553 |
|
| 12554 |
if (TARGET_THUMB) |
| 12555 |
{ |
| 12556 |
rtx op4 = gen_reg_rtx (SImode); |
| 12557 |
rtx op5 = gen_reg_rtx (SImode); |
| 12558 |
|
| 12559 |
emit_insn (gen_thumb_legacy_rev (operands[0], operands[1], |
| 12560 |
op2, op3, op4, op5)); |
| 12561 |
} |
| 12562 |
else |
| 12563 |
{ |
| 12564 |
emit_insn (gen_arm_legacy_rev (operands[0], operands[1], |
| 12565 |
op2, op3)); |
| 12566 |
} |
| 12567 |
|
| 12568 |
DONE; |
| 12569 |
} |
| 12570 |
" |
| 12571 |
) |
| 12572 |
|
| 12573 |
;; bswap16 patterns: use revsh and rev16 instructions for the signed |
| 12574 |
;; and unsigned variants, respectively. For rev16, expose |
| 12575 |
;; byte-swapping in the lower 16 bits only. |
| 12576 |
(define_insn "*arm_revsh" |
| 12577 |
[(set (match_operand:SI 0 "s_register_operand" "=l,l,r") |
| 12578 |
(sign_extend:SI (bswap:HI (match_operand:HI 1 "s_register_operand" "l,l,r"))))] |
| 12579 |
"arm_arch6" |
| 12580 |
"@ |
| 12581 |
revsh\t%0, %1 |
| 12582 |
revsh%?\t%0, %1 |
| 12583 |
revsh%?\t%0, %1" |
| 12584 |
[(set_attr "arch" "t1,t2,32") |
| 12585 |
(set_attr "length" "2,2,4") |
| 12586 |
(set_attr "predicable" "no,yes,yes") |
| 12587 |
(set_attr "type" "rev")] |
| 12588 |
) |
| 12589 |
|
| 12590 |
(define_insn "*arm_rev16" |
| 12591 |
[(set (match_operand:HI 0 "s_register_operand" "=l,l,r") |
| 12592 |
(bswap:HI (match_operand:HI 1 "s_register_operand" "l,l,r")))] |
| 12593 |
"arm_arch6" |
| 12594 |
"@ |
| 12595 |
rev16\t%0, %1 |
| 12596 |
rev16%?\t%0, %1 |
| 12597 |
rev16%?\t%0, %1" |
| 12598 |
[(set_attr "arch" "t1,t2,32") |
| 12599 |
(set_attr "length" "2,2,4") |
| 12600 |
(set_attr "predicable" "no,yes,yes") |
| 12601 |
(set_attr "type" "rev")] |
| 12602 |
) |
| 12603 |
|
| 12604 |
;; There are no canonicalisation rules for the position of the lshiftrt, ashift |
| 12605 |
;; operations within an IOR/AND RTX, therefore we have two patterns matching |
| 12606 |
;; each valid permutation. |
| 12607 |
|
| 12608 |
(define_insn "arm_rev16si2_alt1" |
| 12609 |
[(set (match_operand:SI 0 "register_operand" "=l,l,r") |
| 12610 |
(ior:SI (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "l,l,r") |
| 12611 |
(const_int 8)) |
| 12612 |
(match_operand:SI 3 "const_int_operand" "n,n,n")) |
| 12613 |
(and:SI (lshiftrt:SI (match_dup 1) |
| 12614 |
(const_int 8)) |
| 12615 |
(match_operand:SI 2 "const_int_operand" "n,n,n"))))] |
| 12616 |
"arm_arch6 |
| 12617 |
&& aarch_rev16_shleft_mask_imm_p (operands[3], SImode) |
| 12618 |
&& aarch_rev16_shright_mask_imm_p (operands[2], SImode)" |
| 12619 |
"@ |
| 12620 |
rev16\t%0, %1 |
| 12621 |
rev16%?\t%0, %1 |
| 12622 |
rev16%?\t%0, %1" |
| 12623 |
[(set_attr "arch" "t1,t2,32") |
| 12624 |
(set_attr "length" "2,2,4") |
| 12625 |
(set_attr "predicable" "no,yes,yes") |
| 12626 |
(set_attr "type" "rev")] |
| 12627 |
) |
| 12628 |
|
| 12629 |
(define_insn "*arm_rev16si2_alt2" |
| 12630 |
[(set (match_operand:SI 0 "register_operand" "=l,l,r") |
| 12631 |
(ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "l,l,r") |
| 12632 |
(const_int 8)) |
| 12633 |
(match_operand:SI 2 "const_int_operand" "n,n,n")) |
| 12634 |
(and:SI (ashift:SI (match_dup 1) |
| 12635 |
(const_int 8)) |
| 12636 |
(match_operand:SI 3 "const_int_operand" "n,n,n"))))] |
| 12637 |
"arm_arch6 |
| 12638 |
&& aarch_rev16_shleft_mask_imm_p (operands[3], SImode) |
| 12639 |
&& aarch_rev16_shright_mask_imm_p (operands[2], SImode)" |
| 12640 |
"@ |
| 12641 |
rev16\t%0, %1 |
| 12642 |
rev16%?\t%0, %1 |
| 12643 |
rev16%?\t%0, %1" |
| 12644 |
[(set_attr "arch" "t1,t2,32") |
| 12645 |
(set_attr "length" "2,2,4") |
| 12646 |
(set_attr "predicable" "no,yes,yes") |
| 12647 |
(set_attr "type" "rev")] |
| 12648 |
) |
| 12649 |
|
| 12650 |
;; Similar pattern to match (rotate (bswap) 16) |
| 12651 |
(define_insn "arm_rev16si2" |
| 12652 |
[(set (match_operand:SI 0 "register_operand" "=l,l,r") |
| 12653 |
(rotate:SI (bswap:SI (match_operand:SI 1 "register_operand" "l,l,r")) |
| 12654 |
(const_int 16)))] |
| 12655 |
"arm_arch6" |
| 12656 |
"@ |
| 12657 |
rev16\t%0, %1 |
| 12658 |
rev16%?\t%0, %1 |
| 12659 |
rev16%?\t%0, %1" |
| 12660 |
[(set_attr "arch" "t1,t2,32") |
| 12661 |
(set_attr "length" "2,2,4") |
| 12662 |
(set_attr "type" "rev")] |
| 12663 |
) |
| 12664 |
|
| 12665 |
(define_expand "bswaphi2" |
| 12666 |
[(set (match_operand:HI 0 "s_register_operand") |
| 12667 |
(bswap:HI (match_operand:HI 1 "s_register_operand")))] |
| 12668 |
"arm_arch6" |
| 12669 |
"" |
| 12670 |
) |
| 12671 |
|
| 12672 |
;; Implement zero_extract using uxtb/uxth instruction with |
| 12673 |
;; the ror #N qualifier when applicable. |
| 12674 |
|
| 12675 |
(define_insn "*arm_zeroextractsi2_8_8" |
| 12676 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12677 |
(zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 12678 |
(const_int 8) (const_int 8)))] |
| 12679 |
"TARGET_ARM && arm_arch6" |
| 12680 |
"uxtb%?\\t%0, %1, ror #8" |
| 12681 |
[(set_attr "predicable" "yes") |
| 12682 |
(set_attr "type" "extend")] |
| 12683 |
) |
| 12684 |
|
| 12685 |
(define_insn "*arm_zeroextractsi2_8_16" |
| 12686 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12687 |
(zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 12688 |
(const_int 8) (const_int 16)))] |
| 12689 |
"TARGET_ARM && arm_arch6" |
| 12690 |
"uxtb%?\\t%0, %1, ror #16" |
| 12691 |
[(set_attr "predicable" "yes") |
| 12692 |
(set_attr "type" "extend")] |
| 12693 |
) |
| 12694 |
|
| 12695 |
(define_insn "*arm_zeroextractsi2_16_8" |
| 12696 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12697 |
(zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 12698 |
(const_int 16) (const_int 8)))] |
| 12699 |
"TARGET_ARM && arm_arch6" |
| 12700 |
"uxth%?\\t%0, %1, ror #8" |
| 12701 |
[(set_attr "predicable" "yes") |
| 12702 |
(set_attr "type" "extend")] |
| 12703 |
) |
| 12704 |
|
| 12705 |
;; Implement sign_extract using sxtb/sxth instruction with |
| 12706 |
;; the ror #N qualifier when applicable. |
| 12707 |
|
| 12708 |
(define_insn "*arm_signextractsi2_8_8" |
| 12709 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12710 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 12711 |
(const_int 8) (const_int 8)))] |
| 12712 |
"TARGET_ARM && arm_arch6" |
| 12713 |
"sxtb%?\\t%0, %1, ror #8" |
| 12714 |
[(set_attr "predicable" "yes") |
| 12715 |
(set_attr "type" "extend")] |
| 12716 |
) |
| 12717 |
|
| 12718 |
(define_insn "*arm_signextractsi2_8_16" |
| 12719 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12720 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 12721 |
(const_int 8) (const_int 16)))] |
| 12722 |
"TARGET_ARM && arm_arch6" |
| 12723 |
"sxtb%?\\t%0, %1, ror #16" |
| 12724 |
[(set_attr "predicable" "yes") |
| 12725 |
(set_attr "type" "extend")] |
| 12726 |
) |
| 12727 |
|
| 12728 |
(define_insn "*arm_signextractsi2_16_8" |
| 12729 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12730 |
(sign_extract:SI (match_operand:SI 1 "s_register_operand" "r") |
| 12731 |
(const_int 16) (const_int 8)))] |
| 12732 |
"TARGET_ARM && arm_arch6" |
| 12733 |
"sxth%?\\t%0, %1, ror #8" |
| 12734 |
[(set_attr "predicable" "yes") |
| 12735 |
(set_attr "type" "extend")] |
| 12736 |
) |
| 12737 |
|
| 12738 |
;; Patterns for LDRD/STRD in Thumb2 mode |
| 12739 |
|
| 12740 |
(define_insn "*thumb2_ldrd" |
| 12741 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12742 |
(mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "rk") |
| 12743 |
(match_operand:SI 2 "ldrd_strd_offset_operand" "Do")))) |
| 12744 |
(set (match_operand:SI 3 "s_register_operand" "=r") |
| 12745 |
(mem:SI (plus:SI (match_dup 1) |
| 12746 |
(match_operand:SI 4 "const_int_operand" ""))))] |
| 12747 |
"TARGET_LDRD && TARGET_THUMB2 && reload_completed |
| 12748 |
&& ((INTVAL (operands[2]) + 4) == INTVAL (operands[4])) |
| 12749 |
&& (operands_ok_ldrd_strd (operands[0], operands[3], |
| 12750 |
operands[1], INTVAL (operands[2]), |
| 12751 |
false, true))" |
| 12752 |
"ldrd%?\t%0, %3, [%1, %2]" |
| 12753 |
[(set_attr "type" "load_8") |
| 12754 |
(set_attr "predicable" "yes")]) |
| 12755 |
|
| 12756 |
(define_insn "*thumb2_ldrd_base" |
| 12757 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12758 |
(mem:SI (match_operand:SI 1 "s_register_operand" "rk"))) |
| 12759 |
(set (match_operand:SI 2 "s_register_operand" "=r") |
| 12760 |
(mem:SI (plus:SI (match_dup 1) |
| 12761 |
(const_int 4))))] |
| 12762 |
"TARGET_LDRD && TARGET_THUMB2 && reload_completed |
| 12763 |
&& (operands_ok_ldrd_strd (operands[0], operands[2], |
| 12764 |
operands[1], 0, false, true))" |
| 12765 |
"ldrd%?\t%0, %2, [%1]" |
| 12766 |
[(set_attr "type" "load_8") |
| 12767 |
(set_attr "predicable" "yes")]) |
| 12768 |
|
| 12769 |
(define_insn "*thumb2_ldrd_base_neg" |
| 12770 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12771 |
(mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "rk") |
| 12772 |
(const_int -4)))) |
| 12773 |
(set (match_operand:SI 2 "s_register_operand" "=r") |
| 12774 |
(mem:SI (match_dup 1)))] |
| 12775 |
"TARGET_LDRD && TARGET_THUMB2 && reload_completed |
| 12776 |
&& (operands_ok_ldrd_strd (operands[0], operands[2], |
| 12777 |
operands[1], -4, false, true))" |
| 12778 |
"ldrd%?\t%0, %2, [%1, #-4]" |
| 12779 |
[(set_attr "type" "load_8") |
| 12780 |
(set_attr "predicable" "yes")]) |
| 12781 |
|
| 12782 |
(define_insn "*thumb2_strd" |
| 12783 |
[(set (mem:SI (plus:SI (match_operand:SI 0 "s_register_operand" "rk") |
| 12784 |
(match_operand:SI 1 "ldrd_strd_offset_operand" "Do"))) |
| 12785 |
(match_operand:SI 2 "s_register_operand" "r")) |
| 12786 |
(set (mem:SI (plus:SI (match_dup 0) |
| 12787 |
(match_operand:SI 3 "const_int_operand" ""))) |
| 12788 |
(match_operand:SI 4 "s_register_operand" "r"))] |
| 12789 |
"TARGET_LDRD && TARGET_THUMB2 && reload_completed |
| 12790 |
&& ((INTVAL (operands[1]) + 4) == INTVAL (operands[3])) |
| 12791 |
&& (operands_ok_ldrd_strd (operands[2], operands[4], |
| 12792 |
operands[0], INTVAL (operands[1]), |
| 12793 |
false, false))" |
| 12794 |
"strd%?\t%2, %4, [%0, %1]" |
| 12795 |
[(set_attr "type" "store_8") |
| 12796 |
(set_attr "predicable" "yes")]) |
| 12797 |
|
| 12798 |
(define_insn "*thumb2_strd_base" |
| 12799 |
[(set (mem:SI (match_operand:SI 0 "s_register_operand" "rk")) |
| 12800 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 12801 |
(set (mem:SI (plus:SI (match_dup 0) |
| 12802 |
(const_int 4))) |
| 12803 |
(match_operand:SI 2 "s_register_operand" "r"))] |
| 12804 |
"TARGET_LDRD && TARGET_THUMB2 && reload_completed |
| 12805 |
&& (operands_ok_ldrd_strd (operands[1], operands[2], |
| 12806 |
operands[0], 0, false, false))" |
| 12807 |
"strd%?\t%1, %2, [%0]" |
| 12808 |
[(set_attr "type" "store_8") |
| 12809 |
(set_attr "predicable" "yes")]) |
| 12810 |
|
| 12811 |
(define_insn "*thumb2_strd_base_neg" |
| 12812 |
[(set (mem:SI (plus:SI (match_operand:SI 0 "s_register_operand" "rk") |
| 12813 |
(const_int -4))) |
| 12814 |
(match_operand:SI 1 "s_register_operand" "r")) |
| 12815 |
(set (mem:SI (match_dup 0)) |
| 12816 |
(match_operand:SI 2 "s_register_operand" "r"))] |
| 12817 |
"TARGET_LDRD && TARGET_THUMB2 && reload_completed |
| 12818 |
&& (operands_ok_ldrd_strd (operands[1], operands[2], |
| 12819 |
operands[0], -4, false, false))" |
| 12820 |
"strd%?\t%1, %2, [%0, #-4]" |
| 12821 |
[(set_attr "type" "store_8") |
| 12822 |
(set_attr "predicable" "yes")]) |
| 12823 |
|
| 12824 |
;; ARMv8 CRC32 instructions. |
| 12825 |
(define_insn "arm_<crc_variant>" |
| 12826 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 12827 |
(unspec:SI [(match_operand:SI 1 "s_register_operand" "r") |
| 12828 |
(match_operand:<crc_mode> 2 "s_register_operand" "r")] |
| 12829 |
CRC))] |
| 12830 |
"TARGET_CRC32" |
| 12831 |
"<crc_variant>\\t%0, %1, %2" |
| 12832 |
[(set_attr "type" "crc") |
| 12833 |
(set_attr "conds" "unconditional")] |
| 12834 |
) |
| 12835 |
|
| 12836 |
;; Load the load/store double peephole optimizations. |
| 12837 |
(include "ldrdstrd.md") |
| 12838 |
|
| 12839 |
;; Load the load/store multiple patterns |
| 12840 |
(include "ldmstm.md") |
| 12841 |
|
| 12842 |
;; Patterns in ldmstm.md don't cover more than 4 registers. This pattern covers |
| 12843 |
;; large lists without explicit writeback generated for APCS_FRAME epilogue. |
| 12844 |
;; The operands are validated through the load_multiple_operation |
| 12845 |
;; match_parallel predicate rather than through constraints so enable it only |
| 12846 |
;; after reload. |
| 12847 |
(define_insn "*load_multiple" |
| 12848 |
[(match_parallel 0 "load_multiple_operation" |
| 12849 |
[(set (match_operand:SI 2 "s_register_operand" "=rk") |
| 12850 |
(mem:SI (match_operand:SI 1 "s_register_operand" "rk"))) |
| 12851 |
])] |
| 12852 |
"TARGET_32BIT && reload_completed" |
| 12853 |
"* |
| 12854 |
{ |
| 12855 |
arm_output_multireg_pop (operands, /*return_pc=*/false, |
| 12856 |
/*cond=*/const_true_rtx, |
| 12857 |
/*reverse=*/false, |
| 12858 |
/*update=*/false); |
| 12859 |
return \"\"; |
| 12860 |
} |
| 12861 |
" |
| 12862 |
[(set_attr "predicable" "yes")] |
| 12863 |
) |
| 12864 |
|
| 12865 |
(define_expand "copysignsf3" |
| 12866 |
[(match_operand:SF 0 "register_operand") |
| 12867 |
(match_operand:SF 1 "register_operand") |
| 12868 |
(match_operand:SF 2 "register_operand")] |
| 12869 |
"TARGET_SOFT_FLOAT && arm_arch_thumb2" |
| 12870 |
"{ |
| 12871 |
emit_move_insn (operands[0], operands[2]); |
| 12872 |
emit_insn (gen_insv_t2 (simplify_gen_subreg (SImode, operands[0], SFmode, 0), |
| 12873 |
GEN_INT (31), GEN_INT (0), |
| 12874 |
simplify_gen_subreg (SImode, operands[1], SFmode, 0))); |
| 12875 |
DONE; |
| 12876 |
}" |
| 12877 |
) |
| 12878 |
|
| 12879 |
(define_expand "copysigndf3" |
| 12880 |
[(match_operand:DF 0 "register_operand") |
| 12881 |
(match_operand:DF 1 "register_operand") |
| 12882 |
(match_operand:DF 2 "register_operand")] |
| 12883 |
"TARGET_SOFT_FLOAT && arm_arch_thumb2" |
| 12884 |
"{ |
| 12885 |
rtx op0_low = gen_lowpart (SImode, operands[0]); |
| 12886 |
rtx op0_high = gen_highpart (SImode, operands[0]); |
| 12887 |
rtx op1_low = gen_lowpart (SImode, operands[1]); |
| 12888 |
rtx op1_high = gen_highpart (SImode, operands[1]); |
| 12889 |
rtx op2_high = gen_highpart (SImode, operands[2]); |
| 12890 |
|
| 12891 |
rtx scratch1 = gen_reg_rtx (SImode); |
| 12892 |
rtx scratch2 = gen_reg_rtx (SImode); |
| 12893 |
emit_move_insn (scratch1, op2_high); |
| 12894 |
emit_move_insn (scratch2, op1_high); |
| 12895 |
|
| 12896 |
emit_insn(gen_rtx_SET(scratch1, |
| 12897 |
gen_rtx_LSHIFTRT (SImode, op2_high, GEN_INT(31)))); |
| 12898 |
emit_insn(gen_insv_t2(scratch2, GEN_INT(1), GEN_INT(31), scratch1)); |
| 12899 |
emit_move_insn (op0_low, op1_low); |
| 12900 |
emit_move_insn (op0_high, scratch2); |
| 12901 |
|
| 12902 |
DONE; |
| 12903 |
}" |
| 12904 |
) |
| 12905 |
|
| 12906 |
;; movmisalign for DImode |
| 12907 |
(define_expand "movmisaligndi" |
| 12908 |
[(match_operand:DI 0 "general_operand") |
| 12909 |
(match_operand:DI 1 "general_operand")] |
| 12910 |
"unaligned_access" |
| 12911 |
{ |
| 12912 |
rtx lo_op0 = gen_lowpart (SImode, operands[0]); |
| 12913 |
rtx lo_op1 = gen_lowpart (SImode, operands[1]); |
| 12914 |
rtx hi_op0 = gen_highpart_mode (SImode, DImode, operands[0]); |
| 12915 |
rtx hi_op1 = gen_highpart_mode (SImode, DImode, operands[1]); |
| 12916 |
|
| 12917 |
if (aligned_operand (lo_op0, SImode) && aligned_operand (lo_op1, SImode)) |
| 12918 |
{ |
| 12919 |
emit_move_insn (lo_op0, lo_op1); |
| 12920 |
emit_move_insn (hi_op0, hi_op1); |
| 12921 |
} |
| 12922 |
else |
| 12923 |
{ |
| 12924 |
emit_insn (gen_movmisalignsi (lo_op0, lo_op1)); |
| 12925 |
emit_insn (gen_movmisalignsi (hi_op0, hi_op1)); |
| 12926 |
} |
| 12927 |
DONE; |
| 12928 |
}) |
| 12929 |
|
| 12930 |
;; movmisalign patterns for HImode and SImode. |
| 12931 |
(define_expand "movmisalign<mode>" |
| 12932 |
[(match_operand:HSI 0 "general_operand") |
| 12933 |
(match_operand:HSI 1 "general_operand")] |
| 12934 |
"unaligned_access" |
| 12935 |
{ |
| 12936 |
/* This pattern is not permitted to fail during expansion: if both arguments |
| 12937 |
are non-registers (e.g. memory := constant), force operand 1 into a |
| 12938 |
register. */ |
| 12939 |
rtx (* gen_unaligned_load)(rtx, rtx); |
| 12940 |
rtx tmp_dest = operands[0]; |
| 12941 |
if (!s_register_operand (operands[0], <MODE>mode) |
| 12942 |
&& !s_register_operand (operands[1], <MODE>mode)) |
| 12943 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 12944 |
|
| 12945 |
if (<MODE>mode == HImode) |
| 12946 |
{ |
| 12947 |
gen_unaligned_load = gen_unaligned_loadhiu; |
| 12948 |
tmp_dest = gen_reg_rtx (SImode); |
| 12949 |
} |
| 12950 |
else |
| 12951 |
gen_unaligned_load = gen_unaligned_loadsi; |
| 12952 |
|
| 12953 |
if (MEM_P (operands[1])) |
| 12954 |
{ |
| 12955 |
emit_insn (gen_unaligned_load (tmp_dest, operands[1])); |
| 12956 |
if (<MODE>mode == HImode) |
| 12957 |
emit_move_insn (operands[0], gen_lowpart (HImode, tmp_dest)); |
| 12958 |
} |
| 12959 |
else |
| 12960 |
emit_insn (gen_unaligned_store<mode> (operands[0], operands[1])); |
| 12961 |
|
| 12962 |
DONE; |
| 12963 |
}) |
| 12964 |
|
| 12965 |
(define_insn "arm_<cdp>" |
| 12966 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand" "n") |
| 12967 |
(match_operand:SI 1 "immediate_operand" "n") |
| 12968 |
(match_operand:SI 2 "immediate_operand" "n") |
| 12969 |
(match_operand:SI 3 "immediate_operand" "n") |
| 12970 |
(match_operand:SI 4 "immediate_operand" "n") |
| 12971 |
(match_operand:SI 5 "immediate_operand" "n")] CDPI)] |
| 12972 |
"arm_coproc_builtin_available (VUNSPEC_<CDP>)" |
| 12973 |
{ |
| 12974 |
arm_const_bounds (operands[0], 0, 16); |
| 12975 |
arm_const_bounds (operands[1], 0, 16); |
| 12976 |
arm_const_bounds (operands[2], 0, (1 << 5)); |
| 12977 |
arm_const_bounds (operands[3], 0, (1 << 5)); |
| 12978 |
arm_const_bounds (operands[4], 0, (1 << 5)); |
| 12979 |
arm_const_bounds (operands[5], 0, 8); |
| 12980 |
return "<cdp>\\tp%c0, %1, CR%c2, CR%c3, CR%c4, %5"; |
| 12981 |
} |
| 12982 |
[(set_attr "length" "4") |
| 12983 |
(set_attr "type" "coproc")]) |
| 12984 |
|
| 12985 |
(define_insn "*ldc" |
| 12986 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand" "n") |
| 12987 |
(match_operand:SI 1 "immediate_operand" "n") |
| 12988 |
(match_operand:SI 2 "memory_operand" "Uz")] LDCI)] |
| 12989 |
"arm_coproc_builtin_available (VUNSPEC_<LDC>)" |
| 12990 |
{ |
| 12991 |
arm_const_bounds (operands[0], 0, 16); |
| 12992 |
arm_const_bounds (operands[1], 0, (1 << 5)); |
| 12993 |
return "<ldc>\\tp%c0, CR%c1, %2"; |
| 12994 |
} |
| 12995 |
[(set_attr "length" "4") |
| 12996 |
(set_attr "type" "coproc")]) |
| 12997 |
|
| 12998 |
(define_insn "*stc" |
| 12999 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand" "n") |
| 13000 |
(match_operand:SI 1 "immediate_operand" "n") |
| 13001 |
(match_operand:SI 2 "memory_operand" "=Uz")] STCI)] |
| 13002 |
"arm_coproc_builtin_available (VUNSPEC_<STC>)" |
| 13003 |
{ |
| 13004 |
arm_const_bounds (operands[0], 0, 16); |
| 13005 |
arm_const_bounds (operands[1], 0, (1 << 5)); |
| 13006 |
return "<stc>\\tp%c0, CR%c1, %2"; |
| 13007 |
} |
| 13008 |
[(set_attr "length" "4") |
| 13009 |
(set_attr "type" "coproc")]) |
| 13010 |
|
| 13011 |
(define_expand "arm_<ldc>" |
| 13012 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand") |
| 13013 |
(match_operand:SI 1 "immediate_operand") |
| 13014 |
(mem:SI (match_operand:SI 2 "s_register_operand"))] LDCI)] |
| 13015 |
"arm_coproc_builtin_available (VUNSPEC_<LDC>)") |
| 13016 |
|
| 13017 |
(define_expand "arm_<stc>" |
| 13018 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand") |
| 13019 |
(match_operand:SI 1 "immediate_operand") |
| 13020 |
(mem:SI (match_operand:SI 2 "s_register_operand"))] STCI)] |
| 13021 |
"arm_coproc_builtin_available (VUNSPEC_<STC>)") |
| 13022 |
|
| 13023 |
(define_insn "arm_<mcr>" |
| 13024 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand" "n") |
| 13025 |
(match_operand:SI 1 "immediate_operand" "n") |
| 13026 |
(match_operand:SI 2 "s_register_operand" "r") |
| 13027 |
(match_operand:SI 3 "immediate_operand" "n") |
| 13028 |
(match_operand:SI 4 "immediate_operand" "n") |
| 13029 |
(match_operand:SI 5 "immediate_operand" "n")] MCRI) |
| 13030 |
(use (match_dup 2))] |
| 13031 |
"arm_coproc_builtin_available (VUNSPEC_<MCR>)" |
| 13032 |
{ |
| 13033 |
arm_const_bounds (operands[0], 0, 16); |
| 13034 |
arm_const_bounds (operands[1], 0, 8); |
| 13035 |
arm_const_bounds (operands[3], 0, (1 << 5)); |
| 13036 |
arm_const_bounds (operands[4], 0, (1 << 5)); |
| 13037 |
arm_const_bounds (operands[5], 0, 8); |
| 13038 |
return "<mcr>\\tp%c0, %1, %2, CR%c3, CR%c4, %5"; |
| 13039 |
} |
| 13040 |
[(set_attr "length" "4") |
| 13041 |
(set_attr "type" "coproc")]) |
| 13042 |
|
| 13043 |
(define_insn "arm_<mrc>" |
| 13044 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 13045 |
(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "n") |
| 13046 |
(match_operand:SI 2 "immediate_operand" "n") |
| 13047 |
(match_operand:SI 3 "immediate_operand" "n") |
| 13048 |
(match_operand:SI 4 "immediate_operand" "n") |
| 13049 |
(match_operand:SI 5 "immediate_operand" "n")] MRCI))] |
| 13050 |
"arm_coproc_builtin_available (VUNSPEC_<MRC>)" |
| 13051 |
{ |
| 13052 |
arm_const_bounds (operands[1], 0, 16); |
| 13053 |
arm_const_bounds (operands[2], 0, 8); |
| 13054 |
arm_const_bounds (operands[3], 0, (1 << 5)); |
| 13055 |
arm_const_bounds (operands[4], 0, (1 << 5)); |
| 13056 |
arm_const_bounds (operands[5], 0, 8); |
| 13057 |
return "<mrc>\\tp%c1, %2, %0, CR%c3, CR%c4, %5"; |
| 13058 |
} |
| 13059 |
[(set_attr "length" "4") |
| 13060 |
(set_attr "type" "coproc")]) |
| 13061 |
|
| 13062 |
(define_insn "arm_<mcrr>" |
| 13063 |
[(unspec_volatile [(match_operand:SI 0 "immediate_operand" "n") |
| 13064 |
(match_operand:SI 1 "immediate_operand" "n") |
| 13065 |
(match_operand:DI 2 "s_register_operand" "r") |
| 13066 |
(match_operand:SI 3 "immediate_operand" "n")] MCRRI) |
| 13067 |
(use (match_dup 2))] |
| 13068 |
"arm_coproc_builtin_available (VUNSPEC_<MCRR>)" |
| 13069 |
{ |
| 13070 |
arm_const_bounds (operands[0], 0, 16); |
| 13071 |
arm_const_bounds (operands[1], 0, 16); |
| 13072 |
arm_const_bounds (operands[3], 0, (1 << 5)); |
| 13073 |
return "<mcrr>\\tp%c0, %1, %Q2, %R2, CR%c3"; |
| 13074 |
} |
| 13075 |
[(set_attr "length" "4") |
| 13076 |
(set_attr "type" "coproc")]) |
| 13077 |
|
| 13078 |
(define_insn "arm_<mrrc>" |
| 13079 |
[(set (match_operand:DI 0 "s_register_operand" "=r") |
| 13080 |
(unspec_volatile:DI [(match_operand:SI 1 "immediate_operand" "n") |
| 13081 |
(match_operand:SI 2 "immediate_operand" "n") |
| 13082 |
(match_operand:SI 3 "immediate_operand" "n")] MRRCI))] |
| 13083 |
"arm_coproc_builtin_available (VUNSPEC_<MRRC>)" |
| 13084 |
{ |
| 13085 |
arm_const_bounds (operands[1], 0, 16); |
| 13086 |
arm_const_bounds (operands[2], 0, 16); |
| 13087 |
arm_const_bounds (operands[3], 0, (1 << 5)); |
| 13088 |
return "<mrrc>\\tp%c1, %2, %Q0, %R0, CR%c3"; |
| 13089 |
} |
| 13090 |
[(set_attr "length" "4") |
| 13091 |
(set_attr "type" "coproc")]) |
| 13092 |
|
| 13093 |
(define_expand "speculation_barrier" |
| 13094 |
[(unspec_volatile [(const_int 0)] VUNSPEC_SPECULATION_BARRIER)] |
| 13095 |
"TARGET_EITHER" |
| 13096 |
" |
| 13097 |
/* For thumb1 (except Armv8 derivatives), and for pre-Armv7 we don't |
| 13098 |
have a usable barrier (and probably don't need one in practice). |
| 13099 |
But to be safe if such code is run on later architectures, call a |
| 13100 |
helper function in libgcc that will do the thing for the active |
| 13101 |
system. */ |
| 13102 |
if (!(arm_arch7 || arm_arch8)) |
| 13103 |
{ |
| 13104 |
arm_emit_speculation_barrier_function (); |
| 13105 |
DONE; |
| 13106 |
} |
| 13107 |
" |
| 13108 |
) |
| 13109 |
|
| 13110 |
;; Generate a hard speculation barrier when we have not enabled speculation |
| 13111 |
;; tracking. |
| 13112 |
(define_insn "*speculation_barrier_insn" |
| 13113 |
[(unspec_volatile [(const_int 0)] VUNSPEC_SPECULATION_BARRIER)] |
| 13114 |
"arm_arch7 || arm_arch8" |
| 13115 |
"isb\;dsb\\tsy" |
| 13116 |
[(set_attr "type" "block") |
| 13117 |
(set_attr "length" "8")] |
| 13118 |
) |
| 13119 |
|
| 13120 |
(define_insn "pac_nop" |
| 13121 |
[(set (reg:SI IP_REGNUM) |
| 13122 |
(unspec:SI [(reg:SI SP_REGNUM) (reg:SI LR_REGNUM)] |
| 13123 |
UNSPEC_PAC_NOP))] |
| 13124 |
"arm_arch8m_main" |
| 13125 |
"pac\t%|ip, %|lr, %|sp" |
| 13126 |
[(set_attr "conds" "unconditional")]) |
| 13127 |
|
| 13128 |
(define_insn "pacbti_nop" |
| 13129 |
[(set (reg:SI IP_REGNUM) |
| 13130 |
(unspec_volatile:SI [(reg:SI SP_REGNUM) (reg:SI LR_REGNUM)] |
| 13131 |
VUNSPEC_PACBTI_NOP))] |
| 13132 |
"arm_arch8m_main" |
| 13133 |
"pacbti\t%|ip, %|lr, %|sp" |
| 13134 |
[(set_attr "conds" "unconditional")]) |
| 13135 |
|
| 13136 |
(define_insn "aut_nop" |
| 13137 |
[(unspec_volatile:SI [(reg:SI IP_REGNUM) (reg:SI SP_REGNUM) (reg:SI LR_REGNUM)] |
| 13138 |
VUNSPEC_AUT_NOP)] |
| 13139 |
"arm_arch8m_main" |
| 13140 |
"aut\t%|ip, %|lr, %|sp" |
| 13141 |
[(set_attr "conds" "unconditional")]) |
| 13142 |
|
| 13143 |
(define_insn "bti_nop" |
| 13144 |
[(unspec_volatile [(const_int 0)] VUNSPEC_BTI_NOP)] |
| 13145 |
"arm_arch8m_main" |
| 13146 |
"bti" |
| 13147 |
[(set_attr "conds" "unconditional") |
| 13148 |
(set_attr "type" "nop")]) |
| 13149 |
|
| 13150 |
;; Vector bits common to IWMMXT, Neon and MVE |
| 13151 |
(include "vec-common.md") |
| 13152 |
;; Load the Intel Wireless Multimedia Extension patterns |
| 13153 |
(include "iwmmxt.md") |
| 13154 |
;; Load the VFP co-processor patterns |
| 13155 |
(include "vfp.md") |
| 13156 |
;; Thumb-1 patterns |
| 13157 |
(include "thumb1.md") |
| 13158 |
;; Thumb-2 patterns |
| 13159 |
(include "thumb2.md") |
| 13160 |
;; Neon patterns |
| 13161 |
(include "neon.md") |
| 13162 |
;; Crypto patterns |
| 13163 |
(include "crypto.md") |
| 13164 |
;; Synchronization Primitives |
| 13165 |
(include "sync.md") |
| 13166 |
;; Fixed-point patterns |
| 13167 |
(include "arm-fixed.md") |
| 13168 |
;; M-profile Vector Extension |
| 13169 |
(include "mve.md") |