| 1 |
;; GCC machine description for IA-32 and x86-64. |
| 2 |
;; Copyright (C) 1988-2025 Free Software Foundation, Inc. |
| 3 |
;; Mostly by William Schelter. |
| 4 |
;; x86_64 support added by Jan Hubicka |
| 5 |
;; |
| 6 |
;; This file is part of GCC. |
| 7 |
;; |
| 8 |
;; GCC is free software; you can redistribute it and/or modify |
| 9 |
;; it under the terms of the GNU General Public License as published by |
| 10 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 11 |
;; any later version. |
| 12 |
;; |
| 13 |
;; GCC is distributed in the hope that it will be useful, |
| 14 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
;; GNU General Public License for more details. |
| 17 |
;; |
| 18 |
;; You should have received a copy of the GNU General Public License |
| 19 |
;; along with GCC; see the file COPYING3. If not see |
| 20 |
;; <http://www.gnu.org/licenses/>. */ |
| 21 |
;; |
| 22 |
;; The original PO technology requires these to be ordered by speed, |
| 23 |
;; so that assigner will pick the fastest. |
| 24 |
;; |
| 25 |
;; See file "rtl.def" for documentation on define_insn, match_*, et. al. |
| 26 |
;; |
| 27 |
;; The special asm out single letter directives following a '%' are: |
| 28 |
;; L,W,B,Q,S,T -- print the opcode suffix for specified size of operand. |
| 29 |
;; C -- print opcode suffix for set/cmov insn. |
| 30 |
;; c -- like C, but print reversed condition |
| 31 |
;; F,f -- likewise, but for floating-point. |
| 32 |
;; O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.", |
| 33 |
;; otherwise nothing |
| 34 |
;; R -- print the prefix for register names. |
| 35 |
;; z -- print the opcode suffix for the size of the current operand. |
| 36 |
;; Z -- likewise, with special suffixes for x87 instructions. |
| 37 |
;; * -- print a star (in certain assembler syntax) |
| 38 |
;; A -- print an absolute memory reference. |
| 39 |
;; E -- print address with DImode register names if TARGET_64BIT. |
| 40 |
;; w -- print the operand as if it's a "word" (HImode) even if it isn't. |
| 41 |
;; s -- print a shift double count, followed by the assemblers argument |
| 42 |
;; delimiter. |
| 43 |
;; b -- print the QImode name of the register for the indicated operand. |
| 44 |
;; %b0 would print %al if operands[0] is reg 0. |
| 45 |
;; w -- likewise, print the HImode name of the register. |
| 46 |
;; k -- likewise, print the SImode name of the register. |
| 47 |
;; q -- likewise, print the DImode name of the register. |
| 48 |
;; x -- likewise, print the V4SFmode name of the register. |
| 49 |
;; t -- likewise, print the V8SFmode name of the register. |
| 50 |
;; h -- print the QImode name for a "high" register, either ah, bh, ch or dh. |
| 51 |
;; y -- print "st(0)" instead of "st" as a register. |
| 52 |
;; d -- print duplicated register operand for AVX instruction. |
| 53 |
;; D -- print condition for SSE cmp instruction. |
| 54 |
;; P -- if PIC, print an @PLT suffix. |
| 55 |
;; p -- print raw symbol name. |
| 56 |
;; X -- don't print any sort of PIC '@' suffix for a symbol. |
| 57 |
;; & -- print some in-use local-dynamic symbol name. |
| 58 |
;; H -- print a memory address offset by 8; used for sse high-parts |
| 59 |
;; K -- print HLE lock prefix |
| 60 |
;; Y -- print condition for XOP pcom* instruction. |
| 61 |
;; + -- print a branch hint as 'cs' or 'ds' prefix |
| 62 |
;; ; -- print a semicolon (after prefixes due to bug in older gas). |
| 63 |
;; ~ -- print "i" if TARGET_AVX2, "f" otherwise. |
| 64 |
;; ^ -- print addr32 prefix if TARGET_64BIT and Pmode != word_mode |
| 65 |
;; ! -- print NOTRACK prefix for jxx/call/ret instructions if required. |
| 66 |
|
| 67 |
(define_c_enum "unspec" [ |
| 68 |
;; Relocation specifiers |
| 69 |
UNSPEC_GOT |
| 70 |
UNSPEC_GOTOFF |
| 71 |
UNSPEC_GOTPCREL |
| 72 |
UNSPEC_GOTTPOFF |
| 73 |
UNSPEC_TPOFF |
| 74 |
UNSPEC_NTPOFF |
| 75 |
UNSPEC_DTPOFF |
| 76 |
UNSPEC_GOTNTPOFF |
| 77 |
UNSPEC_INDNTPOFF |
| 78 |
UNSPEC_PLTOFF |
| 79 |
UNSPEC_MACHOPIC_OFFSET |
| 80 |
UNSPEC_PCREL |
| 81 |
UNSPEC_SIZEOF |
| 82 |
|
| 83 |
;; Prologue support |
| 84 |
UNSPEC_STACK_ALLOC |
| 85 |
UNSPEC_SET_GOT |
| 86 |
UNSPEC_SET_RIP |
| 87 |
UNSPEC_SET_GOT_OFFSET |
| 88 |
UNSPEC_MEMORY_BLOCKAGE |
| 89 |
UNSPEC_PROBE_STACK |
| 90 |
|
| 91 |
;; TLS support |
| 92 |
UNSPEC_TP |
| 93 |
UNSPEC_TLS_GD |
| 94 |
UNSPEC_TLS_LD_BASE |
| 95 |
UNSPEC_TLSDESC |
| 96 |
|
| 97 |
;; Other random patterns |
| 98 |
UNSPEC_SCAS |
| 99 |
UNSPEC_FNSTSW |
| 100 |
UNSPEC_SAHF |
| 101 |
UNSPEC_NOTRAP |
| 102 |
UNSPEC_PARITY |
| 103 |
UNSPEC_FSTCW |
| 104 |
UNSPEC_REP |
| 105 |
UNSPEC_LD_MPIC ; load_macho_picbase |
| 106 |
UNSPEC_TRUNC_NOOP |
| 107 |
UNSPEC_DIV_ALREADY_SPLIT |
| 108 |
UNSPEC_PAUSE |
| 109 |
UNSPEC_LEA_ADDR |
| 110 |
UNSPEC_XBEGIN_ABORT |
| 111 |
UNSPEC_STOS |
| 112 |
UNSPEC_PEEPSIB |
| 113 |
UNSPEC_INSN_FALSE_DEP |
| 114 |
UNSPEC_SBB |
| 115 |
UNSPEC_CC_NE |
| 116 |
UNSPEC_STC |
| 117 |
UNSPEC_PUSHFL |
| 118 |
UNSPEC_POPFL |
| 119 |
UNSPEC_OPTCOMX |
| 120 |
UNSPEC_SETCC_SI_SLP |
| 121 |
|
| 122 |
;; For SSE/MMX support: |
| 123 |
UNSPEC_FIX_NOTRUNC |
| 124 |
UNSPEC_MASKMOV |
| 125 |
UNSPEC_MOVCC_MASK |
| 126 |
UNSPEC_MOVMSK |
| 127 |
UNSPEC_INSERTPS |
| 128 |
UNSPEC_BLENDV |
| 129 |
UNSPEC_PSHUFB |
| 130 |
UNSPEC_XOP_PERMUTE |
| 131 |
UNSPEC_RCP |
| 132 |
UNSPEC_RSQRT |
| 133 |
UNSPEC_PSADBW |
| 134 |
|
| 135 |
;; Different from generic us_truncate RTX |
| 136 |
;; as it does unsigned saturation of signed source. |
| 137 |
UNSPEC_US_TRUNCATE |
| 138 |
|
| 139 |
;; For AVX/AVX512F support |
| 140 |
UNSPEC_SCALEF |
| 141 |
UNSPEC_PCMP |
| 142 |
UNSPEC_CVTBFSF |
| 143 |
UNSPEC_COMX |
| 144 |
|
| 145 |
;; Generic math support |
| 146 |
UNSPEC_IEEE_MIN ; not commutative |
| 147 |
UNSPEC_IEEE_MAX ; not commutative |
| 148 |
|
| 149 |
;; x87 Floating point |
| 150 |
UNSPEC_SIN |
| 151 |
UNSPEC_COS |
| 152 |
UNSPEC_FPATAN |
| 153 |
UNSPEC_FYL2X |
| 154 |
UNSPEC_FYL2XP1 |
| 155 |
UNSPEC_FRNDINT |
| 156 |
UNSPEC_FIST |
| 157 |
UNSPEC_F2XM1 |
| 158 |
UNSPEC_TAN |
| 159 |
UNSPEC_FXAM |
| 160 |
|
| 161 |
;; x87 Rounding |
| 162 |
UNSPEC_FRNDINT_ROUNDEVEN |
| 163 |
UNSPEC_FRNDINT_FLOOR |
| 164 |
UNSPEC_FRNDINT_CEIL |
| 165 |
UNSPEC_FRNDINT_TRUNC |
| 166 |
UNSPEC_FIST_FLOOR |
| 167 |
UNSPEC_FIST_CEIL |
| 168 |
|
| 169 |
;; x87 Double output FP |
| 170 |
UNSPEC_SINCOS_COS |
| 171 |
UNSPEC_SINCOS_SIN |
| 172 |
UNSPEC_XTRACT_FRACT |
| 173 |
UNSPEC_XTRACT_EXP |
| 174 |
UNSPEC_FSCALE_FRACT |
| 175 |
UNSPEC_FSCALE_EXP |
| 176 |
UNSPEC_FPREM_F |
| 177 |
UNSPEC_FPREM_U |
| 178 |
UNSPEC_FPREM1_F |
| 179 |
UNSPEC_FPREM1_U |
| 180 |
|
| 181 |
UNSPEC_C2_FLAG |
| 182 |
UNSPEC_FXAM_MEM |
| 183 |
|
| 184 |
;; SSP patterns |
| 185 |
UNSPEC_SP_SET |
| 186 |
UNSPEC_SP_TEST |
| 187 |
|
| 188 |
;; For ROUND support |
| 189 |
UNSPEC_ROUND |
| 190 |
|
| 191 |
;; For CRC32 support |
| 192 |
UNSPEC_CRC32 |
| 193 |
|
| 194 |
;; For LZCNT suppoprt |
| 195 |
UNSPEC_LZCNT |
| 196 |
|
| 197 |
;; For BMI support |
| 198 |
UNSPEC_TZCNT |
| 199 |
UNSPEC_BEXTR |
| 200 |
|
| 201 |
;; For BMI2 support |
| 202 |
UNSPEC_PDEP |
| 203 |
UNSPEC_PEXT |
| 204 |
|
| 205 |
;; IRET support |
| 206 |
UNSPEC_INTERRUPT_RETURN |
| 207 |
|
| 208 |
;; For MOVDIRI and MOVDIR64B support |
| 209 |
UNSPEC_MOVDIRI |
| 210 |
UNSPEC_MOVDIR64B |
| 211 |
|
| 212 |
;; For insn_callee_abi: |
| 213 |
UNSPEC_CALLEE_ABI |
| 214 |
|
| 215 |
;; For APX PUSH2/POP2 support |
| 216 |
UNSPEC_APXPUSH2 |
| 217 |
UNSPEC_APXPOP2_LOW |
| 218 |
UNSPEC_APXPOP2_HIGH |
| 219 |
|
| 220 |
;; For APX PPX support |
| 221 |
UNSPEC_APX_PPX |
| 222 |
|
| 223 |
;; For APX CCMP support |
| 224 |
;; DFV = default flag value |
| 225 |
UNSPEC_APX_DFV |
| 226 |
]) |
| 227 |
|
| 228 |
(define_c_enum "unspecv" [ |
| 229 |
UNSPECV_UD2 |
| 230 |
UNSPECV_BLOCKAGE |
| 231 |
UNSPECV_STACK_PROBE |
| 232 |
UNSPECV_PROBE_STACK_RANGE |
| 233 |
UNSPECV_ALIGN |
| 234 |
UNSPECV_PROLOGUE_USE |
| 235 |
UNSPECV_SPLIT_STACK_RETURN |
| 236 |
UNSPECV_CLD |
| 237 |
UNSPECV_NOPS |
| 238 |
UNSPECV_RDTSC |
| 239 |
UNSPECV_RDTSCP |
| 240 |
UNSPECV_RDPMC |
| 241 |
UNSPECV_LLWP_INTRINSIC |
| 242 |
UNSPECV_SLWP_INTRINSIC |
| 243 |
UNSPECV_LWPVAL_INTRINSIC |
| 244 |
UNSPECV_LWPINS_INTRINSIC |
| 245 |
UNSPECV_RDFSBASE |
| 246 |
UNSPECV_RDGSBASE |
| 247 |
UNSPECV_WRFSBASE |
| 248 |
UNSPECV_WRGSBASE |
| 249 |
UNSPECV_FXSAVE |
| 250 |
UNSPECV_FXRSTOR |
| 251 |
UNSPECV_FXSAVE64 |
| 252 |
UNSPECV_FXRSTOR64 |
| 253 |
UNSPECV_XSAVE |
| 254 |
UNSPECV_XRSTOR |
| 255 |
UNSPECV_XSAVE64 |
| 256 |
UNSPECV_XRSTOR64 |
| 257 |
UNSPECV_XSAVEOPT |
| 258 |
UNSPECV_XSAVEOPT64 |
| 259 |
UNSPECV_XSAVES |
| 260 |
UNSPECV_XRSTORS |
| 261 |
UNSPECV_XSAVES64 |
| 262 |
UNSPECV_XRSTORS64 |
| 263 |
UNSPECV_XSAVEC |
| 264 |
UNSPECV_XSAVEC64 |
| 265 |
UNSPECV_XGETBV |
| 266 |
UNSPECV_XSETBV |
| 267 |
UNSPECV_WBINVD |
| 268 |
UNSPECV_WBNOINVD |
| 269 |
|
| 270 |
;; For atomic compound assignments. |
| 271 |
UNSPECV_FNSTENV |
| 272 |
UNSPECV_FLDENV |
| 273 |
UNSPECV_FNSTSW |
| 274 |
UNSPECV_FNCLEX |
| 275 |
|
| 276 |
;; For RDRAND support |
| 277 |
UNSPECV_RDRAND |
| 278 |
|
| 279 |
;; For RDSEED support |
| 280 |
UNSPECV_RDSEED |
| 281 |
|
| 282 |
;; For RTM support |
| 283 |
UNSPECV_XBEGIN |
| 284 |
UNSPECV_XEND |
| 285 |
UNSPECV_XABORT |
| 286 |
UNSPECV_XTEST |
| 287 |
|
| 288 |
UNSPECV_NLGR |
| 289 |
|
| 290 |
;; For CLWB support |
| 291 |
UNSPECV_CLWB |
| 292 |
|
| 293 |
;; For CLFLUSHOPT support |
| 294 |
UNSPECV_CLFLUSHOPT |
| 295 |
|
| 296 |
;; For MONITORX and MWAITX support |
| 297 |
UNSPECV_MONITORX |
| 298 |
UNSPECV_MWAITX |
| 299 |
|
| 300 |
;; For CLZERO support |
| 301 |
UNSPECV_CLZERO |
| 302 |
|
| 303 |
;; For RDPKRU and WRPKRU support |
| 304 |
UNSPECV_PKU |
| 305 |
|
| 306 |
;; For RDPID support |
| 307 |
UNSPECV_RDPID |
| 308 |
|
| 309 |
;; For CET support |
| 310 |
UNSPECV_NOP_ENDBR |
| 311 |
UNSPECV_NOP_RDSSP |
| 312 |
UNSPECV_INCSSP |
| 313 |
UNSPECV_SAVEPREVSSP |
| 314 |
UNSPECV_RSTORSSP |
| 315 |
UNSPECV_WRSS |
| 316 |
UNSPECV_WRUSS |
| 317 |
UNSPECV_SETSSBSY |
| 318 |
UNSPECV_CLRSSBSY |
| 319 |
|
| 320 |
;; For TSXLDTRK support |
| 321 |
UNSPECV_XSUSLDTRK |
| 322 |
UNSPECV_XRESLDTRK |
| 323 |
|
| 324 |
;; For WAITPKG support |
| 325 |
UNSPECV_UMWAIT |
| 326 |
UNSPECV_UMONITOR |
| 327 |
UNSPECV_TPAUSE |
| 328 |
|
| 329 |
;; For UINTR support |
| 330 |
UNSPECV_CLUI |
| 331 |
UNSPECV_STUI |
| 332 |
UNSPECV_TESTUI |
| 333 |
UNSPECV_SENDUIPI |
| 334 |
|
| 335 |
;; For CLDEMOTE support |
| 336 |
UNSPECV_CLDEMOTE |
| 337 |
|
| 338 |
;; For Speculation Barrier support |
| 339 |
UNSPECV_SPECULATION_BARRIER |
| 340 |
|
| 341 |
UNSPECV_PTWRITE |
| 342 |
|
| 343 |
;; For ENQCMD and ENQCMDS support |
| 344 |
UNSPECV_ENQCMD |
| 345 |
UNSPECV_ENQCMDS |
| 346 |
|
| 347 |
;; For SERIALIZE support |
| 348 |
UNSPECV_SERIALIZE |
| 349 |
|
| 350 |
;; For patchable area support |
| 351 |
UNSPECV_PATCHABLE_AREA |
| 352 |
|
| 353 |
;; For HRESET support |
| 354 |
UNSPECV_HRESET |
| 355 |
|
| 356 |
;; For PREFETCHI support |
| 357 |
UNSPECV_PREFETCHI |
| 358 |
|
| 359 |
;; For USER_MSR support |
| 360 |
UNSPECV_URDMSR |
| 361 |
UNSPECV_UWRMSR |
| 362 |
|
| 363 |
;; For AMX-TILE |
| 364 |
UNSPECV_LDTILECFG |
| 365 |
UNSPECV_STTILECFG |
| 366 |
|
| 367 |
;; For MOVRS support |
| 368 |
UNSPECV_MOVRS |
| 369 |
]) |
| 370 |
|
| 371 |
;; Constants to represent rounding modes in the ROUND instruction |
| 372 |
(define_constants |
| 373 |
[(ROUND_ROUNDEVEN 0x0) |
| 374 |
(ROUND_FLOOR 0x1) |
| 375 |
(ROUND_CEIL 0x2) |
| 376 |
(ROUND_TRUNC 0x3) |
| 377 |
(ROUND_MXCSR 0x4) |
| 378 |
(ROUND_NO_EXC 0x8) |
| 379 |
]) |
| 380 |
|
| 381 |
;; Constants to represent AVX512F embeded rounding |
| 382 |
(define_constants |
| 383 |
[(ROUND_NEAREST_INT 0) |
| 384 |
(ROUND_NEG_INF 1) |
| 385 |
(ROUND_POS_INF 2) |
| 386 |
(ROUND_ZERO 3) |
| 387 |
(NO_ROUND 4) |
| 388 |
(ROUND_SAE 8) |
| 389 |
]) |
| 390 |
|
| 391 |
;; Constants to represent pcomtrue/pcomfalse variants |
| 392 |
(define_constants |
| 393 |
[(PCOM_FALSE 0) |
| 394 |
(PCOM_TRUE 1) |
| 395 |
(COM_FALSE_S 2) |
| 396 |
(COM_FALSE_P 3) |
| 397 |
(COM_TRUE_S 4) |
| 398 |
(COM_TRUE_P 5) |
| 399 |
]) |
| 400 |
|
| 401 |
;; Constants used in the XOP pperm instruction |
| 402 |
(define_constants |
| 403 |
[(PPERM_SRC 0x00) /* copy source */ |
| 404 |
(PPERM_INVERT 0x20) /* invert source */ |
| 405 |
(PPERM_REVERSE 0x40) /* bit reverse source */ |
| 406 |
(PPERM_REV_INV 0x60) /* bit reverse & invert src */ |
| 407 |
(PPERM_ZERO 0x80) /* all 0's */ |
| 408 |
(PPERM_ONES 0xa0) /* all 1's */ |
| 409 |
(PPERM_SIGN 0xc0) /* propagate sign bit */ |
| 410 |
(PPERM_INV_SIGN 0xe0) /* invert & propagate sign */ |
| 411 |
(PPERM_SRC1 0x00) /* use first source byte */ |
| 412 |
(PPERM_SRC2 0x10) /* use second source byte */ |
| 413 |
]) |
| 414 |
|
| 415 |
;; Registers by name. |
| 416 |
(define_constants |
| 417 |
[(AX_REG 0) |
| 418 |
(DX_REG 1) |
| 419 |
(CX_REG 2) |
| 420 |
(BX_REG 3) |
| 421 |
(SI_REG 4) |
| 422 |
(DI_REG 5) |
| 423 |
(BP_REG 6) |
| 424 |
(SP_REG 7) |
| 425 |
(ST0_REG 8) |
| 426 |
(ST1_REG 9) |
| 427 |
(ST2_REG 10) |
| 428 |
(ST3_REG 11) |
| 429 |
(ST4_REG 12) |
| 430 |
(ST5_REG 13) |
| 431 |
(ST6_REG 14) |
| 432 |
(ST7_REG 15) |
| 433 |
(ARGP_REG 16) |
| 434 |
(FLAGS_REG 17) |
| 435 |
(FPSR_REG 18) |
| 436 |
(FRAME_REG 19) |
| 437 |
(XMM0_REG 20) |
| 438 |
(XMM1_REG 21) |
| 439 |
(XMM2_REG 22) |
| 440 |
(XMM3_REG 23) |
| 441 |
(XMM4_REG 24) |
| 442 |
(XMM5_REG 25) |
| 443 |
(XMM6_REG 26) |
| 444 |
(XMM7_REG 27) |
| 445 |
(MM0_REG 28) |
| 446 |
(MM1_REG 29) |
| 447 |
(MM2_REG 30) |
| 448 |
(MM3_REG 31) |
| 449 |
(MM4_REG 32) |
| 450 |
(MM5_REG 33) |
| 451 |
(MM6_REG 34) |
| 452 |
(MM7_REG 35) |
| 453 |
(R8_REG 36) |
| 454 |
(R9_REG 37) |
| 455 |
(R10_REG 38) |
| 456 |
(R11_REG 39) |
| 457 |
(R12_REG 40) |
| 458 |
(R13_REG 41) |
| 459 |
(R14_REG 42) |
| 460 |
(R15_REG 43) |
| 461 |
(XMM8_REG 44) |
| 462 |
(XMM9_REG 45) |
| 463 |
(XMM10_REG 46) |
| 464 |
(XMM11_REG 47) |
| 465 |
(XMM12_REG 48) |
| 466 |
(XMM13_REG 49) |
| 467 |
(XMM14_REG 50) |
| 468 |
(XMM15_REG 51) |
| 469 |
(XMM16_REG 52) |
| 470 |
(XMM17_REG 53) |
| 471 |
(XMM18_REG 54) |
| 472 |
(XMM19_REG 55) |
| 473 |
(XMM20_REG 56) |
| 474 |
(XMM21_REG 57) |
| 475 |
(XMM22_REG 58) |
| 476 |
(XMM23_REG 59) |
| 477 |
(XMM24_REG 60) |
| 478 |
(XMM25_REG 61) |
| 479 |
(XMM26_REG 62) |
| 480 |
(XMM27_REG 63) |
| 481 |
(XMM28_REG 64) |
| 482 |
(XMM29_REG 65) |
| 483 |
(XMM30_REG 66) |
| 484 |
(XMM31_REG 67) |
| 485 |
(MASK0_REG 68) |
| 486 |
(MASK1_REG 69) |
| 487 |
(MASK2_REG 70) |
| 488 |
(MASK3_REG 71) |
| 489 |
(MASK4_REG 72) |
| 490 |
(MASK5_REG 73) |
| 491 |
(MASK6_REG 74) |
| 492 |
(MASK7_REG 75) |
| 493 |
(R16_REG 76) |
| 494 |
(R17_REG 77) |
| 495 |
(R18_REG 78) |
| 496 |
(R19_REG 79) |
| 497 |
(R20_REG 80) |
| 498 |
(R21_REG 81) |
| 499 |
(R22_REG 82) |
| 500 |
(R23_REG 83) |
| 501 |
(R24_REG 84) |
| 502 |
(R25_REG 85) |
| 503 |
(R26_REG 86) |
| 504 |
(R27_REG 87) |
| 505 |
(R28_REG 88) |
| 506 |
(R29_REG 89) |
| 507 |
(R30_REG 90) |
| 508 |
(R31_REG 91) |
| 509 |
(FIRST_PSEUDO_REG 92) |
| 510 |
]) |
| 511 |
|
| 512 |
;; Insn callee abi index. |
| 513 |
(define_constants |
| 514 |
[(ABI_DEFAULT 0) |
| 515 |
(ABI_VZEROUPPER 1) |
| 516 |
(ABI_UNKNOWN 2)]) |
| 517 |
|
| 518 |
;; Insns whose names begin with "x86_" are emitted by gen_FOO calls |
| 519 |
;; from i386.cc. |
| 520 |
|
| 521 |
;; In C guard expressions, put expressions which may be compile-time |
| 522 |
;; constants first. This allows for better optimization. For |
| 523 |
;; example, write "TARGET_64BIT && reload_completed", not |
| 524 |
;; "reload_completed && TARGET_64BIT". |
| 525 |
|
| 526 |
|
| 527 |
;; Processor type. |
| 528 |
(define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,nehalem, |
| 529 |
atom,slm,glm,haswell,generic,lujiazui,yongfeng,amdfam10,bdver1, |
| 530 |
bdver2,bdver3,bdver4,btver2,znver1,znver2,znver3,znver4, |
| 531 |
znver5,c86_4g_m4,c86_4g_m6,c86_4g_m7" |
| 532 |
(const (symbol_ref "ix86_schedule"))) |
| 533 |
|
| 534 |
;; A basic instruction type. Refinements due to arguments to be |
| 535 |
;; provided in other attributes. |
| 536 |
(define_attr "type" |
| 537 |
"other,multi, |
| 538 |
alu,alu1,negnot,imov,imovx,lea, |
| 539 |
incdec,ishift,ishiftx,ishift1,rotate,rotatex,rotate1, |
| 540 |
imul,imulx,idiv,icmp,test,ibr,setcc,icmov, |
| 541 |
push,pop,call,callv,leave, |
| 542 |
str,bitmanip, |
| 543 |
fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp, |
| 544 |
fxch,fistp,fisttp,frndint, |
| 545 |
sse,ssemov,ssemov2,sseadd,sseadd1,sseiadd,sseiadd1, |
| 546 |
ssemul,sseimul,ssediv,sselog,sselog1, |
| 547 |
sseishft,sseishft1,ssecmp,ssecomi, |
| 548 |
ssecvt,ssecvt1,sseicvt,sseicvt2,sseins, |
| 549 |
sseshuf,sseshuf1,ssemuladd,sse4arg, |
| 550 |
lwp,mskmov,msklog, |
| 551 |
mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft" |
| 552 |
(const_string "other")) |
| 553 |
|
| 554 |
;; Main data type used by the insn |
| 555 |
(define_attr "mode" |
| 556 |
"unknown,none,QI,HI,SI,DI,TI,OI,XI,HF,BF,SF,DF,XF,TF, |
| 557 |
V32HF,V16HF,V8HF,V4HF,V2HF,V32BF,V16BF,V8BF,V4BF,V2BF, |
| 558 |
V16SF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF,V8DF" |
| 559 |
(const_string "unknown")) |
| 560 |
|
| 561 |
;; The CPU unit operations uses. |
| 562 |
(define_attr "unit" "integer,i387,sse,mmx,unknown" |
| 563 |
(cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp, |
| 564 |
fxch,fistp,fisttp,frndint") |
| 565 |
(const_string "i387") |
| 566 |
(eq_attr "type" "sse,ssemov,ssemov2,sseadd,sseadd1,sseiadd,sseiadd1, |
| 567 |
ssemul,sseimul,ssediv,sselog,sselog1, |
| 568 |
sseishft,sseishft1,ssecmp,ssecomi, |
| 569 |
ssecvt,ssecvt1,sseicvt,sseicvt2,sseins, |
| 570 |
sseshuf,sseshuf1,ssemuladd,sse4arg,mskmov") |
| 571 |
(const_string "sse") |
| 572 |
(eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft") |
| 573 |
(const_string "mmx") |
| 574 |
(eq_attr "type" "other") |
| 575 |
(const_string "unknown")] |
| 576 |
(const_string "integer"))) |
| 577 |
|
| 578 |
;; Used to control the "enabled" attribute on a per-instruction basis. |
| 579 |
(define_attr "isa" "base,x64,nox64,x64_sse2,x64_sse4,x64_sse4_noavx, |
| 580 |
x64_avx,x64_avx512bw,x64_avx512dq,apx_ndd,apx_ndd_64, |
| 581 |
sse_noavx,sse2,sse2_noavx,sse3,sse3_noavx,sse4,sse4_noavx, |
| 582 |
avx,noavx,avx2,noavx2,bmi,bmi2,fma4,fma,avx512f,avx512f_512, |
| 583 |
noavx512f,avx512bw,avx512bw_512,noavx512bw,avx512dq, |
| 584 |
noavx512dq,fma_or_avx512vl,avx512vl,noavx512vl,avxvnni, |
| 585 |
avx512vnnivl,avx512fp16,avxifma,avx512ifmavl,avxneconvert, |
| 586 |
avx512bf16vl,vpclmulqdqvl,avx_noavx512f,avx_noavx512vl, |
| 587 |
vaes_avx512vl,noapx_nf,avx10_2" |
| 588 |
(const_string "base")) |
| 589 |
|
| 590 |
;; The (bounding maximum) length of an instruction immediate. |
| 591 |
(define_attr "length_immediate" "" |
| 592 |
(cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave, |
| 593 |
bitmanip,imulx,msklog,mskmov") |
| 594 |
(const_int 0) |
| 595 |
(ior (eq_attr "type" "sse4arg") |
| 596 |
(eq_attr "isa" "fma4")) |
| 597 |
(const_int 1) |
| 598 |
(eq_attr "unit" "i387,sse,mmx") |
| 599 |
(const_int 0) |
| 600 |
(eq_attr "type" "alu,alu1,negnot,imovx,ishift,ishiftx,ishift1, |
| 601 |
rotate,rotatex,rotate1,imul,icmp,push,pop") |
| 602 |
(symbol_ref "ix86_attr_length_immediate_default (insn, true)") |
| 603 |
(eq_attr "type" "imov,test") |
| 604 |
(symbol_ref "ix86_attr_length_immediate_default (insn, false)") |
| 605 |
(eq_attr "type" "call") |
| 606 |
(if_then_else (match_operand 0 "constant_call_address_operand") |
| 607 |
(const_int 4) |
| 608 |
(const_int 0)) |
| 609 |
(eq_attr "type" "callv") |
| 610 |
(if_then_else (match_operand 1 "constant_call_address_operand") |
| 611 |
(const_int 4) |
| 612 |
(const_int 0)) |
| 613 |
;; We don't know the size before shorten_branches. Expect |
| 614 |
;; the instruction to fit for better scheduling. |
| 615 |
(eq_attr "type" "ibr") |
| 616 |
(const_int 1) |
| 617 |
] |
| 618 |
(symbol_ref "/* Update immediate_length and other attributes! */ |
| 619 |
gcc_unreachable (),1"))) |
| 620 |
|
| 621 |
;; The (bounding maximum) length of an instruction address. |
| 622 |
(define_attr "length_address" "" |
| 623 |
(cond [(eq_attr "type" "str,other,multi,fxch") |
| 624 |
(const_int 0) |
| 625 |
(and (eq_attr "type" "call") |
| 626 |
(match_operand 0 "constant_call_address_operand")) |
| 627 |
(const_int 0) |
| 628 |
(and (eq_attr "type" "callv") |
| 629 |
(match_operand 1 "constant_call_address_operand")) |
| 630 |
(const_int 0) |
| 631 |
] |
| 632 |
(symbol_ref "ix86_attr_length_address_default (insn)"))) |
| 633 |
|
| 634 |
;; Set when length prefix is used. |
| 635 |
(define_attr "prefix_data16" "" |
| 636 |
(cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1") |
| 637 |
(const_int 0) |
| 638 |
(eq_attr "mode" "HI") |
| 639 |
(const_int 1) |
| 640 |
(and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF,TI")) |
| 641 |
(const_int 1) |
| 642 |
] |
| 643 |
(const_int 0))) |
| 644 |
|
| 645 |
;; Set when string REP prefix is used. |
| 646 |
(define_attr "prefix_rep" "" |
| 647 |
(cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1") |
| 648 |
(const_int 0) |
| 649 |
(and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF")) |
| 650 |
(const_int 1) |
| 651 |
] |
| 652 |
(const_int 0))) |
| 653 |
|
| 654 |
;; Set when 0f opcode prefix is used. |
| 655 |
(define_attr "prefix_0f" "" |
| 656 |
(if_then_else |
| 657 |
(ior (eq_attr "type" "imovx,setcc,icmov,bitmanip,msklog,mskmov") |
| 658 |
(eq_attr "unit" "sse,mmx")) |
| 659 |
(const_int 1) |
| 660 |
(const_int 0))) |
| 661 |
|
| 662 |
;; Set when REX opcode prefix is used. |
| 663 |
(define_attr "prefix_rex" "" |
| 664 |
(cond [(not (match_test "TARGET_64BIT")) |
| 665 |
(const_int 0) |
| 666 |
(and (eq_attr "mode" "DI") |
| 667 |
(and (eq_attr "type" "!push,pop,call,callv,leave,ibr") |
| 668 |
(eq_attr "unit" "!mmx"))) |
| 669 |
(const_int 1) |
| 670 |
(and (eq_attr "mode" "QI") |
| 671 |
(match_test "x86_extended_QIreg_mentioned_p (insn)")) |
| 672 |
(const_int 1) |
| 673 |
(match_test "x86_extended_reg_mentioned_p (insn)") |
| 674 |
(const_int 1) |
| 675 |
(and (eq_attr "type" "imovx") |
| 676 |
(match_operand:QI 1 "ext_QIreg_operand")) |
| 677 |
(const_int 1) |
| 678 |
] |
| 679 |
(const_int 0))) |
| 680 |
|
| 681 |
;; There are also additional prefixes in 3DNOW, SSSE3. |
| 682 |
;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a. |
| 683 |
;; While generally inapplicable to VEX/XOP/EVEX encodings, "length_vex" uses |
| 684 |
;; the attribute evaluating to zero to know that VEX2 encoding may be usable. |
| 685 |
(define_attr "prefix_extra" "" |
| 686 |
(cond [(eq_attr "type" "ssemuladd,sse4arg,sseiadd1,ssecvt1") |
| 687 |
(const_int 1) |
| 688 |
] |
| 689 |
(const_int 0))) |
| 690 |
|
| 691 |
;; Prefix used: original, VEX or maybe VEX. |
| 692 |
(define_attr "prefix" "orig,vex,maybe_vex,evex,maybe_evex" |
| 693 |
(cond [(eq_attr "mode" "OI,V8SF,V4DF") |
| 694 |
(const_string "vex") |
| 695 |
(eq_attr "mode" "XI,V16SF,V8DF") |
| 696 |
(const_string "evex") |
| 697 |
(eq_attr "type" "ssemuladd") |
| 698 |
(if_then_else (eq_attr "isa" "fma4") |
| 699 |
(const_string "vex") |
| 700 |
(const_string "maybe_evex")) |
| 701 |
(eq_attr "type" "sse4arg") |
| 702 |
(const_string "vex") |
| 703 |
] |
| 704 |
(const_string "orig"))) |
| 705 |
|
| 706 |
;; VEX W bit is used. |
| 707 |
(define_attr "prefix_vex_w" "" (const_int 0)) |
| 708 |
|
| 709 |
;; The length of VEX prefix |
| 710 |
;; Only instructions with 0f prefix can have 2 byte VEX prefix, |
| 711 |
;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is |
| 712 |
;; still prefix_0f 1, with prefix_extra 1. |
| 713 |
(define_attr "length_vex" "" |
| 714 |
(if_then_else (and (eq_attr "prefix_0f" "1") |
| 715 |
(eq_attr "prefix_extra" "0")) |
| 716 |
(if_then_else (eq_attr "prefix_vex_w" "1") |
| 717 |
(symbol_ref "ix86_attr_length_vex_default (insn, true, true)") |
| 718 |
(symbol_ref "ix86_attr_length_vex_default (insn, true, false)")) |
| 719 |
(if_then_else (eq_attr "prefix_vex_w" "1") |
| 720 |
(symbol_ref "ix86_attr_length_vex_default (insn, false, true)") |
| 721 |
(symbol_ref "ix86_attr_length_vex_default (insn, false, false)")))) |
| 722 |
|
| 723 |
;; 4-bytes evex prefix and 1 byte opcode. |
| 724 |
(define_attr "length_evex" "" (const_int 5)) |
| 725 |
|
| 726 |
;; Set when modrm byte is used. |
| 727 |
(define_attr "modrm" "" |
| 728 |
(cond [(eq_attr "type" "str,leave") |
| 729 |
(const_int 0) |
| 730 |
(eq_attr "unit" "i387") |
| 731 |
(const_int 0) |
| 732 |
(and (eq_attr "type" "incdec") |
| 733 |
(and (not (match_test "TARGET_64BIT")) |
| 734 |
(ior (match_operand:SI 1 "register_operand") |
| 735 |
(match_operand:HI 1 "register_operand")))) |
| 736 |
(const_int 0) |
| 737 |
(and (eq_attr "type" "push") |
| 738 |
(not (match_operand 1 "memory_operand"))) |
| 739 |
(const_int 0) |
| 740 |
(and (eq_attr "type" "pop") |
| 741 |
(not (match_operand 0 "memory_operand"))) |
| 742 |
(const_int 0) |
| 743 |
(and (eq_attr "type" "imov") |
| 744 |
(and (not (eq_attr "mode" "DI")) |
| 745 |
(ior (and (match_operand 0 "register_operand") |
| 746 |
(match_operand 1 "immediate_operand")) |
| 747 |
(ior (and (match_operand 0 "ax_reg_operand") |
| 748 |
(match_operand 1 "memory_displacement_only_operand")) |
| 749 |
(and (match_operand 0 "memory_displacement_only_operand") |
| 750 |
(match_operand 1 "ax_reg_operand")))))) |
| 751 |
(const_int 0) |
| 752 |
(and (eq_attr "type" "call") |
| 753 |
(match_operand 0 "constant_call_address_operand")) |
| 754 |
(const_int 0) |
| 755 |
(and (eq_attr "type" "callv") |
| 756 |
(match_operand 1 "constant_call_address_operand")) |
| 757 |
(const_int 0) |
| 758 |
(and (eq_attr "type" "alu,alu1,icmp,test") |
| 759 |
(match_operand 0 "ax_reg_operand")) |
| 760 |
(symbol_ref "(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))") |
| 761 |
] |
| 762 |
(const_int 1))) |
| 763 |
|
| 764 |
;; The (bounding maximum) length of an instruction in bytes. |
| 765 |
;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences. |
| 766 |
;; Later we may want to split them and compute proper length as for |
| 767 |
;; other insns. |
| 768 |
(define_attr "length" "" |
| 769 |
(cond [(eq_attr "type" "other,multi,fistp,frndint") |
| 770 |
(const_int 16) |
| 771 |
(eq_attr "type" "fcmp") |
| 772 |
(const_int 4) |
| 773 |
(eq_attr "unit" "i387") |
| 774 |
(plus (const_int 2) |
| 775 |
(plus (attr "prefix_data16") |
| 776 |
(attr "length_address"))) |
| 777 |
(ior (eq_attr "prefix" "evex") |
| 778 |
(and (ior (eq_attr "prefix" "maybe_evex") |
| 779 |
(eq_attr "prefix" "maybe_vex")) |
| 780 |
(match_test "TARGET_AVX512F"))) |
| 781 |
(plus (attr "length_evex") |
| 782 |
(plus (attr "length_immediate") |
| 783 |
(plus (attr "modrm") |
| 784 |
(attr "length_address")))) |
| 785 |
(ior (eq_attr "prefix" "vex") |
| 786 |
(and (ior (eq_attr "prefix" "maybe_vex") |
| 787 |
(eq_attr "prefix" "maybe_evex")) |
| 788 |
(match_test "TARGET_AVX"))) |
| 789 |
(plus (attr "length_vex") |
| 790 |
(plus (attr "length_immediate") |
| 791 |
(plus (attr "modrm") |
| 792 |
(attr "length_address"))))] |
| 793 |
(plus (plus (attr "modrm") |
| 794 |
(plus (attr "prefix_0f") |
| 795 |
(plus (attr "prefix_rex") |
| 796 |
(plus (attr "prefix_extra") |
| 797 |
(const_int 1))))) |
| 798 |
(plus (attr "prefix_rep") |
| 799 |
(plus (attr "prefix_data16") |
| 800 |
(plus (attr "length_immediate") |
| 801 |
(attr "length_address"))))))) |
| 802 |
|
| 803 |
;; The `memory' attribute is `none' if no memory is referenced, `load' or |
| 804 |
;; `store' if there is a simple memory reference therein, or `unknown' |
| 805 |
;; if the instruction is complex. |
| 806 |
|
| 807 |
(define_attr "memory" "none,load,store,both,unknown" |
| 808 |
(cond [(eq_attr "type" "other,multi,str,lwp") |
| 809 |
(const_string "unknown") |
| 810 |
(eq_attr "type" "lea,fcmov,fpspc") |
| 811 |
(const_string "none") |
| 812 |
(eq_attr "type" "fistp,leave") |
| 813 |
(const_string "both") |
| 814 |
(eq_attr "type" "frndint") |
| 815 |
(const_string "load") |
| 816 |
(eq_attr "type" "push") |
| 817 |
(if_then_else (match_operand 1 "memory_operand") |
| 818 |
(const_string "both") |
| 819 |
(const_string "store")) |
| 820 |
(eq_attr "type" "pop") |
| 821 |
(if_then_else (match_operand 0 "memory_operand") |
| 822 |
(const_string "both") |
| 823 |
(const_string "load")) |
| 824 |
(eq_attr "type" "setcc") |
| 825 |
(if_then_else (match_operand 0 "memory_operand") |
| 826 |
(const_string "store") |
| 827 |
(const_string "none")) |
| 828 |
(eq_attr "type" "icmp,test,ssecmp,ssecomi,mmxcmp,fcmp") |
| 829 |
(if_then_else (ior (match_operand 0 "memory_operand") |
| 830 |
(match_operand 1 "memory_operand")) |
| 831 |
(const_string "load") |
| 832 |
(const_string "none")) |
| 833 |
(eq_attr "type" "ibr") |
| 834 |
(if_then_else (match_operand 0 "memory_operand") |
| 835 |
(const_string "load") |
| 836 |
(const_string "none")) |
| 837 |
(eq_attr "type" "call") |
| 838 |
(if_then_else (match_operand 0 "constant_call_address_operand") |
| 839 |
(const_string "none") |
| 840 |
(const_string "load")) |
| 841 |
(eq_attr "type" "callv") |
| 842 |
(if_then_else (match_operand 1 "constant_call_address_operand") |
| 843 |
(const_string "none") |
| 844 |
(const_string "load")) |
| 845 |
(and (eq_attr "type" "alu1,negnot,ishift1,rotate1,sselog1,sseshuf1") |
| 846 |
(match_operand 1 "memory_operand")) |
| 847 |
(const_string "both") |
| 848 |
(and (match_operand 0 "memory_operand") |
| 849 |
(match_operand 1 "memory_operand")) |
| 850 |
(const_string "both") |
| 851 |
(match_operand 0 "memory_operand") |
| 852 |
(const_string "store") |
| 853 |
(match_operand 1 "memory_operand") |
| 854 |
(const_string "load") |
| 855 |
(and (eq_attr "type" |
| 856 |
"!alu1,negnot,ishift1,rotate1, |
| 857 |
imov,imovx,icmp,test,bitmanip, |
| 858 |
fmov,fcmp,fsgn, |
| 859 |
sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt, |
| 860 |
sselog1,sseshuf1,sseadd1,sseiadd1,sseishft1, |
| 861 |
mmx,mmxmov,mmxcmp,mmxcvt,mskmov,msklog") |
| 862 |
(match_operand 2 "memory_operand")) |
| 863 |
(const_string "load") |
| 864 |
(and (eq_attr "type" "ssemov2,sseicvt2") |
| 865 |
(match_operand 2 "memory_operand")) |
| 866 |
(const_string "load") |
| 867 |
(and (eq_attr "type" "icmov,ssemuladd,sse4arg") |
| 868 |
(match_operand 3 "memory_operand")) |
| 869 |
(const_string "load") |
| 870 |
] |
| 871 |
(const_string "none"))) |
| 872 |
|
| 873 |
;; Indicates if an instruction has both an immediate and a displacement. |
| 874 |
|
| 875 |
(define_attr "imm_disp" "false,true,unknown" |
| 876 |
(cond [(eq_attr "type" "other,multi") |
| 877 |
(const_string "unknown") |
| 878 |
(and (eq_attr "type" "icmp,test,imov,alu1,ishift1,rotate1") |
| 879 |
(and (match_operand 0 "memory_displacement_operand") |
| 880 |
(match_operand 1 "immediate_operand"))) |
| 881 |
(const_string "true") |
| 882 |
(and (eq_attr "type" "alu,ishift,ishiftx,rotate,rotatex,imul,idiv") |
| 883 |
(and (match_operand 0 "memory_displacement_operand") |
| 884 |
(match_operand 2 "immediate_operand"))) |
| 885 |
(const_string "true") |
| 886 |
] |
| 887 |
(const_string "false"))) |
| 888 |
|
| 889 |
;; Indicates if an FP operation has an integer source. |
| 890 |
|
| 891 |
(define_attr "fp_int_src" "false,true" |
| 892 |
(const_string "false")) |
| 893 |
|
| 894 |
;; Defines rounding mode of an FP operation. |
| 895 |
|
| 896 |
(define_attr "i387_cw" "roundeven,floor,ceil,trunc,uninitialized,any" |
| 897 |
(const_string "any")) |
| 898 |
|
| 899 |
;; Define attribute to indicate AVX insns with partial XMM register update. |
| 900 |
(define_attr "avx_partial_xmm_update" "false,true" |
| 901 |
(const_string "false")) |
| 902 |
|
| 903 |
;; Define attribute to classify add/sub insns that consumes carry flag (CF) |
| 904 |
(define_attr "use_carry" "0,1" (const_string "0")) |
| 905 |
|
| 906 |
;; Define attribute to indicate unaligned ssemov insns |
| 907 |
(define_attr "movu" "0,1" (const_string "0")) |
| 908 |
|
| 909 |
;; Define attribute to limit memory address register set. |
| 910 |
(define_attr "addr" "gpr8,gpr16,gpr32" (const_string "gpr32")) |
| 911 |
|
| 912 |
;; Define instruction set of MMX instructions |
| 913 |
(define_attr "mmx_isa" "base,native,sse,sse_noavx,avx" |
| 914 |
(const_string "base")) |
| 915 |
|
| 916 |
(define_attr "enabled" "" |
| 917 |
(cond [(eq_attr "isa" "x64") (symbol_ref "TARGET_64BIT") |
| 918 |
(eq_attr "isa" "nox64") (symbol_ref "!TARGET_64BIT") |
| 919 |
(eq_attr "isa" "x64_sse2") |
| 920 |
(symbol_ref "TARGET_64BIT && TARGET_SSE2") |
| 921 |
(eq_attr "isa" "x64_sse4") |
| 922 |
(symbol_ref "TARGET_64BIT && TARGET_SSE4_1") |
| 923 |
(eq_attr "isa" "x64_sse4_noavx") |
| 924 |
(symbol_ref "TARGET_64BIT && TARGET_SSE4_1 && !TARGET_AVX") |
| 925 |
(eq_attr "isa" "x64_avx") |
| 926 |
(symbol_ref "TARGET_64BIT && TARGET_AVX") |
| 927 |
(eq_attr "isa" "x64_avx512bw") |
| 928 |
(symbol_ref "TARGET_64BIT && TARGET_AVX512BW") |
| 929 |
(eq_attr "isa" "x64_avx512dq") |
| 930 |
(symbol_ref "TARGET_64BIT && TARGET_AVX512DQ") |
| 931 |
(eq_attr "isa" "sse_noavx") |
| 932 |
(symbol_ref "TARGET_SSE && !TARGET_AVX") |
| 933 |
(eq_attr "isa" "sse2") (symbol_ref "TARGET_SSE2") |
| 934 |
(eq_attr "isa" "sse2_noavx") |
| 935 |
(symbol_ref "TARGET_SSE2 && !TARGET_AVX") |
| 936 |
(eq_attr "isa" "sse3") (symbol_ref "TARGET_SSE3") |
| 937 |
(eq_attr "isa" "sse3_noavx") |
| 938 |
(symbol_ref "TARGET_SSE3 && !TARGET_AVX") |
| 939 |
(eq_attr "isa" "sse4") (symbol_ref "TARGET_SSE4_1") |
| 940 |
(eq_attr "isa" "sse4_noavx") |
| 941 |
(symbol_ref "TARGET_SSE4_1 && !TARGET_AVX") |
| 942 |
(eq_attr "isa" "avx") (symbol_ref "TARGET_AVX") |
| 943 |
(eq_attr "isa" "avx_noavx512f") |
| 944 |
(symbol_ref "TARGET_AVX && !TARGET_AVX512F") |
| 945 |
(eq_attr "isa" "avx_noavx512vl") |
| 946 |
(symbol_ref "TARGET_AVX && !TARGET_AVX512VL") |
| 947 |
(eq_attr "isa" "noavx") (symbol_ref "!TARGET_AVX") |
| 948 |
(eq_attr "isa" "avx2") (symbol_ref "TARGET_AVX2") |
| 949 |
(eq_attr "isa" "noavx2") (symbol_ref "!TARGET_AVX2") |
| 950 |
(eq_attr "isa" "bmi") (symbol_ref "TARGET_BMI") |
| 951 |
(eq_attr "isa" "bmi2") (symbol_ref "TARGET_BMI2") |
| 952 |
(eq_attr "isa" "fma4") (symbol_ref "TARGET_FMA4") |
| 953 |
(eq_attr "isa" "fma") (symbol_ref "TARGET_FMA") |
| 954 |
(eq_attr "isa" "fma_or_avx512vl") |
| 955 |
(symbol_ref "TARGET_FMA || TARGET_AVX512VL") |
| 956 |
(eq_attr "isa" "avx512f") (symbol_ref "TARGET_AVX512F") |
| 957 |
(eq_attr "isa" "avx512f_512") |
| 958 |
(symbol_ref "TARGET_AVX512F && TARGET_EVEX512") |
| 959 |
(eq_attr "isa" "noavx512f") (symbol_ref "!TARGET_AVX512F") |
| 960 |
(eq_attr "isa" "avx512bw") (symbol_ref "TARGET_AVX512BW") |
| 961 |
(eq_attr "isa" "avx512bw_512") |
| 962 |
(symbol_ref "TARGET_AVX512BW && TARGET_EVEX512") |
| 963 |
(eq_attr "isa" "noavx512bw") (symbol_ref "!TARGET_AVX512BW") |
| 964 |
(eq_attr "isa" "avx512dq") (symbol_ref "TARGET_AVX512DQ") |
| 965 |
(eq_attr "isa" "noavx512dq") (symbol_ref "!TARGET_AVX512DQ") |
| 966 |
(eq_attr "isa" "avx512vl") (symbol_ref "TARGET_AVX512VL") |
| 967 |
(eq_attr "isa" "noavx512vl") (symbol_ref "!TARGET_AVX512VL") |
| 968 |
(eq_attr "isa" "avxvnni") (symbol_ref "TARGET_AVXVNNI") |
| 969 |
(eq_attr "isa" "avx512vnnivl") |
| 970 |
(symbol_ref "TARGET_AVX512VNNI && TARGET_AVX512VL") |
| 971 |
(eq_attr "isa" "avx512fp16") |
| 972 |
(symbol_ref "TARGET_AVX512FP16") |
| 973 |
(eq_attr "isa" "avxifma") (symbol_ref "TARGET_AVXIFMA") |
| 974 |
(eq_attr "isa" "avx512ifmavl") |
| 975 |
(symbol_ref "TARGET_AVX512IFMA && TARGET_AVX512VL") |
| 976 |
(eq_attr "isa" "avxneconvert") (symbol_ref "TARGET_AVXNECONVERT") |
| 977 |
(eq_attr "isa" "avx512bf16vl") |
| 978 |
(symbol_ref "TARGET_AVX512BF16 && TARGET_AVX512VL") |
| 979 |
(eq_attr "isa" "vpclmulqdqvl") |
| 980 |
(symbol_ref "TARGET_VPCLMULQDQ && TARGET_AVX512VL") |
| 981 |
(eq_attr "isa" "apx_ndd") |
| 982 |
(symbol_ref "TARGET_APX_NDD") |
| 983 |
(eq_attr "isa" "apx_ndd_64") |
| 984 |
(symbol_ref "TARGET_APX_NDD && Pmode == DImode") |
| 985 |
(eq_attr "isa" "vaes_avx512vl") |
| 986 |
(symbol_ref "TARGET_VAES && TARGET_AVX512VL") |
| 987 |
(eq_attr "isa" "avx10_2") (symbol_ref "TARGET_AVX10_2") |
| 988 |
|
| 989 |
(eq_attr "mmx_isa" "native") |
| 990 |
(symbol_ref "!TARGET_MMX_WITH_SSE") |
| 991 |
(eq_attr "mmx_isa" "sse") |
| 992 |
(symbol_ref "TARGET_MMX_WITH_SSE") |
| 993 |
(eq_attr "mmx_isa" "sse_noavx") |
| 994 |
(symbol_ref "TARGET_MMX_WITH_SSE && !TARGET_AVX") |
| 995 |
(eq_attr "mmx_isa" "avx") |
| 996 |
(symbol_ref "TARGET_MMX_WITH_SSE && TARGET_AVX") |
| 997 |
(eq_attr "isa" "noapx_nf") (symbol_ref "!TARGET_APX_NF") |
| 998 |
] |
| 999 |
(const_int 1))) |
| 1000 |
|
| 1001 |
(define_attr "preferred_for_size" "" (const_int 1)) |
| 1002 |
(define_attr "preferred_for_speed" "" (const_int 1)) |
| 1003 |
|
| 1004 |
;; Define attribute to mark the insn has nf variant. |
| 1005 |
(define_attr "has_nf" "0,1" (const_string "0")) |
| 1006 |
|
| 1007 |
;; Describe a user's asm statement. |
| 1008 |
(define_asm_attributes |
| 1009 |
[(set_attr "length" "128") |
| 1010 |
(set_attr "type" "multi")]) |
| 1011 |
|
| 1012 |
(define_code_iterator plusminus [plus minus]) |
| 1013 |
(define_code_iterator plusminusmult [plus minus mult]) |
| 1014 |
(define_code_iterator plusminusmultdiv [plus minus mult div]) |
| 1015 |
|
| 1016 |
(define_code_iterator sat_plusminus [ss_plus us_plus ss_minus us_minus]) |
| 1017 |
|
| 1018 |
;; Base name for insn mnemonic. |
| 1019 |
(define_code_attr plusminus_mnemonic |
| 1020 |
[(plus "add") (ss_plus "adds") (us_plus "addus") |
| 1021 |
(minus "sub") (ss_minus "subs") (us_minus "subus")]) |
| 1022 |
|
| 1023 |
(define_code_iterator multdiv [mult div]) |
| 1024 |
|
| 1025 |
(define_code_attr multdiv_mnemonic |
| 1026 |
[(mult "mul") (div "div")]) |
| 1027 |
|
| 1028 |
;; Mark commutative operators as such in constraints. |
| 1029 |
(define_code_attr comm [(plus "%") (ss_plus "%") (us_plus "%") |
| 1030 |
(minus "") (ss_minus "") (us_minus "") |
| 1031 |
(mult "%") (div "")]) |
| 1032 |
|
| 1033 |
;; Mapping of max and min |
| 1034 |
(define_code_iterator maxmin [smax smin umax umin]) |
| 1035 |
|
| 1036 |
;; Mapping of signed max and min |
| 1037 |
(define_code_iterator smaxmin [smax smin]) |
| 1038 |
|
| 1039 |
;; Mapping of unsigned max and min |
| 1040 |
(define_code_iterator umaxmin [umax umin]) |
| 1041 |
|
| 1042 |
;; Base name for integer and FP insn mnemonic |
| 1043 |
(define_code_attr maxmin_int [(smax "maxs") (smin "mins") |
| 1044 |
(umax "maxu") (umin "minu")]) |
| 1045 |
(define_code_attr maxmin_float [(smax "max") (smin "min")]) |
| 1046 |
|
| 1047 |
(define_int_iterator IEEE_MAXMIN |
| 1048 |
[UNSPEC_IEEE_MAX |
| 1049 |
UNSPEC_IEEE_MIN]) |
| 1050 |
|
| 1051 |
(define_int_attr ieee_maxmin |
| 1052 |
[(UNSPEC_IEEE_MAX "max") |
| 1053 |
(UNSPEC_IEEE_MIN "min")]) |
| 1054 |
|
| 1055 |
;; Mapping of logic operators |
| 1056 |
(define_code_iterator any_logic [and ior xor]) |
| 1057 |
(define_code_iterator any_or [ior xor]) |
| 1058 |
(define_code_iterator fpint_logic [and xor]) |
| 1059 |
|
| 1060 |
;; Base name for insn mnemonic. |
| 1061 |
(define_code_attr logic [(and "and") (ior "or") (xor "xor")]) |
| 1062 |
|
| 1063 |
;; Mapping of logic-shift operators |
| 1064 |
(define_code_iterator any_lshift [ashift lshiftrt]) |
| 1065 |
|
| 1066 |
;; Mapping of shift-right operators |
| 1067 |
(define_code_iterator any_shiftrt [lshiftrt ashiftrt]) |
| 1068 |
|
| 1069 |
;; Mapping of all shift operators |
| 1070 |
(define_code_iterator any_shift [ashift lshiftrt ashiftrt]) |
| 1071 |
|
| 1072 |
;; Base name for insn mnemonic. |
| 1073 |
(define_code_attr shift [(ashift "sal") (lshiftrt "shr") (ashiftrt "sar")]) |
| 1074 |
(define_code_attr vshift [(ashift "sll") (lshiftrt "srl") (ashiftrt "sra")]) |
| 1075 |
|
| 1076 |
;; Mapping of rotate operators |
| 1077 |
(define_code_iterator any_rotate [rotate rotatert]) |
| 1078 |
|
| 1079 |
;; Base name for insn mnemonic. |
| 1080 |
(define_code_attr rotate [(rotate "rol") (rotatert "ror")]) |
| 1081 |
|
| 1082 |
;; Counter rotate. |
| 1083 |
(define_code_attr crotate [(rotate "rotatert") (rotatert "rotate")]) |
| 1084 |
|
| 1085 |
;; Mapping of abs neg operators |
| 1086 |
(define_code_iterator absneg [abs neg]) |
| 1087 |
|
| 1088 |
;; Mapping of abs neg operators to logic operation |
| 1089 |
(define_code_attr absneg_op [(abs "and") (neg "xor")]) |
| 1090 |
|
| 1091 |
;; Base name for x87 insn mnemonic. |
| 1092 |
(define_code_attr absneg_mnemonic [(abs "fabs") (neg "fchs")]) |
| 1093 |
|
| 1094 |
;; Mapping of extend operators |
| 1095 |
(define_code_iterator any_extend [sign_extend zero_extend]) |
| 1096 |
|
| 1097 |
;; Mapping of highpart multiply operators |
| 1098 |
(define_code_iterator any_mul_highpart [smul_highpart umul_highpart]) |
| 1099 |
|
| 1100 |
;; Prefix for insn menmonic. |
| 1101 |
(define_code_attr sgnprefix [(sign_extend "i") (zero_extend "") |
| 1102 |
(smul_highpart "i") (umul_highpart "") |
| 1103 |
(div "i") (udiv "")]) |
| 1104 |
;; Prefix for define_insn |
| 1105 |
(define_code_attr s [(sign_extend "s") (zero_extend "u") |
| 1106 |
(smul_highpart "s") (umul_highpart "u")]) |
| 1107 |
(define_code_attr u [(sign_extend "") (zero_extend "u") |
| 1108 |
(div "") (udiv "u")]) |
| 1109 |
(define_code_attr u_bool [(sign_extend "false") (zero_extend "true") |
| 1110 |
(div "false") (udiv "true")]) |
| 1111 |
|
| 1112 |
;; Used in signed and unsigned truncations. |
| 1113 |
(define_code_iterator any_truncate [ss_truncate truncate us_truncate]) |
| 1114 |
;; Instruction suffix for truncations. |
| 1115 |
(define_code_attr trunsuffix |
| 1116 |
[(ss_truncate "s") (truncate "") (us_truncate "us")]) |
| 1117 |
|
| 1118 |
;; Instruction suffix for SSE sign and zero extensions. |
| 1119 |
(define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")]) |
| 1120 |
|
| 1121 |
;; Used in signed and unsigned fix. |
| 1122 |
(define_code_iterator any_fix [fix unsigned_fix]) |
| 1123 |
(define_code_attr fixsuffix [(fix "") (unsigned_fix "u")]) |
| 1124 |
(define_code_attr fixunssuffix [(fix "") (unsigned_fix "uns")]) |
| 1125 |
(define_code_attr fixprefix [(fix "s") (unsigned_fix "u")]) |
| 1126 |
|
| 1127 |
;; Used in signed and unsigned float. |
| 1128 |
(define_code_iterator any_float [float unsigned_float]) |
| 1129 |
(define_code_attr floatsuffix [(float "") (unsigned_float "u")]) |
| 1130 |
(define_code_attr floatunssuffix [(float "") (unsigned_float "uns")]) |
| 1131 |
(define_code_attr floatprefix [(float "s") (unsigned_float "u")]) |
| 1132 |
|
| 1133 |
;; Base name for expression |
| 1134 |
(define_code_attr insn |
| 1135 |
[(plus "add") (ss_plus "ssadd") (us_plus "usadd") |
| 1136 |
(minus "sub") (ss_minus "sssub") (us_minus "ussub") |
| 1137 |
(sign_extend "extend") (zero_extend "zero_extend") |
| 1138 |
(ashift "ashl") (lshiftrt "lshr") (ashiftrt "ashr") |
| 1139 |
(rotate "rotl") (rotatert "rotr") |
| 1140 |
(mult "mul") (div "div")]) |
| 1141 |
|
| 1142 |
;; All integer modes. |
| 1143 |
(define_mode_iterator SWI1248x [QI HI SI DI]) |
| 1144 |
|
| 1145 |
;; All integer modes without QImode. |
| 1146 |
(define_mode_iterator SWI248x [HI SI DI]) |
| 1147 |
|
| 1148 |
;; All integer modes without QImode and HImode. |
| 1149 |
(define_mode_iterator SWI48x [SI DI]) |
| 1150 |
|
| 1151 |
;; All integer modes without SImode and DImode. |
| 1152 |
(define_mode_iterator SWI12 [QI HI]) |
| 1153 |
|
| 1154 |
;; All integer modes without DImode. |
| 1155 |
(define_mode_iterator SWI124 [QI HI SI]) |
| 1156 |
|
| 1157 |
;; All integer modes without QImode and DImode. |
| 1158 |
(define_mode_iterator SWI24 [HI SI]) |
| 1159 |
|
| 1160 |
;; Single word integer modes. |
| 1161 |
(define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")]) |
| 1162 |
|
| 1163 |
;; Single word integer modes without QImode. |
| 1164 |
(define_mode_iterator SWI248 [HI SI (DI "TARGET_64BIT")]) |
| 1165 |
|
| 1166 |
;; Single word integer modes without QImode and HImode. |
| 1167 |
(define_mode_iterator SWI48 [SI (DI "TARGET_64BIT")]) |
| 1168 |
|
| 1169 |
;; All math-dependant single and double word integer modes. |
| 1170 |
(define_mode_iterator SDWIM [(QI "TARGET_QIMODE_MATH") |
| 1171 |
(HI "TARGET_HIMODE_MATH") |
| 1172 |
SI DI (TI "TARGET_64BIT")]) |
| 1173 |
|
| 1174 |
;; Math-dependant single word integer modes. |
| 1175 |
(define_mode_iterator SWIM [(QI "TARGET_QIMODE_MATH") |
| 1176 |
(HI "TARGET_HIMODE_MATH") |
| 1177 |
SI (DI "TARGET_64BIT")]) |
| 1178 |
|
| 1179 |
;; Math-dependant integer modes without DImode. |
| 1180 |
(define_mode_iterator SWIM124 [(QI "TARGET_QIMODE_MATH") |
| 1181 |
(HI "TARGET_HIMODE_MATH") |
| 1182 |
SI]) |
| 1183 |
|
| 1184 |
;; Math-dependant integer modes with DImode. |
| 1185 |
(define_mode_iterator SWIM1248x |
| 1186 |
[(QI "TARGET_QIMODE_MATH") |
| 1187 |
(HI "TARGET_HIMODE_MATH") |
| 1188 |
SI DI]) |
| 1189 |
|
| 1190 |
;; Math-dependant single word integer modes without QImode. |
| 1191 |
(define_mode_iterator SWIM248 [(HI "TARGET_HIMODE_MATH") |
| 1192 |
SI (DI "TARGET_64BIT")]) |
| 1193 |
|
| 1194 |
;; Double word integer modes. |
| 1195 |
(define_mode_iterator DWI [(DI "!TARGET_64BIT") |
| 1196 |
(TI "TARGET_64BIT")]) |
| 1197 |
|
| 1198 |
;; SWI and DWI together. |
| 1199 |
(define_mode_iterator SWIDWI [QI HI SI DI (TI "TARGET_64BIT")]) |
| 1200 |
|
| 1201 |
;; SWI48 and DWI together. |
| 1202 |
(define_mode_iterator SWI48DWI [SI DI (TI "TARGET_64BIT")]) |
| 1203 |
|
| 1204 |
;; GET_MODE_SIZE for selected modes. As GET_MODE_SIZE is not |
| 1205 |
;; compile time constant, it is faster to use <MODE_SIZE> than |
| 1206 |
;; GET_MODE_SIZE (<MODE>mode). For XFmode which depends on |
| 1207 |
;; command line options just use GET_MODE_SIZE macro. |
| 1208 |
(define_mode_attr MODE_SIZE [(QI "1") (HI "2") (SI "4") (DI "8") |
| 1209 |
(TI "16") (HF "2") (BF "2") (SF "4") (DF "8") |
| 1210 |
(XF "GET_MODE_SIZE (XFmode)") |
| 1211 |
(V16QI "16") (V32QI "32") (V64QI "64") |
| 1212 |
(V8HI "16") (V16HI "32") (V32HI "64") |
| 1213 |
(V4SI "16") (V8SI "32") (V16SI "64") |
| 1214 |
(V2DI "16") (V4DI "32") (V8DI "64") |
| 1215 |
(V1TI "16") (V2TI "32") (V4TI "64") |
| 1216 |
(V2DF "16") (V4DF "32") (V8DF "64") |
| 1217 |
(V4SF "16") (V8SF "32") (V16SF "64") |
| 1218 |
(V8HF "16") (V16HF "32") (V32HF "64") |
| 1219 |
(V4HF "8") (V2HF "4") |
| 1220 |
(V8BF "16") (V16BF "32") (V32BF "64") |
| 1221 |
(V4BF "8") (V2BF "4")]) |
| 1222 |
|
| 1223 |
;; Double word integer modes as mode attribute. |
| 1224 |
(define_mode_attr DWI [(QI "HI") (HI "SI") (SI "DI") (DI "TI") (TI "OI")]) |
| 1225 |
(define_mode_attr dwi [(QI "hi") (HI "si") (SI "di") (DI "ti") (TI "oi")]) |
| 1226 |
|
| 1227 |
;; Half sized integer modes. |
| 1228 |
(define_mode_attr HALF [(TI "DI") (DI "SI")]) |
| 1229 |
(define_mode_attr half [(TI "di") (DI "si")]) |
| 1230 |
|
| 1231 |
;; LEA mode corresponding to an integer mode |
| 1232 |
(define_mode_attr LEAMODE [(QI "SI") (HI "SI") (SI "SI") (DI "DI")]) |
| 1233 |
|
| 1234 |
;; Half mode for double word integer modes. |
| 1235 |
(define_mode_iterator DWIH [(SI "!TARGET_64BIT") |
| 1236 |
(DI "TARGET_64BIT")]) |
| 1237 |
|
| 1238 |
;; Instruction suffix for integer modes. |
| 1239 |
(define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")]) |
| 1240 |
|
| 1241 |
;; Instruction suffix for masks. |
| 1242 |
(define_mode_attr mskmodesuffix [(QI "b") (HI "w") (SI "d") (DI "q")]) |
| 1243 |
|
| 1244 |
;; Pointer size prefix for integer modes (Intel asm dialect) |
| 1245 |
(define_mode_attr iptrsize [(QI "BYTE") |
| 1246 |
(HI "WORD") |
| 1247 |
(SI "DWORD") |
| 1248 |
(DI "QWORD")]) |
| 1249 |
|
| 1250 |
;; Register class for integer modes. |
| 1251 |
(define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")]) |
| 1252 |
|
| 1253 |
;; Immediate operand constraint for integer modes. |
| 1254 |
(define_mode_attr i [(QI "n") (HI "n") (SI "e") (DI "e")]) |
| 1255 |
|
| 1256 |
;; General operand constraint for word modes. |
| 1257 |
(define_mode_attr g [(QI "qmn") (HI "rmn") (SI "rme") (DI "rme")]) |
| 1258 |
|
| 1259 |
;; Memory operand constraint for word modes. |
| 1260 |
(define_mode_attr m [(QI "m") (HI "m") (SI "BM") (DI "BM")]) |
| 1261 |
|
| 1262 |
;; Immediate operand constraint for double integer modes. |
| 1263 |
(define_mode_attr di [(SI "nF") (DI "Wd")]) |
| 1264 |
|
| 1265 |
;; Immediate operand constraint for shifts. |
| 1266 |
(define_mode_attr S [(QI "I") (HI "I") (SI "I") (DI "J") (TI "O")]) |
| 1267 |
(define_mode_attr KS [(QI "Wb") (HI "Ww") (SI "I") (DI "J")]) |
| 1268 |
|
| 1269 |
;; Print register name in the specified mode. |
| 1270 |
(define_mode_attr k [(QI "b") (HI "w") (SI "k") (DI "q")]) |
| 1271 |
|
| 1272 |
;; General operand predicate for integer modes. |
| 1273 |
(define_mode_attr general_operand |
| 1274 |
[(QI "general_operand") |
| 1275 |
(HI "general_operand") |
| 1276 |
(SI "x86_64_general_operand") |
| 1277 |
(DI "x86_64_general_operand") |
| 1278 |
(TI "x86_64_general_operand")]) |
| 1279 |
|
| 1280 |
;; General operand predicate for integer modes, where for TImode |
| 1281 |
;; we need both words of the operand to be general operands. |
| 1282 |
(define_mode_attr general_hilo_operand |
| 1283 |
[(QI "general_operand") |
| 1284 |
(HI "general_operand") |
| 1285 |
(SI "x86_64_general_operand") |
| 1286 |
(DI "x86_64_general_operand") |
| 1287 |
(TI "x86_64_hilo_general_operand")]) |
| 1288 |
|
| 1289 |
;; General sign extend operand predicate for integer modes, |
| 1290 |
;; which disallows VOIDmode operands and thus it is suitable |
| 1291 |
;; for use inside sign_extend. |
| 1292 |
(define_mode_attr general_sext_operand |
| 1293 |
[(QI "sext_operand") |
| 1294 |
(HI "sext_operand") |
| 1295 |
(SI "x86_64_sext_operand") |
| 1296 |
(DI "x86_64_sext_operand")]) |
| 1297 |
|
| 1298 |
;; General sign/zero extend operand predicate for integer modes. |
| 1299 |
(define_mode_attr general_szext_operand |
| 1300 |
[(QI "general_operand") |
| 1301 |
(HI "general_operand") |
| 1302 |
(SI "x86_64_szext_general_operand") |
| 1303 |
(DI "x86_64_szext_general_operand") |
| 1304 |
(TI "x86_64_hilo_general_operand")]) |
| 1305 |
|
| 1306 |
(define_mode_attr nonmemory_szext_operand |
| 1307 |
[(QI "nonmemory_operand") |
| 1308 |
(HI "nonmemory_operand") |
| 1309 |
(SI "x86_64_szext_nonmemory_operand") |
| 1310 |
(DI "x86_64_szext_nonmemory_operand")]) |
| 1311 |
|
| 1312 |
;; Immediate operand predicate for integer modes. |
| 1313 |
(define_mode_attr immediate_operand |
| 1314 |
[(QI "immediate_operand") |
| 1315 |
(HI "immediate_operand") |
| 1316 |
(SI "x86_64_immediate_operand") |
| 1317 |
(DI "x86_64_immediate_operand")]) |
| 1318 |
|
| 1319 |
;; Nonmemory operand predicate for integer modes. |
| 1320 |
(define_mode_attr nonmemory_operand |
| 1321 |
[(QI "nonmemory_operand") |
| 1322 |
(HI "nonmemory_operand") |
| 1323 |
(SI "x86_64_nonmemory_operand") |
| 1324 |
(DI "x86_64_nonmemory_operand")]) |
| 1325 |
|
| 1326 |
;; Operand predicate for shifts. |
| 1327 |
(define_mode_attr shift_operand |
| 1328 |
[(QI "nonimmediate_operand") |
| 1329 |
(HI "nonimmediate_operand") |
| 1330 |
(SI "nonimmediate_operand") |
| 1331 |
(DI "shiftdi_operand") |
| 1332 |
(TI "register_operand")]) |
| 1333 |
|
| 1334 |
;; Operand predicate for shift argument. |
| 1335 |
(define_mode_attr shift_immediate_operand |
| 1336 |
[(QI "const_1_to_31_operand") |
| 1337 |
(HI "const_1_to_31_operand") |
| 1338 |
(SI "const_1_to_31_operand") |
| 1339 |
(DI "const_1_to_63_operand")]) |
| 1340 |
|
| 1341 |
;; Input operand predicate for arithmetic left shifts. |
| 1342 |
(define_mode_attr ashl_input_operand |
| 1343 |
[(QI "nonimmediate_operand") |
| 1344 |
(HI "nonimmediate_operand") |
| 1345 |
(SI "nonimmediate_operand") |
| 1346 |
(DI "ashldi_input_operand") |
| 1347 |
(TI "reg_or_pm1_operand")]) |
| 1348 |
|
| 1349 |
;; SSE and x87 SFmode and DFmode floating point modes |
| 1350 |
(define_mode_iterator MODEF [SF DF]) |
| 1351 |
|
| 1352 |
(define_mode_iterator MODEF248 [BF HF SF (DF "TARGET_SSE2")]) |
| 1353 |
|
| 1354 |
;; SSE floating point modes |
| 1355 |
(define_mode_iterator MODEFH [(HF "TARGET_AVX512FP16") SF DF]) |
| 1356 |
|
| 1357 |
;; All x87 floating point modes |
| 1358 |
(define_mode_iterator X87MODEF [SF DF XF]) |
| 1359 |
|
| 1360 |
;; All x87 floating point modes plus HFmode |
| 1361 |
(define_mode_iterator X87MODEFH [HF SF DF XF BF]) |
| 1362 |
|
| 1363 |
;; All SSE floating point modes |
| 1364 |
(define_mode_iterator SSEMODEF [HF SF DF TF]) |
| 1365 |
(define_mode_attr ssevecmodef [(HF "V8HF") (SF "V4SF") (DF "V2DF") (TF "TF")]) |
| 1366 |
|
| 1367 |
;; SSE instruction suffix for various modes |
| 1368 |
(define_mode_attr ssemodesuffix |
| 1369 |
[(HF "sh") (SF "ss") (DF "sd") |
| 1370 |
(V32HF "ph") (V16SF "ps") (V8DF "pd") |
| 1371 |
(V16HF "ph") (V16BF "bf") (V8SF "ps") (V4DF "pd") |
| 1372 |
(V8HF "ph") (V8BF "bf") (V4SF "ps") (V2DF "pd") |
| 1373 |
(V16QI "b") (V8HI "w") (V4SI "d") (V2DI "q") |
| 1374 |
(V32QI "b") (V16HI "w") (V8SI "d") (V4DI "q") |
| 1375 |
(V64QI "b") (V32HI "w") (V16SI "d") (V8DI "q")]) |
| 1376 |
|
| 1377 |
;; SSE vector suffix for floating point modes |
| 1378 |
;; BF HF use same suffix as SF for logic operations. |
| 1379 |
(define_mode_attr ssevecmodesuffix [(BF "ps") (HF "ps") (SF "ps") (DF "pd")]) |
| 1380 |
|
| 1381 |
;; SSE vector mode corresponding to a scalar mode |
| 1382 |
(define_mode_attr ssevecmode |
| 1383 |
[(QI "V16QI") (HI "V8HI") (SI "V4SI") (DI "V2DI") (HF "V8HF") (BF "V8BF") (SF "V4SF") (DF "V2DF")]) |
| 1384 |
(define_mode_attr ssevecmodelower |
| 1385 |
[(QI "v16qi") (HI "v8hi") (SI "v4si") (DI "v2di") (SF "v4sf") (DF "v2df")]) |
| 1386 |
|
| 1387 |
;; AVX512F vector mode corresponding to a scalar mode |
| 1388 |
(define_mode_attr avx512fvecmode |
| 1389 |
[(QI "V64QI") (HI "V32HI") (SI "V16SI") (DI "V8DI") |
| 1390 |
(HF "V32HF") (BF "V32BF") (SF "V16SF") (DF "V8DF")]) |
| 1391 |
|
| 1392 |
;; Instruction suffix for REX 64bit operators. |
| 1393 |
(define_mode_attr rex64suffix [(SI "{l}") (DI "{q}")]) |
| 1394 |
(define_mode_attr rex64namesuffix [(SI "") (DI "q")]) |
| 1395 |
|
| 1396 |
;; This mode iterator allows :P to be used for patterns that operate on |
| 1397 |
;; pointer-sized quantities. Exactly one of the two alternatives will match. |
| 1398 |
(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")]) |
| 1399 |
|
| 1400 |
;; This mode iterator allows :W to be used for patterns that operate on |
| 1401 |
;; word_mode sized quantities. |
| 1402 |
(define_mode_iterator W |
| 1403 |
[(SI "word_mode == SImode") (DI "word_mode == DImode")]) |
| 1404 |
|
| 1405 |
;; This mode iterator allows :PTR to be used for patterns that operate on |
| 1406 |
;; ptr_mode sized quantities. |
| 1407 |
(define_mode_iterator PTR |
| 1408 |
[(SI "ptr_mode == SImode") (DI "ptr_mode == DImode")]) |
| 1409 |
|
| 1410 |
;; Scheduling descriptions |
| 1411 |
|
| 1412 |
(include "pentium.md") |
| 1413 |
(include "ppro.md") |
| 1414 |
(include "k6.md") |
| 1415 |
(include "athlon.md") |
| 1416 |
(include "bdver1.md") |
| 1417 |
(include "bdver3.md") |
| 1418 |
(include "btver2.md") |
| 1419 |
(include "znver.md") |
| 1420 |
(include "zn4zn5.md") |
| 1421 |
(include "geode.md") |
| 1422 |
(include "atom.md") |
| 1423 |
(include "slm.md") |
| 1424 |
(include "glm.md") |
| 1425 |
(include "core2.md") |
| 1426 |
(include "haswell.md") |
| 1427 |
(include "lujiazui.md") |
| 1428 |
(include "yongfeng.md") |
| 1429 |
(include "c86-4g.md") |
| 1430 |
(include "c86-4g-m7.md") |
| 1431 |
|
| 1432 |
|
| 1433 |
;; Operand and operator predicates and constraints |
| 1434 |
|
| 1435 |
(include "predicates.md") |
| 1436 |
(include "constraints.md") |
| 1437 |
|
| 1438 |
|
| 1439 |
;; Compare and branch/compare and store instructions. |
| 1440 |
|
| 1441 |
(define_expand "cbranch<mode>4" |
| 1442 |
[(set (reg:CC FLAGS_REG) |
| 1443 |
(compare:CC (match_operand:SWIM1248x 1 "nonimmediate_operand") |
| 1444 |
(match_operand:SWIM1248x 2 "<general_operand>"))) |
| 1445 |
(set (pc) (if_then_else |
| 1446 |
(match_operator 0 "ordered_comparison_operator" |
| 1447 |
[(reg:CC FLAGS_REG) (const_int 0)]) |
| 1448 |
(label_ref (match_operand 3)) |
| 1449 |
(pc)))] |
| 1450 |
"" |
| 1451 |
{ |
| 1452 |
if (MEM_P (operands[1]) && MEM_P (operands[2])) |
| 1453 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 1454 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1455 |
operands[1], operands[2], operands[3]); |
| 1456 |
DONE; |
| 1457 |
}) |
| 1458 |
|
| 1459 |
(define_expand "cbranchti4" |
| 1460 |
[(set (reg:CC FLAGS_REG) |
| 1461 |
(compare:CC (match_operand:TI 1 "nonimmediate_operand") |
| 1462 |
(match_operand:TI 2 "ix86_timode_comparison_operand"))) |
| 1463 |
(set (pc) (if_then_else |
| 1464 |
(match_operator 0 "ix86_timode_comparison_operator" |
| 1465 |
[(reg:CC FLAGS_REG) (const_int 0)]) |
| 1466 |
(label_ref (match_operand 3)) |
| 1467 |
(pc)))] |
| 1468 |
"TARGET_64BIT || TARGET_SSE4_1" |
| 1469 |
{ |
| 1470 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1471 |
operands[1], operands[2], operands[3]); |
| 1472 |
DONE; |
| 1473 |
}) |
| 1474 |
|
| 1475 |
(define_expand "cbranchoi4" |
| 1476 |
[(set (reg:CC FLAGS_REG) |
| 1477 |
(compare:CC (match_operand:OI 1 "nonimmediate_operand") |
| 1478 |
(match_operand:OI 2 "nonimmediate_operand"))) |
| 1479 |
(set (pc) (if_then_else |
| 1480 |
(match_operator 0 "bt_comparison_operator" |
| 1481 |
[(reg:CC FLAGS_REG) (const_int 0)]) |
| 1482 |
(label_ref (match_operand 3)) |
| 1483 |
(pc)))] |
| 1484 |
"TARGET_AVX" |
| 1485 |
{ |
| 1486 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1487 |
operands[1], operands[2], operands[3]); |
| 1488 |
DONE; |
| 1489 |
}) |
| 1490 |
|
| 1491 |
(define_expand "cbranchxi4" |
| 1492 |
[(set (reg:CC FLAGS_REG) |
| 1493 |
(compare:CC (match_operand:XI 1 "nonimmediate_operand") |
| 1494 |
(match_operand:XI 2 "nonimmediate_operand"))) |
| 1495 |
(set (pc) (if_then_else |
| 1496 |
(match_operator 0 "bt_comparison_operator" |
| 1497 |
[(reg:CC FLAGS_REG) (const_int 0)]) |
| 1498 |
(label_ref (match_operand 3)) |
| 1499 |
(pc)))] |
| 1500 |
"TARGET_AVX512F && TARGET_EVEX512 && !TARGET_PREFER_AVX256" |
| 1501 |
{ |
| 1502 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1503 |
operands[1], operands[2], operands[3]); |
| 1504 |
DONE; |
| 1505 |
}) |
| 1506 |
|
| 1507 |
(define_expand "cstore<mode>4" |
| 1508 |
[(set (reg:CC FLAGS_REG) |
| 1509 |
(compare:CC (match_operand:SDWIM 2 "nonimmediate_operand") |
| 1510 |
(match_operand:SDWIM 3 "<general_operand>"))) |
| 1511 |
(set (match_operand:QI 0 "register_operand") |
| 1512 |
(match_operator 1 "ordered_comparison_operator" |
| 1513 |
[(reg:CC FLAGS_REG) (const_int 0)]))] |
| 1514 |
"" |
| 1515 |
{ |
| 1516 |
if (<MODE>mode == (TARGET_64BIT ? TImode : DImode)) |
| 1517 |
{ |
| 1518 |
if (GET_CODE (operands[1]) != EQ |
| 1519 |
&& GET_CODE (operands[1]) != NE) |
| 1520 |
FAIL; |
| 1521 |
} |
| 1522 |
else if (MEM_P (operands[2]) && MEM_P (operands[3])) |
| 1523 |
operands[2] = force_reg (<MODE>mode, operands[2]); |
| 1524 |
ix86_expand_setcc (operands[0], GET_CODE (operands[1]), |
| 1525 |
operands[2], operands[3]); |
| 1526 |
DONE; |
| 1527 |
}) |
| 1528 |
|
| 1529 |
(define_insn "@ccmp<mode>" |
| 1530 |
[(set (match_operand:CC 0 "flags_reg_operand") |
| 1531 |
(if_then_else:CC |
| 1532 |
(match_operator 1 "comparison_operator" |
| 1533 |
[(reg:CC FLAGS_REG) (const_int 0)]) |
| 1534 |
(compare:CC |
| 1535 |
(minus:SWI (match_operand:SWI 2 "nonimmediate_operand" "<r>,<r>m,<r>") |
| 1536 |
(match_operand:SWI 3 "<general_operand>" "C,<r><i>,<m>")) |
| 1537 |
(const_int 0)) |
| 1538 |
(unspec:CC |
| 1539 |
[(match_operand:SI 4 "const_0_to_15_operand")] |
| 1540 |
UNSPEC_APX_DFV)))] |
| 1541 |
"TARGET_APX_CCMP" |
| 1542 |
"@ |
| 1543 |
ctest%C1{<imodesuffix>}\t%G4 %2, %2 |
| 1544 |
ccmp%C1{<imodesuffix>}\t%G4 {%3, %2|%2, %3} |
| 1545 |
ccmp%C1{<imodesuffix>}\t%G4 {%3, %2|%2, %3}" |
| 1546 |
[(set_attr "type" "icmp") |
| 1547 |
(set_attr "mode" "<MODE>") |
| 1548 |
(set_attr "length_immediate" "1") |
| 1549 |
(set_attr "prefix" "evex")]) |
| 1550 |
|
| 1551 |
(define_expand "@cmp<mode>_1" |
| 1552 |
[(set (reg:CC FLAGS_REG) |
| 1553 |
(compare:CC (match_operand:SWI 0 "nonimmediate_operand") |
| 1554 |
(match_operand:SWI 1 "<general_operand>")))]) |
| 1555 |
|
| 1556 |
(define_mode_iterator SWI1248_AVX512BWDQ_64 |
| 1557 |
[(QI "TARGET_AVX512DQ") HI |
| 1558 |
(SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW && TARGET_64BIT")]) |
| 1559 |
|
| 1560 |
(define_insn "*cmp<mode>_ccz_1" |
| 1561 |
[(set (reg FLAGS_REG) |
| 1562 |
(compare (match_operand:SWI1248_AVX512BWDQ_64 0 |
| 1563 |
"nonimmediate_operand" "<r>,?m<r>,$k") |
| 1564 |
(match_operand:SWI1248_AVX512BWDQ_64 1 "const0_operand")))] |
| 1565 |
"TARGET_AVX512F && ix86_match_ccmode (insn, CCZmode)" |
| 1566 |
"@ |
| 1567 |
test{<imodesuffix>}\t%0, %0 |
| 1568 |
cmp{<imodesuffix>}\t{%1, %0|%0, %1} |
| 1569 |
kortest<mskmodesuffix>\t%0, %0" |
| 1570 |
[(set_attr "type" "test,icmp,msklog") |
| 1571 |
(set_attr "length_immediate" "0,1,*") |
| 1572 |
(set_attr "prefix" "*,*,vex") |
| 1573 |
(set_attr "mode" "<MODE>")]) |
| 1574 |
|
| 1575 |
(define_insn "*cmp<mode>_ccno_1" |
| 1576 |
[(set (reg FLAGS_REG) |
| 1577 |
(compare (match_operand:SWI 0 "nonimmediate_operand" "<r>,?m<r>") |
| 1578 |
(match_operand:SWI 1 "const0_operand")))] |
| 1579 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 1580 |
"@ |
| 1581 |
test{<imodesuffix>}\t%0, %0 |
| 1582 |
cmp{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 1583 |
[(set_attr "type" "test,icmp") |
| 1584 |
(set_attr "length_immediate" "0,1") |
| 1585 |
(set_attr "mode" "<MODE>")]) |
| 1586 |
|
| 1587 |
(define_insn "*cmp<mode>_1" |
| 1588 |
[(set (reg FLAGS_REG) |
| 1589 |
(compare (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>") |
| 1590 |
(match_operand:SWI 1 "<general_operand>" "<r><i>,<r><m>")))] |
| 1591 |
"ix86_match_ccmode (insn, CCmode)" |
| 1592 |
"cmp{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 1593 |
[(set_attr "type" "icmp") |
| 1594 |
(set_attr "mode" "<MODE>")]) |
| 1595 |
|
| 1596 |
(define_insn "*cmp<mode>_minus_1" |
| 1597 |
[(set (reg FLAGS_REG) |
| 1598 |
(compare |
| 1599 |
(minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>") |
| 1600 |
(match_operand:SWI 1 "<general_operand>" "<r><i>,<r><m>")) |
| 1601 |
(const_int 0)))] |
| 1602 |
"ix86_match_ccmode (insn, CCGOCmode)" |
| 1603 |
"cmp{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 1604 |
[(set_attr "type" "icmp") |
| 1605 |
(set_attr "mode" "<MODE>")]) |
| 1606 |
|
| 1607 |
(define_insn "*cmpqi_ext<mode>_1" |
| 1608 |
[(set (reg FLAGS_REG) |
| 1609 |
(compare |
| 1610 |
(match_operand:QI 0 "nonimmediate_operand" "QBn") |
| 1611 |
(subreg:QI |
| 1612 |
(match_operator:SWI248 2 "extract_operator" |
| 1613 |
[(match_operand 1 "int248_register_operand" "Q") |
| 1614 |
(const_int 8) |
| 1615 |
(const_int 8)]) 0)))] |
| 1616 |
"ix86_match_ccmode (insn, CCmode)" |
| 1617 |
"cmp{b}\t{%h1, %0|%0, %h1}" |
| 1618 |
[(set_attr "addr" "gpr8") |
| 1619 |
(set_attr "type" "icmp") |
| 1620 |
(set_attr "mode" "QI")]) |
| 1621 |
|
| 1622 |
(define_insn "*cmpqi_ext<mode>_2" |
| 1623 |
[(set (reg FLAGS_REG) |
| 1624 |
(compare |
| 1625 |
(subreg:QI |
| 1626 |
(match_operator:SWI248 2 "extract_operator" |
| 1627 |
[(match_operand 0 "int248_register_operand" "Q") |
| 1628 |
(const_int 8) |
| 1629 |
(const_int 8)]) 0) |
| 1630 |
(match_operand:QI 1 "const0_operand")))] |
| 1631 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 1632 |
"test{b}\t%h0, %h0" |
| 1633 |
[(set_attr "type" "test") |
| 1634 |
(set_attr "length_immediate" "0") |
| 1635 |
(set_attr "mode" "QI")]) |
| 1636 |
|
| 1637 |
(define_expand "cmpqi_ext_3" |
| 1638 |
[(set (reg:CC FLAGS_REG) |
| 1639 |
(compare:CC |
| 1640 |
(subreg:QI |
| 1641 |
(zero_extract:HI |
| 1642 |
(match_operand:HI 0 "register_operand") |
| 1643 |
(const_int 8) |
| 1644 |
(const_int 8)) 0) |
| 1645 |
(match_operand:QI 1 "const_int_operand")))]) |
| 1646 |
|
| 1647 |
(define_insn "*cmpqi_ext<mode>_3" |
| 1648 |
[(set (reg FLAGS_REG) |
| 1649 |
(compare |
| 1650 |
(subreg:QI |
| 1651 |
(match_operator:SWI248 2 "extract_operator" |
| 1652 |
[(match_operand 0 "int248_register_operand" "Q") |
| 1653 |
(const_int 8) |
| 1654 |
(const_int 8)]) 0) |
| 1655 |
(match_operand:QI 1 "general_operand" "QnBn")))] |
| 1656 |
"ix86_match_ccmode (insn, CCmode)" |
| 1657 |
"cmp{b}\t{%1, %h0|%h0, %1}" |
| 1658 |
[(set_attr "addr" "gpr8") |
| 1659 |
(set_attr "type" "icmp") |
| 1660 |
(set_attr "mode" "QI")]) |
| 1661 |
|
| 1662 |
(define_insn "*cmpqi_ext<mode>_4" |
| 1663 |
[(set (reg FLAGS_REG) |
| 1664 |
(compare |
| 1665 |
(subreg:QI |
| 1666 |
(match_operator:SWI248 2 "extract_operator" |
| 1667 |
[(match_operand 0 "int248_register_operand" "Q") |
| 1668 |
(const_int 8) |
| 1669 |
(const_int 8)]) 0) |
| 1670 |
(subreg:QI |
| 1671 |
(match_operator:SWI248 3 "extract_operator" |
| 1672 |
[(match_operand 1 "int248_register_operand" "Q") |
| 1673 |
(const_int 8) |
| 1674 |
(const_int 8)]) 0)))] |
| 1675 |
"ix86_match_ccmode (insn, CCmode)" |
| 1676 |
"cmp{b}\t{%h1, %h0|%h0, %h1}" |
| 1677 |
[(set_attr "type" "icmp") |
| 1678 |
(set_attr "mode" "QI")]) |
| 1679 |
|
| 1680 |
(define_insn_and_split "*cmp<dwi>_doubleword" |
| 1681 |
[(set (reg:CCZ FLAGS_REG) |
| 1682 |
(compare:CCZ (match_operand:<DWI> 0 "nonimmediate_operand") |
| 1683 |
(match_operand:<DWI> 1 "general_operand")))] |
| 1684 |
"ix86_pre_reload_split ()" |
| 1685 |
"#" |
| 1686 |
"&& 1" |
| 1687 |
[(parallel [(set (reg:CCZ FLAGS_REG) |
| 1688 |
(compare:CCZ (ior:DWIH (match_dup 4) (match_dup 5)) |
| 1689 |
(const_int 0))) |
| 1690 |
(set (match_dup 4) (ior:DWIH (match_dup 4) (match_dup 5)))])] |
| 1691 |
{ |
| 1692 |
split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[2]); |
| 1693 |
|
| 1694 |
operands[4] = gen_reg_rtx (<MODE>mode); |
| 1695 |
|
| 1696 |
/* Special case comparisons against -1. */ |
| 1697 |
if (operands[1] == constm1_rtx && operands[3] == constm1_rtx) |
| 1698 |
{ |
| 1699 |
emit_insn (gen_and<mode>3 (operands[4], operands[0], operands[2])); |
| 1700 |
emit_insn (gen_cmp_1 (<MODE>mode, operands[4], constm1_rtx)); |
| 1701 |
DONE; |
| 1702 |
} |
| 1703 |
|
| 1704 |
if (operands[1] == const0_rtx) |
| 1705 |
emit_move_insn (operands[4], operands[0]); |
| 1706 |
else if (operands[0] == const0_rtx) |
| 1707 |
emit_move_insn (operands[4], operands[1]); |
| 1708 |
else if (operands[1] == constm1_rtx) |
| 1709 |
emit_insn (gen_one_cmpl<mode>2 (operands[4], operands[0])); |
| 1710 |
else if (operands[0] == constm1_rtx) |
| 1711 |
emit_insn (gen_one_cmpl<mode>2 (operands[4], operands[1])); |
| 1712 |
else |
| 1713 |
{ |
| 1714 |
if (CONST_SCALAR_INT_P (operands[1]) |
| 1715 |
&& !x86_64_immediate_operand (operands[1], <MODE>mode)) |
| 1716 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 1717 |
emit_insn (gen_xor<mode>3 (operands[4], operands[0], operands[1])); |
| 1718 |
} |
| 1719 |
|
| 1720 |
if (operands[3] == const0_rtx) |
| 1721 |
operands[5] = operands[2]; |
| 1722 |
else if (operands[2] == const0_rtx) |
| 1723 |
operands[5] = operands[3]; |
| 1724 |
else |
| 1725 |
{ |
| 1726 |
operands[5] = gen_reg_rtx (<MODE>mode); |
| 1727 |
if (operands[3] == constm1_rtx) |
| 1728 |
emit_insn (gen_one_cmpl<mode>2 (operands[5], operands[2])); |
| 1729 |
else if (operands[2] == constm1_rtx) |
| 1730 |
emit_insn (gen_one_cmpl<mode>2 (operands[5], operands[3])); |
| 1731 |
else |
| 1732 |
{ |
| 1733 |
if (CONST_SCALAR_INT_P (operands[3]) |
| 1734 |
&& !x86_64_immediate_operand (operands[3], <MODE>mode)) |
| 1735 |
operands[3] = force_reg (<MODE>mode, operands[3]); |
| 1736 |
emit_insn (gen_xor<mode>3 (operands[5], operands[2], operands[3])); |
| 1737 |
} |
| 1738 |
} |
| 1739 |
}) |
| 1740 |
|
| 1741 |
;; These implement float point compares. |
| 1742 |
;; %%% See if we can get away with VOIDmode operands on the actual insns, |
| 1743 |
;; which would allow mix and match FP modes on the compares. Which is what |
| 1744 |
;; the old patterns did, but with many more of them. |
| 1745 |
|
| 1746 |
(define_expand "cbranchxf4" |
| 1747 |
[(set (reg:CC FLAGS_REG) |
| 1748 |
(compare:CC (match_operand:XF 1 "nonmemory_operand") |
| 1749 |
(match_operand:XF 2 "nonmemory_operand"))) |
| 1750 |
(set (pc) (if_then_else |
| 1751 |
(match_operator 0 "ix86_fp_comparison_operator_xf" |
| 1752 |
[(reg:CC FLAGS_REG) |
| 1753 |
(const_int 0)]) |
| 1754 |
(label_ref (match_operand 3)) |
| 1755 |
(pc)))] |
| 1756 |
"TARGET_80387" |
| 1757 |
{ |
| 1758 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1759 |
operands[1], operands[2], operands[3]); |
| 1760 |
DONE; |
| 1761 |
}) |
| 1762 |
|
| 1763 |
(define_expand "cstorexf4" |
| 1764 |
[(set (reg:CC FLAGS_REG) |
| 1765 |
(compare:CC (match_operand:XF 2 "nonmemory_operand") |
| 1766 |
(match_operand:XF 3 "nonmemory_operand"))) |
| 1767 |
(set (match_operand:QI 0 "register_operand") |
| 1768 |
(match_operator 1 "ix86_fp_comparison_operator_xf" |
| 1769 |
[(reg:CC FLAGS_REG) |
| 1770 |
(const_int 0)]))] |
| 1771 |
"TARGET_80387" |
| 1772 |
{ |
| 1773 |
ix86_expand_setcc (operands[0], GET_CODE (operands[1]), |
| 1774 |
operands[2], operands[3]); |
| 1775 |
DONE; |
| 1776 |
}) |
| 1777 |
|
| 1778 |
(define_expand "cbranchhf4" |
| 1779 |
[(set (reg:CC FLAGS_REG) |
| 1780 |
(compare:CC (match_operand:HF 1 "cmp_fp_expander_operand") |
| 1781 |
(match_operand:HF 2 "cmp_fp_expander_operand"))) |
| 1782 |
(set (pc) (if_then_else |
| 1783 |
(match_operator 0 "ix86_fp_comparison_operator" |
| 1784 |
[(reg:CC FLAGS_REG) |
| 1785 |
(const_int 0)]) |
| 1786 |
(label_ref (match_operand 3)) |
| 1787 |
(pc)))] |
| 1788 |
"TARGET_AVX512FP16" |
| 1789 |
{ |
| 1790 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1791 |
operands[1], operands[2], operands[3]); |
| 1792 |
DONE; |
| 1793 |
}) |
| 1794 |
|
| 1795 |
(define_expand "cbranch<mode>4" |
| 1796 |
[(set (reg:CC FLAGS_REG) |
| 1797 |
(compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand") |
| 1798 |
(match_operand:MODEF 2 "cmp_fp_expander_operand"))) |
| 1799 |
(set (pc) (if_then_else |
| 1800 |
(match_operator 0 "ix86_fp_comparison_operator" |
| 1801 |
[(reg:CC FLAGS_REG) |
| 1802 |
(const_int 0)]) |
| 1803 |
(label_ref (match_operand 3)) |
| 1804 |
(pc)))] |
| 1805 |
"TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 1806 |
{ |
| 1807 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1808 |
operands[1], operands[2], operands[3]); |
| 1809 |
DONE; |
| 1810 |
}) |
| 1811 |
|
| 1812 |
(define_expand "cbranchbf4" |
| 1813 |
[(set (reg:CC FLAGS_REG) |
| 1814 |
(compare:CC (match_operand:BF 1 "cmp_fp_expander_operand") |
| 1815 |
(match_operand:BF 2 "cmp_fp_expander_operand"))) |
| 1816 |
(set (pc) (if_then_else |
| 1817 |
(match_operator 0 "ix86_fp_comparison_operator" |
| 1818 |
[(reg:CC FLAGS_REG) |
| 1819 |
(const_int 0)]) |
| 1820 |
(label_ref (match_operand 3)) |
| 1821 |
(pc)))] |
| 1822 |
"TARGET_80387 || (SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)" |
| 1823 |
{ |
| 1824 |
if (TARGET_AVX10_2 && !flag_trapping_math) |
| 1825 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1826 |
operands[1], operands[2], operands[3]); |
| 1827 |
else |
| 1828 |
{ |
| 1829 |
rtx op1 = ix86_expand_fast_convert_bf_to_sf (operands[1]); |
| 1830 |
rtx op2 = ix86_expand_fast_convert_bf_to_sf (operands[2]); |
| 1831 |
do_compare_rtx_and_jump (op1, op2, GET_CODE (operands[0]), 0, |
| 1832 |
SFmode, NULL_RTX, NULL, |
| 1833 |
as_a <rtx_code_label *> (operands[3]), |
| 1834 |
/* Unfortunately this isn't propagated. */ |
| 1835 |
profile_probability::even ()); |
| 1836 |
} |
| 1837 |
DONE; |
| 1838 |
}) |
| 1839 |
|
| 1840 |
(define_expand "cstorehf4" |
| 1841 |
[(set (reg:CC FLAGS_REG) |
| 1842 |
(compare:CC (match_operand:HF 2 "cmp_fp_expander_operand") |
| 1843 |
(match_operand:HF 3 "cmp_fp_expander_operand"))) |
| 1844 |
(set (match_operand:QI 0 "register_operand") |
| 1845 |
(match_operator 1 "ix86_fp_comparison_operator" |
| 1846 |
[(reg:CC FLAGS_REG) |
| 1847 |
(const_int 0)]))] |
| 1848 |
"TARGET_AVX512FP16" |
| 1849 |
{ |
| 1850 |
ix86_expand_setcc (operands[0], GET_CODE (operands[1]), |
| 1851 |
operands[2], operands[3]); |
| 1852 |
DONE; |
| 1853 |
}) |
| 1854 |
|
| 1855 |
(define_expand "cstorebf4" |
| 1856 |
[(set (reg:CC FLAGS_REG) |
| 1857 |
(compare:CC (match_operand:BF 2 "cmp_fp_expander_operand") |
| 1858 |
(match_operand:BF 3 "cmp_fp_expander_operand"))) |
| 1859 |
(set (match_operand:QI 0 "register_operand") |
| 1860 |
(match_operator 1 "ix86_fp_comparison_operator" |
| 1861 |
[(reg:CC FLAGS_REG) |
| 1862 |
(const_int 0)]))] |
| 1863 |
"TARGET_80387 || (SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)" |
| 1864 |
{ |
| 1865 |
rtx op2 = operands[2], op3 = operands[3]; |
| 1866 |
if (!TARGET_AVX10_2 || flag_trapping_math) |
| 1867 |
{ |
| 1868 |
op2 = ix86_expand_fast_convert_bf_to_sf (operands[2]); |
| 1869 |
op3 = ix86_expand_fast_convert_bf_to_sf (operands[3]); |
| 1870 |
} |
| 1871 |
ix86_expand_setcc (operands[0], GET_CODE (operands[1]), |
| 1872 |
op2, op3); |
| 1873 |
DONE; |
| 1874 |
}) |
| 1875 |
|
| 1876 |
(define_expand "cstore<mode>4" |
| 1877 |
[(set (reg:CC FLAGS_REG) |
| 1878 |
(compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand") |
| 1879 |
(match_operand:MODEF 3 "cmp_fp_expander_operand"))) |
| 1880 |
(set (match_operand:QI 0 "register_operand") |
| 1881 |
(match_operator 1 "ix86_fp_comparison_operator" |
| 1882 |
[(reg:CC FLAGS_REG) |
| 1883 |
(const_int 0)]))] |
| 1884 |
"TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 1885 |
{ |
| 1886 |
ix86_expand_setcc (operands[0], GET_CODE (operands[1]), |
| 1887 |
operands[2], operands[3]); |
| 1888 |
DONE; |
| 1889 |
}) |
| 1890 |
|
| 1891 |
(define_expand "cbranchcc4" |
| 1892 |
[(set (pc) (if_then_else |
| 1893 |
(match_operator 0 "comparison_operator" |
| 1894 |
[(match_operand 1 "flags_reg_operand") |
| 1895 |
(match_operand 2 "const0_operand")]) |
| 1896 |
(label_ref (match_operand 3)) |
| 1897 |
(pc)))] |
| 1898 |
"" |
| 1899 |
{ |
| 1900 |
ix86_expand_branch (GET_CODE (operands[0]), |
| 1901 |
operands[1], operands[2], operands[3]); |
| 1902 |
DONE; |
| 1903 |
}) |
| 1904 |
|
| 1905 |
;; For conditonal compare, the middle-end hook will convert |
| 1906 |
;; CCmode to sub-CCmode using SELECT_CC_MODE macro and try |
| 1907 |
;; to find cstore<submodes> in optab. Add ALL_CC to support |
| 1908 |
;; the cstore after ccmp sequence. |
| 1909 |
|
| 1910 |
(define_mode_iterator ALL_CC |
| 1911 |
[CCGC CCGOC CCNO CCGZ CCA CCC CCO CCP CCS CCZ CC]) |
| 1912 |
|
| 1913 |
(define_expand "cstore<mode>4" |
| 1914 |
[(set (match_operand:QI 0 "register_operand") |
| 1915 |
(match_operator 1 "comparison_operator" |
| 1916 |
[(match_operand:ALL_CC 2 "flags_reg_operand") |
| 1917 |
(match_operand 3 "const0_operand")]))] |
| 1918 |
"" |
| 1919 |
{ |
| 1920 |
ix86_expand_setcc (operands[0], GET_CODE (operands[1]), |
| 1921 |
operands[2], operands[3]); |
| 1922 |
DONE; |
| 1923 |
}) |
| 1924 |
|
| 1925 |
;; FP compares, step 1: |
| 1926 |
;; Set the FP condition codes and move fpsr to ax. |
| 1927 |
|
| 1928 |
;; We may not use "#" to split and emit these |
| 1929 |
;; due to reg-stack pops killing fpsr. |
| 1930 |
|
| 1931 |
(define_insn "*cmpxf_i387" |
| 1932 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 1933 |
(unspec:HI |
| 1934 |
[(compare:CCFP |
| 1935 |
(match_operand:XF 1 "register_operand" "f") |
| 1936 |
(match_operand:XF 2 "reg_or_0_operand" "fC"))] |
| 1937 |
UNSPEC_FNSTSW))] |
| 1938 |
"TARGET_80387" |
| 1939 |
"* return output_fp_compare (insn, operands, false, false);" |
| 1940 |
[(set_attr "type" "multi") |
| 1941 |
(set_attr "unit" "i387") |
| 1942 |
(set_attr "mode" "XF")]) |
| 1943 |
|
| 1944 |
(define_insn "*cmp<mode>_i387" |
| 1945 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 1946 |
(unspec:HI |
| 1947 |
[(compare:CCFP |
| 1948 |
(match_operand:MODEF 1 "register_operand" "f") |
| 1949 |
(match_operand:MODEF 2 "nonimm_or_0_operand" "fmC"))] |
| 1950 |
UNSPEC_FNSTSW))] |
| 1951 |
"TARGET_80387" |
| 1952 |
"* return output_fp_compare (insn, operands, false, false);" |
| 1953 |
[(set_attr "type" "multi") |
| 1954 |
(set_attr "unit" "i387") |
| 1955 |
(set_attr "mode" "<MODE>")]) |
| 1956 |
|
| 1957 |
(define_insn "*cmp<X87MODEF:mode>_<SWI24:mode>_i387" |
| 1958 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 1959 |
(unspec:HI |
| 1960 |
[(compare:CCFP |
| 1961 |
(match_operand:X87MODEF 1 "register_operand" "f") |
| 1962 |
(float:X87MODEF |
| 1963 |
(match_operand:SWI24 2 "nonimmediate_operand" "m")))] |
| 1964 |
UNSPEC_FNSTSW))] |
| 1965 |
"TARGET_80387 |
| 1966 |
&& (TARGET_USE_<SWI24:MODE>MODE_FIOP |
| 1967 |
|| optimize_function_for_size_p (cfun))" |
| 1968 |
"* return output_fp_compare (insn, operands, false, false);" |
| 1969 |
[(set_attr "type" "multi") |
| 1970 |
(set_attr "unit" "i387") |
| 1971 |
(set_attr "fp_int_src" "true") |
| 1972 |
(set_attr "mode" "<SWI24:MODE>")]) |
| 1973 |
|
| 1974 |
(define_insn "*cmpu<mode>_i387" |
| 1975 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 1976 |
(unspec:HI |
| 1977 |
[(unspec:CCFP |
| 1978 |
[(compare:CCFP |
| 1979 |
(match_operand:X87MODEF 1 "register_operand" "f") |
| 1980 |
(match_operand:X87MODEF 2 "register_operand" "f"))] |
| 1981 |
UNSPEC_NOTRAP)] |
| 1982 |
UNSPEC_FNSTSW))] |
| 1983 |
"TARGET_80387" |
| 1984 |
"* return output_fp_compare (insn, operands, false, true);" |
| 1985 |
[(set_attr "type" "multi") |
| 1986 |
(set_attr "unit" "i387") |
| 1987 |
(set_attr "mode" "<MODE>")]) |
| 1988 |
|
| 1989 |
;; FP compares, step 2: |
| 1990 |
;; Get ax into flags, general case. |
| 1991 |
|
| 1992 |
(define_insn "x86_sahf_1" |
| 1993 |
[(set (reg:CC FLAGS_REG) |
| 1994 |
(unspec:CC [(match_operand:HI 0 "register_operand" "a")] |
| 1995 |
UNSPEC_SAHF))] |
| 1996 |
"TARGET_SAHF" |
| 1997 |
{ |
| 1998 |
#ifndef HAVE_AS_IX86_SAHF |
| 1999 |
if (TARGET_64BIT) |
| 2000 |
return ASM_BYTE "0x9e"; |
| 2001 |
else |
| 2002 |
#endif |
| 2003 |
return "sahf"; |
| 2004 |
} |
| 2005 |
[(set_attr "length" "1") |
| 2006 |
(set_attr "athlon_decode" "vector") |
| 2007 |
(set_attr "amdfam10_decode" "direct") |
| 2008 |
(set_attr "bdver1_decode" "direct") |
| 2009 |
(set_attr "mode" "SI")]) |
| 2010 |
|
| 2011 |
;; Pentium Pro can do both steps in one go. |
| 2012 |
;; (these instructions set flags directly) |
| 2013 |
|
| 2014 |
(define_subst_attr "unord" "unord_subst" "" "u") |
| 2015 |
(define_subst_attr "unordered" "unord_subst" "false" "true") |
| 2016 |
|
| 2017 |
(define_subst "unord_subst" |
| 2018 |
[(set (match_operand:CCFP 0) |
| 2019 |
(match_operand:CCFP 1))] |
| 2020 |
"" |
| 2021 |
[(set (match_dup 0) |
| 2022 |
(unspec:CCFP |
| 2023 |
[(match_dup 1)] |
| 2024 |
UNSPEC_NOTRAP))]) |
| 2025 |
|
| 2026 |
(define_insn "*cmpi<unord>xf_i387" |
| 2027 |
[(set (reg:CCFP FLAGS_REG) |
| 2028 |
(compare:CCFP |
| 2029 |
(match_operand:XF 0 "register_operand" "f") |
| 2030 |
(match_operand:XF 1 "register_operand" "f")))] |
| 2031 |
"TARGET_80387 && TARGET_CMOVE" |
| 2032 |
"* return output_fp_compare (insn, operands, true, <unordered>);" |
| 2033 |
[(set_attr "type" "fcmp") |
| 2034 |
(set_attr "mode" "XF") |
| 2035 |
(set_attr "athlon_decode" "vector") |
| 2036 |
(set_attr "amdfam10_decode" "direct") |
| 2037 |
(set_attr "bdver1_decode" "double") |
| 2038 |
(set_attr "c86_decode" "double") |
| 2039 |
(set_attr "znver1_decode" "double")]) |
| 2040 |
|
| 2041 |
(define_insn "*cmpx<unord><MODEF:mode>" |
| 2042 |
[(set (reg:CCFP FLAGS_REG) |
| 2043 |
(unspec:CCFP [ |
| 2044 |
(compare:CCFP |
| 2045 |
(match_operand:MODEF 0 "register_operand" "v") |
| 2046 |
(match_operand:MODEF 1 "nonimmediate_operand" "vm"))] |
| 2047 |
UNSPEC_OPTCOMX))] |
| 2048 |
"TARGET_AVX10_2" |
| 2049 |
"%v<unord>comx<MODEF:ssemodesuffix>\t{%1, %0|%0, %1}" |
| 2050 |
[(set_attr "type" "ssecomi") |
| 2051 |
(set_attr "prefix" "evex") |
| 2052 |
(set_attr "mode" "<MODEF:MODE>")]) |
| 2053 |
|
| 2054 |
(define_insn "*cmpx<unord>hf" |
| 2055 |
[(set (reg:CCFP FLAGS_REG) |
| 2056 |
(unspec:CCFP [ |
| 2057 |
(compare:CCFP |
| 2058 |
(match_operand:HF 0 "register_operand" "v") |
| 2059 |
(match_operand:HF 1 "nonimmediate_operand" "vm"))] |
| 2060 |
UNSPEC_OPTCOMX))] |
| 2061 |
"TARGET_AVX10_2" |
| 2062 |
"v<unord>comxsh\t{%1, %0|%0, %1}" |
| 2063 |
[(set_attr "type" "ssecomi") |
| 2064 |
(set_attr "prefix" "evex") |
| 2065 |
(set_attr "mode" "HF")]) |
| 2066 |
|
| 2067 |
(define_insn "*cmpi<unord><MODEF:mode>" |
| 2068 |
[(set (reg:CCFP FLAGS_REG) |
| 2069 |
(compare:CCFP |
| 2070 |
(match_operand:MODEF 0 "register_operand" "f,v") |
| 2071 |
(match_operand:MODEF 1 "register_ssemem_operand" "f,vm")))] |
| 2072 |
"(SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH) |
| 2073 |
|| (TARGET_80387 && TARGET_CMOVE)" |
| 2074 |
"@ |
| 2075 |
* return output_fp_compare (insn, operands, true, <unordered>); |
| 2076 |
%v<unord>comi<MODEF:ssemodesuffix>\t{%1, %0|%0, %1}" |
| 2077 |
[(set_attr "type" "fcmp,ssecomi") |
| 2078 |
(set_attr "prefix" "orig,maybe_vex") |
| 2079 |
(set_attr "mode" "<MODEF:MODE>") |
| 2080 |
(set_attr "prefix_rep" "*,0") |
| 2081 |
(set (attr "prefix_data16") |
| 2082 |
(cond [(eq_attr "alternative" "0") |
| 2083 |
(const_string "*") |
| 2084 |
(eq_attr "mode" "DF") |
| 2085 |
(const_string "1") |
| 2086 |
] |
| 2087 |
(const_string "0"))) |
| 2088 |
(set_attr "athlon_decode" "vector") |
| 2089 |
(set_attr "amdfam10_decode" "direct") |
| 2090 |
(set_attr "bdver1_decode" "double") |
| 2091 |
(set_attr "znver1_decode" "double") |
| 2092 |
(set_attr "c86_decode" "double") |
| 2093 |
(set (attr "enabled") |
| 2094 |
(if_then_else |
| 2095 |
(match_test ("SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH")) |
| 2096 |
(if_then_else |
| 2097 |
(eq_attr "alternative" "0") |
| 2098 |
(symbol_ref "TARGET_MIX_SSE_I387") |
| 2099 |
(symbol_ref "true")) |
| 2100 |
(if_then_else |
| 2101 |
(eq_attr "alternative" "0") |
| 2102 |
(symbol_ref "true") |
| 2103 |
(symbol_ref "false"))))]) |
| 2104 |
|
| 2105 |
(define_insn "*cmpi<unord>hf" |
| 2106 |
[(set (reg:CCFP FLAGS_REG) |
| 2107 |
(compare:CCFP |
| 2108 |
(match_operand:HF 0 "register_operand" "v") |
| 2109 |
(match_operand:HF 1 "nonimmediate_operand" "vm")))] |
| 2110 |
"TARGET_AVX512FP16" |
| 2111 |
"v<unord>comish\t{%1, %0|%0, %1}" |
| 2112 |
[(set_attr "type" "ssecomi") |
| 2113 |
(set_attr "prefix" "evex") |
| 2114 |
(set_attr "mode" "HF")]) |
| 2115 |
|
| 2116 |
(define_insn "*cmpibf" |
| 2117 |
[(set (reg:CCFP FLAGS_REG) |
| 2118 |
(compare:CCFP |
| 2119 |
(match_operand:BF 0 "register_operand" "v") |
| 2120 |
(match_operand:BF 1 "nonimmediate_operand" "vm")))] |
| 2121 |
"TARGET_AVX10_2" |
| 2122 |
"vcomisbf16\t{%1, %0|%0, %1}" |
| 2123 |
[(set_attr "type" "ssecomi") |
| 2124 |
(set_attr "prefix" "evex") |
| 2125 |
(set_attr "mode" "BF")]) |
| 2126 |
|
| 2127 |
;; Set carry flag. |
| 2128 |
(define_insn "x86_stc" |
| 2129 |
[(set (reg:CCC FLAGS_REG) (unspec:CCC [(const_int 0)] UNSPEC_STC))] |
| 2130 |
"" |
| 2131 |
"stc" |
| 2132 |
[(set_attr "length" "1") |
| 2133 |
(set_attr "length_immediate" "0") |
| 2134 |
(set_attr "modrm" "0")]) |
| 2135 |
|
| 2136 |
;; On Pentium 4, set the carry flag using mov $1,%al;addb $-1,%al. |
| 2137 |
(define_peephole2 |
| 2138 |
[(match_scratch:QI 0 "r") |
| 2139 |
(set (reg:CCC FLAGS_REG) (unspec:CCC [(const_int 0)] UNSPEC_STC))] |
| 2140 |
"TARGET_SLOW_STC && !optimize_insn_for_size_p ()" |
| 2141 |
[(set (match_dup 0) (const_int 1)) |
| 2142 |
(parallel |
| 2143 |
[(set (reg:CCC FLAGS_REG) |
| 2144 |
(compare:CCC (plus:QI (match_dup 0) (const_int -1)) |
| 2145 |
(match_dup 0))) |
| 2146 |
(set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))])]) |
| 2147 |
|
| 2148 |
;; Complement carry flag. |
| 2149 |
(define_insn "*x86_cmc" |
| 2150 |
[(set (reg:CCC FLAGS_REG) |
| 2151 |
(compare:CCC (neg:QI (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 2152 |
(geu:QI (reg:CCC FLAGS_REG) (const_int 0))))] |
| 2153 |
"" |
| 2154 |
"cmc" |
| 2155 |
[(set_attr "length" "1") |
| 2156 |
(set_attr "length_immediate" "0") |
| 2157 |
(set_attr "use_carry" "1") |
| 2158 |
(set_attr "modrm" "0")]) |
| 2159 |
|
| 2160 |
;; On Pentium 4, cmc is replaced with setnc %al;addb $-1,%al. |
| 2161 |
(define_peephole2 |
| 2162 |
[(match_scratch:QI 0 "r") |
| 2163 |
(set (reg:CCC FLAGS_REG) |
| 2164 |
(compare:CCC (neg:QI (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 2165 |
(geu:QI (reg:CCC FLAGS_REG) (const_int 0))))] |
| 2166 |
"TARGET_SLOW_STC && !optimize_insn_for_size_p ()" |
| 2167 |
[(set (match_dup 0) (ne:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 2168 |
(parallel |
| 2169 |
[(set (reg:CCC FLAGS_REG) |
| 2170 |
(compare:CCC (plus:QI (match_dup 0) (const_int -1)) |
| 2171 |
(match_dup 0))) |
| 2172 |
(set (match_dup 0) (plus:QI (match_dup 0) (const_int -1)))])]) |
| 2173 |
|
| 2174 |
;; Push/pop instructions. |
| 2175 |
|
| 2176 |
(define_insn_and_split "*pushv1ti2" |
| 2177 |
[(set (match_operand:V1TI 0 "push_operand" "=<") |
| 2178 |
(match_operand:V1TI 1 "register_operand" "v"))] |
| 2179 |
"TARGET_64BIT && TARGET_STV" |
| 2180 |
"#" |
| 2181 |
"&& reload_completed" |
| 2182 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) |
| 2183 |
(set (match_dup 0) (match_dup 1))] |
| 2184 |
{ |
| 2185 |
operands[2] = GEN_INT (-PUSH_ROUNDING (GET_MODE_SIZE (V1TImode))); |
| 2186 |
/* Preserve memory attributes. */ |
| 2187 |
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); |
| 2188 |
} |
| 2189 |
[(set_attr "type" "multi") |
| 2190 |
(set_attr "mode" "TI")]) |
| 2191 |
|
| 2192 |
(define_insn "*push<mode>2" |
| 2193 |
[(set (match_operand:DWI 0 "push_operand" "=<,<") |
| 2194 |
(match_operand:DWI 1 "general_no_elim_operand" "riF*o,*v"))] |
| 2195 |
"" |
| 2196 |
"#" |
| 2197 |
[(set_attr "type" "multi") |
| 2198 |
(set_attr "mode" "<MODE>")]) |
| 2199 |
|
| 2200 |
(define_split |
| 2201 |
[(set (match_operand:DWI 0 "push_operand") |
| 2202 |
(match_operand:DWI 1 "general_gr_operand"))] |
| 2203 |
"reload_completed" |
| 2204 |
[(const_int 0)] |
| 2205 |
"ix86_split_long_move (operands); DONE;") |
| 2206 |
|
| 2207 |
(define_insn "*pushdi2_rex64" |
| 2208 |
[(set (match_operand:DI 0 "push_operand" "=<,<,!<") |
| 2209 |
(match_operand:DI 1 "general_no_elim_operand" "re*m,*v,n"))] |
| 2210 |
"TARGET_64BIT" |
| 2211 |
"@ |
| 2212 |
push{q}\t%1 |
| 2213 |
# |
| 2214 |
#" |
| 2215 |
[(set_attr "type" "push,multi,multi") |
| 2216 |
(set_attr "mode" "DI")]) |
| 2217 |
|
| 2218 |
;; Convert impossible pushes of immediate to existing instructions. |
| 2219 |
;; First try to get scratch register and go through it. In case this |
| 2220 |
;; fails, push sign extended lower part first and then overwrite |
| 2221 |
;; upper part by 32bit move. |
| 2222 |
|
| 2223 |
(define_peephole2 |
| 2224 |
[(match_scratch:DI 2 "r") |
| 2225 |
(set (match_operand:DI 0 "push_operand") |
| 2226 |
(match_operand:DI 1 "immediate_operand"))] |
| 2227 |
"TARGET_64BIT |
| 2228 |
&& !symbolic_operand (operands[1], DImode) |
| 2229 |
&& !x86_64_immediate_operand (operands[1], DImode)" |
| 2230 |
[(set (match_dup 2) (match_dup 1)) |
| 2231 |
(set (match_dup 0) (match_dup 2))]) |
| 2232 |
|
| 2233 |
(define_split |
| 2234 |
[(set (match_operand:DI 0 "push_operand") |
| 2235 |
(match_operand:DI 1 "immediate_operand"))] |
| 2236 |
"TARGET_64BIT && epilogue_completed |
| 2237 |
&& !symbolic_operand (operands[1], DImode) |
| 2238 |
&& !x86_64_immediate_operand (operands[1], DImode)" |
| 2239 |
[(set (match_dup 0) (match_dup 1)) |
| 2240 |
(set (match_dup 2) (match_dup 3))] |
| 2241 |
{ |
| 2242 |
split_double_mode (DImode, &operands[1], 1, &operands[2], &operands[3]); |
| 2243 |
|
| 2244 |
operands[1] = gen_lowpart (DImode, operands[2]); |
| 2245 |
operands[2] = gen_rtx_MEM (SImode, |
| 2246 |
plus_constant (Pmode, stack_pointer_rtx, 4)); |
| 2247 |
}) |
| 2248 |
|
| 2249 |
;; For TARGET_64BIT we always round up to 8 bytes. |
| 2250 |
(define_insn "*pushsi2_rex64" |
| 2251 |
[(set (match_operand:SI 0 "push_operand" "=X,X") |
| 2252 |
(match_operand:SI 1 "nonmemory_no_elim_operand" "re,*v"))] |
| 2253 |
"TARGET_64BIT" |
| 2254 |
"@ |
| 2255 |
push{q}\t%q1 |
| 2256 |
#" |
| 2257 |
[(set_attr "type" "push,multi") |
| 2258 |
(set_attr "mode" "DI")]) |
| 2259 |
|
| 2260 |
(define_insn "*pushsi2" |
| 2261 |
[(set (match_operand:SI 0 "push_operand" "=<,<") |
| 2262 |
(match_operand:SI 1 "general_no_elim_operand" "ri*m,*v"))] |
| 2263 |
"!TARGET_64BIT" |
| 2264 |
"@ |
| 2265 |
push{l}\t%1 |
| 2266 |
#" |
| 2267 |
[(set_attr "type" "push,multi") |
| 2268 |
(set_attr "mode" "SI")]) |
| 2269 |
|
| 2270 |
(define_split |
| 2271 |
[(set (match_operand:SWI48DWI 0 "push_operand") |
| 2272 |
(match_operand:SWI48DWI 1 "sse_reg_operand"))] |
| 2273 |
"TARGET_SSE && reload_completed" |
| 2274 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) |
| 2275 |
(set (match_dup 0) (match_dup 1))] |
| 2276 |
{ |
| 2277 |
operands[2] = GEN_INT (-PUSH_ROUNDING (GET_MODE_SIZE (<SWI48DWI:MODE>mode))); |
| 2278 |
/* Preserve memory attributes. */ |
| 2279 |
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); |
| 2280 |
}) |
| 2281 |
|
| 2282 |
;; emit_push_insn when it calls move_by_pieces requires an insn to |
| 2283 |
;; "push a byte/word". But actually we use push{l,q}, which has |
| 2284 |
;; the effect of rounding the amount pushed up to a word. |
| 2285 |
|
| 2286 |
(define_insn "*push<mode>2" |
| 2287 |
[(set (match_operand:SWI12 0 "push_operand" "=X") |
| 2288 |
(match_operand:SWI12 1 "nonmemory_no_elim_operand" "rn"))] |
| 2289 |
"" |
| 2290 |
"* return TARGET_64BIT ? \"push{q}\t%q1\" : \"push{l}\t%k1\";" |
| 2291 |
[(set_attr "type" "push") |
| 2292 |
(set (attr "mode") |
| 2293 |
(if_then_else (match_test "TARGET_64BIT") |
| 2294 |
(const_string "DI") |
| 2295 |
(const_string "SI")))]) |
| 2296 |
|
| 2297 |
(define_insn "*push<mode>2_prologue" |
| 2298 |
[(set (match_operand:W 0 "push_operand" "=<") |
| 2299 |
(match_operand:W 1 "general_no_elim_operand" "r<i>*m")) |
| 2300 |
(clobber (mem:BLK (scratch)))] |
| 2301 |
"" |
| 2302 |
"push{<imodesuffix>}\t%1" |
| 2303 |
[(set_attr "type" "push") |
| 2304 |
(set_attr "mode" "<MODE>")]) |
| 2305 |
|
| 2306 |
(define_insn "*pop<mode>1" |
| 2307 |
[(set (match_operand:W 0 "nonimmediate_operand" "=r*m") |
| 2308 |
(match_operand:W 1 "pop_operand" ">"))] |
| 2309 |
"" |
| 2310 |
"pop{<imodesuffix>}\t%0" |
| 2311 |
[(set_attr "type" "pop") |
| 2312 |
(set_attr "mode" "<MODE>")]) |
| 2313 |
|
| 2314 |
(define_insn "*pop<mode>1_epilogue" |
| 2315 |
[(set (match_operand:W 0 "nonimmediate_operand" "=r*m") |
| 2316 |
(match_operand:W 1 "pop_operand" ">")) |
| 2317 |
(clobber (mem:BLK (scratch)))] |
| 2318 |
"" |
| 2319 |
"pop{<imodesuffix>}\t%0" |
| 2320 |
[(set_attr "type" "pop") |
| 2321 |
(set_attr "mode" "<MODE>")]) |
| 2322 |
|
| 2323 |
(define_insn "@pushfl<mode>2" |
| 2324 |
[(set (match_operand:W 0 "push_operand" "=<") |
| 2325 |
(unspec:W [(match_operand 1 "flags_reg_operand")] |
| 2326 |
UNSPEC_PUSHFL))] |
| 2327 |
"GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_CC" |
| 2328 |
"pushf{<imodesuffix>}" |
| 2329 |
[(set_attr "type" "push") |
| 2330 |
(set_attr "mode" "<MODE>")]) |
| 2331 |
|
| 2332 |
(define_insn "@popfl<mode>1" |
| 2333 |
[(set (match_operand:CC 0 "flags_reg_operand") |
| 2334 |
(unspec:CC [(match_operand:W 1 "pop_operand" ">")] |
| 2335 |
UNSPEC_POPFL))] |
| 2336 |
"" |
| 2337 |
"popf{<imodesuffix>}" |
| 2338 |
[(set_attr "type" "pop") |
| 2339 |
(set_attr "mode" "<MODE>")]) |
| 2340 |
|
| 2341 |
|
| 2342 |
;; Reload patterns to support multi-word load/store |
| 2343 |
;; with non-offsetable address. |
| 2344 |
(define_expand "reload_noff_store" |
| 2345 |
[(parallel [(match_operand 0 "memory_operand" "=m") |
| 2346 |
(match_operand 1 "register_operand" "r") |
| 2347 |
(match_operand:DI 2 "register_operand" "=&r")])] |
| 2348 |
"TARGET_64BIT" |
| 2349 |
{ |
| 2350 |
rtx mem = operands[0]; |
| 2351 |
rtx addr = XEXP (mem, 0); |
| 2352 |
|
| 2353 |
emit_move_insn (operands[2], addr); |
| 2354 |
mem = replace_equiv_address_nv (mem, operands[2]); |
| 2355 |
|
| 2356 |
emit_insn (gen_rtx_SET (mem, operands[1])); |
| 2357 |
DONE; |
| 2358 |
}) |
| 2359 |
|
| 2360 |
(define_expand "reload_noff_load" |
| 2361 |
[(parallel [(match_operand 0 "register_operand" "=r") |
| 2362 |
(match_operand 1 "memory_operand" "m") |
| 2363 |
(match_operand:DI 2 "register_operand" "=r")])] |
| 2364 |
"TARGET_64BIT" |
| 2365 |
{ |
| 2366 |
rtx mem = operands[1]; |
| 2367 |
rtx addr = XEXP (mem, 0); |
| 2368 |
|
| 2369 |
emit_move_insn (operands[2], addr); |
| 2370 |
mem = replace_equiv_address_nv (mem, operands[2]); |
| 2371 |
|
| 2372 |
emit_insn (gen_rtx_SET (operands[0], mem)); |
| 2373 |
DONE; |
| 2374 |
}) |
| 2375 |
|
| 2376 |
;; Move instructions. |
| 2377 |
|
| 2378 |
(define_expand "movxi" |
| 2379 |
[(set (match_operand:XI 0 "nonimmediate_operand") |
| 2380 |
(match_operand:XI 1 "general_operand"))] |
| 2381 |
"TARGET_AVX512F && TARGET_EVEX512" |
| 2382 |
"ix86_expand_vector_move (XImode, operands); DONE;") |
| 2383 |
|
| 2384 |
(define_expand "movoi" |
| 2385 |
[(set (match_operand:OI 0 "nonimmediate_operand") |
| 2386 |
(match_operand:OI 1 "general_operand"))] |
| 2387 |
"TARGET_AVX" |
| 2388 |
"ix86_expand_vector_move (OImode, operands); DONE;") |
| 2389 |
|
| 2390 |
(define_expand "movti" |
| 2391 |
[(set (match_operand:TI 0 "nonimmediate_operand") |
| 2392 |
(match_operand:TI 1 "general_operand"))] |
| 2393 |
"TARGET_64BIT || TARGET_SSE" |
| 2394 |
{ |
| 2395 |
if (TARGET_64BIT) |
| 2396 |
ix86_expand_move (TImode, operands); |
| 2397 |
else |
| 2398 |
ix86_expand_vector_move (TImode, operands); |
| 2399 |
DONE; |
| 2400 |
}) |
| 2401 |
|
| 2402 |
;; This expands to what emit_move_complex would generate if we didn't |
| 2403 |
;; have a movti pattern. Having this avoids problems with reload on |
| 2404 |
;; 32-bit targets when SSE is present, but doesn't seem to be harmful |
| 2405 |
;; to have around all the time. |
| 2406 |
(define_expand "movcdi" |
| 2407 |
[(set (match_operand:CDI 0 "nonimmediate_operand") |
| 2408 |
(match_operand:CDI 1 "general_operand"))] |
| 2409 |
"" |
| 2410 |
{ |
| 2411 |
if (push_operand (operands[0], CDImode)) |
| 2412 |
emit_move_complex_push (CDImode, operands[0], operands[1]); |
| 2413 |
else |
| 2414 |
emit_move_complex_parts (operands[0], operands[1]); |
| 2415 |
DONE; |
| 2416 |
}) |
| 2417 |
|
| 2418 |
(define_expand "mov<mode>" |
| 2419 |
[(set (match_operand:SWI1248x 0 "nonimmediate_operand") |
| 2420 |
(match_operand:SWI1248x 1 "general_operand"))] |
| 2421 |
"" |
| 2422 |
"ix86_expand_move (<MODE>mode, operands); DONE;") |
| 2423 |
|
| 2424 |
(define_insn "*mov<mode>_xor" |
| 2425 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 2426 |
(match_operand:SWI48 1 "const0_operand")) |
| 2427 |
(clobber (reg:CC FLAGS_REG))] |
| 2428 |
"reload_completed" |
| 2429 |
"xor{l}\t%k0, %k0" |
| 2430 |
[(set_attr "type" "alu1") |
| 2431 |
(set_attr "mode" "SI") |
| 2432 |
(set_attr "length_immediate" "0")]) |
| 2433 |
|
| 2434 |
;; Generate shorter "and $0,mem" for -Oz. Split it to "mov $0,mem" |
| 2435 |
;; otherwise. |
| 2436 |
(define_insn_and_split "*mov<mode>_and" |
| 2437 |
[(set (match_operand:SWI248 0 "memory_operand" "=m") |
| 2438 |
(match_operand:SWI248 1 "const0_operand")) |
| 2439 |
(clobber (reg:CC FLAGS_REG))] |
| 2440 |
"reload_completed" |
| 2441 |
"and{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 2442 |
"&& !(optimize_insn_for_size_p () && optimize_size > 1)" |
| 2443 |
[(set (match_dup 0) (match_dup 1))] |
| 2444 |
"" |
| 2445 |
[(set_attr "type" "alu1") |
| 2446 |
(set_attr "mode" "<MODE>") |
| 2447 |
(set_attr "length_immediate" "1")]) |
| 2448 |
|
| 2449 |
;; Generate shorter "or $-1,mem" for -Oz. Split it to "mov $-1,mem" |
| 2450 |
;; otherwise. |
| 2451 |
(define_insn_and_split "*mov<mode>_or" |
| 2452 |
[(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm") |
| 2453 |
(match_operand:SWI248 1 "constm1_operand")) |
| 2454 |
(clobber (reg:CC FLAGS_REG))] |
| 2455 |
"reload_completed" |
| 2456 |
"or{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 2457 |
"&& !(optimize_insn_for_size_p () && optimize_size > 1)" |
| 2458 |
[(set (match_dup 0) (match_dup 1))] |
| 2459 |
"" |
| 2460 |
[(set_attr "type" "alu1") |
| 2461 |
(set_attr "mode" "<MODE>") |
| 2462 |
(set_attr "length_immediate" "1")]) |
| 2463 |
|
| 2464 |
(define_insn "*movxi_internal_avx512f" |
| 2465 |
[(set (match_operand:XI 0 "nonimmediate_operand" "=v,v ,v ,m") |
| 2466 |
(match_operand:XI 1 "nonimmediate_or_sse_const_operand" " C,BC,vm,v"))] |
| 2467 |
"TARGET_AVX512F && TARGET_EVEX512 |
| 2468 |
&& (register_operand (operands[0], XImode) |
| 2469 |
|| register_operand (operands[1], XImode))" |
| 2470 |
{ |
| 2471 |
switch (get_attr_type (insn)) |
| 2472 |
{ |
| 2473 |
case TYPE_SSELOG1: |
| 2474 |
return standard_sse_constant_opcode (insn, operands); |
| 2475 |
|
| 2476 |
case TYPE_SSEMOV: |
| 2477 |
return ix86_output_ssemov (insn, operands); |
| 2478 |
|
| 2479 |
default: |
| 2480 |
gcc_unreachable (); |
| 2481 |
} |
| 2482 |
} |
| 2483 |
[(set_attr "type" "sselog1,sselog1,ssemov,ssemov") |
| 2484 |
(set_attr "c86_attr" "sselogic,sselogic,*,*") |
| 2485 |
(set_attr "prefix" "evex") |
| 2486 |
(set_attr "mode" "XI")]) |
| 2487 |
|
| 2488 |
(define_insn "*movoi_internal_avx" |
| 2489 |
[(set (match_operand:OI 0 "nonimmediate_operand" "=v,v ,v ,m") |
| 2490 |
(match_operand:OI 1 "nonimmediate_or_sse_const_operand" " C,BC,vm,v"))] |
| 2491 |
"TARGET_AVX |
| 2492 |
&& (register_operand (operands[0], OImode) |
| 2493 |
|| register_operand (operands[1], OImode))" |
| 2494 |
{ |
| 2495 |
switch (get_attr_type (insn)) |
| 2496 |
{ |
| 2497 |
case TYPE_SSELOG1: |
| 2498 |
return standard_sse_constant_opcode (insn, operands); |
| 2499 |
|
| 2500 |
case TYPE_SSEMOV: |
| 2501 |
return ix86_output_ssemov (insn, operands); |
| 2502 |
|
| 2503 |
default: |
| 2504 |
gcc_unreachable (); |
| 2505 |
} |
| 2506 |
} |
| 2507 |
[(set_attr "isa" "*,avx2,*,*") |
| 2508 |
(set_attr "type" "sselog1,sselog1,ssemov,ssemov") |
| 2509 |
(set_attr "c86_attr" "sselogic,sselogic,*,*") |
| 2510 |
(set_attr "prefix" "vex") |
| 2511 |
(set_attr "mode" "OI")]) |
| 2512 |
|
| 2513 |
(define_insn "*movti_internal" |
| 2514 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=!r ,o ,v,v ,v ,m,?jc,?Yd") |
| 2515 |
(match_operand:TI 1 "general_operand" "riFo,re,C,BC,vm,v,Yd,jc"))] |
| 2516 |
"(TARGET_64BIT |
| 2517 |
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))) |
| 2518 |
|| (TARGET_SSE |
| 2519 |
&& nonimmediate_or_sse_const_operand (operands[1], TImode) |
| 2520 |
&& (register_operand (operands[0], TImode) |
| 2521 |
|| register_operand (operands[1], TImode)))" |
| 2522 |
{ |
| 2523 |
switch (get_attr_type (insn)) |
| 2524 |
{ |
| 2525 |
case TYPE_MULTI: |
| 2526 |
return "#"; |
| 2527 |
|
| 2528 |
case TYPE_SSELOG1: |
| 2529 |
return standard_sse_constant_opcode (insn, operands); |
| 2530 |
|
| 2531 |
case TYPE_SSEMOV: |
| 2532 |
return ix86_output_ssemov (insn, operands); |
| 2533 |
|
| 2534 |
default: |
| 2535 |
gcc_unreachable (); |
| 2536 |
} |
| 2537 |
} |
| 2538 |
[(set (attr "isa") |
| 2539 |
(cond [(eq_attr "alternative" "0,1,6,7") |
| 2540 |
(const_string "x64") |
| 2541 |
(eq_attr "alternative" "3") |
| 2542 |
(const_string "sse2") |
| 2543 |
] |
| 2544 |
(const_string "*"))) |
| 2545 |
(set (attr "type") |
| 2546 |
(cond [(eq_attr "alternative" "0,1,6,7") |
| 2547 |
(const_string "multi") |
| 2548 |
(eq_attr "alternative" "2,3") |
| 2549 |
(const_string "sselog1") |
| 2550 |
] |
| 2551 |
(const_string "ssemov"))) |
| 2552 |
(set (attr "c86_attr") |
| 2553 |
(if_then_else (eq_attr "alternative" "2,3") |
| 2554 |
(const_string "sselogic") |
| 2555 |
(const_string "*"))) |
| 2556 |
(set (attr "prefix") |
| 2557 |
(if_then_else (eq_attr "type" "sselog1,ssemov") |
| 2558 |
(const_string "maybe_vex") |
| 2559 |
(const_string "orig"))) |
| 2560 |
(set (attr "mode") |
| 2561 |
(cond [(eq_attr "alternative" "0,1") |
| 2562 |
(const_string "DI") |
| 2563 |
(match_test "TARGET_AVX") |
| 2564 |
(const_string "TI") |
| 2565 |
(ior (not (match_test "TARGET_SSE2")) |
| 2566 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 2567 |
(const_string "V4SF") |
| 2568 |
(and (eq_attr "alternative" "5") |
| 2569 |
(match_test "TARGET_SSE_TYPELESS_STORES")) |
| 2570 |
(const_string "V4SF") |
| 2571 |
] |
| 2572 |
(const_string "TI"))) |
| 2573 |
(set (attr "preferred_for_speed") |
| 2574 |
(cond [(eq_attr "alternative" "6") |
| 2575 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 2576 |
(eq_attr "alternative" "7") |
| 2577 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 2578 |
] |
| 2579 |
(symbol_ref "true")))]) |
| 2580 |
|
| 2581 |
(define_split |
| 2582 |
[(set (match_operand:TI 0 "sse_reg_operand") |
| 2583 |
(match_operand:TI 1 "general_reg_operand"))] |
| 2584 |
"TARGET_64BIT && TARGET_SSE4_1 |
| 2585 |
&& reload_completed" |
| 2586 |
[(set (match_dup 2) |
| 2587 |
(vec_merge:V2DI |
| 2588 |
(vec_duplicate:V2DI (match_dup 3)) |
| 2589 |
(match_dup 2) |
| 2590 |
(const_int 2)))] |
| 2591 |
{ |
| 2592 |
operands[2] = lowpart_subreg (V2DImode, operands[0], TImode); |
| 2593 |
operands[3] = gen_highpart (DImode, operands[1]); |
| 2594 |
|
| 2595 |
emit_move_insn (gen_lowpart (DImode, operands[0]), |
| 2596 |
gen_lowpart (DImode, operands[1])); |
| 2597 |
}) |
| 2598 |
|
| 2599 |
(define_insn "*movdi_internal" |
| 2600 |
[(set (match_operand:DI 0 "nonimmediate_operand" |
| 2601 |
"=r ,o ,r,r ,r,m ,*y,*y,?*y,?m,?r,?*y,?Yv,?v,?v,m ,m,?jc,?*Yd,?r,?v,?*y,?*x,*k,*k ,*r,*m,*k") |
| 2602 |
(match_operand:DI 1 "general_operand" |
| 2603 |
"riFo,riF,Z,rem,i,re,C ,*y,Bk ,*y,*y,r ,C ,?v,Bk,?v,v,*Yd,jc ,?v,r ,*x ,*y ,*r,*kBk,*k,*k,CBC"))] |
| 2604 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 2605 |
&& ix86_hardreg_mov_ok (operands[0], operands[1])" |
| 2606 |
{ |
| 2607 |
switch (get_attr_type (insn)) |
| 2608 |
{ |
| 2609 |
case TYPE_MSKMOV: |
| 2610 |
return "kmovq\t{%1, %0|%0, %1}"; |
| 2611 |
|
| 2612 |
case TYPE_MSKLOG: |
| 2613 |
if (operands[1] == const0_rtx) |
| 2614 |
return "kxorq\t%0, %0, %0"; |
| 2615 |
else if (operands[1] == constm1_rtx) |
| 2616 |
return "kxnorq\t%0, %0, %0"; |
| 2617 |
gcc_unreachable (); |
| 2618 |
|
| 2619 |
case TYPE_MULTI: |
| 2620 |
return "#"; |
| 2621 |
|
| 2622 |
case TYPE_MMX: |
| 2623 |
return "pxor\t%0, %0"; |
| 2624 |
|
| 2625 |
case TYPE_MMXMOV: |
| 2626 |
/* Handle broken assemblers that require movd instead of movq. */ |
| 2627 |
if (!HAVE_AS_IX86_INTERUNIT_MOVQ |
| 2628 |
&& (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1]))) |
| 2629 |
return "movd\t{%1, %0|%0, %1}"; |
| 2630 |
return "movq\t{%1, %0|%0, %1}"; |
| 2631 |
|
| 2632 |
case TYPE_SSELOG1: |
| 2633 |
return standard_sse_constant_opcode (insn, operands); |
| 2634 |
|
| 2635 |
case TYPE_SSEMOV: |
| 2636 |
return ix86_output_ssemov (insn, operands); |
| 2637 |
|
| 2638 |
case TYPE_SSECVT: |
| 2639 |
if (SSE_REG_P (operands[0])) |
| 2640 |
return "movq2dq\t{%1, %0|%0, %1}"; |
| 2641 |
else |
| 2642 |
return "movdq2q\t{%1, %0|%0, %1}"; |
| 2643 |
|
| 2644 |
case TYPE_LEA: |
| 2645 |
return "lea{q}\t{%E1, %0|%0, %E1}"; |
| 2646 |
|
| 2647 |
case TYPE_IMOV: |
| 2648 |
gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1])); |
| 2649 |
if (get_attr_mode (insn) == MODE_SI) |
| 2650 |
return "mov{l}\t{%k1, %k0|%k0, %k1}"; |
| 2651 |
else if (which_alternative == 4) |
| 2652 |
return "movabs{q}\t{%1, %0|%0, %1}"; |
| 2653 |
else if (ix86_use_lea_for_mov (insn, operands)) |
| 2654 |
return "lea{q}\t{%E1, %0|%0, %E1}"; |
| 2655 |
else |
| 2656 |
return "mov{q}\t{%1, %0|%0, %1}"; |
| 2657 |
|
| 2658 |
default: |
| 2659 |
gcc_unreachable (); |
| 2660 |
} |
| 2661 |
} |
| 2662 |
[(set (attr "isa") |
| 2663 |
(cond [(eq_attr "alternative" "0,1,17,18") |
| 2664 |
(const_string "nox64") |
| 2665 |
(eq_attr "alternative" "2,3,4,5,10,11") |
| 2666 |
(const_string "x64") |
| 2667 |
(eq_attr "alternative" "19,20") |
| 2668 |
(const_string "x64_sse2") |
| 2669 |
(eq_attr "alternative" "21,22") |
| 2670 |
(const_string "sse2") |
| 2671 |
(eq_attr "alternative" "23,25") |
| 2672 |
(const_string "x64_avx512bw") |
| 2673 |
(eq_attr "alternative" "24,26,27") |
| 2674 |
(const_string "avx512bw") |
| 2675 |
] |
| 2676 |
(const_string "*"))) |
| 2677 |
(set (attr "type") |
| 2678 |
(cond [(eq_attr "alternative" "0,1,17,18") |
| 2679 |
(const_string "multi") |
| 2680 |
(eq_attr "alternative" "6") |
| 2681 |
(const_string "mmx") |
| 2682 |
(eq_attr "alternative" "7,8,9,10,11") |
| 2683 |
(const_string "mmxmov") |
| 2684 |
(eq_attr "alternative" "12") |
| 2685 |
(const_string "sselog1") |
| 2686 |
(eq_attr "alternative" "13,14,15,16,19,20") |
| 2687 |
(const_string "ssemov") |
| 2688 |
(eq_attr "alternative" "21,22") |
| 2689 |
(const_string "ssecvt") |
| 2690 |
(eq_attr "alternative" "23,24,25,26") |
| 2691 |
(const_string "mskmov") |
| 2692 |
(eq_attr "alternative" "27") |
| 2693 |
(const_string "msklog") |
| 2694 |
(and (match_operand 0 "register_operand") |
| 2695 |
(match_operand 1 "pic_32bit_operand")) |
| 2696 |
(const_string "lea") |
| 2697 |
] |
| 2698 |
(const_string "imov"))) |
| 2699 |
(set (attr "c86_attr") |
| 2700 |
(if_then_else (eq_attr "alternative" "12") |
| 2701 |
(const_string "sselogic") |
| 2702 |
(const_string "*"))) |
| 2703 |
(set (attr "modrm") |
| 2704 |
(if_then_else |
| 2705 |
(and (eq_attr "alternative" "4") (eq_attr "type" "imov")) |
| 2706 |
(const_string "0") |
| 2707 |
(const_string "*"))) |
| 2708 |
(set (attr "length_immediate") |
| 2709 |
(if_then_else |
| 2710 |
(and (eq_attr "alternative" "4") (eq_attr "type" "imov")) |
| 2711 |
(const_string "8") |
| 2712 |
(const_string "*"))) |
| 2713 |
(set (attr "prefix_rex") |
| 2714 |
(if_then_else |
| 2715 |
(eq_attr "alternative" "10,11,19,20") |
| 2716 |
(const_string "1") |
| 2717 |
(const_string "*"))) |
| 2718 |
(set (attr "prefix") |
| 2719 |
(if_then_else (eq_attr "type" "sselog1,ssemov") |
| 2720 |
(const_string "maybe_vex") |
| 2721 |
(const_string "orig"))) |
| 2722 |
(set (attr "prefix_data16") |
| 2723 |
(if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "DI")) |
| 2724 |
(const_string "1") |
| 2725 |
(const_string "*"))) |
| 2726 |
(set (attr "mode") |
| 2727 |
(cond [(eq_attr "alternative" "2") |
| 2728 |
(const_string "SI") |
| 2729 |
(eq_attr "alternative" "12") |
| 2730 |
(cond [(match_test "TARGET_AVX") |
| 2731 |
(const_string "TI") |
| 2732 |
(ior (not (match_test "TARGET_SSE2")) |
| 2733 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 2734 |
(const_string "V4SF") |
| 2735 |
] |
| 2736 |
(const_string "TI")) |
| 2737 |
(eq_attr "alternative" "13") |
| 2738 |
(cond [(match_test "TARGET_AVX512VL") |
| 2739 |
(const_string "TI") |
| 2740 |
(match_test "TARGET_AVX512F") |
| 2741 |
(const_string "DF") |
| 2742 |
(match_test "TARGET_AVX") |
| 2743 |
(const_string "TI") |
| 2744 |
(ior (not (match_test "TARGET_SSE2")) |
| 2745 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 2746 |
(const_string "V4SF") |
| 2747 |
] |
| 2748 |
(const_string "TI")) |
| 2749 |
|
| 2750 |
(and (eq_attr "alternative" "14,15,16") |
| 2751 |
(not (match_test "TARGET_SSE2"))) |
| 2752 |
(const_string "V2SF") |
| 2753 |
] |
| 2754 |
(const_string "DI"))) |
| 2755 |
(set (attr "preferred_for_speed") |
| 2756 |
(cond [(eq_attr "alternative" "10,17,19") |
| 2757 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 2758 |
(eq_attr "alternative" "11,18,20") |
| 2759 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 2760 |
] |
| 2761 |
(symbol_ref "true"))) |
| 2762 |
(set (attr "enabled") |
| 2763 |
(cond [(eq_attr "alternative" "15") |
| 2764 |
(if_then_else |
| 2765 |
(match_test "TARGET_STV && TARGET_SSE2") |
| 2766 |
(symbol_ref "false") |
| 2767 |
(const_string "*")) |
| 2768 |
(eq_attr "alternative" "16") |
| 2769 |
(if_then_else |
| 2770 |
(match_test "TARGET_STV && TARGET_SSE2") |
| 2771 |
(symbol_ref "true") |
| 2772 |
(symbol_ref "false")) |
| 2773 |
] |
| 2774 |
(const_string "*")))]) |
| 2775 |
|
| 2776 |
(define_split |
| 2777 |
[(set (match_operand:<DWI> 0 "general_reg_operand") |
| 2778 |
(match_operand:<DWI> 1 "sse_reg_operand"))] |
| 2779 |
"TARGET_SSE4_1 |
| 2780 |
&& reload_completed" |
| 2781 |
[(set (match_dup 2) |
| 2782 |
(vec_select:DWIH |
| 2783 |
(match_dup 3) |
| 2784 |
(parallel [(const_int 1)])))] |
| 2785 |
{ |
| 2786 |
operands[2] = gen_highpart (<MODE>mode, operands[0]); |
| 2787 |
operands[3] = lowpart_subreg (<ssevecmode>mode, operands[1], <DWI>mode); |
| 2788 |
|
| 2789 |
emit_move_insn (gen_lowpart (<MODE>mode, operands[0]), |
| 2790 |
gen_lowpart (<MODE>mode, operands[1])); |
| 2791 |
}) |
| 2792 |
|
| 2793 |
(define_split |
| 2794 |
[(set (match_operand:DWI 0 "nonimmediate_gr_operand") |
| 2795 |
(match_operand:DWI 1 "general_gr_operand"))] |
| 2796 |
"reload_completed" |
| 2797 |
[(const_int 0)] |
| 2798 |
"ix86_split_long_move (operands); DONE;") |
| 2799 |
|
| 2800 |
(define_split |
| 2801 |
[(set (match_operand:DI 0 "sse_reg_operand") |
| 2802 |
(match_operand:DI 1 "general_reg_operand"))] |
| 2803 |
"!TARGET_64BIT && TARGET_SSE4_1 |
| 2804 |
&& reload_completed" |
| 2805 |
[(set (match_dup 2) |
| 2806 |
(vec_merge:V4SI |
| 2807 |
(vec_duplicate:V4SI (match_dup 3)) |
| 2808 |
(match_dup 2) |
| 2809 |
(const_int 2)))] |
| 2810 |
{ |
| 2811 |
operands[2] = lowpart_subreg (V4SImode, operands[0], DImode); |
| 2812 |
operands[3] = gen_highpart (SImode, operands[1]); |
| 2813 |
|
| 2814 |
emit_move_insn (gen_lowpart (SImode, operands[0]), |
| 2815 |
gen_lowpart (SImode, operands[1])); |
| 2816 |
}) |
| 2817 |
|
| 2818 |
;; movabsq $0x0012345678000000, %rax is longer |
| 2819 |
;; than movl $0x12345678, %eax; shlq $24, %rax. |
| 2820 |
(define_peephole2 |
| 2821 |
[(set (match_operand:DI 0 "register_operand") |
| 2822 |
(match_operand:DI 1 "const_int_operand"))] |
| 2823 |
"TARGET_64BIT |
| 2824 |
&& optimize_insn_for_size_p () |
| 2825 |
&& LEGACY_INT_REG_P (operands[0]) |
| 2826 |
&& !x86_64_immediate_operand (operands[1], DImode) |
| 2827 |
&& !x86_64_zext_immediate_operand (operands[1], DImode) |
| 2828 |
&& !((UINTVAL (operands[1]) >> ctz_hwi (UINTVAL (operands[1]))) |
| 2829 |
& ~HOST_WIDE_INT_C (0xffffffff)) |
| 2830 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 2831 |
[(set (match_dup 0) (match_dup 1)) |
| 2832 |
(parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2))) |
| 2833 |
(clobber (reg:CC FLAGS_REG))])] |
| 2834 |
{ |
| 2835 |
int shift = ctz_hwi (UINTVAL (operands[1])); |
| 2836 |
rtx op1 = gen_int_mode (UINTVAL (operands[1]) >> shift, DImode); |
| 2837 |
if (ix86_endbr_immediate_operand (op1, VOIDmode)) |
| 2838 |
FAIL; |
| 2839 |
operands[1] = op1; |
| 2840 |
operands[2] = gen_int_mode (shift, QImode); |
| 2841 |
}) |
| 2842 |
|
| 2843 |
(define_insn "*movsi_internal" |
| 2844 |
[(set (match_operand:SI 0 "nonimmediate_operand" |
| 2845 |
"=r,m ,*y,*y,?*y,?m,?r,?*y,?Yv,?v,?v,m ,?r,?v,*k,*k ,*rm,*k") |
| 2846 |
(match_operand:SI 1 "general_operand" |
| 2847 |
"g ,re,C ,*y,Bk ,*y,*y,r ,C ,?v,Bk,?v,?v,r ,*r,*kBk,*k ,CBC"))] |
| 2848 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 2849 |
&& ix86_hardreg_mov_ok (operands[0], operands[1])" |
| 2850 |
{ |
| 2851 |
switch (get_attr_type (insn)) |
| 2852 |
{ |
| 2853 |
case TYPE_SSELOG1: |
| 2854 |
return standard_sse_constant_opcode (insn, operands); |
| 2855 |
|
| 2856 |
case TYPE_MSKMOV: |
| 2857 |
return "kmovd\t{%1, %0|%0, %1}"; |
| 2858 |
|
| 2859 |
case TYPE_MSKLOG: |
| 2860 |
if (operands[1] == const0_rtx) |
| 2861 |
return "kxord\t%0, %0, %0"; |
| 2862 |
else if (operands[1] == constm1_rtx) |
| 2863 |
return "kxnord\t%0, %0, %0"; |
| 2864 |
gcc_unreachable (); |
| 2865 |
|
| 2866 |
case TYPE_SSEMOV: |
| 2867 |
return ix86_output_ssemov (insn, operands); |
| 2868 |
|
| 2869 |
case TYPE_MMX: |
| 2870 |
return "pxor\t%0, %0"; |
| 2871 |
|
| 2872 |
case TYPE_MMXMOV: |
| 2873 |
switch (get_attr_mode (insn)) |
| 2874 |
{ |
| 2875 |
case MODE_DI: |
| 2876 |
return "movq\t{%1, %0|%0, %1}"; |
| 2877 |
case MODE_SI: |
| 2878 |
return "movd\t{%1, %0|%0, %1}"; |
| 2879 |
|
| 2880 |
default: |
| 2881 |
gcc_unreachable (); |
| 2882 |
} |
| 2883 |
|
| 2884 |
case TYPE_LEA: |
| 2885 |
return "lea{l}\t{%E1, %0|%0, %E1}"; |
| 2886 |
|
| 2887 |
case TYPE_IMOV: |
| 2888 |
gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1])); |
| 2889 |
if (ix86_use_lea_for_mov (insn, operands)) |
| 2890 |
return "lea{l}\t{%E1, %0|%0, %E1}"; |
| 2891 |
else |
| 2892 |
return "mov{l}\t{%1, %0|%0, %1}"; |
| 2893 |
|
| 2894 |
default: |
| 2895 |
gcc_unreachable (); |
| 2896 |
} |
| 2897 |
} |
| 2898 |
[(set (attr "isa") |
| 2899 |
(cond [(eq_attr "alternative" "12,13") |
| 2900 |
(const_string "sse2") |
| 2901 |
(eq_attr "alternative" "14,15,16,17") |
| 2902 |
(const_string "avx512bw") |
| 2903 |
] |
| 2904 |
(const_string "*"))) |
| 2905 |
(set (attr "type") |
| 2906 |
(cond [(eq_attr "alternative" "2") |
| 2907 |
(const_string "mmx") |
| 2908 |
(eq_attr "alternative" "3,4,5,6,7") |
| 2909 |
(const_string "mmxmov") |
| 2910 |
(eq_attr "alternative" "8") |
| 2911 |
(const_string "sselog1") |
| 2912 |
(eq_attr "alternative" "9,10,11,12,13") |
| 2913 |
(const_string "ssemov") |
| 2914 |
(eq_attr "alternative" "14,15,16") |
| 2915 |
(const_string "mskmov") |
| 2916 |
(eq_attr "alternative" "17") |
| 2917 |
(const_string "msklog") |
| 2918 |
(and (match_operand 0 "register_operand") |
| 2919 |
(match_operand 1 "pic_32bit_operand")) |
| 2920 |
(const_string "lea") |
| 2921 |
] |
| 2922 |
(const_string "imov"))) |
| 2923 |
(set (attr "c86_attr") |
| 2924 |
(if_then_else (eq_attr "alternative" "8") |
| 2925 |
(const_string "sselogic") |
| 2926 |
(const_string "*"))) |
| 2927 |
(set (attr "prefix") |
| 2928 |
(if_then_else (eq_attr "type" "sselog1,ssemov") |
| 2929 |
(const_string "maybe_vex") |
| 2930 |
(const_string "orig"))) |
| 2931 |
(set (attr "prefix_data16") |
| 2932 |
(if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI")) |
| 2933 |
(const_string "1") |
| 2934 |
(const_string "*"))) |
| 2935 |
(set (attr "mode") |
| 2936 |
(cond [(eq_attr "alternative" "2,3") |
| 2937 |
(const_string "DI") |
| 2938 |
(eq_attr "alternative" "8") |
| 2939 |
(cond [(match_test "TARGET_AVX") |
| 2940 |
(const_string "TI") |
| 2941 |
(ior (not (match_test "TARGET_SSE2")) |
| 2942 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 2943 |
(const_string "V4SF") |
| 2944 |
] |
| 2945 |
(const_string "TI")) |
| 2946 |
(eq_attr "alternative" "9") |
| 2947 |
(cond [(match_test "TARGET_AVX512VL") |
| 2948 |
(const_string "TI") |
| 2949 |
(match_test "TARGET_AVX512F") |
| 2950 |
(const_string "SF") |
| 2951 |
(match_test "TARGET_AVX") |
| 2952 |
(const_string "TI") |
| 2953 |
(ior (not (match_test "TARGET_SSE2")) |
| 2954 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 2955 |
(const_string "V4SF") |
| 2956 |
] |
| 2957 |
(const_string "TI")) |
| 2958 |
|
| 2959 |
(and (eq_attr "alternative" "10,11") |
| 2960 |
(not (match_test "TARGET_SSE2"))) |
| 2961 |
(const_string "SF") |
| 2962 |
] |
| 2963 |
(const_string "SI"))) |
| 2964 |
(set (attr "preferred_for_speed") |
| 2965 |
(cond [(eq_attr "alternative" "6,12") |
| 2966 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 2967 |
(eq_attr "alternative" "7,13") |
| 2968 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 2969 |
] |
| 2970 |
(symbol_ref "true")))]) |
| 2971 |
|
| 2972 |
;; With -Oz, transform mov $imm,reg to the shorter push $imm; pop reg. |
| 2973 |
(define_peephole2 |
| 2974 |
[(set (match_operand:SWI248 0 "general_reg_operand") |
| 2975 |
(match_operand:SWI248 1 "const_int_operand"))] |
| 2976 |
"optimize_insn_for_size_p () && optimize_size > 1 |
| 2977 |
&& operands[1] != const0_rtx |
| 2978 |
&& (operands[1] != constm1_rtx |
| 2979 |
|| (<MODE>mode == DImode && LEGACY_INT_REG_P (operands[0]))) |
| 2980 |
&& IN_RANGE (INTVAL (operands[1]), -128, 127) |
| 2981 |
&& !ix86_red_zone_used |
| 2982 |
&& REGNO (operands[0]) != SP_REG" |
| 2983 |
[(set (match_dup 2) (match_dup 1)) |
| 2984 |
(set (match_dup 0) (match_dup 3))] |
| 2985 |
{ |
| 2986 |
if (GET_MODE (operands[0]) != word_mode) |
| 2987 |
operands[0] = gen_rtx_REG (word_mode, REGNO (operands[0])); |
| 2988 |
|
| 2989 |
operands[2] = gen_rtx_MEM (word_mode, |
| 2990 |
gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx)); |
| 2991 |
operands[3] = gen_rtx_MEM (word_mode, |
| 2992 |
gen_rtx_POST_INC (Pmode, stack_pointer_rtx)); |
| 2993 |
}) |
| 2994 |
|
| 2995 |
;; With -Oz, transform mov $0,mem to the shorter and $0,mem. |
| 2996 |
;; Likewise, transform mov $-1,mem to the shorter or $-1,mem. |
| 2997 |
(define_peephole2 |
| 2998 |
[(set (match_operand:SWI248 0 "memory_operand") |
| 2999 |
(match_operand:SWI248 1 "const_int_operand"))] |
| 3000 |
"(operands[1] == const0_rtx || operands[1] == constm1_rtx) |
| 3001 |
&& optimize_insn_for_size_p () && optimize_size > 1 |
| 3002 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 3003 |
[(parallel [(set (match_dup 0) (match_dup 1)) |
| 3004 |
(clobber (reg:CC FLAGS_REG))])]) |
| 3005 |
|
| 3006 |
(define_insn "*movhi_internal" |
| 3007 |
[(set (match_operand:HI 0 "nonimmediate_operand" |
| 3008 |
"=r,r,r,m ,*k,*k ,r ,m ,*k ,?r,?*v,*Yv,*v,*v,jm,m") |
| 3009 |
(match_operand:HI 1 "general_operand" |
| 3010 |
"r ,n,m,rn,r ,*km,*k,*k,CBC,*v,r ,C ,*v,m ,*x,*v"))] |
| 3011 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 3012 |
&& ix86_hardreg_mov_ok (operands[0], operands[1])" |
| 3013 |
{ |
| 3014 |
switch (get_attr_type (insn)) |
| 3015 |
{ |
| 3016 |
case TYPE_IMOVX: |
| 3017 |
/* movzwl is faster than movw on p2 due to partial word stalls, |
| 3018 |
though not as fast as an aligned movl. */ |
| 3019 |
return "movz{wl|x}\t{%1, %k0|%k0, %1}"; |
| 3020 |
|
| 3021 |
case TYPE_MSKMOV: |
| 3022 |
switch (which_alternative) |
| 3023 |
{ |
| 3024 |
case 4: |
| 3025 |
return "kmovw\t{%k1, %0|%0, %k1}"; |
| 3026 |
case 6: |
| 3027 |
return "kmovw\t{%1, %k0|%k0, %1}"; |
| 3028 |
case 5: |
| 3029 |
case 7: |
| 3030 |
return "kmovw\t{%1, %0|%0, %1}"; |
| 3031 |
default: |
| 3032 |
gcc_unreachable (); |
| 3033 |
} |
| 3034 |
|
| 3035 |
case TYPE_SSEMOV: |
| 3036 |
return ix86_output_ssemov (insn, operands); |
| 3037 |
|
| 3038 |
case TYPE_SSELOG1: |
| 3039 |
if (satisfies_constraint_C (operands[1])) |
| 3040 |
return standard_sse_constant_opcode (insn, operands); |
| 3041 |
|
| 3042 |
if (SSE_REG_P (operands[0])) |
| 3043 |
return "%vpinsrw\t{$0, %1, %d0|%d0, %1, 0}"; |
| 3044 |
else |
| 3045 |
return "%vpextrw\t{$0, %1, %0|%0, %1, 0}"; |
| 3046 |
|
| 3047 |
case TYPE_MSKLOG: |
| 3048 |
if (operands[1] == const0_rtx) |
| 3049 |
return "kxorw\t%0, %0, %0"; |
| 3050 |
else if (operands[1] == constm1_rtx) |
| 3051 |
return "kxnorw\t%0, %0, %0"; |
| 3052 |
gcc_unreachable (); |
| 3053 |
|
| 3054 |
default: |
| 3055 |
if (get_attr_mode (insn) == MODE_SI) |
| 3056 |
return "mov{l}\t{%k1, %k0|%k0, %k1}"; |
| 3057 |
else |
| 3058 |
return "mov{w}\t{%1, %0|%0, %1}"; |
| 3059 |
} |
| 3060 |
} |
| 3061 |
[(set (attr "isa") |
| 3062 |
(cond [(eq_attr "alternative" "9,10,11,12,13") |
| 3063 |
(const_string "sse2") |
| 3064 |
(eq_attr "alternative" "14") |
| 3065 |
(const_string "sse4_noavx") |
| 3066 |
(eq_attr "alternative" "15") |
| 3067 |
(const_string "avx") |
| 3068 |
] |
| 3069 |
(const_string "*"))) |
| 3070 |
(set (attr "addr") |
| 3071 |
(if_then_else (eq_attr "alternative" "14") |
| 3072 |
(const_string "gpr16") |
| 3073 |
(const_string "*"))) |
| 3074 |
(set (attr "type") |
| 3075 |
(cond [(eq_attr "alternative" "4,5,6,7") |
| 3076 |
(const_string "mskmov") |
| 3077 |
(eq_attr "alternative" "8") |
| 3078 |
(const_string "msklog") |
| 3079 |
(eq_attr "alternative" "13,14,15") |
| 3080 |
(if_then_else (match_test "TARGET_AVX512FP16") |
| 3081 |
(const_string "ssemov") |
| 3082 |
(const_string "sselog1")) |
| 3083 |
(eq_attr "alternative" "11") |
| 3084 |
(const_string "sselog1") |
| 3085 |
(eq_attr "alternative" "9,10,12") |
| 3086 |
(const_string "ssemov") |
| 3087 |
(match_test "optimize_function_for_size_p (cfun)") |
| 3088 |
(const_string "imov") |
| 3089 |
(and (eq_attr "alternative" "0") |
| 3090 |
(ior (not (match_test "TARGET_PARTIAL_REG_STALL")) |
| 3091 |
(not (match_test "TARGET_HIMODE_MATH")))) |
| 3092 |
(const_string "imov") |
| 3093 |
(and (eq_attr "alternative" "1,2") |
| 3094 |
(match_operand:HI 1 "aligned_operand")) |
| 3095 |
(const_string "imov") |
| 3096 |
(and (match_test "TARGET_MOVX") |
| 3097 |
(eq_attr "alternative" "0,2")) |
| 3098 |
(const_string "imovx") |
| 3099 |
] |
| 3100 |
(const_string "imov"))) |
| 3101 |
(set (attr "c86_attr") |
| 3102 |
(if_then_else (eq_attr "alternative" "11") |
| 3103 |
(const_string "sselogic") |
| 3104 |
(const_string "*"))) |
| 3105 |
(set (attr "prefix") |
| 3106 |
(cond [(eq_attr "alternative" "4,5,6,7,8") |
| 3107 |
(const_string "vex") |
| 3108 |
(eq_attr "alternative" "9,10,11,12,13,14,15") |
| 3109 |
(const_string "maybe_evex") |
| 3110 |
] |
| 3111 |
(const_string "orig"))) |
| 3112 |
(set (attr "mode") |
| 3113 |
(cond [(eq_attr "alternative" "9,10") |
| 3114 |
(if_then_else (match_test "TARGET_AVX512FP16") |
| 3115 |
(const_string "HI") |
| 3116 |
(const_string "SI")) |
| 3117 |
(eq_attr "alternative" "13,14,15") |
| 3118 |
(if_then_else (match_test "TARGET_AVX512FP16") |
| 3119 |
(const_string "HI") |
| 3120 |
(const_string "TI")) |
| 3121 |
(eq_attr "alternative" "11") |
| 3122 |
(cond [(match_test "TARGET_AVX") |
| 3123 |
(const_string "TI") |
| 3124 |
(ior (not (match_test "TARGET_SSE2")) |
| 3125 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 3126 |
(const_string "V4SF") |
| 3127 |
] |
| 3128 |
(const_string "TI")) |
| 3129 |
(eq_attr "alternative" "12") |
| 3130 |
(cond [(match_test "TARGET_AVX512VL") |
| 3131 |
(const_string "TI") |
| 3132 |
(match_test "TARGET_AVX512FP16") |
| 3133 |
(const_string "HF") |
| 3134 |
(match_test "TARGET_AVX512F") |
| 3135 |
(const_string "SF") |
| 3136 |
(match_test "TARGET_AVX") |
| 3137 |
(const_string "TI") |
| 3138 |
(ior (not (match_test "TARGET_SSE2")) |
| 3139 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 3140 |
(const_string "V4SF") |
| 3141 |
] |
| 3142 |
(const_string "TI")) |
| 3143 |
(eq_attr "type" "imovx") |
| 3144 |
(const_string "SI") |
| 3145 |
(and (eq_attr "alternative" "1,2") |
| 3146 |
(match_operand:HI 1 "aligned_operand")) |
| 3147 |
(const_string "SI") |
| 3148 |
(and (eq_attr "alternative" "0") |
| 3149 |
(ior (not (match_test "TARGET_PARTIAL_REG_STALL")) |
| 3150 |
(not (match_test "TARGET_HIMODE_MATH")))) |
| 3151 |
(const_string "SI") |
| 3152 |
] |
| 3153 |
(const_string "HI"))) |
| 3154 |
(set (attr "preferred_for_speed") |
| 3155 |
(cond [(eq_attr "alternative" "9") |
| 3156 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 3157 |
(eq_attr "alternative" "10") |
| 3158 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 3159 |
] |
| 3160 |
(symbol_ref "true")))]) |
| 3161 |
|
| 3162 |
;; Situation is quite tricky about when to choose full sized (SImode) move |
| 3163 |
;; over QImode moves. For Q_REG -> Q_REG move we use full size only for |
| 3164 |
;; partial register dependency machines (such as AMD Athlon), where QImode |
| 3165 |
;; moves issue extra dependency and for partial register stalls machines |
| 3166 |
;; that don't use QImode patterns (and QImode move cause stall on the next |
| 3167 |
;; instruction). |
| 3168 |
;; |
| 3169 |
;; For loads of Q_REG to NONQ_REG we use full sized moves except for partial |
| 3170 |
;; register stall machines with, where we use QImode instructions, since |
| 3171 |
;; partial register stall can be caused there. Then we use movzx. |
| 3172 |
|
| 3173 |
(define_insn "*movqi_internal" |
| 3174 |
[(set (match_operand:QI 0 "nonimmediate_operand" |
| 3175 |
"=Q,R,r,q,q,r,r ,?r,m ,*k,*k,*r,*m,*k,*k,*k") |
| 3176 |
(match_operand:QI 1 "general_operand" |
| 3177 |
"Q ,R,r,n,m,q,rn, m,qn,*r,*k,*k,*k,*m,C,BC"))] |
| 3178 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 3179 |
&& ix86_hardreg_mov_ok (operands[0], operands[1])" |
| 3180 |
|
| 3181 |
{ |
| 3182 |
char buf[128]; |
| 3183 |
const char *ops; |
| 3184 |
const char *suffix; |
| 3185 |
|
| 3186 |
switch (get_attr_type (insn)) |
| 3187 |
{ |
| 3188 |
case TYPE_IMOVX: |
| 3189 |
gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1])); |
| 3190 |
return "movz{bl|x}\t{%1, %k0|%k0, %1}"; |
| 3191 |
|
| 3192 |
case TYPE_MSKMOV: |
| 3193 |
switch (which_alternative) |
| 3194 |
{ |
| 3195 |
case 9: |
| 3196 |
ops = "kmov%s\t{%%k1, %%0|%%0, %%k1}"; |
| 3197 |
break; |
| 3198 |
case 11: |
| 3199 |
ops = "kmov%s\t{%%1, %%k0|%%k0, %%1}"; |
| 3200 |
break; |
| 3201 |
case 12: |
| 3202 |
case 13: |
| 3203 |
gcc_assert (TARGET_AVX512DQ); |
| 3204 |
/* FALLTHRU */ |
| 3205 |
case 10: |
| 3206 |
ops = "kmov%s\t{%%1, %%0|%%0, %%1}"; |
| 3207 |
break; |
| 3208 |
default: |
| 3209 |
gcc_unreachable (); |
| 3210 |
} |
| 3211 |
|
| 3212 |
suffix = (get_attr_mode (insn) == MODE_HI) ? "w" : "b"; |
| 3213 |
|
| 3214 |
snprintf (buf, sizeof (buf), ops, suffix); |
| 3215 |
output_asm_insn (buf, operands); |
| 3216 |
return ""; |
| 3217 |
|
| 3218 |
case TYPE_MSKLOG: |
| 3219 |
if (operands[1] == const0_rtx) |
| 3220 |
{ |
| 3221 |
if (get_attr_mode (insn) == MODE_HI) |
| 3222 |
return "kxorw\t%0, %0, %0"; |
| 3223 |
else |
| 3224 |
return "kxorb\t%0, %0, %0"; |
| 3225 |
} |
| 3226 |
else if (operands[1] == constm1_rtx) |
| 3227 |
{ |
| 3228 |
gcc_assert (TARGET_AVX512DQ); |
| 3229 |
return "kxnorb\t%0, %0, %0"; |
| 3230 |
} |
| 3231 |
gcc_unreachable (); |
| 3232 |
|
| 3233 |
default: |
| 3234 |
if (get_attr_mode (insn) == MODE_SI) |
| 3235 |
return "mov{l}\t{%k1, %k0|%k0, %k1}"; |
| 3236 |
else |
| 3237 |
return "mov{b}\t{%1, %0|%0, %1}"; |
| 3238 |
} |
| 3239 |
} |
| 3240 |
[(set (attr "isa") |
| 3241 |
(cond [(eq_attr "alternative" "1,2") |
| 3242 |
(const_string "x64") |
| 3243 |
(eq_attr "alternative" "12,13,15") |
| 3244 |
(const_string "avx512dq") |
| 3245 |
] |
| 3246 |
(const_string "*"))) |
| 3247 |
(set (attr "type") |
| 3248 |
(cond [(eq_attr "alternative" "9,10,11,12,13") |
| 3249 |
(const_string "mskmov") |
| 3250 |
(eq_attr "alternative" "14,15") |
| 3251 |
(const_string "msklog") |
| 3252 |
(and (eq_attr "alternative" "7") |
| 3253 |
(not (match_operand:QI 1 "aligned_operand"))) |
| 3254 |
(const_string "imovx") |
| 3255 |
(match_test "optimize_function_for_size_p (cfun)") |
| 3256 |
(const_string "imov") |
| 3257 |
(and (eq_attr "alternative" "5") |
| 3258 |
(ior (not (match_test "TARGET_PARTIAL_REG_STALL")) |
| 3259 |
(not (match_test "TARGET_QIMODE_MATH")))) |
| 3260 |
(const_string "imov") |
| 3261 |
(eq_attr "alternative" "5,7") |
| 3262 |
(const_string "imovx") |
| 3263 |
(and (match_test "TARGET_MOVX") |
| 3264 |
(eq_attr "alternative" "4")) |
| 3265 |
(const_string "imovx") |
| 3266 |
] |
| 3267 |
(const_string "imov"))) |
| 3268 |
(set (attr "prefix") |
| 3269 |
(if_then_else (eq_attr "alternative" "9,10,11,12,13,14,15") |
| 3270 |
(const_string "vex") |
| 3271 |
(const_string "orig"))) |
| 3272 |
(set (attr "mode") |
| 3273 |
(cond [(eq_attr "alternative" "5,6,7") |
| 3274 |
(const_string "SI") |
| 3275 |
(eq_attr "alternative" "8") |
| 3276 |
(const_string "QI") |
| 3277 |
(and (eq_attr "alternative" "9,10,11,14") |
| 3278 |
(not (match_test "TARGET_AVX512DQ"))) |
| 3279 |
(const_string "HI") |
| 3280 |
(eq_attr "type" "imovx") |
| 3281 |
(const_string "SI") |
| 3282 |
;; For -Os, 8-bit immediates are always shorter than 32-bit |
| 3283 |
;; ones. |
| 3284 |
(and (eq_attr "type" "imov") |
| 3285 |
(and (eq_attr "alternative" "3") |
| 3286 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 3287 |
(const_string "QI") |
| 3288 |
;; For -Os, movl where one or both operands are NON_Q_REGS |
| 3289 |
;; and both are LEGACY_REGS is shorter than movb. |
| 3290 |
;; Otherwise movb and movl sizes are the same, so decide purely |
| 3291 |
;; based on speed factors. |
| 3292 |
(and (eq_attr "type" "imov") |
| 3293 |
(and (eq_attr "alternative" "1") |
| 3294 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 3295 |
(const_string "SI") |
| 3296 |
(and (eq_attr "type" "imov") |
| 3297 |
(and (eq_attr "alternative" "0,1,2,3") |
| 3298 |
(and (match_test "TARGET_PARTIAL_REG_DEPENDENCY") |
| 3299 |
(not (match_test "TARGET_PARTIAL_REG_STALL"))))) |
| 3300 |
(const_string "SI") |
| 3301 |
;; Avoid partial register stalls when not using QImode arithmetic |
| 3302 |
(and (eq_attr "type" "imov") |
| 3303 |
(and (eq_attr "alternative" "0,1,2,3") |
| 3304 |
(and (match_test "TARGET_PARTIAL_REG_STALL") |
| 3305 |
(not (match_test "TARGET_QIMODE_MATH"))))) |
| 3306 |
(const_string "SI") |
| 3307 |
] |
| 3308 |
(const_string "QI")))]) |
| 3309 |
|
| 3310 |
/* Reload dislikes loading 0/-1 directly into mask registers. |
| 3311 |
Try to tidy things up here. */ |
| 3312 |
(define_peephole2 |
| 3313 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 3314 |
(match_operand:SWI 1 "immediate_operand")) |
| 3315 |
(set (match_operand:SWI 2 "mask_reg_operand") |
| 3316 |
(match_dup 0))] |
| 3317 |
"peep2_reg_dead_p (2, operands[0]) |
| 3318 |
&& (const0_operand (operands[1], <MODE>mode) |
| 3319 |
|| (constm1_operand (operands[1], <MODE>mode) |
| 3320 |
&& (<MODE_SIZE> > 1 || TARGET_AVX512DQ)))" |
| 3321 |
[(set (match_dup 2) (match_dup 1))]) |
| 3322 |
|
| 3323 |
;; Stores and loads of ax to arbitrary constant address. |
| 3324 |
;; We fake an second form of instruction to force reload to load address |
| 3325 |
;; into register when rax is not available |
| 3326 |
(define_insn "*movabs<mode>_1" |
| 3327 |
[(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r")) |
| 3328 |
(match_operand:SWI1248x 1 "nonmemory_operand" "a,r<i>"))] |
| 3329 |
"TARGET_LP64 && ix86_check_movabs (insn, 0)" |
| 3330 |
{ |
| 3331 |
/* Recover the full memory rtx. */ |
| 3332 |
operands[0] = SET_DEST (PATTERN (insn)); |
| 3333 |
switch (which_alternative) |
| 3334 |
{ |
| 3335 |
case 0: |
| 3336 |
return "movabs{<imodesuffix>}\t{%1, %P0|<iptrsize> PTR [%P0], %1}"; |
| 3337 |
case 1: |
| 3338 |
return "mov{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 3339 |
default: |
| 3340 |
gcc_unreachable (); |
| 3341 |
} |
| 3342 |
} |
| 3343 |
[(set_attr "type" "imov") |
| 3344 |
(set_attr "modrm" "0,*") |
| 3345 |
(set_attr "length_address" "8,0") |
| 3346 |
(set_attr "length_immediate" "0,*") |
| 3347 |
(set_attr "memory" "store") |
| 3348 |
(set_attr "mode" "<MODE>")]) |
| 3349 |
|
| 3350 |
(define_insn "*movabs<mode>_2" |
| 3351 |
[(set (match_operand:SWI1248x 0 "register_operand" "=a,r") |
| 3352 |
(mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))] |
| 3353 |
"TARGET_LP64 && ix86_check_movabs (insn, 1)" |
| 3354 |
{ |
| 3355 |
/* Recover the full memory rtx. */ |
| 3356 |
operands[1] = SET_SRC (PATTERN (insn)); |
| 3357 |
switch (which_alternative) |
| 3358 |
{ |
| 3359 |
case 0: |
| 3360 |
return "movabs{<imodesuffix>}\t{%P1, %0|%0, <iptrsize> PTR [%P1]}"; |
| 3361 |
case 1: |
| 3362 |
return "mov{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 3363 |
default: |
| 3364 |
gcc_unreachable (); |
| 3365 |
} |
| 3366 |
} |
| 3367 |
[(set_attr "type" "imov") |
| 3368 |
(set_attr "modrm" "0,*") |
| 3369 |
(set_attr "length_address" "8,0") |
| 3370 |
(set_attr "length_immediate" "0") |
| 3371 |
(set_attr "memory" "load") |
| 3372 |
(set_attr "mode" "<MODE>")]) |
| 3373 |
|
| 3374 |
(define_insn "swap<mode>" |
| 3375 |
[(set (match_operand:SWI48 0 "register_operand" "+r") |
| 3376 |
(match_operand:SWI48 1 "register_operand" "+r")) |
| 3377 |
(set (match_dup 1) |
| 3378 |
(match_dup 0))] |
| 3379 |
"" |
| 3380 |
"xchg{<imodesuffix>}\t%1, %0" |
| 3381 |
[(set_attr "type" "imov") |
| 3382 |
(set_attr "mode" "<MODE>") |
| 3383 |
(set_attr "pent_pair" "np") |
| 3384 |
(set_attr "athlon_decode" "vector") |
| 3385 |
(set_attr "amdfam10_decode" "double") |
| 3386 |
(set_attr "c86_decode" "vector") |
| 3387 |
(set_attr "bdver1_decode" "double")]) |
| 3388 |
|
| 3389 |
(define_insn "*swap<mode>" |
| 3390 |
[(set (match_operand:SWI12 0 "register_operand" "+<r>,r") |
| 3391 |
(match_operand:SWI12 1 "register_operand" "+<r>,r")) |
| 3392 |
(set (match_dup 1) |
| 3393 |
(match_dup 0))] |
| 3394 |
"" |
| 3395 |
"@ |
| 3396 |
xchg{<imodesuffix>}\t%1, %0 |
| 3397 |
xchg{l}\t%k1, %k0" |
| 3398 |
[(set_attr "type" "imov") |
| 3399 |
(set_attr "mode" "<MODE>,SI") |
| 3400 |
(set (attr "preferred_for_size") |
| 3401 |
(cond [(eq_attr "alternative" "0") |
| 3402 |
(symbol_ref "false")] |
| 3403 |
(symbol_ref "true"))) |
| 3404 |
;; Potential partial reg stall on alternative 1. |
| 3405 |
(set (attr "preferred_for_speed") |
| 3406 |
(cond [(eq_attr "alternative" "1") |
| 3407 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 3408 |
(symbol_ref "true"))) |
| 3409 |
(set_attr "pent_pair" "np") |
| 3410 |
(set_attr "athlon_decode" "vector") |
| 3411 |
(set_attr "amdfam10_decode" "double") |
| 3412 |
(set_attr "c86_decode" "vector") |
| 3413 |
(set_attr "bdver1_decode" "double")]) |
| 3414 |
|
| 3415 |
(define_peephole2 |
| 3416 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 3417 |
(match_operand:SWI 1 "general_reg_operand")) |
| 3418 |
(set (match_dup 1) |
| 3419 |
(match_operand:SWI 2 "general_reg_operand")) |
| 3420 |
(set (match_dup 2) (match_dup 0))] |
| 3421 |
"peep2_reg_dead_p (3, operands[0]) |
| 3422 |
&& optimize_insn_for_size_p ()" |
| 3423 |
[(parallel [(set (match_dup 1) (match_dup 2)) |
| 3424 |
(set (match_dup 2) (match_dup 1))])]) |
| 3425 |
|
| 3426 |
;; Convert xchg with a REG_UNUSED note to a mov (variant #1). |
| 3427 |
(define_peephole2 |
| 3428 |
[(parallel [(set (match_operand:SWI 0 "general_reg_operand") |
| 3429 |
(match_operand:SWI 1 "general_reg_operand")) |
| 3430 |
(set (match_dup 1) (match_dup 0))])] |
| 3431 |
"((REGNO (operands[0]) != AX_REG |
| 3432 |
&& REGNO (operands[1]) != AX_REG) |
| 3433 |
|| optimize_size < 2 |
| 3434 |
|| !optimize_insn_for_size_p ()) |
| 3435 |
&& peep2_reg_dead_p (1, operands[0])" |
| 3436 |
[(set (match_dup 1) (match_dup 0))]) |
| 3437 |
|
| 3438 |
;; Convert xchg with a REG_UNUSED note to a mov (variant #2). |
| 3439 |
(define_peephole2 |
| 3440 |
[(parallel [(set (match_operand:SWI 0 "general_reg_operand") |
| 3441 |
(match_operand:SWI 1 "general_reg_operand")) |
| 3442 |
(set (match_dup 1) (match_dup 0))])] |
| 3443 |
"((REGNO (operands[0]) != AX_REG |
| 3444 |
&& REGNO (operands[1]) != AX_REG) |
| 3445 |
|| optimize_size < 2 |
| 3446 |
|| !optimize_insn_for_size_p ()) |
| 3447 |
&& peep2_reg_dead_p (1, operands[1])" |
| 3448 |
[(set (match_dup 0) (match_dup 1))]) |
| 3449 |
|
| 3450 |
;; Convert moves to/from AX_REG into xchg with -Oz. |
| 3451 |
(define_peephole2 |
| 3452 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 3453 |
(match_operand:SWI48 1 "general_reg_operand"))] |
| 3454 |
"optimize_size > 1 |
| 3455 |
&& ((REGNO (operands[0]) == AX_REG) |
| 3456 |
!= (REGNO (operands[1]) == AX_REG)) |
| 3457 |
&& optimize_insn_for_size_p () |
| 3458 |
&& peep2_reg_dead_p (1, operands[1])" |
| 3459 |
[(parallel [(set (match_dup 0) (match_dup 1)) |
| 3460 |
(set (match_dup 1) (match_dup 0))])]) |
| 3461 |
|
| 3462 |
(define_expand "movstrict<mode>" |
| 3463 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand")) |
| 3464 |
(match_operand:SWI12 1 "general_operand"))] |
| 3465 |
"" |
| 3466 |
{ |
| 3467 |
gcc_assert (SUBREG_P (operands[0])); |
| 3468 |
if ((TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun)) |
| 3469 |
|| !VALID_INT_MODE_P (GET_MODE (SUBREG_REG (operands[0])))) |
| 3470 |
FAIL; |
| 3471 |
}) |
| 3472 |
|
| 3473 |
(define_insn "*movstrict<mode>_1" |
| 3474 |
[(set (strict_low_part |
| 3475 |
(match_operand:SWI12 0 "register_operand" "+<r>")) |
| 3476 |
(match_operand:SWI12 1 "general_operand" "<r>mn"))] |
| 3477 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 3478 |
"mov{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 3479 |
[(set_attr "type" "imov") |
| 3480 |
(set_attr "mode" "<MODE>")]) |
| 3481 |
|
| 3482 |
(define_insn "*movstrict<mode>_xor" |
| 3483 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>")) |
| 3484 |
(match_operand:SWI12 1 "const0_operand")) |
| 3485 |
(clobber (reg:CC FLAGS_REG))] |
| 3486 |
"reload_completed" |
| 3487 |
"xor{<imodesuffix>}\t%0, %0" |
| 3488 |
[(set_attr "type" "alu1") |
| 3489 |
(set_attr "mode" "<MODE>") |
| 3490 |
(set_attr "length_immediate" "0")]) |
| 3491 |
|
| 3492 |
(define_insn "*movstrictqi_ext<mode>_1" |
| 3493 |
[(set (strict_low_part |
| 3494 |
(match_operand:QI 0 "register_operand" "+Q")) |
| 3495 |
(subreg:QI |
| 3496 |
(match_operator:SWI248 2 "extract_operator" |
| 3497 |
[(match_operand 1 "int248_register_operand" "Q") |
| 3498 |
(const_int 8) |
| 3499 |
(const_int 8)]) 0))] |
| 3500 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 3501 |
"mov{b}\t{%h1, %0|%0, %h1}" |
| 3502 |
[(set_attr "type" "imov") |
| 3503 |
(set_attr "mode" "QI")]) |
| 3504 |
|
| 3505 |
(define_expand "extv<mode>" |
| 3506 |
[(set (match_operand:SWI24 0 "register_operand") |
| 3507 |
(sign_extract:SWI24 (match_operand:SWI24 1 "register_operand") |
| 3508 |
(match_operand:QI 2 "const_int_operand") |
| 3509 |
(match_operand:QI 3 "const_int_operand")))] |
| 3510 |
"" |
| 3511 |
{ |
| 3512 |
/* Handle extractions from %ah et al. */ |
| 3513 |
if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8) |
| 3514 |
FAIL; |
| 3515 |
|
| 3516 |
unsigned int regno = reg_or_subregno (operands[1]); |
| 3517 |
|
| 3518 |
/* Be careful to expand only with registers having upper parts. */ |
| 3519 |
if (regno <= LAST_VIRTUAL_REGISTER && !QI_REGNO_P (regno)) |
| 3520 |
operands[1] = copy_to_reg (operands[1]); |
| 3521 |
}) |
| 3522 |
|
| 3523 |
(define_insn "*extv<mode>" |
| 3524 |
[(set (match_operand:SWI24 0 "register_operand" "=R") |
| 3525 |
(sign_extract:SWI24 (match_operand 1 "int248_register_operand" "Q") |
| 3526 |
(const_int 8) |
| 3527 |
(const_int 8)))] |
| 3528 |
"" |
| 3529 |
"movs{bl|x}\t{%h1, %k0|%k0, %h1}" |
| 3530 |
[(set_attr "type" "imovx") |
| 3531 |
(set_attr "mode" "SI")]) |
| 3532 |
|
| 3533 |
;; Split sign-extension of single least significant bit as and x,$1;neg x |
| 3534 |
(define_insn_and_split "*extv<mode>_1_0" |
| 3535 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 3536 |
(sign_extract:SWI48 (match_operand:SWI48 1 "register_operand" "0") |
| 3537 |
(const_int 1) |
| 3538 |
(const_int 0))) |
| 3539 |
(clobber (reg:CC FLAGS_REG))] |
| 3540 |
"" |
| 3541 |
"#" |
| 3542 |
"" |
| 3543 |
[(parallel [(set (match_dup 0) (and:SWI48 (match_dup 1) (const_int 1))) |
| 3544 |
(clobber (reg:CC FLAGS_REG))]) |
| 3545 |
(parallel [(set (match_dup 0) (neg:SWI48 (match_dup 0))) |
| 3546 |
(clobber (reg:CC FLAGS_REG))])]) |
| 3547 |
|
| 3548 |
(define_expand "extzv<mode>" |
| 3549 |
[(set (match_operand:SWI248 0 "register_operand") |
| 3550 |
(zero_extract:SWI248 (match_operand:SWI248 1 "register_operand") |
| 3551 |
(match_operand:QI 2 "const_int_operand") |
| 3552 |
(match_operand:QI 3 "const_int_operand")))] |
| 3553 |
"" |
| 3554 |
{ |
| 3555 |
if (ix86_expand_pextr (operands)) |
| 3556 |
DONE; |
| 3557 |
|
| 3558 |
/* Handle extractions from %ah et al. */ |
| 3559 |
if (INTVAL (operands[2]) != 8 || INTVAL (operands[3]) != 8) |
| 3560 |
FAIL; |
| 3561 |
|
| 3562 |
unsigned int regno = reg_or_subregno (operands[1]); |
| 3563 |
|
| 3564 |
/* Be careful to expand only with registers having upper parts. */ |
| 3565 |
if (regno <= LAST_VIRTUAL_REGISTER && !QI_REGNO_P (regno)) |
| 3566 |
operands[1] = copy_to_reg (operands[1]); |
| 3567 |
}) |
| 3568 |
|
| 3569 |
(define_insn "*extzv<mode>" |
| 3570 |
[(set (match_operand:SWI248 0 "register_operand" "=R") |
| 3571 |
(zero_extract:SWI248 (match_operand 1 "int248_register_operand" "Q") |
| 3572 |
(const_int 8) |
| 3573 |
(const_int 8)))] |
| 3574 |
"" |
| 3575 |
"movz{bl|x}\t{%h1, %k0|%k0, %h1}" |
| 3576 |
[(set_attr "type" "imovx") |
| 3577 |
(set_attr "mode" "SI")]) |
| 3578 |
|
| 3579 |
(define_insn "*extzvqi" |
| 3580 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=QBn,?R") |
| 3581 |
(subreg:QI |
| 3582 |
(match_operator:SWI248 2 "extract_operator" |
| 3583 |
[(match_operand 1 "int248_register_operand" "Q,Q") |
| 3584 |
(const_int 8) |
| 3585 |
(const_int 8)]) 0))] |
| 3586 |
"" |
| 3587 |
{ |
| 3588 |
switch (get_attr_type (insn)) |
| 3589 |
{ |
| 3590 |
case TYPE_IMOVX: |
| 3591 |
return "movz{bl|x}\t{%h1, %k0|%k0, %h1}"; |
| 3592 |
default: |
| 3593 |
return "mov{b}\t{%h1, %0|%0, %h1}"; |
| 3594 |
} |
| 3595 |
} |
| 3596 |
[(set_attr "addr" "gpr8,*") |
| 3597 |
(set (attr "type") |
| 3598 |
(if_then_else (and (match_operand:QI 0 "register_operand") |
| 3599 |
(ior (not (match_operand:QI 0 "QIreg_operand")) |
| 3600 |
(match_test "TARGET_MOVX"))) |
| 3601 |
(const_string "imovx") |
| 3602 |
(const_string "imov"))) |
| 3603 |
(set (attr "mode") |
| 3604 |
(if_then_else (eq_attr "type" "imovx") |
| 3605 |
(const_string "SI") |
| 3606 |
(const_string "QI")))]) |
| 3607 |
|
| 3608 |
(define_expand "insv<mode>" |
| 3609 |
[(set (zero_extract:SWI248 (match_operand:SWI248 0 "register_operand") |
| 3610 |
(match_operand:QI 1 "const_int_operand") |
| 3611 |
(match_operand:QI 2 "const_int_operand")) |
| 3612 |
(match_operand:SWI248 3 "register_operand"))] |
| 3613 |
"" |
| 3614 |
{ |
| 3615 |
rtx dst; |
| 3616 |
|
| 3617 |
if (ix86_expand_pinsr (operands)) |
| 3618 |
DONE; |
| 3619 |
|
| 3620 |
/* Handle insertions to %ah et al. */ |
| 3621 |
if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) != 8) |
| 3622 |
FAIL; |
| 3623 |
|
| 3624 |
unsigned int regno = reg_or_subregno (operands[0]); |
| 3625 |
|
| 3626 |
/* Be careful to expand only with registers having upper parts. */ |
| 3627 |
if (regno <= LAST_VIRTUAL_REGISTER && !QI_REGNO_P (regno)) |
| 3628 |
dst = copy_to_reg (operands[0]); |
| 3629 |
else |
| 3630 |
dst = operands[0]; |
| 3631 |
|
| 3632 |
emit_insn (gen_insv_1 (<MODE>mode, dst, operands[3])); |
| 3633 |
|
| 3634 |
/* Fix up the destination if needed. */ |
| 3635 |
if (dst != operands[0]) |
| 3636 |
emit_move_insn (operands[0], dst); |
| 3637 |
|
| 3638 |
DONE; |
| 3639 |
}) |
| 3640 |
|
| 3641 |
(define_insn "@insv<mode>_1" |
| 3642 |
[(set (zero_extract:SWI248 |
| 3643 |
(match_operand 0 "int248_register_operand" "+Q") |
| 3644 |
(const_int 8) |
| 3645 |
(const_int 8)) |
| 3646 |
(match_operand:SWI248 1 "general_operand" "QnBn"))] |
| 3647 |
"" |
| 3648 |
{ |
| 3649 |
if (CONST_INT_P (operands[1])) |
| 3650 |
operands[1] = gen_int_mode (INTVAL (operands[1]), QImode); |
| 3651 |
return "mov{b}\t{%b1, %h0|%h0, %b1}"; |
| 3652 |
} |
| 3653 |
[(set_attr "addr" "gpr8") |
| 3654 |
(set_attr "type" "imov") |
| 3655 |
(set_attr "mode" "QI")]) |
| 3656 |
|
| 3657 |
(define_insn "*insvqi_1" |
| 3658 |
[(set (zero_extract:SWI248 |
| 3659 |
(match_operand 0 "int248_register_operand" "+Q") |
| 3660 |
(const_int 8) |
| 3661 |
(const_int 8)) |
| 3662 |
(subreg:SWI248 |
| 3663 |
(match_operand:QI 1 "general_operand" "QnBn") 0))] |
| 3664 |
"" |
| 3665 |
"mov{b}\t{%1, %h0|%h0, %1}" |
| 3666 |
[(set_attr "addr" "gpr8") |
| 3667 |
(set_attr "type" "imov") |
| 3668 |
(set_attr "mode" "QI")]) |
| 3669 |
|
| 3670 |
;; Eliminate redundant insv, e.g. xorl %eax,%eax; movb $0, %ah |
| 3671 |
(define_peephole2 |
| 3672 |
[(parallel [(set (match_operand:SWI48 0 "general_reg_operand") |
| 3673 |
(const_int 0)) |
| 3674 |
(clobber (reg:CC FLAGS_REG))]) |
| 3675 |
(set (zero_extract:SWI248 (match_operand 1 "int248_register_operand") |
| 3676 |
(const_int 8) |
| 3677 |
(const_int 8)) |
| 3678 |
(const_int 0))] |
| 3679 |
"REGNO (operands[0]) == REGNO (operands[1])" |
| 3680 |
[(parallel [(set (match_operand:SWI48 0 "general_reg_operand") |
| 3681 |
(const_int 0)) |
| 3682 |
(clobber (reg:CC FLAGS_REG))])]) |
| 3683 |
|
| 3684 |
;; Combine movl followed by movb. |
| 3685 |
(define_peephole2 |
| 3686 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 3687 |
(match_operand:SWI48 1 "const_int_operand")) |
| 3688 |
(set (zero_extract:SWI248 (match_operand 2 "int248_register_operand") |
| 3689 |
(const_int 8) |
| 3690 |
(const_int 8)) |
| 3691 |
(match_operand:SWI248 3 "const_int_operand"))] |
| 3692 |
"REGNO (operands[0]) == REGNO (operands[2])" |
| 3693 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 3694 |
(match_dup 4))] |
| 3695 |
{ |
| 3696 |
HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~HOST_WIDE_INT_C (0xff00); |
| 3697 |
tmp |= (INTVAL (operands[3]) & 0xff) << 8; |
| 3698 |
operands[4] = gen_int_mode (tmp, <SWI48:MODE>mode); |
| 3699 |
}) |
| 3700 |
|
| 3701 |
(define_insn "*insvqi_2" |
| 3702 |
[(set (zero_extract:SWI248 |
| 3703 |
(match_operand 0 "int248_register_operand" "+Q") |
| 3704 |
(const_int 8) |
| 3705 |
(const_int 8)) |
| 3706 |
(match_operator:SWI248 2 "extract_operator" |
| 3707 |
[(match_operand 1 "int248_register_operand" "Q") |
| 3708 |
(const_int 8) |
| 3709 |
(const_int 8)]))] |
| 3710 |
"" |
| 3711 |
"mov{b}\t{%h1, %h0|%h0, %h1}" |
| 3712 |
[(set_attr "type" "imov") |
| 3713 |
(set_attr "mode" "QI")]) |
| 3714 |
|
| 3715 |
(define_insn "*insvqi_3" |
| 3716 |
[(set (zero_extract:SWI248 |
| 3717 |
(match_operand 0 "int248_register_operand" "+Q") |
| 3718 |
(const_int 8) |
| 3719 |
(const_int 8)) |
| 3720 |
(any_shiftrt:SWI248 |
| 3721 |
(match_operand:SWI248 1 "register_operand" "Q") |
| 3722 |
(const_int 8)))] |
| 3723 |
"" |
| 3724 |
"mov{b}\t{%h1, %h0|%h0, %h1}" |
| 3725 |
[(set_attr "type" "imov") |
| 3726 |
(set_attr "mode" "QI")]) |
| 3727 |
|
| 3728 |
(define_code_iterator any_or_plus [plus ior xor]) |
| 3729 |
|
| 3730 |
(define_insn_and_split "*insvti_highpart_1" |
| 3731 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=ro,r,r,&r") |
| 3732 |
(any_or_plus:TI |
| 3733 |
(and:TI |
| 3734 |
(match_operand:TI 1 "nonimmediate_operand" "r,m,r,m") |
| 3735 |
(match_operand:TI 3 "const_scalar_int_operand" "n,n,n,n")) |
| 3736 |
(ashift:TI |
| 3737 |
(zero_extend:TI |
| 3738 |
(match_operand:DI 2 "nonimmediate_operand" "r,r,m,m")) |
| 3739 |
(const_int 64))))] |
| 3740 |
"TARGET_64BIT |
| 3741 |
&& CONST_WIDE_INT_P (operands[3]) |
| 3742 |
&& CONST_WIDE_INT_NUNITS (operands[3]) == 2 |
| 3743 |
&& CONST_WIDE_INT_ELT (operands[3], 0) == -1 |
| 3744 |
&& CONST_WIDE_INT_ELT (operands[3], 1) == 0" |
| 3745 |
"#" |
| 3746 |
"&& reload_completed" |
| 3747 |
[(const_int 0)] |
| 3748 |
{ |
| 3749 |
operands[4] = gen_lowpart (DImode, operands[1]); |
| 3750 |
split_double_concat (TImode, operands[0], operands[4], operands[2]); |
| 3751 |
DONE; |
| 3752 |
}) |
| 3753 |
|
| 3754 |
(define_insn_and_split "*insvti_lowpart_1" |
| 3755 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=ro,r,r,&r") |
| 3756 |
(any_or_plus:TI |
| 3757 |
(and:TI |
| 3758 |
(match_operand:TI 1 "nonimmediate_operand" "r,o,r,o") |
| 3759 |
(match_operand:TI 3 "const_scalar_int_operand" "n,n,n,n")) |
| 3760 |
(zero_extend:TI |
| 3761 |
(match_operand:DI 2 "nonimmediate_operand" "r,r,m,m"))))] |
| 3762 |
"TARGET_64BIT |
| 3763 |
&& CONST_WIDE_INT_P (operands[3]) |
| 3764 |
&& CONST_WIDE_INT_NUNITS (operands[3]) == 2 |
| 3765 |
&& CONST_WIDE_INT_ELT (operands[3], 0) == 0 |
| 3766 |
&& CONST_WIDE_INT_ELT (operands[3], 1) == -1" |
| 3767 |
"#" |
| 3768 |
"&& reload_completed" |
| 3769 |
[(const_int 0)] |
| 3770 |
{ |
| 3771 |
operands[4] = gen_highpart (DImode, operands[1]); |
| 3772 |
split_double_concat (TImode, operands[0], operands[2], operands[4]); |
| 3773 |
DONE; |
| 3774 |
}) |
| 3775 |
|
| 3776 |
(define_insn_and_split "*insvdi_lowpart_1" |
| 3777 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=ro,r,r,&r") |
| 3778 |
(any_or_plus:DI |
| 3779 |
(and:DI |
| 3780 |
(match_operand:DI 1 "nonimmediate_operand" "r,o,r,o") |
| 3781 |
(match_operand:DI 3 "const_int_operand" "n,n,n,n")) |
| 3782 |
(zero_extend:DI |
| 3783 |
(match_operand:SI 2 "nonimmediate_operand" "r,r,m,m"))))] |
| 3784 |
"!TARGET_64BIT |
| 3785 |
&& CONST_INT_P (operands[3]) |
| 3786 |
&& UINTVAL (operands[3]) == 0xffffffff00000000ll" |
| 3787 |
"#" |
| 3788 |
"&& reload_completed" |
| 3789 |
[(const_int 0)] |
| 3790 |
{ |
| 3791 |
operands[4] = gen_highpart (SImode, operands[1]); |
| 3792 |
split_double_concat (DImode, operands[0], operands[2], operands[4]); |
| 3793 |
DONE; |
| 3794 |
}) |
| 3795 |
|
| 3796 |
;; Floating point push instructions. |
| 3797 |
|
| 3798 |
(define_insn "*pushtf" |
| 3799 |
[(set (match_operand:TF 0 "push_operand" "=<,<") |
| 3800 |
(match_operand:TF 1 "general_no_elim_operand" "v,*roC"))] |
| 3801 |
"TARGET_64BIT || TARGET_SSE" |
| 3802 |
{ |
| 3803 |
/* This insn should be already split before reg-stack. */ |
| 3804 |
return "#"; |
| 3805 |
} |
| 3806 |
[(set_attr "isa" "*,x64") |
| 3807 |
(set_attr "type" "multi") |
| 3808 |
(set_attr "unit" "sse,*") |
| 3809 |
(set_attr "mode" "TF,DI")]) |
| 3810 |
|
| 3811 |
;; %%% Kill this when call knows how to work this out. |
| 3812 |
(define_split |
| 3813 |
[(set (match_operand:TF 0 "push_operand") |
| 3814 |
(match_operand:TF 1 "sse_reg_operand"))] |
| 3815 |
"TARGET_SSE && reload_completed" |
| 3816 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16))) |
| 3817 |
(set (match_dup 0) (match_dup 1))] |
| 3818 |
{ |
| 3819 |
/* Preserve memory attributes. */ |
| 3820 |
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); |
| 3821 |
}) |
| 3822 |
|
| 3823 |
(define_insn "*pushxf" |
| 3824 |
[(set (match_operand:XF 0 "push_operand" "=<,<,<,<,<") |
| 3825 |
(match_operand:XF 1 "general_no_elim_operand" "f,r,*r,oF,oC"))] |
| 3826 |
"" |
| 3827 |
{ |
| 3828 |
/* This insn should be already split before reg-stack. */ |
| 3829 |
return "#"; |
| 3830 |
} |
| 3831 |
[(set_attr "isa" "*,*,*,nox64,x64") |
| 3832 |
(set_attr "type" "multi") |
| 3833 |
(set_attr "unit" "i387,*,*,*,*") |
| 3834 |
(set (attr "mode") |
| 3835 |
(cond [(eq_attr "alternative" "1,2,3,4") |
| 3836 |
(if_then_else (match_test "TARGET_64BIT") |
| 3837 |
(const_string "DI") |
| 3838 |
(const_string "SI")) |
| 3839 |
] |
| 3840 |
(const_string "XF"))) |
| 3841 |
(set (attr "preferred_for_size") |
| 3842 |
(cond [(eq_attr "alternative" "1") |
| 3843 |
(symbol_ref "false")] |
| 3844 |
(symbol_ref "true")))]) |
| 3845 |
|
| 3846 |
;; %%% Kill this when call knows how to work this out. |
| 3847 |
(define_split |
| 3848 |
[(set (match_operand:XF 0 "push_operand") |
| 3849 |
(match_operand:XF 1 "fp_register_operand"))] |
| 3850 |
"reload_completed" |
| 3851 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) |
| 3852 |
(set (match_dup 0) (match_dup 1))] |
| 3853 |
{ |
| 3854 |
operands[2] = GEN_INT (-PUSH_ROUNDING (GET_MODE_SIZE (XFmode))); |
| 3855 |
/* Preserve memory attributes. */ |
| 3856 |
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); |
| 3857 |
}) |
| 3858 |
|
| 3859 |
(define_insn "*pushdf" |
| 3860 |
[(set (match_operand:DF 0 "push_operand" "=<,<,<,<,<,<") |
| 3861 |
(match_operand:DF 1 "general_no_elim_operand" "f,r,*r,oF,rmC,v"))] |
| 3862 |
"" |
| 3863 |
{ |
| 3864 |
/* This insn should be already split before reg-stack. */ |
| 3865 |
return "#"; |
| 3866 |
} |
| 3867 |
[(set_attr "isa" "*,nox64,nox64,nox64,x64,sse2") |
| 3868 |
(set_attr "type" "multi") |
| 3869 |
(set_attr "unit" "i387,*,*,*,*,sse") |
| 3870 |
(set_attr "mode" "DF,SI,SI,SI,DI,DF") |
| 3871 |
(set (attr "preferred_for_size") |
| 3872 |
(cond [(eq_attr "alternative" "1") |
| 3873 |
(symbol_ref "false")] |
| 3874 |
(symbol_ref "true"))) |
| 3875 |
(set (attr "preferred_for_speed") |
| 3876 |
(cond [(eq_attr "alternative" "1") |
| 3877 |
(symbol_ref "TARGET_INTEGER_DFMODE_MOVES")] |
| 3878 |
(symbol_ref "true")))]) |
| 3879 |
|
| 3880 |
;; %%% Kill this when call knows how to work this out. |
| 3881 |
(define_split |
| 3882 |
[(set (match_operand:DF 0 "push_operand") |
| 3883 |
(match_operand:DF 1 "any_fp_register_operand"))] |
| 3884 |
"reload_completed" |
| 3885 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8))) |
| 3886 |
(set (match_dup 0) (match_dup 1))] |
| 3887 |
{ |
| 3888 |
/* Preserve memory attributes. */ |
| 3889 |
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); |
| 3890 |
}) |
| 3891 |
|
| 3892 |
(define_mode_iterator HFBF [HF BF]) |
| 3893 |
|
| 3894 |
(define_insn "*push<mode>_rex64" |
| 3895 |
[(set (match_operand:HFBF 0 "push_operand" "=X,X") |
| 3896 |
(match_operand:HFBF 1 "nonmemory_no_elim_operand" "r,x"))] |
| 3897 |
"TARGET_64BIT" |
| 3898 |
{ |
| 3899 |
/* Anything else should be already split before reg-stack. */ |
| 3900 |
gcc_assert (which_alternative == 0); |
| 3901 |
return "push{q}\t%q1"; |
| 3902 |
} |
| 3903 |
[(set_attr "isa" "*,sse4") |
| 3904 |
(set_attr "type" "push,multi") |
| 3905 |
(set_attr "mode" "DI,TI")]) |
| 3906 |
|
| 3907 |
(define_insn "*push<mode>" |
| 3908 |
[(set (match_operand:HFBF 0 "push_operand" "=X,X") |
| 3909 |
(match_operand:HFBF 1 "general_no_elim_operand" "rmF,x"))] |
| 3910 |
"!TARGET_64BIT" |
| 3911 |
{ |
| 3912 |
/* Anything else should be already split before reg-stack. */ |
| 3913 |
gcc_assert (which_alternative == 0); |
| 3914 |
return "push{l}\t%k1"; |
| 3915 |
} |
| 3916 |
[(set_attr "isa" "*,sse4") |
| 3917 |
(set_attr "type" "push,multi") |
| 3918 |
(set_attr "mode" "SI,TI")]) |
| 3919 |
|
| 3920 |
(define_insn "push2_di" |
| 3921 |
[(set (match_operand:TI 0 "push_operand" "=<") |
| 3922 |
(unspec:TI [(match_operand:DI 1 "register_operand" "r") |
| 3923 |
(match_operand:DI 2 "register_operand" "r")] |
| 3924 |
UNSPEC_APXPUSH2))] |
| 3925 |
"TARGET_APX_PUSH2POP2" |
| 3926 |
"push2\t{%2, %1|%1, %2}" |
| 3927 |
[(set_attr "mode" "TI") |
| 3928 |
(set_attr "type" "multi") |
| 3929 |
(set_attr "prefix" "evex")]) |
| 3930 |
|
| 3931 |
(define_insn "pop2_di" |
| 3932 |
[(parallel [(set (match_operand:DI 0 "register_operand" "=r") |
| 3933 |
(unspec:DI [(match_operand:TI 1 "pop_operand" ">")] |
| 3934 |
UNSPEC_APXPOP2_LOW)) |
| 3935 |
(set (match_operand:DI 2 "register_operand" "=r") |
| 3936 |
(unspec:DI [(const_int 0)] UNSPEC_APXPOP2_HIGH))])] |
| 3937 |
"TARGET_APX_PUSH2POP2" |
| 3938 |
"pop2\t{%2, %0|%0, %2}" |
| 3939 |
[(set_attr "mode" "TI") |
| 3940 |
(set_attr "prefix" "evex")]) |
| 3941 |
|
| 3942 |
(define_insn "pushp_di" |
| 3943 |
[(set (match_operand:DI 0 "push_operand" "=<") |
| 3944 |
(match_operand:DI 1 "register_operand" "r")) |
| 3945 |
(unspec:DI [(const_int 0)] UNSPEC_APX_PPX)] |
| 3946 |
"TARGET_64BIT" |
| 3947 |
"pushp\t%1" |
| 3948 |
[(set_attr "mode" "DI")]) |
| 3949 |
|
| 3950 |
(define_insn "popp_di" |
| 3951 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 3952 |
(match_operand:DI 1 "pop_operand" ">")) |
| 3953 |
(unspec:DI [(const_int 0)] UNSPEC_APX_PPX)] |
| 3954 |
"TARGET_APX_PPX" |
| 3955 |
"popp\t%0" |
| 3956 |
[(set_attr "mode" "DI")]) |
| 3957 |
|
| 3958 |
(define_insn "push2p_di" |
| 3959 |
[(set (match_operand:TI 0 "push_operand" "=<") |
| 3960 |
(unspec:TI [(match_operand:DI 1 "register_operand" "r") |
| 3961 |
(match_operand:DI 2 "register_operand" "r")] |
| 3962 |
UNSPEC_APXPUSH2)) |
| 3963 |
(unspec:DI [(const_int 0)] UNSPEC_APX_PPX)] |
| 3964 |
"TARGET_APX_PUSH2POP2 && TARGET_APX_PPX" |
| 3965 |
"push2p\t{%2, %1|%1, %2}" |
| 3966 |
[(set_attr "mode" "TI") |
| 3967 |
(set_attr "type" "multi") |
| 3968 |
(set_attr "prefix" "evex")]) |
| 3969 |
|
| 3970 |
(define_insn "pop2p_di" |
| 3971 |
[(parallel [(set (match_operand:DI 0 "register_operand" "=r") |
| 3972 |
(unspec:DI [(match_operand:TI 1 "pop_operand" ">")] |
| 3973 |
UNSPEC_APXPOP2_LOW)) |
| 3974 |
(set (match_operand:DI 2 "register_operand" "=r") |
| 3975 |
(unspec:DI [(const_int 0)] UNSPEC_APXPOP2_HIGH)) |
| 3976 |
(unspec:DI [(const_int 0)] UNSPEC_APX_PPX)])] |
| 3977 |
"TARGET_APX_PUSH2POP2 && TARGET_APX_PPX" |
| 3978 |
"pop2p\t{%2, %0|%0, %2}" |
| 3979 |
[(set_attr "mode" "TI") |
| 3980 |
(set_attr "prefix" "evex")]) |
| 3981 |
|
| 3982 |
(define_insn "*pushsf_rex64" |
| 3983 |
[(set (match_operand:SF 0 "push_operand" "=X,X,X") |
| 3984 |
(match_operand:SF 1 "nonmemory_no_elim_operand" "f,rF,v"))] |
| 3985 |
"TARGET_64BIT" |
| 3986 |
{ |
| 3987 |
/* Anything else should be already split before reg-stack. */ |
| 3988 |
if (which_alternative != 1) |
| 3989 |
return "#"; |
| 3990 |
return "push{q}\t%q1"; |
| 3991 |
} |
| 3992 |
[(set_attr "type" "multi,push,multi") |
| 3993 |
(set_attr "unit" "i387,*,*") |
| 3994 |
(set_attr "mode" "SF,DI,SF")]) |
| 3995 |
|
| 3996 |
(define_insn "*pushsf" |
| 3997 |
[(set (match_operand:SF 0 "push_operand" "=<,<,<") |
| 3998 |
(match_operand:SF 1 "general_no_elim_operand" "f,rmF,v"))] |
| 3999 |
"!TARGET_64BIT" |
| 4000 |
{ |
| 4001 |
/* Anything else should be already split before reg-stack. */ |
| 4002 |
if (which_alternative != 1) |
| 4003 |
return "#"; |
| 4004 |
return "push{l}\t%1"; |
| 4005 |
} |
| 4006 |
[(set_attr "type" "multi,push,multi") |
| 4007 |
(set_attr "unit" "i387,*,*") |
| 4008 |
(set_attr "mode" "SF,SI,SF")]) |
| 4009 |
|
| 4010 |
(define_mode_iterator MODESH [SF HF BF]) |
| 4011 |
;; %%% Kill this when call knows how to work this out. |
| 4012 |
(define_split |
| 4013 |
[(set (match_operand:MODESH 0 "push_operand") |
| 4014 |
(match_operand:MODESH 1 "any_fp_register_operand"))] |
| 4015 |
"reload_completed" |
| 4016 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) |
| 4017 |
(set (match_dup 0) (match_dup 1))] |
| 4018 |
{ |
| 4019 |
rtx op = XEXP (operands[0], 0); |
| 4020 |
if (GET_CODE (op) == PRE_DEC) |
| 4021 |
{ |
| 4022 |
gcc_assert (!TARGET_64BIT); |
| 4023 |
op = GEN_INT (-4); |
| 4024 |
} |
| 4025 |
else |
| 4026 |
{ |
| 4027 |
op = XEXP (XEXP (op, 1), 1); |
| 4028 |
gcc_assert (CONST_INT_P (op)); |
| 4029 |
} |
| 4030 |
operands[2] = op; |
| 4031 |
/* Preserve memory attributes. */ |
| 4032 |
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx); |
| 4033 |
}) |
| 4034 |
|
| 4035 |
(define_split |
| 4036 |
[(set (match_operand:SF 0 "push_operand") |
| 4037 |
(match_operand:SF 1 "memory_operand"))] |
| 4038 |
"reload_completed |
| 4039 |
&& find_constant_src (insn)" |
| 4040 |
[(set (match_dup 0) (match_dup 2))] |
| 4041 |
"operands[2] = find_constant_src (curr_insn);") |
| 4042 |
|
| 4043 |
(define_split |
| 4044 |
[(set (match_operand 0 "push_operand") |
| 4045 |
(match_operand 1 "general_gr_operand"))] |
| 4046 |
"reload_completed |
| 4047 |
&& (GET_MODE (operands[0]) == TFmode |
| 4048 |
|| GET_MODE (operands[0]) == XFmode |
| 4049 |
|| GET_MODE (operands[0]) == DFmode)" |
| 4050 |
[(const_int 0)] |
| 4051 |
"ix86_split_long_move (operands); DONE;") |
| 4052 |
|
| 4053 |
;; Floating point move instructions. |
| 4054 |
|
| 4055 |
(define_expand "movtf" |
| 4056 |
[(set (match_operand:TF 0 "nonimmediate_operand") |
| 4057 |
(match_operand:TF 1 "nonimmediate_operand"))] |
| 4058 |
"TARGET_64BIT || TARGET_SSE" |
| 4059 |
"ix86_expand_move (TFmode, operands); DONE;") |
| 4060 |
|
| 4061 |
(define_expand "mov<mode>" |
| 4062 |
[(set (match_operand:X87MODEFH 0 "nonimmediate_operand") |
| 4063 |
(match_operand:X87MODEFH 1 "general_operand"))] |
| 4064 |
"" |
| 4065 |
"ix86_expand_move (<MODE>mode, operands); DONE;") |
| 4066 |
|
| 4067 |
(define_insn "*movtf_internal" |
| 4068 |
[(set (match_operand:TF 0 "nonimmediate_operand" "=v,v ,m,?*r ,!o") |
| 4069 |
(match_operand:TF 1 "general_operand" "C ,vm,v,*roF,*rC"))] |
| 4070 |
"(TARGET_64BIT || TARGET_SSE) |
| 4071 |
&& !(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 4072 |
&& (lra_in_progress || reload_completed |
| 4073 |
|| !CONST_DOUBLE_P (operands[1]) |
| 4074 |
|| (standard_sse_constant_p (operands[1], TFmode) == 1 |
| 4075 |
&& !memory_operand (operands[0], TFmode)) |
| 4076 |
|| (!TARGET_MEMORY_MISMATCH_STALL |
| 4077 |
&& memory_operand (operands[0], TFmode)))" |
| 4078 |
{ |
| 4079 |
switch (get_attr_type (insn)) |
| 4080 |
{ |
| 4081 |
case TYPE_SSELOG1: |
| 4082 |
return standard_sse_constant_opcode (insn, operands); |
| 4083 |
|
| 4084 |
case TYPE_SSEMOV: |
| 4085 |
return ix86_output_ssemov (insn, operands); |
| 4086 |
|
| 4087 |
case TYPE_MULTI: |
| 4088 |
return "#"; |
| 4089 |
|
| 4090 |
default: |
| 4091 |
gcc_unreachable (); |
| 4092 |
} |
| 4093 |
} |
| 4094 |
[(set_attr "isa" "*,*,*,x64,x64") |
| 4095 |
(set_attr "type" "sselog1,ssemov,ssemov,multi,multi") |
| 4096 |
(set_attr "c86_attr" "sselogic,*,*,*,*") |
| 4097 |
(set (attr "prefix") |
| 4098 |
(if_then_else (eq_attr "type" "sselog1,ssemov") |
| 4099 |
(const_string "maybe_vex") |
| 4100 |
(const_string "orig"))) |
| 4101 |
(set (attr "mode") |
| 4102 |
(cond [(eq_attr "alternative" "3,4") |
| 4103 |
(const_string "DI") |
| 4104 |
(match_test "TARGET_AVX") |
| 4105 |
(const_string "TI") |
| 4106 |
(ior (not (match_test "TARGET_SSE2")) |
| 4107 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 4108 |
(const_string "V4SF") |
| 4109 |
(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL") |
| 4110 |
(const_string "V4SF") |
| 4111 |
(and (eq_attr "alternative" "2") |
| 4112 |
(match_test "TARGET_SSE_TYPELESS_STORES")) |
| 4113 |
(const_string "V4SF") |
| 4114 |
] |
| 4115 |
(const_string "TI")))]) |
| 4116 |
|
| 4117 |
(define_split |
| 4118 |
[(set (match_operand:TF 0 "nonimmediate_gr_operand") |
| 4119 |
(match_operand:TF 1 "general_gr_operand"))] |
| 4120 |
"reload_completed" |
| 4121 |
[(const_int 0)] |
| 4122 |
"ix86_split_long_move (operands); DONE;") |
| 4123 |
|
| 4124 |
;; Possible store forwarding (partial memory) stall |
| 4125 |
;; in alternatives 4, 6, 7 and 8. |
| 4126 |
(define_insn "*movxf_internal" |
| 4127 |
[(set (match_operand:XF 0 "nonimmediate_operand" |
| 4128 |
"=f,m,f,?r ,!o,?*r ,!o,!o,!o,r ,o ,o") |
| 4129 |
(match_operand:XF 1 "general_operand" |
| 4130 |
"fm,f,G,roF,r ,*roF,*r,F ,C ,roF,rF,rC"))] |
| 4131 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 4132 |
&& (lra_in_progress || reload_completed |
| 4133 |
|| !CONST_DOUBLE_P (operands[1]) |
| 4134 |
|| ((optimize_function_for_size_p (cfun) |
| 4135 |
|| (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)) |
| 4136 |
&& standard_80387_constant_p (operands[1]) > 0 |
| 4137 |
&& !memory_operand (operands[0], XFmode)) |
| 4138 |
|| (!TARGET_MEMORY_MISMATCH_STALL |
| 4139 |
&& memory_operand (operands[0], XFmode)) |
| 4140 |
|| !TARGET_HARD_XF_REGS)" |
| 4141 |
{ |
| 4142 |
switch (get_attr_type (insn)) |
| 4143 |
{ |
| 4144 |
case TYPE_FMOV: |
| 4145 |
if (which_alternative == 2) |
| 4146 |
return standard_80387_constant_opcode (operands[1]); |
| 4147 |
return output_387_reg_move (insn, operands); |
| 4148 |
|
| 4149 |
case TYPE_MULTI: |
| 4150 |
return "#"; |
| 4151 |
|
| 4152 |
default: |
| 4153 |
gcc_unreachable (); |
| 4154 |
} |
| 4155 |
} |
| 4156 |
[(set (attr "isa") |
| 4157 |
(cond [(eq_attr "alternative" "7,10") |
| 4158 |
(const_string "nox64") |
| 4159 |
(eq_attr "alternative" "8,11") |
| 4160 |
(const_string "x64") |
| 4161 |
] |
| 4162 |
(const_string "*"))) |
| 4163 |
(set (attr "type") |
| 4164 |
(cond [(eq_attr "alternative" "3,4,5,6,7,8,9,10,11") |
| 4165 |
(const_string "multi") |
| 4166 |
] |
| 4167 |
(const_string "fmov"))) |
| 4168 |
(set (attr "mode") |
| 4169 |
(cond [(eq_attr "alternative" "3,4,5,6,7,8,9,10,11") |
| 4170 |
(if_then_else (match_test "TARGET_64BIT") |
| 4171 |
(const_string "DI") |
| 4172 |
(const_string "SI")) |
| 4173 |
] |
| 4174 |
(const_string "XF"))) |
| 4175 |
(set (attr "preferred_for_size") |
| 4176 |
(cond [(eq_attr "alternative" "3,4") |
| 4177 |
(symbol_ref "false")] |
| 4178 |
(symbol_ref "true"))) |
| 4179 |
(set (attr "enabled") |
| 4180 |
(cond [(eq_attr "alternative" "9,10,11") |
| 4181 |
(if_then_else |
| 4182 |
(match_test "TARGET_HARD_XF_REGS") |
| 4183 |
(symbol_ref "false") |
| 4184 |
(const_string "*")) |
| 4185 |
(not (match_test "TARGET_HARD_XF_REGS")) |
| 4186 |
(symbol_ref "false") |
| 4187 |
] |
| 4188 |
(const_string "*")))]) |
| 4189 |
|
| 4190 |
(define_split |
| 4191 |
[(set (match_operand:XF 0 "nonimmediate_gr_operand") |
| 4192 |
(match_operand:XF 1 "general_gr_operand"))] |
| 4193 |
"reload_completed" |
| 4194 |
[(const_int 0)] |
| 4195 |
"ix86_split_long_move (operands); DONE;") |
| 4196 |
|
| 4197 |
;; Possible store forwarding (partial memory) stall in alternatives 4, 6 and 7. |
| 4198 |
(define_insn "*movdf_internal" |
| 4199 |
[(set (match_operand:DF 0 "nonimmediate_operand" |
| 4200 |
"=Yf*f,m ,Yf*f,?r ,!o,?*r ,!o,!o,?r,?m,?r,?r,Yv,v,v,m,*x,*x,*x,m ,?r,?v,r ,o ,r ,m") |
| 4201 |
(match_operand:DF 1 "general_operand" |
| 4202 |
"Yf*fm,Yf*f,G ,roF,r ,*roF,*r,F ,rm,rC,C ,F ,C ,v,m,v,C ,*x,m ,*x, v, r,roF,rF,rmF,rC"))] |
| 4203 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 4204 |
&& (lra_in_progress || reload_completed |
| 4205 |
|| !CONST_DOUBLE_P (operands[1]) |
| 4206 |
|| ((optimize_function_for_size_p (cfun) |
| 4207 |
|| (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)) |
| 4208 |
&& IS_STACK_MODE (DFmode) |
| 4209 |
&& standard_80387_constant_p (operands[1]) > 0 |
| 4210 |
&& !memory_operand (operands[0], DFmode)) |
| 4211 |
|| (TARGET_SSE2 && TARGET_SSE_MATH |
| 4212 |
&& standard_sse_constant_p (operands[1], DFmode) == 1 |
| 4213 |
&& !memory_operand (operands[0], DFmode)) |
| 4214 |
|| ((TARGET_64BIT || !TARGET_MEMORY_MISMATCH_STALL) |
| 4215 |
&& memory_operand (operands[0], DFmode)) |
| 4216 |
|| !TARGET_HARD_DF_REGS)" |
| 4217 |
{ |
| 4218 |
switch (get_attr_type (insn)) |
| 4219 |
{ |
| 4220 |
case TYPE_FMOV: |
| 4221 |
if (which_alternative == 2) |
| 4222 |
return standard_80387_constant_opcode (operands[1]); |
| 4223 |
return output_387_reg_move (insn, operands); |
| 4224 |
|
| 4225 |
case TYPE_MULTI: |
| 4226 |
return "#"; |
| 4227 |
|
| 4228 |
case TYPE_IMOV: |
| 4229 |
if (get_attr_mode (insn) == MODE_SI) |
| 4230 |
return "mov{l}\t{%1, %k0|%k0, %1}"; |
| 4231 |
else if (which_alternative == 11) |
| 4232 |
return "movabs{q}\t{%1, %0|%0, %1}"; |
| 4233 |
else |
| 4234 |
return "mov{q}\t{%1, %0|%0, %1}"; |
| 4235 |
|
| 4236 |
case TYPE_SSELOG1: |
| 4237 |
return standard_sse_constant_opcode (insn, operands); |
| 4238 |
|
| 4239 |
case TYPE_SSEMOV: |
| 4240 |
return ix86_output_ssemov (insn, operands); |
| 4241 |
|
| 4242 |
default: |
| 4243 |
gcc_unreachable (); |
| 4244 |
} |
| 4245 |
} |
| 4246 |
[(set (attr "isa") |
| 4247 |
(cond [(eq_attr "alternative" "3,4,5,6,7,22,23") |
| 4248 |
(const_string "nox64") |
| 4249 |
(eq_attr "alternative" "8,9,10,11,24,25") |
| 4250 |
(const_string "x64") |
| 4251 |
(eq_attr "alternative" "12,13,14,15") |
| 4252 |
(const_string "sse2") |
| 4253 |
(eq_attr "alternative" "20,21") |
| 4254 |
(const_string "x64_sse2") |
| 4255 |
] |
| 4256 |
(const_string "*"))) |
| 4257 |
(set (attr "type") |
| 4258 |
(cond [(eq_attr "alternative" "0,1,2") |
| 4259 |
(const_string "fmov") |
| 4260 |
(eq_attr "alternative" "3,4,5,6,7,22,23") |
| 4261 |
(const_string "multi") |
| 4262 |
(eq_attr "alternative" "8,9,10,11,24,25") |
| 4263 |
(const_string "imov") |
| 4264 |
(eq_attr "alternative" "12,16") |
| 4265 |
(const_string "sselog1") |
| 4266 |
] |
| 4267 |
(const_string "ssemov"))) |
| 4268 |
(set (attr "c86_attr") |
| 4269 |
(if_then_else (eq_attr "alternative" "12,16") |
| 4270 |
(const_string "sselogic") |
| 4271 |
(const_string "*"))) |
| 4272 |
(set (attr "modrm") |
| 4273 |
(if_then_else (eq_attr "alternative" "11") |
| 4274 |
(const_string "0") |
| 4275 |
(const_string "*"))) |
| 4276 |
(set (attr "length_immediate") |
| 4277 |
(if_then_else (eq_attr "alternative" "11") |
| 4278 |
(const_string "8") |
| 4279 |
(const_string "*"))) |
| 4280 |
(set (attr "prefix") |
| 4281 |
(if_then_else (eq_attr "type" "sselog1,ssemov") |
| 4282 |
(const_string "maybe_vex") |
| 4283 |
(const_string "orig"))) |
| 4284 |
(set (attr "prefix_data16") |
| 4285 |
(if_then_else |
| 4286 |
(ior (and (eq_attr "type" "ssemov") (eq_attr "mode" "DI")) |
| 4287 |
(eq_attr "mode" "V1DF")) |
| 4288 |
(const_string "1") |
| 4289 |
(const_string "*"))) |
| 4290 |
(set (attr "mode") |
| 4291 |
(cond [(eq_attr "alternative" "3,4,5,6,7,10,22,23") |
| 4292 |
(const_string "SI") |
| 4293 |
(eq_attr "alternative" "8,9,11,20,21,24,25") |
| 4294 |
(const_string "DI") |
| 4295 |
|
| 4296 |
/* xorps is one byte shorter for non-AVX targets. */ |
| 4297 |
(eq_attr "alternative" "12,16") |
| 4298 |
(cond [(match_test "TARGET_AVX") |
| 4299 |
(const_string "V2DF") |
| 4300 |
(ior (not (match_test "TARGET_SSE2")) |
| 4301 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 4302 |
(const_string "V4SF") |
| 4303 |
(match_test "TARGET_SSE_LOAD0_BY_PXOR") |
| 4304 |
(const_string "TI") |
| 4305 |
] |
| 4306 |
(const_string "V2DF")) |
| 4307 |
|
| 4308 |
/* For architectures resolving dependencies on |
| 4309 |
whole SSE registers use movapd to break dependency |
| 4310 |
chains, otherwise use short move to avoid extra work. */ |
| 4311 |
|
| 4312 |
/* movaps is one byte shorter for non-AVX targets. */ |
| 4313 |
(eq_attr "alternative" "13,17") |
| 4314 |
(cond [(match_test "TARGET_AVX512VL") |
| 4315 |
(const_string "V2DF") |
| 4316 |
(match_test "TARGET_AVX512F") |
| 4317 |
(const_string "DF") |
| 4318 |
(match_test "TARGET_AVX") |
| 4319 |
(const_string "V2DF") |
| 4320 |
(ior (not (match_test "TARGET_SSE2")) |
| 4321 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 4322 |
(const_string "V4SF") |
| 4323 |
(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL") |
| 4324 |
(const_string "V4SF") |
| 4325 |
(match_test "TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 4326 |
(const_string "V2DF") |
| 4327 |
] |
| 4328 |
(const_string "DF")) |
| 4329 |
|
| 4330 |
/* For architectures resolving dependencies on register |
| 4331 |
parts we may avoid extra work to zero out upper part |
| 4332 |
of register. */ |
| 4333 |
(eq_attr "alternative" "14,18") |
| 4334 |
(cond [(not (match_test "TARGET_SSE2")) |
| 4335 |
(const_string "V2SF") |
| 4336 |
(match_test "TARGET_AVX") |
| 4337 |
(const_string "DF") |
| 4338 |
(match_test "TARGET_SSE_SPLIT_REGS") |
| 4339 |
(const_string "V1DF") |
| 4340 |
] |
| 4341 |
(const_string "DF")) |
| 4342 |
|
| 4343 |
(and (eq_attr "alternative" "15,19") |
| 4344 |
(not (match_test "TARGET_SSE2"))) |
| 4345 |
(const_string "V2SF") |
| 4346 |
] |
| 4347 |
(const_string "DF"))) |
| 4348 |
(set (attr "preferred_for_size") |
| 4349 |
(cond [(eq_attr "alternative" "3,4") |
| 4350 |
(symbol_ref "false")] |
| 4351 |
(symbol_ref "true"))) |
| 4352 |
(set (attr "preferred_for_speed") |
| 4353 |
(cond [(eq_attr "alternative" "3,4") |
| 4354 |
(symbol_ref "TARGET_INTEGER_DFMODE_MOVES") |
| 4355 |
(eq_attr "alternative" "20") |
| 4356 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 4357 |
(eq_attr "alternative" "21") |
| 4358 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 4359 |
] |
| 4360 |
(symbol_ref "true"))) |
| 4361 |
(set (attr "enabled") |
| 4362 |
(cond [(eq_attr "alternative" "22,23,24,25") |
| 4363 |
(if_then_else |
| 4364 |
(match_test "TARGET_HARD_DF_REGS") |
| 4365 |
(symbol_ref "false") |
| 4366 |
(const_string "*")) |
| 4367 |
(not (match_test "TARGET_HARD_DF_REGS")) |
| 4368 |
(symbol_ref "false") |
| 4369 |
] |
| 4370 |
(const_string "*")))]) |
| 4371 |
|
| 4372 |
(define_split |
| 4373 |
[(set (match_operand:DF 0 "nonimmediate_gr_operand") |
| 4374 |
(match_operand:DF 1 "general_gr_operand"))] |
| 4375 |
"!TARGET_64BIT && reload_completed" |
| 4376 |
[(const_int 0)] |
| 4377 |
"ix86_split_long_move (operands); DONE;") |
| 4378 |
|
| 4379 |
(define_insn "*movsf_internal" |
| 4380 |
[(set (match_operand:SF 0 "nonimmediate_operand" |
| 4381 |
"=Yf*f,m ,Yf*f,?r ,?m,Yv,v,v,m,?r,?v,!*y,!*y,!m,!r,!*y,r ,m") |
| 4382 |
(match_operand:SF 1 "general_operand" |
| 4383 |
"Yf*fm,Yf*f,G ,rmF,rF,C ,v,m,v,v ,r ,*y ,m ,*y,*y,r ,rmF,rF"))] |
| 4384 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 4385 |
&& (lra_in_progress || reload_completed |
| 4386 |
|| !CONST_DOUBLE_P (operands[1]) |
| 4387 |
|| ((optimize_function_for_size_p (cfun) |
| 4388 |
|| (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)) |
| 4389 |
&& IS_STACK_MODE (SFmode) |
| 4390 |
&& standard_80387_constant_p (operands[1]) > 0) |
| 4391 |
|| (TARGET_SSE && TARGET_SSE_MATH |
| 4392 |
&& standard_sse_constant_p (operands[1], SFmode) == 1) |
| 4393 |
|| memory_operand (operands[0], SFmode) |
| 4394 |
|| !TARGET_HARD_SF_REGS)" |
| 4395 |
{ |
| 4396 |
switch (get_attr_type (insn)) |
| 4397 |
{ |
| 4398 |
case TYPE_FMOV: |
| 4399 |
if (which_alternative == 2) |
| 4400 |
return standard_80387_constant_opcode (operands[1]); |
| 4401 |
return output_387_reg_move (insn, operands); |
| 4402 |
|
| 4403 |
case TYPE_IMOV: |
| 4404 |
return "mov{l}\t{%1, %0|%0, %1}"; |
| 4405 |
|
| 4406 |
case TYPE_SSELOG1: |
| 4407 |
return standard_sse_constant_opcode (insn, operands); |
| 4408 |
|
| 4409 |
case TYPE_SSEMOV: |
| 4410 |
return ix86_output_ssemov (insn, operands); |
| 4411 |
|
| 4412 |
case TYPE_MMXMOV: |
| 4413 |
switch (get_attr_mode (insn)) |
| 4414 |
{ |
| 4415 |
case MODE_DI: |
| 4416 |
return "movq\t{%1, %0|%0, %1}"; |
| 4417 |
case MODE_SI: |
| 4418 |
return "movd\t{%1, %0|%0, %1}"; |
| 4419 |
|
| 4420 |
default: |
| 4421 |
gcc_unreachable (); |
| 4422 |
} |
| 4423 |
|
| 4424 |
default: |
| 4425 |
gcc_unreachable (); |
| 4426 |
} |
| 4427 |
} |
| 4428 |
[(set (attr "isa") |
| 4429 |
(cond [(eq_attr "alternative" "9,10") |
| 4430 |
(const_string "sse2") |
| 4431 |
] |
| 4432 |
(const_string "*"))) |
| 4433 |
(set (attr "type") |
| 4434 |
(cond [(eq_attr "alternative" "0,1,2") |
| 4435 |
(const_string "fmov") |
| 4436 |
(eq_attr "alternative" "3,4,16,17") |
| 4437 |
(const_string "imov") |
| 4438 |
(eq_attr "alternative" "5") |
| 4439 |
(const_string "sselog1") |
| 4440 |
(eq_attr "alternative" "11,12,13,14,15") |
| 4441 |
(const_string "mmxmov") |
| 4442 |
] |
| 4443 |
(const_string "ssemov"))) |
| 4444 |
(set (attr "c86_attr") |
| 4445 |
(if_then_else (eq_attr "alternative" "5") |
| 4446 |
(const_string "sselogic") |
| 4447 |
(const_string "*"))) |
| 4448 |
(set (attr "prefix") |
| 4449 |
(if_then_else (eq_attr "type" "sselog1,ssemov") |
| 4450 |
(const_string "maybe_vex") |
| 4451 |
(const_string "orig"))) |
| 4452 |
(set (attr "prefix_data16") |
| 4453 |
(if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI")) |
| 4454 |
(const_string "1") |
| 4455 |
(const_string "*"))) |
| 4456 |
(set (attr "mode") |
| 4457 |
(cond [(eq_attr "alternative" "3,4,9,10,12,13,14,15,16,17") |
| 4458 |
(const_string "SI") |
| 4459 |
(eq_attr "alternative" "11") |
| 4460 |
(const_string "DI") |
| 4461 |
(eq_attr "alternative" "5") |
| 4462 |
(cond [(and (match_test "TARGET_AVX512F && TARGET_EVEX512") |
| 4463 |
(not (match_test "TARGET_PREFER_AVX256"))) |
| 4464 |
(const_string "V16SF") |
| 4465 |
(match_test "TARGET_AVX") |
| 4466 |
(const_string "V4SF") |
| 4467 |
(ior (not (match_test "TARGET_SSE2")) |
| 4468 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 4469 |
(const_string "V4SF") |
| 4470 |
(match_test "TARGET_SSE_LOAD0_BY_PXOR") |
| 4471 |
(const_string "TI") |
| 4472 |
] |
| 4473 |
(const_string "V4SF")) |
| 4474 |
|
| 4475 |
/* For architectures resolving dependencies on |
| 4476 |
whole SSE registers use APS move to break dependency |
| 4477 |
chains, otherwise use short move to avoid extra work. |
| 4478 |
|
| 4479 |
Do the same for architectures resolving dependencies on |
| 4480 |
the parts. While in DF mode it is better to always handle |
| 4481 |
just register parts, the SF mode is different due to lack |
| 4482 |
of instructions to load just part of the register. It is |
| 4483 |
better to maintain the whole registers in single format |
| 4484 |
to avoid problems on using packed logical operations. */ |
| 4485 |
(eq_attr "alternative" "6") |
| 4486 |
(cond [(match_test "TARGET_AVX512VL") |
| 4487 |
(const_string "V4SF") |
| 4488 |
(match_test "TARGET_AVX512F") |
| 4489 |
(const_string "SF") |
| 4490 |
(ior (match_test "TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 4491 |
(match_test "TARGET_SSE_SPLIT_REGS")) |
| 4492 |
(const_string "V4SF") |
| 4493 |
] |
| 4494 |
(const_string "SF")) |
| 4495 |
] |
| 4496 |
(const_string "SF"))) |
| 4497 |
(set (attr "preferred_for_speed") |
| 4498 |
(cond [(eq_attr "alternative" "9,14") |
| 4499 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 4500 |
(eq_attr "alternative" "10,15") |
| 4501 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 4502 |
] |
| 4503 |
(symbol_ref "true"))) |
| 4504 |
(set (attr "enabled") |
| 4505 |
(cond [(eq_attr "alternative" "16,17") |
| 4506 |
(if_then_else |
| 4507 |
(match_test "TARGET_HARD_SF_REGS") |
| 4508 |
(symbol_ref "false") |
| 4509 |
(const_string "*")) |
| 4510 |
(not (match_test "TARGET_HARD_SF_REGS")) |
| 4511 |
(symbol_ref "false") |
| 4512 |
] |
| 4513 |
(const_string "*")))]) |
| 4514 |
|
| 4515 |
(define_mode_attr hfbfconstf |
| 4516 |
[(HF "F") (BF "")]) |
| 4517 |
|
| 4518 |
(define_insn "*mov<mode>_internal" |
| 4519 |
[(set (match_operand:HFBF 0 "nonimmediate_operand" |
| 4520 |
"=?r,?r,?r,?m ,Yv,v,?r,jm,m,?v,v") |
| 4521 |
(match_operand:HFBF 1 "general_operand" |
| 4522 |
"r ,F ,m ,r<hfbfconstf>,C ,v, v,v ,v,r ,m"))] |
| 4523 |
"!(MEM_P (operands[0]) && MEM_P (operands[1])) |
| 4524 |
&& (lra_in_progress |
| 4525 |
|| reload_completed |
| 4526 |
|| !CONST_DOUBLE_P (operands[1]) |
| 4527 |
|| (TARGET_SSE2 |
| 4528 |
&& standard_sse_constant_p (operands[1], <MODE>mode) == 1) |
| 4529 |
|| memory_operand (operands[0], <MODE>mode))" |
| 4530 |
{ |
| 4531 |
switch (get_attr_type (insn)) |
| 4532 |
{ |
| 4533 |
case TYPE_IMOVX: |
| 4534 |
/* movzwl is faster than movw on p2 due to partial word stalls, |
| 4535 |
though not as fast as an aligned movl. */ |
| 4536 |
return "movz{wl|x}\t{%1, %k0|%k0, %1}"; |
| 4537 |
|
| 4538 |
case TYPE_SSEMOV: |
| 4539 |
return ix86_output_ssemov (insn, operands); |
| 4540 |
|
| 4541 |
case TYPE_SSELOG1: |
| 4542 |
if (satisfies_constraint_C (operands[1])) |
| 4543 |
return standard_sse_constant_opcode (insn, operands); |
| 4544 |
|
| 4545 |
if (SSE_REG_P (operands[0])) |
| 4546 |
return "%vpinsrw\t{$0, %1, %d0|%d0, %1, 0}"; |
| 4547 |
else |
| 4548 |
return "%vpextrw\t{$0, %1, %0|%0, %1, 0}"; |
| 4549 |
|
| 4550 |
default: |
| 4551 |
if (get_attr_mode (insn) == MODE_SI) |
| 4552 |
return "mov{l}\t{%k1, %k0|%k0, %k1}"; |
| 4553 |
else |
| 4554 |
return "mov{w}\t{%1, %0|%0, %1}"; |
| 4555 |
} |
| 4556 |
} |
| 4557 |
[(set (attr "isa") |
| 4558 |
(cond [(eq_attr "alternative" "4,5,6,9,10") |
| 4559 |
(const_string "sse2") |
| 4560 |
(eq_attr "alternative" "7") |
| 4561 |
(const_string "sse4_noavx") |
| 4562 |
(eq_attr "alternative" "8") |
| 4563 |
(const_string "avx") |
| 4564 |
] |
| 4565 |
(const_string "*"))) |
| 4566 |
(set (attr "addr") |
| 4567 |
(if_then_else (eq_attr "alternative" "7") |
| 4568 |
(const_string "gpr16") |
| 4569 |
(const_string "*"))) |
| 4570 |
(set (attr "type") |
| 4571 |
(cond [(eq_attr "alternative" "4") |
| 4572 |
(const_string "sselog1") |
| 4573 |
(eq_attr "alternative" "5,6,9") |
| 4574 |
(const_string "ssemov") |
| 4575 |
(eq_attr "alternative" "7,8,10") |
| 4576 |
(if_then_else |
| 4577 |
(match_test ("TARGET_AVX512FP16")) |
| 4578 |
(const_string "ssemov") |
| 4579 |
(const_string "sselog1")) |
| 4580 |
(match_test "optimize_function_for_size_p (cfun)") |
| 4581 |
(const_string "imov") |
| 4582 |
(and (eq_attr "alternative" "0") |
| 4583 |
(ior (not (match_test "TARGET_PARTIAL_REG_STALL")) |
| 4584 |
(not (match_test "TARGET_HIMODE_MATH")))) |
| 4585 |
(const_string "imov") |
| 4586 |
(and (eq_attr "alternative" "1,2") |
| 4587 |
(match_operand:HI 1 "aligned_operand")) |
| 4588 |
(const_string "imov") |
| 4589 |
(and (match_test "TARGET_MOVX") |
| 4590 |
(eq_attr "alternative" "0,2")) |
| 4591 |
(const_string "imovx") |
| 4592 |
] |
| 4593 |
(const_string "imov"))) |
| 4594 |
(set (attr "prefix") |
| 4595 |
(cond [(eq_attr "alternative" "4,5,6,7,8,9,10") |
| 4596 |
(const_string "maybe_vex") |
| 4597 |
] |
| 4598 |
(const_string "orig"))) |
| 4599 |
(set (attr "mode") |
| 4600 |
(cond [(eq_attr "alternative" "4") |
| 4601 |
(const_string "V4SF") |
| 4602 |
(eq_attr "alternative" "6,9") |
| 4603 |
(if_then_else |
| 4604 |
(match_test "TARGET_AVX512FP16") |
| 4605 |
(const_string "HI") |
| 4606 |
(const_string "SI")) |
| 4607 |
(eq_attr "alternative" "7,8,10") |
| 4608 |
(if_then_else |
| 4609 |
(match_test "TARGET_AVX512FP16") |
| 4610 |
(const_string "HI") |
| 4611 |
(const_string "TI")) |
| 4612 |
(eq_attr "alternative" "5") |
| 4613 |
(cond [(match_test "TARGET_AVX512VL") |
| 4614 |
(const_string "V4SF") |
| 4615 |
(match_test "TARGET_AVX512FP16") |
| 4616 |
(const_string "HF") |
| 4617 |
(match_test "TARGET_AVX512F") |
| 4618 |
(const_string "SF") |
| 4619 |
(match_test "TARGET_AVX") |
| 4620 |
(const_string "V4SF") |
| 4621 |
(ior (match_test "TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 4622 |
(match_test "TARGET_SSE_SPLIT_REGS")) |
| 4623 |
(const_string "V4SF") |
| 4624 |
] |
| 4625 |
(const_string "SF")) |
| 4626 |
(eq_attr "type" "imovx") |
| 4627 |
(const_string "SI") |
| 4628 |
(and (eq_attr "alternative" "1,2") |
| 4629 |
(match_operand:HI 1 "aligned_operand")) |
| 4630 |
(const_string "SI") |
| 4631 |
(and (eq_attr "alternative" "0") |
| 4632 |
(ior (not (match_test "TARGET_PARTIAL_REG_STALL")) |
| 4633 |
(not (match_test "TARGET_HIMODE_MATH")))) |
| 4634 |
(const_string "SI") |
| 4635 |
] |
| 4636 |
(const_string "HI"))) |
| 4637 |
(set (attr "enabled") |
| 4638 |
(cond [(and (match_test "<MODE>mode == BFmode") |
| 4639 |
(eq_attr "alternative" "1")) |
| 4640 |
(symbol_ref "false") |
| 4641 |
] |
| 4642 |
(const_string "*")))]) |
| 4643 |
|
| 4644 |
(define_split |
| 4645 |
[(set (match_operand 0 "any_fp_register_operand") |
| 4646 |
(match_operand 1 "memory_operand"))] |
| 4647 |
"reload_completed |
| 4648 |
&& (GET_MODE (operands[0]) == TFmode |
| 4649 |
|| GET_MODE (operands[0]) == XFmode |
| 4650 |
|| GET_MODE (operands[0]) == DFmode |
| 4651 |
|| GET_MODE (operands[0]) == SFmode) |
| 4652 |
&& ix86_standard_x87sse_constant_load_p (insn, operands[0])" |
| 4653 |
[(set (match_dup 0) (match_dup 2))] |
| 4654 |
"operands[2] = find_constant_src (curr_insn);") |
| 4655 |
|
| 4656 |
(define_split |
| 4657 |
[(set (match_operand 0 "any_fp_register_operand") |
| 4658 |
(float_extend (match_operand 1 "memory_operand")))] |
| 4659 |
"reload_completed |
| 4660 |
&& (GET_MODE (operands[0]) == TFmode |
| 4661 |
|| GET_MODE (operands[0]) == XFmode |
| 4662 |
|| GET_MODE (operands[0]) == DFmode) |
| 4663 |
&& ix86_standard_x87sse_constant_load_p (insn, operands[0])" |
| 4664 |
[(set (match_dup 0) (match_dup 2))] |
| 4665 |
"operands[2] = find_constant_src (curr_insn);") |
| 4666 |
|
| 4667 |
;; Split the load of -0.0 or -1.0 into fldz;fchs or fld1;fchs sequence |
| 4668 |
(define_split |
| 4669 |
[(set (match_operand:X87MODEF 0 "fp_register_operand") |
| 4670 |
(match_operand:X87MODEF 1 "immediate_operand"))] |
| 4671 |
"reload_completed |
| 4672 |
&& (standard_80387_constant_p (operands[1]) == 8 |
| 4673 |
|| standard_80387_constant_p (operands[1]) == 9)" |
| 4674 |
[(set (match_dup 0)(match_dup 1)) |
| 4675 |
(set (match_dup 0) |
| 4676 |
(neg:X87MODEF (match_dup 0)))] |
| 4677 |
{ |
| 4678 |
if (real_isnegzero (CONST_DOUBLE_REAL_VALUE (operands[1]))) |
| 4679 |
operands[1] = CONST0_RTX (<MODE>mode); |
| 4680 |
else |
| 4681 |
operands[1] = CONST1_RTX (<MODE>mode); |
| 4682 |
}) |
| 4683 |
|
| 4684 |
(define_insn "*swapxf" |
| 4685 |
[(set (match_operand:XF 0 "register_operand" "+f") |
| 4686 |
(match_operand:XF 1 "register_operand" "+f")) |
| 4687 |
(set (match_dup 1) |
| 4688 |
(match_dup 0))] |
| 4689 |
"TARGET_80387" |
| 4690 |
{ |
| 4691 |
if (STACK_TOP_P (operands[0])) |
| 4692 |
return "fxch\t%1"; |
| 4693 |
else |
| 4694 |
return "fxch\t%0"; |
| 4695 |
} |
| 4696 |
[(set_attr "type" "fxch") |
| 4697 |
(set_attr "mode" "XF")]) |
| 4698 |
|
| 4699 |
|
| 4700 |
;; Zero extension instructions |
| 4701 |
|
| 4702 |
(define_insn_and_split "zero_extendditi2" |
| 4703 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=r,o") |
| 4704 |
(zero_extend:TI (match_operand:DI 1 "nonimmediate_operand" "rm,r")))] |
| 4705 |
"TARGET_64BIT" |
| 4706 |
"#" |
| 4707 |
"&& reload_completed" |
| 4708 |
[(set (match_dup 3) (match_dup 1)) |
| 4709 |
(set (match_dup 4) (const_int 0))] |
| 4710 |
"split_double_mode (TImode, &operands[0], 1, &operands[3], &operands[4]);") |
| 4711 |
|
| 4712 |
(define_expand "zero_extendsidi2" |
| 4713 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 4714 |
(zero_extend:DI (match_operand:SI 1 "nonimmediate_operand")))]) |
| 4715 |
|
| 4716 |
(define_insn "*zero_extendsidi2" |
| 4717 |
[(set (match_operand:DI 0 "nonimmediate_operand" |
| 4718 |
"=r,?r,?o,r ,o,?*y,?!*y,$r,$v,$x,*x,*v,?r,?k") |
| 4719 |
(zero_extend:DI |
| 4720 |
(match_operand:SI 1 "x86_64_zext_operand" |
| 4721 |
"0 ,rm,r ,rmWz,0,r ,m ,v ,r ,m ,*x,*v,?k,?km")))] |
| 4722 |
"" |
| 4723 |
{ |
| 4724 |
switch (get_attr_type (insn)) |
| 4725 |
{ |
| 4726 |
case TYPE_IMOVX: |
| 4727 |
if (ix86_use_lea_for_mov (insn, operands)) |
| 4728 |
return "lea{l}\t{%E1, %k0|%k0, %E1}"; |
| 4729 |
else |
| 4730 |
return "mov{l}\t{%1, %k0|%k0, %1}"; |
| 4731 |
|
| 4732 |
case TYPE_MULTI: |
| 4733 |
return "#"; |
| 4734 |
|
| 4735 |
case TYPE_MMXMOV: |
| 4736 |
return "movd\t{%1, %0|%0, %1}"; |
| 4737 |
|
| 4738 |
case TYPE_SSEMOV: |
| 4739 |
if (SSE_REG_P (operands[0]) && SSE_REG_P (operands[1])) |
| 4740 |
{ |
| 4741 |
if (EXT_REX_SSE_REG_P (operands[0]) |
| 4742 |
|| EXT_REX_SSE_REG_P (operands[1])) |
| 4743 |
return "vpmovzxdq\t{%t1, %g0|%g0, %t1}"; |
| 4744 |
else |
| 4745 |
return "%vpmovzxdq\t{%1, %0|%0, %1}"; |
| 4746 |
} |
| 4747 |
|
| 4748 |
if (GENERAL_REG_P (operands[0])) |
| 4749 |
return "%vmovd\t{%1, %k0|%k0, %1}"; |
| 4750 |
|
| 4751 |
return "%vmovd\t{%1, %0|%0, %1}"; |
| 4752 |
|
| 4753 |
case TYPE_MSKMOV: |
| 4754 |
return "kmovd\t{%1, %k0|%k0, %1}"; |
| 4755 |
|
| 4756 |
default: |
| 4757 |
gcc_unreachable (); |
| 4758 |
} |
| 4759 |
} |
| 4760 |
[(set (attr "isa") |
| 4761 |
(cond [(eq_attr "alternative" "0,1,2") |
| 4762 |
(const_string "nox64") |
| 4763 |
(eq_attr "alternative" "3") |
| 4764 |
(const_string "x64") |
| 4765 |
(eq_attr "alternative" "7,8,9") |
| 4766 |
(const_string "sse2") |
| 4767 |
(eq_attr "alternative" "10") |
| 4768 |
(const_string "sse4") |
| 4769 |
(eq_attr "alternative" "11") |
| 4770 |
(const_string "avx512f") |
| 4771 |
(eq_attr "alternative" "12") |
| 4772 |
(const_string "x64_avx512bw") |
| 4773 |
(eq_attr "alternative" "13") |
| 4774 |
(const_string "avx512bw") |
| 4775 |
] |
| 4776 |
(const_string "*"))) |
| 4777 |
(set (attr "mmx_isa") |
| 4778 |
(if_then_else (eq_attr "alternative" "5,6") |
| 4779 |
(const_string "native") |
| 4780 |
(const_string "*"))) |
| 4781 |
(set (attr "type") |
| 4782 |
(cond [(eq_attr "alternative" "0,1,2,4") |
| 4783 |
(const_string "multi") |
| 4784 |
(eq_attr "alternative" "5,6") |
| 4785 |
(const_string "mmxmov") |
| 4786 |
(eq_attr "alternative" "7") |
| 4787 |
(if_then_else (match_test "TARGET_64BIT") |
| 4788 |
(const_string "ssemov") |
| 4789 |
(const_string "multi")) |
| 4790 |
(eq_attr "alternative" "8,9,10,11") |
| 4791 |
(const_string "ssemov") |
| 4792 |
(eq_attr "alternative" "12,13") |
| 4793 |
(const_string "mskmov") |
| 4794 |
] |
| 4795 |
(const_string "imovx"))) |
| 4796 |
(set (attr "c86_attr") |
| 4797 |
(if_then_else (eq_attr "alternative" "10,11") |
| 4798 |
(const_string "vpmovx") |
| 4799 |
(const_string "*"))) |
| 4800 |
(set (attr "prefix_extra") |
| 4801 |
(if_then_else (eq_attr "alternative" "10,11") |
| 4802 |
(const_string "1") |
| 4803 |
(const_string "*"))) |
| 4804 |
(set (attr "prefix") |
| 4805 |
(if_then_else (eq_attr "type" "ssemov") |
| 4806 |
(const_string "maybe_vex") |
| 4807 |
(const_string "orig"))) |
| 4808 |
(set (attr "prefix_0f") |
| 4809 |
(if_then_else (eq_attr "type" "imovx") |
| 4810 |
(const_string "0") |
| 4811 |
(const_string "*"))) |
| 4812 |
(set (attr "mode") |
| 4813 |
(cond [(eq_attr "alternative" "5,6") |
| 4814 |
(const_string "DI") |
| 4815 |
(and (eq_attr "alternative" "7") |
| 4816 |
(match_test "TARGET_64BIT")) |
| 4817 |
(const_string "TI") |
| 4818 |
(eq_attr "alternative" "8,10,11") |
| 4819 |
(const_string "TI") |
| 4820 |
] |
| 4821 |
(const_string "SI"))) |
| 4822 |
(set (attr "preferred_for_speed") |
| 4823 |
(cond [(eq_attr "alternative" "7") |
| 4824 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") |
| 4825 |
(eq_attr "alternative" "5,8") |
| 4826 |
(symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") |
| 4827 |
] |
| 4828 |
(symbol_ref "true")))]) |
| 4829 |
|
| 4830 |
(define_split |
| 4831 |
[(set (match_operand:DI 0 "memory_operand") |
| 4832 |
(zero_extend:DI (match_operand:SI 1 "memory_operand")))] |
| 4833 |
"reload_completed" |
| 4834 |
[(set (match_dup 4) (const_int 0))] |
| 4835 |
"split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);") |
| 4836 |
|
| 4837 |
(define_split |
| 4838 |
[(set (match_operand:DI 0 "general_reg_operand") |
| 4839 |
(zero_extend:DI (match_operand:SI 1 "general_reg_operand")))] |
| 4840 |
"!TARGET_64BIT && reload_completed |
| 4841 |
&& REGNO (operands[0]) == REGNO (operands[1])" |
| 4842 |
[(set (match_dup 4) (const_int 0))] |
| 4843 |
"split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);") |
| 4844 |
|
| 4845 |
(define_split |
| 4846 |
[(set (match_operand:DI 0 "nonimmediate_gr_operand") |
| 4847 |
(zero_extend:DI (match_operand:SI 1 "nonimmediate_operand")))] |
| 4848 |
"!TARGET_64BIT && reload_completed |
| 4849 |
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))" |
| 4850 |
[(set (match_dup 3) (match_dup 1)) |
| 4851 |
(set (match_dup 4) (const_int 0))] |
| 4852 |
"split_double_mode (DImode, &operands[0], 1, &operands[3], &operands[4]);") |
| 4853 |
|
| 4854 |
(define_mode_attr kmov_isa |
| 4855 |
[(QI "avx512dq") (HI "avx512f") (SI "avx512bw") (DI "avx512bw")]) |
| 4856 |
|
| 4857 |
(define_insn "zero_extend<mode>di2" |
| 4858 |
[(set (match_operand:DI 0 "register_operand" "=r,?r,?k") |
| 4859 |
(zero_extend:DI |
| 4860 |
(match_operand:SWI12 1 "nonimmediate_operand" "<r>m,?k,?km")))] |
| 4861 |
"TARGET_64BIT" |
| 4862 |
"@ |
| 4863 |
movz{<imodesuffix>l|x}\t{%1, %k0|%k0, %1} |
| 4864 |
kmov<mskmodesuffix>\t{%1, %k0|%k0, %1} |
| 4865 |
kmov<mskmodesuffix>\t{%1, %k0|%k0, %1}" |
| 4866 |
[(set_attr "isa" "*,<kmov_isa>,<kmov_isa>") |
| 4867 |
(set_attr "type" "imovx,mskmov,mskmov") |
| 4868 |
(set_attr "mode" "SI,<MODE>,<MODE>")]) |
| 4869 |
|
| 4870 |
(define_expand "zero_extend<mode>si2" |
| 4871 |
[(set (match_operand:SI 0 "register_operand") |
| 4872 |
(zero_extend:SI (match_operand:SWI12 1 "nonimmediate_operand")))] |
| 4873 |
"" |
| 4874 |
{ |
| 4875 |
if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)) |
| 4876 |
{ |
| 4877 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 4878 |
emit_insn (gen_zero_extend<mode>si2_and (operands[0], operands[1])); |
| 4879 |
DONE; |
| 4880 |
} |
| 4881 |
}) |
| 4882 |
|
| 4883 |
(define_insn_and_split "zero_extend<mode>si2_and" |
| 4884 |
[(set (match_operand:SI 0 "register_operand" "=r,?&<r>") |
| 4885 |
(zero_extend:SI |
| 4886 |
(match_operand:SWI12 1 "nonimmediate_operand" "0,<r>m"))) |
| 4887 |
(clobber (reg:CC FLAGS_REG))] |
| 4888 |
"TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)" |
| 4889 |
"#" |
| 4890 |
"&& reload_completed" |
| 4891 |
[(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 2))) |
| 4892 |
(clobber (reg:CC FLAGS_REG))])] |
| 4893 |
{ |
| 4894 |
if (!REG_P (operands[1]) |
| 4895 |
|| REGNO (operands[0]) != REGNO (operands[1])) |
| 4896 |
{ |
| 4897 |
ix86_expand_clear (operands[0]); |
| 4898 |
|
| 4899 |
gcc_assert (!TARGET_PARTIAL_REG_STALL); |
| 4900 |
emit_insn (gen_rtx_SET |
| 4901 |
(gen_rtx_STRICT_LOW_PART |
| 4902 |
(VOIDmode, gen_lowpart (<MODE>mode, operands[0])), |
| 4903 |
operands[1])); |
| 4904 |
DONE; |
| 4905 |
} |
| 4906 |
|
| 4907 |
operands[2] = GEN_INT (GET_MODE_MASK (<MODE>mode)); |
| 4908 |
} |
| 4909 |
[(set_attr "type" "alu1") |
| 4910 |
(set_attr "mode" "SI")]) |
| 4911 |
|
| 4912 |
(define_insn "*zero_extend<mode>si2" |
| 4913 |
[(set (match_operand:SI 0 "register_operand" "=r,?r,?k") |
| 4914 |
(zero_extend:SI |
| 4915 |
(match_operand:SWI12 1 "nonimmediate_operand" "<r>m,?k,?km")))] |
| 4916 |
"!(TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))" |
| 4917 |
"@ |
| 4918 |
movz{<imodesuffix>l|x}\t{%1, %0|%0, %1} |
| 4919 |
kmov<mskmodesuffix>\t{%1, %0|%0, %1} |
| 4920 |
kmov<mskmodesuffix>\t{%1, %0|%0, %1}" |
| 4921 |
[(set_attr "isa" "*,<kmov_isa>,<kmov_isa>") |
| 4922 |
(set_attr "type" "imovx,mskmov,mskmov") |
| 4923 |
(set_attr "mode" "SI,<MODE>,<MODE>")]) |
| 4924 |
|
| 4925 |
(define_expand "zero_extendqihi2" |
| 4926 |
[(set (match_operand:HI 0 "register_operand") |
| 4927 |
(zero_extend:HI (match_operand:QI 1 "nonimmediate_operand")))] |
| 4928 |
"" |
| 4929 |
{ |
| 4930 |
if (TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)) |
| 4931 |
{ |
| 4932 |
operands[1] = force_reg (QImode, operands[1]); |
| 4933 |
emit_insn (gen_zero_extendqihi2_and (operands[0], operands[1])); |
| 4934 |
DONE; |
| 4935 |
} |
| 4936 |
}) |
| 4937 |
|
| 4938 |
(define_insn_and_split "zero_extendqihi2_and" |
| 4939 |
[(set (match_operand:HI 0 "register_operand" "=r,?&q") |
| 4940 |
(zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm"))) |
| 4941 |
(clobber (reg:CC FLAGS_REG))] |
| 4942 |
"TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)" |
| 4943 |
"#" |
| 4944 |
"&& reload_completed" |
| 4945 |
[(parallel [(set (match_dup 0) (and:SI (match_dup 0) (const_int 255))) |
| 4946 |
(clobber (reg:CC FLAGS_REG))])] |
| 4947 |
{ |
| 4948 |
if (!REG_P (operands[1]) |
| 4949 |
|| REGNO (operands[0]) != REGNO (operands[1])) |
| 4950 |
{ |
| 4951 |
ix86_expand_clear (operands[0]); |
| 4952 |
|
| 4953 |
gcc_assert (!TARGET_PARTIAL_REG_STALL); |
| 4954 |
emit_insn (gen_rtx_SET |
| 4955 |
(gen_rtx_STRICT_LOW_PART |
| 4956 |
(VOIDmode, gen_lowpart (QImode, operands[0])), |
| 4957 |
operands[1])); |
| 4958 |
DONE; |
| 4959 |
} |
| 4960 |
|
| 4961 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 4962 |
} |
| 4963 |
[(set_attr "type" "alu1") |
| 4964 |
(set_attr "mode" "SI")]) |
| 4965 |
|
| 4966 |
; zero extend to SImode to avoid partial register stalls |
| 4967 |
(define_insn "*zero_extendqihi2" |
| 4968 |
[(set (match_operand:HI 0 "register_operand" "=r,?r,?k") |
| 4969 |
(zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm,?k,?km")))] |
| 4970 |
"!(TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun))" |
| 4971 |
"@ |
| 4972 |
movz{bl|x}\t{%1, %k0|%k0, %1} |
| 4973 |
kmovb\t{%1, %k0|%k0, %1} |
| 4974 |
kmovb\t{%1, %0|%0, %1}" |
| 4975 |
[(set_attr "isa" "*,avx512dq,avx512dq") |
| 4976 |
(set_attr "type" "imovx,mskmov,mskmov") |
| 4977 |
(set_attr "mode" "SI,QI,QI")]) |
| 4978 |
|
| 4979 |
;; Transform xorl; mov[bw] (set strict_low_part) into movz[bw]l. |
| 4980 |
(define_peephole2 |
| 4981 |
[(parallel [(set (match_operand:SWI48 0 "general_reg_operand") |
| 4982 |
(const_int 0)) |
| 4983 |
(clobber (reg:CC FLAGS_REG))]) |
| 4984 |
(set (strict_low_part (match_operand:SWI12 1 "general_reg_operand")) |
| 4985 |
(match_operand:SWI12 2 "nonimmediate_operand"))] |
| 4986 |
"REGNO (operands[0]) == REGNO (operands[1]) |
| 4987 |
&& (<SWI48:MODE>mode != SImode |
| 4988 |
|| !TARGET_ZERO_EXTEND_WITH_AND |
| 4989 |
|| !optimize_function_for_speed_p (cfun))" |
| 4990 |
[(set (match_dup 0) (zero_extend:SWI48 (match_dup 2)))]) |
| 4991 |
|
| 4992 |
;; Likewise, but preserving FLAGS_REG. |
| 4993 |
(define_peephole2 |
| 4994 |
[(set (match_operand:SWI48 0 "general_reg_operand") (const_int 0)) |
| 4995 |
(set (strict_low_part (match_operand:SWI12 1 "general_reg_operand")) |
| 4996 |
(match_operand:SWI12 2 "nonimmediate_operand"))] |
| 4997 |
"REGNO (operands[0]) == REGNO (operands[1]) |
| 4998 |
&& (<SWI48:MODE>mode != SImode |
| 4999 |
|| !TARGET_ZERO_EXTEND_WITH_AND |
| 5000 |
|| !optimize_function_for_speed_p (cfun))" |
| 5001 |
[(set (match_dup 0) (zero_extend:SWI48 (match_dup 2)))]) |
| 5002 |
|
| 5003 |
;; Sign extension instructions |
| 5004 |
|
| 5005 |
(define_expand "extendsidi2" |
| 5006 |
[(set (match_operand:DI 0 "register_operand") |
| 5007 |
(sign_extend:DI (match_operand:SI 1 "register_operand")))] |
| 5008 |
"" |
| 5009 |
{ |
| 5010 |
if (!TARGET_64BIT) |
| 5011 |
{ |
| 5012 |
emit_insn (gen_extendsidi2_1 (operands[0], operands[1])); |
| 5013 |
DONE; |
| 5014 |
} |
| 5015 |
}) |
| 5016 |
|
| 5017 |
(define_insn "*extendsidi2_rex64" |
| 5018 |
[(set (match_operand:DI 0 "register_operand" "=*a,r") |
| 5019 |
(sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "*0,rm")))] |
| 5020 |
"TARGET_64BIT" |
| 5021 |
"@ |
| 5022 |
{cltq|cdqe} |
| 5023 |
movs{lq|xd}\t{%1, %0|%0, %1}" |
| 5024 |
[(set_attr "type" "imovx") |
| 5025 |
(set_attr "mode" "DI") |
| 5026 |
(set_attr "prefix_0f" "0") |
| 5027 |
(set_attr "modrm" "0,1")]) |
| 5028 |
|
| 5029 |
(define_insn "extendsidi2_1" |
| 5030 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=*A,r,?r,?*o") |
| 5031 |
(sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,r"))) |
| 5032 |
(clobber (reg:CC FLAGS_REG)) |
| 5033 |
(clobber (match_scratch:SI 2 "=X,X,X,&r"))] |
| 5034 |
"!TARGET_64BIT" |
| 5035 |
"#") |
| 5036 |
|
| 5037 |
(define_insn "extendditi2" |
| 5038 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=*A,r,?r,?*o") |
| 5039 |
(sign_extend:TI (match_operand:DI 1 "register_operand" "0,0,r,r"))) |
| 5040 |
(clobber (reg:CC FLAGS_REG)) |
| 5041 |
(clobber (match_scratch:DI 2 "=X,X,X,&r"))] |
| 5042 |
"TARGET_64BIT" |
| 5043 |
"#") |
| 5044 |
|
| 5045 |
;; Split the memory case. If the source register doesn't die, it will stay |
| 5046 |
;; this way, if it does die, following peephole2s take care of it. |
| 5047 |
(define_split |
| 5048 |
[(set (match_operand:<DWI> 0 "memory_operand") |
| 5049 |
(sign_extend:<DWI> (match_operand:DWIH 1 "register_operand"))) |
| 5050 |
(clobber (reg:CC FLAGS_REG)) |
| 5051 |
(clobber (match_operand:DWIH 2 "register_operand"))] |
| 5052 |
"reload_completed" |
| 5053 |
[(const_int 0)] |
| 5054 |
{ |
| 5055 |
rtx bits = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT - 1); |
| 5056 |
|
| 5057 |
split_double_mode (<DWI>mode, &operands[0], 1, &operands[3], &operands[4]); |
| 5058 |
|
| 5059 |
emit_move_insn (operands[3], operands[1]); |
| 5060 |
|
| 5061 |
/* Generate a cltd if possible and doing so it profitable. */ |
| 5062 |
if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 5063 |
&& REGNO (operands[1]) == AX_REG |
| 5064 |
&& REGNO (operands[2]) == DX_REG) |
| 5065 |
{ |
| 5066 |
emit_insn (gen_ashr<mode>3_cvt (operands[2], operands[1], bits)); |
| 5067 |
} |
| 5068 |
else |
| 5069 |
{ |
| 5070 |
emit_move_insn (operands[2], operands[1]); |
| 5071 |
emit_insn (gen_ashr<mode>3_cvt (operands[2], operands[2], bits)); |
| 5072 |
} |
| 5073 |
emit_move_insn (operands[4], operands[2]); |
| 5074 |
DONE; |
| 5075 |
}) |
| 5076 |
|
| 5077 |
;; Peepholes for the case where the source register does die, after |
| 5078 |
;; being split with the above splitter. |
| 5079 |
(define_peephole2 |
| 5080 |
[(set (match_operand:DWIH 0 "memory_operand") |
| 5081 |
(match_operand:DWIH 1 "general_reg_operand")) |
| 5082 |
(set (match_operand:DWIH 2 "general_reg_operand") (match_dup 1)) |
| 5083 |
(parallel [(set (match_dup 2) |
| 5084 |
(ashiftrt:DWIH (match_dup 2) |
| 5085 |
(match_operand 4 "const_int_operand"))) |
| 5086 |
(clobber (reg:CC FLAGS_REG))]) |
| 5087 |
(set (match_operand:DWIH 3 "memory_operand") (match_dup 2))] |
| 5088 |
"REGNO (operands[1]) != REGNO (operands[2]) |
| 5089 |
&& INTVAL (operands[4]) == (<MODE_SIZE> * BITS_PER_UNIT - 1) |
| 5090 |
&& peep2_reg_dead_p (2, operands[1]) |
| 5091 |
&& peep2_reg_dead_p (4, operands[2]) |
| 5092 |
&& !reg_mentioned_p (operands[2], operands[3])" |
| 5093 |
[(set (match_dup 0) (match_dup 1)) |
| 5094 |
(parallel [(set (match_dup 1) (ashiftrt:DWIH (match_dup 1) (match_dup 4))) |
| 5095 |
(clobber (reg:CC FLAGS_REG))]) |
| 5096 |
(set (match_dup 3) (match_dup 1))]) |
| 5097 |
|
| 5098 |
(define_peephole2 |
| 5099 |
[(set (match_operand:DWIH 0 "memory_operand") |
| 5100 |
(match_operand:DWIH 1 "general_reg_operand")) |
| 5101 |
(parallel [(set (match_operand:DWIH 2 "general_reg_operand") |
| 5102 |
(ashiftrt:DWIH (match_dup 1) |
| 5103 |
(match_operand 4 "const_int_operand"))) |
| 5104 |
(clobber (reg:CC FLAGS_REG))]) |
| 5105 |
(set (match_operand:DWIH 3 "memory_operand") (match_dup 2))] |
| 5106 |
"/* cltd is shorter than sarl $31, %eax */ |
| 5107 |
!optimize_function_for_size_p (cfun) |
| 5108 |
&& REGNO (operands[1]) == AX_REG |
| 5109 |
&& REGNO (operands[2]) == DX_REG |
| 5110 |
&& INTVAL (operands[4]) == (<MODE_SIZE> * BITS_PER_UNIT - 1) |
| 5111 |
&& peep2_reg_dead_p (2, operands[1]) |
| 5112 |
&& peep2_reg_dead_p (3, operands[2]) |
| 5113 |
&& !reg_mentioned_p (operands[2], operands[3])" |
| 5114 |
[(set (match_dup 0) (match_dup 1)) |
| 5115 |
(parallel [(set (match_dup 1) (ashiftrt:DWIH (match_dup 1) (match_dup 4))) |
| 5116 |
(clobber (reg:CC FLAGS_REG))]) |
| 5117 |
(set (match_dup 3) (match_dup 1))]) |
| 5118 |
|
| 5119 |
;; Extend to register case. Optimize case where source and destination |
| 5120 |
;; registers match and cases where we can use cltd. |
| 5121 |
(define_split |
| 5122 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 5123 |
(sign_extend:<DWI> (match_operand:DWIH 1 "register_operand"))) |
| 5124 |
(clobber (reg:CC FLAGS_REG)) |
| 5125 |
(clobber (match_scratch:DWIH 2))] |
| 5126 |
"reload_completed" |
| 5127 |
[(const_int 0)] |
| 5128 |
{ |
| 5129 |
rtx bits = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT - 1); |
| 5130 |
|
| 5131 |
split_double_mode (<DWI>mode, &operands[0], 1, &operands[3], &operands[4]); |
| 5132 |
|
| 5133 |
if (REGNO (operands[3]) != REGNO (operands[1])) |
| 5134 |
emit_move_insn (operands[3], operands[1]); |
| 5135 |
|
| 5136 |
rtx src = operands[1]; |
| 5137 |
if (REGNO (operands[3]) == AX_REG) |
| 5138 |
src = operands[3]; |
| 5139 |
|
| 5140 |
/* Generate a cltd if possible and doing so it profitable. */ |
| 5141 |
if ((optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 5142 |
&& REGNO (src) == AX_REG |
| 5143 |
&& REGNO (operands[4]) == DX_REG) |
| 5144 |
{ |
| 5145 |
emit_insn (gen_ashr<mode>3_cvt (operands[4], src, bits)); |
| 5146 |
DONE; |
| 5147 |
} |
| 5148 |
|
| 5149 |
if (REGNO (operands[4]) != REGNO (operands[1])) |
| 5150 |
emit_move_insn (operands[4], operands[1]); |
| 5151 |
|
| 5152 |
emit_insn (gen_ashr<mode>3_cvt (operands[4], operands[4], bits)); |
| 5153 |
DONE; |
| 5154 |
}) |
| 5155 |
|
| 5156 |
(define_peephole2 |
| 5157 |
[(set (match_operand:DI 0 "general_reg_operand") |
| 5158 |
(match_operand:DI 1 "general_reg_operand")) |
| 5159 |
(parallel [(set (match_dup 0) |
| 5160 |
(ashiftrt:DI (match_dup 0) |
| 5161 |
(const_int 63))) |
| 5162 |
(clobber (reg:CC FLAGS_REG))]) |
| 5163 |
(set (match_operand:DI 2 "general_reg_operand") (match_dup 1)) |
| 5164 |
(set (match_operand:DI 3 "general_reg_operand") (match_dup 0))] |
| 5165 |
"(optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 5166 |
&& REGNO (operands[2]) == AX_REG |
| 5167 |
&& REGNO (operands[3]) == DX_REG |
| 5168 |
&& peep2_reg_dead_p (4, operands[0]) |
| 5169 |
&& !reg_mentioned_p (operands[0], operands[1]) |
| 5170 |
&& !reg_mentioned_p (operands[2], operands[0])" |
| 5171 |
[(set (match_dup 2) (match_dup 1)) |
| 5172 |
(parallel [(set (match_dup 3) (ashiftrt:DI (match_dup 2) (const_int 63))) |
| 5173 |
(clobber (reg:CC FLAGS_REG))])]) |
| 5174 |
|
| 5175 |
(define_insn "extend<mode>di2" |
| 5176 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5177 |
(sign_extend:DI |
| 5178 |
(match_operand:SWI12 1 "nonimmediate_operand" "<r>m")))] |
| 5179 |
"TARGET_64BIT" |
| 5180 |
"movs{<imodesuffix>q|x}\t{%1, %0|%0, %1}" |
| 5181 |
[(set_attr "type" "imovx") |
| 5182 |
(set_attr "mode" "DI")]) |
| 5183 |
|
| 5184 |
(define_insn "extendhisi2" |
| 5185 |
[(set (match_operand:SI 0 "register_operand" "=*a,r") |
| 5186 |
(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "*0,rm")))] |
| 5187 |
"" |
| 5188 |
{ |
| 5189 |
switch (get_attr_prefix_0f (insn)) |
| 5190 |
{ |
| 5191 |
case 0: |
| 5192 |
return "{cwtl|cwde}"; |
| 5193 |
default: |
| 5194 |
return "movs{wl|x}\t{%1, %0|%0, %1}"; |
| 5195 |
} |
| 5196 |
} |
| 5197 |
[(set_attr "type" "imovx") |
| 5198 |
(set_attr "mode" "SI") |
| 5199 |
(set (attr "prefix_0f") |
| 5200 |
;; movsx is short decodable while cwtl is vector decoded. |
| 5201 |
(if_then_else (and (eq_attr "cpu" "!k6") |
| 5202 |
(eq_attr "alternative" "0")) |
| 5203 |
(const_string "0") |
| 5204 |
(const_string "1"))) |
| 5205 |
(set (attr "znver1_decode") |
| 5206 |
(if_then_else (eq_attr "prefix_0f" "0") |
| 5207 |
(const_string "double") |
| 5208 |
(const_string "direct"))) |
| 5209 |
(set (attr "c86_decode") |
| 5210 |
(if_then_else (eq_attr "prefix_0f" "0") |
| 5211 |
(const_string "double") |
| 5212 |
(const_string "direct"))) |
| 5213 |
(set (attr "modrm") |
| 5214 |
(if_then_else (eq_attr "prefix_0f" "0") |
| 5215 |
(const_string "0") |
| 5216 |
(const_string "1")))]) |
| 5217 |
|
| 5218 |
(define_insn "*extendhisi2_zext" |
| 5219 |
[(set (match_operand:DI 0 "register_operand" "=*a,r") |
| 5220 |
(zero_extend:DI |
| 5221 |
(sign_extend:SI |
| 5222 |
(match_operand:HI 1 "nonimmediate_operand" "*0,rm"))))] |
| 5223 |
"TARGET_64BIT" |
| 5224 |
{ |
| 5225 |
switch (get_attr_prefix_0f (insn)) |
| 5226 |
{ |
| 5227 |
case 0: |
| 5228 |
return "{cwtl|cwde}"; |
| 5229 |
default: |
| 5230 |
return "movs{wl|x}\t{%1, %k0|%k0, %1}"; |
| 5231 |
} |
| 5232 |
} |
| 5233 |
[(set_attr "type" "imovx") |
| 5234 |
(set_attr "mode" "SI") |
| 5235 |
(set (attr "prefix_0f") |
| 5236 |
;; movsx is short decodable while cwtl is vector decoded. |
| 5237 |
(if_then_else (and (eq_attr "cpu" "!k6") |
| 5238 |
(eq_attr "alternative" "0")) |
| 5239 |
(const_string "0") |
| 5240 |
(const_string "1"))) |
| 5241 |
(set (attr "modrm") |
| 5242 |
(if_then_else (eq_attr "prefix_0f" "0") |
| 5243 |
(const_string "0") |
| 5244 |
(const_string "1")))]) |
| 5245 |
|
| 5246 |
(define_insn "extendqisi2" |
| 5247 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5248 |
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))] |
| 5249 |
"" |
| 5250 |
"movs{bl|x}\t{%1, %0|%0, %1}" |
| 5251 |
[(set_attr "type" "imovx") |
| 5252 |
(set_attr "mode" "SI")]) |
| 5253 |
|
| 5254 |
(define_insn "*extendqisi2_zext" |
| 5255 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5256 |
(zero_extend:DI |
| 5257 |
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm"))))] |
| 5258 |
"TARGET_64BIT" |
| 5259 |
"movs{bl|x}\t{%1, %k0|%k0, %1}" |
| 5260 |
[(set_attr "type" "imovx") |
| 5261 |
(set_attr "mode" "SI")]) |
| 5262 |
|
| 5263 |
(define_insn "extendqihi2" |
| 5264 |
[(set (match_operand:HI 0 "register_operand" "=*a,r") |
| 5265 |
(sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "*0,qm")))] |
| 5266 |
"" |
| 5267 |
{ |
| 5268 |
switch (get_attr_prefix_0f (insn)) |
| 5269 |
{ |
| 5270 |
case 0: |
| 5271 |
return "{cbtw|cbw}"; |
| 5272 |
default: |
| 5273 |
return "movs{bw|x}\t{%1, %0|%0, %1}"; |
| 5274 |
} |
| 5275 |
} |
| 5276 |
[(set_attr "type" "imovx") |
| 5277 |
(set_attr "mode" "HI") |
| 5278 |
(set (attr "prefix_0f") |
| 5279 |
;; movsx is short decodable while cwtl is vector decoded. |
| 5280 |
(if_then_else (and (eq_attr "cpu" "!k6") |
| 5281 |
(eq_attr "alternative" "0")) |
| 5282 |
(const_string "0") |
| 5283 |
(const_string "1"))) |
| 5284 |
(set (attr "modrm") |
| 5285 |
(if_then_else (eq_attr "prefix_0f" "0") |
| 5286 |
(const_string "0") |
| 5287 |
(const_string "1")))]) |
| 5288 |
|
| 5289 |
(define_insn "*extendqi<SWI24:mode>_ext_1" |
| 5290 |
[(set (match_operand:SWI24 0 "register_operand" "=R") |
| 5291 |
(sign_extend:SWI24 |
| 5292 |
(subreg:QI |
| 5293 |
(match_operator:SWI248 2 "extract_operator" |
| 5294 |
[(match_operand 1 "int248_register_operand" "Q") |
| 5295 |
(const_int 8) |
| 5296 |
(const_int 8)]) 0)))] |
| 5297 |
"" |
| 5298 |
"movs{b<SWI24:imodesuffix>|x}\t{%h1, %0|%0, %h1}" |
| 5299 |
[(set_attr "type" "imovx") |
| 5300 |
(set_attr "mode" "<SWI24:MODE>")]) |
| 5301 |
|
| 5302 |
;; Conversions between float and double. |
| 5303 |
|
| 5304 |
;; These are all no-ops in the model used for the 80387. |
| 5305 |
;; So just emit moves. |
| 5306 |
|
| 5307 |
;; %%% Kill these when call knows how to work out a DFmode push earlier. |
| 5308 |
(define_split |
| 5309 |
[(set (match_operand:DF 0 "push_operand") |
| 5310 |
(float_extend:DF (match_operand:SF 1 "fp_register_operand")))] |
| 5311 |
"reload_completed" |
| 5312 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -8))) |
| 5313 |
(set (mem:DF (reg:P SP_REG)) (float_extend:DF (match_dup 1)))]) |
| 5314 |
|
| 5315 |
(define_split |
| 5316 |
[(set (match_operand:XF 0 "push_operand") |
| 5317 |
(float_extend:XF (match_operand:MODEF 1 "fp_register_operand")))] |
| 5318 |
"reload_completed" |
| 5319 |
[(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (match_dup 2))) |
| 5320 |
(set (mem:XF (reg:P SP_REG)) (float_extend:XF (match_dup 1)))] |
| 5321 |
"operands[2] = GEN_INT (-GET_MODE_SIZE (XFmode));") |
| 5322 |
|
| 5323 |
(define_expand "extendsfdf2" |
| 5324 |
[(set (match_operand:DF 0 "nonimm_ssenomem_operand") |
| 5325 |
(float_extend:DF (match_operand:SF 1 "general_operand")))] |
| 5326 |
"TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)" |
| 5327 |
{ |
| 5328 |
/* ??? Needed for compress_float_constant since all fp constants |
| 5329 |
are TARGET_LEGITIMATE_CONSTANT_P. */ |
| 5330 |
if (CONST_DOUBLE_P (operands[1])) |
| 5331 |
{ |
| 5332 |
if ((!TARGET_SSE2 || TARGET_MIX_SSE_I387) |
| 5333 |
&& standard_80387_constant_p (operands[1]) > 0) |
| 5334 |
{ |
| 5335 |
operands[1] = simplify_const_unary_operation |
| 5336 |
(FLOAT_EXTEND, DFmode, operands[1], SFmode); |
| 5337 |
emit_move_insn_1 (operands[0], operands[1]); |
| 5338 |
DONE; |
| 5339 |
} |
| 5340 |
operands[1] = validize_mem (force_const_mem (SFmode, operands[1])); |
| 5341 |
} |
| 5342 |
}) |
| 5343 |
|
| 5344 |
(define_insn "*extendsfdf2" |
| 5345 |
[(set (match_operand:DF 0 "nonimm_ssenomem_operand" "=f,m,v,v") |
| 5346 |
(float_extend:DF |
| 5347 |
(match_operand:SF 1 "nonimmediate_operand" "fm,f,v,m")))] |
| 5348 |
"TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)" |
| 5349 |
{ |
| 5350 |
switch (which_alternative) |
| 5351 |
{ |
| 5352 |
case 0: |
| 5353 |
case 1: |
| 5354 |
return output_387_reg_move (insn, operands); |
| 5355 |
|
| 5356 |
case 2: |
| 5357 |
return "%vcvtss2sd\t{%d1, %0|%0, %d1}"; |
| 5358 |
case 3: |
| 5359 |
return "%vcvtss2sd\t{%1, %d0|%d0, %1}"; |
| 5360 |
|
| 5361 |
default: |
| 5362 |
gcc_unreachable (); |
| 5363 |
} |
| 5364 |
} |
| 5365 |
[(set_attr "type" "fmov,fmov,ssecvt,ssecvt") |
| 5366 |
(set_attr "avx_partial_xmm_update" "false,false,false,true") |
| 5367 |
(set_attr "prefix" "orig,orig,maybe_vex,maybe_vex") |
| 5368 |
(set_attr "mode" "SF,XF,DF,DF") |
| 5369 |
(set (attr "enabled") |
| 5370 |
(if_then_else |
| 5371 |
(match_test ("TARGET_SSE2 && TARGET_SSE_MATH")) |
| 5372 |
(if_then_else |
| 5373 |
(eq_attr "alternative" "0,1") |
| 5374 |
(symbol_ref "TARGET_MIX_SSE_I387") |
| 5375 |
(symbol_ref "true")) |
| 5376 |
(if_then_else |
| 5377 |
(eq_attr "alternative" "0,1") |
| 5378 |
(symbol_ref "true") |
| 5379 |
(symbol_ref "false"))))]) |
| 5380 |
|
| 5381 |
/* For converting SF(xmm2) to DF(xmm1), use the following code instead of |
| 5382 |
cvtss2sd: |
| 5383 |
unpcklps xmm2,xmm2 ; packed conversion might crash on signaling NaNs |
| 5384 |
cvtps2pd xmm2,xmm1 |
| 5385 |
We do the conversion post reload to avoid producing of 128bit spills |
| 5386 |
that might lead to ICE on 32bit target. The sequence unlikely combine |
| 5387 |
anyway. */ |
| 5388 |
(define_split |
| 5389 |
[(set (match_operand:DF 0 "sse_reg_operand") |
| 5390 |
(float_extend:DF |
| 5391 |
(match_operand:SF 1 "nonimmediate_operand")))] |
| 5392 |
"TARGET_USE_VECTOR_FP_CONVERTS |
| 5393 |
&& optimize_insn_for_speed_p () |
| 5394 |
&& reload_completed |
| 5395 |
&& (!EXT_REX_SSE_REG_P (operands[0]) |
| 5396 |
|| TARGET_AVX512VL)" |
| 5397 |
[(set (match_dup 2) |
| 5398 |
(float_extend:V2DF |
| 5399 |
(vec_select:V2SF |
| 5400 |
(match_dup 3) |
| 5401 |
(parallel [(const_int 0) (const_int 1)]))))] |
| 5402 |
{ |
| 5403 |
operands[2] = lowpart_subreg (V2DFmode, operands[0], DFmode); |
| 5404 |
operands[3] = lowpart_subreg (V4SFmode, operands[0], DFmode); |
| 5405 |
/* Use movss for loading from memory, unpcklps reg, reg for registers. |
| 5406 |
Try to avoid move when unpacking can be done in source. */ |
| 5407 |
if (REG_P (operands[1])) |
| 5408 |
{ |
| 5409 |
/* If it is unsafe to overwrite upper half of source, we need |
| 5410 |
to move to destination and unpack there. */ |
| 5411 |
if (REGNO (operands[0]) != REGNO (operands[1]) |
| 5412 |
|| (EXT_REX_SSE_REG_P (operands[1]) && !TARGET_AVX512VL)) |
| 5413 |
{ |
| 5414 |
rtx tmp = lowpart_subreg (SFmode, operands[0], DFmode); |
| 5415 |
emit_move_insn (tmp, operands[1]); |
| 5416 |
} |
| 5417 |
else |
| 5418 |
operands[3] = lowpart_subreg (V4SFmode, operands[1], SFmode); |
| 5419 |
/* FIXME: vec_interleave_lowv4sf for AVX512VL should allow |
| 5420 |
=v, v, then vbroadcastss will be only needed for AVX512F without |
| 5421 |
AVX512VL. */ |
| 5422 |
if (!EXT_REX_SSE_REGNO_P (REGNO (operands[3]))) |
| 5423 |
emit_insn (gen_vec_interleave_lowv4sf (operands[3], operands[3], |
| 5424 |
operands[3])); |
| 5425 |
else |
| 5426 |
{ |
| 5427 |
rtx tmp = lowpart_subreg (V16SFmode, operands[3], V4SFmode); |
| 5428 |
emit_insn (gen_avx512f_vec_dupv16sf_1 (tmp, tmp)); |
| 5429 |
} |
| 5430 |
} |
| 5431 |
else |
| 5432 |
emit_insn (gen_vec_setv4sf_0 (operands[3], |
| 5433 |
CONST0_RTX (V4SFmode), operands[1])); |
| 5434 |
}) |
| 5435 |
|
| 5436 |
;; It's more profitable to split and then extend in the same register. |
| 5437 |
(define_peephole2 |
| 5438 |
[(set (match_operand:DF 0 "sse_reg_operand") |
| 5439 |
(float_extend:DF |
| 5440 |
(match_operand:SF 1 "memory_operand")))] |
| 5441 |
"TARGET_SPLIT_MEM_OPND_FOR_FP_CONVERTS |
| 5442 |
&& optimize_insn_for_speed_p ()" |
| 5443 |
[(set (match_dup 2) (match_dup 1)) |
| 5444 |
(set (match_dup 0) (float_extend:DF (match_dup 2)))] |
| 5445 |
"operands[2] = lowpart_subreg (SFmode, operands[0], DFmode);") |
| 5446 |
|
| 5447 |
;; Break partial SSE register dependency stall. This splitter should split |
| 5448 |
;; late in the pass sequence (after register rename pass), so allocated |
| 5449 |
;; registers won't change anymore |
| 5450 |
|
| 5451 |
(define_split |
| 5452 |
[(set (match_operand:DF 0 "sse_reg_operand") |
| 5453 |
(float_extend:DF |
| 5454 |
(match_operand:SF 1 "nonimmediate_operand")))] |
| 5455 |
"!TARGET_AVX |
| 5456 |
&& TARGET_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY |
| 5457 |
&& epilogue_completed |
| 5458 |
&& optimize_function_for_speed_p (cfun) |
| 5459 |
&& (!REG_P (operands[1]) |
| 5460 |
|| (!TARGET_AVX && REGNO (operands[0]) != REGNO (operands[1]))) |
| 5461 |
&& (!EXT_REX_SSE_REG_P (operands[0]) |
| 5462 |
|| TARGET_AVX512VL)" |
| 5463 |
[(set (match_dup 0) |
| 5464 |
(vec_merge:V2DF |
| 5465 |
(vec_duplicate:V2DF |
| 5466 |
(float_extend:DF |
| 5467 |
(match_dup 1))) |
| 5468 |
(match_dup 0) |
| 5469 |
(const_int 1)))] |
| 5470 |
{ |
| 5471 |
operands[0] = lowpart_subreg (V2DFmode, operands[0], DFmode); |
| 5472 |
emit_move_insn (operands[0], CONST0_RTX (V2DFmode)); |
| 5473 |
}) |
| 5474 |
|
| 5475 |
(define_expand "extendhfsf2" |
| 5476 |
[(set (match_operand:SF 0 "register_operand") |
| 5477 |
(float_extend:SF |
| 5478 |
(match_operand:HF 1 "nonimmediate_operand")))] |
| 5479 |
"TARGET_AVX512FP16 || TARGET_F16C || TARGET_AVX512VL" |
| 5480 |
{ |
| 5481 |
if (!TARGET_AVX512FP16) |
| 5482 |
{ |
| 5483 |
rtx res = gen_reg_rtx (V4SFmode); |
| 5484 |
rtx tmp = gen_reg_rtx (V8HFmode); |
| 5485 |
rtx zero = force_reg (V8HFmode, CONST0_RTX (V8HFmode)); |
| 5486 |
|
| 5487 |
emit_insn (gen_vec_setv8hf_0 (tmp, zero, operands[1])); |
| 5488 |
emit_insn (gen_vcvtph2ps (res, gen_lowpart (V8HImode, tmp))); |
| 5489 |
emit_move_insn (operands[0], gen_lowpart (SFmode, res)); |
| 5490 |
DONE; |
| 5491 |
} |
| 5492 |
}) |
| 5493 |
|
| 5494 |
(define_expand "extendhfdf2" |
| 5495 |
[(set (match_operand:DF 0 "register_operand") |
| 5496 |
(float_extend:DF |
| 5497 |
(match_operand:HF 1 "nonimmediate_operand")))] |
| 5498 |
"TARGET_AVX512FP16") |
| 5499 |
|
| 5500 |
(define_insn "*extendhf<mode>2" |
| 5501 |
[(set (match_operand:MODEF 0 "register_operand" "=v") |
| 5502 |
(float_extend:MODEF |
| 5503 |
(match_operand:HF 1 "nonimmediate_operand" "vm")))] |
| 5504 |
"TARGET_AVX512FP16" |
| 5505 |
"vcvtsh2<ssemodesuffix>\t{%1, %0, %0|%0, %0, %1}" |
| 5506 |
[(set_attr "type" "ssecvt") |
| 5507 |
(set_attr "prefix" "evex") |
| 5508 |
(set_attr "mode" "<MODE>")]) |
| 5509 |
|
| 5510 |
(define_expand "extendbfsf2" |
| 5511 |
[(set (match_operand:SF 0 "register_operand") |
| 5512 |
(unspec:SF |
| 5513 |
[(match_operand:BF 1 "register_operand")] |
| 5514 |
UNSPEC_CVTBFSF))] |
| 5515 |
"TARGET_SSE2 && !HONOR_NANS (BFmode)") |
| 5516 |
|
| 5517 |
;; Don't use float_extend since psrlld doesn't raise |
| 5518 |
;; exceptions and turn a sNaN into a qNaN. |
| 5519 |
(define_insn "extendbfsf2_1" |
| 5520 |
[(set (match_operand:SF 0 "register_operand" "=x,Yv,v") |
| 5521 |
(unspec:SF |
| 5522 |
[(match_operand:BF 1 "register_operand" " 0,Yv,v")] |
| 5523 |
UNSPEC_CVTBFSF))] |
| 5524 |
"TARGET_SSE2" |
| 5525 |
"@ |
| 5526 |
pslld\t{$16, %0|%0, 16} |
| 5527 |
vpslld\t{$16, %1, %0|%0, %1, 16} |
| 5528 |
vpslld\t{$16, %g1, %g0|%g0, %g1, 16}" |
| 5529 |
[(set_attr "isa" "noavx,avx,*") |
| 5530 |
(set_attr "type" "sseishft1") |
| 5531 |
(set_attr "length_immediate" "1") |
| 5532 |
(set_attr "prefix_data16" "1,*,*") |
| 5533 |
(set_attr "prefix" "orig,maybe_evex,evex") |
| 5534 |
(set_attr "mode" "TI,TI,XI") |
| 5535 |
(set_attr "memory" "none") |
| 5536 |
(set (attr "enabled") |
| 5537 |
(if_then_else (eq_attr "alternative" "2") |
| 5538 |
(symbol_ref "TARGET_AVX512F && TARGET_EVEX512 |
| 5539 |
&& !TARGET_AVX512VL && !TARGET_PREFER_AVX256") |
| 5540 |
(const_string "*")))]) |
| 5541 |
|
| 5542 |
(define_expand "extend<mode>xf2" |
| 5543 |
[(set (match_operand:XF 0 "nonimmediate_operand") |
| 5544 |
(float_extend:XF (match_operand:MODEF 1 "general_operand")))] |
| 5545 |
"TARGET_80387" |
| 5546 |
{ |
| 5547 |
/* ??? Needed for compress_float_constant since all fp constants |
| 5548 |
are TARGET_LEGITIMATE_CONSTANT_P. */ |
| 5549 |
if (CONST_DOUBLE_P (operands[1])) |
| 5550 |
{ |
| 5551 |
if (standard_80387_constant_p (operands[1]) > 0) |
| 5552 |
{ |
| 5553 |
operands[1] = simplify_const_unary_operation |
| 5554 |
(FLOAT_EXTEND, XFmode, operands[1], <MODE>mode); |
| 5555 |
emit_move_insn_1 (operands[0], operands[1]); |
| 5556 |
DONE; |
| 5557 |
} |
| 5558 |
operands[1] = validize_mem (force_const_mem (<MODE>mode, operands[1])); |
| 5559 |
} |
| 5560 |
}) |
| 5561 |
|
| 5562 |
(define_insn "*extend<mode>xf2_i387" |
| 5563 |
[(set (match_operand:XF 0 "nonimmediate_operand" "=f,m") |
| 5564 |
(float_extend:XF |
| 5565 |
(match_operand:MODEF 1 "nonimmediate_operand" "fm,f")))] |
| 5566 |
"TARGET_80387" |
| 5567 |
"* return output_387_reg_move (insn, operands);" |
| 5568 |
[(set_attr "type" "fmov") |
| 5569 |
(set_attr "mode" "<MODE>,XF")]) |
| 5570 |
|
| 5571 |
;; %%% This seems like bad news. |
| 5572 |
;; This cannot output into an f-reg because there is no way to be sure |
| 5573 |
;; of truncating in that case. Otherwise this is just like a simple move |
| 5574 |
;; insn. So we pretend we can output to a reg in order to get better |
| 5575 |
;; register preferencing, but we really use a stack slot. |
| 5576 |
|
| 5577 |
;; Conversion from DFmode to SFmode. |
| 5578 |
|
| 5579 |
(define_insn "truncdfsf2" |
| 5580 |
[(set (match_operand:SF 0 "nonimm_ssenomem_operand" "=m,f,v,v") |
| 5581 |
(float_truncate:SF |
| 5582 |
(match_operand:DF 1 "register_ssemem_operand" "f,f,v,m")))] |
| 5583 |
"TARGET_80387 || (TARGET_SSE2 && TARGET_SSE_MATH)" |
| 5584 |
{ |
| 5585 |
switch (which_alternative) |
| 5586 |
{ |
| 5587 |
case 0: |
| 5588 |
case 1: |
| 5589 |
return output_387_reg_move (insn, operands); |
| 5590 |
|
| 5591 |
case 2: |
| 5592 |
return "%vcvtsd2ss\t{%d1, %0|%0, %d1}"; |
| 5593 |
case 3: |
| 5594 |
return "%vcvtsd2ss\t{%1, %d0|%d0, %1}"; |
| 5595 |
|
| 5596 |
default: |
| 5597 |
gcc_unreachable (); |
| 5598 |
} |
| 5599 |
} |
| 5600 |
[(set_attr "type" "fmov,fmov,ssecvt,ssecvt") |
| 5601 |
(set_attr "avx_partial_xmm_update" "false,false,false,true") |
| 5602 |
(set_attr "mode" "SF") |
| 5603 |
(set (attr "enabled") |
| 5604 |
(if_then_else |
| 5605 |
(match_test ("TARGET_SSE2 && TARGET_SSE_MATH")) |
| 5606 |
(cond [(eq_attr "alternative" "0") |
| 5607 |
(symbol_ref "TARGET_MIX_SSE_I387") |
| 5608 |
(eq_attr "alternative" "1") |
| 5609 |
(symbol_ref "TARGET_MIX_SSE_I387 |
| 5610 |
&& flag_unsafe_math_optimizations") |
| 5611 |
] |
| 5612 |
(symbol_ref "true")) |
| 5613 |
(cond [(eq_attr "alternative" "0") |
| 5614 |
(symbol_ref "true") |
| 5615 |
(eq_attr "alternative" "1") |
| 5616 |
(symbol_ref "flag_unsafe_math_optimizations") |
| 5617 |
] |
| 5618 |
(symbol_ref "false"))))]) |
| 5619 |
|
| 5620 |
/* For converting DF(xmm2) to SF(xmm1), use the following code instead of |
| 5621 |
cvtsd2ss: |
| 5622 |
unpcklpd xmm2,xmm2 ; packed conversion might crash on signaling NaNs |
| 5623 |
cvtpd2ps xmm2,xmm1 |
| 5624 |
We do the conversion post reload to avoid producing of 128bit spills |
| 5625 |
that might lead to ICE on 32bit target. The sequence unlikely combine |
| 5626 |
anyway. */ |
| 5627 |
(define_split |
| 5628 |
[(set (match_operand:SF 0 "sse_reg_operand") |
| 5629 |
(float_truncate:SF |
| 5630 |
(match_operand:DF 1 "nonimmediate_operand")))] |
| 5631 |
"TARGET_USE_VECTOR_FP_CONVERTS |
| 5632 |
&& optimize_insn_for_speed_p () |
| 5633 |
&& reload_completed |
| 5634 |
&& (!EXT_REX_SSE_REG_P (operands[0]) |
| 5635 |
|| TARGET_AVX512VL)" |
| 5636 |
[(set (match_dup 2) |
| 5637 |
(vec_concat:V4SF |
| 5638 |
(float_truncate:V2SF |
| 5639 |
(match_dup 4)) |
| 5640 |
(match_dup 3)))] |
| 5641 |
{ |
| 5642 |
operands[2] = lowpart_subreg (V4SFmode, operands[0], SFmode); |
| 5643 |
operands[3] = CONST0_RTX (V2SFmode); |
| 5644 |
operands[4] = lowpart_subreg (V2DFmode, operands[0], SFmode); |
| 5645 |
/* Use movsd for loading from memory, unpcklpd for registers. |
| 5646 |
Try to avoid move when unpacking can be done in source, or SSE3 |
| 5647 |
movddup is available. */ |
| 5648 |
if (REG_P (operands[1])) |
| 5649 |
{ |
| 5650 |
if ((!TARGET_SSE3 && REGNO (operands[0]) != REGNO (operands[1])) |
| 5651 |
|| (EXT_REX_SSE_REG_P (operands[1]) && !TARGET_AVX512VL)) |
| 5652 |
{ |
| 5653 |
rtx tmp = lowpart_subreg (DFmode, operands[0], SFmode); |
| 5654 |
emit_move_insn (tmp, operands[1]); |
| 5655 |
operands[1] = tmp; |
| 5656 |
} |
| 5657 |
else if (!TARGET_SSE3) |
| 5658 |
operands[4] = lowpart_subreg (V2DFmode, operands[1], DFmode); |
| 5659 |
emit_insn (gen_vec_dupv2df (operands[4], operands[1])); |
| 5660 |
} |
| 5661 |
else |
| 5662 |
emit_insn (gen_vec_concatv2df (operands[4], operands[1], |
| 5663 |
CONST0_RTX (DFmode))); |
| 5664 |
}) |
| 5665 |
|
| 5666 |
;; It's more profitable to split and then truncate in the same register. |
| 5667 |
(define_peephole2 |
| 5668 |
[(set (match_operand:SF 0 "sse_reg_operand") |
| 5669 |
(float_truncate:SF |
| 5670 |
(match_operand:DF 1 "memory_operand")))] |
| 5671 |
"TARGET_SPLIT_MEM_OPND_FOR_FP_CONVERTS |
| 5672 |
&& optimize_insn_for_speed_p ()" |
| 5673 |
[(set (match_dup 2) (match_dup 1)) |
| 5674 |
(set (match_dup 0) (float_truncate:SF (match_dup 2)))] |
| 5675 |
"operands[2] = lowpart_subreg (DFmode, operands[0], SFmode);") |
| 5676 |
|
| 5677 |
;; Break partial SSE register dependency stall. This splitter should split |
| 5678 |
;; late in the pass sequence (after register rename pass), so allocated |
| 5679 |
;; registers won't change anymore |
| 5680 |
|
| 5681 |
(define_split |
| 5682 |
[(set (match_operand:SF 0 "sse_reg_operand") |
| 5683 |
(float_truncate:SF |
| 5684 |
(match_operand:DF 1 "nonimmediate_operand")))] |
| 5685 |
"!TARGET_AVX |
| 5686 |
&& TARGET_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY |
| 5687 |
&& epilogue_completed |
| 5688 |
&& optimize_function_for_speed_p (cfun) |
| 5689 |
&& (!REG_P (operands[1]) |
| 5690 |
|| (!TARGET_AVX && REGNO (operands[0]) != REGNO (operands[1]))) |
| 5691 |
&& (!EXT_REX_SSE_REG_P (operands[0]) |
| 5692 |
|| TARGET_AVX512VL)" |
| 5693 |
[(set (match_dup 0) |
| 5694 |
(vec_merge:V4SF |
| 5695 |
(vec_duplicate:V4SF |
| 5696 |
(float_truncate:SF |
| 5697 |
(match_dup 1))) |
| 5698 |
(match_dup 0) |
| 5699 |
(const_int 1)))] |
| 5700 |
{ |
| 5701 |
operands[0] = lowpart_subreg (V4SFmode, operands[0], SFmode); |
| 5702 |
emit_move_insn (operands[0], CONST0_RTX (V4SFmode)); |
| 5703 |
}) |
| 5704 |
|
| 5705 |
;; Conversion from XFmode to {SF,DF}mode |
| 5706 |
|
| 5707 |
(define_insn "truncxf<mode>2" |
| 5708 |
[(set (match_operand:MODEF 0 "nonimmediate_operand" "=m,f") |
| 5709 |
(float_truncate:MODEF |
| 5710 |
(match_operand:XF 1 "register_operand" "f,f")))] |
| 5711 |
"TARGET_80387" |
| 5712 |
"* return output_387_reg_move (insn, operands);" |
| 5713 |
[(set_attr "type" "fmov") |
| 5714 |
(set_attr "mode" "<MODE>") |
| 5715 |
(set (attr "enabled") |
| 5716 |
(cond [(eq_attr "alternative" "1") |
| 5717 |
(symbol_ref "flag_unsafe_math_optimizations") |
| 5718 |
] |
| 5719 |
(symbol_ref "true")))]) |
| 5720 |
|
| 5721 |
;; Conversion from {SF,DF}mode to HFmode. |
| 5722 |
|
| 5723 |
(define_expand "truncsfhf2" |
| 5724 |
[(set (match_operand:HF 0 "register_operand") |
| 5725 |
(float_truncate:HF |
| 5726 |
(match_operand:SF 1 "nonimmediate_operand")))] |
| 5727 |
"TARGET_AVX512FP16 || TARGET_F16C || TARGET_AVX512VL" |
| 5728 |
{ |
| 5729 |
if (!TARGET_AVX512FP16) |
| 5730 |
{ |
| 5731 |
rtx res = gen_reg_rtx (V8HFmode); |
| 5732 |
rtx tmp = gen_reg_rtx (V4SFmode); |
| 5733 |
rtx zero = force_reg (V4SFmode, CONST0_RTX (V4SFmode)); |
| 5734 |
|
| 5735 |
emit_insn (gen_vec_setv4sf_0 (tmp, zero, operands[1])); |
| 5736 |
emit_insn (gen_vcvtps2ph (gen_lowpart (V8HImode, res), tmp, GEN_INT (4))); |
| 5737 |
emit_move_insn (operands[0], gen_lowpart (HFmode, res)); |
| 5738 |
DONE; |
| 5739 |
} |
| 5740 |
}) |
| 5741 |
|
| 5742 |
(define_expand "truncdfhf2" |
| 5743 |
[(set (match_operand:HF 0 "register_operand") |
| 5744 |
(float_truncate:HF |
| 5745 |
(match_operand:DF 1 "nonimmediate_operand")))] |
| 5746 |
"TARGET_AVX512FP16") |
| 5747 |
|
| 5748 |
(define_insn "*trunc<mode>hf2" |
| 5749 |
[(set (match_operand:HF 0 "register_operand" "=v") |
| 5750 |
(float_truncate:HF |
| 5751 |
(match_operand:MODEF 1 "nonimmediate_operand" "vm")))] |
| 5752 |
"TARGET_AVX512FP16" |
| 5753 |
"vcvt<ssemodesuffix>2sh\t{%1, %d0|%d0, %1}" |
| 5754 |
[(set_attr "type" "ssecvt") |
| 5755 |
(set_attr "prefix" "evex") |
| 5756 |
(set_attr "mode" "HF")]) |
| 5757 |
|
| 5758 |
/* vcvtneps2bf16 doesn't honor SNAN, and turn sNAN into qNAN quietly, |
| 5759 |
and it always round to even. |
| 5760 |
flag_unsafte_math_optimization is needed for psrld. |
| 5761 |
If we don't expect qNaNs nor sNaNs and can assume rounding |
| 5762 |
to nearest, we can expand the conversion inline as |
| 5763 |
(fromi + 0x7fff + ((fromi >> 16) & 1)) >> 16. */ |
| 5764 |
(define_insn "truncsfbf2" |
| 5765 |
[(set (match_operand:BF 0 "register_operand" "=x,x,v,Yv") |
| 5766 |
(float_truncate:BF |
| 5767 |
(match_operand:SF 1 "register_operand" "0,x,v,Yv")))] |
| 5768 |
"TARGET_SSE2 && !HONOR_NANS (BFmode) && !flag_rounding_math |
| 5769 |
&& (flag_unsafe_math_optimizations |
| 5770 |
|| TARGET_AVXNECONVERT |
| 5771 |
|| (TARGET_AVX512BF16 && TARGET_AVX512VL))" |
| 5772 |
"@ |
| 5773 |
psrld\t{$16, %0|%0, 16} |
| 5774 |
%{vex%} vcvtneps2bf16\t{%1, %0|%0, %1} |
| 5775 |
vcvtneps2bf16\t{%1, %0|%0, %1} |
| 5776 |
vpsrld\t{$16, %1, %0|%0, %1, 16}" |
| 5777 |
[(set_attr "isa" "noavx,avxneconvert,avx512bf16vl,avx") |
| 5778 |
(set_attr "prefix" "orig,vex,evex,vex") |
| 5779 |
(set_attr "type" "sseishft1,ssecvt,ssecvt,sseishft1")]) |
| 5780 |
|
| 5781 |
;; Signed conversion to DImode. |
| 5782 |
|
| 5783 |
(define_expand "fix_truncxfdi2" |
| 5784 |
[(parallel [(set (match_operand:DI 0 "nonimmediate_operand") |
| 5785 |
(fix:DI (match_operand:XF 1 "register_operand"))) |
| 5786 |
(clobber (reg:CC FLAGS_REG))])] |
| 5787 |
"TARGET_80387" |
| 5788 |
{ |
| 5789 |
if (TARGET_FISTTP) |
| 5790 |
{ |
| 5791 |
emit_insn (gen_fix_truncdi_i387_fisttp (operands[0], operands[1])); |
| 5792 |
DONE; |
| 5793 |
} |
| 5794 |
}) |
| 5795 |
|
| 5796 |
(define_expand "fix_trunc<mode>di2" |
| 5797 |
[(parallel [(set (match_operand:DI 0 "nonimmediate_operand") |
| 5798 |
(fix:DI (match_operand:MODEF 1 "register_operand"))) |
| 5799 |
(clobber (reg:CC FLAGS_REG))])] |
| 5800 |
"TARGET_80387 || (TARGET_64BIT && SSE_FLOAT_MODE_P (<MODE>mode))" |
| 5801 |
{ |
| 5802 |
if (TARGET_FISTTP |
| 5803 |
&& !(TARGET_64BIT && SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)) |
| 5804 |
{ |
| 5805 |
emit_insn (gen_fix_truncdi_i387_fisttp (operands[0], operands[1])); |
| 5806 |
DONE; |
| 5807 |
} |
| 5808 |
if (TARGET_64BIT && SSE_FLOAT_MODE_P (<MODE>mode)) |
| 5809 |
{ |
| 5810 |
rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (DImode); |
| 5811 |
emit_insn (gen_fix_trunc<mode>di_sse (out, operands[1])); |
| 5812 |
if (out != operands[0]) |
| 5813 |
emit_move_insn (operands[0], out); |
| 5814 |
DONE; |
| 5815 |
} |
| 5816 |
}) |
| 5817 |
|
| 5818 |
(define_insn "fix<fixunssuffix>_trunchf<mode>2" |
| 5819 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 5820 |
(any_fix:SWI48 |
| 5821 |
(match_operand:HF 1 "nonimmediate_operand" "vm")))] |
| 5822 |
"TARGET_AVX512FP16" |
| 5823 |
"vcvttsh2<fixsuffix>si\t{%1, %0|%0, %1}" |
| 5824 |
[(set_attr "type" "sseicvt") |
| 5825 |
(set_attr "prefix" "evex") |
| 5826 |
(set_attr "mode" "<MODE>")]) |
| 5827 |
|
| 5828 |
;; Signed conversion to SImode. |
| 5829 |
|
| 5830 |
(define_expand "fix_truncxfsi2" |
| 5831 |
[(parallel [(set (match_operand:SI 0 "nonimmediate_operand") |
| 5832 |
(fix:SI (match_operand:XF 1 "register_operand"))) |
| 5833 |
(clobber (reg:CC FLAGS_REG))])] |
| 5834 |
"TARGET_80387" |
| 5835 |
{ |
| 5836 |
if (TARGET_FISTTP) |
| 5837 |
{ |
| 5838 |
emit_insn (gen_fix_truncsi_i387_fisttp (operands[0], operands[1])); |
| 5839 |
DONE; |
| 5840 |
} |
| 5841 |
}) |
| 5842 |
|
| 5843 |
(define_expand "fix_trunc<mode>si2" |
| 5844 |
[(parallel [(set (match_operand:SI 0 "nonimmediate_operand") |
| 5845 |
(fix:SI (match_operand:MODEF 1 "register_operand"))) |
| 5846 |
(clobber (reg:CC FLAGS_REG))])] |
| 5847 |
"TARGET_80387 || SSE_FLOAT_MODE_P (<MODE>mode)" |
| 5848 |
{ |
| 5849 |
if (TARGET_FISTTP |
| 5850 |
&& !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)) |
| 5851 |
{ |
| 5852 |
emit_insn (gen_fix_truncsi_i387_fisttp (operands[0], operands[1])); |
| 5853 |
DONE; |
| 5854 |
} |
| 5855 |
if (SSE_FLOAT_MODE_P (<MODE>mode)) |
| 5856 |
{ |
| 5857 |
rtx out = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode); |
| 5858 |
emit_insn (gen_fix_trunc<mode>si_sse (out, operands[1])); |
| 5859 |
if (out != operands[0]) |
| 5860 |
emit_move_insn (operands[0], out); |
| 5861 |
DONE; |
| 5862 |
} |
| 5863 |
}) |
| 5864 |
|
| 5865 |
;; Signed conversion to HImode. |
| 5866 |
|
| 5867 |
(define_expand "fix_trunc<mode>hi2" |
| 5868 |
[(parallel [(set (match_operand:HI 0 "nonimmediate_operand") |
| 5869 |
(fix:HI (match_operand:X87MODEF 1 "register_operand"))) |
| 5870 |
(clobber (reg:CC FLAGS_REG))])] |
| 5871 |
"TARGET_80387 |
| 5872 |
&& !(SSE_FLOAT_MODE_P (<MODE>mode) && (!TARGET_FISTTP || TARGET_SSE_MATH))" |
| 5873 |
{ |
| 5874 |
if (TARGET_FISTTP) |
| 5875 |
{ |
| 5876 |
emit_insn (gen_fix_trunchi_i387_fisttp (operands[0], operands[1])); |
| 5877 |
DONE; |
| 5878 |
} |
| 5879 |
}) |
| 5880 |
|
| 5881 |
;; Unsigned conversion to DImode |
| 5882 |
|
| 5883 |
(define_insn "fixuns_trunc<mode>di2" |
| 5884 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5885 |
(unsigned_fix:DI |
| 5886 |
(match_operand:MODEF 1 "nonimmediate_operand" "vm")))] |
| 5887 |
"TARGET_64BIT && TARGET_AVX512F && TARGET_SSE_MATH" |
| 5888 |
"vcvtt<ssemodesuffix>2usi\t{%1, %0|%0, %1}" |
| 5889 |
[(set_attr "type" "sseicvt") |
| 5890 |
(set_attr "prefix" "evex") |
| 5891 |
(set_attr "mode" "DI")]) |
| 5892 |
|
| 5893 |
;; Unsigned conversion to SImode. |
| 5894 |
|
| 5895 |
(define_expand "fixuns_trunc<mode>si2" |
| 5896 |
[(parallel |
| 5897 |
[(set (match_operand:SI 0 "register_operand") |
| 5898 |
(unsigned_fix:SI |
| 5899 |
(match_operand:MODEF 1 "nonimmediate_operand"))) |
| 5900 |
(use (match_dup 2)) |
| 5901 |
(clobber (scratch:<ssevecmode>)) |
| 5902 |
(clobber (scratch:<ssevecmode>))])] |
| 5903 |
"(!TARGET_64BIT || TARGET_AVX512F) && TARGET_SSE2 && TARGET_SSE_MATH" |
| 5904 |
{ |
| 5905 |
machine_mode mode = <MODE>mode; |
| 5906 |
machine_mode vecmode = <ssevecmode>mode; |
| 5907 |
REAL_VALUE_TYPE TWO31r; |
| 5908 |
rtx two31; |
| 5909 |
|
| 5910 |
if (TARGET_AVX512F) |
| 5911 |
{ |
| 5912 |
emit_insn (gen_fixuns_trunc<mode>si2_avx512f (operands[0], operands[1])); |
| 5913 |
DONE; |
| 5914 |
} |
| 5915 |
|
| 5916 |
if (optimize_insn_for_size_p ()) |
| 5917 |
FAIL; |
| 5918 |
|
| 5919 |
real_ldexp (&TWO31r, &dconst1, 31); |
| 5920 |
two31 = const_double_from_real_value (TWO31r, mode); |
| 5921 |
two31 = ix86_build_const_vector (vecmode, true, two31); |
| 5922 |
operands[2] = force_reg (vecmode, two31); |
| 5923 |
}) |
| 5924 |
|
| 5925 |
(define_insn "fixuns_trunc<mode>si2_avx512f" |
| 5926 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5927 |
(unsigned_fix:SI |
| 5928 |
(match_operand:MODEF 1 "nonimmediate_operand" "vm")))] |
| 5929 |
"TARGET_AVX512F && TARGET_SSE_MATH" |
| 5930 |
"vcvtt<ssemodesuffix>2usi\t{%1, %0|%0, %1}" |
| 5931 |
[(set_attr "type" "sseicvt") |
| 5932 |
(set_attr "prefix" "evex") |
| 5933 |
(set_attr "mode" "SI")]) |
| 5934 |
|
| 5935 |
(define_insn "*fixuns_trunchfsi2zext" |
| 5936 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5937 |
(zero_extend:DI |
| 5938 |
(unsigned_fix:SI |
| 5939 |
(match_operand:HF 1 "nonimmediate_operand" "vm"))))] |
| 5940 |
"TARGET_64BIT && TARGET_AVX512FP16" |
| 5941 |
"vcvttsh2usi\t{%1, %k0|%k0, %1}" |
| 5942 |
[(set_attr "type" "sseicvt") |
| 5943 |
(set_attr "prefix" "evex") |
| 5944 |
(set_attr "mode" "SI")]) |
| 5945 |
|
| 5946 |
(define_insn "*fixuns_trunc<mode>si2_avx512f_zext" |
| 5947 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5948 |
(zero_extend:DI |
| 5949 |
(unsigned_fix:SI |
| 5950 |
(match_operand:MODEF 1 "nonimmediate_operand" "vm"))))] |
| 5951 |
"TARGET_64BIT && TARGET_AVX512F && TARGET_SSE_MATH" |
| 5952 |
"vcvtt<ssemodesuffix>2usi\t{%1, %k0|%k0, %1}" |
| 5953 |
[(set_attr "type" "sseicvt") |
| 5954 |
(set_attr "prefix" "evex") |
| 5955 |
(set_attr "mode" "SI")]) |
| 5956 |
|
| 5957 |
(define_insn_and_split "*fixuns_trunc<mode>_1" |
| 5958 |
[(set (match_operand:SI 0 "register_operand" "=&x,&x") |
| 5959 |
(unsigned_fix:SI |
| 5960 |
(match_operand:MODEF 3 "nonimmediate_operand" "xm,xm"))) |
| 5961 |
(use (match_operand:<ssevecmode> 4 "nonimmediate_operand" "m,x")) |
| 5962 |
(clobber (match_scratch:<ssevecmode> 1 "=x,&x")) |
| 5963 |
(clobber (match_scratch:<ssevecmode> 2 "=x,x"))] |
| 5964 |
"!TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH |
| 5965 |
&& optimize_function_for_speed_p (cfun)" |
| 5966 |
"#" |
| 5967 |
"&& reload_completed" |
| 5968 |
[(const_int 0)] |
| 5969 |
{ |
| 5970 |
ix86_split_convert_uns_si_sse (operands); |
| 5971 |
DONE; |
| 5972 |
}) |
| 5973 |
|
| 5974 |
;; Unsigned conversion to HImode. |
| 5975 |
;; Without these patterns, we'll try the unsigned SI conversion which |
| 5976 |
;; is complex for SSE, rather than the signed SI conversion, which isn't. |
| 5977 |
|
| 5978 |
(define_expand "fixuns_trunchfhi2" |
| 5979 |
[(set (match_dup 2) |
| 5980 |
(fix:SI (match_operand:HF 1 "nonimmediate_operand"))) |
| 5981 |
(set (match_operand:HI 0 "nonimmediate_operand") |
| 5982 |
(subreg:HI (match_dup 2) 0))] |
| 5983 |
"TARGET_AVX512FP16" |
| 5984 |
"operands[2] = gen_reg_rtx (SImode);") |
| 5985 |
|
| 5986 |
(define_expand "fixuns_trunc<mode>hi2" |
| 5987 |
[(set (match_dup 2) |
| 5988 |
(fix:SI (match_operand:MODEF 1 "nonimmediate_operand"))) |
| 5989 |
(set (match_operand:HI 0 "nonimmediate_operand") |
| 5990 |
(subreg:HI (match_dup 2) 0))] |
| 5991 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH" |
| 5992 |
"operands[2] = gen_reg_rtx (SImode);") |
| 5993 |
|
| 5994 |
;; When SSE is available, it is always faster to use it! |
| 5995 |
(define_insn "fix_trunc<MODEF:mode><SWI48:mode>_sse" |
| 5996 |
[(set (match_operand:SWI48 0 "register_operand" "=r,r") |
| 5997 |
(fix:SWI48 (match_operand:MODEF 1 "nonimmediate_operand" "v,m")))] |
| 5998 |
"SSE_FLOAT_MODE_P (<MODEF:MODE>mode) |
| 5999 |
&& (!TARGET_FISTTP || TARGET_SSE_MATH)" |
| 6000 |
"%vcvtt<MODEF:ssemodesuffix>2si<SWI48:rex64suffix>\t{%1, %0|%0, %1}" |
| 6001 |
[(set_attr "type" "sseicvt") |
| 6002 |
(set_attr "prefix" "maybe_vex") |
| 6003 |
(set (attr "prefix_rex") |
| 6004 |
(if_then_else |
| 6005 |
(match_test "<SWI48:MODE>mode == DImode") |
| 6006 |
(const_string "1") |
| 6007 |
(const_string "*"))) |
| 6008 |
(set_attr "mode" "<MODEF:MODE>") |
| 6009 |
(set_attr "athlon_decode" "double,vector") |
| 6010 |
(set_attr "amdfam10_decode" "double,double") |
| 6011 |
(set_attr "bdver1_decode" "double,double")]) |
| 6012 |
|
| 6013 |
;; Avoid vector decoded forms of the instruction. |
| 6014 |
(define_peephole2 |
| 6015 |
[(match_scratch:MODEF 2 "x") |
| 6016 |
(set (match_operand:SWI48 0 "register_operand") |
| 6017 |
(fix:SWI48 (match_operand:MODEF 1 "memory_operand")))] |
| 6018 |
"TARGET_AVOID_VECTOR_DECODE |
| 6019 |
&& SSE_FLOAT_MODE_P (<MODEF:MODE>mode) |
| 6020 |
&& optimize_insn_for_speed_p ()" |
| 6021 |
[(set (match_dup 2) (match_dup 1)) |
| 6022 |
(set (match_dup 0) (fix:SWI48 (match_dup 2)))]) |
| 6023 |
|
| 6024 |
(define_insn "fix_trunc<mode>_i387_fisttp" |
| 6025 |
[(set (match_operand:SWI248x 0 "nonimmediate_operand" "=m") |
| 6026 |
(fix:SWI248x (match_operand 1 "register_operand" "f"))) |
| 6027 |
(clobber (match_scratch:XF 2 "=&f"))] |
| 6028 |
"X87_FLOAT_MODE_P (GET_MODE (operands[1])) |
| 6029 |
&& TARGET_FISTTP |
| 6030 |
&& !((SSE_FLOAT_MODE_P (GET_MODE (operands[1])) |
| 6031 |
&& (TARGET_64BIT || <MODE>mode != DImode)) |
| 6032 |
&& TARGET_SSE_MATH)" |
| 6033 |
"* return output_fix_trunc (insn, operands, true);" |
| 6034 |
[(set_attr "type" "fisttp") |
| 6035 |
(set_attr "mode" "<MODE>")]) |
| 6036 |
|
| 6037 |
;; See the comments in i386.h near OPTIMIZE_MODE_SWITCHING for the description |
| 6038 |
;; of the machinery. Please note the clobber of FLAGS_REG. In i387 control |
| 6039 |
;; word calculation (inserted by LCM in mode switching pass) a FLAGS_REG |
| 6040 |
;; clobbering insns can be used. Look at emit_i387_cw_initialization () |
| 6041 |
;; function in i386.cc. |
| 6042 |
(define_insn_and_split "*fix_trunc<mode>_i387_1" |
| 6043 |
[(set (match_operand:SWI248x 0 "nonimmediate_operand") |
| 6044 |
(fix:SWI248x (match_operand 1 "register_operand"))) |
| 6045 |
(clobber (reg:CC FLAGS_REG))] |
| 6046 |
"X87_FLOAT_MODE_P (GET_MODE (operands[1])) |
| 6047 |
&& !TARGET_FISTTP |
| 6048 |
&& !(SSE_FLOAT_MODE_P (GET_MODE (operands[1])) |
| 6049 |
&& (TARGET_64BIT || <MODE>mode != DImode)) |
| 6050 |
&& ix86_pre_reload_split ()" |
| 6051 |
"#" |
| 6052 |
"&& 1" |
| 6053 |
[(const_int 0)] |
| 6054 |
{ |
| 6055 |
ix86_optimize_mode_switching[I387_TRUNC] = 1; |
| 6056 |
|
| 6057 |
operands[2] = assign_386_stack_local (HImode, SLOT_CW_STORED); |
| 6058 |
operands[3] = assign_386_stack_local (HImode, SLOT_CW_TRUNC); |
| 6059 |
|
| 6060 |
emit_insn (gen_fix_trunc<mode>_i387 (operands[0], operands[1], |
| 6061 |
operands[2], operands[3])); |
| 6062 |
DONE; |
| 6063 |
} |
| 6064 |
[(set_attr "type" "fistp") |
| 6065 |
(set_attr "i387_cw" "trunc") |
| 6066 |
(set_attr "mode" "<MODE>")]) |
| 6067 |
|
| 6068 |
(define_insn "fix_truncdi_i387" |
| 6069 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=m") |
| 6070 |
(fix:DI (match_operand 1 "register_operand" "f"))) |
| 6071 |
(use (match_operand:HI 2 "memory_operand" "m")) |
| 6072 |
(use (match_operand:HI 3 "memory_operand" "m")) |
| 6073 |
(clobber (match_scratch:XF 4 "=&f"))] |
| 6074 |
"X87_FLOAT_MODE_P (GET_MODE (operands[1])) |
| 6075 |
&& !TARGET_FISTTP |
| 6076 |
&& !(TARGET_64BIT && SSE_FLOAT_MODE_P (GET_MODE (operands[1])))" |
| 6077 |
"* return output_fix_trunc (insn, operands, false);" |
| 6078 |
[(set_attr "type" "fistp") |
| 6079 |
(set_attr "i387_cw" "trunc") |
| 6080 |
(set_attr "mode" "DI")]) |
| 6081 |
|
| 6082 |
(define_insn "fix_trunc<mode>_i387" |
| 6083 |
[(set (match_operand:SWI24 0 "nonimmediate_operand" "=m") |
| 6084 |
(fix:SWI24 (match_operand 1 "register_operand" "f"))) |
| 6085 |
(use (match_operand:HI 2 "memory_operand" "m")) |
| 6086 |
(use (match_operand:HI 3 "memory_operand" "m"))] |
| 6087 |
"X87_FLOAT_MODE_P (GET_MODE (operands[1])) |
| 6088 |
&& !TARGET_FISTTP |
| 6089 |
&& !SSE_FLOAT_MODE_P (GET_MODE (operands[1]))" |
| 6090 |
"* return output_fix_trunc (insn, operands, false);" |
| 6091 |
[(set_attr "type" "fistp") |
| 6092 |
(set_attr "i387_cw" "trunc") |
| 6093 |
(set_attr "mode" "<MODE>")]) |
| 6094 |
|
| 6095 |
(define_insn "x86_fnstcw_1" |
| 6096 |
[(set (match_operand:HI 0 "memory_operand" "=m") |
| 6097 |
(unspec:HI [(const_int 0)] UNSPEC_FSTCW))] |
| 6098 |
"TARGET_80387" |
| 6099 |
"fnstcw\t%0" |
| 6100 |
[(set (attr "length") |
| 6101 |
(symbol_ref "ix86_attr_length_address_default (insn) + 2")) |
| 6102 |
(set_attr "mode" "HI") |
| 6103 |
(set_attr "unit" "i387") |
| 6104 |
(set_attr "bdver1_decode" "vector")]) |
| 6105 |
|
| 6106 |
;; Conversion between fixed point and floating point. |
| 6107 |
|
| 6108 |
;; Even though we only accept memory inputs, the backend _really_ |
| 6109 |
;; wants to be able to do this between registers. Thankfully, LRA |
| 6110 |
;; will fix this up for us during register allocation. |
| 6111 |
|
| 6112 |
(define_insn "floathi<mode>2" |
| 6113 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f") |
| 6114 |
(float:X87MODEF (match_operand:HI 1 "nonimmediate_operand" "m")))] |
| 6115 |
"TARGET_80387 |
| 6116 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 6117 |
|| TARGET_MIX_SSE_I387)" |
| 6118 |
"fild%Z1\t%1" |
| 6119 |
[(set_attr "type" "fmov") |
| 6120 |
(set_attr "mode" "<MODE>") |
| 6121 |
(set_attr "znver1_decode" "double") |
| 6122 |
(set_attr "c86_decode" "double") |
| 6123 |
(set_attr "fp_int_src" "true")]) |
| 6124 |
|
| 6125 |
(define_insn "float<SWI48x:mode>xf2" |
| 6126 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 6127 |
(float:XF (match_operand:SWI48x 1 "nonimmediate_operand" "m")))] |
| 6128 |
"TARGET_80387" |
| 6129 |
"fild%Z1\t%1" |
| 6130 |
[(set_attr "type" "fmov") |
| 6131 |
(set_attr "mode" "XF") |
| 6132 |
(set_attr "znver1_decode" "double") |
| 6133 |
(set_attr "c86_decode" "double") |
| 6134 |
(set_attr "fp_int_src" "true")]) |
| 6135 |
|
| 6136 |
(define_expand "float<SWI48x:mode><MODEF:mode>2" |
| 6137 |
[(set (match_operand:MODEF 0 "register_operand") |
| 6138 |
(float:MODEF (match_operand:SWI48x 1 "nonimmediate_operand")))] |
| 6139 |
"(TARGET_80387 && X87_ENABLE_FLOAT (<MODEF:MODE>mode, <SWI48x:MODE>mode)) |
| 6140 |
|| (SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH |
| 6141 |
&& ((<SWI48x:MODE>mode != DImode) || TARGET_64BIT))") |
| 6142 |
|
| 6143 |
(define_insn "*float<SWI48:mode><MODEF:mode>2" |
| 6144 |
[(set (match_operand:MODEF 0 "register_operand" "=f,v,v") |
| 6145 |
(float:MODEF |
| 6146 |
(match_operand:SWI48 1 "nonimmediate_operand" "m,r,m")))] |
| 6147 |
"(TARGET_80387 && X87_ENABLE_FLOAT (<MODEF:MODE>mode, <SWI48:MODE>mode)) |
| 6148 |
|| (SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH)" |
| 6149 |
"@ |
| 6150 |
fild%Z1\t%1 |
| 6151 |
%vcvtsi2<MODEF:ssemodesuffix><SWI48:rex64suffix>\t{%1, %d0|%d0, %1} |
| 6152 |
%vcvtsi2<MODEF:ssemodesuffix><SWI48:rex64suffix>\t{%1, %d0|%d0, %1}" |
| 6153 |
[(set_attr "type" "fmov,sseicvt,sseicvt") |
| 6154 |
(set_attr "avx_partial_xmm_update" "false,true,true") |
| 6155 |
(set_attr "prefix" "orig,maybe_vex,maybe_vex") |
| 6156 |
(set_attr "mode" "<MODEF:MODE>") |
| 6157 |
(set (attr "prefix_rex") |
| 6158 |
(if_then_else |
| 6159 |
(and (eq_attr "prefix" "maybe_vex") |
| 6160 |
(match_test "<SWI48:MODE>mode == DImode")) |
| 6161 |
(const_string "1") |
| 6162 |
(const_string "*"))) |
| 6163 |
(set_attr "unit" "i387,*,*") |
| 6164 |
(set_attr "athlon_decode" "*,double,direct") |
| 6165 |
(set_attr "amdfam10_decode" "*,vector,double") |
| 6166 |
(set_attr "bdver1_decode" "*,double,direct") |
| 6167 |
(set_attr "znver1_decode" "double,*,*") |
| 6168 |
(set_attr "c86_decode" "double,*,*") |
| 6169 |
(set_attr "fp_int_src" "true") |
| 6170 |
(set (attr "enabled") |
| 6171 |
(if_then_else |
| 6172 |
(match_test ("SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH")) |
| 6173 |
(if_then_else |
| 6174 |
(eq_attr "alternative" "0") |
| 6175 |
(symbol_ref "TARGET_MIX_SSE_I387 |
| 6176 |
&& X87_ENABLE_FLOAT (<MODEF:MODE>mode, |
| 6177 |
<SWI48:MODE>mode)") |
| 6178 |
(symbol_ref "true")) |
| 6179 |
(if_then_else |
| 6180 |
(eq_attr "alternative" "0") |
| 6181 |
(symbol_ref "true") |
| 6182 |
(symbol_ref "false")))) |
| 6183 |
(set (attr "preferred_for_speed") |
| 6184 |
(cond [(eq_attr "alternative" "1") |
| 6185 |
(symbol_ref "TARGET_INTER_UNIT_CONVERSIONS")] |
| 6186 |
(symbol_ref "true")))]) |
| 6187 |
|
| 6188 |
(define_insn "float<floatunssuffix><mode>hf2" |
| 6189 |
[(set (match_operand:HF 0 "register_operand" "=v") |
| 6190 |
(any_float:HF |
| 6191 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm")))] |
| 6192 |
"TARGET_AVX512FP16" |
| 6193 |
"vcvt<floatsuffix>si2sh<rex64suffix>\t{%1, %d0|%d0, %1}" |
| 6194 |
[(set_attr "type" "sseicvt") |
| 6195 |
(set_attr "prefix" "evex") |
| 6196 |
(set_attr "mode" "HF")]) |
| 6197 |
|
| 6198 |
(define_insn "*floatdi<MODEF:mode>2_i387" |
| 6199 |
[(set (match_operand:MODEF 0 "register_operand" "=f") |
| 6200 |
(float:MODEF (match_operand:DI 1 "nonimmediate_operand" "m")))] |
| 6201 |
"!TARGET_64BIT |
| 6202 |
&& TARGET_80387 && X87_ENABLE_FLOAT (<MODEF:MODE>mode, DImode)" |
| 6203 |
"fild%Z1\t%1" |
| 6204 |
[(set_attr "type" "fmov") |
| 6205 |
(set_attr "mode" "<MODEF:MODE>") |
| 6206 |
(set_attr "znver1_decode" "double") |
| 6207 |
(set_attr "c86_decode" "double") |
| 6208 |
(set_attr "fp_int_src" "true")]) |
| 6209 |
|
| 6210 |
;; Try TARGET_USE_VECTOR_CONVERTS, but not so hard as to require extra memory |
| 6211 |
;; slots when !TARGET_INTER_UNIT_MOVES_TO_VEC disables the general_regs |
| 6212 |
;; alternative in sse2_loadld. |
| 6213 |
(define_split |
| 6214 |
[(set (match_operand:MODEF 0 "sse_reg_operand") |
| 6215 |
(float:MODEF (match_operand:SI 1 "nonimmediate_operand")))] |
| 6216 |
"TARGET_SSE2 |
| 6217 |
&& TARGET_USE_VECTOR_CONVERTS |
| 6218 |
&& optimize_function_for_speed_p (cfun) |
| 6219 |
&& reload_completed |
| 6220 |
&& (MEM_P (operands[1]) || TARGET_INTER_UNIT_MOVES_TO_VEC) |
| 6221 |
&& (!EXT_REX_SSE_REG_P (operands[0]) |
| 6222 |
|| TARGET_AVX512VL)" |
| 6223 |
[(const_int 0)] |
| 6224 |
{ |
| 6225 |
operands[3] = lowpart_subreg (<ssevecmode>mode, operands[0], <MODE>mode); |
| 6226 |
operands[4] = lowpart_subreg (V4SImode, operands[0], <MODE>mode); |
| 6227 |
|
| 6228 |
emit_insn (gen_sse2_loadld (operands[4], |
| 6229 |
CONST0_RTX (V4SImode), operands[1])); |
| 6230 |
|
| 6231 |
if (<ssevecmode>mode == V4SFmode) |
| 6232 |
emit_insn (gen_floatv4siv4sf2 (operands[3], operands[4])); |
| 6233 |
else |
| 6234 |
emit_insn (gen_sse2_cvtdq2pd (operands[3], operands[4])); |
| 6235 |
DONE; |
| 6236 |
}) |
| 6237 |
|
| 6238 |
;; Avoid store forwarding (partial memory) stall penalty |
| 6239 |
;; by passing DImode value through XMM registers. */ |
| 6240 |
|
| 6241 |
(define_split |
| 6242 |
[(set (match_operand:X87MODEF 0 "register_operand") |
| 6243 |
(float:X87MODEF |
| 6244 |
(match_operand:DI 1 "register_operand")))] |
| 6245 |
"!TARGET_64BIT && TARGET_INTER_UNIT_MOVES_TO_VEC |
| 6246 |
&& TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) |
| 6247 |
&& TARGET_SSE2 && optimize_function_for_speed_p (cfun) |
| 6248 |
&& can_create_pseudo_p ()" |
| 6249 |
[(const_int 0)] |
| 6250 |
{ |
| 6251 |
rtx s = assign_386_stack_local (DImode, SLOT_FLOATxFDI_387); |
| 6252 |
emit_insn (gen_floatdi<mode>2_i387_with_xmm (operands[0], operands[1], s)); |
| 6253 |
DONE; |
| 6254 |
}) |
| 6255 |
|
| 6256 |
(define_insn_and_split "floatdi<X87MODEF:mode>2_i387_with_xmm" |
| 6257 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f,f") |
| 6258 |
(float:X87MODEF |
| 6259 |
(match_operand:DI 1 "register_operand" "r,r"))) |
| 6260 |
(clobber (match_operand:DI 2 "memory_operand" "=m,m")) |
| 6261 |
(clobber (match_scratch:V4SI 3 "=x,x")) |
| 6262 |
(clobber (match_scratch:V4SI 4 "=X,x"))] |
| 6263 |
"!TARGET_64BIT && TARGET_INTER_UNIT_MOVES_TO_VEC |
| 6264 |
&& TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) |
| 6265 |
&& TARGET_SSE2 && optimize_function_for_speed_p (cfun)" |
| 6266 |
"#" |
| 6267 |
"&& reload_completed" |
| 6268 |
[(set (match_dup 2) (match_dup 3)) |
| 6269 |
(set (match_dup 0) (float:X87MODEF (match_dup 2)))] |
| 6270 |
{ |
| 6271 |
/* The DImode arrived in a pair of integral registers (e.g. %edx:%eax). |
| 6272 |
Assemble the 64-bit DImode value in an xmm register. */ |
| 6273 |
emit_insn (gen_sse2_loadld (operands[3], CONST0_RTX (V4SImode), |
| 6274 |
gen_lowpart (SImode, operands[1]))); |
| 6275 |
if (TARGET_SSE4_1) |
| 6276 |
emit_insn (gen_sse4_1_pinsrd (operands[3], operands[3], |
| 6277 |
gen_highpart (SImode, operands[1]), |
| 6278 |
GEN_INT (2))); |
| 6279 |
else |
| 6280 |
{ |
| 6281 |
emit_insn (gen_sse2_loadld (operands[4], CONST0_RTX (V4SImode), |
| 6282 |
gen_highpart (SImode, operands[1]))); |
| 6283 |
emit_insn (gen_vec_interleave_lowv4si (operands[3], operands[3], |
| 6284 |
operands[4])); |
| 6285 |
} |
| 6286 |
operands[3] = gen_lowpart (DImode, operands[3]); |
| 6287 |
} |
| 6288 |
[(set_attr "isa" "sse4,*") |
| 6289 |
(set_attr "type" "multi") |
| 6290 |
(set_attr "mode" "<X87MODEF:MODE>") |
| 6291 |
(set_attr "unit" "i387") |
| 6292 |
(set_attr "fp_int_src" "true")]) |
| 6293 |
|
| 6294 |
;; Break partial SSE register dependency stall. This splitter should split |
| 6295 |
;; late in the pass sequence (after register rename pass), so allocated |
| 6296 |
;; registers won't change anymore |
| 6297 |
|
| 6298 |
(define_split |
| 6299 |
[(set (match_operand:MODEF 0 "sse_reg_operand") |
| 6300 |
(float:MODEF (match_operand:SWI48 1 "nonimmediate_operand")))] |
| 6301 |
"!TARGET_AVX |
| 6302 |
&& TARGET_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY |
| 6303 |
&& epilogue_completed |
| 6304 |
&& optimize_function_for_speed_p (cfun) |
| 6305 |
&& (!EXT_REX_SSE_REG_P (operands[0]) |
| 6306 |
|| TARGET_AVX512VL)" |
| 6307 |
[(set (match_dup 0) |
| 6308 |
(vec_merge:<MODEF:ssevecmode> |
| 6309 |
(vec_duplicate:<MODEF:ssevecmode> |
| 6310 |
(float:MODEF |
| 6311 |
(match_dup 1))) |
| 6312 |
(match_dup 0) |
| 6313 |
(const_int 1)))] |
| 6314 |
{ |
| 6315 |
const machine_mode vmode = <MODEF:ssevecmode>mode; |
| 6316 |
|
| 6317 |
operands[0] = lowpart_subreg (vmode, operands[0], <MODEF:MODE>mode); |
| 6318 |
emit_move_insn (operands[0], CONST0_RTX (vmode)); |
| 6319 |
}) |
| 6320 |
|
| 6321 |
(define_expand "floatuns<SWI12:mode><MODEF:mode>2" |
| 6322 |
[(set (match_operand:MODEF 0 "register_operand") |
| 6323 |
(unsigned_float:MODEF |
| 6324 |
(match_operand:SWI12 1 "nonimmediate_operand")))] |
| 6325 |
"!TARGET_64BIT |
| 6326 |
&& SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH" |
| 6327 |
{ |
| 6328 |
operands[1] = convert_to_mode (SImode, operands[1], 1); |
| 6329 |
emit_insn (gen_floatsi<MODEF:mode>2 (operands[0], operands[1])); |
| 6330 |
DONE; |
| 6331 |
}) |
| 6332 |
|
| 6333 |
(define_insn "*floatuns<SWI48:mode><MODEF:mode>2_avx512" |
| 6334 |
[(set (match_operand:MODEF 0 "register_operand" "=v") |
| 6335 |
(unsigned_float:MODEF |
| 6336 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm")))] |
| 6337 |
"TARGET_AVX512F && TARGET_SSE_MATH" |
| 6338 |
"vcvtusi2<MODEF:ssemodesuffix><SWI48:rex64suffix>\t{%1, %0, %0|%0, %0, %1}" |
| 6339 |
[(set_attr "type" "sseicvt") |
| 6340 |
(set_attr "avx_partial_xmm_update" "true") |
| 6341 |
(set_attr "prefix" "evex") |
| 6342 |
(set_attr "mode" "<MODEF:MODE>")]) |
| 6343 |
|
| 6344 |
;; Avoid store forwarding (partial memory) stall penalty by extending |
| 6345 |
;; SImode value to DImode through XMM register instead of pushing two |
| 6346 |
;; SImode values to stack. Also note that fild loads from memory only. |
| 6347 |
|
| 6348 |
(define_insn_and_split "floatunssi<mode>2_i387_with_xmm" |
| 6349 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f") |
| 6350 |
(unsigned_float:X87MODEF |
| 6351 |
(match_operand:SI 1 "nonimmediate_operand" "rm"))) |
| 6352 |
(clobber (match_operand:DI 2 "memory_operand" "=m")) |
| 6353 |
(clobber (match_scratch:DI 3 "=x"))] |
| 6354 |
"!TARGET_64BIT |
| 6355 |
&& TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) |
| 6356 |
&& TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC" |
| 6357 |
"#" |
| 6358 |
"&& reload_completed" |
| 6359 |
[(set (match_dup 3) (zero_extend:DI (match_dup 1))) |
| 6360 |
(set (match_dup 2) (match_dup 3)) |
| 6361 |
(set (match_dup 0) |
| 6362 |
(float:X87MODEF (match_dup 2)))] |
| 6363 |
"" |
| 6364 |
[(set_attr "type" "multi") |
| 6365 |
(set_attr "mode" "<MODE>")]) |
| 6366 |
|
| 6367 |
(define_expand "floatunssi<mode>2" |
| 6368 |
[(set (match_operand:X87MODEF 0 "register_operand") |
| 6369 |
(unsigned_float:X87MODEF |
| 6370 |
(match_operand:SI 1 "nonimmediate_operand")))] |
| 6371 |
"(!TARGET_64BIT |
| 6372 |
&& TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) |
| 6373 |
&& TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC) |
| 6374 |
|| ((!TARGET_64BIT || TARGET_AVX512F) |
| 6375 |
&& SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 6376 |
{ |
| 6377 |
if (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)) |
| 6378 |
{ |
| 6379 |
emit_insn (gen_floatunssi<mode>2_i387_with_xmm |
| 6380 |
(operands[0], operands[1], |
| 6381 |
assign_stack_temp (DImode, GET_MODE_SIZE (DImode)))); |
| 6382 |
DONE; |
| 6383 |
} |
| 6384 |
if (!TARGET_AVX512F) |
| 6385 |
{ |
| 6386 |
ix86_expand_convert_uns_si<mode>_sse (operands[0], operands[1]); |
| 6387 |
DONE; |
| 6388 |
} |
| 6389 |
}) |
| 6390 |
|
| 6391 |
(define_expand "floatunsdisf2" |
| 6392 |
[(set (match_operand:SF 0 "register_operand") |
| 6393 |
(unsigned_float:SF |
| 6394 |
(match_operand:DI 1 "nonimmediate_operand")))] |
| 6395 |
"TARGET_64BIT && TARGET_SSE && TARGET_SSE_MATH" |
| 6396 |
{ |
| 6397 |
if (!TARGET_AVX512F) |
| 6398 |
{ |
| 6399 |
x86_emit_floatuns (operands); |
| 6400 |
DONE; |
| 6401 |
} |
| 6402 |
}) |
| 6403 |
|
| 6404 |
(define_expand "floatunsdidf2" |
| 6405 |
[(set (match_operand:DF 0 "register_operand") |
| 6406 |
(unsigned_float:DF |
| 6407 |
(match_operand:DI 1 "nonimmediate_operand")))] |
| 6408 |
"((TARGET_64BIT && TARGET_AVX512F) |
| 6409 |
|| TARGET_KEEPS_VECTOR_ALIGNED_STACK) |
| 6410 |
&& TARGET_SSE2 && TARGET_SSE_MATH" |
| 6411 |
{ |
| 6412 |
if (!TARGET_64BIT) |
| 6413 |
{ |
| 6414 |
ix86_expand_convert_uns_didf_sse (operands[0], operands[1]); |
| 6415 |
DONE; |
| 6416 |
} |
| 6417 |
if (!TARGET_AVX512F) |
| 6418 |
{ |
| 6419 |
x86_emit_floatuns (operands); |
| 6420 |
DONE; |
| 6421 |
} |
| 6422 |
}) |
| 6423 |
|
| 6424 |
;; Load effective address instructions |
| 6425 |
|
| 6426 |
(define_insn "*lea<mode>" |
| 6427 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 6428 |
(match_operand:SWI48 1 "address_no_seg_operand" "Ts"))] |
| 6429 |
"ix86_hardreg_mov_ok (operands[0], operands[1])" |
| 6430 |
{ |
| 6431 |
if (SImode_address_operand (operands[1], VOIDmode)) |
| 6432 |
{ |
| 6433 |
gcc_assert (TARGET_64BIT); |
| 6434 |
return "lea{l}\t{%E1, %k0|%k0, %E1}"; |
| 6435 |
} |
| 6436 |
else |
| 6437 |
return "lea{<imodesuffix>}\t{%E1, %0|%0, %E1}"; |
| 6438 |
} |
| 6439 |
[(set_attr "type" "lea") |
| 6440 |
(set (attr "mode") |
| 6441 |
(if_then_else |
| 6442 |
(match_operand 1 "SImode_address_operand") |
| 6443 |
(const_string "SI") |
| 6444 |
(const_string "<MODE>")))]) |
| 6445 |
|
| 6446 |
(define_peephole2 |
| 6447 |
[(set (match_operand:SWI48 0 "register_operand") |
| 6448 |
(match_operand:SWI48 1 "address_no_seg_operand"))] |
| 6449 |
"ix86_hardreg_mov_ok (operands[0], operands[1]) |
| 6450 |
&& peep2_regno_dead_p (0, FLAGS_REG) |
| 6451 |
&& ix86_avoid_lea_for_addr (peep2_next_insn (0), operands)" |
| 6452 |
[(const_int 0)] |
| 6453 |
{ |
| 6454 |
machine_mode mode = <MODE>mode; |
| 6455 |
|
| 6456 |
/* Emit all operations in SImode for zero-extended addresses. */ |
| 6457 |
if (SImode_address_operand (operands[1], VOIDmode)) |
| 6458 |
mode = SImode; |
| 6459 |
|
| 6460 |
ix86_split_lea_for_addr (peep2_next_insn (0), operands, mode); |
| 6461 |
|
| 6462 |
/* Zero-extend return register to DImode for zero-extended addresses. */ |
| 6463 |
if (mode != <MODE>mode) |
| 6464 |
emit_insn (gen_zero_extendsidi2 (operands[0], |
| 6465 |
gen_lowpart (mode, operands[0]))); |
| 6466 |
|
| 6467 |
DONE; |
| 6468 |
}) |
| 6469 |
|
| 6470 |
;; ix86_split_lea_for_addr emits the shifts as MULT to avoid it from being |
| 6471 |
;; peephole2 optimized back into a lea. Split that into the shift during |
| 6472 |
;; the following split pass. |
| 6473 |
(define_split |
| 6474 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 6475 |
(mult:SWI48 (match_dup 0) (match_operand:SWI48 1 "const1248_operand"))) |
| 6476 |
(clobber (reg:CC FLAGS_REG))] |
| 6477 |
"reload_completed" |
| 6478 |
[(parallel [(set (match_dup 0) (ashift:SWI48 (match_dup 0) (match_dup 1))) |
| 6479 |
(clobber (reg:CC FLAGS_REG))])] |
| 6480 |
"operands[1] = GEN_INT (exact_log2 (INTVAL (operands[1])));") |
| 6481 |
|
| 6482 |
(define_split |
| 6483 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 6484 |
(mult:SWI48 (match_dup 0) (match_operand:SWI48 1 "const1248_operand")))] |
| 6485 |
"TARGET_APX_NF && reload_completed" |
| 6486 |
[(set (match_dup 0) (ashift:SWI48 (match_dup 0) (match_dup 1)))] |
| 6487 |
"operands[1] = GEN_INT (exact_log2 (INTVAL (operands[1])));") |
| 6488 |
|
| 6489 |
;; The peephole2 pass may expose consecutive additions suitable for lea. |
| 6490 |
(define_peephole2 |
| 6491 |
[(parallel [(set (match_operand:SWI48 0 "register_operand") |
| 6492 |
(plus:SWI48 (match_dup 0) |
| 6493 |
(match_operand 1 "register_operand"))) |
| 6494 |
(clobber (reg:CC FLAGS_REG))]) |
| 6495 |
(parallel [(set (match_dup 0) |
| 6496 |
(plus:SWI48 (match_dup 0) |
| 6497 |
(match_operand 2 "x86_64_immediate_operand"))) |
| 6498 |
(clobber (reg:CC FLAGS_REG))])] |
| 6499 |
"!TARGET_AVOID_LEA_FOR_ADDR || optimize_function_for_size_p (cfun)" |
| 6500 |
[(set (match_dup 0) (plus:SWI48 (plus:SWI48 (match_dup 0) |
| 6501 |
(match_dup 1)) |
| 6502 |
(match_dup 2)))]) |
| 6503 |
|
| 6504 |
;; Add instructions |
| 6505 |
|
| 6506 |
(define_expand "add<mode>3" |
| 6507 |
[(set (match_operand:SDWIM 0 "nonimmediate_operand") |
| 6508 |
(plus:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand") |
| 6509 |
(match_operand:SDWIM 2 "<general_hilo_operand>")))] |
| 6510 |
"" |
| 6511 |
{ |
| 6512 |
ix86_expand_binary_operator (PLUS, <MODE>mode, operands, TARGET_APX_NDD); |
| 6513 |
DONE; |
| 6514 |
}) |
| 6515 |
|
| 6516 |
(define_insn_and_split "*add<dwi>3_doubleword" |
| 6517 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r,&r,&r") |
| 6518 |
(plus:<DWI> |
| 6519 |
(match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r,ro,jO,r") |
| 6520 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,K,<di>,r"))) |
| 6521 |
(clobber (reg:CC FLAGS_REG))] |
| 6522 |
"ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)" |
| 6523 |
"#" |
| 6524 |
"&& reload_completed" |
| 6525 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 6526 |
(compare:CCC |
| 6527 |
(plus:DWIH (match_dup 1) (match_dup 2)) |
| 6528 |
(match_dup 1))) |
| 6529 |
(set (match_dup 0) |
| 6530 |
(plus:DWIH (match_dup 1) (match_dup 2)))]) |
| 6531 |
(parallel [(set (match_dup 3) |
| 6532 |
(plus:DWIH |
| 6533 |
(plus:DWIH |
| 6534 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 6535 |
(match_dup 4)) |
| 6536 |
(match_dup 5))) |
| 6537 |
(clobber (reg:CC FLAGS_REG))])] |
| 6538 |
{ |
| 6539 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 6540 |
if (operands[2] == const0_rtx) |
| 6541 |
{ |
| 6542 |
/* Under NDD op0 and op1 may not equal, do not delete insn then. */ |
| 6543 |
bool emit_insn_deleted_note_p = true; |
| 6544 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 6545 |
{ |
| 6546 |
emit_move_insn (operands[0], operands[1]); |
| 6547 |
emit_insn_deleted_note_p = false; |
| 6548 |
} |
| 6549 |
if (operands[5] != const0_rtx) |
| 6550 |
ix86_expand_binary_operator (PLUS, <MODE>mode, &operands[3], |
| 6551 |
TARGET_APX_NDD); |
| 6552 |
else if (!rtx_equal_p (operands[3], operands[4])) |
| 6553 |
emit_move_insn (operands[3], operands[4]); |
| 6554 |
else if (emit_insn_deleted_note_p) |
| 6555 |
emit_note (NOTE_INSN_DELETED); |
| 6556 |
DONE; |
| 6557 |
} |
| 6558 |
} |
| 6559 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd,apx_ndd_64,apx_ndd")]) |
| 6560 |
|
| 6561 |
(define_insn_and_split "*add<dwi>3_doubleword_zext" |
| 6562 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=r,o,&r,&r") |
| 6563 |
(plus:<DWI> |
| 6564 |
(zero_extend:<DWI> |
| 6565 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm,r,rm,r")) |
| 6566 |
(match_operand:<DWI> 1 "nonimmediate_operand" "0,0,r,o"))) |
| 6567 |
(clobber (reg:CC FLAGS_REG))] |
| 6568 |
"ix86_binary_operator_ok (UNKNOWN, <DWI>mode, operands, TARGET_APX_NDD)" |
| 6569 |
"#" |
| 6570 |
"&& reload_completed" |
| 6571 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 6572 |
(compare:CCC |
| 6573 |
(plus:DWIH (match_dup 1) (match_dup 2)) |
| 6574 |
(match_dup 1))) |
| 6575 |
(set (match_dup 0) |
| 6576 |
(plus:DWIH (match_dup 1) (match_dup 2)))]) |
| 6577 |
(parallel [(set (match_dup 3) |
| 6578 |
(plus:DWIH |
| 6579 |
(plus:DWIH |
| 6580 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 6581 |
(match_dup 4)) |
| 6582 |
(const_int 0))) |
| 6583 |
(clobber (reg:CC FLAGS_REG))])] |
| 6584 |
"split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[3]);" |
| 6585 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) |
| 6586 |
|
| 6587 |
(define_insn_and_split "*add<dwi>3_doubleword_concat" |
| 6588 |
[(set (match_operand:<DWI> 0 "register_operand" "=&r") |
| 6589 |
(plus:<DWI> |
| 6590 |
(any_or_plus:<DWI> |
| 6591 |
(ashift:<DWI> |
| 6592 |
(zero_extend:<DWI> |
| 6593 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm")) |
| 6594 |
(match_operand:QI 3 "const_int_operand")) |
| 6595 |
(zero_extend:<DWI> |
| 6596 |
(match_operand:DWIH 4 "nonimmediate_operand" "rm"))) |
| 6597 |
(match_operand:<DWI> 1 "register_operand" "0"))) |
| 6598 |
(clobber (reg:CC FLAGS_REG))] |
| 6599 |
"INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 6600 |
"#" |
| 6601 |
"&& reload_completed" |
| 6602 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 6603 |
(compare:CCC |
| 6604 |
(plus:DWIH (match_dup 1) (match_dup 4)) |
| 6605 |
(match_dup 1))) |
| 6606 |
(set (match_dup 0) |
| 6607 |
(plus:DWIH (match_dup 1) (match_dup 4)))]) |
| 6608 |
(parallel [(set (match_dup 5) |
| 6609 |
(plus:DWIH |
| 6610 |
(plus:DWIH |
| 6611 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 6612 |
(match_dup 6)) |
| 6613 |
(match_dup 2))) |
| 6614 |
(clobber (reg:CC FLAGS_REG))])] |
| 6615 |
"split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[5]);") |
| 6616 |
|
| 6617 |
(define_insn_and_split "*add<dwi>3_doubleword_concat_zext" |
| 6618 |
[(set (match_operand:<DWI> 0 "register_operand" "=&r") |
| 6619 |
(plus:<DWI> |
| 6620 |
(any_or_plus:<DWI> |
| 6621 |
(ashift:<DWI> |
| 6622 |
(zero_extend:<DWI> |
| 6623 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm")) |
| 6624 |
(match_operand:QI 3 "const_int_operand")) |
| 6625 |
(zero_extend:<DWI> |
| 6626 |
(match_operand:DWIH 4 "nonimmediate_operand" "rm"))) |
| 6627 |
(zero_extend:<DWI> |
| 6628 |
(match_operand:DWIH 1 "nonimmediate_operand" "rm")))) |
| 6629 |
(clobber (reg:CC FLAGS_REG))] |
| 6630 |
"INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 6631 |
"#" |
| 6632 |
"&& reload_completed" |
| 6633 |
[(set (match_dup 0) (match_dup 4)) |
| 6634 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 6635 |
(compare:CCC |
| 6636 |
(plus:DWIH (match_dup 0) (match_dup 1)) |
| 6637 |
(match_dup 0))) |
| 6638 |
(set (match_dup 0) |
| 6639 |
(plus:DWIH (match_dup 0) (match_dup 1)))]) |
| 6640 |
(set (match_dup 5) (match_dup 2)) |
| 6641 |
(parallel [(set (match_dup 5) |
| 6642 |
(plus:DWIH |
| 6643 |
(plus:DWIH |
| 6644 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 6645 |
(match_dup 5)) |
| 6646 |
(const_int 0))) |
| 6647 |
(clobber (reg:CC FLAGS_REG))])] |
| 6648 |
"split_double_mode (<DWI>mode, &operands[0], 1, &operands[0], &operands[5]);") |
| 6649 |
|
| 6650 |
(define_subst_attr "nf_name" "nf_subst" "_nf" "") |
| 6651 |
(define_subst_attr "nf_prefix" "nf_subst" "%{nf%} " "") |
| 6652 |
(define_subst_attr "nf_condition" "nf_subst" "TARGET_APX_NF" "true") |
| 6653 |
(define_subst_attr "nf_add_mem_constraint" "nf_subst" "je" "m") |
| 6654 |
(define_subst_attr "nf_mem_constraint" "nf_subst" "jM" "m") |
| 6655 |
(define_subst_attr "nf_applied" "nf_subst" "true" "false") |
| 6656 |
(define_subst_attr "nf_nonf_attr" "nf_subst" "noapx_nf" "*") |
| 6657 |
(define_subst_attr "nf_nonf_x64_attr" "nf_subst" "noapx_nf" "x64") |
| 6658 |
|
| 6659 |
(define_subst "nf_subst" |
| 6660 |
[(set (match_operand:SWIDWI 0) |
| 6661 |
(match_operand:SWIDWI 1))] |
| 6662 |
"" |
| 6663 |
[(set (match_dup 0) |
| 6664 |
(match_dup 1)) |
| 6665 |
(clobber (reg:CC FLAGS_REG))]) |
| 6666 |
|
| 6667 |
(define_insn "*add<mode>_1<nf_name>" |
| 6668 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=r<nf_add_mem_constraint>,r<nf_mem_constraint>,r,r,r,r,r,r") |
| 6669 |
(plus:SWI48 |
| 6670 |
(match_operand:SWI48 1 "nonimmediate_operand" "%0,0,0,r,r,rje,jM,r") |
| 6671 |
(match_operand:SWI48 2 "x86_64_general_operand" "r,e,BM,0,le,r,e,BM")))] |
| 6672 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 6673 |
&& <nf_condition>" |
| 6674 |
{ |
| 6675 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 6676 |
switch (get_attr_type (insn)) |
| 6677 |
{ |
| 6678 |
case TYPE_LEA: |
| 6679 |
if (TARGET_APX_NDD && <nf_applied>) |
| 6680 |
return "%{nf%} add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}"; |
| 6681 |
else |
| 6682 |
return "#"; |
| 6683 |
|
| 6684 |
case TYPE_INCDEC: |
| 6685 |
if (operands[2] == const1_rtx) |
| 6686 |
return use_ndd ? "<nf_prefix>inc{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 6687 |
: "<nf_prefix>inc{<imodesuffix>}\t%0"; |
| 6688 |
else |
| 6689 |
{ |
| 6690 |
gcc_assert (operands[2] == constm1_rtx); |
| 6691 |
return use_ndd ? "<nf_prefix>dec{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 6692 |
: "<nf_prefix>dec{<imodesuffix>}\t%0"; |
| 6693 |
} |
| 6694 |
|
| 6695 |
default: |
| 6696 |
/* For most processors, ADD is faster than LEA. This alternative |
| 6697 |
was added to use ADD as much as possible. */ |
| 6698 |
if (which_alternative == 3) |
| 6699 |
std::swap (operands[1], operands[2]); |
| 6700 |
|
| 6701 |
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode)) |
| 6702 |
return use_ndd ? "<nf_prefix>sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 6703 |
: "<nf_prefix>sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 6704 |
|
| 6705 |
return use_ndd ? "<nf_prefix>add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 6706 |
: "<nf_prefix>add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 6707 |
} |
| 6708 |
} |
| 6709 |
[(set_attr "isa" "*,*,*,*,*,apx_ndd,apx_ndd,apx_ndd") |
| 6710 |
(set (attr "type") |
| 6711 |
(cond [(eq_attr "alternative" "4") |
| 6712 |
(const_string "lea") |
| 6713 |
(match_operand:SWI48 2 "incdec_operand") |
| 6714 |
(const_string "incdec") |
| 6715 |
] |
| 6716 |
(const_string "alu"))) |
| 6717 |
(set (attr "length_immediate") |
| 6718 |
(if_then_else |
| 6719 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 6720 |
(const_string "1") |
| 6721 |
(const_string "*"))) |
| 6722 |
(set_attr "has_nf" "1") |
| 6723 |
(set_attr "mode" "<MODE>")]) |
| 6724 |
|
| 6725 |
;; For APX instruction with an NDD, the destination GPR will get the |
| 6726 |
;; instruction’s result in bits [OSIZE-1:0] and, if OSIZE < 64b, have |
| 6727 |
;; its upper bits [63:OSIZE] zeroed. |
| 6728 |
|
| 6729 |
(define_insn "*addqi_1_zext<mode><nf_name>" |
| 6730 |
[(set (match_operand:SWI248x 0 "register_operand" "=r,r") |
| 6731 |
(zero_extend:SWI248x |
| 6732 |
(plus:QI (match_operand:QI 1 "nonimmediate_operand" "%rm,r") |
| 6733 |
(match_operand:QI 2 "general_operand" "rn,m"))))] |
| 6734 |
"TARGET_APX_NDD && <nf_condition> |
| 6735 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 6736 |
{ |
| 6737 |
switch (get_attr_type (insn)) |
| 6738 |
{ |
| 6739 |
case TYPE_INCDEC: |
| 6740 |
if (operands[2] == const1_rtx) |
| 6741 |
return "<nf_prefix>inc{b}\t{%1, %b0|%b0, %1}"; |
| 6742 |
else |
| 6743 |
{ |
| 6744 |
gcc_assert (operands[2] == constm1_rtx); |
| 6745 |
return "<nf_prefix>dec{b}\t{%1, %b0|%b0, %1}"; |
| 6746 |
} |
| 6747 |
|
| 6748 |
default: |
| 6749 |
if (x86_maybe_negate_const_int (&operands[2], QImode)) |
| 6750 |
return "<nf_prefix>sub{b}\t{%2, %1, %b0|%b0, %1, %2}"; |
| 6751 |
return "<nf_prefix>add{b}\t{%2, %1, %b0|%b0, %1, %2}"; |
| 6752 |
} |
| 6753 |
} |
| 6754 |
[(set (attr "type") |
| 6755 |
(cond [(match_operand:QI 2 "incdec_operand") |
| 6756 |
(const_string "incdec") |
| 6757 |
] |
| 6758 |
(const_string "alu"))) |
| 6759 |
(set (attr "length_immediate") |
| 6760 |
(if_then_else |
| 6761 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 6762 |
(const_string "1") |
| 6763 |
(const_string "*"))) |
| 6764 |
(set_attr "has_nf" "1") |
| 6765 |
(set_attr "mode" "QI")]) |
| 6766 |
|
| 6767 |
(define_insn "*addhi_1_zext<mode><nf_name>" |
| 6768 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 6769 |
(zero_extend:SWI48x |
| 6770 |
(plus:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,r") |
| 6771 |
(match_operand:HI 2 "general_operand" "rn,m"))))] |
| 6772 |
"TARGET_APX_NDD && <nf_condition> |
| 6773 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 6774 |
{ |
| 6775 |
switch (get_attr_type (insn)) |
| 6776 |
{ |
| 6777 |
case TYPE_INCDEC: |
| 6778 |
if (operands[2] == const1_rtx) |
| 6779 |
return "<nf_prefix>inc{w}\t{%1, %w0|%w0, %1}"; |
| 6780 |
else |
| 6781 |
{ |
| 6782 |
gcc_assert (operands[2] == constm1_rtx); |
| 6783 |
return "<nf_prefix>dec{w}\t{%1, %w0|%w0, %1}"; |
| 6784 |
} |
| 6785 |
|
| 6786 |
default: |
| 6787 |
if (x86_maybe_negate_const_int (&operands[2], HImode)) |
| 6788 |
return "<nf_prefix>sub{w}\t{%2, %1, %w0|%w0, %1, %2}"; |
| 6789 |
return "<nf_prefix>add{w}\t{%2, %1, %w0|%w0, %1, %2}"; |
| 6790 |
} |
| 6791 |
} |
| 6792 |
[(set (attr "type") |
| 6793 |
(cond [(match_operand:QI 2 "incdec_operand") |
| 6794 |
(const_string "incdec") |
| 6795 |
] |
| 6796 |
(const_string "alu"))) |
| 6797 |
(set (attr "length_immediate") |
| 6798 |
(if_then_else |
| 6799 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 6800 |
(const_string "1") |
| 6801 |
(const_string "*"))) |
| 6802 |
(set_attr "has_nf" "1") |
| 6803 |
(set_attr "mode" "HI")]) |
| 6804 |
|
| 6805 |
;; It may seem that nonimmediate operand is proper one for operand 1. |
| 6806 |
;; The addsi_1 pattern allows nonimmediate operand at that place and |
| 6807 |
;; we take care in ix86_binary_operator_ok to not allow two memory |
| 6808 |
;; operands so proper swapping will be done in reload. This allow |
| 6809 |
;; patterns constructed from addsi_1 to match. |
| 6810 |
|
| 6811 |
(define_insn "addsi_1_zext" |
| 6812 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r,r") |
| 6813 |
(zero_extend:DI |
| 6814 |
(plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r,r,r,rm,rjM") |
| 6815 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,0,le,rBMe,r,e")))) |
| 6816 |
(clobber (reg:CC FLAGS_REG))] |
| 6817 |
"TARGET_64BIT |
| 6818 |
&& ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" |
| 6819 |
{ |
| 6820 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 6821 |
switch (get_attr_type (insn)) |
| 6822 |
{ |
| 6823 |
case TYPE_LEA: |
| 6824 |
return "#"; |
| 6825 |
|
| 6826 |
case TYPE_INCDEC: |
| 6827 |
if (operands[2] == const1_rtx) |
| 6828 |
return use_ndd ? "inc{l}\t{%1, %k0|%k0, %1}" |
| 6829 |
: "inc{l}\t%k0"; |
| 6830 |
else |
| 6831 |
{ |
| 6832 |
gcc_assert (operands[2] == constm1_rtx); |
| 6833 |
return use_ndd ? "dec{l}\t{%1, %k0|%k0, %1}" |
| 6834 |
: "dec{l}\t%k0"; |
| 6835 |
} |
| 6836 |
|
| 6837 |
default: |
| 6838 |
/* For most processors, ADD is faster than LEA. This alternative |
| 6839 |
was added to use ADD as much as possible. */ |
| 6840 |
if (which_alternative == 1) |
| 6841 |
std::swap (operands[1], operands[2]); |
| 6842 |
|
| 6843 |
if (x86_maybe_negate_const_int (&operands[2], SImode)) |
| 6844 |
return use_ndd ? "sub{l}\t{%2 ,%1, %k0|%k0, %1, %2}" |
| 6845 |
: "sub{l}\t{%2, %k0|%k0, %2}"; |
| 6846 |
|
| 6847 |
return use_ndd ? "add{l}\t{%2 ,%1, %k0|%k0, %1, %2}" |
| 6848 |
: "add{l}\t{%2, %k0|%k0, %2}"; |
| 6849 |
} |
| 6850 |
} |
| 6851 |
[(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,apx_ndd") |
| 6852 |
(set (attr "type") |
| 6853 |
(cond [(eq_attr "alternative" "2") |
| 6854 |
(const_string "lea") |
| 6855 |
(match_operand:SI 2 "incdec_operand") |
| 6856 |
(const_string "incdec") |
| 6857 |
] |
| 6858 |
(const_string "alu"))) |
| 6859 |
(set (attr "length_immediate") |
| 6860 |
(if_then_else |
| 6861 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 6862 |
(const_string "1") |
| 6863 |
(const_string "*"))) |
| 6864 |
(set_attr "mode" "SI")]) |
| 6865 |
|
| 6866 |
(define_insn "*addhi_1<nf_name>" |
| 6867 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r,Yp,r,r") |
| 6868 |
(plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r,Yp,rm,r") |
| 6869 |
(match_operand:HI 2 "general_operand" "rn,m,0,ln,rn,m")))] |
| 6870 |
"ix86_binary_operator_ok (PLUS, HImode, operands, TARGET_APX_NDD) |
| 6871 |
&& <nf_condition>" |
| 6872 |
{ |
| 6873 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 6874 |
switch (get_attr_type (insn)) |
| 6875 |
{ |
| 6876 |
case TYPE_LEA: |
| 6877 |
if (TARGET_APX_NDD && <nf_applied>) |
| 6878 |
return "%{nf%} add{w}\t{%2, %1, %0|%0, %1, %2}"; |
| 6879 |
else |
| 6880 |
return "#"; |
| 6881 |
|
| 6882 |
case TYPE_INCDEC: |
| 6883 |
if (operands[2] == const1_rtx) |
| 6884 |
return use_ndd ? "<nf_prefix>inc{w}\t{%1, %0|%0, %1}" |
| 6885 |
: "<nf_prefix>inc{w}\t%0"; |
| 6886 |
else |
| 6887 |
{ |
| 6888 |
gcc_assert (operands[2] == constm1_rtx); |
| 6889 |
return use_ndd ? "<nf_prefix>dec{w}\t{%1, %0|%0, %1}" |
| 6890 |
: "<nf_prefix>dec{w}\t%0"; |
| 6891 |
} |
| 6892 |
|
| 6893 |
default: |
| 6894 |
/* For most processors, ADD is faster than LEA. This alternative |
| 6895 |
was added to use ADD as much as possible. */ |
| 6896 |
if (which_alternative == 2) |
| 6897 |
std::swap (operands[1], operands[2]); |
| 6898 |
|
| 6899 |
if (x86_maybe_negate_const_int (&operands[2], HImode)) |
| 6900 |
return use_ndd ? "<nf_prefix>sub{w}\t{%2, %1, %0|%0, %1, %2}" |
| 6901 |
: "<nf_prefix>sub{w}\t{%2, %0|%0, %2}"; |
| 6902 |
|
| 6903 |
return use_ndd ? "<nf_prefix>add{w}\t{%2, %1, %0|%0, %1, %2}" |
| 6904 |
: "<nf_prefix>add{w}\t{%2, %0|%0, %2}"; |
| 6905 |
} |
| 6906 |
} |
| 6907 |
[(set_attr "isa" "*,*,*,*,apx_ndd,apx_ndd") |
| 6908 |
(set (attr "type") |
| 6909 |
(cond [(eq_attr "alternative" "3") |
| 6910 |
(const_string "lea") |
| 6911 |
(match_operand:HI 2 "incdec_operand") |
| 6912 |
(const_string "incdec") |
| 6913 |
] |
| 6914 |
(const_string "alu"))) |
| 6915 |
(set (attr "length_immediate") |
| 6916 |
(if_then_else |
| 6917 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 6918 |
(const_string "1") |
| 6919 |
(const_string "*"))) |
| 6920 |
(set_attr "has_nf" "1") |
| 6921 |
(set_attr "mode" "HI,HI,HI,SI,HI,HI")]) |
| 6922 |
|
| 6923 |
(define_insn "*addqi_1<nf_name>" |
| 6924 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,q,r,r,Yp,r,r") |
| 6925 |
(plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,q,0,r,Yp,rm,r") |
| 6926 |
(match_operand:QI 2 "general_operand" "qn,m,0,rn,0,ln,rn,m")))] |
| 6927 |
"ix86_binary_operator_ok (PLUS, QImode, operands, TARGET_APX_NDD) |
| 6928 |
&& <nf_condition>" |
| 6929 |
{ |
| 6930 |
bool widen = (get_attr_mode (insn) != MODE_QI); |
| 6931 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 6932 |
switch (get_attr_type (insn)) |
| 6933 |
{ |
| 6934 |
case TYPE_LEA: |
| 6935 |
if (TARGET_APX_NDD && <nf_applied>) |
| 6936 |
return "%{nf%} add{b}\t{%2, %1, %0|%0, %1, %2}"; |
| 6937 |
else |
| 6938 |
return "#"; |
| 6939 |
|
| 6940 |
case TYPE_INCDEC: |
| 6941 |
if (operands[2] == const1_rtx) |
| 6942 |
if (use_ndd) |
| 6943 |
return "<nf_prefix>inc{b}\t{%1, %0|%0, %1}"; |
| 6944 |
else |
| 6945 |
return widen ? "<nf_prefix>inc{l}\t%k0" : "<nf_prefix>inc{b}\t%0"; |
| 6946 |
else |
| 6947 |
{ |
| 6948 |
gcc_assert (operands[2] == constm1_rtx); |
| 6949 |
if (use_ndd) |
| 6950 |
return "<nf_prefix>dec{b}\t{%1, %0|%0, %1}"; |
| 6951 |
else |
| 6952 |
return widen ? "<nf_prefix>dec{l}\t%k0" : "<nf_prefix>dec{b}\t%0"; |
| 6953 |
} |
| 6954 |
|
| 6955 |
default: |
| 6956 |
/* For most processors, ADD is faster than LEA. These alternatives |
| 6957 |
were added to use ADD as much as possible. */ |
| 6958 |
if (which_alternative == 2 || which_alternative == 4) |
| 6959 |
std::swap (operands[1], operands[2]); |
| 6960 |
|
| 6961 |
if (x86_maybe_negate_const_int (&operands[2], QImode)) |
| 6962 |
{ |
| 6963 |
if (use_ndd) |
| 6964 |
return "<nf_prefix>sub{b}\t{%2, %1, %0|%0, %1, %2}"; |
| 6965 |
else |
| 6966 |
return widen ? "<nf_prefix>sub{l}\t{%2, %k0|%k0, %2}" |
| 6967 |
: "<nf_prefix>sub{b}\t{%2, %0|%0, %2}"; |
| 6968 |
} |
| 6969 |
if (use_ndd) |
| 6970 |
return "<nf_prefix>add{b}\t{%2, %1, %0|%0, %1, %2}"; |
| 6971 |
else |
| 6972 |
return widen ? "<nf_prefix>add{l}\t{%k2, %k0|%k0, %k2}" |
| 6973 |
: "<nf_prefix>add{b}\t{%2, %0|%0, %2}"; |
| 6974 |
} |
| 6975 |
} |
| 6976 |
[(set_attr "isa" "*,*,*,*,*,*,apx_ndd,apx_ndd") |
| 6977 |
(set (attr "type") |
| 6978 |
(cond [(eq_attr "alternative" "5") |
| 6979 |
(const_string "lea") |
| 6980 |
(match_operand:QI 2 "incdec_operand") |
| 6981 |
(const_string "incdec") |
| 6982 |
] |
| 6983 |
(const_string "alu"))) |
| 6984 |
(set (attr "length_immediate") |
| 6985 |
(if_then_else |
| 6986 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 6987 |
(const_string "1") |
| 6988 |
(const_string "*"))) |
| 6989 |
(set_attr "has_nf" "1") |
| 6990 |
(set_attr "mode" "QI,QI,QI,SI,SI,SI,QI,QI") |
| 6991 |
;; Potential partial reg stall on alternatives 3 and 4. |
| 6992 |
(set (attr "preferred_for_speed") |
| 6993 |
(cond [(eq_attr "alternative" "3,4") |
| 6994 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 6995 |
(symbol_ref "true")))]) |
| 6996 |
|
| 6997 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 6998 |
(define_insn_and_split "*add<mode>_1_slp" |
| 6999 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 7000 |
(plus:SWI12 (match_operand:SWI12 1 "nonimmediate_operand" "%0,!<r>") |
| 7001 |
(match_operand:SWI12 2 "general_operand" "<r>mn,<r>mn"))) |
| 7002 |
(clobber (reg:CC FLAGS_REG))] |
| 7003 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 7004 |
{ |
| 7005 |
if (which_alternative) |
| 7006 |
return "#"; |
| 7007 |
|
| 7008 |
switch (get_attr_type (insn)) |
| 7009 |
{ |
| 7010 |
case TYPE_INCDEC: |
| 7011 |
if (operands[2] == const1_rtx) |
| 7012 |
return "inc{<imodesuffix>}\t%0"; |
| 7013 |
else |
| 7014 |
{ |
| 7015 |
gcc_assert (operands[2] == constm1_rtx); |
| 7016 |
return "dec{<imodesuffix>}\t%0"; |
| 7017 |
} |
| 7018 |
|
| 7019 |
default: |
| 7020 |
if (x86_maybe_negate_const_int (&operands[2], QImode)) |
| 7021 |
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7022 |
|
| 7023 |
return "add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7024 |
} |
| 7025 |
} |
| 7026 |
"&& reload_completed |
| 7027 |
&& !(rtx_equal_p (operands[0], operands[1]) |
| 7028 |
|| rtx_equal_p (operands[0], operands[2]))" |
| 7029 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 7030 |
(parallel |
| 7031 |
[(set (strict_low_part (match_dup 0)) |
| 7032 |
(plus:SWI12 (match_dup 0) (match_dup 2))) |
| 7033 |
(clobber (reg:CC FLAGS_REG))])] |
| 7034 |
"" |
| 7035 |
[(set (attr "type") |
| 7036 |
(if_then_else (match_operand:QI 2 "incdec_operand") |
| 7037 |
(const_string "incdec") |
| 7038 |
(const_string "alu"))) |
| 7039 |
(set_attr "mode" "<MODE>")]) |
| 7040 |
|
| 7041 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 7042 |
(define_insn_and_split "*addqi_ext<mode>_1_slp" |
| 7043 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+Q,&Q")) |
| 7044 |
(plus:QI |
| 7045 |
(subreg:QI |
| 7046 |
(match_operator:SWI248 3 "extract_operator" |
| 7047 |
[(match_operand 2 "int248_register_operand" "Q,Q") |
| 7048 |
(const_int 8) |
| 7049 |
(const_int 8)]) 0) |
| 7050 |
(match_operand:QI 1 "nonimmediate_operand" "0,!qm"))) |
| 7051 |
(clobber (reg:CC FLAGS_REG))] |
| 7052 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 7053 |
"@ |
| 7054 |
add{b}\t{%h2, %0|%0, %h2} |
| 7055 |
#" |
| 7056 |
"&& reload_completed |
| 7057 |
&& !rtx_equal_p (operands[0], operands[1])" |
| 7058 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 7059 |
(parallel |
| 7060 |
[(set (strict_low_part (match_dup 0)) |
| 7061 |
(plus:QI |
| 7062 |
(subreg:QI |
| 7063 |
(match_op_dup 3 |
| 7064 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0) |
| 7065 |
(match_dup 0))) |
| 7066 |
(clobber (reg:CC FLAGS_REG))])] |
| 7067 |
"" |
| 7068 |
[(set_attr "type" "alu") |
| 7069 |
(set_attr "mode" "QI")]) |
| 7070 |
|
| 7071 |
(define_insn_and_split "*addqi_ext<mode>_2_slp" |
| 7072 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+&Q")) |
| 7073 |
(plus:QI |
| 7074 |
(subreg:QI |
| 7075 |
(match_operator:SWI248 3 "extract_operator" |
| 7076 |
[(match_operand 1 "int248_register_operand" "Q") |
| 7077 |
(const_int 8) |
| 7078 |
(const_int 8)]) 0) |
| 7079 |
(subreg:QI |
| 7080 |
(match_operator:SWI248 4 "extract_operator" |
| 7081 |
[(match_operand 2 "int248_register_operand" "Q") |
| 7082 |
(const_int 8) |
| 7083 |
(const_int 8)]) 0))) |
| 7084 |
(clobber (reg:CC FLAGS_REG))] |
| 7085 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 7086 |
"#" |
| 7087 |
"&& reload_completed" |
| 7088 |
[(set (strict_low_part (match_dup 0)) |
| 7089 |
(subreg:QI |
| 7090 |
(match_op_dup 4 |
| 7091 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0)) |
| 7092 |
(parallel |
| 7093 |
[(set (strict_low_part (match_dup 0)) |
| 7094 |
(plus:QI |
| 7095 |
(subreg:QI |
| 7096 |
(match_op_dup 3 |
| 7097 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0) |
| 7098 |
(match_dup 0))) |
| 7099 |
(clobber (reg:CC FLAGS_REG))])] |
| 7100 |
"" |
| 7101 |
[(set_attr "type" "alu") |
| 7102 |
(set_attr "mode" "QI")]) |
| 7103 |
|
| 7104 |
;; Split non destructive adds if we cannot use lea. |
| 7105 |
(define_split |
| 7106 |
[(set (match_operand:SWI48 0 "register_operand") |
| 7107 |
(plus:SWI48 (match_operand:SWI48 1 "register_operand") |
| 7108 |
(match_operand:SWI48 2 "x86_64_nonmemory_operand"))) |
| 7109 |
(clobber (reg:CC FLAGS_REG))] |
| 7110 |
"reload_completed && ix86_avoid_lea_for_add (insn, operands)" |
| 7111 |
[(set (match_dup 0) (match_dup 1)) |
| 7112 |
(parallel [(set (match_dup 0) (plus:SWI48 (match_dup 0) (match_dup 2))) |
| 7113 |
(clobber (reg:CC FLAGS_REG))])]) |
| 7114 |
|
| 7115 |
;; Split non destructive adds if we cannot use lea. |
| 7116 |
(define_split |
| 7117 |
[(set (match_operand:DI 0 "register_operand") |
| 7118 |
(zero_extend:DI |
| 7119 |
(plus:SI (match_operand:SI 1 "register_operand") |
| 7120 |
(match_operand:SI 2 "x86_64_nonmemory_operand")))) |
| 7121 |
(clobber (reg:CC FLAGS_REG))] |
| 7122 |
"TARGET_64BIT |
| 7123 |
&& reload_completed && ix86_avoid_lea_for_add (insn, operands)" |
| 7124 |
[(set (match_dup 3) (match_dup 1)) |
| 7125 |
(parallel [(set (match_dup 0) |
| 7126 |
(zero_extend:DI (plus:SI (match_dup 3) (match_dup 2)))) |
| 7127 |
(clobber (reg:CC FLAGS_REG))])] |
| 7128 |
"operands[3] = gen_lowpart (SImode, operands[0]);") |
| 7129 |
|
| 7130 |
;; Convert add to the lea pattern to avoid flags dependency. |
| 7131 |
(define_split |
| 7132 |
[(set (match_operand:SWI 0 "register_operand") |
| 7133 |
(plus:SWI (match_operand:SWI 1 "register_operand") |
| 7134 |
(match_operand:SWI 2 "<nonmemory_operand>"))) |
| 7135 |
(clobber (reg:CC FLAGS_REG))] |
| 7136 |
"reload_completed && ix86_lea_for_add_ok (insn, operands)" |
| 7137 |
[(set (match_dup 0) |
| 7138 |
(plus:<LEAMODE> (match_dup 1) (match_dup 2)))] |
| 7139 |
{ |
| 7140 |
if (<MODE>mode != <LEAMODE>mode) |
| 7141 |
{ |
| 7142 |
operands[0] = gen_lowpart (<LEAMODE>mode, operands[0]); |
| 7143 |
operands[1] = gen_lowpart (<LEAMODE>mode, operands[1]); |
| 7144 |
operands[2] = gen_lowpart (<LEAMODE>mode, operands[2]); |
| 7145 |
} |
| 7146 |
}) |
| 7147 |
|
| 7148 |
(define_split |
| 7149 |
[(set (match_operand:SWI 0 "register_operand") |
| 7150 |
(plus:SWI (match_operand:SWI 1 "register_operand") |
| 7151 |
(match_operand:SWI 2 "<nonmemory_operand>")))] |
| 7152 |
"TARGET_APX_NF && reload_completed |
| 7153 |
&& ix86_lea_for_add_ok (insn, operands)" |
| 7154 |
[(set (match_dup 0) |
| 7155 |
(plus:<LEAMODE> (match_dup 1) (match_dup 2)))] |
| 7156 |
{ |
| 7157 |
if (<MODE>mode != <LEAMODE>mode) |
| 7158 |
{ |
| 7159 |
operands[0] = gen_lowpart (<LEAMODE>mode, operands[0]); |
| 7160 |
operands[1] = gen_lowpart (<LEAMODE>mode, operands[1]); |
| 7161 |
operands[2] = gen_lowpart (<LEAMODE>mode, operands[2]); |
| 7162 |
} |
| 7163 |
}) |
| 7164 |
|
| 7165 |
;; Convert add to the lea pattern to avoid flags dependency. |
| 7166 |
(define_split |
| 7167 |
[(set (match_operand:DI 0 "register_operand") |
| 7168 |
(zero_extend:DI |
| 7169 |
(plus:SI (match_operand:SI 1 "register_operand") |
| 7170 |
(match_operand:SI 2 "x86_64_nonmemory_operand")))) |
| 7171 |
(clobber (reg:CC FLAGS_REG))] |
| 7172 |
"TARGET_64BIT && reload_completed && ix86_lea_for_add_ok (insn, operands)" |
| 7173 |
[(set (match_dup 0) |
| 7174 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]) |
| 7175 |
|
| 7176 |
(define_insn "*add<mode>_2" |
| 7177 |
[(set (reg FLAGS_REG) |
| 7178 |
(compare |
| 7179 |
(plus:SWI |
| 7180 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,<r>,rm,r") |
| 7181 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,0,r<i>,<m>")) |
| 7182 |
(const_int 0))) |
| 7183 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,<r>,r,r") |
| 7184 |
(plus:SWI (match_dup 1) (match_dup 2)))] |
| 7185 |
"ix86_match_ccmode (insn, CCGOCmode) |
| 7186 |
&& ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 7187 |
{ |
| 7188 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 7189 |
switch (get_attr_type (insn)) |
| 7190 |
{ |
| 7191 |
case TYPE_INCDEC: |
| 7192 |
if (operands[2] == const1_rtx) |
| 7193 |
return use_ndd ? "inc{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 7194 |
: "inc{<imodesuffix>}\t%0"; |
| 7195 |
else |
| 7196 |
{ |
| 7197 |
gcc_assert (operands[2] == constm1_rtx); |
| 7198 |
return use_ndd ? "dec{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 7199 |
: "dec{<imodesuffix>}\t%0"; |
| 7200 |
} |
| 7201 |
|
| 7202 |
default: |
| 7203 |
if (which_alternative == 2) |
| 7204 |
std::swap (operands[1], operands[2]); |
| 7205 |
|
| 7206 |
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode)) |
| 7207 |
return use_ndd ? "sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7208 |
: "sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7209 |
|
| 7210 |
return use_ndd ? "add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7211 |
: "add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7212 |
} |
| 7213 |
} |
| 7214 |
[(set_attr "isa" "*,*,*,apx_ndd,apx_ndd") |
| 7215 |
(set (attr "type") |
| 7216 |
(if_then_else (match_operand:SWI 2 "incdec_operand") |
| 7217 |
(const_string "incdec") |
| 7218 |
(const_string "alu"))) |
| 7219 |
(set (attr "length_immediate") |
| 7220 |
(if_then_else |
| 7221 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7222 |
(const_string "1") |
| 7223 |
(const_string "*"))) |
| 7224 |
(set_attr "mode" "<MODE>")]) |
| 7225 |
|
| 7226 |
;; See comment for addsi_1_zext why we do use nonimmediate_operand |
| 7227 |
(define_insn "*addsi_2_zext" |
| 7228 |
[(set (reg FLAGS_REG) |
| 7229 |
(compare |
| 7230 |
(plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r,r,rm") |
| 7231 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,0,rBMe,re")) |
| 7232 |
(const_int 0))) |
| 7233 |
(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 7234 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] |
| 7235 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode) |
| 7236 |
&& ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" |
| 7237 |
{ |
| 7238 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 7239 |
switch (get_attr_type (insn)) |
| 7240 |
{ |
| 7241 |
case TYPE_INCDEC: |
| 7242 |
if (operands[2] == const1_rtx) |
| 7243 |
return use_ndd ? "inc{l}\t{%1, %k0|%k0, %1}" |
| 7244 |
: "inc{l}\t%k0"; |
| 7245 |
else |
| 7246 |
{ |
| 7247 |
gcc_assert (operands[2] == constm1_rtx); |
| 7248 |
return use_ndd ? "dec{l}\t{%1, %k0|%k0, %1}" |
| 7249 |
: "dec{l}\t%k0"; |
| 7250 |
} |
| 7251 |
|
| 7252 |
default: |
| 7253 |
if (which_alternative == 1) |
| 7254 |
std::swap (operands[1], operands[2]); |
| 7255 |
|
| 7256 |
if (x86_maybe_negate_const_int (&operands[2], SImode)) |
| 7257 |
return use_ndd ? "sub{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 7258 |
: "sub{l}\t{%2, %k0|%k0, %2}"; |
| 7259 |
|
| 7260 |
return use_ndd ? "add{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 7261 |
: "add{l}\t{%2, %k0|%k0, %2}"; |
| 7262 |
} |
| 7263 |
} |
| 7264 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 7265 |
(set (attr "type") |
| 7266 |
(if_then_else (match_operand:SI 2 "incdec_operand") |
| 7267 |
(const_string "incdec") |
| 7268 |
(const_string "alu"))) |
| 7269 |
(set (attr "length_immediate") |
| 7270 |
(if_then_else |
| 7271 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7272 |
(const_string "1") |
| 7273 |
(const_string "*"))) |
| 7274 |
(set_attr "mode" "SI")]) |
| 7275 |
|
| 7276 |
(define_insn "*add<mode>_3" |
| 7277 |
[(set (reg FLAGS_REG) |
| 7278 |
(compare |
| 7279 |
(neg:SWI (match_operand:SWI 2 "<general_operand>" "<g>,0,<g>,re")) |
| 7280 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,<r>,r,rm"))) |
| 7281 |
(clobber (match_scratch:SWI 0 "=<r>,<r>,r,r"))] |
| 7282 |
"ix86_match_ccmode (insn, CCZmode) |
| 7283 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 7284 |
{ |
| 7285 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 7286 |
switch (get_attr_type (insn)) |
| 7287 |
{ |
| 7288 |
case TYPE_INCDEC: |
| 7289 |
if (operands[2] == const1_rtx) |
| 7290 |
return use_ndd ? "inc{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 7291 |
: "inc{<imodesuffix>}\t%0"; |
| 7292 |
else |
| 7293 |
{ |
| 7294 |
gcc_assert (operands[2] == constm1_rtx); |
| 7295 |
return use_ndd ? "dec{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 7296 |
: "dec{<imodesuffix>}\t%0"; |
| 7297 |
} |
| 7298 |
|
| 7299 |
default: |
| 7300 |
if (which_alternative == 1) |
| 7301 |
std::swap (operands[1], operands[2]); |
| 7302 |
|
| 7303 |
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode)) |
| 7304 |
return use_ndd ? "sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7305 |
: "sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7306 |
|
| 7307 |
return use_ndd ? "add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7308 |
: "add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7309 |
} |
| 7310 |
} |
| 7311 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 7312 |
(set (attr "type") |
| 7313 |
(if_then_else (match_operand:SWI 2 "incdec_operand") |
| 7314 |
(const_string "incdec") |
| 7315 |
(const_string "alu"))) |
| 7316 |
(set (attr "length_immediate") |
| 7317 |
(if_then_else |
| 7318 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7319 |
(const_string "1") |
| 7320 |
(const_string "*"))) |
| 7321 |
(set_attr "mode" "<MODE>")]) |
| 7322 |
|
| 7323 |
;; See comment for addsi_1_zext why we do use nonimmediate_operand |
| 7324 |
(define_insn "*addsi_3_zext" |
| 7325 |
[(set (reg FLAGS_REG) |
| 7326 |
(compare |
| 7327 |
(neg:SI (match_operand:SI 2 "x86_64_general_operand" "rBMe,0,rBMe,re")) |
| 7328 |
(match_operand:SI 1 "nonimmediate_operand" "%0,r,r,rm"))) |
| 7329 |
(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 7330 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] |
| 7331 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCZmode) |
| 7332 |
&& ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" |
| 7333 |
{ |
| 7334 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 7335 |
switch (get_attr_type (insn)) |
| 7336 |
{ |
| 7337 |
case TYPE_INCDEC: |
| 7338 |
if (operands[2] == const1_rtx) |
| 7339 |
return use_ndd ? "inc{l}\t{%1, %k0|%k0, %1}" : "inc{l}\t%k0"; |
| 7340 |
else |
| 7341 |
{ |
| 7342 |
gcc_assert (operands[2] == constm1_rtx); |
| 7343 |
return use_ndd ? "dec{l}\t{%1, %k0|%k0, %1}" : "dec{l}\t%k0"; |
| 7344 |
} |
| 7345 |
|
| 7346 |
default: |
| 7347 |
if (which_alternative == 1) |
| 7348 |
std::swap (operands[1], operands[2]); |
| 7349 |
|
| 7350 |
if (x86_maybe_negate_const_int (&operands[2], SImode)) |
| 7351 |
return use_ndd ? "sub{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 7352 |
: "sub{l}\t{%2, %k0|%k0, %2}"; |
| 7353 |
|
| 7354 |
return use_ndd ? "add{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 7355 |
: "add{l}\t{%2, %k0|%k0, %2}"; |
| 7356 |
} |
| 7357 |
} |
| 7358 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 7359 |
(set (attr "type") |
| 7360 |
(if_then_else (match_operand:SI 2 "incdec_operand") |
| 7361 |
(const_string "incdec") |
| 7362 |
(const_string "alu"))) |
| 7363 |
(set (attr "length_immediate") |
| 7364 |
(if_then_else |
| 7365 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7366 |
(const_string "1") |
| 7367 |
(const_string "*"))) |
| 7368 |
(set_attr "mode" "SI")]) |
| 7369 |
|
| 7370 |
; For comparisons against 1, -1 and 128, we may generate better code |
| 7371 |
; by converting cmp to add, inc or dec as done by peephole2. This pattern |
| 7372 |
; is matched then. We can't accept general immediate, because for |
| 7373 |
; case of overflows, the result is messed up. |
| 7374 |
; Also carry flag is reversed compared to cmp, so this conversion is valid |
| 7375 |
; only for comparisons not depending on it. |
| 7376 |
|
| 7377 |
(define_insn "*adddi_4" |
| 7378 |
[(set (reg FLAGS_REG) |
| 7379 |
(compare |
| 7380 |
(match_operand:DI 1 "nonimmediate_operand" "0") |
| 7381 |
(match_operand:DI 2 "x86_64_immediate_operand" "e"))) |
| 7382 |
(clobber (match_scratch:DI 0 "=r"))] |
| 7383 |
"TARGET_64BIT |
| 7384 |
&& ix86_match_ccmode (insn, CCGCmode)" |
| 7385 |
{ |
| 7386 |
switch (get_attr_type (insn)) |
| 7387 |
{ |
| 7388 |
case TYPE_INCDEC: |
| 7389 |
if (operands[2] == constm1_rtx) |
| 7390 |
return "inc{q}\t%0"; |
| 7391 |
else |
| 7392 |
{ |
| 7393 |
gcc_assert (operands[2] == const1_rtx); |
| 7394 |
return "dec{q}\t%0"; |
| 7395 |
} |
| 7396 |
|
| 7397 |
default: |
| 7398 |
if (x86_maybe_negate_const_int (&operands[2], DImode)) |
| 7399 |
return "add{q}\t{%2, %0|%0, %2}"; |
| 7400 |
|
| 7401 |
return "sub{q}\t{%2, %0|%0, %2}"; |
| 7402 |
} |
| 7403 |
} |
| 7404 |
[(set (attr "type") |
| 7405 |
(if_then_else (match_operand:DI 2 "incdec_operand") |
| 7406 |
(const_string "incdec") |
| 7407 |
(const_string "alu"))) |
| 7408 |
(set (attr "length_immediate") |
| 7409 |
(if_then_else |
| 7410 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7411 |
(const_string "1") |
| 7412 |
(const_string "*"))) |
| 7413 |
(set_attr "mode" "DI")]) |
| 7414 |
|
| 7415 |
; For comparisons against 1, -1 and 128, we may generate better code |
| 7416 |
; by converting cmp to add, inc or dec as done by peephole2. This pattern |
| 7417 |
; is matched then. We can't accept general immediate, because for |
| 7418 |
; case of overflows, the result is messed up. |
| 7419 |
; Also carry flag is reversed compared to cmp, so this conversion is valid |
| 7420 |
; only for comparisons not depending on it. |
| 7421 |
|
| 7422 |
(define_insn "*add<mode>_4" |
| 7423 |
[(set (reg FLAGS_REG) |
| 7424 |
(compare |
| 7425 |
(match_operand:SWI124 1 "nonimmediate_operand" "0") |
| 7426 |
(match_operand:SWI124 2 "const_int_operand"))) |
| 7427 |
(clobber (match_scratch:SWI124 0 "=<r>"))] |
| 7428 |
"ix86_match_ccmode (insn, CCGCmode)" |
| 7429 |
{ |
| 7430 |
switch (get_attr_type (insn)) |
| 7431 |
{ |
| 7432 |
case TYPE_INCDEC: |
| 7433 |
if (operands[2] == constm1_rtx) |
| 7434 |
return "inc{<imodesuffix>}\t%0"; |
| 7435 |
else |
| 7436 |
{ |
| 7437 |
gcc_assert (operands[2] == const1_rtx); |
| 7438 |
return "dec{<imodesuffix>}\t%0"; |
| 7439 |
} |
| 7440 |
|
| 7441 |
default: |
| 7442 |
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode)) |
| 7443 |
return "add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7444 |
|
| 7445 |
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7446 |
} |
| 7447 |
} |
| 7448 |
[(set (attr "type") |
| 7449 |
(if_then_else (match_operand:<MODE> 2 "incdec_operand") |
| 7450 |
(const_string "incdec") |
| 7451 |
(const_string "alu"))) |
| 7452 |
(set (attr "length_immediate") |
| 7453 |
(if_then_else |
| 7454 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7455 |
(const_string "1") |
| 7456 |
(const_string "*"))) |
| 7457 |
(set_attr "mode" "<MODE>")]) |
| 7458 |
|
| 7459 |
(define_insn "*add<mode>_5" |
| 7460 |
[(set (reg FLAGS_REG) |
| 7461 |
(compare |
| 7462 |
(plus:SWI |
| 7463 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,<r>,r,rm") |
| 7464 |
(match_operand:SWI 2 "<general_operand>" "<g>,0,<g>,re")) |
| 7465 |
(const_int 0))) |
| 7466 |
(clobber (match_scratch:SWI 0 "=<r>,<r>,r,r"))] |
| 7467 |
"ix86_match_ccmode (insn, CCGOCmode) |
| 7468 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 7469 |
{ |
| 7470 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 7471 |
switch (get_attr_type (insn)) |
| 7472 |
{ |
| 7473 |
case TYPE_INCDEC: |
| 7474 |
if (operands[2] == const1_rtx) |
| 7475 |
return use_ndd ? "inc{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 7476 |
: "inc{<imodesuffix>}\t%0"; |
| 7477 |
else |
| 7478 |
{ |
| 7479 |
gcc_assert (operands[2] == constm1_rtx); |
| 7480 |
return use_ndd ? "dec{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 7481 |
: "dec{<imodesuffix>}\t%0"; |
| 7482 |
} |
| 7483 |
|
| 7484 |
default: |
| 7485 |
if (which_alternative == 1) |
| 7486 |
std::swap (operands[1], operands[2]); |
| 7487 |
|
| 7488 |
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode)) |
| 7489 |
return use_ndd ? "sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7490 |
: "sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7491 |
|
| 7492 |
return use_ndd ? "add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7493 |
: "add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 7494 |
} |
| 7495 |
} |
| 7496 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 7497 |
(set (attr "type") |
| 7498 |
(if_then_else (match_operand:SWI 2 "incdec_operand") |
| 7499 |
(const_string "incdec") |
| 7500 |
(const_string "alu"))) |
| 7501 |
(set (attr "length_immediate") |
| 7502 |
(if_then_else |
| 7503 |
(and (eq_attr "type" "alu") (match_operand 2 "const128_operand")) |
| 7504 |
(const_string "1") |
| 7505 |
(const_string "*"))) |
| 7506 |
(set_attr "mode" "<MODE>")]) |
| 7507 |
|
| 7508 |
(define_insn "*addqi_ext<mode>_0" |
| 7509 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=QBn") |
| 7510 |
(plus:QI |
| 7511 |
(subreg:QI |
| 7512 |
(match_operator:SWI248 3 "extract_operator" |
| 7513 |
[(match_operand 2 "int248_register_operand" "Q") |
| 7514 |
(const_int 8) |
| 7515 |
(const_int 8)]) 0) |
| 7516 |
(match_operand:QI 1 "nonimmediate_operand" "0"))) |
| 7517 |
(clobber (reg:CC FLAGS_REG))] |
| 7518 |
"" |
| 7519 |
"add{b}\t{%h2, %0|%0, %h2}" |
| 7520 |
[(set_attr "addr" "gpr8") |
| 7521 |
(set_attr "type" "alu") |
| 7522 |
(set_attr "mode" "QI")]) |
| 7523 |
|
| 7524 |
(define_insn_and_split "*addqi_ext2<mode>_0" |
| 7525 |
[(set (match_operand:QI 0 "register_operand" "=&Q") |
| 7526 |
(plus:QI |
| 7527 |
(subreg:QI |
| 7528 |
(match_operator:SWI248 3 "extract_operator" |
| 7529 |
[(match_operand 1 "int248_register_operand" "Q") |
| 7530 |
(const_int 8) |
| 7531 |
(const_int 8)]) 0) |
| 7532 |
(subreg:QI |
| 7533 |
(match_operator:SWI248 4 "extract_operator" |
| 7534 |
[(match_operand 2 "int248_register_operand" "Q") |
| 7535 |
(const_int 8) |
| 7536 |
(const_int 8)]) 0))) |
| 7537 |
(clobber (reg:CC FLAGS_REG))] |
| 7538 |
"" |
| 7539 |
"#" |
| 7540 |
"&& reload_completed" |
| 7541 |
[(set (match_dup 0) |
| 7542 |
(subreg:QI |
| 7543 |
(match_op_dup 4 |
| 7544 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0)) |
| 7545 |
(parallel |
| 7546 |
[(set (match_dup 0) |
| 7547 |
(plus:QI |
| 7548 |
(subreg:QI |
| 7549 |
(match_op_dup 3 |
| 7550 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0) |
| 7551 |
(match_dup 0))) |
| 7552 |
(clobber (reg:CC FLAGS_REG))])] |
| 7553 |
"" |
| 7554 |
[(set_attr "type" "alu") |
| 7555 |
(set_attr "mode" "QI")]) |
| 7556 |
|
| 7557 |
(define_expand "addqi_ext_1" |
| 7558 |
[(parallel |
| 7559 |
[(set (zero_extract:HI (match_operand:HI 0 "register_operand") |
| 7560 |
(const_int 8) |
| 7561 |
(const_int 8)) |
| 7562 |
(subreg:HI |
| 7563 |
(plus:QI |
| 7564 |
(subreg:QI |
| 7565 |
(zero_extract:HI (match_operand:HI 1 "register_operand") |
| 7566 |
(const_int 8) |
| 7567 |
(const_int 8)) 0) |
| 7568 |
(match_operand:QI 2 "const_int_operand")) 0)) |
| 7569 |
(clobber (reg:CC FLAGS_REG))])]) |
| 7570 |
|
| 7571 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 7572 |
(define_insn_and_split "*addqi_ext<mode>_1" |
| 7573 |
[(set (zero_extract:SWI248 |
| 7574 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 7575 |
(const_int 8) |
| 7576 |
(const_int 8)) |
| 7577 |
(subreg:SWI248 |
| 7578 |
(plus:QI |
| 7579 |
(subreg:QI |
| 7580 |
(match_operator:SWI248 3 "extract_operator" |
| 7581 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 7582 |
(const_int 8) |
| 7583 |
(const_int 8)]) 0) |
| 7584 |
(match_operand:QI 2 "general_operand" "QnBn,QnBn")) 0)) |
| 7585 |
(clobber (reg:CC FLAGS_REG))] |
| 7586 |
"" |
| 7587 |
{ |
| 7588 |
if (which_alternative) |
| 7589 |
return "#"; |
| 7590 |
|
| 7591 |
switch (get_attr_type (insn)) |
| 7592 |
{ |
| 7593 |
case TYPE_INCDEC: |
| 7594 |
if (operands[2] == const1_rtx) |
| 7595 |
return "inc{b}\t%h0"; |
| 7596 |
else |
| 7597 |
{ |
| 7598 |
gcc_assert (operands[2] == constm1_rtx); |
| 7599 |
return "dec{b}\t%h0"; |
| 7600 |
} |
| 7601 |
|
| 7602 |
default: |
| 7603 |
return "add{b}\t{%2, %h0|%h0, %2}"; |
| 7604 |
} |
| 7605 |
} |
| 7606 |
"reload_completed |
| 7607 |
&& !rtx_equal_p (operands[0], operands[1])" |
| 7608 |
[(set (zero_extract:SWI248 |
| 7609 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 7610 |
(zero_extract:SWI248 |
| 7611 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 7612 |
(parallel |
| 7613 |
[(set (zero_extract:SWI248 |
| 7614 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 7615 |
(subreg:SWI248 |
| 7616 |
(plus:QI |
| 7617 |
(subreg:QI |
| 7618 |
(match_op_dup 3 |
| 7619 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 7620 |
(match_dup 2)) 0)) |
| 7621 |
(clobber (reg:CC FLAGS_REG))])] |
| 7622 |
"" |
| 7623 |
[(set_attr "addr" "gpr8") |
| 7624 |
(set (attr "type") |
| 7625 |
(if_then_else (match_operand:QI 2 "incdec_operand") |
| 7626 |
(const_string "incdec") |
| 7627 |
(const_string "alu"))) |
| 7628 |
(set_attr "mode" "QI")]) |
| 7629 |
|
| 7630 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 7631 |
(define_insn_and_split "*<insn>qi_ext<mode>_2" |
| 7632 |
[(set (zero_extract:SWI248 |
| 7633 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 7634 |
(const_int 8) |
| 7635 |
(const_int 8)) |
| 7636 |
(subreg:SWI248 |
| 7637 |
(plusminus:QI |
| 7638 |
(subreg:QI |
| 7639 |
(match_operator:SWI248 3 "extract_operator" |
| 7640 |
[(match_operand 1 "int248_register_operand" "<comm>0,!Q") |
| 7641 |
(const_int 8) |
| 7642 |
(const_int 8)]) 0) |
| 7643 |
(subreg:QI |
| 7644 |
(match_operator:SWI248 4 "extract_operator" |
| 7645 |
[(match_operand 2 "int248_register_operand" "Q,Q") |
| 7646 |
(const_int 8) |
| 7647 |
(const_int 8)]) 0)) 0)) |
| 7648 |
(clobber (reg:CC FLAGS_REG))] |
| 7649 |
"" |
| 7650 |
"@ |
| 7651 |
<insn>{b}\t{%h2, %h0|%h0, %h2} |
| 7652 |
#" |
| 7653 |
"reload_completed |
| 7654 |
&& !(rtx_equal_p (operands[0], operands[1]) |
| 7655 |
|| (<CODE> == PLUS && rtx_equal_p (operands[0], operands[2])))" |
| 7656 |
[(set (zero_extract:SWI248 |
| 7657 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 7658 |
(zero_extract:SWI248 |
| 7659 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 7660 |
(parallel |
| 7661 |
[(set (zero_extract:SWI248 |
| 7662 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 7663 |
(subreg:SWI248 |
| 7664 |
(plusminus:QI |
| 7665 |
(subreg:QI |
| 7666 |
(match_op_dup 3 |
| 7667 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 7668 |
(subreg:QI |
| 7669 |
(match_op_dup 4 |
| 7670 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0)) 0)) |
| 7671 |
(clobber (reg:CC FLAGS_REG))])] |
| 7672 |
"" |
| 7673 |
[(set_attr "type" "alu") |
| 7674 |
(set_attr "mode" "QI")]) |
| 7675 |
|
| 7676 |
;; Like DWI, but use POImode instead of OImode. |
| 7677 |
(define_mode_attr DPWI [(QI "HI") (HI "SI") (SI "DI") (DI "TI") (TI "POI")]) |
| 7678 |
|
| 7679 |
;; Add with jump on overflow. |
| 7680 |
(define_expand "addv<mode>4" |
| 7681 |
[(parallel [(set (reg:CCO FLAGS_REG) |
| 7682 |
(eq:CCO |
| 7683 |
(plus:<DPWI> |
| 7684 |
(sign_extend:<DPWI> |
| 7685 |
(match_operand:SWIDWI 1 "nonimmediate_operand")) |
| 7686 |
(match_dup 4)) |
| 7687 |
(sign_extend:<DPWI> |
| 7688 |
(plus:SWIDWI (match_dup 1) |
| 7689 |
(match_operand:SWIDWI 2 |
| 7690 |
"<general_hilo_operand>"))))) |
| 7691 |
(set (match_operand:SWIDWI 0 "register_operand") |
| 7692 |
(plus:SWIDWI (match_dup 1) (match_dup 2)))]) |
| 7693 |
(set (pc) (if_then_else |
| 7694 |
(eq (reg:CCO FLAGS_REG) (const_int 0)) |
| 7695 |
(label_ref (match_operand 3)) |
| 7696 |
(pc)))] |
| 7697 |
"" |
| 7698 |
{ |
| 7699 |
ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands); |
| 7700 |
if (CONST_SCALAR_INT_P (operands[2])) |
| 7701 |
operands[4] = operands[2]; |
| 7702 |
else |
| 7703 |
operands[4] = gen_rtx_SIGN_EXTEND (<DPWI>mode, operands[2]); |
| 7704 |
}) |
| 7705 |
|
| 7706 |
(define_insn "*addv<mode>4" |
| 7707 |
[(set (reg:CCO FLAGS_REG) |
| 7708 |
(eq:CCO (plus:<DWI> |
| 7709 |
(sign_extend:<DWI> |
| 7710 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r")) |
| 7711 |
(sign_extend:<DWI> |
| 7712 |
(match_operand:SWI 2 "<general_sext_operand>" "<r>We,m,rWe,m"))) |
| 7713 |
(sign_extend:<DWI> |
| 7714 |
(plus:SWI (match_dup 1) (match_dup 2))))) |
| 7715 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 7716 |
(plus:SWI (match_dup 1) (match_dup 2)))] |
| 7717 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 7718 |
"@ |
| 7719 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 7720 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 7721 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 7722 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7723 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 7724 |
(set_attr "type" "alu") |
| 7725 |
(set_attr "mode" "<MODE>")]) |
| 7726 |
|
| 7727 |
(define_insn "addv<mode>4_1" |
| 7728 |
[(set (reg:CCO FLAGS_REG) |
| 7729 |
(eq:CCO (plus:<DWI> |
| 7730 |
(sign_extend:<DWI> |
| 7731 |
(match_operand:SWI 1 "nonimmediate_operand" "0,rm")) |
| 7732 |
(match_operand:<DWI> 3 "const_int_operand")) |
| 7733 |
(sign_extend:<DWI> |
| 7734 |
(plus:SWI |
| 7735 |
(match_dup 1) |
| 7736 |
(match_operand:SWI 2 "x86_64_immediate_operand" "<i>,<i>"))))) |
| 7737 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 7738 |
(plus:SWI (match_dup 1) (match_dup 2)))] |
| 7739 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 7740 |
&& CONST_INT_P (operands[2]) |
| 7741 |
&& INTVAL (operands[2]) == INTVAL (operands[3])" |
| 7742 |
"@ |
| 7743 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 7744 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7745 |
[(set_attr "isa" "*,apx_ndd") |
| 7746 |
(set_attr "type" "alu") |
| 7747 |
(set_attr "mode" "<MODE>") |
| 7748 |
(set (attr "length_immediate") |
| 7749 |
(cond [(match_test "IN_RANGE (INTVAL (operands[2]), -128, 127)") |
| 7750 |
(const_string "1") |
| 7751 |
(match_test "<MODE_SIZE> == 8") |
| 7752 |
(const_string "4")] |
| 7753 |
(const_string "<MODE_SIZE>")))]) |
| 7754 |
|
| 7755 |
;; Quad word integer modes as mode attribute. |
| 7756 |
(define_mode_attr QPWI [(SI "TI") (DI "POI")]) |
| 7757 |
|
| 7758 |
(define_insn_and_split "*addv<dwi>4_doubleword" |
| 7759 |
[(set (reg:CCO FLAGS_REG) |
| 7760 |
(eq:CCO |
| 7761 |
(plus:<QPWI> |
| 7762 |
(sign_extend:<QPWI> |
| 7763 |
(match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r")) |
| 7764 |
(sign_extend:<QPWI> |
| 7765 |
(match_operand:<DWI> 2 "nonimmediate_operand" "r,o,r,o"))) |
| 7766 |
(sign_extend:<QPWI> |
| 7767 |
(plus:<DWI> (match_dup 1) (match_dup 2))))) |
| 7768 |
(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") |
| 7769 |
(plus:<DWI> (match_dup 1) (match_dup 2)))] |
| 7770 |
"ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)" |
| 7771 |
"#" |
| 7772 |
"&& reload_completed" |
| 7773 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 7774 |
(compare:CCC |
| 7775 |
(plus:DWIH (match_dup 1) (match_dup 2)) |
| 7776 |
(match_dup 1))) |
| 7777 |
(set (match_dup 0) |
| 7778 |
(plus:DWIH (match_dup 1) (match_dup 2)))]) |
| 7779 |
(parallel [(set (reg:CCO FLAGS_REG) |
| 7780 |
(eq:CCO |
| 7781 |
(plus:<DWI> |
| 7782 |
(plus:<DWI> |
| 7783 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0)) |
| 7784 |
(sign_extend:<DWI> (match_dup 4))) |
| 7785 |
(sign_extend:<DWI> (match_dup 5))) |
| 7786 |
(sign_extend:<DWI> |
| 7787 |
(plus:DWIH |
| 7788 |
(plus:DWIH |
| 7789 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 7790 |
(match_dup 4)) |
| 7791 |
(match_dup 5))))) |
| 7792 |
(set (match_dup 3) |
| 7793 |
(plus:DWIH |
| 7794 |
(plus:DWIH |
| 7795 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 7796 |
(match_dup 4)) |
| 7797 |
(match_dup 5)))])] |
| 7798 |
{ |
| 7799 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 7800 |
} |
| 7801 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) |
| 7802 |
|
| 7803 |
(define_insn_and_split "*addv<dwi>4_doubleword_1" |
| 7804 |
[(set (reg:CCO FLAGS_REG) |
| 7805 |
(eq:CCO |
| 7806 |
(plus:<QPWI> |
| 7807 |
(sign_extend:<QPWI> |
| 7808 |
(match_operand:<DWI> 1 "nonimmediate_operand" "%0,rjO")) |
| 7809 |
(match_operand:<QPWI> 3 "const_scalar_int_operand" "n,n")) |
| 7810 |
(sign_extend:<QPWI> |
| 7811 |
(plus:<DWI> |
| 7812 |
(match_dup 1) |
| 7813 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "<di>,<di>"))))) |
| 7814 |
(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r") |
| 7815 |
(plus:<DWI> (match_dup 1) (match_dup 2)))] |
| 7816 |
"ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD) |
| 7817 |
&& CONST_SCALAR_INT_P (operands[2]) |
| 7818 |
&& rtx_equal_p (operands[2], operands[3])" |
| 7819 |
"#" |
| 7820 |
"&& reload_completed" |
| 7821 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 7822 |
(compare:CCC |
| 7823 |
(plus:DWIH (match_dup 1) (match_dup 2)) |
| 7824 |
(match_dup 1))) |
| 7825 |
(set (match_dup 0) |
| 7826 |
(plus:DWIH (match_dup 1) (match_dup 2)))]) |
| 7827 |
(parallel [(set (reg:CCO FLAGS_REG) |
| 7828 |
(eq:CCO |
| 7829 |
(plus:<DWI> |
| 7830 |
(plus:<DWI> |
| 7831 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0)) |
| 7832 |
(sign_extend:<DWI> (match_dup 4))) |
| 7833 |
(match_dup 5)) |
| 7834 |
(sign_extend:<DWI> |
| 7835 |
(plus:DWIH |
| 7836 |
(plus:DWIH |
| 7837 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 7838 |
(match_dup 4)) |
| 7839 |
(match_dup 5))))) |
| 7840 |
(set (match_dup 3) |
| 7841 |
(plus:DWIH |
| 7842 |
(plus:DWIH |
| 7843 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 7844 |
(match_dup 4)) |
| 7845 |
(match_dup 5)))])] |
| 7846 |
{ |
| 7847 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 7848 |
if (operands[2] == const0_rtx) |
| 7849 |
{ |
| 7850 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 7851 |
emit_move_insn (operands[0], operands[1]); |
| 7852 |
emit_insn (gen_addv<mode>4_1 (operands[3], operands[4], operands[5], |
| 7853 |
operands[5])); |
| 7854 |
DONE; |
| 7855 |
} |
| 7856 |
} |
| 7857 |
[(set_attr "isa" "*,apx_ndd")]) |
| 7858 |
|
| 7859 |
(define_insn "*addv<mode>4_overflow_1" |
| 7860 |
[(set (reg:CCO FLAGS_REG) |
| 7861 |
(eq:CCO |
| 7862 |
(plus:<DWI> |
| 7863 |
(plus:<DWI> |
| 7864 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 7865 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 7866 |
(sign_extend:<DWI> |
| 7867 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r"))) |
| 7868 |
(sign_extend:<DWI> |
| 7869 |
(match_operand:SWI 2 "<general_sext_operand>" "rWe,m,rWe,m"))) |
| 7870 |
(sign_extend:<DWI> |
| 7871 |
(plus:SWI |
| 7872 |
(plus:SWI |
| 7873 |
(match_operator:SWI 5 "ix86_carry_flag_operator" |
| 7874 |
[(match_dup 3) (const_int 0)]) |
| 7875 |
(match_dup 1)) |
| 7876 |
(match_dup 2))))) |
| 7877 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=rm,r,r,r") |
| 7878 |
(plus:SWI |
| 7879 |
(plus:SWI |
| 7880 |
(match_op_dup 5 [(match_dup 3) (const_int 0)]) |
| 7881 |
(match_dup 1)) |
| 7882 |
(match_dup 2)))] |
| 7883 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 7884 |
"@ |
| 7885 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 7886 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 7887 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 7888 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7889 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 7890 |
(set_attr "type" "alu") |
| 7891 |
(set_attr "mode" "<MODE>")]) |
| 7892 |
|
| 7893 |
(define_insn "*addv<mode>4_overflow_2" |
| 7894 |
[(set (reg:CCO FLAGS_REG) |
| 7895 |
(eq:CCO |
| 7896 |
(plus:<DWI> |
| 7897 |
(plus:<DWI> |
| 7898 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 7899 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 7900 |
(sign_extend:<DWI> |
| 7901 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,rm"))) |
| 7902 |
(match_operand:<DWI> 6 "const_int_operand" "n,n")) |
| 7903 |
(sign_extend:<DWI> |
| 7904 |
(plus:SWI |
| 7905 |
(plus:SWI |
| 7906 |
(match_operator:SWI 5 "ix86_carry_flag_operator" |
| 7907 |
[(match_dup 3) (const_int 0)]) |
| 7908 |
(match_dup 1)) |
| 7909 |
(match_operand:SWI 2 "x86_64_immediate_operand" "e,e"))))) |
| 7910 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=rm,r") |
| 7911 |
(plus:SWI |
| 7912 |
(plus:SWI |
| 7913 |
(match_op_dup 5 [(match_dup 3) (const_int 0)]) |
| 7914 |
(match_dup 1)) |
| 7915 |
(match_dup 2)))] |
| 7916 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 7917 |
&& CONST_INT_P (operands[2]) |
| 7918 |
&& INTVAL (operands[2]) == INTVAL (operands[6])" |
| 7919 |
"@ |
| 7920 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 7921 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 7922 |
[(set_attr "isa" "*,apx_ndd") |
| 7923 |
(set_attr "type" "alu") |
| 7924 |
(set_attr "mode" "<MODE>") |
| 7925 |
(set (attr "length_immediate") |
| 7926 |
(if_then_else (match_test "IN_RANGE (INTVAL (operands[2]), -128, 127)") |
| 7927 |
(const_string "1") |
| 7928 |
(const_string "4")))]) |
| 7929 |
|
| 7930 |
(define_expand "uaddv<mode>4" |
| 7931 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 7932 |
(compare:CCC |
| 7933 |
(plus:SWIDWI |
| 7934 |
(match_operand:SWIDWI 1 "nonimmediate_operand") |
| 7935 |
(match_operand:SWIDWI 2 "<general_hilo_operand>")) |
| 7936 |
(match_dup 1))) |
| 7937 |
(set (match_operand:SWIDWI 0 "register_operand") |
| 7938 |
(plus:SWIDWI (match_dup 1) (match_dup 2)))]) |
| 7939 |
(set (pc) (if_then_else |
| 7940 |
(ltu (reg:CCC FLAGS_REG) (const_int 0)) |
| 7941 |
(label_ref (match_operand 3)) |
| 7942 |
(pc)))] |
| 7943 |
"" |
| 7944 |
"ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);") |
| 7945 |
|
| 7946 |
;; The lea patterns for modes less than 32 bits need to be matched by |
| 7947 |
;; several insns converted to real lea by splitters. |
| 7948 |
|
| 7949 |
(define_insn_and_split "*lea<mode>_general_1" |
| 7950 |
[(set (match_operand:SWI12 0 "register_operand" "=r") |
| 7951 |
(plus:SWI12 |
| 7952 |
(plus:SWI12 (match_operand:SWI12 1 "register_no_SP_operand" "l") |
| 7953 |
(match_operand:SWI12 2 "register_operand" "r")) |
| 7954 |
(match_operand:SWI12 3 "immediate_operand" "i")))] |
| 7955 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 7956 |
"#" |
| 7957 |
"&& reload_completed" |
| 7958 |
[(set (match_dup 0) |
| 7959 |
(plus:SI |
| 7960 |
(plus:SI (match_dup 1) (match_dup 2)) |
| 7961 |
(match_dup 3)))] |
| 7962 |
{ |
| 7963 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 7964 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 7965 |
operands[2] = gen_lowpart (SImode, operands[2]); |
| 7966 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 7967 |
} |
| 7968 |
[(set_attr "type" "lea") |
| 7969 |
(set_attr "mode" "SI")]) |
| 7970 |
|
| 7971 |
(define_insn_and_split "*lea<mode>_general_2" |
| 7972 |
[(set (match_operand:SWI12 0 "register_operand" "=r") |
| 7973 |
(plus:SWI12 |
| 7974 |
(mult:SWI12 (match_operand:SWI12 1 "register_no_SP_operand" "l") |
| 7975 |
(match_operand 2 "const248_operand" "n")) |
| 7976 |
(match_operand:SWI12 3 "nonmemory_operand" "ri")))] |
| 7977 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 7978 |
"#" |
| 7979 |
"&& reload_completed" |
| 7980 |
[(set (match_dup 0) |
| 7981 |
(plus:SI |
| 7982 |
(mult:SI (match_dup 1) (match_dup 2)) |
| 7983 |
(match_dup 3)))] |
| 7984 |
{ |
| 7985 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 7986 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 7987 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 7988 |
} |
| 7989 |
[(set_attr "type" "lea") |
| 7990 |
(set_attr "mode" "SI")]) |
| 7991 |
|
| 7992 |
(define_insn_and_split "*lea<mode>_general_2b" |
| 7993 |
[(set (match_operand:SWI12 0 "register_operand" "=r") |
| 7994 |
(plus:SWI12 |
| 7995 |
(ashift:SWI12 (match_operand:SWI12 1 "register_no_SP_operand" "l") |
| 7996 |
(match_operand 2 "const123_operand" "n")) |
| 7997 |
(match_operand:SWI12 3 "nonmemory_operand" "ri")))] |
| 7998 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 7999 |
"#" |
| 8000 |
"&& reload_completed" |
| 8001 |
[(set (match_dup 0) |
| 8002 |
(plus:SI |
| 8003 |
(ashift:SI (match_dup 1) (match_dup 2)) |
| 8004 |
(match_dup 3)))] |
| 8005 |
{ |
| 8006 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 8007 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 8008 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 8009 |
} |
| 8010 |
[(set_attr "type" "lea") |
| 8011 |
(set_attr "mode" "SI")]) |
| 8012 |
|
| 8013 |
(define_insn_and_split "*lea<mode>_general_3" |
| 8014 |
[(set (match_operand:SWI12 0 "register_operand" "=r") |
| 8015 |
(plus:SWI12 |
| 8016 |
(plus:SWI12 |
| 8017 |
(mult:SWI12 (match_operand:SWI12 1 "register_no_SP_operand" "l") |
| 8018 |
(match_operand 2 "const248_operand" "n")) |
| 8019 |
(match_operand:SWI12 3 "register_operand" "r")) |
| 8020 |
(match_operand:SWI12 4 "immediate_operand" "i")))] |
| 8021 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 8022 |
"#" |
| 8023 |
"&& reload_completed" |
| 8024 |
[(set (match_dup 0) |
| 8025 |
(plus:SI |
| 8026 |
(plus:SI |
| 8027 |
(mult:SI (match_dup 1) (match_dup 2)) |
| 8028 |
(match_dup 3)) |
| 8029 |
(match_dup 4)))] |
| 8030 |
{ |
| 8031 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 8032 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 8033 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 8034 |
operands[4] = gen_lowpart (SImode, operands[4]); |
| 8035 |
} |
| 8036 |
[(set_attr "type" "lea") |
| 8037 |
(set_attr "mode" "SI")]) |
| 8038 |
|
| 8039 |
(define_insn_and_split "*lea<mode>_general_3b" |
| 8040 |
[(set (match_operand:SWI12 0 "register_operand" "=r") |
| 8041 |
(plus:SWI12 |
| 8042 |
(plus:SWI12 |
| 8043 |
(ashift:SWI12 (match_operand:SWI12 1 "register_no_SP_operand" "l") |
| 8044 |
(match_operand 2 "const123_operand" "n")) |
| 8045 |
(match_operand:SWI12 3 "register_operand" "r")) |
| 8046 |
(match_operand:SWI12 4 "immediate_operand" "i")))] |
| 8047 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 8048 |
"#" |
| 8049 |
"&& reload_completed" |
| 8050 |
[(set (match_dup 0) |
| 8051 |
(plus:SI |
| 8052 |
(plus:SI |
| 8053 |
(ashift:SI (match_dup 1) (match_dup 2)) |
| 8054 |
(match_dup 3)) |
| 8055 |
(match_dup 4)))] |
| 8056 |
{ |
| 8057 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 8058 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 8059 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 8060 |
operands[4] = gen_lowpart (SImode, operands[4]); |
| 8061 |
} |
| 8062 |
[(set_attr "type" "lea") |
| 8063 |
(set_attr "mode" "SI")]) |
| 8064 |
|
| 8065 |
(define_insn_and_split "*lea<mode>_general_4" |
| 8066 |
[(set (match_operand:SWI12 0 "register_operand" "=r") |
| 8067 |
(any_or:SWI12 |
| 8068 |
(ashift:SWI12 |
| 8069 |
(match_operand:SWI12 1 "register_no_SP_operand" "l") |
| 8070 |
(match_operand 2 "const_0_to_3_operand")) |
| 8071 |
(match_operand 3 "const_int_operand")))] |
| 8072 |
"(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 8073 |
&& ((unsigned HOST_WIDE_INT) INTVAL (operands[3]) |
| 8074 |
< (HOST_WIDE_INT_1U << INTVAL (operands[2])))" |
| 8075 |
"#" |
| 8076 |
"&& reload_completed" |
| 8077 |
[(set (match_dup 0) |
| 8078 |
(plus:SI |
| 8079 |
(mult:SI (match_dup 1) (match_dup 2)) |
| 8080 |
(match_dup 3)))] |
| 8081 |
{ |
| 8082 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 8083 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 8084 |
operands[2] = GEN_INT (1 << INTVAL (operands[2])); |
| 8085 |
} |
| 8086 |
[(set_attr "type" "lea") |
| 8087 |
(set_attr "mode" "SI")]) |
| 8088 |
|
| 8089 |
(define_insn_and_split "*lea<mode>_general_4" |
| 8090 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 8091 |
(any_or:SWI48 |
| 8092 |
(ashift:SWI48 |
| 8093 |
(match_operand:SWI48 1 "register_no_SP_operand" "l") |
| 8094 |
(match_operand 2 "const_0_to_3_operand")) |
| 8095 |
(match_operand 3 "const_int_operand")))] |
| 8096 |
"(unsigned HOST_WIDE_INT) INTVAL (operands[3]) |
| 8097 |
< (HOST_WIDE_INT_1U << INTVAL (operands[2]))" |
| 8098 |
"#" |
| 8099 |
"&& reload_completed" |
| 8100 |
[(set (match_dup 0) |
| 8101 |
(plus:SWI48 |
| 8102 |
(mult:SWI48 (match_dup 1) (match_dup 2)) |
| 8103 |
(match_dup 3)))] |
| 8104 |
"operands[2] = GEN_INT (1 << INTVAL (operands[2]));" |
| 8105 |
[(set_attr "type" "lea") |
| 8106 |
(set_attr "mode" "<MODE>")]) |
| 8107 |
|
| 8108 |
;; Subtract instructions |
| 8109 |
|
| 8110 |
(define_expand "sub<mode>3" |
| 8111 |
[(set (match_operand:SDWIM 0 "nonimmediate_operand") |
| 8112 |
(minus:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand") |
| 8113 |
(match_operand:SDWIM 2 "<general_hilo_operand>")))] |
| 8114 |
"" |
| 8115 |
{ |
| 8116 |
ix86_expand_binary_operator (MINUS, <MODE>mode, operands, TARGET_APX_NDD); |
| 8117 |
DONE; |
| 8118 |
}) |
| 8119 |
|
| 8120 |
(define_insn_and_split "*sub<dwi>3_doubleword" |
| 8121 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") |
| 8122 |
(minus:<DWI> |
| 8123 |
(match_operand:<DWI> 1 "nonimmediate_operand" "0,0,ro,r") |
| 8124 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r<di>,o"))) |
| 8125 |
(clobber (reg:CC FLAGS_REG))] |
| 8126 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8127 |
"#" |
| 8128 |
"&& reload_completed" |
| 8129 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8130 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 8131 |
(set (match_dup 0) |
| 8132 |
(minus:DWIH (match_dup 1) (match_dup 2)))]) |
| 8133 |
(parallel [(set (match_dup 3) |
| 8134 |
(minus:DWIH |
| 8135 |
(minus:DWIH |
| 8136 |
(match_dup 4) |
| 8137 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) |
| 8138 |
(match_dup 5))) |
| 8139 |
(clobber (reg:CC FLAGS_REG))])] |
| 8140 |
{ |
| 8141 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 8142 |
if (operands[2] == const0_rtx) |
| 8143 |
{ |
| 8144 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 8145 |
emit_move_insn (operands[0], operands[1]); |
| 8146 |
ix86_expand_binary_operator (MINUS, <MODE>mode, &operands[3], |
| 8147 |
TARGET_APX_NDD); |
| 8148 |
DONE; |
| 8149 |
} |
| 8150 |
} |
| 8151 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) |
| 8152 |
|
| 8153 |
(define_insn_and_split "*sub<dwi>3_doubleword_zext" |
| 8154 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=r,o,&r,&r") |
| 8155 |
(minus:<DWI> |
| 8156 |
(match_operand:<DWI> 1 "nonimmediate_operand" "0,0,r,o") |
| 8157 |
(zero_extend:<DWI> |
| 8158 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm,r,rm,r")))) |
| 8159 |
(clobber (reg:CC FLAGS_REG))] |
| 8160 |
"ix86_binary_operator_ok (UNKNOWN, <DWI>mode, operands, TARGET_APX_NDD)" |
| 8161 |
"#" |
| 8162 |
"&& reload_completed" |
| 8163 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8164 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 8165 |
(set (match_dup 0) |
| 8166 |
(minus:DWIH (match_dup 1) (match_dup 2)))]) |
| 8167 |
(parallel [(set (match_dup 3) |
| 8168 |
(minus:DWIH |
| 8169 |
(minus:DWIH |
| 8170 |
(match_dup 4) |
| 8171 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) |
| 8172 |
(const_int 0))) |
| 8173 |
(clobber (reg:CC FLAGS_REG))])] |
| 8174 |
"split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[3]);" |
| 8175 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) |
| 8176 |
|
| 8177 |
(define_insn "*sub<mode>_1<nf_name>" |
| 8178 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r<nf_mem_constraint>,<r>,r,r,r") |
| 8179 |
(minus:SWI |
| 8180 |
(match_operand:SWI 1 "nonimmediate_operand" "0,0,0,rm,rjM,r") |
| 8181 |
(match_operand:SWI 2 "<general_operand>" "<r>,<i>,<m>,r,<i>,<m>")))] |
| 8182 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 8183 |
&& <nf_condition>" |
| 8184 |
"@ |
| 8185 |
<nf_prefix>sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8186 |
<nf_prefix>sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8187 |
<nf_prefix>sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8188 |
<nf_prefix>sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8189 |
<nf_prefix>sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8190 |
<nf_prefix>sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8191 |
[(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,apx_ndd") |
| 8192 |
(set_attr "type" "alu") |
| 8193 |
(set_attr "has_nf" "1") |
| 8194 |
(set_attr "mode" "<MODE>")]) |
| 8195 |
|
| 8196 |
(define_insn "*subqi_1_zext<mode><nf_name>" |
| 8197 |
[(set (match_operand:SWI248x 0 "register_operand" "=r,r") |
| 8198 |
(zero_extend:SWI248x |
| 8199 |
(minus:QI (match_operand:QI 1 "nonimmediate_operand" "rm,r") |
| 8200 |
(match_operand:QI 2 "x86_64_general_operand" "rn,m"))))] |
| 8201 |
"TARGET_APX_NDD && <nf_condition> |
| 8202 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 8203 |
"@ |
| 8204 |
<nf_prefix>sub{b}\t{%2, %1, %b0|%b0, %1, %2} |
| 8205 |
<nf_prefix>sub{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 8206 |
[(set_attr "type" "alu") |
| 8207 |
(set_attr "has_nf" "1") |
| 8208 |
(set_attr "mode" "QI")]) |
| 8209 |
|
| 8210 |
(define_insn "*subhi_1_zext<mode><nf_name>" |
| 8211 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 8212 |
(zero_extend:SWI48x |
| 8213 |
(minus:HI (match_operand:HI 1 "nonimmediate_operand" "rm,r") |
| 8214 |
(match_operand:HI 2 "x86_64_general_operand" "rn,m"))))] |
| 8215 |
"TARGET_APX_NDD && <nf_condition> |
| 8216 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 8217 |
"@ |
| 8218 |
<nf_prefix>sub{w}\t{%2, %1, %w0|%w0, %1, %2} |
| 8219 |
<nf_prefix>sub{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 8220 |
[(set_attr "type" "alu") |
| 8221 |
(set_attr "has_nf" "1") |
| 8222 |
(set_attr "mode" "HI")]) |
| 8223 |
|
| 8224 |
(define_insn "*subsi_1_zext" |
| 8225 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 8226 |
(zero_extend:DI |
| 8227 |
(minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,r,rm") |
| 8228 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re")))) |
| 8229 |
(clobber (reg:CC FLAGS_REG))] |
| 8230 |
"TARGET_64BIT |
| 8231 |
&& ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)" |
| 8232 |
"@ |
| 8233 |
sub{l}\t{%2, %k0|%k0, %2} |
| 8234 |
sub{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 8235 |
sub{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 8236 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 8237 |
(set_attr "type" "alu") |
| 8238 |
(set_attr "mode" "SI")]) |
| 8239 |
|
| 8240 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 8241 |
(define_insn_and_split "*sub<mode>_1_slp" |
| 8242 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 8243 |
(minus:SWI12 (match_operand:SWI12 1 "register_operand" "0,!<r>") |
| 8244 |
(match_operand:SWI12 2 "general_operand" "<r>mn,<r>mn"))) |
| 8245 |
(clobber (reg:CC FLAGS_REG))] |
| 8246 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 8247 |
"@ |
| 8248 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8249 |
#" |
| 8250 |
"&& reload_completed |
| 8251 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 8252 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 8253 |
(parallel |
| 8254 |
[(set (strict_low_part (match_dup 0)) |
| 8255 |
(minus:SWI12 (match_dup 0) (match_dup 2))) |
| 8256 |
(clobber (reg:CC FLAGS_REG))])] |
| 8257 |
"" |
| 8258 |
[(set_attr "type" "alu") |
| 8259 |
(set_attr "mode" "<MODE>")]) |
| 8260 |
|
| 8261 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 8262 |
(define_insn_and_split "*subqi_ext<mode>_1_slp" |
| 8263 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+Q,&Q")) |
| 8264 |
(minus:QI |
| 8265 |
(match_operand:QI 1 "nonimmediate_operand" "0,!qm") |
| 8266 |
(subreg:QI |
| 8267 |
(match_operator:SWI248 3 "extract_operator" |
| 8268 |
[(match_operand 2 "int248_register_operand" "Q,Q") |
| 8269 |
(const_int 8) |
| 8270 |
(const_int 8)]) 0))) |
| 8271 |
(clobber (reg:CC FLAGS_REG))] |
| 8272 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 8273 |
"@ |
| 8274 |
sub{b}\t{%h2, %0|%0, %h2} |
| 8275 |
#" |
| 8276 |
"&& reload_completed |
| 8277 |
&& !rtx_equal_p (operands[0], operands[1])" |
| 8278 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 8279 |
(parallel |
| 8280 |
[(set (strict_low_part (match_dup 0)) |
| 8281 |
(minus:QI |
| 8282 |
(match_dup 0) |
| 8283 |
(subreg:QI |
| 8284 |
(match_op_dup 3 |
| 8285 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0))) |
| 8286 |
(clobber (reg:CC FLAGS_REG))])] |
| 8287 |
"" |
| 8288 |
[(set_attr "type" "alu") |
| 8289 |
(set_attr "mode" "QI")]) |
| 8290 |
|
| 8291 |
(define_insn_and_split "*subqi_ext<mode>_2_slp" |
| 8292 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+&Q")) |
| 8293 |
(minus:QI |
| 8294 |
(subreg:QI |
| 8295 |
(match_operator:SWI248 3 "extract_operator" |
| 8296 |
[(match_operand 1 "int248_register_operand" "Q") |
| 8297 |
(const_int 8) |
| 8298 |
(const_int 8)]) 0) |
| 8299 |
(subreg:QI |
| 8300 |
(match_operator:SWI248 4 "extract_operator" |
| 8301 |
[(match_operand 2 "int248_register_operand" "Q") |
| 8302 |
(const_int 8) |
| 8303 |
(const_int 8)]) 0))) |
| 8304 |
(clobber (reg:CC FLAGS_REG))] |
| 8305 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 8306 |
"#" |
| 8307 |
"&& reload_completed" |
| 8308 |
[(set (strict_low_part (match_dup 0)) |
| 8309 |
(subreg:QI |
| 8310 |
(match_op_dup 3 |
| 8311 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0)) |
| 8312 |
(parallel |
| 8313 |
[(set (strict_low_part (match_dup 0)) |
| 8314 |
(minus:QI |
| 8315 |
(match_dup 0) |
| 8316 |
(subreg:QI |
| 8317 |
(match_op_dup 4 |
| 8318 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0))) |
| 8319 |
(clobber (reg:CC FLAGS_REG))])] |
| 8320 |
"" |
| 8321 |
[(set_attr "type" "alu") |
| 8322 |
(set_attr "mode" "QI")]) |
| 8323 |
|
| 8324 |
(define_insn "*sub<mode>_2" |
| 8325 |
[(set (reg FLAGS_REG) |
| 8326 |
(compare |
| 8327 |
(minus:SWI |
| 8328 |
(match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,r") |
| 8329 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")) |
| 8330 |
(const_int 0))) |
| 8331 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 8332 |
(minus:SWI (match_dup 1) (match_dup 2)))] |
| 8333 |
"ix86_match_ccmode (insn, CCGOCmode) |
| 8334 |
&& ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8335 |
"@ |
| 8336 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8337 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8338 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8339 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8340 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 8341 |
(set_attr "type" "alu") |
| 8342 |
(set_attr "mode" "<MODE>")]) |
| 8343 |
|
| 8344 |
(define_insn "*subsi_2_zext" |
| 8345 |
[(set (reg FLAGS_REG) |
| 8346 |
(compare |
| 8347 |
(minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,r,rm") |
| 8348 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re")) |
| 8349 |
(const_int 0))) |
| 8350 |
(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 8351 |
(zero_extend:DI |
| 8352 |
(minus:SI (match_dup 1) |
| 8353 |
(match_dup 2))))] |
| 8354 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode) |
| 8355 |
&& ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)" |
| 8356 |
"@ |
| 8357 |
sub{l}\t{%2, %k0|%k0, %2} |
| 8358 |
sub{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 8359 |
sub{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 8360 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 8361 |
(set_attr "type" "alu") |
| 8362 |
(set_attr "mode" "SI")]) |
| 8363 |
|
| 8364 |
(define_insn "*subqi_ext<mode>_0" |
| 8365 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=QBn") |
| 8366 |
(minus:QI |
| 8367 |
(match_operand:QI 1 "nonimmediate_operand" "0") |
| 8368 |
(subreg:QI |
| 8369 |
(match_operator:SWI248 3 "extract_operator" |
| 8370 |
[(match_operand 2 "int248_register_operand" "Q") |
| 8371 |
(const_int 8) |
| 8372 |
(const_int 8)]) 0))) |
| 8373 |
(clobber (reg:CC FLAGS_REG))] |
| 8374 |
"" |
| 8375 |
"sub{b}\t{%h2, %0|%0, %h2}" |
| 8376 |
[(set_attr "addr" "gpr8") |
| 8377 |
(set_attr "type" "alu") |
| 8378 |
(set_attr "mode" "QI")]) |
| 8379 |
|
| 8380 |
(define_insn_and_split "*subqi_ext2<mode>_0" |
| 8381 |
[(set (match_operand:QI 0 "register_operand" "=&Q") |
| 8382 |
(minus:QI |
| 8383 |
(subreg:QI |
| 8384 |
(match_operator:SWI248 3 "extract_operator" |
| 8385 |
[(match_operand 1 "int248_register_operand" "Q") |
| 8386 |
(const_int 8) |
| 8387 |
(const_int 8)]) 0) |
| 8388 |
(subreg:QI |
| 8389 |
(match_operator:SWI248 4 "extract_operator" |
| 8390 |
[(match_operand 2 "int248_register_operand" "Q") |
| 8391 |
(const_int 8) |
| 8392 |
(const_int 8)]) 0))) |
| 8393 |
(clobber (reg:CC FLAGS_REG))] |
| 8394 |
"" |
| 8395 |
"#" |
| 8396 |
"&& reload_completed" |
| 8397 |
[(set (match_dup 0) |
| 8398 |
(subreg:QI |
| 8399 |
(match_op_dup 3 |
| 8400 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0)) |
| 8401 |
(parallel |
| 8402 |
[(set (match_dup 0) |
| 8403 |
(minus:QI |
| 8404 |
(match_dup 0) |
| 8405 |
(subreg:QI |
| 8406 |
(match_op_dup 4 |
| 8407 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0))) |
| 8408 |
(clobber (reg:CC FLAGS_REG))])] |
| 8409 |
"" |
| 8410 |
[(set_attr "type" "alu") |
| 8411 |
(set_attr "mode" "QI")]) |
| 8412 |
|
| 8413 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 8414 |
(define_insn_and_split "*subqi_ext<mode>_1" |
| 8415 |
[(set (zero_extract:SWI248 |
| 8416 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 8417 |
(const_int 8) |
| 8418 |
(const_int 8)) |
| 8419 |
(subreg:SWI248 |
| 8420 |
(minus:QI |
| 8421 |
(subreg:QI |
| 8422 |
(match_operator:SWI248 3 "extract_operator" |
| 8423 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 8424 |
(const_int 8) |
| 8425 |
(const_int 8)]) 0) |
| 8426 |
(match_operand:QI 2 "general_operand" "QnBn,QnBn")) 0)) |
| 8427 |
(clobber (reg:CC FLAGS_REG))] |
| 8428 |
"" |
| 8429 |
"@ |
| 8430 |
sub{b}\t{%2, %h0|%h0, %2} |
| 8431 |
#" |
| 8432 |
"reload_completed |
| 8433 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 8434 |
[(set (zero_extract:SWI248 |
| 8435 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 8436 |
(zero_extract:SWI248 |
| 8437 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 8438 |
(parallel |
| 8439 |
[(set (zero_extract:SWI248 |
| 8440 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 8441 |
(subreg:SWI248 |
| 8442 |
(minus:QI |
| 8443 |
(subreg:QI |
| 8444 |
(match_op_dup 3 |
| 8445 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 8446 |
(match_dup 2)) 0)) |
| 8447 |
(clobber (reg:CC FLAGS_REG))])] |
| 8448 |
"" |
| 8449 |
[(set_attr "addr" "gpr8") |
| 8450 |
(set_attr "type" "alu") |
| 8451 |
(set_attr "mode" "QI")]) |
| 8452 |
|
| 8453 |
;; Subtract with jump on overflow. |
| 8454 |
(define_expand "subv<mode>4" |
| 8455 |
[(parallel [(set (reg:CCO FLAGS_REG) |
| 8456 |
(eq:CCO |
| 8457 |
(minus:<DPWI> |
| 8458 |
(sign_extend:<DPWI> |
| 8459 |
(match_operand:SWIDWI 1 "nonimmediate_operand")) |
| 8460 |
(match_dup 4)) |
| 8461 |
(sign_extend:<DPWI> |
| 8462 |
(minus:SWIDWI (match_dup 1) |
| 8463 |
(match_operand:SWIDWI 2 |
| 8464 |
"<general_hilo_operand>"))))) |
| 8465 |
(set (match_operand:SWIDWI 0 "register_operand") |
| 8466 |
(minus:SWIDWI (match_dup 1) (match_dup 2)))]) |
| 8467 |
(set (pc) (if_then_else |
| 8468 |
(eq (reg:CCO FLAGS_REG) (const_int 0)) |
| 8469 |
(label_ref (match_operand 3)) |
| 8470 |
(pc)))] |
| 8471 |
"" |
| 8472 |
{ |
| 8473 |
ix86_fixup_binary_operands_no_copy (MINUS, <MODE>mode, operands, |
| 8474 |
TARGET_APX_NDD); |
| 8475 |
if (CONST_SCALAR_INT_P (operands[2])) |
| 8476 |
operands[4] = operands[2]; |
| 8477 |
else |
| 8478 |
operands[4] = gen_rtx_SIGN_EXTEND (<DPWI>mode, operands[2]); |
| 8479 |
}) |
| 8480 |
|
| 8481 |
(define_insn "*subv<mode>4" |
| 8482 |
[(set (reg:CCO FLAGS_REG) |
| 8483 |
(eq:CCO (minus:<DWI> |
| 8484 |
(sign_extend:<DWI> |
| 8485 |
(match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,r")) |
| 8486 |
(sign_extend:<DWI> |
| 8487 |
(match_operand:SWI 2 "<general_sext_operand>" "<r>We,m,rWe,m"))) |
| 8488 |
(sign_extend:<DWI> |
| 8489 |
(minus:SWI (match_dup 1) (match_dup 2))))) |
| 8490 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 8491 |
(minus:SWI (match_dup 1) (match_dup 2)))] |
| 8492 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8493 |
"@ |
| 8494 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8495 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8496 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8497 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8498 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 8499 |
(set_attr "type" "alu") |
| 8500 |
(set_attr "mode" "<MODE>")]) |
| 8501 |
|
| 8502 |
(define_insn "subv<mode>4_1" |
| 8503 |
[(set (reg:CCO FLAGS_REG) |
| 8504 |
(eq:CCO (minus:<DWI> |
| 8505 |
(sign_extend:<DWI> |
| 8506 |
(match_operand:SWI 1 "nonimmediate_operand" "0,rm")) |
| 8507 |
(match_operand:<DWI> 3 "const_int_operand")) |
| 8508 |
(sign_extend:<DWI> |
| 8509 |
(minus:SWI |
| 8510 |
(match_dup 1) |
| 8511 |
(match_operand:SWI 2 "x86_64_immediate_operand" "<i>,<i>"))))) |
| 8512 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 8513 |
(minus:SWI (match_dup 1) (match_dup 2)))] |
| 8514 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 8515 |
&& CONST_INT_P (operands[2]) |
| 8516 |
&& INTVAL (operands[2]) == INTVAL (operands[3])" |
| 8517 |
"@ |
| 8518 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8519 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8520 |
[(set_attr "isa" "*,apx_ndd") |
| 8521 |
(set_attr "type" "alu") |
| 8522 |
(set_attr "mode" "<MODE>") |
| 8523 |
(set (attr "length_immediate") |
| 8524 |
(cond [(match_test "IN_RANGE (INTVAL (operands[2]), -128, 127)") |
| 8525 |
(const_string "1") |
| 8526 |
(match_test "<MODE_SIZE> == 8") |
| 8527 |
(const_string "4")] |
| 8528 |
(const_string "<MODE_SIZE>")))]) |
| 8529 |
|
| 8530 |
(define_insn_and_split "*subv<dwi>4_doubleword" |
| 8531 |
[(set (reg:CCO FLAGS_REG) |
| 8532 |
(eq:CCO |
| 8533 |
(minus:<QPWI> |
| 8534 |
(sign_extend:<QPWI> |
| 8535 |
(match_operand:<DWI> 1 "nonimmediate_operand" "0,0,ro,r")) |
| 8536 |
(sign_extend:<QPWI> |
| 8537 |
(match_operand:<DWI> 2 "nonimmediate_operand" "r,o,r,o"))) |
| 8538 |
(sign_extend:<QPWI> |
| 8539 |
(minus:<DWI> (match_dup 1) (match_dup 2))))) |
| 8540 |
(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r") |
| 8541 |
(minus:<DWI> (match_dup 1) (match_dup 2)))] |
| 8542 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8543 |
"#" |
| 8544 |
"&& reload_completed" |
| 8545 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8546 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 8547 |
(set (match_dup 0) |
| 8548 |
(minus:DWIH (match_dup 1) (match_dup 2)))]) |
| 8549 |
(parallel [(set (reg:CCO FLAGS_REG) |
| 8550 |
(eq:CCO |
| 8551 |
(minus:<DWI> |
| 8552 |
(minus:<DWI> |
| 8553 |
(sign_extend:<DWI> (match_dup 4)) |
| 8554 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0))) |
| 8555 |
(sign_extend:<DWI> (match_dup 5))) |
| 8556 |
(sign_extend:<DWI> |
| 8557 |
(minus:DWIH |
| 8558 |
(minus:DWIH |
| 8559 |
(match_dup 4) |
| 8560 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) |
| 8561 |
(match_dup 5))))) |
| 8562 |
(set (match_dup 3) |
| 8563 |
(minus:DWIH |
| 8564 |
(minus:DWIH |
| 8565 |
(match_dup 4) |
| 8566 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) |
| 8567 |
(match_dup 5)))])] |
| 8568 |
{ |
| 8569 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 8570 |
} |
| 8571 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd")]) |
| 8572 |
|
| 8573 |
(define_insn_and_split "*subv<dwi>4_doubleword_1" |
| 8574 |
[(set (reg:CCO FLAGS_REG) |
| 8575 |
(eq:CCO |
| 8576 |
(minus:<QPWI> |
| 8577 |
(sign_extend:<QPWI> |
| 8578 |
(match_operand:<DWI> 1 "nonimmediate_operand" "0,ro")) |
| 8579 |
(match_operand:<QPWI> 3 "const_scalar_int_operand")) |
| 8580 |
(sign_extend:<QPWI> |
| 8581 |
(minus:<DWI> |
| 8582 |
(match_dup 1) |
| 8583 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "<di>,<di>"))))) |
| 8584 |
(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r") |
| 8585 |
(minus:<DWI> (match_dup 1) (match_dup 2)))] |
| 8586 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 8587 |
&& CONST_SCALAR_INT_P (operands[2]) |
| 8588 |
&& rtx_equal_p (operands[2], operands[3])" |
| 8589 |
"#" |
| 8590 |
"&& reload_completed" |
| 8591 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8592 |
(compare:CC (match_dup 1) (match_dup 2))) |
| 8593 |
(set (match_dup 0) |
| 8594 |
(minus:DWIH (match_dup 1) (match_dup 2)))]) |
| 8595 |
(parallel [(set (reg:CCO FLAGS_REG) |
| 8596 |
(eq:CCO |
| 8597 |
(minus:<DWI> |
| 8598 |
(minus:<DWI> |
| 8599 |
(sign_extend:<DWI> (match_dup 4)) |
| 8600 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0))) |
| 8601 |
(match_dup 5)) |
| 8602 |
(sign_extend:<DWI> |
| 8603 |
(minus:DWIH |
| 8604 |
(minus:DWIH |
| 8605 |
(match_dup 4) |
| 8606 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) |
| 8607 |
(match_dup 5))))) |
| 8608 |
(set (match_dup 3) |
| 8609 |
(minus:DWIH |
| 8610 |
(minus:DWIH |
| 8611 |
(match_dup 4) |
| 8612 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) |
| 8613 |
(match_dup 5)))])] |
| 8614 |
{ |
| 8615 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 8616 |
if (operands[2] == const0_rtx) |
| 8617 |
{ |
| 8618 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 8619 |
emit_move_insn (operands[0], operands[1]); |
| 8620 |
emit_insn (gen_subv<mode>4_1 (operands[3], operands[4], operands[5], |
| 8621 |
operands[5])); |
| 8622 |
DONE; |
| 8623 |
} |
| 8624 |
} |
| 8625 |
[(set_attr "isa" "*,apx_ndd")]) |
| 8626 |
|
| 8627 |
(define_insn "*subv<mode>4_overflow_1" |
| 8628 |
[(set (reg:CCO FLAGS_REG) |
| 8629 |
(eq:CCO |
| 8630 |
(minus:<DWI> |
| 8631 |
(minus:<DWI> |
| 8632 |
(sign_extend:<DWI> |
| 8633 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r")) |
| 8634 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 8635 |
[(match_operand 3 "flags_reg_operand") (const_int 0)])) |
| 8636 |
(sign_extend:<DWI> |
| 8637 |
(match_operand:SWI 2 "<general_sext_operand>" "rWe,m,rWe,m"))) |
| 8638 |
(sign_extend:<DWI> |
| 8639 |
(minus:SWI |
| 8640 |
(minus:SWI |
| 8641 |
(match_dup 1) |
| 8642 |
(match_operator:SWI 5 "ix86_carry_flag_operator" |
| 8643 |
[(match_dup 3) (const_int 0)])) |
| 8644 |
(match_dup 2))))) |
| 8645 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=rm,r,r,r") |
| 8646 |
(minus:SWI |
| 8647 |
(minus:SWI |
| 8648 |
(match_dup 1) |
| 8649 |
(match_op_dup 5 [(match_dup 3) (const_int 0)])) |
| 8650 |
(match_dup 2)))] |
| 8651 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8652 |
"@ |
| 8653 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8654 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8655 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8656 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8657 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 8658 |
(set_attr "type" "alu") |
| 8659 |
(set_attr "mode" "<MODE>")]) |
| 8660 |
|
| 8661 |
(define_insn "*subv<mode>4_overflow_2" |
| 8662 |
[(set (reg:CCO FLAGS_REG) |
| 8663 |
(eq:CCO |
| 8664 |
(minus:<DWI> |
| 8665 |
(minus:<DWI> |
| 8666 |
(sign_extend:<DWI> |
| 8667 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,rm")) |
| 8668 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 8669 |
[(match_operand 3 "flags_reg_operand") (const_int 0)])) |
| 8670 |
(match_operand:<DWI> 6 "const_int_operand" "n,n")) |
| 8671 |
(sign_extend:<DWI> |
| 8672 |
(minus:SWI |
| 8673 |
(minus:SWI |
| 8674 |
(match_dup 1) |
| 8675 |
(match_operator:SWI 5 "ix86_carry_flag_operator" |
| 8676 |
[(match_dup 3) (const_int 0)])) |
| 8677 |
(match_operand:SWI 2 "x86_64_immediate_operand" "e,e"))))) |
| 8678 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=rm,r") |
| 8679 |
(minus:SWI |
| 8680 |
(minus:SWI |
| 8681 |
(match_dup 1) |
| 8682 |
(match_op_dup 5 [(match_dup 3) (const_int 0)])) |
| 8683 |
(match_dup 2)))] |
| 8684 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 8685 |
&& CONST_INT_P (operands[2]) |
| 8686 |
&& INTVAL (operands[2]) == INTVAL (operands[6])" |
| 8687 |
"@ |
| 8688 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8689 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8690 |
[(set_attr "isa" "*,apx_ndd") |
| 8691 |
(set_attr "type" "alu") |
| 8692 |
(set_attr "mode" "<MODE>") |
| 8693 |
(set (attr "length_immediate") |
| 8694 |
(if_then_else (match_test "IN_RANGE (INTVAL (operands[2]), -128, 127)") |
| 8695 |
(const_string "1") |
| 8696 |
(const_string "4")))]) |
| 8697 |
|
| 8698 |
(define_expand "usubv<mode>4" |
| 8699 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8700 |
(compare:CC |
| 8701 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 8702 |
(match_operand:SWI 2 "<general_operand>"))) |
| 8703 |
(set (match_operand:SWI 0 "register_operand") |
| 8704 |
(minus:SWI (match_dup 1) (match_dup 2)))]) |
| 8705 |
(set (pc) (if_then_else |
| 8706 |
(ltu (reg:CC FLAGS_REG) (const_int 0)) |
| 8707 |
(label_ref (match_operand 3)) |
| 8708 |
(pc)))] |
| 8709 |
"" |
| 8710 |
"ix86_fixup_binary_operands_no_copy (MINUS, <MODE>mode, operands, |
| 8711 |
TARGET_APX_NDD);") |
| 8712 |
|
| 8713 |
(define_expand "sub<mode>_3" |
| 8714 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8715 |
(compare:CC |
| 8716 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 8717 |
(match_operand:SWI 2 "<general_operand>"))) |
| 8718 |
(set (match_operand:SWI 0 "register_operand") |
| 8719 |
(minus:SWI (match_dup 1) (match_dup 2)))])]) |
| 8720 |
|
| 8721 |
(define_insn "*sub<mode>_3" |
| 8722 |
[(set (reg FLAGS_REG) |
| 8723 |
(compare (match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,r") |
| 8724 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>"))) |
| 8725 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 8726 |
(minus:SWI (match_dup 1) (match_dup 2)))] |
| 8727 |
"ix86_match_ccmode (insn, CCmode) |
| 8728 |
&& ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8729 |
"@ |
| 8730 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8731 |
sub{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8732 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8733 |
sub{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8734 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 8735 |
(set_attr "type" "alu") |
| 8736 |
(set_attr "mode" "<MODE>")]) |
| 8737 |
|
| 8738 |
(define_peephole2 |
| 8739 |
[(parallel |
| 8740 |
[(set (reg:CC FLAGS_REG) |
| 8741 |
(compare:CC (match_operand:SWI 0 "general_reg_operand") |
| 8742 |
(match_operand:SWI 1 "general_gr_operand"))) |
| 8743 |
(set (match_dup 0) |
| 8744 |
(minus:SWI (match_dup 0) (match_dup 1)))])] |
| 8745 |
"find_regno_note (peep2_next_insn (0), REG_UNUSED, REGNO (operands[0])) != 0" |
| 8746 |
[(set (reg:CC FLAGS_REG) |
| 8747 |
(compare:CC (match_dup 0) (match_dup 1)))]) |
| 8748 |
|
| 8749 |
(define_peephole2 |
| 8750 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 8751 |
(match_operand:SWI 1 "memory_operand")) |
| 8752 |
(parallel [(set (reg:CC FLAGS_REG) |
| 8753 |
(compare:CC (match_dup 0) |
| 8754 |
(match_operand:SWI 2 "memory_operand"))) |
| 8755 |
(set (match_dup 0) |
| 8756 |
(minus:SWI (match_dup 0) (match_dup 2)))]) |
| 8757 |
(set (match_dup 1) (match_dup 0))] |
| 8758 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 8759 |
&& peep2_reg_dead_p (3, operands[0]) |
| 8760 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 8761 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 8762 |
[(set (match_dup 0) (match_dup 2)) |
| 8763 |
(parallel [(set (reg:CC FLAGS_REG) |
| 8764 |
(compare:CC (match_dup 1) (match_dup 0))) |
| 8765 |
(set (match_dup 1) |
| 8766 |
(minus:SWI (match_dup 1) (match_dup 0)))])]) |
| 8767 |
|
| 8768 |
;; decl %eax; cmpl $-1, %eax; jne .Lxx; can be optimized into |
| 8769 |
;; subl $1, %eax; jnc .Lxx; |
| 8770 |
(define_peephole2 |
| 8771 |
[(parallel |
| 8772 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 8773 |
(plus:SWI (match_dup 0) (const_int -1))) |
| 8774 |
(clobber (reg FLAGS_REG))]) |
| 8775 |
(set (reg:CCZ FLAGS_REG) |
| 8776 |
(compare:CCZ (match_dup 0) (const_int -1))) |
| 8777 |
(set (pc) |
| 8778 |
(if_then_else (match_operator 1 "bt_comparison_operator" |
| 8779 |
[(reg:CCZ FLAGS_REG) (const_int 0)]) |
| 8780 |
(match_operand 2) |
| 8781 |
(pc)))] |
| 8782 |
"peep2_regno_dead_p (3, FLAGS_REG)" |
| 8783 |
[(parallel |
| 8784 |
[(set (reg:CC FLAGS_REG) |
| 8785 |
(compare:CC (match_dup 0) (const_int 1))) |
| 8786 |
(set (match_dup 0) |
| 8787 |
(minus:SWI (match_dup 0) (const_int 1)))]) |
| 8788 |
(set (pc) |
| 8789 |
(if_then_else (match_dup 3) |
| 8790 |
(match_dup 2) |
| 8791 |
(pc)))] |
| 8792 |
{ |
| 8793 |
rtx cc = gen_rtx_REG (CCmode, FLAGS_REG); |
| 8794 |
operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[1]) == NE |
| 8795 |
? GEU : LTU, VOIDmode, cc, const0_rtx); |
| 8796 |
}) |
| 8797 |
|
| 8798 |
;; Help combine use borrow flag to test for -1 after dec (add $-1). |
| 8799 |
(define_insn_and_split "*dec_cmov<mode>" |
| 8800 |
[(set (match_operand:SWI248 0 "register_operand" "=r") |
| 8801 |
(if_then_else:SWI248 |
| 8802 |
(match_operator 1 "bt_comparison_operator" |
| 8803 |
[(match_operand:SWI248 2 "register_operand" "0") (const_int 0)]) |
| 8804 |
(plus:SWI248 (match_dup 2) (const_int -1)) |
| 8805 |
(match_operand:SWI248 3 "nonimmediate_operand" "rm"))) |
| 8806 |
(clobber (reg:CC FLAGS_REG))] |
| 8807 |
"TARGET_CMOVE" |
| 8808 |
"#" |
| 8809 |
"&& reload_completed" |
| 8810 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 8811 |
(compare:CC (match_dup 2) (const_int 1))) |
| 8812 |
(set (match_dup 0) (minus:SWI248 (match_dup 2) (const_int 1)))]) |
| 8813 |
(set (match_dup 0) |
| 8814 |
(if_then_else:SWI248 (match_dup 4) (match_dup 0) (match_dup 3)))] |
| 8815 |
{ |
| 8816 |
rtx cc = gen_rtx_REG (CCCmode, FLAGS_REG); |
| 8817 |
operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[1]) == NE |
| 8818 |
? GEU : LTU, VOIDmode, cc, const0_rtx); |
| 8819 |
}) |
| 8820 |
|
| 8821 |
(define_insn "*subsi_3_zext" |
| 8822 |
[(set (reg FLAGS_REG) |
| 8823 |
(compare (match_operand:SI 1 "nonimmediate_operand" "0,r,rm") |
| 8824 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re"))) |
| 8825 |
(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 8826 |
(zero_extend:DI |
| 8827 |
(minus:SI (match_dup 1) |
| 8828 |
(match_dup 2))))] |
| 8829 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCmode) |
| 8830 |
&& ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)" |
| 8831 |
"@ |
| 8832 |
sub{l}\t{%2, %1|%1, %2} |
| 8833 |
sub{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 8834 |
sub{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 8835 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 8836 |
(set_attr "type" "alu") |
| 8837 |
(set_attr "mode" "SI")]) |
| 8838 |
|
| 8839 |
;; Add with carry and subtract with borrow |
| 8840 |
|
| 8841 |
(define_insn "@add<mode>3_carry" |
| 8842 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 8843 |
(plus:SWI |
| 8844 |
(plus:SWI |
| 8845 |
(match_operator:SWI 4 "ix86_carry_flag_operator" |
| 8846 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 8847 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r")) |
| 8848 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>"))) |
| 8849 |
(clobber (reg:CC FLAGS_REG))] |
| 8850 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 8851 |
"@ |
| 8852 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8853 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 8854 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 8855 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 8856 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 8857 |
(set_attr "type" "alu") |
| 8858 |
(set_attr "use_carry" "1") |
| 8859 |
(set_attr "pent_pair" "pu") |
| 8860 |
(set_attr "mode" "<MODE>")]) |
| 8861 |
|
| 8862 |
(define_peephole2 |
| 8863 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 8864 |
(match_operand:SWI 1 "memory_operand")) |
| 8865 |
(parallel [(set (match_dup 0) |
| 8866 |
(plus:SWI |
| 8867 |
(plus:SWI |
| 8868 |
(match_operator:SWI 4 "ix86_carry_flag_operator" |
| 8869 |
[(match_operand 3 "flags_reg_operand") |
| 8870 |
(const_int 0)]) |
| 8871 |
(match_dup 0)) |
| 8872 |
(match_operand:SWI 2 "memory_operand"))) |
| 8873 |
(clobber (reg:CC FLAGS_REG))]) |
| 8874 |
(set (match_dup 1) (match_dup 0))] |
| 8875 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 8876 |
&& peep2_reg_dead_p (3, operands[0]) |
| 8877 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 8878 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 8879 |
[(set (match_dup 0) (match_dup 2)) |
| 8880 |
(parallel [(set (match_dup 1) |
| 8881 |
(plus:SWI (plus:SWI (match_op_dup 4 |
| 8882 |
[(match_dup 3) (const_int 0)]) |
| 8883 |
(match_dup 1)) |
| 8884 |
(match_dup 0))) |
| 8885 |
(clobber (reg:CC FLAGS_REG))])]) |
| 8886 |
|
| 8887 |
(define_peephole2 |
| 8888 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 8889 |
(match_operand:SWI 1 "memory_operand")) |
| 8890 |
(parallel [(set (match_dup 0) |
| 8891 |
(plus:SWI |
| 8892 |
(plus:SWI |
| 8893 |
(match_operator:SWI 4 "ix86_carry_flag_operator" |
| 8894 |
[(match_operand 3 "flags_reg_operand") |
| 8895 |
(const_int 0)]) |
| 8896 |
(match_dup 0)) |
| 8897 |
(match_operand:SWI 2 "memory_operand"))) |
| 8898 |
(clobber (reg:CC FLAGS_REG))]) |
| 8899 |
(set (match_operand:SWI 5 "general_reg_operand") (match_dup 0)) |
| 8900 |
(set (match_dup 1) (match_dup 5))] |
| 8901 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 8902 |
&& peep2_reg_dead_p (3, operands[0]) |
| 8903 |
&& peep2_reg_dead_p (4, operands[5]) |
| 8904 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 8905 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 8906 |
&& !reg_overlap_mentioned_p (operands[5], operands[1])" |
| 8907 |
[(set (match_dup 0) (match_dup 2)) |
| 8908 |
(parallel [(set (match_dup 1) |
| 8909 |
(plus:SWI (plus:SWI (match_op_dup 4 |
| 8910 |
[(match_dup 3) (const_int 0)]) |
| 8911 |
(match_dup 1)) |
| 8912 |
(match_dup 0))) |
| 8913 |
(clobber (reg:CC FLAGS_REG))])]) |
| 8914 |
|
| 8915 |
(define_insn "*add<mode>3_carry_0" |
| 8916 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") |
| 8917 |
(plus:SWI |
| 8918 |
(match_operator:SWI 2 "ix86_carry_flag_operator" |
| 8919 |
[(reg FLAGS_REG) (const_int 0)]) |
| 8920 |
(match_operand:SWI 1 "nonimmediate_operand" "0"))) |
| 8921 |
(clobber (reg:CC FLAGS_REG))] |
| 8922 |
"!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[1])" |
| 8923 |
"adc{<imodesuffix>}\t{$0, %0|%0, 0}" |
| 8924 |
[(set_attr "type" "alu") |
| 8925 |
(set_attr "use_carry" "1") |
| 8926 |
(set_attr "pent_pair" "pu") |
| 8927 |
(set_attr "mode" "<MODE>")]) |
| 8928 |
|
| 8929 |
(define_insn "*add<mode>3_carry_0r" |
| 8930 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") |
| 8931 |
(plus:SWI |
| 8932 |
(match_operator:SWI 2 "ix86_carry_flag_unset_operator" |
| 8933 |
[(reg FLAGS_REG) (const_int 0)]) |
| 8934 |
(match_operand:SWI 1 "nonimmediate_operand" "0"))) |
| 8935 |
(clobber (reg:CC FLAGS_REG))] |
| 8936 |
"!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[1])" |
| 8937 |
"sbb{<imodesuffix>}\t{$-1, %0|%0, -1}" |
| 8938 |
[(set_attr "type" "alu") |
| 8939 |
(set_attr "use_carry" "1") |
| 8940 |
(set_attr "pent_pair" "pu") |
| 8941 |
(set_attr "mode" "<MODE>")]) |
| 8942 |
|
| 8943 |
(define_insn "*addqi3_carry_zext<mode>" |
| 8944 |
[(set (match_operand:SWI248x 0 "register_operand" "=r,r") |
| 8945 |
(zero_extend:SWI248x |
| 8946 |
(plus:QI |
| 8947 |
(plus:QI (match_operator:QI 3 "ix86_carry_flag_operator" |
| 8948 |
[(reg FLAGS_REG) (const_int 0)]) |
| 8949 |
(match_operand:QI 1 "nonimmediate_operand" "%rm,r")) |
| 8950 |
(match_operand:QI 2 "x86_64_general_operand" "rn,m")))) |
| 8951 |
(clobber (reg:CC FLAGS_REG))] |
| 8952 |
"TARGET_APX_NDD |
| 8953 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 8954 |
"@ |
| 8955 |
adc{b}\t{%2, %1, %b0|%b0, %1, %2} |
| 8956 |
adc{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 8957 |
[(set_attr "type" "alu") |
| 8958 |
(set_attr "use_carry" "1") |
| 8959 |
(set_attr "pent_pair" "pu") |
| 8960 |
(set_attr "mode" "QI")]) |
| 8961 |
|
| 8962 |
(define_insn "*addhi3_carry_zext<mode>" |
| 8963 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 8964 |
(zero_extend:SWI48x |
| 8965 |
(plus:HI |
| 8966 |
(plus:HI (match_operator:HI 3 "ix86_carry_flag_operator" |
| 8967 |
[(reg FLAGS_REG) (const_int 0)]) |
| 8968 |
(match_operand:HI 1 "nonimmediate_operand" "%rm,r")) |
| 8969 |
(match_operand:HI 2 "x86_64_general_operand" "rn,m")))) |
| 8970 |
(clobber (reg:CC FLAGS_REG))] |
| 8971 |
"TARGET_APX_NDD |
| 8972 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 8973 |
"@ |
| 8974 |
adc{w}\t{%2, %1, %w0|%w0, %1, %2} |
| 8975 |
adc{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 8976 |
[(set_attr "type" "alu") |
| 8977 |
(set_attr "use_carry" "1") |
| 8978 |
(set_attr "pent_pair" "pu") |
| 8979 |
(set_attr "mode" "HI")]) |
| 8980 |
|
| 8981 |
(define_insn "*addsi3_carry_zext" |
| 8982 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 8983 |
(zero_extend:DI |
| 8984 |
(plus:SI |
| 8985 |
(plus:SI (match_operator:SI 3 "ix86_carry_flag_operator" |
| 8986 |
[(reg FLAGS_REG) (const_int 0)]) |
| 8987 |
(match_operand:SI 1 "nonimmediate_operand" "%0,r,rm")) |
| 8988 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re")))) |
| 8989 |
(clobber (reg:CC FLAGS_REG))] |
| 8990 |
"TARGET_64BIT |
| 8991 |
&& ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" |
| 8992 |
"@ |
| 8993 |
adc{l}\t{%2, %k0|%k0, %2} |
| 8994 |
adc{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 8995 |
adc{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 8996 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 8997 |
(set_attr "type" "alu") |
| 8998 |
(set_attr "use_carry" "1") |
| 8999 |
(set_attr "pent_pair" "pu") |
| 9000 |
(set_attr "mode" "SI")]) |
| 9001 |
|
| 9002 |
(define_insn "*addqi3_carry_zext<mode>_0" |
| 9003 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 9004 |
(zero_extend:SWI248x |
| 9005 |
(plus:QI (match_operator:QI 2 "ix86_carry_flag_operator" |
| 9006 |
[(reg FLAGS_REG) (const_int 0)]) |
| 9007 |
(match_operand:QI 1 "nonimmediate_operand" "rm")))) |
| 9008 |
(clobber (reg:CC FLAGS_REG))] |
| 9009 |
"TARGET_APX_NDD" |
| 9010 |
"adc{b}\t{$0, %1, %b0|%b0, %1, 0}" |
| 9011 |
[(set_attr "type" "alu") |
| 9012 |
(set_attr "use_carry" "1") |
| 9013 |
(set_attr "pent_pair" "pu") |
| 9014 |
(set_attr "mode" "QI")]) |
| 9015 |
|
| 9016 |
(define_insn "*addhi3_carry_zext<mode>_0" |
| 9017 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 9018 |
(zero_extend:SWI48x |
| 9019 |
(plus:HI (match_operator:HI 2 "ix86_carry_flag_operator" |
| 9020 |
[(reg FLAGS_REG) (const_int 0)]) |
| 9021 |
(match_operand:HI 1 "nonimmediate_operand" "rm")))) |
| 9022 |
(clobber (reg:CC FLAGS_REG))] |
| 9023 |
"TARGET_APX_NDD" |
| 9024 |
"adc{w}\t{$0, %1, %w0|%w0, %1, 0}" |
| 9025 |
[(set_attr "type" "alu") |
| 9026 |
(set_attr "use_carry" "1") |
| 9027 |
(set_attr "pent_pair" "pu") |
| 9028 |
(set_attr "mode" "HI")]) |
| 9029 |
|
| 9030 |
(define_insn "*addsi3_carry_zext_0" |
| 9031 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 9032 |
(zero_extend:DI |
| 9033 |
(plus:SI (match_operator:SI 2 "ix86_carry_flag_operator" |
| 9034 |
[(reg FLAGS_REG) (const_int 0)]) |
| 9035 |
(match_operand:SI 1 "nonimmediate_operand" "0,rm")))) |
| 9036 |
(clobber (reg:CC FLAGS_REG))] |
| 9037 |
"TARGET_64BIT" |
| 9038 |
"@ |
| 9039 |
adc{l}\t{$0, %k0|%k0, 0} |
| 9040 |
adc{l}\t{$0, %1, %k0|%k0, %1, 0}" |
| 9041 |
[(set_attr "isa" "*,apx_ndd") |
| 9042 |
(set_attr "type" "alu") |
| 9043 |
(set_attr "use_carry" "1") |
| 9044 |
(set_attr "pent_pair" "pu") |
| 9045 |
(set_attr "mode" "SI")]) |
| 9046 |
|
| 9047 |
(define_insn "*addqi3_carry_zext<mode>_0r" |
| 9048 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 9049 |
(zero_extend:SWI248x |
| 9050 |
(plus:QI (match_operator:QI 2 "ix86_carry_flag_unset_operator" |
| 9051 |
[(reg FLAGS_REG) (const_int 0)]) |
| 9052 |
(match_operand:QI 1 "nonimmediate_operand" "rm")))) |
| 9053 |
(clobber (reg:CC FLAGS_REG))] |
| 9054 |
"TARGET_APX_NDD" |
| 9055 |
"sbb{b}\t{$-1, %1, %b0|%b0, %1, -1}" |
| 9056 |
[(set_attr "type" "alu") |
| 9057 |
(set_attr "use_carry" "1") |
| 9058 |
(set_attr "pent_pair" "pu") |
| 9059 |
(set_attr "mode" "QI")]) |
| 9060 |
|
| 9061 |
(define_insn "*addhi3_carry_zext<mode>_0r" |
| 9062 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 9063 |
(zero_extend:SWI48x |
| 9064 |
(plus:HI (match_operator:HI 2 "ix86_carry_flag_unset_operator" |
| 9065 |
[(reg FLAGS_REG) (const_int 0)]) |
| 9066 |
(match_operand:HI 1 "nonimmediate_operand" "rm")))) |
| 9067 |
(clobber (reg:CC FLAGS_REG))] |
| 9068 |
"TARGET_APX_NDD" |
| 9069 |
"sbb{w}\t{$-1, %1, %w0|%w0, %1, -1}" |
| 9070 |
[(set_attr "type" "alu") |
| 9071 |
(set_attr "use_carry" "1") |
| 9072 |
(set_attr "pent_pair" "pu") |
| 9073 |
(set_attr "mode" "HI")]) |
| 9074 |
|
| 9075 |
(define_insn "*addsi3_carry_zext_0r" |
| 9076 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 9077 |
(zero_extend:DI |
| 9078 |
(plus:SI (match_operator:SI 2 "ix86_carry_flag_unset_operator" |
| 9079 |
[(reg FLAGS_REG) (const_int 0)]) |
| 9080 |
(match_operand:SI 1 "nonimmediate_operand" "0,rm")))) |
| 9081 |
(clobber (reg:CC FLAGS_REG))] |
| 9082 |
"TARGET_64BIT" |
| 9083 |
"@ |
| 9084 |
sbb{l}\t{$-1, %k0|%k0, -1} |
| 9085 |
sbb{l}\t{$-1, %1, %k0|%k0, %1, -1}" |
| 9086 |
[(set_attr "isa" "*,apx_ndd") |
| 9087 |
(set_attr "type" "alu") |
| 9088 |
(set_attr "use_carry" "1") |
| 9089 |
(set_attr "pent_pair" "pu") |
| 9090 |
(set_attr "mode" "SI")]) |
| 9091 |
|
| 9092 |
;; There is no point to generate ADCX instruction. ADC is shorter and faster. |
| 9093 |
|
| 9094 |
(define_insn "addcarry<mode>" |
| 9095 |
[(set (reg:CCC FLAGS_REG) |
| 9096 |
(compare:CCC |
| 9097 |
(zero_extend:<DWI> |
| 9098 |
(plus:SWI48 |
| 9099 |
(plus:SWI48 |
| 9100 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9101 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9102 |
(match_operand:SWI48 1 "nonimmediate_operand" "%0,0,rm,r")) |
| 9103 |
(match_operand:SWI48 2 "nonimmediate_operand" "r,rm,r,m"))) |
| 9104 |
(plus:<DWI> |
| 9105 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9106 |
[(match_dup 3) (const_int 0)]) |
| 9107 |
(zero_extend:<DWI> (match_dup 2))))) |
| 9108 |
(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r") |
| 9109 |
(plus:SWI48 (plus:SWI48 (match_op_dup 5 |
| 9110 |
[(match_dup 3) (const_int 0)]) |
| 9111 |
(match_dup 1)) |
| 9112 |
(match_dup 2)))] |
| 9113 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 9114 |
"@ |
| 9115 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9116 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9117 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 9118 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 9119 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 9120 |
(set_attr "type" "alu") |
| 9121 |
(set_attr "use_carry" "1") |
| 9122 |
(set_attr "pent_pair" "pu") |
| 9123 |
(set_attr "mode" "<MODE>")]) |
| 9124 |
|
| 9125 |
(define_peephole2 |
| 9126 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 9127 |
(compare:CCC |
| 9128 |
(zero_extend:<DWI> |
| 9129 |
(plus:SWI48 |
| 9130 |
(plus:SWI48 |
| 9131 |
(match_operator:SWI48 4 "ix86_carry_flag_operator" |
| 9132 |
[(match_operand 2 "flags_reg_operand") |
| 9133 |
(const_int 0)]) |
| 9134 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 9135 |
(match_operand:SWI48 1 "memory_operand"))) |
| 9136 |
(plus:<DWI> |
| 9137 |
(match_operator:<DWI> 3 "ix86_carry_flag_operator" |
| 9138 |
[(match_dup 2) (const_int 0)]) |
| 9139 |
(zero_extend:<DWI> (match_dup 1))))) |
| 9140 |
(set (match_dup 0) |
| 9141 |
(plus:SWI48 (plus:SWI48 (match_op_dup 4 |
| 9142 |
[(match_dup 2) (const_int 0)]) |
| 9143 |
(match_dup 0)) |
| 9144 |
(match_dup 1)))]) |
| 9145 |
(set (match_dup 1) (match_dup 0))] |
| 9146 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9147 |
&& peep2_reg_dead_p (2, operands[0]) |
| 9148 |
&& !reg_overlap_mentioned_p (operands[0], operands[1])" |
| 9149 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 9150 |
(compare:CCC |
| 9151 |
(zero_extend:<DWI> |
| 9152 |
(plus:SWI48 |
| 9153 |
(plus:SWI48 |
| 9154 |
(match_op_dup 4 |
| 9155 |
[(match_dup 2) (const_int 0)]) |
| 9156 |
(match_dup 1)) |
| 9157 |
(match_dup 0))) |
| 9158 |
(plus:<DWI> |
| 9159 |
(match_op_dup 3 |
| 9160 |
[(match_dup 2) (const_int 0)]) |
| 9161 |
(zero_extend:<DWI> (match_dup 0))))) |
| 9162 |
(set (match_dup 1) |
| 9163 |
(plus:SWI48 (plus:SWI48 (match_op_dup 4 |
| 9164 |
[(match_dup 2) (const_int 0)]) |
| 9165 |
(match_dup 1)) |
| 9166 |
(match_dup 0)))])]) |
| 9167 |
|
| 9168 |
(define_peephole2 |
| 9169 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 9170 |
(match_operand:SWI48 1 "memory_operand")) |
| 9171 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9172 |
(compare:CCC |
| 9173 |
(zero_extend:<DWI> |
| 9174 |
(plus:SWI48 |
| 9175 |
(plus:SWI48 |
| 9176 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9177 |
[(match_operand 3 "flags_reg_operand") |
| 9178 |
(const_int 0)]) |
| 9179 |
(match_dup 0)) |
| 9180 |
(match_operand:SWI48 2 "memory_operand"))) |
| 9181 |
(plus:<DWI> |
| 9182 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9183 |
[(match_dup 3) (const_int 0)]) |
| 9184 |
(zero_extend:<DWI> (match_dup 2))))) |
| 9185 |
(set (match_dup 0) |
| 9186 |
(plus:SWI48 (plus:SWI48 (match_op_dup 5 |
| 9187 |
[(match_dup 3) (const_int 0)]) |
| 9188 |
(match_dup 0)) |
| 9189 |
(match_dup 2)))]) |
| 9190 |
(set (match_dup 1) (match_dup 0))] |
| 9191 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9192 |
&& peep2_reg_dead_p (3, operands[0]) |
| 9193 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9194 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 9195 |
[(set (match_dup 0) (match_dup 2)) |
| 9196 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9197 |
(compare:CCC |
| 9198 |
(zero_extend:<DWI> |
| 9199 |
(plus:SWI48 |
| 9200 |
(plus:SWI48 |
| 9201 |
(match_op_dup 5 |
| 9202 |
[(match_dup 3) (const_int 0)]) |
| 9203 |
(match_dup 1)) |
| 9204 |
(match_dup 0))) |
| 9205 |
(plus:<DWI> |
| 9206 |
(match_op_dup 4 |
| 9207 |
[(match_dup 3) (const_int 0)]) |
| 9208 |
(zero_extend:<DWI> (match_dup 0))))) |
| 9209 |
(set (match_dup 1) |
| 9210 |
(plus:SWI48 (plus:SWI48 (match_op_dup 5 |
| 9211 |
[(match_dup 3) (const_int 0)]) |
| 9212 |
(match_dup 1)) |
| 9213 |
(match_dup 0)))])]) |
| 9214 |
|
| 9215 |
(define_peephole2 |
| 9216 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 9217 |
(compare:CCC |
| 9218 |
(zero_extend:<DWI> |
| 9219 |
(plus:SWI48 |
| 9220 |
(plus:SWI48 |
| 9221 |
(match_operator:SWI48 4 "ix86_carry_flag_operator" |
| 9222 |
[(match_operand 2 "flags_reg_operand") |
| 9223 |
(const_int 0)]) |
| 9224 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 9225 |
(match_operand:SWI48 1 "memory_operand"))) |
| 9226 |
(plus:<DWI> |
| 9227 |
(match_operator:<DWI> 3 "ix86_carry_flag_operator" |
| 9228 |
[(match_dup 2) (const_int 0)]) |
| 9229 |
(zero_extend:<DWI> (match_dup 1))))) |
| 9230 |
(set (match_dup 0) |
| 9231 |
(plus:SWI48 (plus:SWI48 (match_op_dup 4 |
| 9232 |
[(match_dup 2) (const_int 0)]) |
| 9233 |
(match_dup 0)) |
| 9234 |
(match_dup 1)))]) |
| 9235 |
(set (match_operand:QI 5 "general_reg_operand") |
| 9236 |
(ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 9237 |
(set (match_operand:SWI48 6 "general_reg_operand") |
| 9238 |
(zero_extend:SWI48 (match_dup 5))) |
| 9239 |
(set (match_dup 1) (match_dup 0))] |
| 9240 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9241 |
&& peep2_reg_dead_p (4, operands[0]) |
| 9242 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9243 |
&& !reg_overlap_mentioned_p (operands[0], operands[5]) |
| 9244 |
&& !reg_overlap_mentioned_p (operands[5], operands[1]) |
| 9245 |
&& !reg_overlap_mentioned_p (operands[0], operands[6]) |
| 9246 |
&& !reg_overlap_mentioned_p (operands[6], operands[1])" |
| 9247 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 9248 |
(compare:CCC |
| 9249 |
(zero_extend:<DWI> |
| 9250 |
(plus:SWI48 |
| 9251 |
(plus:SWI48 |
| 9252 |
(match_op_dup 4 |
| 9253 |
[(match_dup 2) (const_int 0)]) |
| 9254 |
(match_dup 1)) |
| 9255 |
(match_dup 0))) |
| 9256 |
(plus:<DWI> |
| 9257 |
(match_op_dup 3 |
| 9258 |
[(match_dup 2) (const_int 0)]) |
| 9259 |
(zero_extend:<DWI> (match_dup 0))))) |
| 9260 |
(set (match_dup 1) |
| 9261 |
(plus:SWI48 (plus:SWI48 (match_op_dup 4 |
| 9262 |
[(match_dup 2) (const_int 0)]) |
| 9263 |
(match_dup 1)) |
| 9264 |
(match_dup 0)))]) |
| 9265 |
(set (match_dup 5) (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 9266 |
(set (match_dup 6) (zero_extend:SWI48 (match_dup 5)))]) |
| 9267 |
|
| 9268 |
(define_expand "addcarry<mode>_0" |
| 9269 |
[(parallel |
| 9270 |
[(set (reg:CCC FLAGS_REG) |
| 9271 |
(compare:CCC |
| 9272 |
(plus:SWI48 |
| 9273 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 9274 |
(match_operand:SWI48 2 "x86_64_general_operand")) |
| 9275 |
(match_dup 1))) |
| 9276 |
(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 9277 |
(plus:SWI48 (match_dup 1) (match_dup 2)))])] |
| 9278 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)") |
| 9279 |
|
| 9280 |
(define_insn "*addcarry<mode>_1" |
| 9281 |
[(set (reg:CCC FLAGS_REG) |
| 9282 |
(compare:CCC |
| 9283 |
(zero_extend:<DWI> |
| 9284 |
(plus:SWI48 |
| 9285 |
(plus:SWI48 |
| 9286 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9287 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9288 |
(match_operand:SWI48 1 "nonimmediate_operand" "%0,rm")) |
| 9289 |
(match_operand:SWI48 2 "x86_64_immediate_operand" "e,e"))) |
| 9290 |
(plus:<DWI> |
| 9291 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9292 |
[(match_dup 3) (const_int 0)]) |
| 9293 |
(match_operand:<DWI> 6 "const_scalar_int_operand")))) |
| 9294 |
(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r") |
| 9295 |
(plus:SWI48 (plus:SWI48 (match_op_dup 5 |
| 9296 |
[(match_dup 3) (const_int 0)]) |
| 9297 |
(match_dup 1)) |
| 9298 |
(match_dup 2)))] |
| 9299 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 9300 |
&& CONST_INT_P (operands[2]) |
| 9301 |
/* Check that operands[6] is operands[2] zero extended from |
| 9302 |
<MODE>mode to <DWI>mode. */ |
| 9303 |
&& ((<MODE>mode == SImode || INTVAL (operands[2]) >= 0) |
| 9304 |
? (CONST_INT_P (operands[6]) |
| 9305 |
&& UINTVAL (operands[6]) == (UINTVAL (operands[2]) |
| 9306 |
& GET_MODE_MASK (<MODE>mode))) |
| 9307 |
: (CONST_WIDE_INT_P (operands[6]) |
| 9308 |
&& CONST_WIDE_INT_NUNITS (operands[6]) == 2 |
| 9309 |
&& ((unsigned HOST_WIDE_INT) CONST_WIDE_INT_ELT (operands[6], 0) |
| 9310 |
== UINTVAL (operands[2])) |
| 9311 |
&& CONST_WIDE_INT_ELT (operands[6], 1) == 0))" |
| 9312 |
"@ |
| 9313 |
adc{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9314 |
adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 9315 |
[(set_attr "isa" "*,apx_ndd") |
| 9316 |
(set_attr "type" "alu") |
| 9317 |
(set_attr "use_carry" "1") |
| 9318 |
(set_attr "pent_pair" "pu") |
| 9319 |
(set_attr "mode" "<MODE>") |
| 9320 |
(set (attr "length_immediate") |
| 9321 |
(if_then_else (match_test "IN_RANGE (INTVAL (operands[2]), -128, 127)") |
| 9322 |
(const_string "1") |
| 9323 |
(const_string "4")))]) |
| 9324 |
|
| 9325 |
(define_insn "@sub<mode>3_carry" |
| 9326 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 9327 |
(minus:SWI |
| 9328 |
(minus:SWI |
| 9329 |
(match_operand:SWI 1 "nonimmediate_operand" "0,0,rm,r") |
| 9330 |
(match_operator:SWI 4 "ix86_carry_flag_operator" |
| 9331 |
[(match_operand 3 "flags_reg_operand") (const_int 0)])) |
| 9332 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>"))) |
| 9333 |
(clobber (reg:CC FLAGS_REG))] |
| 9334 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 9335 |
"@ |
| 9336 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9337 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9338 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 9339 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 9340 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 9341 |
(set_attr "type" "alu") |
| 9342 |
(set_attr "use_carry" "1") |
| 9343 |
(set_attr "pent_pair" "pu") |
| 9344 |
(set_attr "mode" "<MODE>")]) |
| 9345 |
|
| 9346 |
(define_peephole2 |
| 9347 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 9348 |
(match_operand:SWI 1 "memory_operand")) |
| 9349 |
(parallel [(set (match_dup 0) |
| 9350 |
(minus:SWI |
| 9351 |
(minus:SWI |
| 9352 |
(match_dup 0) |
| 9353 |
(match_operator:SWI 4 "ix86_carry_flag_operator" |
| 9354 |
[(match_operand 3 "flags_reg_operand") |
| 9355 |
(const_int 0)])) |
| 9356 |
(match_operand:SWI 2 "memory_operand"))) |
| 9357 |
(clobber (reg:CC FLAGS_REG))]) |
| 9358 |
(set (match_dup 1) (match_dup 0))] |
| 9359 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9360 |
&& peep2_reg_dead_p (3, operands[0]) |
| 9361 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9362 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 9363 |
[(set (match_dup 0) (match_dup 2)) |
| 9364 |
(parallel [(set (match_dup 1) |
| 9365 |
(minus:SWI (minus:SWI (match_dup 1) |
| 9366 |
(match_op_dup 4 |
| 9367 |
[(match_dup 3) (const_int 0)])) |
| 9368 |
(match_dup 0))) |
| 9369 |
(clobber (reg:CC FLAGS_REG))])]) |
| 9370 |
|
| 9371 |
(define_peephole2 |
| 9372 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 9373 |
(match_operand:SWI 1 "memory_operand")) |
| 9374 |
(parallel [(set (match_dup 0) |
| 9375 |
(minus:SWI |
| 9376 |
(minus:SWI |
| 9377 |
(match_dup 0) |
| 9378 |
(match_operator:SWI 4 "ix86_carry_flag_operator" |
| 9379 |
[(match_operand 3 "flags_reg_operand") |
| 9380 |
(const_int 0)])) |
| 9381 |
(match_operand:SWI 2 "memory_operand"))) |
| 9382 |
(clobber (reg:CC FLAGS_REG))]) |
| 9383 |
(set (match_operand:SWI 5 "general_reg_operand") (match_dup 0)) |
| 9384 |
(set (match_dup 1) (match_dup 5))] |
| 9385 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9386 |
&& peep2_reg_dead_p (3, operands[0]) |
| 9387 |
&& peep2_reg_dead_p (4, operands[5]) |
| 9388 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9389 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 9390 |
&& !reg_overlap_mentioned_p (operands[5], operands[1])" |
| 9391 |
[(set (match_dup 0) (match_dup 2)) |
| 9392 |
(parallel [(set (match_dup 1) |
| 9393 |
(minus:SWI (minus:SWI (match_dup 1) |
| 9394 |
(match_op_dup 4 |
| 9395 |
[(match_dup 3) (const_int 0)])) |
| 9396 |
(match_dup 0))) |
| 9397 |
(clobber (reg:CC FLAGS_REG))])]) |
| 9398 |
|
| 9399 |
(define_insn "*sub<mode>3_carry_0" |
| 9400 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") |
| 9401 |
(minus:SWI |
| 9402 |
(match_operand:SWI 1 "nonimmediate_operand" "0") |
| 9403 |
(match_operator:SWI 2 "ix86_carry_flag_operator" |
| 9404 |
[(reg FLAGS_REG) (const_int 0)]))) |
| 9405 |
(clobber (reg:CC FLAGS_REG))] |
| 9406 |
"!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[1])" |
| 9407 |
"sbb{<imodesuffix>}\t{$0, %0|%0, 0}" |
| 9408 |
[(set_attr "type" "alu") |
| 9409 |
(set_attr "use_carry" "1") |
| 9410 |
(set_attr "pent_pair" "pu") |
| 9411 |
(set_attr "mode" "<MODE>")]) |
| 9412 |
|
| 9413 |
(define_insn "*sub<mode>3_carry_0r" |
| 9414 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") |
| 9415 |
(minus:SWI |
| 9416 |
(match_operand:SWI 1 "nonimmediate_operand" "0") |
| 9417 |
(match_operator:SWI 2 "ix86_carry_flag_unset_operator" |
| 9418 |
[(reg FLAGS_REG) (const_int 0)]))) |
| 9419 |
(clobber (reg:CC FLAGS_REG))] |
| 9420 |
"!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[1])" |
| 9421 |
"adc{<imodesuffix>}\t{$-1, %0|%0, -1}" |
| 9422 |
[(set_attr "type" "alu") |
| 9423 |
(set_attr "use_carry" "1") |
| 9424 |
(set_attr "pent_pair" "pu") |
| 9425 |
(set_attr "mode" "<MODE>")]) |
| 9426 |
|
| 9427 |
(define_insn "*subqi3_carry_zext<mode>" |
| 9428 |
[(set (match_operand:SWI248x 0 "register_operand" "=r,r") |
| 9429 |
(zero_extend:SWI248x |
| 9430 |
(minus:QI |
| 9431 |
(minus:QI |
| 9432 |
(match_operand:QI 1 "nonimmediate_operand" "r,rm") |
| 9433 |
(match_operator:QI 3 "ix86_carry_flag_operator" |
| 9434 |
[(reg FLAGS_REG) (const_int 0)])) |
| 9435 |
(match_operand:QI 2 "x86_64_general_operand" "rBMe,re")))) |
| 9436 |
(clobber (reg:CC FLAGS_REG))] |
| 9437 |
"TARGET_APX_NDD |
| 9438 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 9439 |
"@ |
| 9440 |
sbb{b}\t{%2, %1, %b0|%b0, %1, %2} |
| 9441 |
sbb{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 9442 |
[(set_attr "type" "alu") |
| 9443 |
(set_attr "use_carry" "1") |
| 9444 |
(set_attr "pent_pair" "pu") |
| 9445 |
(set_attr "mode" "QI")]) |
| 9446 |
|
| 9447 |
(define_insn "*subhi3_carry_zext<mode>" |
| 9448 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 9449 |
(zero_extend:SWI48x |
| 9450 |
(minus:HI |
| 9451 |
(minus:HI |
| 9452 |
(match_operand:HI 1 "nonimmediate_operand" "r,rm") |
| 9453 |
(match_operator:HI 3 "ix86_carry_flag_operator" |
| 9454 |
[(reg FLAGS_REG) (const_int 0)])) |
| 9455 |
(match_operand:HI 2 "x86_64_general_operand" "rBMe,re")))) |
| 9456 |
(clobber (reg:CC FLAGS_REG))] |
| 9457 |
"TARGET_APX_NDD |
| 9458 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 9459 |
"@ |
| 9460 |
sbb{w}\t{%2, %1, %w0|%w0, %1, %2} |
| 9461 |
sbb{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 9462 |
[(set_attr "type" "alu") |
| 9463 |
(set_attr "use_carry" "1") |
| 9464 |
(set_attr "pent_pair" "pu") |
| 9465 |
(set_attr "mode" "HI")]) |
| 9466 |
|
| 9467 |
(define_insn "*subsi3_carry_zext" |
| 9468 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 9469 |
(zero_extend:DI |
| 9470 |
(minus:SI |
| 9471 |
(minus:SI |
| 9472 |
(match_operand:SI 1 "nonimmediate_operand" "0,r,rm") |
| 9473 |
(match_operator:SI 3 "ix86_carry_flag_operator" |
| 9474 |
[(reg FLAGS_REG) (const_int 0)])) |
| 9475 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re")))) |
| 9476 |
(clobber (reg:CC FLAGS_REG))] |
| 9477 |
"TARGET_64BIT |
| 9478 |
&& ix86_binary_operator_ok (MINUS, SImode, operands, TARGET_APX_NDD)" |
| 9479 |
"@ |
| 9480 |
sbb{l}\t{%2, %k0|%k0, %2} |
| 9481 |
sbb{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 9482 |
sbb{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 9483 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 9484 |
(set_attr "type" "alu") |
| 9485 |
(set_attr "use_carry" "1") |
| 9486 |
(set_attr "pent_pair" "pu") |
| 9487 |
(set_attr "mode" "SI")]) |
| 9488 |
|
| 9489 |
(define_insn "*subqi3_carry_zext<mode>_0" |
| 9490 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 9491 |
(zero_extend:SWI248x |
| 9492 |
(minus:QI |
| 9493 |
(match_operand:QI 1 "nonimmediate_operand" "rm") |
| 9494 |
(match_operator:QI 2 "ix86_carry_flag_operator" |
| 9495 |
[(reg FLAGS_REG) (const_int 0)])))) |
| 9496 |
(clobber (reg:CC FLAGS_REG))] |
| 9497 |
"TARGET_APX_NDD" |
| 9498 |
"sbb{b}\t{$0, %1, %b0|%b0, %1, 0}" |
| 9499 |
[(set_attr "type" "alu") |
| 9500 |
(set_attr "use_carry" "1") |
| 9501 |
(set_attr "pent_pair" "pu") |
| 9502 |
(set_attr "mode" "QI")]) |
| 9503 |
|
| 9504 |
(define_insn "*subhi3_carry_zext<mode>_0" |
| 9505 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 9506 |
(zero_extend:SWI48x |
| 9507 |
(minus:HI |
| 9508 |
(match_operand:HI 1 "nonimmediate_operand" "rm") |
| 9509 |
(match_operator:HI 2 "ix86_carry_flag_operator" |
| 9510 |
[(reg FLAGS_REG) (const_int 0)])))) |
| 9511 |
(clobber (reg:CC FLAGS_REG))] |
| 9512 |
"TARGET_APX_NDD" |
| 9513 |
"sbb{w}\t{$0, %1, %w0|%w0, %1, 0}" |
| 9514 |
[(set_attr "type" "alu") |
| 9515 |
(set_attr "use_carry" "1") |
| 9516 |
(set_attr "pent_pair" "pu") |
| 9517 |
(set_attr "mode" "HI")]) |
| 9518 |
|
| 9519 |
(define_insn "*subsi3_carry_zext_0" |
| 9520 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 9521 |
(zero_extend:DI |
| 9522 |
(minus:SI |
| 9523 |
(match_operand:SI 1 "nonimmediate_operand" "0,rm") |
| 9524 |
(match_operator:SI 2 "ix86_carry_flag_operator" |
| 9525 |
[(reg FLAGS_REG) (const_int 0)])))) |
| 9526 |
(clobber (reg:CC FLAGS_REG))] |
| 9527 |
"TARGET_64BIT" |
| 9528 |
"@ |
| 9529 |
sbb{l}\t{$0, %k0|%k0, 0} |
| 9530 |
sbb{l}\t{$0, %1, %k0|%k0, %1, 0}" |
| 9531 |
[(set_attr "isa" "*,apx_ndd") |
| 9532 |
(set_attr "type" "alu") |
| 9533 |
(set_attr "use_carry" "1") |
| 9534 |
(set_attr "pent_pair" "pu") |
| 9535 |
(set_attr "mode" "SI")]) |
| 9536 |
|
| 9537 |
(define_insn "*subqi3_carry_zext<mode>_0r" |
| 9538 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 9539 |
(zero_extend:SWI248x |
| 9540 |
(minus:QI |
| 9541 |
(match_operand:QI 1 "nonimmediate_operand" "rm") |
| 9542 |
(match_operator:QI 2 "ix86_carry_flag_unset_operator" |
| 9543 |
[(reg FLAGS_REG) (const_int 0)])))) |
| 9544 |
(clobber (reg:CC FLAGS_REG))] |
| 9545 |
"TARGET_APX_NDD" |
| 9546 |
"adc{b}\t{$-1, %1, %b0|%b0, %1, -1}" |
| 9547 |
[(set_attr "type" "alu") |
| 9548 |
(set_attr "use_carry" "1") |
| 9549 |
(set_attr "pent_pair" "pu") |
| 9550 |
(set_attr "mode" "QI")]) |
| 9551 |
|
| 9552 |
(define_insn "*subhi3_carry_zext<mode>_0r" |
| 9553 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 9554 |
(zero_extend:SWI48x |
| 9555 |
(minus:HI |
| 9556 |
(match_operand:HI 1 "nonimmediate_operand" "rm") |
| 9557 |
(match_operator:HI 2 "ix86_carry_flag_unset_operator" |
| 9558 |
[(reg FLAGS_REG) (const_int 0)])))) |
| 9559 |
(clobber (reg:CC FLAGS_REG))] |
| 9560 |
"TARGET_APX_NDD" |
| 9561 |
"adc{w}\t{$-1, %1, %w0|%w0, %1, -1}" |
| 9562 |
[(set_attr "type" "alu") |
| 9563 |
(set_attr "use_carry" "1") |
| 9564 |
(set_attr "pent_pair" "pu") |
| 9565 |
(set_attr "mode" "HI")]) |
| 9566 |
|
| 9567 |
(define_insn "*subsi3_carry_zext_0r" |
| 9568 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 9569 |
(zero_extend:DI |
| 9570 |
(minus:SI |
| 9571 |
(match_operand:SI 1 "nonimmediate_operand" "0,rm") |
| 9572 |
(match_operator:SI 2 "ix86_carry_flag_unset_operator" |
| 9573 |
[(reg FLAGS_REG) (const_int 0)])))) |
| 9574 |
(clobber (reg:CC FLAGS_REG))] |
| 9575 |
"TARGET_64BIT" |
| 9576 |
"@ |
| 9577 |
adc{l}\t{$-1, %k0|%k0, -1} |
| 9578 |
adc{l}\t{$-1, %1, %k0|%k0, %1, -1}" |
| 9579 |
[(set_attr "isa" "*,apx_ndd") |
| 9580 |
(set_attr "type" "alu") |
| 9581 |
(set_attr "use_carry" "1") |
| 9582 |
(set_attr "pent_pair" "pu") |
| 9583 |
(set_attr "mode" "SI")]) |
| 9584 |
|
| 9585 |
(define_insn "@sub<mode>3_carry_ccc" |
| 9586 |
[(set (reg:CCC FLAGS_REG) |
| 9587 |
(compare:CCC |
| 9588 |
(zero_extend:<DWI> (match_operand:DWIH 1 "register_operand" "0")) |
| 9589 |
(plus:<DWI> |
| 9590 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0)) |
| 9591 |
(zero_extend:<DWI> |
| 9592 |
(match_operand:DWIH 2 "x86_64_sext_operand" "rmWe"))))) |
| 9593 |
(clobber (match_scratch:DWIH 0 "=r"))] |
| 9594 |
"" |
| 9595 |
"sbb{<imodesuffix>}\t{%2, %0|%0, %2}" |
| 9596 |
[(set_attr "type" "alu") |
| 9597 |
(set_attr "mode" "<MODE>")]) |
| 9598 |
|
| 9599 |
(define_insn "*sub<mode>3_carry_ccc_1" |
| 9600 |
[(set (reg:CCC FLAGS_REG) |
| 9601 |
(compare:CCC |
| 9602 |
(zero_extend:<DWI> (match_operand:DWIH 1 "register_operand" "0")) |
| 9603 |
(plus:<DWI> |
| 9604 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0)) |
| 9605 |
(match_operand:<DWI> 2 "x86_64_dwzext_immediate_operand" "Wf")))) |
| 9606 |
(clobber (match_scratch:DWIH 0 "=r"))] |
| 9607 |
"" |
| 9608 |
{ |
| 9609 |
operands[3] = simplify_subreg (<MODE>mode, operands[2], <DWI>mode, 0); |
| 9610 |
return "sbb{<imodesuffix>}\t{%3, %0|%0, %3}"; |
| 9611 |
} |
| 9612 |
[(set_attr "type" "alu") |
| 9613 |
(set_attr "mode" "<MODE>")]) |
| 9614 |
|
| 9615 |
;; The sign flag is set from the |
| 9616 |
;; (compare (match_dup 1) (plus:DWIH (ltu:DWIH ...) (match_dup 2))) |
| 9617 |
;; result, the overflow flag likewise, but the overflow flag is also |
| 9618 |
;; set if the (plus:DWIH (ltu:DWIH ...) (match_dup 2)) overflows. |
| 9619 |
(define_insn "@sub<mode>3_carry_ccgz" |
| 9620 |
[(set (reg:CCGZ FLAGS_REG) |
| 9621 |
(unspec:CCGZ [(match_operand:DWIH 1 "register_operand" "0") |
| 9622 |
(match_operand:DWIH 2 "x86_64_general_operand" "rBMe") |
| 9623 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))] |
| 9624 |
UNSPEC_SBB)) |
| 9625 |
(clobber (match_scratch:DWIH 0 "=r"))] |
| 9626 |
"" |
| 9627 |
"sbb{<imodesuffix>}\t{%2, %0|%0, %2}" |
| 9628 |
[(set_attr "type" "alu") |
| 9629 |
(set_attr "mode" "<MODE>")]) |
| 9630 |
|
| 9631 |
(define_insn "subborrow<mode>" |
| 9632 |
[(set (reg:CCC FLAGS_REG) |
| 9633 |
(compare:CCC |
| 9634 |
(zero_extend:<DWI> |
| 9635 |
(match_operand:SWI48 1 "nonimmediate_operand" "0,0,r,rm")) |
| 9636 |
(plus:<DWI> |
| 9637 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9638 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9639 |
(zero_extend:<DWI> |
| 9640 |
(match_operand:SWI48 2 "nonimmediate_operand" "r,rm,rm,r"))))) |
| 9641 |
(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r") |
| 9642 |
(minus:SWI48 (minus:SWI48 |
| 9643 |
(match_dup 1) |
| 9644 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9645 |
[(match_dup 3) (const_int 0)])) |
| 9646 |
(match_dup 2)))] |
| 9647 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 9648 |
"@ |
| 9649 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9650 |
sbb{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9651 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 9652 |
sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 9653 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 9654 |
(set_attr "type" "alu") |
| 9655 |
(set_attr "use_carry" "1") |
| 9656 |
(set_attr "pent_pair" "pu") |
| 9657 |
(set_attr "mode" "<MODE>")]) |
| 9658 |
|
| 9659 |
(define_peephole2 |
| 9660 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 9661 |
(match_operand:SWI48 1 "memory_operand")) |
| 9662 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9663 |
(compare:CCC |
| 9664 |
(zero_extend:<DWI> (match_dup 0)) |
| 9665 |
(plus:<DWI> |
| 9666 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9667 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9668 |
(zero_extend:<DWI> |
| 9669 |
(match_operand:SWI48 2 "memory_operand"))))) |
| 9670 |
(set (match_dup 0) |
| 9671 |
(minus:SWI48 |
| 9672 |
(minus:SWI48 |
| 9673 |
(match_dup 0) |
| 9674 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9675 |
[(match_dup 3) (const_int 0)])) |
| 9676 |
(match_dup 2)))]) |
| 9677 |
(set (match_dup 1) (match_dup 0))] |
| 9678 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9679 |
&& peep2_reg_dead_p (3, operands[0]) |
| 9680 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9681 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 9682 |
[(set (match_dup 0) (match_dup 2)) |
| 9683 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9684 |
(compare:CCC |
| 9685 |
(zero_extend:<DWI> (match_dup 1)) |
| 9686 |
(plus:<DWI> (match_op_dup 4 |
| 9687 |
[(match_dup 3) (const_int 0)]) |
| 9688 |
(zero_extend:<DWI> (match_dup 0))))) |
| 9689 |
(set (match_dup 1) |
| 9690 |
(minus:SWI48 (minus:SWI48 (match_dup 1) |
| 9691 |
(match_op_dup 5 |
| 9692 |
[(match_dup 3) (const_int 0)])) |
| 9693 |
(match_dup 0)))])]) |
| 9694 |
|
| 9695 |
(define_peephole2 |
| 9696 |
[(set (match_operand:SWI48 6 "general_reg_operand") |
| 9697 |
(match_operand:SWI48 7 "memory_operand")) |
| 9698 |
(set (match_operand:SWI48 8 "general_reg_operand") |
| 9699 |
(match_operand:SWI48 9 "memory_operand")) |
| 9700 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9701 |
(compare:CCC |
| 9702 |
(zero_extend:<DWI> |
| 9703 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 9704 |
(plus:<DWI> |
| 9705 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9706 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9707 |
(zero_extend:<DWI> |
| 9708 |
(match_operand:SWI48 2 "general_reg_operand"))))) |
| 9709 |
(set (match_dup 0) |
| 9710 |
(minus:SWI48 |
| 9711 |
(minus:SWI48 |
| 9712 |
(match_dup 0) |
| 9713 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9714 |
[(match_dup 3) (const_int 0)])) |
| 9715 |
(match_dup 2)))]) |
| 9716 |
(set (match_operand:SWI48 1 "memory_operand") (match_dup 0))] |
| 9717 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9718 |
&& peep2_reg_dead_p (4, operands[0]) |
| 9719 |
&& peep2_reg_dead_p (3, operands[2]) |
| 9720 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9721 |
&& !reg_overlap_mentioned_p (operands[2], operands[1]) |
| 9722 |
&& !reg_overlap_mentioned_p (operands[6], operands[9]) |
| 9723 |
&& (rtx_equal_p (operands[6], operands[0]) |
| 9724 |
? (rtx_equal_p (operands[7], operands[1]) |
| 9725 |
&& rtx_equal_p (operands[8], operands[2])) |
| 9726 |
: (rtx_equal_p (operands[8], operands[0]) |
| 9727 |
&& rtx_equal_p (operands[9], operands[1]) |
| 9728 |
&& rtx_equal_p (operands[6], operands[2])))" |
| 9729 |
[(set (match_dup 0) (match_dup 9)) |
| 9730 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9731 |
(compare:CCC |
| 9732 |
(zero_extend:<DWI> (match_dup 1)) |
| 9733 |
(plus:<DWI> (match_op_dup 4 |
| 9734 |
[(match_dup 3) (const_int 0)]) |
| 9735 |
(zero_extend:<DWI> (match_dup 0))))) |
| 9736 |
(set (match_dup 1) |
| 9737 |
(minus:SWI48 (minus:SWI48 (match_dup 1) |
| 9738 |
(match_op_dup 5 |
| 9739 |
[(match_dup 3) (const_int 0)])) |
| 9740 |
(match_dup 0)))])] |
| 9741 |
{ |
| 9742 |
if (!rtx_equal_p (operands[6], operands[0])) |
| 9743 |
operands[9] = operands[7]; |
| 9744 |
}) |
| 9745 |
|
| 9746 |
(define_peephole2 |
| 9747 |
[(set (match_operand:SWI48 6 "general_reg_operand") |
| 9748 |
(match_operand:SWI48 7 "memory_operand")) |
| 9749 |
(set (match_operand:SWI48 8 "general_reg_operand") |
| 9750 |
(match_operand:SWI48 9 "memory_operand")) |
| 9751 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9752 |
(compare:CCC |
| 9753 |
(zero_extend:<DWI> |
| 9754 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 9755 |
(plus:<DWI> |
| 9756 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9757 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9758 |
(zero_extend:<DWI> |
| 9759 |
(match_operand:SWI48 2 "general_reg_operand"))))) |
| 9760 |
(set (match_dup 0) |
| 9761 |
(minus:SWI48 |
| 9762 |
(minus:SWI48 |
| 9763 |
(match_dup 0) |
| 9764 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9765 |
[(match_dup 3) (const_int 0)])) |
| 9766 |
(match_dup 2)))]) |
| 9767 |
(set (match_operand:QI 10 "general_reg_operand") |
| 9768 |
(ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 9769 |
(set (match_operand:SWI48 11 "general_reg_operand") |
| 9770 |
(zero_extend:SWI48 (match_dup 10))) |
| 9771 |
(set (match_operand:SWI48 1 "memory_operand") (match_dup 0))] |
| 9772 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 9773 |
&& peep2_reg_dead_p (6, operands[0]) |
| 9774 |
&& peep2_reg_dead_p (3, operands[2]) |
| 9775 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 9776 |
&& !reg_overlap_mentioned_p (operands[2], operands[1]) |
| 9777 |
&& !reg_overlap_mentioned_p (operands[6], operands[9]) |
| 9778 |
&& !reg_overlap_mentioned_p (operands[0], operands[10]) |
| 9779 |
&& !reg_overlap_mentioned_p (operands[10], operands[1]) |
| 9780 |
&& !reg_overlap_mentioned_p (operands[0], operands[11]) |
| 9781 |
&& !reg_overlap_mentioned_p (operands[11], operands[1]) |
| 9782 |
&& (rtx_equal_p (operands[6], operands[0]) |
| 9783 |
? (rtx_equal_p (operands[7], operands[1]) |
| 9784 |
&& rtx_equal_p (operands[8], operands[2])) |
| 9785 |
: (rtx_equal_p (operands[8], operands[0]) |
| 9786 |
&& rtx_equal_p (operands[9], operands[1]) |
| 9787 |
&& rtx_equal_p (operands[6], operands[2])))" |
| 9788 |
[(set (match_dup 0) (match_dup 9)) |
| 9789 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 9790 |
(compare:CCC |
| 9791 |
(zero_extend:<DWI> (match_dup 1)) |
| 9792 |
(plus:<DWI> (match_op_dup 4 |
| 9793 |
[(match_dup 3) (const_int 0)]) |
| 9794 |
(zero_extend:<DWI> (match_dup 0))))) |
| 9795 |
(set (match_dup 1) |
| 9796 |
(minus:SWI48 (minus:SWI48 (match_dup 1) |
| 9797 |
(match_op_dup 5 |
| 9798 |
[(match_dup 3) (const_int 0)])) |
| 9799 |
(match_dup 0)))]) |
| 9800 |
(set (match_dup 10) (ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 9801 |
(set (match_dup 11) (zero_extend:SWI48 (match_dup 10)))] |
| 9802 |
{ |
| 9803 |
if (!rtx_equal_p (operands[6], operands[0])) |
| 9804 |
operands[9] = operands[7]; |
| 9805 |
}) |
| 9806 |
|
| 9807 |
(define_expand "subborrow<mode>_0" |
| 9808 |
[(parallel |
| 9809 |
[(set (reg:CC FLAGS_REG) |
| 9810 |
(compare:CC |
| 9811 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 9812 |
(match_operand:SWI48 2 "<general_operand>"))) |
| 9813 |
(set (match_operand:SWI48 0 "register_operand") |
| 9814 |
(minus:SWI48 (match_dup 1) (match_dup 2)))])] |
| 9815 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD)") |
| 9816 |
|
| 9817 |
(define_insn "*subborrow<mode>_1" |
| 9818 |
[(set (reg:CCC FLAGS_REG) |
| 9819 |
(compare:CCC |
| 9820 |
(zero_extend:<DWI> |
| 9821 |
(match_operand:SWI48 1 "nonimmediate_operand" "0,rm")) |
| 9822 |
(plus:<DWI> |
| 9823 |
(match_operator:<DWI> 4 "ix86_carry_flag_operator" |
| 9824 |
[(match_operand 3 "flags_reg_operand") (const_int 0)]) |
| 9825 |
(match_operand:<DWI> 6 "const_scalar_int_operand")))) |
| 9826 |
(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r") |
| 9827 |
(plus:SWI48 (minus:SWI48 |
| 9828 |
(match_dup 1) |
| 9829 |
(match_operator:SWI48 5 "ix86_carry_flag_operator" |
| 9830 |
[(match_dup 3) (const_int 0)])) |
| 9831 |
(match_operand:SWI48 2 "x86_64_immediate_operand" "e,e")))] |
| 9832 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 9833 |
&& CONST_INT_P (operands[2]) |
| 9834 |
/* Check that operands[6] is -operands[2] zero extended from |
| 9835 |
<MODE>mode to <DWI>mode. */ |
| 9836 |
&& ((<MODE>mode == SImode || -INTVAL (operands[2]) >= 0) |
| 9837 |
? (CONST_INT_P (operands[6]) |
| 9838 |
&& (UINTVAL (operands[6]) |
| 9839 |
== ((unsigned HOST_WIDE_INT) -INTVAL (operands[2]) |
| 9840 |
& GET_MODE_MASK (<MODE>mode)))) |
| 9841 |
: (CONST_WIDE_INT_P (operands[6]) |
| 9842 |
&& CONST_WIDE_INT_NUNITS (operands[6]) == 2 |
| 9843 |
&& ((unsigned HOST_WIDE_INT) CONST_WIDE_INT_ELT (operands[6], 0) |
| 9844 |
== (unsigned HOST_WIDE_INT) -INTVAL (operands[2])) |
| 9845 |
&& CONST_WIDE_INT_ELT (operands[6], 1) == 0))" |
| 9846 |
{ |
| 9847 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 9848 |
|
| 9849 |
operands[2] = GEN_INT (-INTVAL (operands[2])); |
| 9850 |
|
| 9851 |
return use_ndd ? "sbb{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 9852 |
: "sbb{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 9853 |
} |
| 9854 |
[(set_attr "isa" "*,apx_ndd") |
| 9855 |
(set_attr "type" "alu") |
| 9856 |
(set_attr "use_carry" "1") |
| 9857 |
(set_attr "pent_pair" "pu") |
| 9858 |
(set_attr "mode" "<MODE>") |
| 9859 |
(set (attr "length_immediate") |
| 9860 |
(if_then_else (match_test "IN_RANGE (-INTVAL (operands[2]), -128, 127)") |
| 9861 |
(const_string "1") |
| 9862 |
(const_string "4")))]) |
| 9863 |
|
| 9864 |
(define_expand "uaddc<mode>5" |
| 9865 |
[(match_operand:SWI48 0 "register_operand") |
| 9866 |
(match_operand:SWI48 1 "register_operand") |
| 9867 |
(match_operand:SWI48 2 "register_operand") |
| 9868 |
(match_operand:SWI48 3 "register_operand") |
| 9869 |
(match_operand:SWI48 4 "nonmemory_operand")] |
| 9870 |
"" |
| 9871 |
{ |
| 9872 |
rtx cf = gen_rtx_REG (CCCmode, FLAGS_REG), pat, pat2; |
| 9873 |
if (operands[4] == const0_rtx) |
| 9874 |
emit_insn (gen_addcarry<mode>_0 (operands[0], operands[2], operands[3])); |
| 9875 |
else |
| 9876 |
{ |
| 9877 |
ix86_expand_carry (operands[4]); |
| 9878 |
pat = gen_rtx_LTU (<DWI>mode, cf, const0_rtx); |
| 9879 |
pat2 = gen_rtx_LTU (<MODE>mode, cf, const0_rtx); |
| 9880 |
emit_insn (gen_addcarry<mode> (operands[0], operands[2], operands[3], |
| 9881 |
cf, pat, pat2)); |
| 9882 |
} |
| 9883 |
rtx cc = gen_reg_rtx (QImode); |
| 9884 |
pat = gen_rtx_LTU (QImode, cf, const0_rtx); |
| 9885 |
emit_insn (gen_rtx_SET (cc, pat)); |
| 9886 |
emit_insn (gen_zero_extendqi<mode>2 (operands[1], cc)); |
| 9887 |
DONE; |
| 9888 |
}) |
| 9889 |
|
| 9890 |
(define_expand "usubc<mode>5" |
| 9891 |
[(match_operand:SWI48 0 "register_operand") |
| 9892 |
(match_operand:SWI48 1 "register_operand") |
| 9893 |
(match_operand:SWI48 2 "register_operand") |
| 9894 |
(match_operand:SWI48 3 "register_operand") |
| 9895 |
(match_operand:SWI48 4 "nonmemory_operand")] |
| 9896 |
"" |
| 9897 |
{ |
| 9898 |
rtx cf, pat, pat2; |
| 9899 |
if (operands[4] == const0_rtx) |
| 9900 |
{ |
| 9901 |
cf = gen_rtx_REG (CCmode, FLAGS_REG); |
| 9902 |
emit_insn (gen_subborrow<mode>_0 (operands[0], operands[2], |
| 9903 |
operands[3])); |
| 9904 |
} |
| 9905 |
else |
| 9906 |
{ |
| 9907 |
cf = gen_rtx_REG (CCCmode, FLAGS_REG); |
| 9908 |
ix86_expand_carry (operands[4]); |
| 9909 |
pat = gen_rtx_LTU (<DWI>mode, cf, const0_rtx); |
| 9910 |
pat2 = gen_rtx_LTU (<MODE>mode, cf, const0_rtx); |
| 9911 |
emit_insn (gen_subborrow<mode> (operands[0], operands[2], operands[3], |
| 9912 |
cf, pat, pat2)); |
| 9913 |
} |
| 9914 |
rtx cc = gen_reg_rtx (QImode); |
| 9915 |
pat = gen_rtx_LTU (QImode, cf, const0_rtx); |
| 9916 |
emit_insn (gen_rtx_SET (cc, pat)); |
| 9917 |
emit_insn (gen_zero_extendqi<mode>2 (operands[1], cc)); |
| 9918 |
DONE; |
| 9919 |
}) |
| 9920 |
|
| 9921 |
(define_mode_iterator CC_CCC [CC CCC]) |
| 9922 |
|
| 9923 |
;; Pre-reload splitter to optimize |
| 9924 |
;; *setcc_qi followed by *addqi3_cconly_overflow_1 with the same QI |
| 9925 |
;; operand and no intervening flags modifications into nothing. |
| 9926 |
(define_insn_and_split "*setcc_qi_addqi3_cconly_overflow_1_<mode>" |
| 9927 |
[(set (reg:CCC FLAGS_REG) |
| 9928 |
(compare:CCC (neg:QI (geu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))) |
| 9929 |
(ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))))] |
| 9930 |
"ix86_pre_reload_split ()" |
| 9931 |
"#" |
| 9932 |
"&& 1" |
| 9933 |
[(const_int 0)] |
| 9934 |
"emit_note (NOTE_INSN_DELETED); DONE;") |
| 9935 |
|
| 9936 |
;; Set the carry flag from the carry flag. |
| 9937 |
(define_insn_and_split "*setccc" |
| 9938 |
[(set (reg:CCC FLAGS_REG) |
| 9939 |
(reg:CCC FLAGS_REG))] |
| 9940 |
"ix86_pre_reload_split ()" |
| 9941 |
"#" |
| 9942 |
"&& 1" |
| 9943 |
[(const_int 0)] |
| 9944 |
"emit_note (NOTE_INSN_DELETED); DONE;") |
| 9945 |
|
| 9946 |
;; Set the carry flag from the carry flag. |
| 9947 |
(define_insn_and_split "*setcc_qi_negqi_ccc_1_<mode>" |
| 9948 |
[(set (reg:CCC FLAGS_REG) |
| 9949 |
(ltu:CCC (reg:CC_CCC FLAGS_REG) (const_int 0)))] |
| 9950 |
"ix86_pre_reload_split ()" |
| 9951 |
"#" |
| 9952 |
"&& 1" |
| 9953 |
[(const_int 0)] |
| 9954 |
"emit_note (NOTE_INSN_DELETED); DONE;") |
| 9955 |
|
| 9956 |
;; Set the carry flag from the carry flag. |
| 9957 |
(define_insn_and_split "*setcc_qi_negqi_ccc_2_<mode>" |
| 9958 |
[(set (reg:CCC FLAGS_REG) |
| 9959 |
(unspec:CCC [(ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0)) |
| 9960 |
(const_int 0)] UNSPEC_CC_NE))] |
| 9961 |
"ix86_pre_reload_split ()" |
| 9962 |
"#" |
| 9963 |
"&& 1" |
| 9964 |
[(const_int 0)] |
| 9965 |
"emit_note (NOTE_INSN_DELETED); DONE;") |
| 9966 |
|
| 9967 |
;; Overflow setting add instructions |
| 9968 |
|
| 9969 |
(define_expand "addqi3_cconly_overflow" |
| 9970 |
[(parallel |
| 9971 |
[(set (reg:CCC FLAGS_REG) |
| 9972 |
(compare:CCC |
| 9973 |
(plus:QI |
| 9974 |
(match_operand:QI 0 "nonimmediate_operand") |
| 9975 |
(match_operand:QI 1 "general_operand")) |
| 9976 |
(match_dup 0))) |
| 9977 |
(clobber (scratch:QI))])] |
| 9978 |
"!(MEM_P (operands[0]) && MEM_P (operands[1]))") |
| 9979 |
|
| 9980 |
(define_insn "*add<mode>3_cconly_overflow_1" |
| 9981 |
[(set (reg:CCC FLAGS_REG) |
| 9982 |
(compare:CCC |
| 9983 |
(plus:SWI |
| 9984 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,r,rm") |
| 9985 |
(match_operand:SWI 2 "<general_operand>" "<g>,<g>,re")) |
| 9986 |
(match_dup 1))) |
| 9987 |
(clobber (match_scratch:SWI 0 "=<r>,r,r"))] |
| 9988 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 9989 |
"@ |
| 9990 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 9991 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 9992 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 9993 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 9994 |
(set_attr "type" "alu") |
| 9995 |
(set_attr "mode" "<MODE>")]) |
| 9996 |
|
| 9997 |
(define_insn "@add<mode>3_cc_overflow_1" |
| 9998 |
[(set (reg:CCC FLAGS_REG) |
| 9999 |
(compare:CCC |
| 10000 |
(plus:SWI |
| 10001 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,rjM,r") |
| 10002 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r,<i>,<m>")) |
| 10003 |
(match_dup 1))) |
| 10004 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r,r") |
| 10005 |
(plus:SWI (match_dup 1) (match_dup 2)))] |
| 10006 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 10007 |
"@ |
| 10008 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10009 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10010 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10011 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10012 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 10013 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd") |
| 10014 |
(set_attr "type" "alu") |
| 10015 |
(set_attr "mode" "<MODE>")]) |
| 10016 |
|
| 10017 |
(define_peephole2 |
| 10018 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 10019 |
(compare:CCC |
| 10020 |
(plus:SWI (match_operand:SWI 0 "general_reg_operand") |
| 10021 |
(match_operand:SWI 1 "memory_operand")) |
| 10022 |
(match_dup 0))) |
| 10023 |
(set (match_dup 0) (plus:SWI (match_dup 0) (match_dup 1)))]) |
| 10024 |
(set (match_dup 1) (match_dup 0))] |
| 10025 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 10026 |
&& peep2_reg_dead_p (2, operands[0]) |
| 10027 |
&& !reg_overlap_mentioned_p (operands[0], operands[1])" |
| 10028 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 10029 |
(compare:CCC |
| 10030 |
(plus:SWI (match_dup 1) (match_dup 0)) |
| 10031 |
(match_dup 1))) |
| 10032 |
(set (match_dup 1) (plus:SWI (match_dup 1) (match_dup 0)))])]) |
| 10033 |
|
| 10034 |
(define_peephole2 |
| 10035 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 10036 |
(match_operand:SWI 1 "memory_operand")) |
| 10037 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 10038 |
(compare:CCC |
| 10039 |
(plus:SWI (match_dup 0) |
| 10040 |
(match_operand:SWI 2 "memory_operand")) |
| 10041 |
(match_dup 0))) |
| 10042 |
(set (match_dup 0) (plus:SWI (match_dup 0) (match_dup 2)))]) |
| 10043 |
(set (match_dup 1) (match_dup 0))] |
| 10044 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 10045 |
&& peep2_reg_dead_p (3, operands[0]) |
| 10046 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 10047 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 10048 |
[(set (match_dup 0) (match_dup 2)) |
| 10049 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 10050 |
(compare:CCC |
| 10051 |
(plus:SWI (match_dup 1) (match_dup 0)) |
| 10052 |
(match_dup 1))) |
| 10053 |
(set (match_dup 1) (plus:SWI (match_dup 1) (match_dup 0)))])]) |
| 10054 |
|
| 10055 |
(define_insn "*addsi3_zext_cc_overflow_1" |
| 10056 |
[(set (reg:CCC FLAGS_REG) |
| 10057 |
(compare:CCC |
| 10058 |
(plus:SI |
| 10059 |
(match_operand:SI 1 "nonimmediate_operand" "%0,r,rm") |
| 10060 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re")) |
| 10061 |
(match_dup 1))) |
| 10062 |
(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 10063 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] |
| 10064 |
"TARGET_64BIT |
| 10065 |
&& ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" |
| 10066 |
"@ |
| 10067 |
add{l}\t{%2, %k0|%k0, %2} |
| 10068 |
add{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 10069 |
add{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 10070 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 10071 |
(set_attr "type" "alu") |
| 10072 |
(set_attr "mode" "SI")]) |
| 10073 |
|
| 10074 |
(define_insn "*add<mode>3_cconly_overflow_2" |
| 10075 |
[(set (reg:CCC FLAGS_REG) |
| 10076 |
(compare:CCC |
| 10077 |
(plus:SWI |
| 10078 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,r,rm") |
| 10079 |
(match_operand:SWI 2 "<general_operand>" "<g>,<g>,re")) |
| 10080 |
(match_dup 2))) |
| 10081 |
(clobber (match_scratch:SWI 0 "=<r>,r,r"))] |
| 10082 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 10083 |
"@ |
| 10084 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10085 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10086 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 10087 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 10088 |
(set_attr "type" "alu") |
| 10089 |
(set_attr "mode" "<MODE>")]) |
| 10090 |
|
| 10091 |
(define_insn "*add<mode>3_cc_overflow_2" |
| 10092 |
[(set (reg:CCC FLAGS_REG) |
| 10093 |
(compare:CCC |
| 10094 |
(plus:SWI |
| 10095 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r") |
| 10096 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")) |
| 10097 |
(match_dup 2))) |
| 10098 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 10099 |
(plus:SWI (match_dup 1) (match_dup 2)))] |
| 10100 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" |
| 10101 |
"@ |
| 10102 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10103 |
add{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10104 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10105 |
add{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 10106 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 10107 |
(set_attr "type" "alu") |
| 10108 |
(set_attr "mode" "<MODE>")]) |
| 10109 |
|
| 10110 |
(define_insn "*addsi3_zext_cc_overflow_2" |
| 10111 |
[(set (reg:CCC FLAGS_REG) |
| 10112 |
(compare:CCC |
| 10113 |
(plus:SI |
| 10114 |
(match_operand:SI 1 "nonimmediate_operand" "%0,r,rm") |
| 10115 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,rBMe,re")) |
| 10116 |
(match_dup 2))) |
| 10117 |
(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 10118 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] |
| 10119 |
"TARGET_64BIT |
| 10120 |
&& ix86_binary_operator_ok (PLUS, SImode, operands, TARGET_APX_NDD)" |
| 10121 |
"@ |
| 10122 |
add{l}\t{%2, %k0|%k0, %2} |
| 10123 |
add{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 10124 |
add{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 10125 |
[(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 10126 |
(set_attr "type" "alu") |
| 10127 |
(set_attr "mode" "SI")]) |
| 10128 |
|
| 10129 |
(define_insn_and_split "*add<dwi>3_doubleword_cc_overflow_1" |
| 10130 |
[(set (reg:CCC FLAGS_REG) |
| 10131 |
(compare:CCC |
| 10132 |
(plus:<DWI> |
| 10133 |
(match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r,ro,jO,r") |
| 10134 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,K,<di>,o")) |
| 10135 |
(match_dup 1))) |
| 10136 |
(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r,&r,&r") |
| 10137 |
(plus:<DWI> (match_dup 1) (match_dup 2)))] |
| 10138 |
"ix86_binary_operator_ok (PLUS, <DWI>mode, operands, TARGET_APX_NDD)" |
| 10139 |
"#" |
| 10140 |
"&& reload_completed" |
| 10141 |
[(parallel [(set (reg:CCC FLAGS_REG) |
| 10142 |
(compare:CCC |
| 10143 |
(plus:DWIH (match_dup 1) (match_dup 2)) |
| 10144 |
(match_dup 1))) |
| 10145 |
(set (match_dup 0) |
| 10146 |
(plus:DWIH (match_dup 1) (match_dup 2)))]) |
| 10147 |
(parallel [(set (reg:CCC FLAGS_REG) |
| 10148 |
(compare:CCC |
| 10149 |
(zero_extend:<DWI> |
| 10150 |
(plus:DWIH |
| 10151 |
(plus:DWIH |
| 10152 |
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 10153 |
(match_dup 4)) |
| 10154 |
(match_dup 5))) |
| 10155 |
(plus:<DWI> |
| 10156 |
(ltu:<DWI> (reg:CC FLAGS_REG) (const_int 0)) |
| 10157 |
(match_dup 6)))) |
| 10158 |
(set (match_dup 3) |
| 10159 |
(plus:DWIH |
| 10160 |
(plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 10161 |
(match_dup 4)) |
| 10162 |
(match_dup 5)))])] |
| 10163 |
{ |
| 10164 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 10165 |
if (operands[2] == const0_rtx) |
| 10166 |
{ |
| 10167 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 10168 |
emit_move_insn (operands[0], operands[1]); |
| 10169 |
emit_insn (gen_addcarry<mode>_0 (operands[3], operands[4], operands[5])); |
| 10170 |
DONE; |
| 10171 |
} |
| 10172 |
if (CONST_INT_P (operands[5])) |
| 10173 |
operands[6] = simplify_unary_operation (ZERO_EXTEND, <DWI>mode, |
| 10174 |
operands[5], <MODE>mode); |
| 10175 |
else |
| 10176 |
operands[6] = gen_rtx_ZERO_EXTEND (<DWI>mode, operands[5]); |
| 10177 |
} |
| 10178 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd,apx_ndd_64,apx_ndd")]) |
| 10179 |
|
| 10180 |
;; x == 0 with zero flag test can be done also as x < 1U with carry flag |
| 10181 |
;; test, where the latter is preferrable if we have some carry consuming |
| 10182 |
;; instruction. |
| 10183 |
;; For x != 0, we need to use x < 1U with negation of carry, i.e. |
| 10184 |
;; + (1 - CF). |
| 10185 |
(define_insn_and_split "*add<mode>3_eq" |
| 10186 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10187 |
(plus:SWI |
| 10188 |
(plus:SWI |
| 10189 |
(eq:SWI (match_operand 3 "int_nonimmediate_operand") (const_int 0)) |
| 10190 |
(match_operand:SWI 1 "nonimmediate_operand")) |
| 10191 |
(match_operand:SWI 2 "<general_operand>"))) |
| 10192 |
(clobber (reg:CC FLAGS_REG))] |
| 10193 |
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 10194 |
&& ix86_pre_reload_split ()" |
| 10195 |
"#" |
| 10196 |
"&& 1" |
| 10197 |
[(set (reg:CC FLAGS_REG) |
| 10198 |
(compare:CC (match_dup 3) (const_int 1))) |
| 10199 |
(parallel [(set (match_dup 0) |
| 10200 |
(plus:SWI |
| 10201 |
(plus:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_int 0)) |
| 10202 |
(match_dup 1)) |
| 10203 |
(match_dup 2))) |
| 10204 |
(clobber (reg:CC FLAGS_REG))])]) |
| 10205 |
|
| 10206 |
(define_insn_and_split "*add<mode>3_ne" |
| 10207 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10208 |
(plus:SWI |
| 10209 |
(plus:SWI |
| 10210 |
(ne:SWI (match_operand 3 "int_nonimmediate_operand") (const_int 0)) |
| 10211 |
(match_operand:SWI 1 "nonimmediate_operand")) |
| 10212 |
(match_operand:SWI 2 "<immediate_operand>"))) |
| 10213 |
(clobber (reg:CC FLAGS_REG))] |
| 10214 |
"CONST_INT_P (operands[2]) |
| 10215 |
&& (<MODE>mode != DImode |
| 10216 |
|| INTVAL (operands[2]) != HOST_WIDE_INT_C (-0x80000000)) |
| 10217 |
&& ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 10218 |
&& ix86_pre_reload_split ()" |
| 10219 |
"#" |
| 10220 |
"&& 1" |
| 10221 |
[(set (reg:CC FLAGS_REG) |
| 10222 |
(compare:CC (match_dup 3) (const_int 1))) |
| 10223 |
(parallel [(set (match_dup 0) |
| 10224 |
(minus:SWI |
| 10225 |
(minus:SWI (match_dup 1) |
| 10226 |
(ltu:SWI (reg:CC FLAGS_REG) (const_int 0))) |
| 10227 |
(match_dup 2))) |
| 10228 |
(clobber (reg:CC FLAGS_REG))])] |
| 10229 |
{ |
| 10230 |
operands[2] = gen_int_mode (~INTVAL (operands[2]), |
| 10231 |
<MODE>mode == DImode ? SImode : <MODE>mode); |
| 10232 |
}) |
| 10233 |
|
| 10234 |
(define_insn_and_split "*add<mode>3_eq_0" |
| 10235 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10236 |
(plus:SWI |
| 10237 |
(eq:SWI (match_operand 2 "int_nonimmediate_operand") (const_int 0)) |
| 10238 |
(match_operand:SWI 1 "<general_operand>"))) |
| 10239 |
(clobber (reg:CC FLAGS_REG))] |
| 10240 |
"ix86_unary_operator_ok (PLUS, <MODE>mode, operands) |
| 10241 |
&& ix86_pre_reload_split ()" |
| 10242 |
"#" |
| 10243 |
"&& 1" |
| 10244 |
[(set (reg:CC FLAGS_REG) |
| 10245 |
(compare:CC (match_dup 2) (const_int 1))) |
| 10246 |
(parallel [(set (match_dup 0) |
| 10247 |
(plus:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_int 0)) |
| 10248 |
(match_dup 1))) |
| 10249 |
(clobber (reg:CC FLAGS_REG))])] |
| 10250 |
{ |
| 10251 |
if (!nonimmediate_operand (operands[1], <MODE>mode)) |
| 10252 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 10253 |
}) |
| 10254 |
|
| 10255 |
(define_insn_and_split "*add<mode>3_ne_0" |
| 10256 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10257 |
(plus:SWI |
| 10258 |
(ne:SWI (match_operand 2 "int_nonimmediate_operand") (const_int 0)) |
| 10259 |
(match_operand:SWI 1 "<general_operand>"))) |
| 10260 |
(clobber (reg:CC FLAGS_REG))] |
| 10261 |
"ix86_unary_operator_ok (PLUS, <MODE>mode, operands) |
| 10262 |
&& ix86_pre_reload_split ()" |
| 10263 |
"#" |
| 10264 |
"&& 1" |
| 10265 |
[(set (reg:CC FLAGS_REG) |
| 10266 |
(compare:CC (match_dup 2) (const_int 1))) |
| 10267 |
(parallel [(set (match_dup 0) |
| 10268 |
(minus:SWI (minus:SWI |
| 10269 |
(match_dup 1) |
| 10270 |
(ltu:SWI (reg:CC FLAGS_REG) (const_int 0))) |
| 10271 |
(const_int -1))) |
| 10272 |
(clobber (reg:CC FLAGS_REG))])] |
| 10273 |
{ |
| 10274 |
if (!nonimmediate_operand (operands[1], <MODE>mode)) |
| 10275 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 10276 |
}) |
| 10277 |
|
| 10278 |
(define_insn_and_split "*sub<mode>3_eq" |
| 10279 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10280 |
(minus:SWI |
| 10281 |
(minus:SWI |
| 10282 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 10283 |
(eq:SWI (match_operand 3 "int_nonimmediate_operand") |
| 10284 |
(const_int 0))) |
| 10285 |
(match_operand:SWI 2 "<general_operand>"))) |
| 10286 |
(clobber (reg:CC FLAGS_REG))] |
| 10287 |
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 10288 |
&& ix86_pre_reload_split ()" |
| 10289 |
"#" |
| 10290 |
"&& 1" |
| 10291 |
[(set (reg:CC FLAGS_REG) |
| 10292 |
(compare:CC (match_dup 3) (const_int 1))) |
| 10293 |
(parallel [(set (match_dup 0) |
| 10294 |
(minus:SWI |
| 10295 |
(minus:SWI (match_dup 1) |
| 10296 |
(ltu:SWI (reg:CC FLAGS_REG) (const_int 0))) |
| 10297 |
(match_dup 2))) |
| 10298 |
(clobber (reg:CC FLAGS_REG))])]) |
| 10299 |
|
| 10300 |
(define_insn_and_split "*sub<mode>3_ne" |
| 10301 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10302 |
(plus:SWI |
| 10303 |
(minus:SWI |
| 10304 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 10305 |
(ne:SWI (match_operand 3 "int_nonimmediate_operand") |
| 10306 |
(const_int 0))) |
| 10307 |
(match_operand:SWI 2 "<immediate_operand>"))) |
| 10308 |
(clobber (reg:CC FLAGS_REG))] |
| 10309 |
"CONST_INT_P (operands[2]) |
| 10310 |
&& (<MODE>mode != DImode |
| 10311 |
|| INTVAL (operands[2]) != HOST_WIDE_INT_C (-0x80000000)) |
| 10312 |
&& ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 10313 |
&& ix86_pre_reload_split ()" |
| 10314 |
"#" |
| 10315 |
"&& 1" |
| 10316 |
[(set (reg:CC FLAGS_REG) |
| 10317 |
(compare:CC (match_dup 3) (const_int 1))) |
| 10318 |
(parallel [(set (match_dup 0) |
| 10319 |
(plus:SWI |
| 10320 |
(plus:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_int 0)) |
| 10321 |
(match_dup 1)) |
| 10322 |
(match_dup 2))) |
| 10323 |
(clobber (reg:CC FLAGS_REG))])] |
| 10324 |
{ |
| 10325 |
operands[2] = gen_int_mode (INTVAL (operands[2]) - 1, |
| 10326 |
<MODE>mode == DImode ? SImode : <MODE>mode); |
| 10327 |
}) |
| 10328 |
|
| 10329 |
(define_insn_and_split "*sub<mode>3_eq_1" |
| 10330 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10331 |
(plus:SWI |
| 10332 |
(minus:SWI |
| 10333 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 10334 |
(eq:SWI (match_operand 3 "int_nonimmediate_operand") |
| 10335 |
(const_int 0))) |
| 10336 |
(match_operand:SWI 2 "<immediate_operand>"))) |
| 10337 |
(clobber (reg:CC FLAGS_REG))] |
| 10338 |
"CONST_INT_P (operands[2]) |
| 10339 |
&& (<MODE>mode != DImode |
| 10340 |
|| INTVAL (operands[2]) != HOST_WIDE_INT_C (-0x80000000)) |
| 10341 |
&& ix86_binary_operator_ok (MINUS, <MODE>mode, operands, TARGET_APX_NDD) |
| 10342 |
&& ix86_pre_reload_split ()" |
| 10343 |
"#" |
| 10344 |
"&& 1" |
| 10345 |
[(set (reg:CC FLAGS_REG) |
| 10346 |
(compare:CC (match_dup 3) (const_int 1))) |
| 10347 |
(parallel [(set (match_dup 0) |
| 10348 |
(minus:SWI |
| 10349 |
(minus:SWI (match_dup 1) |
| 10350 |
(ltu:SWI (reg:CC FLAGS_REG) (const_int 0))) |
| 10351 |
(match_dup 2))) |
| 10352 |
(clobber (reg:CC FLAGS_REG))])] |
| 10353 |
{ |
| 10354 |
operands[2] = gen_int_mode (-INTVAL (operands[2]), |
| 10355 |
<MODE>mode == DImode ? SImode : <MODE>mode); |
| 10356 |
}) |
| 10357 |
|
| 10358 |
(define_insn_and_split "*sub<mode>3_eq_0" |
| 10359 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10360 |
(minus:SWI |
| 10361 |
(match_operand:SWI 1 "<general_operand>") |
| 10362 |
(eq:SWI (match_operand 2 "int_nonimmediate_operand") (const_int 0)))) |
| 10363 |
(clobber (reg:CC FLAGS_REG))] |
| 10364 |
"ix86_unary_operator_ok (MINUS, <MODE>mode, operands) |
| 10365 |
&& ix86_pre_reload_split ()" |
| 10366 |
"#" |
| 10367 |
"&& 1" |
| 10368 |
[(set (reg:CC FLAGS_REG) |
| 10369 |
(compare:CC (match_dup 2) (const_int 1))) |
| 10370 |
(parallel [(set (match_dup 0) |
| 10371 |
(minus:SWI (match_dup 1) |
| 10372 |
(ltu:SWI (reg:CC FLAGS_REG) (const_int 0)))) |
| 10373 |
(clobber (reg:CC FLAGS_REG))])] |
| 10374 |
{ |
| 10375 |
if (!nonimmediate_operand (operands[1], <MODE>mode)) |
| 10376 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 10377 |
}) |
| 10378 |
|
| 10379 |
(define_insn_and_split "*sub<mode>3_ne_0" |
| 10380 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 10381 |
(minus:SWI |
| 10382 |
(match_operand:SWI 1 "<general_operand>") |
| 10383 |
(ne:SWI (match_operand 2 "int_nonimmediate_operand") (const_int 0)))) |
| 10384 |
(clobber (reg:CC FLAGS_REG))] |
| 10385 |
"ix86_unary_operator_ok (MINUS, <MODE>mode, operands) |
| 10386 |
&& ix86_pre_reload_split ()" |
| 10387 |
"#" |
| 10388 |
"&& 1" |
| 10389 |
[(set (reg:CC FLAGS_REG) |
| 10390 |
(compare:CC (match_dup 2) (const_int 1))) |
| 10391 |
(parallel [(set (match_dup 0) |
| 10392 |
(plus:SWI (plus:SWI |
| 10393 |
(ltu:SWI (reg:CC FLAGS_REG) (const_int 0)) |
| 10394 |
(match_dup 1)) |
| 10395 |
(const_int -1))) |
| 10396 |
(clobber (reg:CC FLAGS_REG))])] |
| 10397 |
{ |
| 10398 |
if (!nonimmediate_operand (operands[1], <MODE>mode)) |
| 10399 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 10400 |
}) |
| 10401 |
|
| 10402 |
(define_expand "usadd<mode>3" |
| 10403 |
[(set (match_operand:SWI 0 "register_operand") |
| 10404 |
(us_plus:SWI (match_operand:SWI 1 "register_operand") |
| 10405 |
(match_operand:SWI 2 "<general_operand>")))] |
| 10406 |
"" |
| 10407 |
{ |
| 10408 |
rtx res = gen_reg_rtx (<MODE>mode); |
| 10409 |
rtx dst; |
| 10410 |
|
| 10411 |
emit_insn (gen_add<mode>3_cc_overflow_1 (res, operands[1], operands[2])); |
| 10412 |
|
| 10413 |
if (TARGET_CMOVE) |
| 10414 |
{ |
| 10415 |
rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG), |
| 10416 |
const0_rtx); |
| 10417 |
|
| 10418 |
if (<MODE_SIZE> < GET_MODE_SIZE (SImode)) |
| 10419 |
{ |
| 10420 |
dst = force_reg (<MODE>mode, operands[0]); |
| 10421 |
emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp, |
| 10422 |
gen_lowpart (SImode, res), constm1_rtx)); |
| 10423 |
} |
| 10424 |
else |
| 10425 |
{ |
| 10426 |
dst = operands[0]; |
| 10427 |
emit_insn (gen_mov<mode>cc (dst, cmp, res, constm1_rtx)); |
| 10428 |
} |
| 10429 |
} |
| 10430 |
else |
| 10431 |
{ |
| 10432 |
rtx msk = gen_reg_rtx (<MODE>mode); |
| 10433 |
|
| 10434 |
emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk)); |
| 10435 |
dst = expand_simple_binop (<MODE>mode, IOR, res, msk, |
| 10436 |
operands[0], 1, OPTAB_WIDEN); |
| 10437 |
} |
| 10438 |
|
| 10439 |
if (!rtx_equal_p (dst, operands[0])) |
| 10440 |
emit_move_insn (operands[0], dst); |
| 10441 |
DONE; |
| 10442 |
}) |
| 10443 |
|
| 10444 |
(define_expand "ussub<mode>3" |
| 10445 |
[(set (match_operand:SWI 0 "register_operand") |
| 10446 |
(us_minus:SWI (match_operand:SWI 1 "register_operand") |
| 10447 |
(match_operand:SWI 2 "<general_operand>")))] |
| 10448 |
"" |
| 10449 |
{ |
| 10450 |
rtx res = gen_reg_rtx (<MODE>mode); |
| 10451 |
rtx dst; |
| 10452 |
|
| 10453 |
emit_insn (gen_sub<mode>_3 (res, operands[1], operands[2])); |
| 10454 |
|
| 10455 |
if (TARGET_CMOVE) |
| 10456 |
{ |
| 10457 |
rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG), |
| 10458 |
const0_rtx); |
| 10459 |
|
| 10460 |
if (<MODE_SIZE> < GET_MODE_SIZE (SImode)) |
| 10461 |
{ |
| 10462 |
dst = force_reg (<MODE>mode, operands[0]); |
| 10463 |
emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp, |
| 10464 |
gen_lowpart (SImode, res), const0_rtx)); |
| 10465 |
} |
| 10466 |
else |
| 10467 |
{ |
| 10468 |
dst = operands[0]; |
| 10469 |
emit_insn (gen_mov<mode>cc (dst, cmp, res, const0_rtx)); |
| 10470 |
} |
| 10471 |
} |
| 10472 |
else |
| 10473 |
{ |
| 10474 |
rtx msk = gen_reg_rtx (<MODE>mode); |
| 10475 |
|
| 10476 |
emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk)); |
| 10477 |
msk = expand_simple_unop (<MODE>mode, NOT, msk, NULL, 1); |
| 10478 |
dst = expand_simple_binop (<MODE>mode, AND, res, msk, |
| 10479 |
operands[0], 1, OPTAB_WIDEN); |
| 10480 |
} |
| 10481 |
|
| 10482 |
if (!rtx_equal_p (dst, operands[0])) |
| 10483 |
emit_move_insn (operands[0], dst); |
| 10484 |
DONE; |
| 10485 |
}) |
| 10486 |
|
| 10487 |
(define_expand "ustruncdi<mode>2" |
| 10488 |
[(set (match_operand:SWI124 0 "register_operand") |
| 10489 |
(us_truncate:DI (match_operand:DI 1 "nonimmediate_operand")))] |
| 10490 |
"TARGET_64BIT" |
| 10491 |
{ |
| 10492 |
rtx op1 = force_reg (DImode, operands[1]); |
| 10493 |
rtx sat = force_reg (DImode, GEN_INT (GET_MODE_MASK (<MODE>mode))); |
| 10494 |
rtx dst; |
| 10495 |
|
| 10496 |
emit_insn (gen_cmpdi_1 (sat, op1)); |
| 10497 |
|
| 10498 |
if (TARGET_CMOVE) |
| 10499 |
{ |
| 10500 |
rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG), |
| 10501 |
const0_rtx); |
| 10502 |
|
| 10503 |
dst = force_reg (<MODE>mode, operands[0]); |
| 10504 |
emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp, |
| 10505 |
gen_lowpart (SImode, op1), |
| 10506 |
gen_lowpart (SImode, sat))); |
| 10507 |
} |
| 10508 |
else |
| 10509 |
{ |
| 10510 |
rtx msk = gen_reg_rtx (<MODE>mode); |
| 10511 |
|
| 10512 |
emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk)); |
| 10513 |
dst = expand_simple_binop (<MODE>mode, IOR, |
| 10514 |
gen_lowpart (<MODE>mode, op1), msk, |
| 10515 |
operands[0], 1, OPTAB_WIDEN); |
| 10516 |
} |
| 10517 |
|
| 10518 |
if (!rtx_equal_p (dst, operands[0])) |
| 10519 |
emit_move_insn (operands[0], dst); |
| 10520 |
DONE; |
| 10521 |
}) |
| 10522 |
|
| 10523 |
(define_expand "ustruncsi<mode>2" |
| 10524 |
[(set (match_operand:SWI12 0 "register_operand") |
| 10525 |
(us_truncate:SI (match_operand:SI 1 "nonimmediate_operand")))] |
| 10526 |
"" |
| 10527 |
{ |
| 10528 |
rtx op1 = force_reg (SImode, operands[1]); |
| 10529 |
rtx sat = force_reg (SImode, GEN_INT (GET_MODE_MASK (<MODE>mode))); |
| 10530 |
rtx dst; |
| 10531 |
|
| 10532 |
emit_insn (gen_cmpsi_1 (sat, op1)); |
| 10533 |
|
| 10534 |
if (TARGET_CMOVE) |
| 10535 |
{ |
| 10536 |
rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG), |
| 10537 |
const0_rtx); |
| 10538 |
|
| 10539 |
dst = force_reg (<MODE>mode, operands[0]); |
| 10540 |
emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp, |
| 10541 |
gen_lowpart (SImode, op1), |
| 10542 |
gen_lowpart (SImode, sat))); |
| 10543 |
} |
| 10544 |
else |
| 10545 |
{ |
| 10546 |
rtx msk = gen_reg_rtx (<MODE>mode); |
| 10547 |
|
| 10548 |
emit_insn (gen_x86_mov<mode>cc_0_m1_neg (msk)); |
| 10549 |
dst = expand_simple_binop (<MODE>mode, IOR, |
| 10550 |
gen_lowpart (<MODE>mode, op1), msk, |
| 10551 |
operands[0], 1, OPTAB_WIDEN); |
| 10552 |
} |
| 10553 |
|
| 10554 |
if (!rtx_equal_p (dst, operands[0])) |
| 10555 |
emit_move_insn (operands[0], dst); |
| 10556 |
DONE; |
| 10557 |
}) |
| 10558 |
|
| 10559 |
(define_expand "ustrunchiqi2" |
| 10560 |
[(set (match_operand:QI 0 "register_operand") |
| 10561 |
(us_truncate:HI (match_operand:HI 1 "nonimmediate_operand")))] |
| 10562 |
"" |
| 10563 |
{ |
| 10564 |
rtx op1 = force_reg (HImode, operands[1]); |
| 10565 |
rtx sat = force_reg (HImode, GEN_INT (GET_MODE_MASK (QImode))); |
| 10566 |
rtx dst; |
| 10567 |
|
| 10568 |
emit_insn (gen_cmphi_1 (sat, op1)); |
| 10569 |
|
| 10570 |
if (TARGET_CMOVE) |
| 10571 |
{ |
| 10572 |
rtx cmp = gen_rtx_GEU (VOIDmode, gen_rtx_REG (CCCmode, FLAGS_REG), |
| 10573 |
const0_rtx); |
| 10574 |
|
| 10575 |
dst = force_reg (QImode, operands[0]); |
| 10576 |
emit_insn (gen_movsicc (gen_lowpart (SImode, dst), cmp, |
| 10577 |
gen_lowpart (SImode, op1), |
| 10578 |
gen_lowpart (SImode, sat))); |
| 10579 |
} |
| 10580 |
else |
| 10581 |
{ |
| 10582 |
rtx msk = gen_reg_rtx (QImode); |
| 10583 |
|
| 10584 |
emit_insn (gen_x86_movqicc_0_m1_neg (msk)); |
| 10585 |
dst = expand_simple_binop (QImode, IOR, |
| 10586 |
gen_lowpart (QImode, op1), msk, |
| 10587 |
operands[0], 1, OPTAB_WIDEN); |
| 10588 |
} |
| 10589 |
|
| 10590 |
if (!rtx_equal_p (dst, operands[0])) |
| 10591 |
emit_move_insn (operands[0], dst); |
| 10592 |
DONE; |
| 10593 |
}) |
| 10594 |
|
| 10595 |
;; The patterns that match these are at the end of this file. |
| 10596 |
|
| 10597 |
(define_expand "<insn>xf3" |
| 10598 |
[(set (match_operand:XF 0 "register_operand") |
| 10599 |
(plusminus:XF |
| 10600 |
(match_operand:XF 1 "register_operand") |
| 10601 |
(match_operand:XF 2 "register_operand")))] |
| 10602 |
"TARGET_80387") |
| 10603 |
|
| 10604 |
(define_expand "<insn>hf3" |
| 10605 |
[(set (match_operand:HF 0 "register_operand") |
| 10606 |
(plusminus:HF |
| 10607 |
(match_operand:HF 1 "register_operand") |
| 10608 |
(match_operand:HF 2 "nonimmediate_operand")))] |
| 10609 |
"TARGET_AVX512FP16") |
| 10610 |
|
| 10611 |
(define_expand "<insn><mode>3" |
| 10612 |
[(set (match_operand:MODEF 0 "register_operand") |
| 10613 |
(plusminus:MODEF |
| 10614 |
(match_operand:MODEF 1 "register_operand") |
| 10615 |
(match_operand:MODEF 2 "nonimmediate_operand")))] |
| 10616 |
"(TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)) |
| 10617 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)") |
| 10618 |
|
| 10619 |
;; Multiply instructions |
| 10620 |
|
| 10621 |
(define_expand "mul<mode>3" |
| 10622 |
[(parallel [(set (match_operand:SWIM248 0 "register_operand") |
| 10623 |
(mult:SWIM248 |
| 10624 |
(match_operand:SWIM248 1 "register_operand") |
| 10625 |
(match_operand:SWIM248 2 "<general_operand>"))) |
| 10626 |
(clobber (reg:CC FLAGS_REG))])]) |
| 10627 |
|
| 10628 |
(define_expand "mulqi3" |
| 10629 |
[(parallel [(set (match_operand:QI 0 "register_operand") |
| 10630 |
(mult:QI |
| 10631 |
(match_operand:QI 1 "register_operand") |
| 10632 |
(match_operand:QI 2 "nonimmediate_operand"))) |
| 10633 |
(clobber (reg:CC FLAGS_REG))])] |
| 10634 |
"TARGET_QIMODE_MATH") |
| 10635 |
|
| 10636 |
;; On AMDFAM10 |
| 10637 |
;; IMUL reg32/64, reg32/64, imm8 Direct |
| 10638 |
;; IMUL reg32/64, mem32/64, imm8 VectorPath |
| 10639 |
;; IMUL reg32/64, reg32/64, imm32 Direct |
| 10640 |
;; IMUL reg32/64, mem32/64, imm32 VectorPath |
| 10641 |
;; IMUL reg32/64, reg32/64 Direct |
| 10642 |
;; IMUL reg32/64, mem32/64 Direct |
| 10643 |
;; |
| 10644 |
;; On BDVER1, all above IMULs use DirectPath |
| 10645 |
;; |
| 10646 |
;; On AMDFAM10 |
| 10647 |
;; IMUL reg16, reg16, imm8 VectorPath |
| 10648 |
;; IMUL reg16, mem16, imm8 VectorPath |
| 10649 |
;; IMUL reg16, reg16, imm16 VectorPath |
| 10650 |
;; IMUL reg16, mem16, imm16 VectorPath |
| 10651 |
;; IMUL reg16, reg16 Direct |
| 10652 |
;; IMUL reg16, mem16 Direct |
| 10653 |
;; |
| 10654 |
;; On BDVER1, all HI MULs use DoublePath |
| 10655 |
|
| 10656 |
(define_insn "*mul<mode>3_1<nf_name>" |
| 10657 |
[(set (match_operand:SWIM248 0 "register_operand" "=r,r,r,r") |
| 10658 |
(mult:SWIM248 |
| 10659 |
(match_operand:SWIM248 1 "nonimmediate_operand" "%rm,rm,0,r") |
| 10660 |
(match_operand:SWIM248 2 "<general_operand>" "K,<i>,<m>r,<m>r")))] |
| 10661 |
"!(MEM_P (operands[1]) && MEM_P (operands[2])) |
| 10662 |
&& <nf_condition>" |
| 10663 |
"@ |
| 10664 |
<nf_prefix>imul{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10665 |
<nf_prefix>imul{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10666 |
<nf_prefix>imul{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10667 |
<nf_prefix>imul{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 10668 |
[(set_attr "type" "imul") |
| 10669 |
(set_attr "prefix_0f" "0,0,1,1") |
| 10670 |
(set_attr "isa" "*,*,*,apx_ndd") |
| 10671 |
(set (attr "athlon_decode") |
| 10672 |
(cond [(eq_attr "cpu" "athlon") |
| 10673 |
(const_string "vector") |
| 10674 |
(eq_attr "alternative" "1") |
| 10675 |
(const_string "vector") |
| 10676 |
(and (eq_attr "alternative" "2,3") |
| 10677 |
(ior (match_test "<MODE>mode == HImode") |
| 10678 |
(match_operand 1 "memory_operand"))) |
| 10679 |
(const_string "vector")] |
| 10680 |
(const_string "direct"))) |
| 10681 |
(set (attr "amdfam10_decode") |
| 10682 |
(cond [(and (eq_attr "alternative" "0,1") |
| 10683 |
(ior (match_test "<MODE>mode == HImode") |
| 10684 |
(match_operand 1 "memory_operand"))) |
| 10685 |
(const_string "vector")] |
| 10686 |
(const_string "direct"))) |
| 10687 |
(set (attr "bdver1_decode") |
| 10688 |
(if_then_else |
| 10689 |
(match_test "<MODE>mode == HImode") |
| 10690 |
(const_string "double") |
| 10691 |
(const_string "direct"))) |
| 10692 |
(set_attr "has_nf" "1") |
| 10693 |
(set_attr "mode" "<MODE>")]) |
| 10694 |
|
| 10695 |
(define_insn "*imulhi<mode>zu<nf_name>" |
| 10696 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 10697 |
(zero_extend:SWI48x |
| 10698 |
(mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,rm") |
| 10699 |
(match_operand:HI 2 "immediate_operand" "K,n"))))] |
| 10700 |
"TARGET_APX_ZU && <nf_condition>" |
| 10701 |
"@ |
| 10702 |
<nf_prefix>imulzu{w}\t{%2, %1, %w0|%w0, %1, %2} |
| 10703 |
<nf_prefix>imulzu{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 10704 |
[(set_attr "type" "imul") |
| 10705 |
(set_attr "mode" "HI")]) |
| 10706 |
|
| 10707 |
(define_insn "*mulsi3_1_zext<nf_name>" |
| 10708 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 10709 |
(zero_extend:DI |
| 10710 |
(mult:SI (match_operand:SI 1 "nonimmediate_operand" "%rm,rm,0,r") |
| 10711 |
(match_operand:SI 2 "x86_64_general_operand" "K,e,BMr,BMr"))))] |
| 10712 |
"TARGET_64BIT |
| 10713 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2])) |
| 10714 |
&& <nf_condition>" |
| 10715 |
"@ |
| 10716 |
<nf_prefix>imul{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 10717 |
<nf_prefix>imul{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 10718 |
<nf_prefix>imul{l}\t{%2, %k0|%k0, %2} |
| 10719 |
<nf_prefix>imul{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 10720 |
[(set_attr "type" "imul") |
| 10721 |
(set_attr "prefix_0f" "0,0,1,1") |
| 10722 |
(set_attr "isa" "*,*,*,apx_ndd") |
| 10723 |
(set (attr "athlon_decode") |
| 10724 |
(cond [(eq_attr "cpu" "athlon") |
| 10725 |
(const_string "vector") |
| 10726 |
(eq_attr "alternative" "1") |
| 10727 |
(const_string "vector") |
| 10728 |
(and (eq_attr "alternative" "2") |
| 10729 |
(match_operand 1 "memory_operand")) |
| 10730 |
(const_string "vector")] |
| 10731 |
(const_string "direct"))) |
| 10732 |
(set (attr "amdfam10_decode") |
| 10733 |
(cond [(and (eq_attr "alternative" "0,1") |
| 10734 |
(match_operand 1 "memory_operand")) |
| 10735 |
(const_string "vector")] |
| 10736 |
(const_string "direct"))) |
| 10737 |
(set_attr "bdver1_decode" "direct") |
| 10738 |
(set_attr "mode" "SI")]) |
| 10739 |
|
| 10740 |
;;On AMDFAM10 and BDVER1 |
| 10741 |
;; MUL reg8 Direct |
| 10742 |
;; MUL mem8 Direct |
| 10743 |
|
| 10744 |
(define_insn "*mulqi3_1<nf_name>" |
| 10745 |
[(set (match_operand:QI 0 "register_operand" "=a") |
| 10746 |
(mult:QI (match_operand:QI 1 "nonimmediate_operand" "%0") |
| 10747 |
(match_operand:QI 2 "nonimmediate_operand" "qm")))] |
| 10748 |
"TARGET_QIMODE_MATH |
| 10749 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2])) |
| 10750 |
&& <nf_condition>" |
| 10751 |
"<nf_prefix>mul{b}\t%2" |
| 10752 |
[(set_attr "type" "imul") |
| 10753 |
(set_attr "length_immediate" "0") |
| 10754 |
(set (attr "athlon_decode") |
| 10755 |
(if_then_else (eq_attr "cpu" "athlon") |
| 10756 |
(const_string "vector") |
| 10757 |
(const_string "direct"))) |
| 10758 |
(set_attr "amdfam10_decode" "direct") |
| 10759 |
(set_attr "bdver1_decode" "direct") |
| 10760 |
(set_attr "has_nf" "1") |
| 10761 |
(set_attr "mode" "QI")]) |
| 10762 |
|
| 10763 |
;; Multiply with jump on overflow. |
| 10764 |
(define_expand "mulv<mode>4" |
| 10765 |
[(parallel [(set (reg:CCO FLAGS_REG) |
| 10766 |
(eq:CCO (mult:<DWI> |
| 10767 |
(sign_extend:<DWI> |
| 10768 |
(match_operand:SWI248 1 "register_operand")) |
| 10769 |
(match_dup 4)) |
| 10770 |
(sign_extend:<DWI> |
| 10771 |
(mult:SWI248 (match_dup 1) |
| 10772 |
(match_operand:SWI248 2 |
| 10773 |
"<general_operand>"))))) |
| 10774 |
(set (match_operand:SWI248 0 "register_operand") |
| 10775 |
(mult:SWI248 (match_dup 1) (match_dup 2)))]) |
| 10776 |
(set (pc) (if_then_else |
| 10777 |
(eq (reg:CCO FLAGS_REG) (const_int 0)) |
| 10778 |
(label_ref (match_operand 3)) |
| 10779 |
(pc)))] |
| 10780 |
"" |
| 10781 |
{ |
| 10782 |
if (CONST_INT_P (operands[2])) |
| 10783 |
operands[4] = operands[2]; |
| 10784 |
else |
| 10785 |
operands[4] = gen_rtx_SIGN_EXTEND (<DWI>mode, operands[2]); |
| 10786 |
}) |
| 10787 |
|
| 10788 |
(define_insn "*mulv<mode>4" |
| 10789 |
[(set (reg:CCO FLAGS_REG) |
| 10790 |
(eq:CCO (mult:<DWI> |
| 10791 |
(sign_extend:<DWI> |
| 10792 |
(match_operand:SWI48 1 "nonimmediate_operand" "%rm,0,r")) |
| 10793 |
(sign_extend:<DWI> |
| 10794 |
(match_operand:SWI48 2 "x86_64_sext_operand" "We,mr,mr"))) |
| 10795 |
(sign_extend:<DWI> |
| 10796 |
(mult:SWI48 (match_dup 1) (match_dup 2))))) |
| 10797 |
(set (match_operand:SWI48 0 "register_operand" "=r,r,r") |
| 10798 |
(mult:SWI48 (match_dup 1) (match_dup 2)))] |
| 10799 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 10800 |
"@ |
| 10801 |
imul{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 10802 |
imul{<imodesuffix>}\t{%2, %0|%0, %2} |
| 10803 |
imul{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 10804 |
[(set_attr "type" "imul") |
| 10805 |
(set_attr "prefix_0f" "0,1,1") |
| 10806 |
(set_attr "isa" "*,*,apx_ndd") |
| 10807 |
(set (attr "athlon_decode") |
| 10808 |
(cond [(eq_attr "cpu" "athlon") |
| 10809 |
(const_string "vector") |
| 10810 |
(eq_attr "alternative" "0") |
| 10811 |
(const_string "vector") |
| 10812 |
(and (eq_attr "alternative" "1,2") |
| 10813 |
(match_operand 1 "memory_operand")) |
| 10814 |
(const_string "vector")] |
| 10815 |
(const_string "direct"))) |
| 10816 |
(set (attr "amdfam10_decode") |
| 10817 |
(cond [(and (eq_attr "alternative" "1,2") |
| 10818 |
(match_operand 1 "memory_operand")) |
| 10819 |
(const_string "vector")] |
| 10820 |
(const_string "direct"))) |
| 10821 |
(set_attr "bdver1_decode" "direct") |
| 10822 |
(set_attr "mode" "<MODE>")]) |
| 10823 |
|
| 10824 |
(define_insn "*mulvhi4" |
| 10825 |
[(set (reg:CCO FLAGS_REG) |
| 10826 |
(eq:CCO (mult:SI |
| 10827 |
(sign_extend:SI |
| 10828 |
(match_operand:HI 1 "nonimmediate_operand" "%0,r")) |
| 10829 |
(sign_extend:SI |
| 10830 |
(match_operand:HI 2 "nonimmediate_operand" "mr,mr"))) |
| 10831 |
(sign_extend:SI |
| 10832 |
(mult:HI (match_dup 1) (match_dup 2))))) |
| 10833 |
(set (match_operand:HI 0 "register_operand" "=r,r") |
| 10834 |
(mult:HI (match_dup 1) (match_dup 2)))] |
| 10835 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 10836 |
"@ |
| 10837 |
imul{w}\t{%2, %0|%0, %2} |
| 10838 |
imul{w}\t{%2, %1, %0|%0, %1, %2}" |
| 10839 |
[(set_attr "type" "imul") |
| 10840 |
(set_attr "prefix_0f" "1") |
| 10841 |
(set_attr "isa" "*,apx_ndd") |
| 10842 |
(set_attr "athlon_decode" "vector") |
| 10843 |
(set_attr "amdfam10_decode" "direct") |
| 10844 |
(set_attr "bdver1_decode" "double") |
| 10845 |
(set_attr "mode" "HI")]) |
| 10846 |
|
| 10847 |
(define_insn "*mulv<mode>4_1" |
| 10848 |
[(set (reg:CCO FLAGS_REG) |
| 10849 |
(eq:CCO (mult:<DWI> |
| 10850 |
(sign_extend:<DWI> |
| 10851 |
(match_operand:SWI248 1 "nonimmediate_operand" "rm,rm")) |
| 10852 |
(match_operand:<DWI> 3 "const_int_operand" "K,i")) |
| 10853 |
(sign_extend:<DWI> |
| 10854 |
(mult:SWI248 (match_dup 1) |
| 10855 |
(match_operand:SWI248 2 |
| 10856 |
"<immediate_operand>" "K,<i>"))))) |
| 10857 |
(set (match_operand:SWI248 0 "register_operand" "=r,r") |
| 10858 |
(mult:SWI248 (match_dup 1) (match_dup 2)))] |
| 10859 |
"!(MEM_P (operands[1]) && MEM_P (operands[2])) |
| 10860 |
&& CONST_INT_P (operands[2]) |
| 10861 |
&& INTVAL (operands[2]) == INTVAL (operands[3])" |
| 10862 |
"imul{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 10863 |
[(set_attr "type" "imul") |
| 10864 |
(set (attr "prefix_0f") |
| 10865 |
(if_then_else |
| 10866 |
(match_test "<MODE>mode == HImode") |
| 10867 |
(const_string "0") |
| 10868 |
(const_string "*"))) |
| 10869 |
(set (attr "athlon_decode") |
| 10870 |
(cond [(eq_attr "cpu" "athlon") |
| 10871 |
(const_string "vector") |
| 10872 |
(eq_attr "alternative" "1") |
| 10873 |
(const_string "vector")] |
| 10874 |
(const_string "direct"))) |
| 10875 |
(set (attr "amdfam10_decode") |
| 10876 |
(cond [(ior (match_test "<MODE>mode == HImode") |
| 10877 |
(match_operand 1 "memory_operand")) |
| 10878 |
(const_string "vector")] |
| 10879 |
(const_string "direct"))) |
| 10880 |
(set (attr "bdver1_decode") |
| 10881 |
(if_then_else |
| 10882 |
(match_test "<MODE>mode == HImode") |
| 10883 |
(const_string "double") |
| 10884 |
(const_string "direct"))) |
| 10885 |
(set_attr "mode" "<MODE>") |
| 10886 |
(set (attr "length_immediate") |
| 10887 |
(cond [(eq_attr "alternative" "0") |
| 10888 |
(const_string "1") |
| 10889 |
(match_test "<MODE_SIZE> == 8") |
| 10890 |
(const_string "4")] |
| 10891 |
(const_string "<MODE_SIZE>")))]) |
| 10892 |
|
| 10893 |
(define_expand "umulv<mode>4" |
| 10894 |
[(parallel [(set (reg:CCO FLAGS_REG) |
| 10895 |
(eq:CCO (mult:<DWI> |
| 10896 |
(zero_extend:<DWI> |
| 10897 |
(match_operand:SWI248 1 |
| 10898 |
"nonimmediate_operand")) |
| 10899 |
(zero_extend:<DWI> |
| 10900 |
(match_operand:SWI248 2 |
| 10901 |
"nonimmediate_operand"))) |
| 10902 |
(zero_extend:<DWI> |
| 10903 |
(mult:SWI248 (match_dup 1) (match_dup 2))))) |
| 10904 |
(set (match_operand:SWI248 0 "register_operand") |
| 10905 |
(mult:SWI248 (match_dup 1) (match_dup 2))) |
| 10906 |
(clobber (scratch:SWI248))]) |
| 10907 |
(set (pc) (if_then_else |
| 10908 |
(eq (reg:CCO FLAGS_REG) (const_int 0)) |
| 10909 |
(label_ref (match_operand 3)) |
| 10910 |
(pc)))] |
| 10911 |
"" |
| 10912 |
{ |
| 10913 |
if (MEM_P (operands[1]) && MEM_P (operands[2])) |
| 10914 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 10915 |
}) |
| 10916 |
|
| 10917 |
(define_insn "*umulv<mode>4" |
| 10918 |
[(set (reg:CCO FLAGS_REG) |
| 10919 |
(eq:CCO (mult:<DWI> |
| 10920 |
(zero_extend:<DWI> |
| 10921 |
(match_operand:SWI248 1 "nonimmediate_operand" "%0")) |
| 10922 |
(zero_extend:<DWI> |
| 10923 |
(match_operand:SWI248 2 "nonimmediate_operand" "rm"))) |
| 10924 |
(zero_extend:<DWI> |
| 10925 |
(mult:SWI248 (match_dup 1) (match_dup 2))))) |
| 10926 |
(set (match_operand:SWI248 0 "register_operand" "=a") |
| 10927 |
(mult:SWI248 (match_dup 1) (match_dup 2))) |
| 10928 |
(clobber (match_scratch:SWI248 3 "=d"))] |
| 10929 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 10930 |
"mul{<imodesuffix>}\t%2" |
| 10931 |
[(set_attr "type" "imul") |
| 10932 |
(set_attr "length_immediate" "0") |
| 10933 |
(set (attr "athlon_decode") |
| 10934 |
(if_then_else (eq_attr "cpu" "athlon") |
| 10935 |
(const_string "vector") |
| 10936 |
(const_string "double"))) |
| 10937 |
(set_attr "amdfam10_decode" "double") |
| 10938 |
(set_attr "bdver1_decode" "direct") |
| 10939 |
(set_attr "mode" "<MODE>")]) |
| 10940 |
|
| 10941 |
(define_expand "<u>mulvqi4" |
| 10942 |
[(parallel [(set (reg:CCO FLAGS_REG) |
| 10943 |
(eq:CCO (mult:HI |
| 10944 |
(any_extend:HI |
| 10945 |
(match_operand:QI 1 "nonimmediate_operand")) |
| 10946 |
(any_extend:HI |
| 10947 |
(match_operand:QI 2 "nonimmediate_operand"))) |
| 10948 |
(any_extend:HI |
| 10949 |
(mult:QI (match_dup 1) (match_dup 2))))) |
| 10950 |
(set (match_operand:QI 0 "register_operand") |
| 10951 |
(mult:QI (match_dup 1) (match_dup 2)))]) |
| 10952 |
(set (pc) (if_then_else |
| 10953 |
(eq (reg:CCO FLAGS_REG) (const_int 0)) |
| 10954 |
(label_ref (match_operand 3)) |
| 10955 |
(pc)))] |
| 10956 |
"TARGET_QIMODE_MATH" |
| 10957 |
{ |
| 10958 |
if (MEM_P (operands[1]) && MEM_P (operands[2])) |
| 10959 |
operands[1] = force_reg (QImode, operands[1]); |
| 10960 |
}) |
| 10961 |
|
| 10962 |
(define_insn "*<u>mulvqi4" |
| 10963 |
[(set (reg:CCO FLAGS_REG) |
| 10964 |
(eq:CCO (mult:HI |
| 10965 |
(any_extend:HI |
| 10966 |
(match_operand:QI 1 "nonimmediate_operand" "%0")) |
| 10967 |
(any_extend:HI |
| 10968 |
(match_operand:QI 2 "nonimmediate_operand" "qm"))) |
| 10969 |
(any_extend:HI |
| 10970 |
(mult:QI (match_dup 1) (match_dup 2))))) |
| 10971 |
(set (match_operand:QI 0 "register_operand" "=a") |
| 10972 |
(mult:QI (match_dup 1) (match_dup 2)))] |
| 10973 |
"TARGET_QIMODE_MATH |
| 10974 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 10975 |
"<sgnprefix>mul{b}\t%2" |
| 10976 |
[(set_attr "type" "imul") |
| 10977 |
(set_attr "length_immediate" "0") |
| 10978 |
(set (attr "athlon_decode") |
| 10979 |
(if_then_else (eq_attr "cpu" "athlon") |
| 10980 |
(const_string "vector") |
| 10981 |
(const_string "direct"))) |
| 10982 |
(set_attr "amdfam10_decode" "direct") |
| 10983 |
(set_attr "bdver1_decode" "direct") |
| 10984 |
(set_attr "mode" "QI")]) |
| 10985 |
|
| 10986 |
(define_expand "<u>mul<mode><dwi>3" |
| 10987 |
[(parallel [(set (match_operand:<DWI> 0 "register_operand") |
| 10988 |
(mult:<DWI> |
| 10989 |
(any_extend:<DWI> |
| 10990 |
(match_operand:DWIH 1 "register_operand")) |
| 10991 |
(any_extend:<DWI> |
| 10992 |
(match_operand:DWIH 2 "nonimmediate_operand")))) |
| 10993 |
(clobber (reg:CC FLAGS_REG))])]) |
| 10994 |
|
| 10995 |
(define_expand "<u>mulqihi3" |
| 10996 |
[(parallel [(set (match_operand:HI 0 "register_operand") |
| 10997 |
(mult:HI |
| 10998 |
(any_extend:HI |
| 10999 |
(match_operand:QI 1 "register_operand")) |
| 11000 |
(any_extend:HI |
| 11001 |
(match_operand:QI 2 "nonimmediate_operand")))) |
| 11002 |
(clobber (reg:CC FLAGS_REG))])] |
| 11003 |
"TARGET_QIMODE_MATH") |
| 11004 |
|
| 11005 |
(define_insn "*bmi2_umul<mode><dwi>3_1" |
| 11006 |
[(set (match_operand:DWIH 0 "register_operand" "=r") |
| 11007 |
(mult:DWIH |
| 11008 |
(match_operand:DWIH 2 "register_operand" "%d") |
| 11009 |
(match_operand:DWIH 3 "nonimmediate_operand" "rm"))) |
| 11010 |
(set (match_operand:DWIH 1 "register_operand" "=r") |
| 11011 |
(umul_highpart:DWIH (match_dup 2) (match_dup 3)))] |
| 11012 |
"TARGET_BMI2" |
| 11013 |
"mulx\t{%3, %0, %1|%1, %0, %3}" |
| 11014 |
[(set_attr "type" "imulx") |
| 11015 |
(set_attr "prefix" "vex") |
| 11016 |
(set_attr "mode" "<MODE>")]) |
| 11017 |
|
| 11018 |
;; Tweak *bmi2_umul<mode><dwi>3_1 to eliminate following mov. |
| 11019 |
(define_peephole2 |
| 11020 |
[(parallel [(set (match_operand:DWIH 0 "general_reg_operand") |
| 11021 |
(mult:DWIH (match_operand:DWIH 2 "register_operand") |
| 11022 |
(match_operand:DWIH 3 "nonimmediate_operand"))) |
| 11023 |
(set (match_operand:DWIH 1 "general_reg_operand") |
| 11024 |
(umul_highpart:DWIH (match_dup 2) (match_dup 3)))]) |
| 11025 |
(set (match_operand:DWIH 4 "general_reg_operand") |
| 11026 |
(match_operand:DWIH 5 "general_reg_operand"))] |
| 11027 |
"TARGET_BMI2 |
| 11028 |
&& ((REGNO (operands[5]) == REGNO (operands[0]) |
| 11029 |
&& REGNO (operands[1]) != REGNO (operands[4])) |
| 11030 |
|| (REGNO (operands[5]) == REGNO (operands[1]) |
| 11031 |
&& REGNO (operands[0]) != REGNO (operands[4]))) |
| 11032 |
&& peep2_reg_dead_p (2, operands[5])" |
| 11033 |
[(parallel [(set (match_dup 0) (mult:DWIH (match_dup 2) (match_dup 3))) |
| 11034 |
(set (match_dup 1) |
| 11035 |
(umul_highpart:DWIH (match_dup 2) (match_dup 3)))])] |
| 11036 |
{ |
| 11037 |
if (REGNO (operands[5]) == REGNO (operands[0])) |
| 11038 |
operands[0] = operands[4]; |
| 11039 |
else |
| 11040 |
operands[1] = operands[4]; |
| 11041 |
}) |
| 11042 |
|
| 11043 |
(define_insn "*umul<mode><dwi>3_1" |
| 11044 |
[(set (match_operand:<DWI> 0 "register_operand" "=r,A") |
| 11045 |
(mult:<DWI> |
| 11046 |
(zero_extend:<DWI> |
| 11047 |
(match_operand:DWIH 1 "register_operand" "%d,a")) |
| 11048 |
(zero_extend:<DWI> |
| 11049 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm,rm")))) |
| 11050 |
(clobber (reg:CC FLAGS_REG))] |
| 11051 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 11052 |
"@ |
| 11053 |
# |
| 11054 |
mul{<imodesuffix>}\t%2" |
| 11055 |
[(set_attr "isa" "bmi2,*") |
| 11056 |
(set_attr "type" "imulx,imul") |
| 11057 |
(set_attr "length_immediate" "*,0") |
| 11058 |
(set (attr "athlon_decode") |
| 11059 |
(cond [(eq_attr "alternative" "1") |
| 11060 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11061 |
(const_string "vector") |
| 11062 |
(const_string "double"))] |
| 11063 |
(const_string "*"))) |
| 11064 |
(set_attr "amdfam10_decode" "*,double") |
| 11065 |
(set_attr "bdver1_decode" "*,direct") |
| 11066 |
(set_attr "prefix" "vex,orig") |
| 11067 |
(set_attr "mode" "<MODE>")]) |
| 11068 |
|
| 11069 |
;; Convert mul to the mulx pattern to avoid flags dependency. |
| 11070 |
(define_split |
| 11071 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 11072 |
(mult:<DWI> |
| 11073 |
(zero_extend:<DWI> |
| 11074 |
(match_operand:DWIH 1 "register_operand")) |
| 11075 |
(zero_extend:<DWI> |
| 11076 |
(match_operand:DWIH 2 "nonimmediate_operand")))) |
| 11077 |
(clobber (reg:CC FLAGS_REG))] |
| 11078 |
"TARGET_BMI2 && reload_completed |
| 11079 |
&& REGNO (operands[1]) == DX_REG" |
| 11080 |
[(parallel [(set (match_dup 3) |
| 11081 |
(mult:DWIH (match_dup 1) (match_dup 2))) |
| 11082 |
(set (match_dup 4) |
| 11083 |
(umul_highpart:DWIH (match_dup 1) (match_dup 2)))])] |
| 11084 |
{ |
| 11085 |
split_double_mode (<DWI>mode, &operands[0], 1, &operands[3], &operands[4]); |
| 11086 |
|
| 11087 |
operands[5] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT); |
| 11088 |
}) |
| 11089 |
|
| 11090 |
(define_insn "*mul<mode><dwi>3_1<nf_name>" |
| 11091 |
[(set (match_operand:<DWI> 0 "register_operand" "=A") |
| 11092 |
(mult:<DWI> |
| 11093 |
(sign_extend:<DWI> |
| 11094 |
(match_operand:DWIH 1 "register_operand" "%a")) |
| 11095 |
(sign_extend:<DWI> |
| 11096 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm"))))] |
| 11097 |
"!(MEM_P (operands[1]) && MEM_P (operands[2])) |
| 11098 |
&& <nf_condition>" |
| 11099 |
"<nf_prefix>imul{<imodesuffix>}\t%2" |
| 11100 |
[(set_attr "type" "imul") |
| 11101 |
(set_attr "length_immediate" "0") |
| 11102 |
(set (attr "athlon_decode") |
| 11103 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11104 |
(const_string "vector") |
| 11105 |
(const_string "double"))) |
| 11106 |
(set_attr "amdfam10_decode" "double") |
| 11107 |
(set_attr "bdver1_decode" "direct") |
| 11108 |
(set_attr "mode" "<MODE>")]) |
| 11109 |
|
| 11110 |
(define_insn "*<u>mulqihi3_1<nf_name>" |
| 11111 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 11112 |
(mult:HI |
| 11113 |
(any_extend:HI |
| 11114 |
(match_operand:QI 1 "register_operand" "%0")) |
| 11115 |
(any_extend:HI |
| 11116 |
(match_operand:QI 2 "nonimmediate_operand" "qm"))))] |
| 11117 |
"TARGET_QIMODE_MATH |
| 11118 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2])) |
| 11119 |
&& <nf_condition>" |
| 11120 |
"<nf_prefix><sgnprefix>mul{b}\t%2" |
| 11121 |
[(set_attr "type" "imul") |
| 11122 |
(set_attr "length_immediate" "0") |
| 11123 |
(set (attr "athlon_decode") |
| 11124 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11125 |
(const_string "vector") |
| 11126 |
(const_string "direct"))) |
| 11127 |
(set_attr "amdfam10_decode" "direct") |
| 11128 |
(set_attr "bdver1_decode" "direct") |
| 11129 |
(set_attr "mode" "QI")]) |
| 11130 |
|
| 11131 |
;; Widening multiplication peephole2s to tweak register allocation. |
| 11132 |
;; mov imm,%rdx; mov %rdi,%rax; mulq %rdx -> mov imm,%rax; mulq %rdi |
| 11133 |
(define_peephole2 |
| 11134 |
[(set (match_operand:DWIH 0 "general_reg_operand") |
| 11135 |
(match_operand:DWIH 1 "immediate_operand")) |
| 11136 |
(set (match_operand:DWIH 2 "general_reg_operand") |
| 11137 |
(match_operand:DWIH 3 "general_reg_operand")) |
| 11138 |
(parallel [(set (match_operand:<DWI> 4 "general_reg_operand") |
| 11139 |
(mult:<DWI> (zero_extend:<DWI> (match_dup 2)) |
| 11140 |
(zero_extend:<DWI> (match_dup 0)))) |
| 11141 |
(clobber (reg:CC FLAGS_REG))])] |
| 11142 |
"REGNO (operands[3]) != AX_REG |
| 11143 |
&& REGNO (operands[0]) != REGNO (operands[2]) |
| 11144 |
&& REGNO (operands[0]) != REGNO (operands[3]) |
| 11145 |
&& (REGNO (operands[0]) == REGNO (operands[4]) |
| 11146 |
|| REGNO (operands[0]) == DX_REG |
| 11147 |
|| peep2_reg_dead_p (3, operands[0]))" |
| 11148 |
[(set (match_dup 2) (match_dup 1)) |
| 11149 |
(parallel [(set (match_dup 4) |
| 11150 |
(mult:<DWI> (zero_extend:<DWI> (match_dup 2)) |
| 11151 |
(zero_extend:<DWI> (match_dup 3)))) |
| 11152 |
(clobber (reg:CC FLAGS_REG))])]) |
| 11153 |
|
| 11154 |
;; mov imm,%rax; mov %rdi,%rdx; mulx %rax -> mov imm,%rdx; mulx %rdi |
| 11155 |
(define_peephole2 |
| 11156 |
[(set (match_operand:DWIH 0 "general_reg_operand") |
| 11157 |
(match_operand:DWIH 1 "immediate_operand")) |
| 11158 |
(set (match_operand:DWIH 2 "general_reg_operand") |
| 11159 |
(match_operand:DWIH 3 "general_reg_operand")) |
| 11160 |
(parallel [(set (match_operand:DWIH 4 "general_reg_operand") |
| 11161 |
(mult:DWIH (match_dup 2) (match_dup 0))) |
| 11162 |
(set (match_operand:DWIH 5 "general_reg_operand") |
| 11163 |
(umul_highpart:DWIH (match_dup 2) (match_dup 0)))])] |
| 11164 |
"REGNO (operands[3]) != DX_REG |
| 11165 |
&& REGNO (operands[0]) != REGNO (operands[2]) |
| 11166 |
&& REGNO (operands[0]) != REGNO (operands[3]) |
| 11167 |
&& (REGNO (operands[0]) == REGNO (operands[4]) |
| 11168 |
|| REGNO (operands[0]) == REGNO (operands[5]) |
| 11169 |
|| peep2_reg_dead_p (3, operands[0])) |
| 11170 |
&& (REGNO (operands[2]) == REGNO (operands[4]) |
| 11171 |
|| REGNO (operands[2]) == REGNO (operands[5]) |
| 11172 |
|| peep2_reg_dead_p (3, operands[2]))" |
| 11173 |
[(set (match_dup 2) (match_dup 1)) |
| 11174 |
(parallel [(set (match_dup 4) |
| 11175 |
(mult:DWIH (match_dup 2) (match_dup 3))) |
| 11176 |
(set (match_dup 5) |
| 11177 |
(umul_highpart:DWIH (match_dup 2) (match_dup 3)))])]) |
| 11178 |
|
| 11179 |
;; Highpart multiplication patterns |
| 11180 |
(define_insn "<s>mul<mode>3_highpart" |
| 11181 |
[(set (match_operand:DWIH 0 "register_operand" "=d") |
| 11182 |
(any_mul_highpart:DWIH |
| 11183 |
(match_operand:DWIH 1 "register_operand" "%a") |
| 11184 |
(match_operand:DWIH 2 "nonimmediate_operand" "rm"))) |
| 11185 |
(clobber (match_scratch:DWIH 3 "=1")) |
| 11186 |
(clobber (reg:CC FLAGS_REG))] |
| 11187 |
"" |
| 11188 |
"<sgnprefix>mul{<imodesuffix>}\t%2" |
| 11189 |
[(set_attr "type" "imul") |
| 11190 |
(set_attr "length_immediate" "0") |
| 11191 |
(set (attr "athlon_decode") |
| 11192 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11193 |
(const_string "vector") |
| 11194 |
(const_string "double"))) |
| 11195 |
(set_attr "amdfam10_decode" "double") |
| 11196 |
(set_attr "bdver1_decode" "direct") |
| 11197 |
(set_attr "mode" "<MODE>")]) |
| 11198 |
|
| 11199 |
(define_insn "*<s>mulsi3_highpart_zext" |
| 11200 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 11201 |
(zero_extend:DI |
| 11202 |
(any_mul_highpart:SI |
| 11203 |
(match_operand:SI 1 "register_operand" "%a") |
| 11204 |
(match_operand:SI 2 "nonimmediate_operand" "rm")))) |
| 11205 |
(clobber (match_scratch:SI 3 "=1")) |
| 11206 |
(clobber (reg:CC FLAGS_REG))] |
| 11207 |
"TARGET_64BIT" |
| 11208 |
"<sgnprefix>mul{l}\t%2" |
| 11209 |
[(set_attr "type" "imul") |
| 11210 |
(set_attr "length_immediate" "0") |
| 11211 |
(set (attr "athlon_decode") |
| 11212 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11213 |
(const_string "vector") |
| 11214 |
(const_string "double"))) |
| 11215 |
(set_attr "amdfam10_decode" "double") |
| 11216 |
(set_attr "bdver1_decode" "direct") |
| 11217 |
(set_attr "mode" "SI")]) |
| 11218 |
|
| 11219 |
(define_insn "*<s>muldi3_highpart_1" |
| 11220 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 11221 |
(truncate:DI |
| 11222 |
(lshiftrt:TI |
| 11223 |
(mult:TI |
| 11224 |
(any_extend:TI |
| 11225 |
(match_operand:DI 1 "nonimmediate_operand" "%a")) |
| 11226 |
(any_extend:TI |
| 11227 |
(match_operand:DI 2 "nonimmediate_operand" "rm"))) |
| 11228 |
(const_int 64)))) |
| 11229 |
(clobber (match_scratch:DI 3 "=1")) |
| 11230 |
(clobber (reg:CC FLAGS_REG))] |
| 11231 |
"TARGET_64BIT |
| 11232 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 11233 |
"<sgnprefix>mul{q}\t%2" |
| 11234 |
[(set_attr "type" "imul") |
| 11235 |
(set_attr "length_immediate" "0") |
| 11236 |
(set (attr "athlon_decode") |
| 11237 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11238 |
(const_string "vector") |
| 11239 |
(const_string "double"))) |
| 11240 |
(set_attr "amdfam10_decode" "double") |
| 11241 |
(set_attr "bdver1_decode" "direct") |
| 11242 |
(set_attr "mode" "DI")]) |
| 11243 |
|
| 11244 |
(define_insn "*<s>mulsi3_highpart_zext" |
| 11245 |
[(set (match_operand:DI 0 "register_operand" "=d") |
| 11246 |
(zero_extend:DI (truncate:SI |
| 11247 |
(lshiftrt:DI |
| 11248 |
(mult:DI (any_extend:DI |
| 11249 |
(match_operand:SI 1 "nonimmediate_operand" "%a")) |
| 11250 |
(any_extend:DI |
| 11251 |
(match_operand:SI 2 "nonimmediate_operand" "rm"))) |
| 11252 |
(const_int 32))))) |
| 11253 |
(clobber (match_scratch:SI 3 "=1")) |
| 11254 |
(clobber (reg:CC FLAGS_REG))] |
| 11255 |
"TARGET_64BIT |
| 11256 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 11257 |
"<sgnprefix>mul{l}\t%2" |
| 11258 |
[(set_attr "type" "imul") |
| 11259 |
(set_attr "length_immediate" "0") |
| 11260 |
(set (attr "athlon_decode") |
| 11261 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11262 |
(const_string "vector") |
| 11263 |
(const_string "double"))) |
| 11264 |
(set_attr "amdfam10_decode" "double") |
| 11265 |
(set_attr "bdver1_decode" "direct") |
| 11266 |
(set_attr "mode" "SI")]) |
| 11267 |
|
| 11268 |
(define_insn "*<s>mulsi3_highpart_1" |
| 11269 |
[(set (match_operand:SI 0 "register_operand" "=d") |
| 11270 |
(truncate:SI |
| 11271 |
(lshiftrt:DI |
| 11272 |
(mult:DI |
| 11273 |
(any_extend:DI |
| 11274 |
(match_operand:SI 1 "nonimmediate_operand" "%a")) |
| 11275 |
(any_extend:DI |
| 11276 |
(match_operand:SI 2 "nonimmediate_operand" "rm"))) |
| 11277 |
(const_int 32)))) |
| 11278 |
(clobber (match_scratch:SI 3 "=1")) |
| 11279 |
(clobber (reg:CC FLAGS_REG))] |
| 11280 |
"!(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 11281 |
"<sgnprefix>mul{l}\t%2" |
| 11282 |
[(set_attr "type" "imul") |
| 11283 |
(set_attr "length_immediate" "0") |
| 11284 |
(set (attr "athlon_decode") |
| 11285 |
(if_then_else (eq_attr "cpu" "athlon") |
| 11286 |
(const_string "vector") |
| 11287 |
(const_string "double"))) |
| 11288 |
(set_attr "amdfam10_decode" "double") |
| 11289 |
(set_attr "bdver1_decode" "direct") |
| 11290 |
(set_attr "mode" "SI")]) |
| 11291 |
|
| 11292 |
;; Highpart multiplication peephole2s to tweak register allocation. |
| 11293 |
;; mov imm,%rdx; mov %rdi,%rax; imulq %rdx -> mov imm,%rax; imulq %rdi |
| 11294 |
(define_peephole2 |
| 11295 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 11296 |
(match_operand:SWI48 1 "immediate_operand")) |
| 11297 |
(set (match_operand:SWI48 2 "general_reg_operand") |
| 11298 |
(match_operand:SWI48 3 "general_reg_operand")) |
| 11299 |
(parallel [(set (match_operand:SWI48 4 "general_reg_operand") |
| 11300 |
(any_mul_highpart:SWI48 (match_dup 2) (match_dup 0))) |
| 11301 |
(clobber (match_dup 2)) |
| 11302 |
(clobber (reg:CC FLAGS_REG))])] |
| 11303 |
"REGNO (operands[3]) != AX_REG |
| 11304 |
&& REGNO (operands[0]) != REGNO (operands[2]) |
| 11305 |
&& REGNO (operands[0]) != REGNO (operands[3]) |
| 11306 |
&& (REGNO (operands[0]) == REGNO (operands[4]) |
| 11307 |
|| peep2_reg_dead_p (3, operands[0]))" |
| 11308 |
[(set (match_dup 2) (match_dup 1)) |
| 11309 |
(parallel [(set (match_dup 4) |
| 11310 |
(any_mul_highpart:SWI48 (match_dup 2) (match_dup 3))) |
| 11311 |
(clobber (match_dup 2)) |
| 11312 |
(clobber (reg:CC FLAGS_REG))])]) |
| 11313 |
|
| 11314 |
(define_peephole2 |
| 11315 |
[(set (match_operand:SI 0 "general_reg_operand") |
| 11316 |
(match_operand:SI 1 "immediate_operand")) |
| 11317 |
(set (match_operand:SI 2 "general_reg_operand") |
| 11318 |
(match_operand:SI 3 "general_reg_operand")) |
| 11319 |
(parallel [(set (match_operand:DI 4 "general_reg_operand") |
| 11320 |
(zero_extend:DI |
| 11321 |
(any_mul_highpart:SI (match_dup 2) (match_dup 0)))) |
| 11322 |
(clobber (match_dup 2)) |
| 11323 |
(clobber (reg:CC FLAGS_REG))])] |
| 11324 |
"TARGET_64BIT |
| 11325 |
&& REGNO (operands[3]) != AX_REG |
| 11326 |
&& REGNO (operands[0]) != REGNO (operands[2]) |
| 11327 |
&& REGNO (operands[2]) != REGNO (operands[3]) |
| 11328 |
&& REGNO (operands[0]) != REGNO (operands[3]) |
| 11329 |
&& (REGNO (operands[0]) == REGNO (operands[4]) |
| 11330 |
|| peep2_reg_dead_p (3, operands[0]))" |
| 11331 |
[(set (match_dup 2) (match_dup 1)) |
| 11332 |
(parallel [(set (match_dup 4) |
| 11333 |
(zero_extend:DI |
| 11334 |
(any_mul_highpart:SI (match_dup 2) (match_dup 3)))) |
| 11335 |
(clobber (match_dup 2)) |
| 11336 |
(clobber (reg:CC FLAGS_REG))])]) |
| 11337 |
|
| 11338 |
;; The patterns that match these are at the end of this file. |
| 11339 |
|
| 11340 |
(define_expand "mulxf3" |
| 11341 |
[(set (match_operand:XF 0 "register_operand") |
| 11342 |
(mult:XF (match_operand:XF 1 "register_operand") |
| 11343 |
(match_operand:XF 2 "register_operand")))] |
| 11344 |
"TARGET_80387") |
| 11345 |
|
| 11346 |
(define_expand "mulhf3" |
| 11347 |
[(set (match_operand:HF 0 "register_operand") |
| 11348 |
(mult:HF (match_operand:HF 1 "register_operand") |
| 11349 |
(match_operand:HF 2 "nonimmediate_operand")))] |
| 11350 |
"TARGET_AVX512FP16") |
| 11351 |
|
| 11352 |
(define_expand "mul<mode>3" |
| 11353 |
[(set (match_operand:MODEF 0 "register_operand") |
| 11354 |
(mult:MODEF (match_operand:MODEF 1 "register_operand") |
| 11355 |
(match_operand:MODEF 2 "nonimmediate_operand")))] |
| 11356 |
"(TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)) |
| 11357 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)") |
| 11358 |
|
| 11359 |
;; Divide instructions |
| 11360 |
|
| 11361 |
;; The patterns that match these are at the end of this file. |
| 11362 |
|
| 11363 |
(define_expand "divxf3" |
| 11364 |
[(set (match_operand:XF 0 "register_operand") |
| 11365 |
(div:XF (match_operand:XF 1 "register_operand") |
| 11366 |
(match_operand:XF 2 "register_operand")))] |
| 11367 |
"TARGET_80387") |
| 11368 |
|
| 11369 |
/* There is no more precision loss than Newton-Rhapson approximation |
| 11370 |
when using HFmode rcp/rsqrt, so do the transformation directly under |
| 11371 |
TARGET_RECIP_DIV and fast-math. */ |
| 11372 |
(define_expand "divhf3" |
| 11373 |
[(set (match_operand:HF 0 "register_operand") |
| 11374 |
(div:HF (match_operand:HF 1 "register_operand") |
| 11375 |
(match_operand:HF 2 "nonimmediate_operand")))] |
| 11376 |
"TARGET_AVX512FP16" |
| 11377 |
{ |
| 11378 |
if (TARGET_RECIP_DIV |
| 11379 |
&& optimize_insn_for_speed_p () |
| 11380 |
&& flag_finite_math_only && !flag_trapping_math |
| 11381 |
&& flag_unsafe_math_optimizations) |
| 11382 |
{ |
| 11383 |
rtx op = gen_reg_rtx (HFmode); |
| 11384 |
operands[2] = force_reg (HFmode, operands[2]); |
| 11385 |
emit_insn (gen_rcphf2 (op, operands[2])); |
| 11386 |
emit_insn (gen_mulhf3 (operands[0], operands[1], op)); |
| 11387 |
DONE; |
| 11388 |
} |
| 11389 |
}) |
| 11390 |
|
| 11391 |
(define_expand "div<mode>3" |
| 11392 |
[(set (match_operand:MODEF 0 "register_operand") |
| 11393 |
(div:MODEF (match_operand:MODEF 1 "register_operand") |
| 11394 |
(match_operand:MODEF 2 "nonimmediate_operand")))] |
| 11395 |
"(TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode)) |
| 11396 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 11397 |
{ |
| 11398 |
if (<MODE>mode == SFmode |
| 11399 |
&& TARGET_SSE && TARGET_SSE_MATH |
| 11400 |
&& TARGET_RECIP_DIV |
| 11401 |
&& optimize_insn_for_speed_p () |
| 11402 |
&& flag_finite_math_only && !flag_trapping_math |
| 11403 |
&& flag_unsafe_math_optimizations) |
| 11404 |
{ |
| 11405 |
ix86_emit_swdivsf (operands[0], operands[1], |
| 11406 |
operands[2], SFmode); |
| 11407 |
DONE; |
| 11408 |
} |
| 11409 |
}) |
| 11410 |
|
| 11411 |
;; Divmod instructions. |
| 11412 |
|
| 11413 |
(define_code_iterator any_div [div udiv]) |
| 11414 |
(define_code_attr paired_mod [(div "mod") (udiv "umod")]) |
| 11415 |
|
| 11416 |
(define_expand "<u>divmod<mode>4" |
| 11417 |
[(parallel [(set (match_operand:SWIM248 0 "register_operand") |
| 11418 |
(any_div:SWIM248 |
| 11419 |
(match_operand:SWIM248 1 "register_operand") |
| 11420 |
(match_operand:SWIM248 2 "nonimmediate_operand"))) |
| 11421 |
(set (match_operand:SWIM248 3 "register_operand") |
| 11422 |
(<paired_mod>:SWIM248 (match_dup 1) (match_dup 2))) |
| 11423 |
(clobber (reg:CC FLAGS_REG))])]) |
| 11424 |
|
| 11425 |
;; Split with 8bit unsigned divide: |
| 11426 |
;; if (dividend an divisor are in [0-255]) |
| 11427 |
;; use 8bit unsigned integer divide |
| 11428 |
;; else |
| 11429 |
;; use original integer divide |
| 11430 |
(define_split |
| 11431 |
[(set (match_operand:SWI48 0 "register_operand") |
| 11432 |
(any_div:SWI48 (match_operand:SWI48 2 "register_operand") |
| 11433 |
(match_operand:SWI48 3 "nonimmediate_operand"))) |
| 11434 |
(set (match_operand:SWI48 1 "register_operand") |
| 11435 |
(<paired_mod>:SWI48 (match_dup 2) (match_dup 3))) |
| 11436 |
(clobber (reg:CC FLAGS_REG))] |
| 11437 |
"TARGET_USE_8BIT_IDIV |
| 11438 |
&& TARGET_QIMODE_MATH |
| 11439 |
&& can_create_pseudo_p () |
| 11440 |
&& !optimize_insn_for_size_p ()" |
| 11441 |
[(const_int 0)] |
| 11442 |
"ix86_split_idivmod (<MODE>mode, operands, <u_bool>); DONE;") |
| 11443 |
|
| 11444 |
(define_split |
| 11445 |
[(set (match_operand:DI 0 "register_operand") |
| 11446 |
(zero_extend:DI |
| 11447 |
(any_div:SI (match_operand:SI 2 "register_operand") |
| 11448 |
(match_operand:SI 3 "nonimmediate_operand")))) |
| 11449 |
(set (match_operand:SI 1 "register_operand") |
| 11450 |
(<paired_mod>:SI (match_dup 2) (match_dup 3))) |
| 11451 |
(clobber (reg:CC FLAGS_REG))] |
| 11452 |
"TARGET_64BIT |
| 11453 |
&& TARGET_USE_8BIT_IDIV |
| 11454 |
&& TARGET_QIMODE_MATH |
| 11455 |
&& can_create_pseudo_p () |
| 11456 |
&& !optimize_insn_for_size_p ()" |
| 11457 |
[(const_int 0)] |
| 11458 |
"ix86_split_idivmod (SImode, operands, <u_bool>); DONE;") |
| 11459 |
|
| 11460 |
(define_split |
| 11461 |
[(set (match_operand:DI 1 "register_operand") |
| 11462 |
(zero_extend:DI |
| 11463 |
(<paired_mod>:SI (match_operand:SI 2 "register_operand") |
| 11464 |
(match_operand:SI 3 "nonimmediate_operand")))) |
| 11465 |
(set (match_operand:SI 0 "register_operand") |
| 11466 |
(any_div:SI (match_dup 2) (match_dup 3))) |
| 11467 |
(clobber (reg:CC FLAGS_REG))] |
| 11468 |
"TARGET_64BIT |
| 11469 |
&& TARGET_USE_8BIT_IDIV |
| 11470 |
&& TARGET_QIMODE_MATH |
| 11471 |
&& can_create_pseudo_p () |
| 11472 |
&& !optimize_insn_for_size_p ()" |
| 11473 |
[(const_int 0)] |
| 11474 |
"ix86_split_idivmod (SImode, operands, <u_bool>); DONE;") |
| 11475 |
|
| 11476 |
(define_insn_and_split "divmod<mode>4_1" |
| 11477 |
[(set (match_operand:SWI48 0 "register_operand" "=a") |
| 11478 |
(div:SWI48 (match_operand:SWI48 2 "register_operand" "0") |
| 11479 |
(match_operand:SWI48 3 "nonimmediate_operand" "rm"))) |
| 11480 |
(set (match_operand:SWI48 1 "register_operand" "=&d") |
| 11481 |
(mod:SWI48 (match_dup 2) (match_dup 3))) |
| 11482 |
(unspec [(const_int 0)] UNSPEC_DIV_ALREADY_SPLIT) |
| 11483 |
(clobber (reg:CC FLAGS_REG))] |
| 11484 |
"" |
| 11485 |
"#" |
| 11486 |
"reload_completed" |
| 11487 |
[(parallel [(set (match_dup 1) |
| 11488 |
(ashiftrt:SWI48 (match_dup 4) (match_dup 5))) |
| 11489 |
(clobber (reg:CC FLAGS_REG))]) |
| 11490 |
(parallel [(set (match_dup 0) |
| 11491 |
(div:SWI48 (match_dup 2) (match_dup 3))) |
| 11492 |
(set (match_dup 1) |
| 11493 |
(mod:SWI48 (match_dup 2) (match_dup 3))) |
| 11494 |
(use (match_dup 1)) |
| 11495 |
(clobber (reg:CC FLAGS_REG))])] |
| 11496 |
{ |
| 11497 |
operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)-1); |
| 11498 |
|
| 11499 |
if (optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 11500 |
operands[4] = operands[2]; |
| 11501 |
else |
| 11502 |
{ |
| 11503 |
/* Avoid use of cltd in favor of a mov+shift. */ |
| 11504 |
emit_move_insn (operands[1], operands[2]); |
| 11505 |
operands[4] = operands[1]; |
| 11506 |
} |
| 11507 |
} |
| 11508 |
[(set_attr "type" "multi") |
| 11509 |
(set_attr "mode" "<MODE>")]) |
| 11510 |
|
| 11511 |
(define_insn_and_split "udivmod<mode>4_1" |
| 11512 |
[(set (match_operand:SWI48 0 "register_operand" "=a") |
| 11513 |
(udiv:SWI48 (match_operand:SWI48 2 "register_operand" "0") |
| 11514 |
(match_operand:SWI48 3 "nonimmediate_operand" "rm"))) |
| 11515 |
(set (match_operand:SWI48 1 "register_operand" "=&d") |
| 11516 |
(umod:SWI48 (match_dup 2) (match_dup 3))) |
| 11517 |
(unspec [(const_int 0)] UNSPEC_DIV_ALREADY_SPLIT) |
| 11518 |
(clobber (reg:CC FLAGS_REG))] |
| 11519 |
"" |
| 11520 |
"#" |
| 11521 |
"reload_completed" |
| 11522 |
[(set (match_dup 1) (const_int 0)) |
| 11523 |
(parallel [(set (match_dup 0) |
| 11524 |
(udiv:SWI48 (match_dup 2) (match_dup 3))) |
| 11525 |
(set (match_dup 1) |
| 11526 |
(umod:SWI48 (match_dup 2) (match_dup 3))) |
| 11527 |
(use (match_dup 1)) |
| 11528 |
(clobber (reg:CC FLAGS_REG))])] |
| 11529 |
"" |
| 11530 |
[(set_attr "type" "multi") |
| 11531 |
(set_attr "mode" "<MODE>")]) |
| 11532 |
|
| 11533 |
(define_insn_and_split "divmodsi4_zext_1" |
| 11534 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 11535 |
(zero_extend:DI |
| 11536 |
(div:SI (match_operand:SI 2 "register_operand" "0") |
| 11537 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11538 |
(set (match_operand:SI 1 "register_operand" "=&d") |
| 11539 |
(mod:SI (match_dup 2) (match_dup 3))) |
| 11540 |
(unspec [(const_int 0)] UNSPEC_DIV_ALREADY_SPLIT) |
| 11541 |
(clobber (reg:CC FLAGS_REG))] |
| 11542 |
"TARGET_64BIT" |
| 11543 |
"#" |
| 11544 |
"&& reload_completed" |
| 11545 |
[(parallel [(set (match_dup 1) |
| 11546 |
(ashiftrt:SI (match_dup 4) (match_dup 5))) |
| 11547 |
(clobber (reg:CC FLAGS_REG))]) |
| 11548 |
(parallel [(set (match_dup 0) |
| 11549 |
(zero_extend:DI (div:SI (match_dup 2) (match_dup 3)))) |
| 11550 |
(set (match_dup 1) |
| 11551 |
(mod:SI (match_dup 2) (match_dup 3))) |
| 11552 |
(use (match_dup 1)) |
| 11553 |
(clobber (reg:CC FLAGS_REG))])] |
| 11554 |
{ |
| 11555 |
operands[5] = GEN_INT (GET_MODE_BITSIZE (SImode)-1); |
| 11556 |
|
| 11557 |
if (optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 11558 |
operands[4] = operands[2]; |
| 11559 |
else |
| 11560 |
{ |
| 11561 |
/* Avoid use of cltd in favor of a mov+shift. */ |
| 11562 |
emit_move_insn (operands[1], operands[2]); |
| 11563 |
operands[4] = operands[1]; |
| 11564 |
} |
| 11565 |
} |
| 11566 |
[(set_attr "type" "multi") |
| 11567 |
(set_attr "mode" "SI")]) |
| 11568 |
|
| 11569 |
(define_insn_and_split "udivmodsi4_zext_1" |
| 11570 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 11571 |
(zero_extend:DI |
| 11572 |
(udiv:SI (match_operand:SI 2 "register_operand" "0") |
| 11573 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11574 |
(set (match_operand:SI 1 "register_operand" "=&d") |
| 11575 |
(umod:SI (match_dup 2) (match_dup 3))) |
| 11576 |
(unspec [(const_int 0)] UNSPEC_DIV_ALREADY_SPLIT) |
| 11577 |
(clobber (reg:CC FLAGS_REG))] |
| 11578 |
"TARGET_64BIT" |
| 11579 |
"#" |
| 11580 |
"&& reload_completed" |
| 11581 |
[(set (match_dup 1) (const_int 0)) |
| 11582 |
(parallel [(set (match_dup 0) |
| 11583 |
(zero_extend:DI (udiv:SI (match_dup 2) (match_dup 3)))) |
| 11584 |
(set (match_dup 1) |
| 11585 |
(umod:SI (match_dup 2) (match_dup 3))) |
| 11586 |
(use (match_dup 1)) |
| 11587 |
(clobber (reg:CC FLAGS_REG))])] |
| 11588 |
"" |
| 11589 |
[(set_attr "type" "multi") |
| 11590 |
(set_attr "mode" "SI")]) |
| 11591 |
|
| 11592 |
(define_insn_and_split "divmodsi4_zext_2" |
| 11593 |
[(set (match_operand:DI 1 "register_operand" "=&d") |
| 11594 |
(zero_extend:DI |
| 11595 |
(mod:SI (match_operand:SI 2 "register_operand" "0") |
| 11596 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11597 |
(set (match_operand:SI 0 "register_operand" "=a") |
| 11598 |
(div:SI (match_dup 2) (match_dup 3))) |
| 11599 |
(unspec [(const_int 0)] UNSPEC_DIV_ALREADY_SPLIT) |
| 11600 |
(clobber (reg:CC FLAGS_REG))] |
| 11601 |
"TARGET_64BIT" |
| 11602 |
"#" |
| 11603 |
"&& reload_completed" |
| 11604 |
[(parallel [(set (match_dup 6) |
| 11605 |
(ashiftrt:SI (match_dup 4) (match_dup 5))) |
| 11606 |
(clobber (reg:CC FLAGS_REG))]) |
| 11607 |
(parallel [(set (match_dup 1) |
| 11608 |
(zero_extend:DI (mod:SI (match_dup 2) (match_dup 3)))) |
| 11609 |
(set (match_dup 0) |
| 11610 |
(div:SI (match_dup 2) (match_dup 3))) |
| 11611 |
(use (match_dup 6)) |
| 11612 |
(clobber (reg:CC FLAGS_REG))])] |
| 11613 |
{ |
| 11614 |
operands[5] = GEN_INT (GET_MODE_BITSIZE (SImode)-1); |
| 11615 |
operands[6] = gen_lowpart (SImode, operands[1]); |
| 11616 |
|
| 11617 |
if (optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 11618 |
operands[4] = operands[2]; |
| 11619 |
else |
| 11620 |
{ |
| 11621 |
/* Avoid use of cltd in favor of a mov+shift. */ |
| 11622 |
emit_move_insn (operands[6], operands[2]); |
| 11623 |
operands[4] = operands[6]; |
| 11624 |
} |
| 11625 |
} |
| 11626 |
[(set_attr "type" "multi") |
| 11627 |
(set_attr "mode" "SI")]) |
| 11628 |
|
| 11629 |
(define_insn_and_split "udivmodsi4_zext_2" |
| 11630 |
[(set (match_operand:DI 1 "register_operand" "=&d") |
| 11631 |
(zero_extend:DI |
| 11632 |
(umod:SI (match_operand:SI 2 "register_operand" "0") |
| 11633 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11634 |
(set (match_operand:SI 0 "register_operand" "=a") |
| 11635 |
(udiv:SI (match_dup 2) (match_dup 3))) |
| 11636 |
(unspec [(const_int 0)] UNSPEC_DIV_ALREADY_SPLIT) |
| 11637 |
(clobber (reg:CC FLAGS_REG))] |
| 11638 |
"TARGET_64BIT" |
| 11639 |
"#" |
| 11640 |
"&& reload_completed" |
| 11641 |
[(set (match_dup 4) (const_int 0)) |
| 11642 |
(parallel [(set (match_dup 1) |
| 11643 |
(zero_extend:DI (umod:SI (match_dup 2) (match_dup 3)))) |
| 11644 |
(set (match_dup 0) |
| 11645 |
(udiv:SI (match_dup 2) (match_dup 3))) |
| 11646 |
(use (match_dup 4)) |
| 11647 |
(clobber (reg:CC FLAGS_REG))])] |
| 11648 |
"operands[4] = gen_lowpart (SImode, operands[1]);" |
| 11649 |
[(set_attr "type" "multi") |
| 11650 |
(set_attr "mode" "SI")]) |
| 11651 |
|
| 11652 |
(define_insn_and_split "*divmod<mode>4" |
| 11653 |
[(set (match_operand:SWIM248 0 "register_operand" "=a") |
| 11654 |
(div:SWIM248 (match_operand:SWIM248 2 "register_operand" "0") |
| 11655 |
(match_operand:SWIM248 3 "nonimmediate_operand" "rm"))) |
| 11656 |
(set (match_operand:SWIM248 1 "register_operand" "=&d") |
| 11657 |
(mod:SWIM248 (match_dup 2) (match_dup 3))) |
| 11658 |
(clobber (reg:CC FLAGS_REG))] |
| 11659 |
"" |
| 11660 |
"#" |
| 11661 |
"reload_completed" |
| 11662 |
[(parallel [(set (match_dup 1) |
| 11663 |
(ashiftrt:SWIM248 (match_dup 4) (match_dup 5))) |
| 11664 |
(clobber (reg:CC FLAGS_REG))]) |
| 11665 |
(parallel [(set (match_dup 0) |
| 11666 |
(div:SWIM248 (match_dup 2) (match_dup 3))) |
| 11667 |
(set (match_dup 1) |
| 11668 |
(mod:SWIM248 (match_dup 2) (match_dup 3))) |
| 11669 |
(use (match_dup 1)) |
| 11670 |
(clobber (reg:CC FLAGS_REG))])] |
| 11671 |
{ |
| 11672 |
operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)-1); |
| 11673 |
|
| 11674 |
if (<MODE>mode != HImode |
| 11675 |
&& (optimize_function_for_size_p (cfun) || TARGET_USE_CLTD)) |
| 11676 |
operands[4] = operands[2]; |
| 11677 |
else |
| 11678 |
{ |
| 11679 |
/* Avoid use of cltd in favor of a mov+shift. */ |
| 11680 |
emit_move_insn (operands[1], operands[2]); |
| 11681 |
operands[4] = operands[1]; |
| 11682 |
} |
| 11683 |
} |
| 11684 |
[(set_attr "type" "multi") |
| 11685 |
(set_attr "mode" "<MODE>")]) |
| 11686 |
|
| 11687 |
(define_insn_and_split "*udivmod<mode>4" |
| 11688 |
[(set (match_operand:SWIM248 0 "register_operand" "=a") |
| 11689 |
(udiv:SWIM248 (match_operand:SWIM248 2 "register_operand" "0") |
| 11690 |
(match_operand:SWIM248 3 "nonimmediate_operand" "rm"))) |
| 11691 |
(set (match_operand:SWIM248 1 "register_operand" "=&d") |
| 11692 |
(umod:SWIM248 (match_dup 2) (match_dup 3))) |
| 11693 |
(clobber (reg:CC FLAGS_REG))] |
| 11694 |
"" |
| 11695 |
"#" |
| 11696 |
"reload_completed" |
| 11697 |
[(set (match_dup 1) (const_int 0)) |
| 11698 |
(parallel [(set (match_dup 0) |
| 11699 |
(udiv:SWIM248 (match_dup 2) (match_dup 3))) |
| 11700 |
(set (match_dup 1) |
| 11701 |
(umod:SWIM248 (match_dup 2) (match_dup 3))) |
| 11702 |
(use (match_dup 1)) |
| 11703 |
(clobber (reg:CC FLAGS_REG))])] |
| 11704 |
"" |
| 11705 |
[(set_attr "type" "multi") |
| 11706 |
(set_attr "mode" "<MODE>")]) |
| 11707 |
|
| 11708 |
;; Optimize division or modulo by constant power of 2, if the constant |
| 11709 |
;; materializes only after expansion. |
| 11710 |
(define_insn_and_split "*udivmod<mode>4_pow2" |
| 11711 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 11712 |
(udiv:SWI48 (match_operand:SWI48 2 "register_operand" "0") |
| 11713 |
(match_operand:SWI48 3 "const_int_operand"))) |
| 11714 |
(set (match_operand:SWI48 1 "register_operand" "=r") |
| 11715 |
(umod:SWI48 (match_dup 2) (match_dup 3))) |
| 11716 |
(clobber (reg:CC FLAGS_REG))] |
| 11717 |
"IN_RANGE (exact_log2 (UINTVAL (operands[3])), 1, 31)" |
| 11718 |
"#" |
| 11719 |
"&& reload_completed" |
| 11720 |
[(set (match_dup 1) (match_dup 2)) |
| 11721 |
(parallel [(set (match_dup 0) (lshiftrt:<MODE> (match_dup 2) (match_dup 4))) |
| 11722 |
(clobber (reg:CC FLAGS_REG))]) |
| 11723 |
(parallel [(set (match_dup 1) (and:<MODE> (match_dup 1) (match_dup 5))) |
| 11724 |
(clobber (reg:CC FLAGS_REG))])] |
| 11725 |
{ |
| 11726 |
int v = exact_log2 (UINTVAL (operands[3])); |
| 11727 |
operands[4] = GEN_INT (v); |
| 11728 |
operands[5] = GEN_INT ((HOST_WIDE_INT_1U << v) - 1); |
| 11729 |
} |
| 11730 |
[(set_attr "type" "multi") |
| 11731 |
(set_attr "mode" "<MODE>")]) |
| 11732 |
|
| 11733 |
(define_insn_and_split "*divmodsi4_zext_1" |
| 11734 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 11735 |
(zero_extend:DI |
| 11736 |
(div:SI (match_operand:SI 2 "register_operand" "0") |
| 11737 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11738 |
(set (match_operand:SI 1 "register_operand" "=&d") |
| 11739 |
(mod:SI (match_dup 2) (match_dup 3))) |
| 11740 |
(clobber (reg:CC FLAGS_REG))] |
| 11741 |
"TARGET_64BIT" |
| 11742 |
"#" |
| 11743 |
"&& reload_completed" |
| 11744 |
[(parallel [(set (match_dup 1) |
| 11745 |
(ashiftrt:SI (match_dup 4) (match_dup 5))) |
| 11746 |
(clobber (reg:CC FLAGS_REG))]) |
| 11747 |
(parallel [(set (match_dup 0) |
| 11748 |
(zero_extend:DI (div:SI (match_dup 2) (match_dup 3)))) |
| 11749 |
(set (match_dup 1) |
| 11750 |
(mod:SI (match_dup 2) (match_dup 3))) |
| 11751 |
(use (match_dup 1)) |
| 11752 |
(clobber (reg:CC FLAGS_REG))])] |
| 11753 |
{ |
| 11754 |
operands[5] = GEN_INT (GET_MODE_BITSIZE (SImode)-1); |
| 11755 |
|
| 11756 |
if (optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 11757 |
operands[4] = operands[2]; |
| 11758 |
else |
| 11759 |
{ |
| 11760 |
/* Avoid use of cltd in favor of a mov+shift. */ |
| 11761 |
emit_move_insn (operands[1], operands[2]); |
| 11762 |
operands[4] = operands[1]; |
| 11763 |
} |
| 11764 |
} |
| 11765 |
[(set_attr "type" "multi") |
| 11766 |
(set_attr "mode" "SI")]) |
| 11767 |
|
| 11768 |
(define_insn_and_split "*udivmodsi4_zext_1" |
| 11769 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 11770 |
(zero_extend:DI |
| 11771 |
(udiv:SI (match_operand:SI 2 "register_operand" "0") |
| 11772 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11773 |
(set (match_operand:SI 1 "register_operand" "=&d") |
| 11774 |
(umod:SI (match_dup 2) (match_dup 3))) |
| 11775 |
(clobber (reg:CC FLAGS_REG))] |
| 11776 |
"TARGET_64BIT" |
| 11777 |
"#" |
| 11778 |
"&& reload_completed" |
| 11779 |
[(set (match_dup 1) (const_int 0)) |
| 11780 |
(parallel [(set (match_dup 0) |
| 11781 |
(zero_extend:DI (udiv:SI (match_dup 2) (match_dup 3)))) |
| 11782 |
(set (match_dup 1) |
| 11783 |
(umod:SI (match_dup 2) (match_dup 3))) |
| 11784 |
(use (match_dup 1)) |
| 11785 |
(clobber (reg:CC FLAGS_REG))])] |
| 11786 |
"" |
| 11787 |
[(set_attr "type" "multi") |
| 11788 |
(set_attr "mode" "SI")]) |
| 11789 |
|
| 11790 |
(define_insn_and_split "*udivmodsi4_pow2_zext_1" |
| 11791 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 11792 |
(zero_extend:DI |
| 11793 |
(udiv:SI (match_operand:SI 2 "register_operand" "0") |
| 11794 |
(match_operand:SI 3 "const_int_operand")))) |
| 11795 |
(set (match_operand:SI 1 "register_operand" "=r") |
| 11796 |
(umod:SI (match_dup 2) (match_dup 3))) |
| 11797 |
(clobber (reg:CC FLAGS_REG))] |
| 11798 |
"TARGET_64BIT |
| 11799 |
&& IN_RANGE (exact_log2 (UINTVAL (operands[3])), 1, 31)" |
| 11800 |
"#" |
| 11801 |
"&& reload_completed" |
| 11802 |
[(set (match_dup 1) (match_dup 2)) |
| 11803 |
(parallel [(set (match_dup 0) |
| 11804 |
(zero_extend:DI (lshiftrt:SI (match_dup 2) (match_dup 4)))) |
| 11805 |
(clobber (reg:CC FLAGS_REG))]) |
| 11806 |
(parallel [(set (match_dup 1) (and:SI (match_dup 1) (match_dup 5))) |
| 11807 |
(clobber (reg:CC FLAGS_REG))])] |
| 11808 |
{ |
| 11809 |
int v = exact_log2 (UINTVAL (operands[3])); |
| 11810 |
operands[4] = GEN_INT (v); |
| 11811 |
operands[5] = GEN_INT ((HOST_WIDE_INT_1U << v) - 1); |
| 11812 |
} |
| 11813 |
[(set_attr "type" "multi") |
| 11814 |
(set_attr "mode" "SI")]) |
| 11815 |
|
| 11816 |
(define_insn_and_split "*divmodsi4_zext_2" |
| 11817 |
[(set (match_operand:DI 1 "register_operand" "=&d") |
| 11818 |
(zero_extend:DI |
| 11819 |
(mod:SI (match_operand:SI 2 "register_operand" "0") |
| 11820 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11821 |
(set (match_operand:SI 0 "register_operand" "=a") |
| 11822 |
(div:SI (match_dup 2) (match_dup 3))) |
| 11823 |
(clobber (reg:CC FLAGS_REG))] |
| 11824 |
"TARGET_64BIT" |
| 11825 |
"#" |
| 11826 |
"&& reload_completed" |
| 11827 |
[(parallel [(set (match_dup 6) |
| 11828 |
(ashiftrt:SI (match_dup 4) (match_dup 5))) |
| 11829 |
(clobber (reg:CC FLAGS_REG))]) |
| 11830 |
(parallel [(set (match_dup 1) |
| 11831 |
(zero_extend:DI (mod:SI (match_dup 2) (match_dup 3)))) |
| 11832 |
(set (match_dup 0) |
| 11833 |
(div:SI (match_dup 2) (match_dup 3))) |
| 11834 |
(use (match_dup 6)) |
| 11835 |
(clobber (reg:CC FLAGS_REG))])] |
| 11836 |
{ |
| 11837 |
operands[5] = GEN_INT (GET_MODE_BITSIZE (SImode)-1); |
| 11838 |
operands[6] = gen_lowpart (SImode, operands[1]); |
| 11839 |
|
| 11840 |
if (optimize_function_for_size_p (cfun) || TARGET_USE_CLTD) |
| 11841 |
operands[4] = operands[2]; |
| 11842 |
else |
| 11843 |
{ |
| 11844 |
/* Avoid use of cltd in favor of a mov+shift. */ |
| 11845 |
emit_move_insn (operands[6], operands[2]); |
| 11846 |
operands[4] = operands[6]; |
| 11847 |
} |
| 11848 |
} |
| 11849 |
[(set_attr "type" "multi") |
| 11850 |
(set_attr "mode" "SI")]) |
| 11851 |
|
| 11852 |
(define_insn_and_split "*udivmodsi4_zext_2" |
| 11853 |
[(set (match_operand:DI 1 "register_operand" "=&d") |
| 11854 |
(zero_extend:DI |
| 11855 |
(umod:SI (match_operand:SI 2 "register_operand" "0") |
| 11856 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11857 |
(set (match_operand:SI 0 "register_operand" "=a") |
| 11858 |
(udiv:SI (match_dup 2) (match_dup 3))) |
| 11859 |
(clobber (reg:CC FLAGS_REG))] |
| 11860 |
"TARGET_64BIT" |
| 11861 |
"#" |
| 11862 |
"&& reload_completed" |
| 11863 |
[(set (match_dup 4) (const_int 0)) |
| 11864 |
(parallel [(set (match_dup 1) |
| 11865 |
(zero_extend:DI (umod:SI (match_dup 2) (match_dup 3)))) |
| 11866 |
(set (match_dup 0) |
| 11867 |
(udiv:SI (match_dup 2) (match_dup 3))) |
| 11868 |
(use (match_dup 4)) |
| 11869 |
(clobber (reg:CC FLAGS_REG))])] |
| 11870 |
"operands[4] = gen_lowpart (SImode, operands[1]);" |
| 11871 |
[(set_attr "type" "multi") |
| 11872 |
(set_attr "mode" "SI")]) |
| 11873 |
|
| 11874 |
(define_insn_and_split "*udivmodsi4_pow2_zext_2" |
| 11875 |
[(set (match_operand:DI 1 "register_operand" "=r") |
| 11876 |
(zero_extend:DI |
| 11877 |
(umod:SI (match_operand:SI 2 "register_operand" "0") |
| 11878 |
(match_operand:SI 3 "const_int_operand")))) |
| 11879 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 11880 |
(udiv:SI (match_dup 2) (match_dup 3))) |
| 11881 |
(clobber (reg:CC FLAGS_REG))] |
| 11882 |
"TARGET_64BIT |
| 11883 |
&& IN_RANGE (exact_log2 (UINTVAL (operands[3])), 1, 31)" |
| 11884 |
"#" |
| 11885 |
"&& reload_completed" |
| 11886 |
[(set (match_dup 1) (match_dup 2)) |
| 11887 |
(parallel [(set (match_dup 0) (lshiftrt:SI (match_dup 2) (match_dup 4))) |
| 11888 |
(clobber (reg:CC FLAGS_REG))]) |
| 11889 |
(parallel [(set (match_dup 1) |
| 11890 |
(zero_extend:DI (and:SI (match_dup 1) (match_dup 5)))) |
| 11891 |
(clobber (reg:CC FLAGS_REG))])] |
| 11892 |
{ |
| 11893 |
int v = exact_log2 (UINTVAL (operands[3])); |
| 11894 |
operands[4] = GEN_INT (v); |
| 11895 |
operands[5] = GEN_INT ((HOST_WIDE_INT_1U << v) - 1); |
| 11896 |
} |
| 11897 |
[(set_attr "type" "multi") |
| 11898 |
(set_attr "mode" "SI")]) |
| 11899 |
|
| 11900 |
(define_insn "*<u>divmod<mode>4_noext_nf" |
| 11901 |
[(set (match_operand:SWIM248 0 "register_operand" "=a") |
| 11902 |
(any_div:SWIM248 |
| 11903 |
(match_operand:SWIM248 2 "register_operand" "0") |
| 11904 |
(match_operand:SWIM248 3 "nonimmediate_operand" "rm"))) |
| 11905 |
(set (match_operand:SWIM248 1 "register_operand" "=d") |
| 11906 |
(<paired_mod>:SWIM248 (match_dup 2) (match_dup 3))) |
| 11907 |
(use (match_operand:SWIM248 4 "register_operand" "1"))] |
| 11908 |
"TARGET_APX_NF" |
| 11909 |
"%{nf%} <sgnprefix>div{<imodesuffix>}\t%3" |
| 11910 |
[(set_attr "type" "idiv") |
| 11911 |
(set_attr "mode" "<MODE>")]) |
| 11912 |
|
| 11913 |
(define_insn "*<u>divmod<mode>4_noext" |
| 11914 |
[(set (match_operand:SWIM248 0 "register_operand" "=a") |
| 11915 |
(any_div:SWIM248 |
| 11916 |
(match_operand:SWIM248 2 "register_operand" "0") |
| 11917 |
(match_operand:SWIM248 3 "nonimmediate_operand" "rm"))) |
| 11918 |
(set (match_operand:SWIM248 1 "register_operand" "=d") |
| 11919 |
(<paired_mod>:SWIM248 (match_dup 2) (match_dup 3))) |
| 11920 |
(use (match_operand:SWIM248 4 "register_operand" "1")) |
| 11921 |
(clobber (reg:CC FLAGS_REG))] |
| 11922 |
"" |
| 11923 |
"<sgnprefix>div{<imodesuffix>}\t%3" |
| 11924 |
[(set_attr "type" "idiv") |
| 11925 |
(set_attr "has_nf" "1") |
| 11926 |
(set_attr "mode" "<MODE>")]) |
| 11927 |
|
| 11928 |
(define_insn "*<u>divmodsi4_noext_zext_1" |
| 11929 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 11930 |
(zero_extend:DI |
| 11931 |
(any_div:SI (match_operand:SI 2 "register_operand" "0") |
| 11932 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11933 |
(set (match_operand:SI 1 "register_operand" "=d") |
| 11934 |
(<paired_mod>:SI (match_dup 2) (match_dup 3))) |
| 11935 |
(use (match_operand:SI 4 "register_operand" "1")) |
| 11936 |
(clobber (reg:CC FLAGS_REG))] |
| 11937 |
"TARGET_64BIT" |
| 11938 |
"<sgnprefix>div{l}\t%3" |
| 11939 |
[(set_attr "type" "idiv") |
| 11940 |
(set_attr "mode" "SI")]) |
| 11941 |
|
| 11942 |
(define_insn "*<u>divmodsi4_noext_zext_2" |
| 11943 |
[(set (match_operand:DI 1 "register_operand" "=d") |
| 11944 |
(zero_extend:DI |
| 11945 |
(<paired_mod>:SI (match_operand:SI 2 "register_operand" "0") |
| 11946 |
(match_operand:SI 3 "nonimmediate_operand" "rm")))) |
| 11947 |
(set (match_operand:SI 0 "register_operand" "=a") |
| 11948 |
(any_div:SI (match_dup 2) (match_dup 3))) |
| 11949 |
(use (match_operand:SI 4 "register_operand" "1")) |
| 11950 |
(clobber (reg:CC FLAGS_REG))] |
| 11951 |
"TARGET_64BIT" |
| 11952 |
"<sgnprefix>div{l}\t%3" |
| 11953 |
[(set_attr "type" "idiv") |
| 11954 |
(set_attr "mode" "SI")]) |
| 11955 |
|
| 11956 |
;; Avoid sign-extension (using cdq) for constant numerators. |
| 11957 |
(define_insn_and_split "*divmodsi4_const" |
| 11958 |
[(set (match_operand:SI 0 "register_operand" "=&a") |
| 11959 |
(div:SI (match_operand:SI 2 "const_int_operand") |
| 11960 |
(match_operand:SI 3 "nonimmediate_operand" "rm"))) |
| 11961 |
(set (match_operand:SI 1 "register_operand" "=&d") |
| 11962 |
(mod:SI (match_dup 2) (match_dup 3))) |
| 11963 |
(clobber (reg:CC FLAGS_REG))] |
| 11964 |
"!optimize_function_for_size_p (cfun)" |
| 11965 |
"#" |
| 11966 |
"&& reload_completed" |
| 11967 |
[(set (match_dup 0) (match_dup 2)) |
| 11968 |
(set (match_dup 1) (match_dup 4)) |
| 11969 |
(parallel [(set (match_dup 0) |
| 11970 |
(div:SI (match_dup 0) (match_dup 3))) |
| 11971 |
(set (match_dup 1) |
| 11972 |
(mod:SI (match_dup 0) (match_dup 3))) |
| 11973 |
(use (match_dup 1)) |
| 11974 |
(clobber (reg:CC FLAGS_REG))])] |
| 11975 |
{ |
| 11976 |
operands[4] = INTVAL (operands[2]) < 0 ? constm1_rtx : const0_rtx; |
| 11977 |
} |
| 11978 |
[(set_attr "type" "multi") |
| 11979 |
(set_attr "mode" "SI")]) |
| 11980 |
|
| 11981 |
(define_expand "divmodqi4" |
| 11982 |
[(parallel [(set (match_operand:QI 0 "register_operand") |
| 11983 |
(div:QI |
| 11984 |
(match_operand:QI 1 "register_operand") |
| 11985 |
(match_operand:QI 2 "nonimmediate_operand"))) |
| 11986 |
(set (match_operand:QI 3 "register_operand") |
| 11987 |
(mod:QI (match_dup 1) (match_dup 2))) |
| 11988 |
(clobber (reg:CC FLAGS_REG))])] |
| 11989 |
"TARGET_QIMODE_MATH" |
| 11990 |
{ |
| 11991 |
rtx div, mod; |
| 11992 |
rtx tmp0, tmp1; |
| 11993 |
|
| 11994 |
tmp0 = gen_reg_rtx (HImode); |
| 11995 |
tmp1 = gen_reg_rtx (HImode); |
| 11996 |
|
| 11997 |
/* Extend operands[1] to HImode. Generate 8bit divide. Result is in AX. */ |
| 11998 |
emit_insn (gen_extendqihi2 (tmp1, operands[1])); |
| 11999 |
emit_insn (gen_divmodhiqi3 (tmp0, tmp1, operands[2])); |
| 12000 |
|
| 12001 |
/* Extract remainder from AH. */ |
| 12002 |
tmp1 = gen_rtx_ZERO_EXTRACT (HImode, tmp0, GEN_INT (8), GEN_INT (8)); |
| 12003 |
tmp1 = lowpart_subreg (QImode, tmp1, HImode); |
| 12004 |
rtx_insn *insn = emit_move_insn (operands[3], tmp1); |
| 12005 |
|
| 12006 |
mod = gen_rtx_MOD (QImode, operands[1], operands[2]); |
| 12007 |
set_unique_reg_note (insn, REG_EQUAL, mod); |
| 12008 |
|
| 12009 |
/* Extract quotient from AL. */ |
| 12010 |
insn = emit_move_insn (operands[0], gen_lowpart (QImode, tmp0)); |
| 12011 |
|
| 12012 |
div = gen_rtx_DIV (QImode, operands[1], operands[2]); |
| 12013 |
set_unique_reg_note (insn, REG_EQUAL, div); |
| 12014 |
|
| 12015 |
DONE; |
| 12016 |
}) |
| 12017 |
|
| 12018 |
(define_expand "udivmodqi4" |
| 12019 |
[(parallel [(set (match_operand:QI 0 "register_operand") |
| 12020 |
(udiv:QI |
| 12021 |
(match_operand:QI 1 "register_operand") |
| 12022 |
(match_operand:QI 2 "nonimmediate_operand"))) |
| 12023 |
(set (match_operand:QI 3 "register_operand") |
| 12024 |
(umod:QI (match_dup 1) (match_dup 2))) |
| 12025 |
(clobber (reg:CC FLAGS_REG))])] |
| 12026 |
"TARGET_QIMODE_MATH" |
| 12027 |
{ |
| 12028 |
rtx div, mod; |
| 12029 |
rtx tmp0, tmp1; |
| 12030 |
|
| 12031 |
tmp0 = gen_reg_rtx (HImode); |
| 12032 |
tmp1 = gen_reg_rtx (HImode); |
| 12033 |
|
| 12034 |
/* Extend operands[1] to HImode. Generate 8bit divide. Result is in AX. */ |
| 12035 |
emit_insn (gen_zero_extendqihi2 (tmp1, operands[1])); |
| 12036 |
emit_insn (gen_udivmodhiqi3 (tmp0, tmp1, operands[2])); |
| 12037 |
|
| 12038 |
/* Extract remainder from AH. */ |
| 12039 |
tmp1 = gen_rtx_ZERO_EXTRACT (HImode, tmp0, GEN_INT (8), GEN_INT (8)); |
| 12040 |
tmp1 = lowpart_subreg (QImode, tmp1, HImode); |
| 12041 |
rtx_insn *insn = emit_move_insn (operands[3], tmp1); |
| 12042 |
|
| 12043 |
mod = gen_rtx_UMOD (QImode, operands[1], operands[2]); |
| 12044 |
set_unique_reg_note (insn, REG_EQUAL, mod); |
| 12045 |
|
| 12046 |
/* Extract quotient from AL. */ |
| 12047 |
insn = emit_move_insn (operands[0], gen_lowpart (QImode, tmp0)); |
| 12048 |
|
| 12049 |
div = gen_rtx_UDIV (QImode, operands[1], operands[2]); |
| 12050 |
set_unique_reg_note (insn, REG_EQUAL, div); |
| 12051 |
|
| 12052 |
DONE; |
| 12053 |
}) |
| 12054 |
|
| 12055 |
;; Divide AX by r/m8, with result stored in |
| 12056 |
;; AL <- Quotient |
| 12057 |
;; AH <- Remainder |
| 12058 |
;; Change div/mod to HImode and extend the second argument to HImode |
| 12059 |
;; so that mode of div/mod matches with mode of arguments. Otherwise |
| 12060 |
;; combine may fail. |
| 12061 |
(define_insn "<u>divmodhiqi3<nf_name>" |
| 12062 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 12063 |
(ior:HI |
| 12064 |
(ashift:HI |
| 12065 |
(zero_extend:HI |
| 12066 |
(truncate:QI |
| 12067 |
(mod:HI (match_operand:HI 1 "register_operand" "0") |
| 12068 |
(any_extend:HI |
| 12069 |
(match_operand:QI 2 "nonimmediate_operand" "qm"))))) |
| 12070 |
(const_int 8)) |
| 12071 |
(zero_extend:HI |
| 12072 |
(truncate:QI |
| 12073 |
(div:HI (match_dup 1) (any_extend:HI (match_dup 2)))))))] |
| 12074 |
"TARGET_QIMODE_MATH |
| 12075 |
&& <nf_condition>" |
| 12076 |
"<nf_prefix><sgnprefix>div{b}\t%2" |
| 12077 |
[(set_attr "type" "idiv") |
| 12078 |
(set_attr "has_nf" "1") |
| 12079 |
(set_attr "mode" "QI")]) |
| 12080 |
|
| 12081 |
;; We cannot use div/idiv for double division, because it causes |
| 12082 |
;; "division by zero" on the overflow and that's not what we expect |
| 12083 |
;; from truncate. Because true (non truncating) double division is |
| 12084 |
;; never generated, we can't create this insn anyway. |
| 12085 |
; |
| 12086 |
;(define_insn "" |
| 12087 |
; [(set (match_operand:SI 0 "register_operand" "=a") |
| 12088 |
; (truncate:SI |
| 12089 |
; (udiv:DI (match_operand:DI 1 "register_operand" "A") |
| 12090 |
; (zero_extend:DI |
| 12091 |
; (match_operand:SI 2 "nonimmediate_operand" "rm"))))) |
| 12092 |
; (set (match_operand:SI 3 "register_operand" "=d") |
| 12093 |
; (truncate:SI |
| 12094 |
; (umod:DI (match_dup 1) (zero_extend:DI (match_dup 2))))) |
| 12095 |
; (clobber (reg:CC FLAGS_REG))] |
| 12096 |
; "" |
| 12097 |
; "div{l}\t{%2, %0|%0, %2}" |
| 12098 |
; [(set_attr "type" "idiv")]) |
| 12099 |
|
| 12100 |
;;- Logical AND instructions |
| 12101 |
|
| 12102 |
;; On Pentium, "test imm, reg" is pairable only with eax, ax, and al. |
| 12103 |
;; Note that this excludes ah. |
| 12104 |
|
| 12105 |
(define_expand "@test<mode>_ccno_1" |
| 12106 |
[(set (reg:CCNO FLAGS_REG) |
| 12107 |
(compare:CCNO |
| 12108 |
(and:SWI48 |
| 12109 |
(match_operand:SWI48 0 "nonimmediate_operand") |
| 12110 |
(match_operand:SWI48 1 "<nonmemory_szext_operand>")) |
| 12111 |
(const_int 0)))]) |
| 12112 |
|
| 12113 |
(define_expand "testqi_ccz_1" |
| 12114 |
[(set (reg:CCZ FLAGS_REG) |
| 12115 |
(compare:CCZ |
| 12116 |
(and:QI |
| 12117 |
(match_operand:QI 0 "nonimmediate_operand") |
| 12118 |
(match_operand:QI 1 "nonmemory_operand")) |
| 12119 |
(const_int 0)))]) |
| 12120 |
|
| 12121 |
(define_insn "*testdi_1" |
| 12122 |
[(set (reg FLAGS_REG) |
| 12123 |
(compare |
| 12124 |
(and:DI |
| 12125 |
(match_operand:DI 0 "nonimmediate_operand" "%r,rm") |
| 12126 |
(match_operand:DI 1 "x86_64_szext_nonmemory_operand" "Z,re")) |
| 12127 |
(const_int 0)))] |
| 12128 |
"TARGET_64BIT |
| 12129 |
&& ix86_match_ccmode |
| 12130 |
(insn, |
| 12131 |
/* If we are going to emit testl instead of testq, and the operands[1] |
| 12132 |
constant might have the SImode sign bit set, make sure the sign |
| 12133 |
flag isn't tested, because the instruction will set the sign flag |
| 12134 |
based on bit 31 rather than bit 63. If it isn't CONST_INT, |
| 12135 |
conservatively assume it might have bit 31 set. */ |
| 12136 |
(satisfies_constraint_Z (operands[1]) |
| 12137 |
&& (!CONST_INT_P (operands[1]) |
| 12138 |
|| val_signbit_known_set_p (SImode, INTVAL (operands[1])))) |
| 12139 |
? CCZmode : CCNOmode)" |
| 12140 |
"@ |
| 12141 |
test{l}\t{%k1, %k0|%k0, %k1} |
| 12142 |
test{q}\t{%1, %0|%0, %1}" |
| 12143 |
[(set_attr "type" "test") |
| 12144 |
(set_attr "mode" "SI,DI")]) |
| 12145 |
|
| 12146 |
(define_insn "*testqi_1_maybe_si" |
| 12147 |
[(set (reg FLAGS_REG) |
| 12148 |
(compare |
| 12149 |
(and:QI |
| 12150 |
(match_operand:QI 0 "nonimmediate_operand" "%qm,qm,r") |
| 12151 |
(match_operand:QI 1 "nonmemory_operand" "q,n,n")) |
| 12152 |
(const_int 0)))] |
| 12153 |
"ix86_match_ccmode (insn, |
| 12154 |
CONST_INT_P (operands[1]) |
| 12155 |
&& INTVAL (operands[1]) >= 0 ? CCNOmode : CCZmode)" |
| 12156 |
{ |
| 12157 |
if (get_attr_mode (insn) == MODE_SI) |
| 12158 |
{ |
| 12159 |
if (CONST_INT_P (operands[1]) && INTVAL (operands[1]) < 0) |
| 12160 |
operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff); |
| 12161 |
return "test{l}\t{%1, %k0|%k0, %1}"; |
| 12162 |
} |
| 12163 |
return "test{b}\t{%1, %0|%0, %1}"; |
| 12164 |
} |
| 12165 |
[(set_attr "type" "test") |
| 12166 |
(set (attr "mode") |
| 12167 |
(cond [(eq_attr "alternative" "2") |
| 12168 |
(const_string "SI") |
| 12169 |
(and (match_test "optimize_insn_for_size_p ()") |
| 12170 |
(and (match_operand 0 "ext_QIreg_operand") |
| 12171 |
(match_operand 1 "const_0_to_127_operand"))) |
| 12172 |
(const_string "SI") |
| 12173 |
] |
| 12174 |
(const_string "QI"))) |
| 12175 |
(set_attr "pent_pair" "uv,np,np")]) |
| 12176 |
|
| 12177 |
(define_insn "*test<mode>_1" |
| 12178 |
[(set (reg FLAGS_REG) |
| 12179 |
(compare |
| 12180 |
(and:SWI124 |
| 12181 |
(match_operand:SWI124 0 "nonimmediate_operand" "%<r>m,*a,<r>m") |
| 12182 |
(match_operand:SWI124 1 "<nonmemory_szext_operand>" "<r>,<i>,<i>")) |
| 12183 |
(const_int 0)))] |
| 12184 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 12185 |
"test{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 12186 |
[(set_attr "type" "test") |
| 12187 |
(set_attr "mode" "<MODE>") |
| 12188 |
(set_attr "pent_pair" "uv,uv,np")]) |
| 12189 |
|
| 12190 |
(define_expand "testqi_ext_1_ccno" |
| 12191 |
[(set (reg:CCNO FLAGS_REG) |
| 12192 |
(compare:CCNO |
| 12193 |
(and:QI |
| 12194 |
(subreg:QI |
| 12195 |
(zero_extract:HI |
| 12196 |
(match_operand:HI 0 "register_operand") |
| 12197 |
(const_int 8) |
| 12198 |
(const_int 8)) 0) |
| 12199 |
(match_operand:QI 1 "const_int_operand")) |
| 12200 |
(const_int 0)))]) |
| 12201 |
|
| 12202 |
(define_insn "*testqi_ext<mode>_1" |
| 12203 |
[(set (reg FLAGS_REG) |
| 12204 |
(compare |
| 12205 |
(and:QI |
| 12206 |
(subreg:QI |
| 12207 |
(match_operator:SWI248 2 "extract_operator" |
| 12208 |
[(match_operand 0 "int248_register_operand" "Q") |
| 12209 |
(const_int 8) |
| 12210 |
(const_int 8)]) 0) |
| 12211 |
(match_operand:QI 1 "general_operand" "QnBn")) |
| 12212 |
(const_int 0)))] |
| 12213 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 12214 |
"test{b}\t{%1, %h0|%h0, %1}" |
| 12215 |
[(set_attr "addr" "gpr8") |
| 12216 |
(set_attr "type" "test") |
| 12217 |
(set_attr "mode" "QI")]) |
| 12218 |
|
| 12219 |
(define_insn "*testqi_ext<mode>_2" |
| 12220 |
[(set (reg FLAGS_REG) |
| 12221 |
(compare |
| 12222 |
(and:QI |
| 12223 |
(subreg:QI |
| 12224 |
(match_operator:SWI248 2 "extract_operator" |
| 12225 |
[(match_operand 0 "int248_register_operand" "Q") |
| 12226 |
(const_int 8) |
| 12227 |
(const_int 8)]) 0) |
| 12228 |
(subreg:QI |
| 12229 |
(match_operator:SWI248 3 "extract_operator" |
| 12230 |
[(match_operand 1 "int248_register_operand" "Q") |
| 12231 |
(const_int 8) |
| 12232 |
(const_int 8)]) 0)) |
| 12233 |
(const_int 0)))] |
| 12234 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 12235 |
"test{b}\t{%h1, %h0|%h0, %h1}" |
| 12236 |
[(set_attr "type" "test") |
| 12237 |
(set_attr "mode" "QI")]) |
| 12238 |
|
| 12239 |
;; Provide a *testti instruction that STV can implement using ptest. |
| 12240 |
;; This pattern splits into *andti3_doubleword and *cmpti_doubleword. |
| 12241 |
(define_insn_and_split "*testti_doubleword" |
| 12242 |
[(set (reg:CCZ FLAGS_REG) |
| 12243 |
(compare:CCZ |
| 12244 |
(and:TI (match_operand:TI 0 "register_operand") |
| 12245 |
(match_operand:TI 1 "general_operand")) |
| 12246 |
(const_int 0)))] |
| 12247 |
"TARGET_64BIT |
| 12248 |
&& ix86_pre_reload_split ()" |
| 12249 |
"#" |
| 12250 |
"&& 1" |
| 12251 |
[(parallel [(set (match_dup 2) (and:TI (match_dup 0) (match_dup 1))) |
| 12252 |
(clobber (reg:CC FLAGS_REG))]) |
| 12253 |
(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 2) (const_int 0)))] |
| 12254 |
{ |
| 12255 |
operands[2] = gen_reg_rtx (TImode); |
| 12256 |
if (!x86_64_hilo_general_operand (operands[1], TImode)) |
| 12257 |
operands[1] = force_reg (TImode, operands[1]); |
| 12258 |
}) |
| 12259 |
|
| 12260 |
;; Combine likes to form bit extractions for some tests. Humor it. |
| 12261 |
(define_insn_and_split "*testqi_ext_3" |
| 12262 |
[(set (match_operand 0 "flags_reg_operand") |
| 12263 |
(match_operator 1 "compare_operator" |
| 12264 |
[(zero_extract:SWI248 |
| 12265 |
(match_operand 2 "int_nonimmediate_operand" "rm") |
| 12266 |
(match_operand:QI 3 "const_int_operand") |
| 12267 |
(match_operand:QI 4 "const_int_operand")) |
| 12268 |
(const_int 0)]))] |
| 12269 |
"/* Ensure that resulting mask is zero or sign extended operand. */ |
| 12270 |
INTVAL (operands[4]) >= 0 |
| 12271 |
&& ((INTVAL (operands[3]) > 0 |
| 12272 |
&& INTVAL (operands[3]) + INTVAL (operands[4]) <= 32) |
| 12273 |
|| (<MODE>mode == DImode |
| 12274 |
&& INTVAL (operands[3]) > 32 |
| 12275 |
&& INTVAL (operands[3]) + INTVAL (operands[4]) == 64)) |
| 12276 |
&& ix86_match_ccmode (insn, |
| 12277 |
/* If zero_extract mode precision is the same |
| 12278 |
as len, the SF of the zero_extract |
| 12279 |
comparison will be the most significant |
| 12280 |
extracted bit, but this could be matched |
| 12281 |
after splitting only for pos 0 len all bits |
| 12282 |
trivial extractions. Require CCZmode. */ |
| 12283 |
(GET_MODE_PRECISION (<MODE>mode) |
| 12284 |
== INTVAL (operands[3])) |
| 12285 |
/* Otherwise, require CCZmode if we'd use a mask |
| 12286 |
with the most significant bit set and can't |
| 12287 |
widen it to wider mode. *testdi_1 also |
| 12288 |
requires CCZmode if the mask has bit |
| 12289 |
31 set and all bits above it clear. */ |
| 12290 |
|| (INTVAL (operands[3]) + INTVAL (operands[4]) |
| 12291 |
>= 32) |
| 12292 |
/* We can't widen also if val is not a REG. */ |
| 12293 |
|| (INTVAL (operands[3]) + INTVAL (operands[4]) |
| 12294 |
== GET_MODE_PRECISION (GET_MODE (operands[2])) |
| 12295 |
&& !register_operand (operands[2], |
| 12296 |
GET_MODE (operands[2]))) |
| 12297 |
/* And we shouldn't widen if |
| 12298 |
TARGET_PARTIAL_REG_STALL. */ |
| 12299 |
|| (TARGET_PARTIAL_REG_STALL |
| 12300 |
&& (INTVAL (operands[3]) + INTVAL (operands[4]) |
| 12301 |
>= (paradoxical_subreg_p (operands[2]) |
| 12302 |
&& (GET_MODE_CLASS |
| 12303 |
(GET_MODE (SUBREG_REG (operands[2]))) |
| 12304 |
== MODE_INT) |
| 12305 |
? GET_MODE_PRECISION |
| 12306 |
(GET_MODE (SUBREG_REG (operands[2]))) |
| 12307 |
: GET_MODE_PRECISION |
| 12308 |
(GET_MODE (operands[2]))))) |
| 12309 |
? CCZmode : CCNOmode)" |
| 12310 |
"#" |
| 12311 |
"&& 1" |
| 12312 |
[(set (match_dup 0) (match_op_dup 1 [(match_dup 2) (const_int 0)]))] |
| 12313 |
{ |
| 12314 |
rtx val = operands[2]; |
| 12315 |
HOST_WIDE_INT len = INTVAL (operands[3]); |
| 12316 |
HOST_WIDE_INT pos = INTVAL (operands[4]); |
| 12317 |
machine_mode mode = GET_MODE (val); |
| 12318 |
|
| 12319 |
if (SUBREG_P (val)) |
| 12320 |
{ |
| 12321 |
machine_mode submode = GET_MODE (SUBREG_REG (val)); |
| 12322 |
|
| 12323 |
/* Narrow paradoxical subregs to prevent partial register stalls. */ |
| 12324 |
if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode) |
| 12325 |
&& GET_MODE_CLASS (submode) == MODE_INT |
| 12326 |
&& (GET_MODE (operands[0]) == CCZmode |
| 12327 |
|| pos + len < GET_MODE_PRECISION (submode) |
| 12328 |
|| REG_P (SUBREG_REG (val)))) |
| 12329 |
{ |
| 12330 |
val = SUBREG_REG (val); |
| 12331 |
mode = submode; |
| 12332 |
} |
| 12333 |
} |
| 12334 |
|
| 12335 |
/* Small HImode tests can be converted to QImode. */ |
| 12336 |
if (pos + len <= 8 |
| 12337 |
&& register_operand (val, HImode)) |
| 12338 |
{ |
| 12339 |
rtx nval = gen_lowpart (QImode, val); |
| 12340 |
if (!MEM_P (nval) |
| 12341 |
|| GET_MODE (operands[0]) == CCZmode |
| 12342 |
|| pos + len < 8) |
| 12343 |
{ |
| 12344 |
val = nval; |
| 12345 |
mode = QImode; |
| 12346 |
} |
| 12347 |
} |
| 12348 |
|
| 12349 |
gcc_assert (pos + len <= GET_MODE_PRECISION (mode)); |
| 12350 |
|
| 12351 |
/* If the mask is going to have the sign bit set in the mode |
| 12352 |
we want to do the comparison in and user isn't interested just |
| 12353 |
in the zero flag, then we must widen the target mode. */ |
| 12354 |
if (pos + len == GET_MODE_PRECISION (mode) |
| 12355 |
&& GET_MODE (operands[0]) != CCZmode) |
| 12356 |
{ |
| 12357 |
gcc_assert (pos + len < 32 && !MEM_P (val)); |
| 12358 |
mode = SImode; |
| 12359 |
val = gen_lowpart (mode, val); |
| 12360 |
} |
| 12361 |
|
| 12362 |
wide_int mask |
| 12363 |
= wi::shifted_mask (pos, len, false, GET_MODE_PRECISION (mode)); |
| 12364 |
|
| 12365 |
operands[2] = gen_rtx_AND (mode, val, immed_wide_int_const (mask, mode)); |
| 12366 |
}) |
| 12367 |
|
| 12368 |
;; Split and;cmp (as optimized by combine) into not;test |
| 12369 |
;; Except when TARGET_BMI provides andn (*andn_<mode>_ccno). |
| 12370 |
(define_insn_and_split "*test<mode>_not" |
| 12371 |
[(set (reg:CCZ FLAGS_REG) |
| 12372 |
(compare:CCZ |
| 12373 |
(and:SWI |
| 12374 |
(not:SWI (match_operand:SWI 0 "register_operand")) |
| 12375 |
(match_operand:SWI 1 "<nonmemory_szext_operand>")) |
| 12376 |
(const_int 0)))] |
| 12377 |
"ix86_pre_reload_split () |
| 12378 |
&& (!TARGET_BMI || !REG_P (operands[1]))" |
| 12379 |
"#" |
| 12380 |
"&& 1" |
| 12381 |
[(set (match_dup 2) (not:SWI (match_dup 0))) |
| 12382 |
(set (reg:CCZ FLAGS_REG) |
| 12383 |
(compare:CCZ (and:SWI (match_dup 2) (match_dup 1)) |
| 12384 |
(const_int 0)))] |
| 12385 |
"operands[2] = gen_reg_rtx (<MODE>mode);") |
| 12386 |
|
| 12387 |
;; Split and;cmp (as optimized by combine) into andn;cmp $0 |
| 12388 |
(define_insn_and_split "*test<mode>_not_doubleword" |
| 12389 |
[(set (reg:CCZ FLAGS_REG) |
| 12390 |
(compare:CCZ |
| 12391 |
(and:DWI |
| 12392 |
(not:DWI (match_operand:DWI 0 "nonimmediate_operand")) |
| 12393 |
(match_operand:DWI 1 "nonimmediate_operand")) |
| 12394 |
(const_int 0)))] |
| 12395 |
"ix86_pre_reload_split ()" |
| 12396 |
"#" |
| 12397 |
"&& 1" |
| 12398 |
[(parallel |
| 12399 |
[(set (match_dup 2) (and:DWI (not:DWI (match_dup 0)) (match_dup 1))) |
| 12400 |
(clobber (reg:CC FLAGS_REG))]) |
| 12401 |
(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 2) (const_int 0)))] |
| 12402 |
{ |
| 12403 |
operands[0] = force_reg (<MODE>mode, operands[0]); |
| 12404 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 12405 |
}) |
| 12406 |
|
| 12407 |
;; Convert HImode/SImode test instructions with immediate to QImode ones. |
| 12408 |
;; i386 does not allow to encode test with 8bit sign extended immediate, so |
| 12409 |
;; this is relatively important trick. |
| 12410 |
;; Do the conversion only post-reload to avoid limiting of the register class |
| 12411 |
;; to QI regs. |
| 12412 |
(define_split |
| 12413 |
[(set (match_operand 0 "flags_reg_operand") |
| 12414 |
(match_operator 1 "compare_operator" |
| 12415 |
[(and (match_operand 2 "QIreg_operand") |
| 12416 |
(match_operand 3 "const_int_operand")) |
| 12417 |
(const_int 0)]))] |
| 12418 |
"reload_completed |
| 12419 |
&& GET_MODE (operands[2]) != QImode |
| 12420 |
&& ((ix86_match_ccmode (insn, CCZmode) |
| 12421 |
&& !(INTVAL (operands[3]) & ~(255 << 8))) |
| 12422 |
|| (ix86_match_ccmode (insn, CCNOmode) |
| 12423 |
&& !(INTVAL (operands[3]) & ~(127 << 8))))" |
| 12424 |
[(set (match_dup 0) |
| 12425 |
(match_op_dup 1 |
| 12426 |
[(and:QI |
| 12427 |
(subreg:QI |
| 12428 |
(zero_extract:HI (match_dup 2) |
| 12429 |
(const_int 8) |
| 12430 |
(const_int 8)) 0) |
| 12431 |
(match_dup 3)) |
| 12432 |
(const_int 0)]))] |
| 12433 |
{ |
| 12434 |
operands[2] = gen_lowpart (HImode, operands[2]); |
| 12435 |
operands[3] = gen_int_mode (INTVAL (operands[3]) >> 8, QImode); |
| 12436 |
}) |
| 12437 |
|
| 12438 |
(define_split |
| 12439 |
[(set (match_operand 0 "flags_reg_operand") |
| 12440 |
(match_operator 1 "compare_operator" |
| 12441 |
[(and (match_operand 2 "nonimmediate_operand") |
| 12442 |
(match_operand 3 "const_int_operand")) |
| 12443 |
(const_int 0)]))] |
| 12444 |
"reload_completed |
| 12445 |
&& GET_MODE (operands[2]) != QImode |
| 12446 |
&& (!REG_P (operands[2]) || ANY_QI_REG_P (operands[2])) |
| 12447 |
&& ((ix86_match_ccmode (insn, CCZmode) |
| 12448 |
&& !(INTVAL (operands[3]) & ~255)) |
| 12449 |
|| (ix86_match_ccmode (insn, CCNOmode) |
| 12450 |
&& !(INTVAL (operands[3]) & ~127)))" |
| 12451 |
[(set (match_dup 0) |
| 12452 |
(match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3)) |
| 12453 |
(const_int 0)]))] |
| 12454 |
{ |
| 12455 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 12456 |
operands[3] = gen_int_mode (INTVAL (operands[3]), QImode); |
| 12457 |
}) |
| 12458 |
|
| 12459 |
;; Narrow test instructions with immediate operands that test |
| 12460 |
;; memory locations for zero. E.g. testl $0x00aa0000, mem can be |
| 12461 |
;; converted to testb $0xaa, mem+2. Reject volatile locations and |
| 12462 |
;; targets where reading (possibly unaligned) part of memory |
| 12463 |
;; location after a large write to the same address causes |
| 12464 |
;; store-to-load forwarding stall. |
| 12465 |
(define_peephole2 |
| 12466 |
[(set (reg:CCZ FLAGS_REG) |
| 12467 |
(compare:CCZ |
| 12468 |
(and:SWI248 (match_operand:SWI248 0 "memory_operand") |
| 12469 |
(match_operand 1 "const_int_operand")) |
| 12470 |
(const_int 0)))] |
| 12471 |
"!TARGET_PARTIAL_MEMORY_READ_STALL |
| 12472 |
&& !MEM_VOLATILE_P (operands[0]) |
| 12473 |
&& offsettable_memref_p (operands[0])" |
| 12474 |
[(set (reg:CCZ FLAGS_REG) |
| 12475 |
(compare:CCZ (match_dup 2) (const_int 0)))] |
| 12476 |
{ |
| 12477 |
unsigned HOST_WIDE_INT ival = UINTVAL (operands[1]); |
| 12478 |
int first_nonzero_byte, bitsize; |
| 12479 |
rtx new_addr, new_const; |
| 12480 |
machine_mode new_mode; |
| 12481 |
|
| 12482 |
if (ival == 0) |
| 12483 |
FAIL; |
| 12484 |
|
| 12485 |
/* Clear bits outside mode width. */ |
| 12486 |
ival &= GET_MODE_MASK (<MODE>mode); |
| 12487 |
|
| 12488 |
first_nonzero_byte = ctz_hwi (ival) / BITS_PER_UNIT; |
| 12489 |
|
| 12490 |
ival >>= first_nonzero_byte * BITS_PER_UNIT; |
| 12491 |
|
| 12492 |
bitsize = sizeof (ival) * BITS_PER_UNIT - clz_hwi (ival); |
| 12493 |
|
| 12494 |
if (bitsize <= GET_MODE_BITSIZE (QImode)) |
| 12495 |
new_mode = QImode; |
| 12496 |
else if (bitsize <= GET_MODE_BITSIZE (HImode)) |
| 12497 |
new_mode = HImode; |
| 12498 |
else if (bitsize <= GET_MODE_BITSIZE (SImode)) |
| 12499 |
new_mode = SImode; |
| 12500 |
else |
| 12501 |
new_mode = DImode; |
| 12502 |
|
| 12503 |
if (GET_MODE_SIZE (new_mode) >= GET_MODE_SIZE (<MODE>mode)) |
| 12504 |
FAIL; |
| 12505 |
|
| 12506 |
new_addr = adjust_address (operands[0], new_mode, first_nonzero_byte); |
| 12507 |
new_const = gen_int_mode (ival, new_mode); |
| 12508 |
|
| 12509 |
operands[2] = gen_rtx_AND (new_mode, new_addr, new_const); |
| 12510 |
}) |
| 12511 |
|
| 12512 |
;; %%% This used to optimize known byte-wide and operations to memory, |
| 12513 |
;; and sometimes to QImode registers. If this is considered useful, |
| 12514 |
;; it should be done with splitters. |
| 12515 |
|
| 12516 |
(define_expand "and<mode>3" |
| 12517 |
[(set (match_operand:SDWIM 0 "nonimmediate_operand") |
| 12518 |
(and:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand") |
| 12519 |
(match_operand:SDWIM 2 "<general_szext_operand>")))] |
| 12520 |
"" |
| 12521 |
{ |
| 12522 |
machine_mode mode = <MODE>mode; |
| 12523 |
|
| 12524 |
if (GET_MODE_SIZE (<MODE>mode) > UNITS_PER_WORD |
| 12525 |
&& !x86_64_hilo_general_operand (operands[2], <MODE>mode)) |
| 12526 |
operands[2] = force_reg (<MODE>mode, operands[2]); |
| 12527 |
|
| 12528 |
if (GET_MODE_SIZE (<MODE>mode) <= UNITS_PER_WORD |
| 12529 |
&& const_int_operand (operands[2], <MODE>mode) |
| 12530 |
&& register_operand (operands[0], <MODE>mode) |
| 12531 |
&& !(TARGET_ZERO_EXTEND_WITH_AND |
| 12532 |
&& optimize_function_for_speed_p (cfun))) |
| 12533 |
{ |
| 12534 |
unsigned HOST_WIDE_INT ival = UINTVAL (operands[2]); |
| 12535 |
|
| 12536 |
if (ival == GET_MODE_MASK (SImode)) |
| 12537 |
mode = SImode; |
| 12538 |
else if (ival == GET_MODE_MASK (HImode)) |
| 12539 |
mode = HImode; |
| 12540 |
else if (ival == GET_MODE_MASK (QImode)) |
| 12541 |
mode = QImode; |
| 12542 |
} |
| 12543 |
|
| 12544 |
if (mode != <MODE>mode) |
| 12545 |
emit_insn (gen_extend_insn |
| 12546 |
(operands[0], gen_lowpart (mode, operands[1]), |
| 12547 |
<MODE>mode, mode, 1)); |
| 12548 |
else |
| 12549 |
ix86_expand_binary_operator (AND, <MODE>mode, operands, TARGET_APX_NDD); |
| 12550 |
|
| 12551 |
DONE; |
| 12552 |
}) |
| 12553 |
|
| 12554 |
(define_insn_and_split "*and<dwi>3_doubleword" |
| 12555 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r,&r,&r") |
| 12556 |
(and:<DWI> |
| 12557 |
(match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r,ro,jO,r") |
| 12558 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,K,<di>,o"))) |
| 12559 |
(clobber (reg:CC FLAGS_REG))] |
| 12560 |
"ix86_binary_operator_ok (AND, <DWI>mode, operands, TARGET_APX_NDD)" |
| 12561 |
"#" |
| 12562 |
"&& reload_completed" |
| 12563 |
[(const_int:DWIH 0)] |
| 12564 |
{ |
| 12565 |
bool emit_insn_deleted_note_p = false; |
| 12566 |
|
| 12567 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 12568 |
|
| 12569 |
if (operands[2] == const0_rtx) |
| 12570 |
emit_move_insn (operands[0], const0_rtx); |
| 12571 |
else if (operands[2] == constm1_rtx) |
| 12572 |
{ |
| 12573 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 12574 |
emit_move_insn (operands[0], operands[1]); |
| 12575 |
else |
| 12576 |
emit_insn_deleted_note_p = true; |
| 12577 |
} |
| 12578 |
else |
| 12579 |
ix86_expand_binary_operator (AND, <MODE>mode, &operands[0], TARGET_APX_NDD); |
| 12580 |
|
| 12581 |
if (operands[5] == const0_rtx) |
| 12582 |
emit_move_insn (operands[3], const0_rtx); |
| 12583 |
else if (operands[5] == constm1_rtx) |
| 12584 |
{ |
| 12585 |
if (!rtx_equal_p (operands[3], operands[4])) |
| 12586 |
emit_move_insn (operands[3], operands[4]); |
| 12587 |
else if (emit_insn_deleted_note_p) |
| 12588 |
emit_note (NOTE_INSN_DELETED); |
| 12589 |
} |
| 12590 |
else |
| 12591 |
ix86_expand_binary_operator (AND, <MODE>mode, &operands[3], TARGET_APX_NDD); |
| 12592 |
|
| 12593 |
DONE; |
| 12594 |
} |
| 12595 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd,apx_ndd_64,apx_ndd")]) |
| 12596 |
|
| 12597 |
(define_insn "*anddi_1<nf_name>" |
| 12598 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,rm,r<nf_mem_constraint>,r,r,r,r,r,?k") |
| 12599 |
(and:DI |
| 12600 |
(match_operand:DI 1 "nonimmediate_operand" "%0,r,0,0,0,rm,rjM,r,qm,k") |
| 12601 |
(match_operand:DI 2 "x86_64_szext_general_operand" "Z,Z,r,e,m,r,e,m,L,k")))] |
| 12602 |
"TARGET_64BIT |
| 12603 |
&& ix86_binary_operator_ok (AND, DImode, operands, TARGET_APX_NDD) |
| 12604 |
&& <nf_condition>" |
| 12605 |
"@ |
| 12606 |
<nf_prefix>and{l}\t{%k2, %k0|%k0, %k2} |
| 12607 |
<nf_prefix>and{l}\t{%k2, %k1, %k0|%k0, %k1, %k2} |
| 12608 |
<nf_prefix>and{q}\t{%2, %0|%0, %2} |
| 12609 |
<nf_prefix>and{q}\t{%2, %0|%0, %2} |
| 12610 |
<nf_prefix>and{q}\t{%2, %0|%0, %2} |
| 12611 |
<nf_prefix>and{q}\t{%2, %1, %0|%0, %1, %2} |
| 12612 |
<nf_prefix>and{q}\t{%2, %1, %0|%0, %1, %2} |
| 12613 |
<nf_prefix>and{q}\t{%2, %1, %0|%0, %1, %2} |
| 12614 |
# |
| 12615 |
#" |
| 12616 |
[(set_attr "isa" "x64,apx_ndd,x64,x64,x64,apx_ndd,apx_ndd,apx_ndd,<nf_nonf_x64_attr>,avx512bw") |
| 12617 |
(set_attr "type" "alu,alu,alu,alu,alu,alu,alu,alu,imovx,msklog") |
| 12618 |
(set_attr "length_immediate" "*,*,*,*,*,*,*,*,0,*") |
| 12619 |
(set (attr "prefix_rex") |
| 12620 |
(if_then_else |
| 12621 |
(and (eq_attr "type" "imovx") |
| 12622 |
(and (match_test "INTVAL (operands[2]) == 0xff") |
| 12623 |
(match_operand 1 "ext_QIreg_operand"))) |
| 12624 |
(const_string "1") |
| 12625 |
(const_string "*"))) |
| 12626 |
(set_attr "has_nf" "1") |
| 12627 |
(set_attr "mode" "SI,SI,DI,DI,DI,DI,DI,DI,SI,DI")]) |
| 12628 |
|
| 12629 |
(define_insn_and_split "*anddi_1_btr" |
| 12630 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=rm") |
| 12631 |
(and:DI |
| 12632 |
(match_operand:DI 1 "nonimmediate_operand" "%0") |
| 12633 |
(match_operand:DI 2 "const_int_operand" "n"))) |
| 12634 |
(clobber (reg:CC FLAGS_REG))] |
| 12635 |
"TARGET_64BIT && TARGET_USE_BT |
| 12636 |
&& ix86_binary_operator_ok (AND, DImode, operands) |
| 12637 |
&& IN_RANGE (exact_log2 (~INTVAL (operands[2])), 31, 63)" |
| 12638 |
"#" |
| 12639 |
"&& reload_completed" |
| 12640 |
[(parallel [(set (zero_extract:DI (match_dup 0) |
| 12641 |
(const_int 1) |
| 12642 |
(match_dup 3)) |
| 12643 |
(const_int 0)) |
| 12644 |
(clobber (reg:CC FLAGS_REG))])] |
| 12645 |
"operands[3] = GEN_INT (exact_log2 (~INTVAL (operands[2])));" |
| 12646 |
[(set_attr "type" "alu1") |
| 12647 |
(set_attr "prefix_0f" "1") |
| 12648 |
(set_attr "znver1_decode" "double") |
| 12649 |
(set_attr "c86_decode" "double") |
| 12650 |
(set_attr "mode" "DI")]) |
| 12651 |
|
| 12652 |
;; Turn *anddi_1 into *andsi_1_zext if possible. |
| 12653 |
(define_split |
| 12654 |
[(set (match_operand:DI 0 "register_operand") |
| 12655 |
(and:DI (subreg:DI (match_operand:SI 1 "register_operand") 0) |
| 12656 |
(match_operand:DI 2 "x86_64_zext_immediate_operand"))) |
| 12657 |
(clobber (reg:CC FLAGS_REG))] |
| 12658 |
"TARGET_64BIT" |
| 12659 |
[(parallel [(set (match_dup 0) |
| 12660 |
(zero_extend:DI (and:SI (match_dup 1) (match_dup 2)))) |
| 12661 |
(clobber (reg:CC FLAGS_REG))])] |
| 12662 |
{ |
| 12663 |
if (GET_CODE (operands[2]) == SYMBOL_REF |
| 12664 |
|| GET_CODE (operands[2]) == LABEL_REF) |
| 12665 |
{ |
| 12666 |
operands[2] = shallow_copy_rtx (operands[2]); |
| 12667 |
PUT_MODE (operands[2], SImode); |
| 12668 |
} |
| 12669 |
else if (GET_CODE (operands[2]) == CONST) |
| 12670 |
{ |
| 12671 |
/* (const:DI (plus:DI (symbol_ref:DI ("...")) (const_int N))) */ |
| 12672 |
operands[2] = copy_rtx (operands[2]); |
| 12673 |
PUT_MODE (operands[2], SImode); |
| 12674 |
PUT_MODE (XEXP (operands[2], 0), SImode); |
| 12675 |
PUT_MODE (XEXP (XEXP (operands[2], 0), 0), SImode); |
| 12676 |
} |
| 12677 |
else |
| 12678 |
operands[2] = gen_lowpart (SImode, operands[2]); |
| 12679 |
}) |
| 12680 |
|
| 12681 |
(define_insn "*andqi_1_zext<mode><nf_name>" |
| 12682 |
[(set (match_operand:SWI248x 0 "register_operand" "=r,r") |
| 12683 |
(zero_extend:SWI248x |
| 12684 |
(and:QI (match_operand:QI 1 "nonimmediate_operand" "%rm,r") |
| 12685 |
(match_operand:QI 2 "x86_64_general_operand" "rn,m"))))] |
| 12686 |
"TARGET_APX_NDD && <nf_condition> |
| 12687 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 12688 |
"@ |
| 12689 |
<nf_prefix>and{b}\t{%2, %1, %b0|%b0, %1, %2} |
| 12690 |
<nf_prefix>and{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 12691 |
[(set_attr "type" "alu") |
| 12692 |
(set_attr "has_nf" "1") |
| 12693 |
(set_attr "mode" "QI")]) |
| 12694 |
|
| 12695 |
(define_insn "*andhi_1_zext<mode><nf_name>" |
| 12696 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 12697 |
(zero_extend:SWI48x |
| 12698 |
(and:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,r") |
| 12699 |
(match_operand:HI 2 "x86_64_general_operand" "rn,m"))))] |
| 12700 |
"TARGET_APX_NDD && <nf_condition> |
| 12701 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 12702 |
"@ |
| 12703 |
<nf_prefix>and{w}\t{%2, %1, %w0|%w0, %1, %2} |
| 12704 |
<nf_prefix>and{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 12705 |
[(set_attr "type" "alu") |
| 12706 |
(set_attr "has_nf" "1") |
| 12707 |
(set_attr "mode" "HI")]) |
| 12708 |
|
| 12709 |
;; See comment for addsi_1_zext why we do use nonimmediate_operand |
| 12710 |
(define_insn "*andsi_1_zext" |
| 12711 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 12712 |
(zero_extend:DI |
| 12713 |
(and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,rjM,r") |
| 12714 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,r,e,BM")))) |
| 12715 |
(clobber (reg:CC FLAGS_REG))] |
| 12716 |
"TARGET_64BIT |
| 12717 |
&& ix86_binary_operator_ok (AND, SImode, operands, TARGET_APX_NDD)" |
| 12718 |
"@ |
| 12719 |
and{l}\t{%2, %k0|%k0, %2} |
| 12720 |
and{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 12721 |
and{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 12722 |
and{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 12723 |
[(set_attr "type" "alu") |
| 12724 |
(set_attr "isa" "*,apx_ndd,apx_ndd,apx_ndd") |
| 12725 |
(set_attr "mode" "SI")]) |
| 12726 |
|
| 12727 |
(define_insn "*and<mode>_1<nf_name>" |
| 12728 |
[(set (match_operand:SWI24 0 "nonimmediate_operand" "=rm,r<nf_mem_constraint>,r,r,r,r,Ya,?k") |
| 12729 |
(and:SWI24 (match_operand:SWI24 1 "nonimmediate_operand" "%0,0,0,rm,rjM,r,qm,k") |
| 12730 |
(match_operand:SWI24 2 "<general_operand>" "r,<i>,<m>,r,<i>,<m>,L,k")))] |
| 12731 |
"ix86_binary_operator_ok (AND, <MODE>mode, operands, TARGET_APX_NDD) |
| 12732 |
&& <nf_condition>" |
| 12733 |
"@ |
| 12734 |
<nf_prefix>and{<imodesuffix>}\t{%2, %0|%0, %2} |
| 12735 |
<nf_prefix>and{<imodesuffix>}\t{%2, %0|%0, %2} |
| 12736 |
<nf_prefix>and{<imodesuffix>}\t{%2, %0|%0, %2} |
| 12737 |
<nf_prefix>and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 12738 |
<nf_prefix>and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 12739 |
<nf_prefix>and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 12740 |
# |
| 12741 |
#" |
| 12742 |
[(set (attr "isa") |
| 12743 |
(cond [(eq_attr "alternative" "3,4,5") |
| 12744 |
(const_string "apx_ndd") |
| 12745 |
(eq_attr "alternative" "6") |
| 12746 |
(const_string "<nf_nonf_attr>") |
| 12747 |
(eq_attr "alternative" "7") |
| 12748 |
(if_then_else (eq_attr "mode" "SI") |
| 12749 |
(const_string "avx512bw") |
| 12750 |
(const_string "avx512f")) |
| 12751 |
] |
| 12752 |
(const_string "*"))) |
| 12753 |
(set_attr "type" "alu,alu,alu,alu,alu,alu,imovx,msklog") |
| 12754 |
(set_attr "length_immediate" "*,*,*,*,*,*,0,*") |
| 12755 |
(set (attr "prefix_rex") |
| 12756 |
(if_then_else |
| 12757 |
(and (eq_attr "type" "imovx") |
| 12758 |
(and (match_test "INTVAL (operands[2]) == 0xff") |
| 12759 |
(match_operand 1 "ext_QIreg_operand"))) |
| 12760 |
(const_string "1") |
| 12761 |
(const_string "*"))) |
| 12762 |
(set_attr "has_nf" "1") |
| 12763 |
(set_attr "mode" "<MODE>,<MODE>,<MODE>,<MODE>,<MODE>,<MODE>,SI,<MODE>")]) |
| 12764 |
|
| 12765 |
(define_insn "*andqi_1<nf_name>" |
| 12766 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r,r,?k") |
| 12767 |
(and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,rm,r,k") |
| 12768 |
(match_operand:QI 2 "general_operand" "qn,m,rn,rn,m,k")))] |
| 12769 |
"ix86_binary_operator_ok (AND, QImode, operands, TARGET_APX_NDD) |
| 12770 |
&& <nf_condition>" |
| 12771 |
"@ |
| 12772 |
<nf_prefix>and{b}\t{%2, %0|%0, %2} |
| 12773 |
<nf_prefix>and{b}\t{%2, %0|%0, %2} |
| 12774 |
<nf_prefix>and{l}\t{%k2, %k0|%k0, %k2} |
| 12775 |
<nf_prefix>and{b}\t{%2, %1, %0|%0, %1, %2} |
| 12776 |
<nf_prefix>and{b}\t{%2, %1, %0|%0, %1, %2} |
| 12777 |
#" |
| 12778 |
[(set_attr "type" "alu,alu,alu,alu,alu,msklog") |
| 12779 |
(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,*") |
| 12780 |
(set_attr "has_nf" "1") |
| 12781 |
(set (attr "mode") |
| 12782 |
(cond [(eq_attr "alternative" "2") |
| 12783 |
(const_string "SI") |
| 12784 |
(and (eq_attr "alternative" "5") |
| 12785 |
(match_test "!TARGET_AVX512DQ")) |
| 12786 |
(const_string "HI") |
| 12787 |
] |
| 12788 |
(const_string "QI"))) |
| 12789 |
;; Potential partial reg stall on alternative 2. |
| 12790 |
(set (attr "preferred_for_speed") |
| 12791 |
(cond [(eq_attr "alternative" "2") |
| 12792 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 12793 |
(symbol_ref "true")))]) |
| 12794 |
|
| 12795 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 12796 |
(define_insn_and_split "*<code><mode>_1_slp" |
| 12797 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 12798 |
(any_logic:SWI12 (match_operand:SWI12 1 "nonimmediate_operand" "%0,!<r>") |
| 12799 |
(match_operand:SWI12 2 "general_operand" "<r>mn,<r>mn"))) |
| 12800 |
(clobber (reg:CC FLAGS_REG))] |
| 12801 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 12802 |
"@ |
| 12803 |
<logic>{<imodesuffix>}\t{%2, %0|%0, %2} |
| 12804 |
#" |
| 12805 |
"&& reload_completed |
| 12806 |
&& !(rtx_equal_p (operands[0], operands[1]) |
| 12807 |
|| rtx_equal_p (operands[0], operands[2]))" |
| 12808 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 12809 |
(parallel |
| 12810 |
[(set (strict_low_part (match_dup 0)) |
| 12811 |
(any_logic:SWI12 (match_dup 0) (match_dup 2))) |
| 12812 |
(clobber (reg:CC FLAGS_REG))])] |
| 12813 |
"" |
| 12814 |
[(set_attr "type" "alu") |
| 12815 |
(set_attr "mode" "<MODE>")]) |
| 12816 |
|
| 12817 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 12818 |
(define_insn_and_split "*<code>qi_ext<mode>_1_slp" |
| 12819 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+Q,&Q")) |
| 12820 |
(any_logic:QI |
| 12821 |
(subreg:QI |
| 12822 |
(match_operator:SWI248 3 "extract_operator" |
| 12823 |
[(match_operand 2 "int248_register_operand" "Q,Q") |
| 12824 |
(const_int 8) |
| 12825 |
(const_int 8)]) 0) |
| 12826 |
(match_operand:QI 1 "nonimmediate_operand" "0,!qm"))) |
| 12827 |
(clobber (reg:CC FLAGS_REG))] |
| 12828 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 12829 |
"@ |
| 12830 |
<logic>{b}\t{%h2, %0|%0, %h2} |
| 12831 |
#" |
| 12832 |
"&& reload_completed |
| 12833 |
&& !rtx_equal_p (operands[0], operands[1])" |
| 12834 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 12835 |
(parallel |
| 12836 |
[(set (strict_low_part (match_dup 0)) |
| 12837 |
(any_logic:QI |
| 12838 |
(subreg:QI |
| 12839 |
(match_op_dup 3 |
| 12840 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0) |
| 12841 |
(match_dup 0))) |
| 12842 |
(clobber (reg:CC FLAGS_REG))])] |
| 12843 |
"" |
| 12844 |
[(set_attr "type" "alu") |
| 12845 |
(set_attr "mode" "QI")]) |
| 12846 |
|
| 12847 |
(define_insn_and_split "*<code>qi_ext<mode>_2_slp" |
| 12848 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+&Q")) |
| 12849 |
(any_logic:QI |
| 12850 |
(subreg:QI |
| 12851 |
(match_operator:SWI248 3 "extract_operator" |
| 12852 |
[(match_operand 1 "int248_register_operand" "Q") |
| 12853 |
(const_int 8) |
| 12854 |
(const_int 8)]) 0) |
| 12855 |
(subreg:QI |
| 12856 |
(match_operator:SWI248 4 "extract_operator" |
| 12857 |
[(match_operand 2 "int248_register_operand" "Q") |
| 12858 |
(const_int 8) |
| 12859 |
(const_int 8)]) 0))) |
| 12860 |
(clobber (reg:CC FLAGS_REG))] |
| 12861 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 12862 |
"#" |
| 12863 |
"&& reload_completed" |
| 12864 |
[(set (strict_low_part (match_dup 0)) |
| 12865 |
(subreg:QI |
| 12866 |
(match_op_dup 4 |
| 12867 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0)) |
| 12868 |
(parallel |
| 12869 |
[(set (strict_low_part (match_dup 0)) |
| 12870 |
(any_logic:QI |
| 12871 |
(subreg:QI |
| 12872 |
(match_op_dup 3 |
| 12873 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0) |
| 12874 |
(match_dup 0))) |
| 12875 |
(clobber (reg:CC FLAGS_REG))])] |
| 12876 |
"" |
| 12877 |
[(set_attr "type" "alu") |
| 12878 |
(set_attr "mode" "QI")]) |
| 12879 |
|
| 12880 |
(define_split |
| 12881 |
[(set (match_operand:SWI248 0 "register_operand") |
| 12882 |
(and:SWI248 (match_operand:SWI248 1 "nonimmediate_operand") |
| 12883 |
(match_operand:SWI248 2 "const_int_operand"))) |
| 12884 |
(clobber (reg:CC FLAGS_REG))] |
| 12885 |
"reload_completed |
| 12886 |
&& (!REG_P (operands[1]) |
| 12887 |
|| REGNO (operands[0]) != REGNO (operands[1])) |
| 12888 |
&& (UINTVAL (operands[2]) == GET_MODE_MASK (SImode) |
| 12889 |
|| UINTVAL (operands[2]) == GET_MODE_MASK (HImode) |
| 12890 |
|| UINTVAL (operands[2]) == GET_MODE_MASK (QImode))" |
| 12891 |
[(const_int 0)] |
| 12892 |
{ |
| 12893 |
unsigned HOST_WIDE_INT ival = UINTVAL (operands[2]); |
| 12894 |
machine_mode mode; |
| 12895 |
|
| 12896 |
if (ival == GET_MODE_MASK (SImode)) |
| 12897 |
mode = SImode; |
| 12898 |
else if (ival == GET_MODE_MASK (HImode)) |
| 12899 |
mode = HImode; |
| 12900 |
else if (ival == GET_MODE_MASK (QImode)) |
| 12901 |
mode = QImode; |
| 12902 |
else |
| 12903 |
gcc_unreachable (); |
| 12904 |
|
| 12905 |
/* Zero extend to SImode to avoid partial register stalls. */ |
| 12906 |
if (<MODE_SIZE> < GET_MODE_SIZE (SImode)) |
| 12907 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 12908 |
|
| 12909 |
emit_insn (gen_extend_insn |
| 12910 |
(operands[0], gen_lowpart (mode, operands[1]), |
| 12911 |
GET_MODE (operands[0]), mode, 1)); |
| 12912 |
DONE; |
| 12913 |
}) |
| 12914 |
|
| 12915 |
(define_split |
| 12916 |
[(set (match_operand:SWI48 0 "register_operand") |
| 12917 |
(and:SWI48 (match_dup 0) |
| 12918 |
(const_int -65536))) |
| 12919 |
(clobber (reg:CC FLAGS_REG))] |
| 12920 |
"(TARGET_FAST_PREFIX && !TARGET_PARTIAL_REG_STALL) |
| 12921 |
|| optimize_function_for_size_p (cfun)" |
| 12922 |
[(set (strict_low_part (match_dup 1)) (const_int 0))] |
| 12923 |
"operands[1] = gen_lowpart (HImode, operands[0]);") |
| 12924 |
|
| 12925 |
(define_split |
| 12926 |
[(set (match_operand:SWI248 0 "any_QIreg_operand") |
| 12927 |
(and:SWI248 (match_dup 0) |
| 12928 |
(const_int -256))) |
| 12929 |
(clobber (reg:CC FLAGS_REG))] |
| 12930 |
"(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 12931 |
&& reload_completed" |
| 12932 |
[(set (strict_low_part (match_dup 1)) (const_int 0))] |
| 12933 |
"operands[1] = gen_lowpart (QImode, operands[0]);") |
| 12934 |
|
| 12935 |
(define_split |
| 12936 |
[(set (match_operand:SWI248 0 "QIreg_operand") |
| 12937 |
(and:SWI248 (match_dup 0) |
| 12938 |
(const_int -65281))) |
| 12939 |
(clobber (reg:CC FLAGS_REG))] |
| 12940 |
"(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 12941 |
&& reload_completed" |
| 12942 |
[(parallel |
| 12943 |
[(set (zero_extract:HI (match_dup 0) |
| 12944 |
(const_int 8) |
| 12945 |
(const_int 8)) |
| 12946 |
(subreg:HI |
| 12947 |
(xor:QI |
| 12948 |
(subreg:QI |
| 12949 |
(zero_extract:HI (match_dup 0) |
| 12950 |
(const_int 8) |
| 12951 |
(const_int 8)) 0) |
| 12952 |
(subreg:QI |
| 12953 |
(zero_extract:HI (match_dup 0) |
| 12954 |
(const_int 8) |
| 12955 |
(const_int 8)) 0)) 0)) |
| 12956 |
(clobber (reg:CC FLAGS_REG))])] |
| 12957 |
"operands[0] = gen_lowpart (HImode, operands[0]);") |
| 12958 |
|
| 12959 |
(define_insn "*anddi_2" |
| 12960 |
[(set (reg FLAGS_REG) |
| 12961 |
(compare |
| 12962 |
(and:DI |
| 12963 |
(match_operand:DI 1 "nonimmediate_operand" "%0,0,0,r,rm,r") |
| 12964 |
(match_operand:DI 2 "x86_64_szext_general_operand" "Z,re,m,Z,re,m")) |
| 12965 |
(const_int 0))) |
| 12966 |
(set (match_operand:DI 0 "nonimmediate_operand" "=r,rm,r,r,r,r") |
| 12967 |
(and:DI (match_dup 1) (match_dup 2)))] |
| 12968 |
"TARGET_64BIT |
| 12969 |
&& ix86_match_ccmode |
| 12970 |
(insn, |
| 12971 |
/* If we are going to emit andl instead of andq, and the operands[2] |
| 12972 |
constant might have the SImode sign bit set, make sure the sign |
| 12973 |
flag isn't tested, because the instruction will set the sign flag |
| 12974 |
based on bit 31 rather than bit 63. If it isn't CONST_INT, |
| 12975 |
conservatively assume it might have bit 31 set. */ |
| 12976 |
(satisfies_constraint_Z (operands[2]) |
| 12977 |
&& (!CONST_INT_P (operands[2]) |
| 12978 |
|| val_signbit_known_set_p (SImode, INTVAL (operands[2])))) |
| 12979 |
? CCZmode : CCNOmode) |
| 12980 |
&& ix86_binary_operator_ok (AND, DImode, operands, TARGET_APX_NDD)" |
| 12981 |
"@ |
| 12982 |
and{l}\t{%k2, %k0|%k0, %k2} |
| 12983 |
and{q}\t{%2, %0|%0, %2} |
| 12984 |
and{q}\t{%2, %0|%0, %2} |
| 12985 |
and{l}\t{%k2, %k1, %k0|%k0, %k1, %k2} |
| 12986 |
and{q}\t{%2, %1, %0|%0, %1, %2} |
| 12987 |
and{q}\t{%2, %1, %0|%0, %1, %2}" |
| 12988 |
[(set_attr "type" "alu") |
| 12989 |
(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,apx_ndd") |
| 12990 |
(set_attr "mode" "SI,DI,DI,SI,DI,DI")]) |
| 12991 |
|
| 12992 |
;; See comment for addsi_1_zext why we do use nonimmediate_operand |
| 12993 |
(define_insn "*andsi_2_zext" |
| 12994 |
[(set (reg FLAGS_REG) |
| 12995 |
(compare (and:SI |
| 12996 |
(match_operand:SI 1 "nonimmediate_operand" "%0,rm,r") |
| 12997 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,re,BM")) |
| 12998 |
(const_int 0))) |
| 12999 |
(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 13000 |
(zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))] |
| 13001 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) |
| 13002 |
&& ix86_binary_operator_ok (AND, SImode, operands, TARGET_APX_NDD)" |
| 13003 |
"@ |
| 13004 |
and{l}\t{%2, %k0|%k0, %2} |
| 13005 |
and{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 13006 |
and{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 13007 |
[(set_attr "type" "alu") |
| 13008 |
(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 13009 |
(set_attr "mode" "SI")]) |
| 13010 |
|
| 13011 |
(define_insn "*andqi_2_maybe_si" |
| 13012 |
[(set (reg FLAGS_REG) |
| 13013 |
(compare (and:QI |
| 13014 |
(match_operand:QI 1 "nonimmediate_operand" "%0,0,0,rm,r") |
| 13015 |
(match_operand:QI 2 "general_operand" "qn,m,n,rn,m")) |
| 13016 |
(const_int 0))) |
| 13017 |
(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r,r") |
| 13018 |
(and:QI (match_dup 1) (match_dup 2)))] |
| 13019 |
"ix86_binary_operator_ok (AND, QImode, operands, TARGET_APX_NDD) |
| 13020 |
&& ix86_match_ccmode (insn, |
| 13021 |
CONST_INT_P (operands[2]) |
| 13022 |
&& INTVAL (operands[2]) >= 0 ? CCNOmode : CCZmode)" |
| 13023 |
{ |
| 13024 |
if (get_attr_mode (insn) == MODE_SI) |
| 13025 |
{ |
| 13026 |
if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) < 0) |
| 13027 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff); |
| 13028 |
return "and{l}\t{%2, %k0|%k0, %2}"; |
| 13029 |
} |
| 13030 |
if (which_alternative > 2) |
| 13031 |
return "and{b}\t{%2, %1, %0|%0, %1, %2}"; |
| 13032 |
return "and{b}\t{%2, %0|%0, %2}"; |
| 13033 |
} |
| 13034 |
[(set_attr "type" "alu") |
| 13035 |
(set_attr "isa" "*,*,*,apx_ndd,apx_ndd") |
| 13036 |
(set (attr "mode") |
| 13037 |
(cond [(eq_attr "alternative" "3,4") |
| 13038 |
(const_string "QI") |
| 13039 |
(eq_attr "alternative" "2") |
| 13040 |
(const_string "SI") |
| 13041 |
(and (match_test "optimize_insn_for_size_p ()") |
| 13042 |
(and (match_operand 0 "ext_QIreg_operand") |
| 13043 |
(match_operand 2 "const_0_to_127_operand"))) |
| 13044 |
(const_string "SI") |
| 13045 |
] |
| 13046 |
(const_string "QI"))) |
| 13047 |
;; Potential partial reg stall on alternative 2. |
| 13048 |
(set (attr "preferred_for_speed") |
| 13049 |
(cond [(eq_attr "alternative" "2") |
| 13050 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 13051 |
(symbol_ref "true")))]) |
| 13052 |
|
| 13053 |
(define_insn "*and<mode>_2" |
| 13054 |
[(set (reg FLAGS_REG) |
| 13055 |
(compare (and:SWI124 |
| 13056 |
(match_operand:SWI124 1 "nonimmediate_operand" "%0,0,rm,r") |
| 13057 |
(match_operand:SWI124 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")) |
| 13058 |
(const_int 0))) |
| 13059 |
(set (match_operand:SWI124 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 13060 |
(and:SWI124 (match_dup 1) (match_dup 2)))] |
| 13061 |
"ix86_match_ccmode (insn, CCNOmode) |
| 13062 |
&& ix86_binary_operator_ok (AND, <MODE>mode, operands, TARGET_APX_NDD)" |
| 13063 |
"@ |
| 13064 |
and{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13065 |
and{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13066 |
and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 13067 |
and{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 13068 |
[(set_attr "type" "alu") |
| 13069 |
(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 13070 |
(set_attr "mode" "<MODE>")]) |
| 13071 |
|
| 13072 |
(define_insn "*<code>qi_ext<mode>_0" |
| 13073 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=QBn") |
| 13074 |
(any_logic:QI |
| 13075 |
(subreg:QI |
| 13076 |
(match_operator:SWI248 3 "extract_operator" |
| 13077 |
[(match_operand 2 "int248_register_operand" "Q") |
| 13078 |
(const_int 8) |
| 13079 |
(const_int 8)]) 0) |
| 13080 |
(match_operand:QI 1 "nonimmediate_operand" "0"))) |
| 13081 |
(clobber (reg:CC FLAGS_REG))] |
| 13082 |
"" |
| 13083 |
"<logic>{b}\t{%h2, %0|%0, %h2}" |
| 13084 |
[(set_attr "addr" "gpr8") |
| 13085 |
(set_attr "type" "alu") |
| 13086 |
(set_attr "mode" "QI")]) |
| 13087 |
|
| 13088 |
(define_insn_and_split "*<code>qi_ext2<mode>_0" |
| 13089 |
[(set (match_operand:QI 0 "register_operand" "=&Q") |
| 13090 |
(any_logic:QI |
| 13091 |
(subreg:QI |
| 13092 |
(match_operator:SWI248 3 "extract_operator" |
| 13093 |
[(match_operand 1 "int248_register_operand" "Q") |
| 13094 |
(const_int 8) |
| 13095 |
(const_int 8)]) 0) |
| 13096 |
(subreg:QI |
| 13097 |
(match_operator:SWI248 4 "extract_operator" |
| 13098 |
[(match_operand 2 "int248_register_operand" "Q") |
| 13099 |
(const_int 8) |
| 13100 |
(const_int 8)]) 0))) |
| 13101 |
(clobber (reg:CC FLAGS_REG))] |
| 13102 |
"" |
| 13103 |
"#" |
| 13104 |
"&& reload_completed" |
| 13105 |
[(set (match_dup 0) |
| 13106 |
(subreg:QI |
| 13107 |
(match_op_dup 4 |
| 13108 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0)) |
| 13109 |
(parallel |
| 13110 |
[(set (match_dup 0) |
| 13111 |
(any_logic:QI |
| 13112 |
(subreg:QI |
| 13113 |
(match_op_dup 3 |
| 13114 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0) |
| 13115 |
(match_dup 0))) |
| 13116 |
(clobber (reg:CC FLAGS_REG))])] |
| 13117 |
"" |
| 13118 |
[(set_attr "type" "alu") |
| 13119 |
(set_attr "mode" "QI")]) |
| 13120 |
|
| 13121 |
(define_expand "andqi_ext_1" |
| 13122 |
[(parallel |
| 13123 |
[(set (zero_extract:HI (match_operand:HI 0 "register_operand") |
| 13124 |
(const_int 8) |
| 13125 |
(const_int 8)) |
| 13126 |
(subreg:HI |
| 13127 |
(and:QI |
| 13128 |
(subreg:QI |
| 13129 |
(zero_extract:HI (match_operand:HI 1 "register_operand") |
| 13130 |
(const_int 8) |
| 13131 |
(const_int 8)) 0) |
| 13132 |
(match_operand:QI 2 "const_int_operand")) 0)) |
| 13133 |
(clobber (reg:CC FLAGS_REG))])]) |
| 13134 |
|
| 13135 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 13136 |
(define_insn_and_split "*<code>qi_ext<mode>_1" |
| 13137 |
[(set (zero_extract:SWI248 |
| 13138 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 13139 |
(const_int 8) |
| 13140 |
(const_int 8)) |
| 13141 |
(subreg:SWI248 |
| 13142 |
(any_logic:QI |
| 13143 |
(subreg:QI |
| 13144 |
(match_operator:SWI248 3 "extract_operator" |
| 13145 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 13146 |
(const_int 8) |
| 13147 |
(const_int 8)]) 0) |
| 13148 |
(match_operand:QI 2 "general_operand" "QnBn,QnBn")) 0)) |
| 13149 |
(clobber (reg:CC FLAGS_REG))] |
| 13150 |
"" |
| 13151 |
"@ |
| 13152 |
<logic>{b}\t{%2, %h0|%h0, %2} |
| 13153 |
#" |
| 13154 |
"reload_completed |
| 13155 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 13156 |
[(set (zero_extract:SWI248 |
| 13157 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13158 |
(zero_extract:SWI248 |
| 13159 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 13160 |
(parallel |
| 13161 |
[(set (zero_extract:SWI248 |
| 13162 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13163 |
(subreg:SWI248 |
| 13164 |
(any_logic:QI |
| 13165 |
(subreg:QI |
| 13166 |
(match_op_dup 3 |
| 13167 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 13168 |
(match_dup 2)) 0)) |
| 13169 |
(clobber (reg:CC FLAGS_REG))])] |
| 13170 |
"" |
| 13171 |
[(set_attr "addr" "gpr8") |
| 13172 |
(set_attr "type" "alu") |
| 13173 |
(set_attr "mode" "QI")]) |
| 13174 |
|
| 13175 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 13176 |
(define_insn_and_split "*<code>qi_ext<mode>_1_cc" |
| 13177 |
[(set (match_operand 4 "flags_reg_operand") |
| 13178 |
(match_operator 5 "compare_operator" |
| 13179 |
[(any_logic:QI |
| 13180 |
(subreg:QI |
| 13181 |
(match_operator:SWI248 3 "extract_operator" |
| 13182 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 13183 |
(const_int 8) |
| 13184 |
(const_int 8)]) 0) |
| 13185 |
(match_operand:QI 2 "general_operand" "QnBn,QnBn")) |
| 13186 |
(const_int 0)])) |
| 13187 |
(set (zero_extract:SWI248 |
| 13188 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 13189 |
(const_int 8) |
| 13190 |
(const_int 8)) |
| 13191 |
(subreg:SWI248 |
| 13192 |
(any_logic:QI |
| 13193 |
(subreg:QI |
| 13194 |
(match_op_dup 3 |
| 13195 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 13196 |
(match_dup 2)) 0))] |
| 13197 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 13198 |
"@ |
| 13199 |
<logic>{b}\t{%2, %h0|%h0, %2} |
| 13200 |
#" |
| 13201 |
"&& reload_completed |
| 13202 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 13203 |
[(set (zero_extract:SWI248 |
| 13204 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13205 |
(zero_extract:SWI248 |
| 13206 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 13207 |
(parallel |
| 13208 |
[(set (match_dup 4) |
| 13209 |
(match_op_dup 5 |
| 13210 |
[(any_logic:QI |
| 13211 |
(subreg:QI |
| 13212 |
(match_op_dup 3 |
| 13213 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 13214 |
(match_dup 2)) |
| 13215 |
(const_int 0)])) |
| 13216 |
(set (zero_extract:SWI248 |
| 13217 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13218 |
(subreg:SWI248 |
| 13219 |
(any_logic:QI |
| 13220 |
(subreg:QI |
| 13221 |
(match_op_dup 3 |
| 13222 |
[(match_dup 1) (const_int 8) (const_int 8)]) 0) |
| 13223 |
(match_dup 2)) 0))])] |
| 13224 |
"" |
| 13225 |
[(set_attr "addr" "gpr8") |
| 13226 |
(set_attr "type" "alu") |
| 13227 |
(set_attr "mode" "QI")]) |
| 13228 |
|
| 13229 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 13230 |
(define_insn_and_split "*<code>qi_ext<mode>_2" |
| 13231 |
[(set (zero_extract:SWI248 |
| 13232 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 13233 |
(const_int 8) |
| 13234 |
(const_int 8)) |
| 13235 |
(subreg:SWI248 |
| 13236 |
(any_logic:QI |
| 13237 |
(subreg:QI |
| 13238 |
(match_operator:SWI248 3 "extract_operator" |
| 13239 |
[(match_operand 1 "int248_register_operand" "%0,!Q") |
| 13240 |
(const_int 8) |
| 13241 |
(const_int 8)]) 0) |
| 13242 |
(subreg:QI |
| 13243 |
(match_operator:SWI248 4 "extract_operator" |
| 13244 |
[(match_operand 2 "int248_register_operand" "Q,Q") |
| 13245 |
(const_int 8) |
| 13246 |
(const_int 8)]) 0)) 0)) |
| 13247 |
(clobber (reg:CC FLAGS_REG))] |
| 13248 |
"" |
| 13249 |
"@ |
| 13250 |
<logic>{b}\t{%h2, %h0|%h0, %h2} |
| 13251 |
#" |
| 13252 |
"reload_completed |
| 13253 |
&& !(rtx_equal_p (operands[0], operands[1]) |
| 13254 |
|| rtx_equal_p (operands[0], operands[2]))" |
| 13255 |
[(set (zero_extract:SWI248 |
| 13256 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13257 |
(zero_extract:SWI248 |
| 13258 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 13259 |
(parallel |
| 13260 |
[(set (zero_extract:SWI248 |
| 13261 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13262 |
(subreg:SWI248 |
| 13263 |
(any_logic:QI |
| 13264 |
(subreg:QI |
| 13265 |
(match_op_dup 3 |
| 13266 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 13267 |
(subreg:QI |
| 13268 |
(match_op_dup 4 |
| 13269 |
[(match_dup 2) (const_int 8) (const_int 8)]) 0)) 0)) |
| 13270 |
(clobber (reg:CC FLAGS_REG))])] |
| 13271 |
"" |
| 13272 |
[(set_attr "type" "alu") |
| 13273 |
(set_attr "mode" "QI")]) |
| 13274 |
|
| 13275 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 13276 |
(define_insn_and_split "*<code>qi_ext<mode>_3" |
| 13277 |
[(set (zero_extract:SWI248 |
| 13278 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 13279 |
(const_int 8) |
| 13280 |
(const_int 8)) |
| 13281 |
(match_operator:SWI248 3 "extract_operator" |
| 13282 |
[(any_logic |
| 13283 |
(match_operand 1 "int248_register_operand" "%0,!Q") |
| 13284 |
(match_operand 2 "int248_register_operand" "Q,Q")) |
| 13285 |
(const_int 8) |
| 13286 |
(const_int 8)])) |
| 13287 |
(clobber (reg:CC FLAGS_REG))] |
| 13288 |
"GET_MODE (operands[1]) == GET_MODE (operands[2])" |
| 13289 |
"@ |
| 13290 |
<logic>{b}\t{%h2, %h0|%h0, %h2} |
| 13291 |
#" |
| 13292 |
"&& reload_completed |
| 13293 |
&& !(rtx_equal_p (operands[0], operands[1]) |
| 13294 |
|| rtx_equal_p (operands[0], operands[2]))" |
| 13295 |
[(set (zero_extract:SWI248 |
| 13296 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13297 |
(zero_extract:SWI248 |
| 13298 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 13299 |
(parallel |
| 13300 |
[(set (zero_extract:SWI248 |
| 13301 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 13302 |
(match_op_dup 3 |
| 13303 |
[(any_logic (match_dup 4) (match_dup 2)) |
| 13304 |
(const_int 8) (const_int 8)])) |
| 13305 |
(clobber (reg:CC FLAGS_REG))])] |
| 13306 |
"operands[4] = gen_lowpart (GET_MODE (operands[1]), operands[0]);" |
| 13307 |
[(set_attr "type" "alu") |
| 13308 |
(set_attr "mode" "QI")]) |
| 13309 |
|
| 13310 |
;; Convert wide AND instructions with immediate operand to shorter QImode |
| 13311 |
;; equivalents when possible. |
| 13312 |
;; Don't do the splitting with memory operands, since it introduces risk |
| 13313 |
;; of memory mismatch stalls. We may want to do the splitting for optimizing |
| 13314 |
;; for size, but that can (should?) be handled by generic code instead. |
| 13315 |
;; Don't do the splitting for APX NDD as NDD does not support *h registers. |
| 13316 |
(define_split |
| 13317 |
[(set (match_operand:SWI248 0 "QIreg_operand") |
| 13318 |
(and:SWI248 (match_operand:SWI248 1 "register_operand") |
| 13319 |
(match_operand:SWI248 2 "const_int_operand"))) |
| 13320 |
(clobber (reg:CC FLAGS_REG))] |
| 13321 |
"reload_completed |
| 13322 |
&& (!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 13323 |
&& !(~INTVAL (operands[2]) & ~(255 << 8)) |
| 13324 |
&& !(TARGET_APX_NDD && REGNO (operands[0]) != REGNO (operands[1]))" |
| 13325 |
[(parallel |
| 13326 |
[(set (zero_extract:HI (match_dup 0) |
| 13327 |
(const_int 8) |
| 13328 |
(const_int 8)) |
| 13329 |
(subreg:HI |
| 13330 |
(and:QI |
| 13331 |
(subreg:QI |
| 13332 |
(zero_extract:HI (match_dup 1) |
| 13333 |
(const_int 8) |
| 13334 |
(const_int 8)) 0) |
| 13335 |
(match_dup 2)) 0)) |
| 13336 |
(clobber (reg:CC FLAGS_REG))])] |
| 13337 |
{ |
| 13338 |
operands[0] = gen_lowpart (HImode, operands[0]); |
| 13339 |
operands[1] = gen_lowpart (HImode, operands[1]); |
| 13340 |
operands[2] = gen_int_mode (INTVAL (operands[2]) >> 8, QImode); |
| 13341 |
}) |
| 13342 |
|
| 13343 |
;; Since AND can be encoded with sign extended immediate, this is only |
| 13344 |
;; profitable when 7th bit is not set. |
| 13345 |
(define_split |
| 13346 |
[(set (match_operand:SWI248 0 "any_QIreg_operand") |
| 13347 |
(and:SWI248 (match_operand:SWI248 1 "general_operand") |
| 13348 |
(match_operand:SWI248 2 "const_int_operand"))) |
| 13349 |
(clobber (reg:CC FLAGS_REG))] |
| 13350 |
"reload_completed |
| 13351 |
&& (!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 13352 |
&& !(~INTVAL (operands[2]) & ~255) |
| 13353 |
&& !(INTVAL (operands[2]) & 128) |
| 13354 |
&& !(TARGET_APX_NDD |
| 13355 |
&& !rtx_equal_p (operands[0], operands[1]))" |
| 13356 |
[(parallel [(set (strict_low_part (match_dup 0)) |
| 13357 |
(and:QI (match_dup 1) |
| 13358 |
(match_dup 2))) |
| 13359 |
(clobber (reg:CC FLAGS_REG))])] |
| 13360 |
{ |
| 13361 |
operands[0] = gen_lowpart (QImode, operands[0]); |
| 13362 |
operands[1] = gen_lowpart (QImode, operands[1]); |
| 13363 |
operands[2] = gen_int_mode (INTVAL (operands[2]), QImode); |
| 13364 |
}) |
| 13365 |
|
| 13366 |
(define_insn_and_split "*andn<dwi>3_doubleword_bmi" |
| 13367 |
[(set (match_operand:<DWI> 0 "register_operand" "=&r,&r,r,r") |
| 13368 |
(and:<DWI> |
| 13369 |
(not:<DWI> (match_operand:<DWI> 1 "register_operand" "r,r,0,r")) |
| 13370 |
(match_operand:<DWI> 2 "nonimmediate_operand" "r,o,ro,0"))) |
| 13371 |
(clobber (reg:CC FLAGS_REG))] |
| 13372 |
"TARGET_BMI" |
| 13373 |
"#" |
| 13374 |
"&& reload_completed" |
| 13375 |
[(parallel [(set (match_dup 0) |
| 13376 |
(and:DWIH (not:DWIH (match_dup 1)) (match_dup 2))) |
| 13377 |
(clobber (reg:CC FLAGS_REG))]) |
| 13378 |
(parallel [(set (match_dup 3) |
| 13379 |
(and:DWIH (not:DWIH (match_dup 4)) (match_dup 5))) |
| 13380 |
(clobber (reg:CC FLAGS_REG))])] |
| 13381 |
"split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]);" |
| 13382 |
[(set_attr "isa" "x64,*,*,*")]) |
| 13383 |
|
| 13384 |
(define_insn_and_split "*andn<mode>3_doubleword" |
| 13385 |
[(set (match_operand:DWI 0 "register_operand") |
| 13386 |
(and:DWI |
| 13387 |
(not:DWI (match_operand:DWI 1 "register_operand")) |
| 13388 |
(match_operand:DWI 2 "nonimmediate_operand"))) |
| 13389 |
(clobber (reg:CC FLAGS_REG))] |
| 13390 |
"!TARGET_BMI |
| 13391 |
&& ix86_pre_reload_split ()" |
| 13392 |
"#" |
| 13393 |
"&& 1" |
| 13394 |
[(set (match_dup 3) (not:DWI (match_dup 1))) |
| 13395 |
(parallel [(set (match_dup 0) |
| 13396 |
(and:DWI (match_dup 3) (match_dup 2))) |
| 13397 |
(clobber (reg:CC FLAGS_REG))])] |
| 13398 |
"operands[3] = gen_reg_rtx (<MODE>mode);") |
| 13399 |
|
| 13400 |
(define_insn "*andn<mode>_1" |
| 13401 |
[(set (match_operand:SWI48 0 "register_operand" "=r,r,?k") |
| 13402 |
(and:SWI48 |
| 13403 |
(not:SWI48 (match_operand:SWI48 1 "register_operand" "r,r,k")) |
| 13404 |
(match_operand:SWI48 2 "nonimmediate_operand" "r,m,k"))) |
| 13405 |
(clobber (reg:CC FLAGS_REG))] |
| 13406 |
"TARGET_BMI || TARGET_AVX512BW" |
| 13407 |
"@ |
| 13408 |
andn\t{%2, %1, %0|%0, %1, %2} |
| 13409 |
andn\t{%2, %1, %0|%0, %1, %2} |
| 13410 |
#" |
| 13411 |
[(set_attr "isa" "bmi,bmi,avx512bw") |
| 13412 |
(set_attr "type" "bitmanip,bitmanip,msklog") |
| 13413 |
(set_attr "btver2_decode" "direct, double,*") |
| 13414 |
(set_attr "mode" "<MODE>")]) |
| 13415 |
|
| 13416 |
(define_insn "*andn<mode>_1" |
| 13417 |
[(set (match_operand:SWI12 0 "register_operand" "=r,?k") |
| 13418 |
(and:SWI12 |
| 13419 |
(not:SWI12 (match_operand:SWI12 1 "register_operand" "r,k")) |
| 13420 |
(match_operand:SWI12 2 "register_operand" "r,k"))) |
| 13421 |
(clobber (reg:CC FLAGS_REG))] |
| 13422 |
"TARGET_BMI || TARGET_AVX512BW" |
| 13423 |
"@ |
| 13424 |
andn\t{%k2, %k1, %k0|%k0, %k1, %k2} |
| 13425 |
#" |
| 13426 |
[(set_attr "isa" "bmi,avx512f") |
| 13427 |
(set_attr "type" "bitmanip,msklog") |
| 13428 |
(set_attr "btver2_decode" "direct,*") |
| 13429 |
(set (attr "mode") |
| 13430 |
(cond [(eq_attr "alternative" "0") |
| 13431 |
(const_string "SI") |
| 13432 |
(and (eq_attr "alternative" "1") |
| 13433 |
(match_test "!TARGET_AVX512DQ")) |
| 13434 |
(const_string "HI") |
| 13435 |
] |
| 13436 |
(const_string "<MODE>")))]) |
| 13437 |
|
| 13438 |
(define_insn "*andn_<mode>_ccno" |
| 13439 |
[(set (reg FLAGS_REG) |
| 13440 |
(compare |
| 13441 |
(and:SWI48 |
| 13442 |
(not:SWI48 (match_operand:SWI48 1 "register_operand" "r,r")) |
| 13443 |
(match_operand:SWI48 2 "nonimmediate_operand" "r,m")) |
| 13444 |
(const_int 0))) |
| 13445 |
(clobber (match_scratch:SWI48 0 "=r,r"))] |
| 13446 |
"TARGET_BMI && ix86_match_ccmode (insn, CCNOmode)" |
| 13447 |
"andn\t{%2, %1, %0|%0, %1, %2}" |
| 13448 |
[(set_attr "type" "bitmanip") |
| 13449 |
(set_attr "btver2_decode" "direct, double") |
| 13450 |
(set_attr "mode" "<MODE>")]) |
| 13451 |
|
| 13452 |
;; Split *andnsi_1 after reload with -Oz when not;and is shorter. |
| 13453 |
(define_split |
| 13454 |
[(set (match_operand:SI 0 "register_operand") |
| 13455 |
(and:SI (not:SI (match_operand:SI 1 "register_operand")) |
| 13456 |
(match_operand:SI 2 "nonimmediate_operand"))) |
| 13457 |
(clobber (reg:CC FLAGS_REG))] |
| 13458 |
"reload_completed |
| 13459 |
&& optimize_insn_for_size_p () && optimize_size > 1 |
| 13460 |
&& REGNO (operands[0]) == REGNO (operands[1]) |
| 13461 |
&& LEGACY_INT_REG_P (operands[0]) |
| 13462 |
&& !REX_INT_REG_P (operands[2]) |
| 13463 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 13464 |
[(set (match_dup 0) (not:SI (match_dup 1))) |
| 13465 |
(parallel [(set (match_dup 0) (and:SI (match_dup 0) (match_dup 2))) |
| 13466 |
(clobber (reg:CC FLAGS_REG))])]) |
| 13467 |
|
| 13468 |
;; Split *andn_si_ccno with -Oz when not;test is shorter. |
| 13469 |
(define_split |
| 13470 |
[(set (match_operand 0 "flags_reg_operand") |
| 13471 |
(match_operator 1 "compare_operator" |
| 13472 |
[(and:SI (not:SI (match_operand:SI 2 "general_reg_operand")) |
| 13473 |
(match_operand:SI 3 "nonimmediate_operand")) |
| 13474 |
(const_int 0)])) |
| 13475 |
(clobber (match_dup 2))] |
| 13476 |
"reload_completed |
| 13477 |
&& optimize_insn_for_size_p () && optimize_size > 1 |
| 13478 |
&& LEGACY_INT_REG_P (operands[2]) |
| 13479 |
&& !REX_INT_REG_P (operands[3]) |
| 13480 |
&& !reg_overlap_mentioned_p (operands[2], operands[3])" |
| 13481 |
[(set (match_dup 2) (not:SI (match_dup 2))) |
| 13482 |
(set (match_dup 0) (match_op_dup 1 |
| 13483 |
[(and:SI (match_dup 3) (match_dup 2)) |
| 13484 |
(const_int 0)]))]) |
| 13485 |
|
| 13486 |
;; Variant 1 of 4: Split ((A | B) ^ A) ^ C as (B & ~A) ^ C. |
| 13487 |
(define_split |
| 13488 |
[(set (match_operand:SWI48 0 "register_operand") |
| 13489 |
(xor:SWI48 |
| 13490 |
(xor:SWI48 |
| 13491 |
(ior:SWI48 (match_operand:SWI48 1 "register_operand") |
| 13492 |
(match_operand:SWI48 2 "nonimmediate_operand")) |
| 13493 |
(match_dup 1)) |
| 13494 |
(match_operand:SWI48 3 "nonimmediate_operand"))) |
| 13495 |
(clobber (reg:CC FLAGS_REG))] |
| 13496 |
"TARGET_BMI" |
| 13497 |
[(parallel |
| 13498 |
[(set (match_dup 4) (and:SWI48 (not:SWI48 (match_dup 1)) (match_dup 2))) |
| 13499 |
(clobber (reg:CC FLAGS_REG))]) |
| 13500 |
(parallel |
| 13501 |
[(set (match_dup 0) (xor:SWI48 (match_dup 4) (match_dup 3))) |
| 13502 |
(clobber (reg:CC FLAGS_REG))])] |
| 13503 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 13504 |
|
| 13505 |
;; Variant 2 of 4: Split ((A | B) ^ B) ^ C as (A & ~B) ^ C. |
| 13506 |
(define_split |
| 13507 |
[(set (match_operand:SWI48 0 "register_operand") |
| 13508 |
(xor:SWI48 |
| 13509 |
(xor:SWI48 |
| 13510 |
(ior:SWI48 (match_operand:SWI48 1 "register_operand") |
| 13511 |
(match_operand:SWI48 2 "register_operand")) |
| 13512 |
(match_dup 2)) |
| 13513 |
(match_operand:SWI48 3 "nonimmediate_operand"))) |
| 13514 |
(clobber (reg:CC FLAGS_REG))] |
| 13515 |
"TARGET_BMI" |
| 13516 |
[(parallel |
| 13517 |
[(set (match_dup 4) (and:SWI48 (not:SWI48 (match_dup 2)) (match_dup 1))) |
| 13518 |
(clobber (reg:CC FLAGS_REG))]) |
| 13519 |
(parallel |
| 13520 |
[(set (match_dup 0) (xor:SWI48 (match_dup 4) (match_dup 3))) |
| 13521 |
(clobber (reg:CC FLAGS_REG))])] |
| 13522 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 13523 |
|
| 13524 |
;; Variant 3 of 4: Split ((A | B) ^ C) ^ A as (B & ~A) ^ C. |
| 13525 |
(define_split |
| 13526 |
[(set (match_operand:SWI48 0 "register_operand") |
| 13527 |
(xor:SWI48 |
| 13528 |
(xor:SWI48 |
| 13529 |
(ior:SWI48 (match_operand:SWI48 1 "register_operand") |
| 13530 |
(match_operand:SWI48 2 "nonimmediate_operand")) |
| 13531 |
(match_operand:SWI48 3 "nonimmediate_operand")) |
| 13532 |
(match_dup 1))) |
| 13533 |
(clobber (reg:CC FLAGS_REG))] |
| 13534 |
"TARGET_BMI" |
| 13535 |
[(parallel |
| 13536 |
[(set (match_dup 4) (and:SWI48 (not:SWI48 (match_dup 1)) (match_dup 2))) |
| 13537 |
(clobber (reg:CC FLAGS_REG))]) |
| 13538 |
(parallel |
| 13539 |
[(set (match_dup 0) (xor:SWI48 (match_dup 4) (match_dup 3))) |
| 13540 |
(clobber (reg:CC FLAGS_REG))])] |
| 13541 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 13542 |
|
| 13543 |
;; Variant 4 of 4: Split ((A | B) ^ C) ^ B as (A & ~B) ^ C. |
| 13544 |
(define_split |
| 13545 |
[(set (match_operand:SWI48 0 "register_operand") |
| 13546 |
(xor:SWI48 |
| 13547 |
(xor:SWI48 |
| 13548 |
(ior:SWI48 (match_operand:SWI48 1 "register_operand") |
| 13549 |
(match_operand:SWI48 2 "register_operand")) |
| 13550 |
(match_operand:SWI48 3 "nonimmediate_operand")) |
| 13551 |
(match_dup 2))) |
| 13552 |
(clobber (reg:CC FLAGS_REG))] |
| 13553 |
"TARGET_BMI" |
| 13554 |
[(parallel |
| 13555 |
[(set (match_dup 4) (and:SWI48 (not:SWI48 (match_dup 2)) (match_dup 1))) |
| 13556 |
(clobber (reg:CC FLAGS_REG))]) |
| 13557 |
(parallel |
| 13558 |
[(set (match_dup 0) (xor:SWI48 (match_dup 4) (match_dup 3))) |
| 13559 |
(clobber (reg:CC FLAGS_REG))])] |
| 13560 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 13561 |
|
| 13562 |
;; Logical inclusive and exclusive OR instructions |
| 13563 |
|
| 13564 |
;; %%% This used to optimize known byte-wide and operations to memory. |
| 13565 |
;; If this is considered useful, it should be done with splitters. |
| 13566 |
|
| 13567 |
(define_expand "<code><mode>3" |
| 13568 |
[(set (match_operand:SDWIM 0 "nonimmediate_operand") |
| 13569 |
(any_or:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand") |
| 13570 |
(match_operand:SDWIM 2 "<general_operand>")))] |
| 13571 |
"" |
| 13572 |
{ |
| 13573 |
if (GET_MODE_SIZE (<MODE>mode) > UNITS_PER_WORD |
| 13574 |
&& !x86_64_hilo_general_operand (operands[2], <MODE>mode)) |
| 13575 |
operands[2] = force_reg (<MODE>mode, operands[2]); |
| 13576 |
|
| 13577 |
ix86_expand_binary_operator (<CODE>, <MODE>mode, operands, TARGET_APX_NDD); |
| 13578 |
DONE; |
| 13579 |
}) |
| 13580 |
|
| 13581 |
(define_insn_and_split "*<code><dwi>3_doubleword" |
| 13582 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,&r,&r,&r,&r,&r") |
| 13583 |
(any_or:<DWI> |
| 13584 |
(match_operand:<DWI> 1 "nonimmediate_operand" "%0,0,ro,r,ro,jO,r") |
| 13585 |
(match_operand:<DWI> 2 "x86_64_hilo_general_operand" "r<di>,o,r,<di>,K,<di>,o"))) |
| 13586 |
(clobber (reg:CC FLAGS_REG))] |
| 13587 |
"ix86_binary_operator_ok (<CODE>, <DWI>mode, operands, TARGET_APX_NDD)" |
| 13588 |
"#" |
| 13589 |
"&& reload_completed" |
| 13590 |
[(const_int:DWIH 0)] |
| 13591 |
{ |
| 13592 |
/* This insn may disappear completely when operands[2] == const0_rtx |
| 13593 |
and operands[0] == operands[1], which requires a NOTE_INSN_DELETED. */ |
| 13594 |
bool emit_insn_deleted_note_p = false; |
| 13595 |
|
| 13596 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 13597 |
|
| 13598 |
if (operands[2] == const0_rtx) |
| 13599 |
{ |
| 13600 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 13601 |
emit_move_insn (operands[0], operands[1]); |
| 13602 |
else |
| 13603 |
emit_insn_deleted_note_p = true; |
| 13604 |
} |
| 13605 |
else if (operands[2] == constm1_rtx) |
| 13606 |
{ |
| 13607 |
if (<CODE> == IOR) |
| 13608 |
emit_move_insn (operands[0], constm1_rtx); |
| 13609 |
else |
| 13610 |
ix86_expand_unary_operator (NOT, <MODE>mode, &operands[0], |
| 13611 |
TARGET_APX_NDD); |
| 13612 |
} |
| 13613 |
else |
| 13614 |
ix86_expand_binary_operator (<CODE>, <MODE>mode, &operands[0], |
| 13615 |
TARGET_APX_NDD); |
| 13616 |
|
| 13617 |
if (operands[5] == const0_rtx) |
| 13618 |
{ |
| 13619 |
if (!rtx_equal_p (operands[3], operands[4])) |
| 13620 |
emit_move_insn (operands[3], operands[4]); |
| 13621 |
else if (emit_insn_deleted_note_p) |
| 13622 |
emit_note (NOTE_INSN_DELETED); |
| 13623 |
} |
| 13624 |
else if (operands[5] == constm1_rtx) |
| 13625 |
{ |
| 13626 |
if (<CODE> == IOR) |
| 13627 |
emit_move_insn (operands[3], constm1_rtx); |
| 13628 |
else |
| 13629 |
ix86_expand_unary_operator (NOT, <MODE>mode, &operands[3], |
| 13630 |
TARGET_APX_NDD); |
| 13631 |
} |
| 13632 |
else |
| 13633 |
ix86_expand_binary_operator (<CODE>, <MODE>mode, &operands[3], |
| 13634 |
TARGET_APX_NDD); |
| 13635 |
|
| 13636 |
DONE; |
| 13637 |
} |
| 13638 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd,apx_ndd,apx_ndd_64,apx_ndd")]) |
| 13639 |
|
| 13640 |
(define_insn "*<code><mode>_1<nf_name>" |
| 13641 |
[(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r<nf_mem_constraint>,r,r,r,r,?k") |
| 13642 |
(any_or:SWI248 |
| 13643 |
(match_operand:SWI248 1 "nonimmediate_operand" "%0,0,0,rm,rjM,r,k") |
| 13644 |
(match_operand:SWI248 2 "<general_operand>" "r,<i>,<m>,r,<i>,<m>,k")))] |
| 13645 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD) |
| 13646 |
&& <nf_condition>" |
| 13647 |
"@ |
| 13648 |
<nf_prefix><logic>{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13649 |
<nf_prefix><logic>{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13650 |
<nf_prefix><logic>{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13651 |
<nf_prefix><logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 13652 |
<nf_prefix><logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 13653 |
<nf_prefix><logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 13654 |
#" |
| 13655 |
[(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,apx_ndd,<kmov_isa>") |
| 13656 |
(set_attr "type" "alu,alu, alu, alu, alu, alu, msklog") |
| 13657 |
(set_attr "has_nf" "1") |
| 13658 |
(set_attr "mode" "<MODE>")]) |
| 13659 |
|
| 13660 |
(define_insn_and_split "*notxor<mode>_1" |
| 13661 |
[(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r,r,r,?k") |
| 13662 |
(not:SWI248 |
| 13663 |
(xor:SWI248 |
| 13664 |
(match_operand:SWI248 1 "nonimmediate_operand" "%0,0,rm,r,k") |
| 13665 |
(match_operand:SWI248 2 "<general_operand>" "r<i>,<m>,r<i>,<m>,k")))) |
| 13666 |
(clobber (reg:CC FLAGS_REG))] |
| 13667 |
"ix86_binary_operator_ok (XOR, <MODE>mode, operands, TARGET_APX_NDD)" |
| 13668 |
"#" |
| 13669 |
"&& reload_completed" |
| 13670 |
[(parallel |
| 13671 |
[(set (match_dup 0) |
| 13672 |
(xor:SWI248 (match_dup 1) (match_dup 2))) |
| 13673 |
(clobber (reg:CC FLAGS_REG))]) |
| 13674 |
(set (match_dup 0) |
| 13675 |
(not:SWI248 (match_dup 0)))] |
| 13676 |
{ |
| 13677 |
if (MASK_REG_P (operands[0])) |
| 13678 |
{ |
| 13679 |
emit_insn (gen_kxnor<mode> (operands[0], operands[1], operands[2])); |
| 13680 |
DONE; |
| 13681 |
} |
| 13682 |
} |
| 13683 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd,<kmov_isa>") |
| 13684 |
(set_attr "type" "alu, alu, alu, alu, msklog") |
| 13685 |
(set_attr "mode" "<MODE>")]) |
| 13686 |
|
| 13687 |
(define_insn_and_split "*iordi_1_bts" |
| 13688 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=rm") |
| 13689 |
(ior:DI |
| 13690 |
(match_operand:DI 1 "nonimmediate_operand" "%0") |
| 13691 |
(match_operand:DI 2 "const_int_operand" "n"))) |
| 13692 |
(clobber (reg:CC FLAGS_REG))] |
| 13693 |
"TARGET_64BIT && TARGET_USE_BT |
| 13694 |
&& ix86_binary_operator_ok (IOR, DImode, operands) |
| 13695 |
&& IN_RANGE (exact_log2 (INTVAL (operands[2])), 31, 63)" |
| 13696 |
"#" |
| 13697 |
"&& reload_completed" |
| 13698 |
[(parallel [(set (zero_extract:DI (match_dup 0) |
| 13699 |
(const_int 1) |
| 13700 |
(match_dup 3)) |
| 13701 |
(const_int 1)) |
| 13702 |
(clobber (reg:CC FLAGS_REG))])] |
| 13703 |
"operands[3] = GEN_INT (exact_log2 (INTVAL (operands[2])));" |
| 13704 |
[(set_attr "type" "alu1") |
| 13705 |
(set_attr "prefix_0f" "1") |
| 13706 |
(set_attr "znver1_decode" "double") |
| 13707 |
(set_attr "c86_decode" "double") |
| 13708 |
(set_attr "mode" "DI")]) |
| 13709 |
|
| 13710 |
(define_insn_and_split "*xordi_1_btc" |
| 13711 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=rm") |
| 13712 |
(xor:DI |
| 13713 |
(match_operand:DI 1 "nonimmediate_operand" "%0") |
| 13714 |
(match_operand:DI 2 "const_int_operand" "n"))) |
| 13715 |
(clobber (reg:CC FLAGS_REG))] |
| 13716 |
"TARGET_64BIT && TARGET_USE_BT |
| 13717 |
&& ix86_binary_operator_ok (XOR, DImode, operands) |
| 13718 |
&& IN_RANGE (exact_log2 (INTVAL (operands[2])), 31, 63)" |
| 13719 |
"#" |
| 13720 |
"&& reload_completed" |
| 13721 |
[(parallel [(set (zero_extract:DI (match_dup 0) |
| 13722 |
(const_int 1) |
| 13723 |
(match_dup 3)) |
| 13724 |
(not:DI (zero_extract:DI (match_dup 0) |
| 13725 |
(const_int 1) |
| 13726 |
(match_dup 3)))) |
| 13727 |
(clobber (reg:CC FLAGS_REG))])] |
| 13728 |
"operands[3] = GEN_INT (exact_log2 (INTVAL (operands[2])));" |
| 13729 |
[(set_attr "type" "alu1") |
| 13730 |
(set_attr "prefix_0f" "1") |
| 13731 |
(set_attr "znver1_decode" "double") |
| 13732 |
(set_attr "c86_decode" "double") |
| 13733 |
(set_attr "mode" "DI")]) |
| 13734 |
|
| 13735 |
;; Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b & mask) |
| 13736 |
(define_insn_and_split "*xor2andn" |
| 13737 |
[(set (match_operand:SWI248 0 "register_operand") |
| 13738 |
(xor:SWI248 |
| 13739 |
(and:SWI248 |
| 13740 |
(xor:SWI248 |
| 13741 |
(match_operand:SWI248 1 "nonimmediate_operand") |
| 13742 |
(match_operand:SWI248 2 "nonimmediate_operand")) |
| 13743 |
(match_operand:SWI248 3 "nonimmediate_operand")) |
| 13744 |
(match_dup 1))) |
| 13745 |
(clobber (reg:CC FLAGS_REG))] |
| 13746 |
"TARGET_BMI && ix86_pre_reload_split ()" |
| 13747 |
"#" |
| 13748 |
"&& 1" |
| 13749 |
[(parallel [(set (match_dup 4) |
| 13750 |
(and:SWI248 |
| 13751 |
(not:SWI248 |
| 13752 |
(match_dup 3)) |
| 13753 |
(match_dup 1))) |
| 13754 |
(clobber (reg:CC FLAGS_REG))]) |
| 13755 |
(parallel [(set (match_dup 5) |
| 13756 |
(and:SWI248 |
| 13757 |
(match_dup 3) |
| 13758 |
(match_dup 2))) |
| 13759 |
(clobber (reg:CC FLAGS_REG))]) |
| 13760 |
(parallel [(set (match_dup 0) |
| 13761 |
(ior:SWI248 |
| 13762 |
(match_dup 4) |
| 13763 |
(match_dup 5))) |
| 13764 |
(clobber (reg:CC FLAGS_REG))])] |
| 13765 |
{ |
| 13766 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 13767 |
operands[3] = force_reg (<MODE>mode, operands[3]); |
| 13768 |
operands[4] = gen_reg_rtx (<MODE>mode); |
| 13769 |
operands[5] = gen_reg_rtx (<MODE>mode); |
| 13770 |
}) |
| 13771 |
|
| 13772 |
(define_insn "*<code>qi_1_zext<mode><nf_name>" |
| 13773 |
[(set (match_operand:SWI248x 0 "register_operand" "=r,r") |
| 13774 |
(zero_extend:SWI248x |
| 13775 |
(any_or:QI (match_operand:QI 1 "nonimmediate_operand" "%rm,r") |
| 13776 |
(match_operand:QI 2 "x86_64_general_operand" "rn,m"))))] |
| 13777 |
"TARGET_APX_NDD && <nf_condition> |
| 13778 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 13779 |
"@ |
| 13780 |
<nf_prefix><logic>{b}\t{%2, %1, %b0|%b0, %1, %2} |
| 13781 |
<nf_prefix><logic>{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 13782 |
[(set_attr "type" "alu") |
| 13783 |
(set_attr "has_nf" "1") |
| 13784 |
(set_attr "mode" "QI")]) |
| 13785 |
|
| 13786 |
(define_insn "*<code>hi_1_zext<mode><nf_name>" |
| 13787 |
[(set (match_operand:SWI48x 0 "register_operand" "=r,r") |
| 13788 |
(zero_extend:SWI48x |
| 13789 |
(any_or:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,r") |
| 13790 |
(match_operand:HI 2 "x86_64_general_operand" "rn,m"))))] |
| 13791 |
"TARGET_APX_NDD && <nf_condition> |
| 13792 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 13793 |
"@ |
| 13794 |
<nf_prefix><logic>{w}\t{%2, %1, %w0|%w0, %1, %2} |
| 13795 |
<nf_prefix><logic>{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 13796 |
[(set_attr "type" "alu") |
| 13797 |
(set_attr "has_nf" "1") |
| 13798 |
(set_attr "mode" "HI")]) |
| 13799 |
|
| 13800 |
;; See comment for addsi_1_zext why we do use nonimmediate_operand |
| 13801 |
(define_insn "*<code>si_1_zext" |
| 13802 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 13803 |
(zero_extend:DI |
| 13804 |
(any_or:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,rjM,r") |
| 13805 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,r,e,BM")))) |
| 13806 |
(clobber (reg:CC FLAGS_REG))] |
| 13807 |
"TARGET_64BIT |
| 13808 |
&& ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" |
| 13809 |
"@ |
| 13810 |
<logic>{l}\t{%2, %k0|%k0, %2} |
| 13811 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 13812 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 13813 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 13814 |
[(set_attr "type" "alu") |
| 13815 |
(set_attr "isa" "*,apx_ndd,apx_ndd,apx_ndd") |
| 13816 |
(set_attr "mode" "SI")]) |
| 13817 |
|
| 13818 |
(define_insn "*<code>si_1_zext_imm" |
| 13819 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 13820 |
(any_or:DI |
| 13821 |
(zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "%0,rm")) |
| 13822 |
(match_operand:DI 2 "x86_64_zext_immediate_operand" "Z,Z"))) |
| 13823 |
(clobber (reg:CC FLAGS_REG))] |
| 13824 |
"TARGET_64BIT |
| 13825 |
&& ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" |
| 13826 |
"@ |
| 13827 |
<logic>{l}\t{%2, %k0|%k0, %2} |
| 13828 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 13829 |
[(set_attr "type" "alu") |
| 13830 |
(set_attr "isa" "*,apx_ndd") |
| 13831 |
(set_attr "mode" "SI")]) |
| 13832 |
|
| 13833 |
(define_insn "*<code>qi_1<nf_name>" |
| 13834 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r,r,?k") |
| 13835 |
(any_or:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,rm,r,k") |
| 13836 |
(match_operand:QI 2 "general_operand" "qn,m,rn,rn,m,k")))] |
| 13837 |
"ix86_binary_operator_ok (<CODE>, QImode, operands, TARGET_APX_NDD) |
| 13838 |
&& <nf_condition>" |
| 13839 |
"@ |
| 13840 |
<nf_prefix><logic>{b}\t{%2, %0|%0, %2} |
| 13841 |
<nf_prefix><logic>{b}\t{%2, %0|%0, %2} |
| 13842 |
<nf_prefix><logic>{l}\t{%k2, %k0|%k0, %k2} |
| 13843 |
<nf_prefix><logic>{b}\t{%2, %1, %0|%0, %1, %2} |
| 13844 |
<nf_prefix><logic>{b}\t{%2, %1, %0|%0, %1, %2} |
| 13845 |
#" |
| 13846 |
[(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,avx512f") |
| 13847 |
(set_attr "type" "alu,alu,alu,alu,alu,msklog") |
| 13848 |
(set_attr "has_nf" "1") |
| 13849 |
(set (attr "mode") |
| 13850 |
(cond [(eq_attr "alternative" "2") |
| 13851 |
(const_string "SI") |
| 13852 |
(and (eq_attr "alternative" "5") |
| 13853 |
(match_test "!TARGET_AVX512DQ")) |
| 13854 |
(const_string "HI") |
| 13855 |
] |
| 13856 |
(const_string "QI"))) |
| 13857 |
;; Potential partial reg stall on alternative 2. |
| 13858 |
(set (attr "preferred_for_speed") |
| 13859 |
(cond [(eq_attr "alternative" "2") |
| 13860 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 13861 |
(symbol_ref "true")))]) |
| 13862 |
|
| 13863 |
(define_insn_and_split "*notxorqi_1" |
| 13864 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,r,r,?k") |
| 13865 |
(not:QI |
| 13866 |
(xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,rm,r,k") |
| 13867 |
(match_operand:QI 2 "general_operand" "qn,m,rn,rn,m,k")))) |
| 13868 |
(clobber (reg:CC FLAGS_REG))] |
| 13869 |
"ix86_binary_operator_ok (XOR, QImode, operands, TARGET_APX_NDD)" |
| 13870 |
"#" |
| 13871 |
"&& reload_completed" |
| 13872 |
[(parallel |
| 13873 |
[(set (match_dup 0) |
| 13874 |
(xor:QI (match_dup 1) (match_dup 2))) |
| 13875 |
(clobber (reg:CC FLAGS_REG))]) |
| 13876 |
(set (match_dup 0) |
| 13877 |
(not:QI (match_dup 0)))] |
| 13878 |
{ |
| 13879 |
if (mask_reg_operand (operands[0], QImode)) |
| 13880 |
{ |
| 13881 |
emit_insn (gen_kxnorqi (operands[0], operands[1], operands[2])); |
| 13882 |
DONE; |
| 13883 |
} |
| 13884 |
} |
| 13885 |
[(set_attr "isa" "*,*,*,apx_ndd,apx_ndd,avx512f") |
| 13886 |
(set_attr "type" "alu,alu,alu,alu,alu,msklog") |
| 13887 |
(set (attr "mode") |
| 13888 |
(cond [(eq_attr "alternative" "2") |
| 13889 |
(const_string "SI") |
| 13890 |
(and (eq_attr "alternative" "5") |
| 13891 |
(match_test "!TARGET_AVX512DQ")) |
| 13892 |
(const_string "HI") |
| 13893 |
] |
| 13894 |
(const_string "QI"))) |
| 13895 |
;; Potential partial reg stall on alternative 2. |
| 13896 |
(set (attr "preferred_for_speed") |
| 13897 |
(cond [(eq_attr "alternative" "2") |
| 13898 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 13899 |
(symbol_ref "true")))]) |
| 13900 |
|
| 13901 |
;; convert (sign_extend:WIDE (any_logic:NARROW (memory, immediate))) |
| 13902 |
;; to (any_logic:WIDE (sign_extend (memory)), (sign_extend (immediate))). |
| 13903 |
;; This eliminates sign extension after logic operation. |
| 13904 |
|
| 13905 |
(define_split |
| 13906 |
[(set (match_operand:SWI248 0 "register_operand") |
| 13907 |
(sign_extend:SWI248 |
| 13908 |
(any_logic:QI (match_operand:QI 1 "memory_operand") |
| 13909 |
(match_operand:QI 2 "const_int_operand"))))] |
| 13910 |
"" |
| 13911 |
[(set (match_dup 3) (sign_extend:SWI248 (match_dup 1))) |
| 13912 |
(set (match_dup 0) (any_logic:SWI248 (match_dup 3) (match_dup 2)))] |
| 13913 |
"operands[3] = gen_reg_rtx (<MODE>mode);") |
| 13914 |
|
| 13915 |
(define_split |
| 13916 |
[(set (match_operand:SWI48 0 "register_operand") |
| 13917 |
(sign_extend:SWI48 |
| 13918 |
(any_logic:HI (match_operand:HI 1 "memory_operand") |
| 13919 |
(match_operand:HI 2 "const_int_operand"))))] |
| 13920 |
"" |
| 13921 |
[(set (match_dup 3) (sign_extend:SWI48 (match_dup 1))) |
| 13922 |
(set (match_dup 0) (any_logic:SWI48 (match_dup 3) (match_dup 2)))] |
| 13923 |
"operands[3] = gen_reg_rtx (<MODE>mode);") |
| 13924 |
|
| 13925 |
(define_split |
| 13926 |
[(set (match_operand:DI 0 "register_operand") |
| 13927 |
(sign_extend:DI |
| 13928 |
(any_logic:SI (match_operand:SI 1 "memory_operand") |
| 13929 |
(match_operand:SI 2 "const_int_operand"))))] |
| 13930 |
"TARGET_64BIT" |
| 13931 |
[(set (match_dup 3) (sign_extend:DI (match_dup 1))) |
| 13932 |
(set (match_dup 0) (any_logic:DI (match_dup 3) (match_dup 2)))] |
| 13933 |
"operands[3] = gen_reg_rtx (DImode);") |
| 13934 |
|
| 13935 |
(define_insn "*<code><mode>_2" |
| 13936 |
[(set (reg FLAGS_REG) |
| 13937 |
(compare (any_or:SWI |
| 13938 |
(match_operand:SWI 1 "nonimmediate_operand" "%0,0,rm,r") |
| 13939 |
(match_operand:SWI 2 "<general_operand>" "<r><i>,<m>,r<i>,<m>")) |
| 13940 |
(const_int 0))) |
| 13941 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>,r,r") |
| 13942 |
(any_or:SWI (match_dup 1) (match_dup 2)))] |
| 13943 |
"ix86_match_ccmode (insn, CCNOmode) |
| 13944 |
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)" |
| 13945 |
"@ |
| 13946 |
<logic>{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13947 |
<logic>{<imodesuffix>}\t{%2, %0|%0, %2} |
| 13948 |
<logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} |
| 13949 |
<logic>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 13950 |
[(set_attr "type" "alu") |
| 13951 |
(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 13952 |
(set_attr "mode" "<MODE>")]) |
| 13953 |
|
| 13954 |
;; See comment for addsi_1_zext why we do use nonimmediate_operand |
| 13955 |
;; ??? Special case for immediate operand is missing - it is tricky. |
| 13956 |
(define_insn "*<code>si_2_zext" |
| 13957 |
[(set (reg FLAGS_REG) |
| 13958 |
(compare (any_or:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm,r") |
| 13959 |
(match_operand:SI 2 "x86_64_general_operand" "rBMe,re,BM")) |
| 13960 |
(const_int 0))) |
| 13961 |
(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 13962 |
(zero_extend:DI (any_or:SI (match_dup 1) (match_dup 2))))] |
| 13963 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) |
| 13964 |
&& ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" |
| 13965 |
"@ |
| 13966 |
<logic>{l}\t{%2, %k0|%k0, %2} |
| 13967 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2} |
| 13968 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 13969 |
[(set_attr "type" "alu") |
| 13970 |
(set_attr "isa" "*,apx_ndd,apx_ndd") |
| 13971 |
(set_attr "mode" "SI")]) |
| 13972 |
|
| 13973 |
(define_insn "*<code>si_2_zext_imm" |
| 13974 |
[(set (reg FLAGS_REG) |
| 13975 |
(compare (any_or:SI |
| 13976 |
(match_operand:SI 1 "nonimmediate_operand" "%0,rm") |
| 13977 |
(match_operand:SI 2 "x86_64_zext_immediate_operand" "Z,Z")) |
| 13978 |
(const_int 0))) |
| 13979 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 13980 |
(any_or:DI (zero_extend:DI (match_dup 1)) (match_dup 2)))] |
| 13981 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) |
| 13982 |
&& ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" |
| 13983 |
"@ |
| 13984 |
<logic>{l}\t{%2, %k0|%k0, %2} |
| 13985 |
<logic>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 13986 |
[(set_attr "type" "alu") |
| 13987 |
(set_attr "isa" "*,apx_ndd") |
| 13988 |
(set_attr "mode" "SI")]) |
| 13989 |
|
| 13990 |
(define_insn "*<code><mode>_3" |
| 13991 |
[(set (reg FLAGS_REG) |
| 13992 |
(compare (any_or:SWI |
| 13993 |
(match_operand:SWI 1 "nonimmediate_operand" "%0") |
| 13994 |
(match_operand:SWI 2 "<general_operand>" "<g>")) |
| 13995 |
(const_int 0))) |
| 13996 |
(clobber (match_scratch:SWI 0 "=<r>"))] |
| 13997 |
"ix86_match_ccmode (insn, CCNOmode) |
| 13998 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 13999 |
"<logic>{<imodesuffix>}\t{%2, %0|%0, %2}" |
| 14000 |
[(set_attr "type" "alu") |
| 14001 |
(set_attr "mode" "<MODE>")]) |
| 14002 |
|
| 14003 |
;; Convert wide OR instructions with immediate operand to shorter QImode |
| 14004 |
;; equivalents when possible. |
| 14005 |
;; Don't do the splitting with memory operands, since it introduces risk |
| 14006 |
;; of memory mismatch stalls. We may want to do the splitting for optimizing |
| 14007 |
;; for size, but that can (should?) be handled by generic code instead. |
| 14008 |
;; Don't do the splitting for APX NDD as NDD does not support *h registers. |
| 14009 |
(define_split |
| 14010 |
[(set (match_operand:SWI248 0 "QIreg_operand") |
| 14011 |
(any_or:SWI248 (match_operand:SWI248 1 "register_operand") |
| 14012 |
(match_operand:SWI248 2 "const_int_operand"))) |
| 14013 |
(clobber (reg:CC FLAGS_REG))] |
| 14014 |
"reload_completed |
| 14015 |
&& (!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 14016 |
&& !(INTVAL (operands[2]) & ~(255 << 8)) |
| 14017 |
&& !(TARGET_APX_NDD && REGNO (operands[0]) != REGNO (operands[1]))" |
| 14018 |
[(parallel |
| 14019 |
[(set (zero_extract:HI (match_dup 0) |
| 14020 |
(const_int 8) |
| 14021 |
(const_int 8)) |
| 14022 |
(subreg:HI |
| 14023 |
(any_or:QI |
| 14024 |
(subreg:QI |
| 14025 |
(zero_extract:HI (match_dup 1) |
| 14026 |
(const_int 8) |
| 14027 |
(const_int 8)) 0) |
| 14028 |
(match_dup 2)) 0)) |
| 14029 |
(clobber (reg:CC FLAGS_REG))])] |
| 14030 |
{ |
| 14031 |
/* Handle the case where INTVAL (operands[2]) == 0. */ |
| 14032 |
if (operands[2] == const0_rtx) |
| 14033 |
{ |
| 14034 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 14035 |
emit_move_insn (operands[0], operands[1]); |
| 14036 |
else |
| 14037 |
emit_note (NOTE_INSN_DELETED); |
| 14038 |
DONE; |
| 14039 |
} |
| 14040 |
operands[0] = gen_lowpart (HImode, operands[0]); |
| 14041 |
operands[1] = gen_lowpart (HImode, operands[1]); |
| 14042 |
operands[2] = gen_int_mode (INTVAL (operands[2]) >> 8, QImode); |
| 14043 |
}) |
| 14044 |
|
| 14045 |
;; Since OR can be encoded with sign extended immediate, this is only |
| 14046 |
;; profitable when 7th bit is set. |
| 14047 |
(define_split |
| 14048 |
[(set (match_operand:SWI248 0 "any_QIreg_operand") |
| 14049 |
(any_or:SWI248 (match_operand:SWI248 1 "general_operand") |
| 14050 |
(match_operand:SWI248 2 "const_int_operand"))) |
| 14051 |
(clobber (reg:CC FLAGS_REG))] |
| 14052 |
"reload_completed |
| 14053 |
&& (!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 14054 |
&& !(INTVAL (operands[2]) & ~255) |
| 14055 |
&& (INTVAL (operands[2]) & 128) |
| 14056 |
&& !(TARGET_APX_NDD |
| 14057 |
&& !rtx_equal_p (operands[0], operands[1]))" |
| 14058 |
[(parallel [(set (strict_low_part (match_dup 0)) |
| 14059 |
(any_or:QI (match_dup 1) |
| 14060 |
(match_dup 2))) |
| 14061 |
(clobber (reg:CC FLAGS_REG))])] |
| 14062 |
{ |
| 14063 |
operands[0] = gen_lowpart (QImode, operands[0]); |
| 14064 |
operands[1] = gen_lowpart (QImode, operands[1]); |
| 14065 |
operands[2] = gen_int_mode (INTVAL (operands[2]), QImode); |
| 14066 |
}) |
| 14067 |
|
| 14068 |
(define_expand "xorqi_ext_1_cc" |
| 14069 |
[(parallel |
| 14070 |
[(set (reg:CCNO FLAGS_REG) |
| 14071 |
(compare:CCNO |
| 14072 |
(xor:QI |
| 14073 |
(subreg:QI |
| 14074 |
(zero_extract:HI (match_operand:HI 1 "register_operand") |
| 14075 |
(const_int 8) |
| 14076 |
(const_int 8)) 0) |
| 14077 |
(match_operand:QI 2 "const_int_operand")) |
| 14078 |
(const_int 0))) |
| 14079 |
(set (zero_extract:HI (match_operand:HI 0 "register_operand") |
| 14080 |
(const_int 8) |
| 14081 |
(const_int 8)) |
| 14082 |
(subreg:HI |
| 14083 |
(xor:QI |
| 14084 |
(subreg:QI |
| 14085 |
(zero_extract:HI (match_dup 1) |
| 14086 |
(const_int 8) |
| 14087 |
(const_int 8)) 0) |
| 14088 |
(match_dup 2)) 0))])]) |
| 14089 |
|
| 14090 |
;; Peephole2 rega = 0; rega op= regb into rega = regb. |
| 14091 |
(define_peephole2 |
| 14092 |
[(parallel [(set (match_operand:SWI 0 "general_reg_operand") |
| 14093 |
(const_int 0)) |
| 14094 |
(clobber (reg:CC FLAGS_REG))]) |
| 14095 |
(parallel [(set (match_dup 0) |
| 14096 |
(any_or_plus:SWI (match_dup 0) |
| 14097 |
(match_operand:SWI 1 "<general_operand>"))) |
| 14098 |
(clobber (reg:CC FLAGS_REG))])] |
| 14099 |
"!reg_mentioned_p (operands[0], operands[1])" |
| 14100 |
[(set (match_dup 0) (match_dup 1))]) |
| 14101 |
|
| 14102 |
;; Peephole2 dead instruction in rega = 0; rega op= rega. |
| 14103 |
(define_peephole2 |
| 14104 |
[(parallel [(set (match_operand:SWI 0 "general_reg_operand") |
| 14105 |
(const_int 0)) |
| 14106 |
(clobber (reg:CC FLAGS_REG))]) |
| 14107 |
(parallel [(set (match_dup 0) |
| 14108 |
(any_or_plus:SWI (match_dup 0) (match_dup 0))) |
| 14109 |
(clobber (reg:CC FLAGS_REG))])] |
| 14110 |
"" |
| 14111 |
[(parallel [(set (match_dup 0) (const_int 0)) |
| 14112 |
(clobber (reg:CC FLAGS_REG))])]) |
| 14113 |
|
| 14114 |
;; Split DST = (HI<<32)|LO early to minimize register usage. |
| 14115 |
(define_insn_and_split "*concat<mode><dwi>3_1" |
| 14116 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r") |
| 14117 |
(any_or_plus:<DWI> |
| 14118 |
(ashift:<DWI> (match_operand:<DWI> 1 "register_operand" "r,r") |
| 14119 |
(match_operand:QI 2 "const_int_operand")) |
| 14120 |
(zero_extend:<DWI> |
| 14121 |
(match_operand:DWIH 3 "nonimmediate_operand" "r,m"))))] |
| 14122 |
"INTVAL (operands[2]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 14123 |
"#" |
| 14124 |
"&& reload_completed" |
| 14125 |
[(const_int 0)] |
| 14126 |
{ |
| 14127 |
split_double_concat (<DWI>mode, operands[0], operands[3], |
| 14128 |
gen_lowpart (<MODE>mode, operands[1])); |
| 14129 |
DONE; |
| 14130 |
}) |
| 14131 |
|
| 14132 |
(define_insn_and_split "*concat<mode><dwi>3_2" |
| 14133 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r") |
| 14134 |
(any_or_plus:<DWI> |
| 14135 |
(zero_extend:<DWI> |
| 14136 |
(match_operand:DWIH 1 "nonimmediate_operand" "r,m")) |
| 14137 |
(ashift:<DWI> (match_operand:<DWI> 2 "register_operand" "r,r") |
| 14138 |
(match_operand:QI 3 "const_int_operand"))))] |
| 14139 |
"INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 14140 |
"#" |
| 14141 |
"&& reload_completed" |
| 14142 |
[(const_int 0)] |
| 14143 |
{ |
| 14144 |
split_double_concat (<DWI>mode, operands[0], operands[1], |
| 14145 |
gen_lowpart (<MODE>mode, operands[2])); |
| 14146 |
DONE; |
| 14147 |
}) |
| 14148 |
|
| 14149 |
(define_insn_and_split "*concat<mode><dwi>3_3" |
| 14150 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,r,&r,x") |
| 14151 |
(any_or_plus:<DWI> |
| 14152 |
(ashift:<DWI> |
| 14153 |
(any_extend:<DWI> |
| 14154 |
(match_operand:DWIH 1 "nonimmediate_operand" "r,m,r,m,x")) |
| 14155 |
(match_operand:QI 2 "const_int_operand")) |
| 14156 |
(zero_extend:<DWI> |
| 14157 |
(match_operand:DWIH 3 "nonimmediate_operand" "r,r,m,m,0"))))] |
| 14158 |
"INTVAL (operands[2]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 14159 |
"#" |
| 14160 |
"&& reload_completed" |
| 14161 |
[(const_int 0)] |
| 14162 |
{ |
| 14163 |
if (SSE_REG_P (operands[0])) |
| 14164 |
{ |
| 14165 |
rtx tmp = gen_rtx_REG (V2DImode, REGNO (operands[0])); |
| 14166 |
emit_insn (gen_vec_concatv2di (tmp, operands[3], operands[1])); |
| 14167 |
} |
| 14168 |
else |
| 14169 |
split_double_concat (<DWI>mode, operands[0], operands[3], operands[1]); |
| 14170 |
DONE; |
| 14171 |
} |
| 14172 |
[(set_attr "isa" "*,*,*,x64,x64")]) |
| 14173 |
|
| 14174 |
(define_insn_and_split "*concat<mode><dwi>3_4" |
| 14175 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,r,r,&r") |
| 14176 |
(any_or_plus:<DWI> |
| 14177 |
(zero_extend:<DWI> |
| 14178 |
(match_operand:DWIH 1 "nonimmediate_operand" "r,m,r,m")) |
| 14179 |
(ashift:<DWI> |
| 14180 |
(any_extend:<DWI> |
| 14181 |
(match_operand:DWIH 2 "nonimmediate_operand" "r,r,m,m")) |
| 14182 |
(match_operand:QI 3 "const_int_operand"))))] |
| 14183 |
"INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 14184 |
"#" |
| 14185 |
"&& reload_completed" |
| 14186 |
[(const_int 0)] |
| 14187 |
{ |
| 14188 |
split_double_concat (<DWI>mode, operands[0], operands[1], operands[2]); |
| 14189 |
DONE; |
| 14190 |
} |
| 14191 |
[(set_attr "isa" "*,*,*,x64")]) |
| 14192 |
|
| 14193 |
(define_insn_and_split "*concat<half><mode>3_5" |
| 14194 |
[(set (match_operand:DWI 0 "nonimmediate_operand" "=r,o,o") |
| 14195 |
(any_or_plus:DWI |
| 14196 |
(ashift:DWI (match_operand:DWI 1 "register_operand" "r,r,r") |
| 14197 |
(match_operand:QI 2 "const_int_operand")) |
| 14198 |
(match_operand:DWI 3 "const_scalar_int_operand" "n,n,Wd")))] |
| 14199 |
"INTVAL (operands[2]) == <MODE_SIZE> * BITS_PER_UNIT / 2 |
| 14200 |
&& (<MODE>mode == DImode |
| 14201 |
? CONST_INT_P (operands[3]) |
| 14202 |
&& (UINTVAL (operands[3]) & ~GET_MODE_MASK (SImode)) == 0 |
| 14203 |
: CONST_INT_P (operands[3]) |
| 14204 |
? INTVAL (operands[3]) >= 0 |
| 14205 |
: CONST_WIDE_INT_NUNITS (operands[3]) == 2 |
| 14206 |
&& CONST_WIDE_INT_ELT (operands[3], 1) == 0) |
| 14207 |
&& !(CONST_INT_P (operands[3]) |
| 14208 |
? ix86_endbr_immediate_operand (operands[3], VOIDmode) |
| 14209 |
: ix86_endbr_immediate_operand (GEN_INT (CONST_WIDE_INT_ELT (operands[3], |
| 14210 |
0)), |
| 14211 |
VOIDmode))" |
| 14212 |
"#" |
| 14213 |
"&& reload_completed" |
| 14214 |
[(const_int 0)] |
| 14215 |
{ |
| 14216 |
rtx op3 = simplify_subreg (<HALF>mode, operands[3], <MODE>mode, 0); |
| 14217 |
split_double_concat (<MODE>mode, operands[0], op3, |
| 14218 |
gen_lowpart (<HALF>mode, operands[1])); |
| 14219 |
DONE; |
| 14220 |
} |
| 14221 |
[(set_attr "isa" "*,nox64,x64")]) |
| 14222 |
|
| 14223 |
(define_insn_and_split "*concat<mode><dwi>3_6" |
| 14224 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=r,o,o,r") |
| 14225 |
(any_or_plus:<DWI> |
| 14226 |
(ashift:<DWI> |
| 14227 |
(any_extend:<DWI> |
| 14228 |
(match_operand:DWIH 1 "nonimmediate_operand" "r,r,r,m")) |
| 14229 |
(match_operand:QI 2 "const_int_operand")) |
| 14230 |
(match_operand:<DWI> 3 "const_scalar_int_operand" "n,n,Wd,n")))] |
| 14231 |
"INTVAL (operands[2]) == <MODE_SIZE> * BITS_PER_UNIT |
| 14232 |
&& (<DWI>mode == DImode |
| 14233 |
? CONST_INT_P (operands[3]) |
| 14234 |
&& (UINTVAL (operands[3]) & ~GET_MODE_MASK (SImode)) == 0 |
| 14235 |
: CONST_INT_P (operands[3]) |
| 14236 |
? INTVAL (operands[3]) >= 0 |
| 14237 |
: CONST_WIDE_INT_NUNITS (operands[3]) == 2 |
| 14238 |
&& CONST_WIDE_INT_ELT (operands[3], 1) == 0) |
| 14239 |
&& !(CONST_INT_P (operands[3]) |
| 14240 |
? ix86_endbr_immediate_operand (operands[3], VOIDmode) |
| 14241 |
: ix86_endbr_immediate_operand (GEN_INT (CONST_WIDE_INT_ELT (operands[3], |
| 14242 |
0)), |
| 14243 |
VOIDmode))" |
| 14244 |
"#" |
| 14245 |
"&& reload_completed" |
| 14246 |
[(const_int 0)] |
| 14247 |
{ |
| 14248 |
rtx op3 = simplify_subreg (<MODE>mode, operands[3], <DWI>mode, 0); |
| 14249 |
split_double_concat (<DWI>mode, operands[0], op3, operands[1]); |
| 14250 |
DONE; |
| 14251 |
} |
| 14252 |
[(set_attr "isa" "*,nox64,x64,*")]) |
| 14253 |
|
| 14254 |
(define_insn_and_split "*concat<mode><dwi>3_7" |
| 14255 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=r,o,o,r") |
| 14256 |
(any_or_plus:<DWI> |
| 14257 |
(zero_extend:<DWI> |
| 14258 |
(match_operand:DWIH 1 "nonimmediate_operand" "r,r,r,m")) |
| 14259 |
(match_operand:<DWI> 2 "const_scalar_int_operand" "n,n,Wd,n")))] |
| 14260 |
"<DWI>mode == DImode |
| 14261 |
? CONST_INT_P (operands[2]) |
| 14262 |
&& (UINTVAL (operands[2]) & GET_MODE_MASK (SImode)) == 0 |
| 14263 |
&& !ix86_endbr_immediate_operand (operands[2], VOIDmode) |
| 14264 |
: CONST_WIDE_INT_P (operands[2]) |
| 14265 |
&& CONST_WIDE_INT_NUNITS (operands[2]) == 2 |
| 14266 |
&& CONST_WIDE_INT_ELT (operands[2], 0) == 0 |
| 14267 |
&& !ix86_endbr_immediate_operand (GEN_INT (CONST_WIDE_INT_ELT (operands[2], |
| 14268 |
1)), |
| 14269 |
VOIDmode)" |
| 14270 |
"#" |
| 14271 |
"&& reload_completed" |
| 14272 |
[(const_int 0)] |
| 14273 |
{ |
| 14274 |
rtx op2; |
| 14275 |
if (<DWI>mode == DImode) |
| 14276 |
op2 = gen_int_mode (INTVAL (operands[2]) >> 32, <MODE>mode); |
| 14277 |
else |
| 14278 |
op2 = gen_int_mode (CONST_WIDE_INT_ELT (operands[2], 1), <MODE>mode); |
| 14279 |
split_double_concat (<DWI>mode, operands[0], operands[1], op2); |
| 14280 |
DONE; |
| 14281 |
} |
| 14282 |
[(set_attr "isa" "*,nox64,x64,*")]) |
| 14283 |
|
| 14284 |
;; Negation instructions |
| 14285 |
|
| 14286 |
(define_expand "neg<mode>2" |
| 14287 |
[(set (match_operand:SDWIM 0 "nonimmediate_operand") |
| 14288 |
(neg:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand")))] |
| 14289 |
"" |
| 14290 |
{ |
| 14291 |
ix86_expand_unary_operator (NEG, <MODE>mode, operands, TARGET_APX_NDD); |
| 14292 |
DONE; |
| 14293 |
}) |
| 14294 |
|
| 14295 |
(define_insn_and_split "*neg<dwi>2_doubleword" |
| 14296 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r") |
| 14297 |
(neg:<DWI> (match_operand:<DWI> 1 "nonimmediate_operand" "0,ro"))) |
| 14298 |
(clobber (reg:CC FLAGS_REG))] |
| 14299 |
"ix86_unary_operator_ok (NEG, <DWI>mode, operands, TARGET_APX_NDD)" |
| 14300 |
"#" |
| 14301 |
"&& reload_completed" |
| 14302 |
[(parallel |
| 14303 |
[(set (reg:CCC FLAGS_REG) |
| 14304 |
(unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE)) |
| 14305 |
(set (match_dup 0) (neg:DWIH (match_dup 1)))]) |
| 14306 |
(parallel |
| 14307 |
[(set (match_dup 2) |
| 14308 |
(plus:DWIH (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 14309 |
(match_dup 3)) |
| 14310 |
(const_int 0))) |
| 14311 |
(clobber (reg:CC FLAGS_REG))]) |
| 14312 |
(parallel |
| 14313 |
[(set (match_dup 2) |
| 14314 |
(neg:DWIH (match_dup 2))) |
| 14315 |
(clobber (reg:CC FLAGS_REG))])] |
| 14316 |
"split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[2]);" |
| 14317 |
[(set_attr "isa" "*,apx_ndd")]) |
| 14318 |
|
| 14319 |
;; Convert: |
| 14320 |
;; mov %esi, %edx |
| 14321 |
;; negl %eax |
| 14322 |
;; adcl $0, %edx |
| 14323 |
;; negl %edx |
| 14324 |
;; to: |
| 14325 |
;; xorl %edx, %edx |
| 14326 |
;; negl %eax |
| 14327 |
;; sbbl %esi, %edx |
| 14328 |
|
| 14329 |
(define_peephole2 |
| 14330 |
[(set (match_operand:SWI48 0 "general_reg_operand") |
| 14331 |
(match_operand:SWI48 1 "nonimmediate_gr_operand")) |
| 14332 |
(parallel |
| 14333 |
[(set (reg:CCC FLAGS_REG) |
| 14334 |
(unspec:CCC [(match_operand:SWI48 2 "general_reg_operand") |
| 14335 |
(const_int 0)] UNSPEC_CC_NE)) |
| 14336 |
(set (match_dup 2) (neg:SWI48 (match_dup 2)))]) |
| 14337 |
(parallel |
| 14338 |
[(set (match_dup 0) |
| 14339 |
(plus:SWI48 (plus:SWI48 |
| 14340 |
(ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0)) |
| 14341 |
(match_dup 0)) |
| 14342 |
(const_int 0))) |
| 14343 |
(clobber (reg:CC FLAGS_REG))]) |
| 14344 |
(parallel |
| 14345 |
[(set (match_dup 0) |
| 14346 |
(neg:SWI48 (match_dup 0))) |
| 14347 |
(clobber (reg:CC FLAGS_REG))])] |
| 14348 |
"REGNO (operands[0]) != REGNO (operands[2]) |
| 14349 |
&& !reg_mentioned_p (operands[0], operands[1]) |
| 14350 |
&& !reg_mentioned_p (operands[2], operands[1])" |
| 14351 |
[(parallel |
| 14352 |
[(set (reg:CCC FLAGS_REG) |
| 14353 |
(unspec:CCC [(match_dup 2) (const_int 0)] UNSPEC_CC_NE)) |
| 14354 |
(set (match_dup 2) (neg:SWI48 (match_dup 2)))]) |
| 14355 |
(parallel |
| 14356 |
[(set (match_dup 0) |
| 14357 |
(minus:SWI48 (minus:SWI48 |
| 14358 |
(match_dup 0) |
| 14359 |
(ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0))) |
| 14360 |
(match_dup 1))) |
| 14361 |
(clobber (reg:CC FLAGS_REG))])] |
| 14362 |
"ix86_expand_clear (operands[0]);") |
| 14363 |
|
| 14364 |
;; Convert: |
| 14365 |
;; xorl %edx, %edx |
| 14366 |
;; negl %eax |
| 14367 |
;; adcl $0, %edx |
| 14368 |
;; negl %edx |
| 14369 |
;; to: |
| 14370 |
;; negl %eax |
| 14371 |
;; sbbl %edx, %edx // *x86_mov<mode>cc_0_m1 |
| 14372 |
|
| 14373 |
(define_peephole2 |
| 14374 |
[(parallel |
| 14375 |
[(set (match_operand:SWI48 0 "general_reg_operand") (const_int 0)) |
| 14376 |
(clobber (reg:CC FLAGS_REG))]) |
| 14377 |
(parallel |
| 14378 |
[(set (reg:CCC FLAGS_REG) |
| 14379 |
(unspec:CCC [(match_operand:SWI48 1 "general_reg_operand") |
| 14380 |
(const_int 0)] UNSPEC_CC_NE)) |
| 14381 |
(set (match_dup 1) (neg:SWI48 (match_dup 1)))]) |
| 14382 |
(parallel |
| 14383 |
[(set (match_dup 0) |
| 14384 |
(plus:SWI48 (plus:SWI48 |
| 14385 |
(ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0)) |
| 14386 |
(match_dup 0)) |
| 14387 |
(const_int 0))) |
| 14388 |
(clobber (reg:CC FLAGS_REG))]) |
| 14389 |
(parallel |
| 14390 |
[(set (match_dup 0) |
| 14391 |
(neg:SWI48 (match_dup 0))) |
| 14392 |
(clobber (reg:CC FLAGS_REG))])] |
| 14393 |
"REGNO (operands[0]) != REGNO (operands[1])" |
| 14394 |
[(parallel |
| 14395 |
[(set (reg:CCC FLAGS_REG) |
| 14396 |
(unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE)) |
| 14397 |
(set (match_dup 1) (neg:SWI48 (match_dup 1)))]) |
| 14398 |
(parallel |
| 14399 |
[(set (match_dup 0) |
| 14400 |
(if_then_else:SWI48 (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0)) |
| 14401 |
(const_int -1) |
| 14402 |
(const_int 0))) |
| 14403 |
(clobber (reg:CC FLAGS_REG))])]) |
| 14404 |
|
| 14405 |
(define_insn "*neg<mode>_1<nf_name>" |
| 14406 |
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 14407 |
(neg:SWI (match_operand:SWI 1 "nonimmediate_operand" "0,rm")))] |
| 14408 |
"ix86_unary_operator_ok (NEG, <MODE>mode, operands, TARGET_APX_NDD) |
| 14409 |
&& <nf_condition>" |
| 14410 |
"@ |
| 14411 |
<nf_prefix>neg{<imodesuffix>}\t%0 |
| 14412 |
<nf_prefix>neg{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 14413 |
[(set_attr "type" "negnot") |
| 14414 |
(set_attr "isa" "*,apx_ndd") |
| 14415 |
(set_attr "has_nf" "1") |
| 14416 |
(set_attr "mode" "<MODE>")]) |
| 14417 |
|
| 14418 |
(define_insn "*negqi_1_zext<mode><nf_name>" |
| 14419 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 14420 |
(zero_extend:SWI248x |
| 14421 |
(neg:QI (match_operand:QI 1 "nonimmediate_operand" "rm"))))] |
| 14422 |
"TARGET_APX_NDD && <nf_condition>" |
| 14423 |
"<nf_prefix>neg{b}\t{%b1, %b0|%b0, %b1}" |
| 14424 |
[(set_attr "type" "negnot") |
| 14425 |
(set_attr "has_nf" "1") |
| 14426 |
(set_attr "mode" "QI")]) |
| 14427 |
|
| 14428 |
(define_insn "*neghi_1_zext<mode><nf_name>" |
| 14429 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 14430 |
(zero_extend:SWI48x |
| 14431 |
(neg:HI (match_operand:HI 1 "nonimmediate_operand" "rm"))))] |
| 14432 |
"TARGET_APX_NDD && <nf_condition>" |
| 14433 |
"<nf_prefix>neg{w}\t{%w1, %w0|%w0, %w1}" |
| 14434 |
[(set_attr "type" "negnot") |
| 14435 |
(set_attr "has_nf" "1") |
| 14436 |
(set_attr "mode" "HI")]) |
| 14437 |
|
| 14438 |
(define_insn "*negsi_1_zext" |
| 14439 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 14440 |
(zero_extend:DI |
| 14441 |
(neg:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm")))) |
| 14442 |
(clobber (reg:CC FLAGS_REG))] |
| 14443 |
"TARGET_64BIT |
| 14444 |
&& ix86_unary_operator_ok (NEG, SImode, operands, TARGET_APX_NDD)" |
| 14445 |
"@ |
| 14446 |
neg{l}\t%k0 |
| 14447 |
neg{l}\t{%k1, %k0|%k0, %k1}" |
| 14448 |
[(set_attr "type" "negnot") |
| 14449 |
(set_attr "isa" "*,apx_ndd") |
| 14450 |
(set_attr "mode" "SI")]) |
| 14451 |
|
| 14452 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 14453 |
(define_insn_and_split "*neg<mode>_1_slp" |
| 14454 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 14455 |
(neg:SWI12 (match_operand:SWI12 1 "register_operand" "0,!<r>"))) |
| 14456 |
(clobber (reg:CC FLAGS_REG))] |
| 14457 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 14458 |
"@ |
| 14459 |
neg{<imodesuffix>}\t%0 |
| 14460 |
#" |
| 14461 |
"&& reload_completed |
| 14462 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 14463 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 14464 |
(parallel |
| 14465 |
[(set (strict_low_part (match_dup 0)) |
| 14466 |
(neg:SWI12 (match_dup 0))) |
| 14467 |
(clobber (reg:CC FLAGS_REG))])] |
| 14468 |
"" |
| 14469 |
[(set_attr "type" "negnot") |
| 14470 |
(set_attr "mode" "<MODE>")]) |
| 14471 |
|
| 14472 |
(define_insn "*neg<mode>_2" |
| 14473 |
[(set (reg FLAGS_REG) |
| 14474 |
(compare |
| 14475 |
(neg:SWI (match_operand:SWI 1 "nonimmediate_operand" "0,rm")) |
| 14476 |
(const_int 0))) |
| 14477 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 14478 |
(neg:SWI (match_dup 1)))] |
| 14479 |
"ix86_match_ccmode (insn, CCGOCmode) |
| 14480 |
&& ix86_unary_operator_ok (NEG, <MODE>mode, operands, TARGET_APX_NDD)" |
| 14481 |
"@ |
| 14482 |
neg{<imodesuffix>}\t%0 |
| 14483 |
neg{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 14484 |
[(set_attr "type" "negnot") |
| 14485 |
(set_attr "isa" "*,apx_ndd") |
| 14486 |
(set_attr "mode" "<MODE>")]) |
| 14487 |
|
| 14488 |
(define_insn "*negsi_2_zext" |
| 14489 |
[(set (reg FLAGS_REG) |
| 14490 |
(compare |
| 14491 |
(neg:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm")) |
| 14492 |
(const_int 0))) |
| 14493 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 14494 |
(zero_extend:DI |
| 14495 |
(neg:SI (match_dup 1))))] |
| 14496 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode) |
| 14497 |
&& ix86_unary_operator_ok (NEG, SImode, operands, TARGET_APX_NDD)" |
| 14498 |
"@ |
| 14499 |
neg{l}\t%k0 |
| 14500 |
neg{l}\t{%1, %k0|%k0, %1}" |
| 14501 |
[(set_attr "type" "negnot") |
| 14502 |
(set_attr "isa" "*,apx_ndd") |
| 14503 |
(set_attr "mode" "SI")]) |
| 14504 |
|
| 14505 |
(define_insn "*neg<mode>_ccc_1" |
| 14506 |
[(set (reg:CCC FLAGS_REG) |
| 14507 |
(unspec:CCC |
| 14508 |
[(match_operand:SWI 1 "nonimmediate_operand" "0,rm") |
| 14509 |
(const_int 0)] UNSPEC_CC_NE)) |
| 14510 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 14511 |
(neg:SWI (match_dup 1)))] |
| 14512 |
"" |
| 14513 |
"@ |
| 14514 |
neg{<imodesuffix>}\t%0 |
| 14515 |
neg{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 14516 |
[(set_attr "type" "negnot") |
| 14517 |
(set_attr "isa" "*,apx_ndd") |
| 14518 |
(set_attr "mode" "<MODE>")]) |
| 14519 |
|
| 14520 |
(define_insn "*neg<mode>_ccc_2" |
| 14521 |
[(set (reg:CCC FLAGS_REG) |
| 14522 |
(unspec:CCC |
| 14523 |
[(match_operand:SWI 1 "nonimmediate_operand" "0,rm") |
| 14524 |
(const_int 0)] UNSPEC_CC_NE)) |
| 14525 |
(clobber (match_scratch:SWI 0 "=<r>,r"))] |
| 14526 |
"" |
| 14527 |
"@ |
| 14528 |
neg{<imodesuffix>}\t%0 |
| 14529 |
neg{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 14530 |
[(set_attr "type" "negnot") |
| 14531 |
(set_attr "isa" "*,apx_ndd") |
| 14532 |
(set_attr "mode" "<MODE>")]) |
| 14533 |
|
| 14534 |
(define_expand "x86_neg<mode>_ccc" |
| 14535 |
[(parallel |
| 14536 |
[(set (reg:CCC FLAGS_REG) |
| 14537 |
(unspec:CCC [(match_operand:SWI48 1 "register_operand") |
| 14538 |
(const_int 0)] UNSPEC_CC_NE)) |
| 14539 |
(set (match_operand:SWI48 0 "register_operand") |
| 14540 |
(neg:SWI48 (match_dup 1)))])]) |
| 14541 |
|
| 14542 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 14543 |
(define_insn_and_split "*negqi_ext<mode>_1" |
| 14544 |
[(set (zero_extract:SWI248 |
| 14545 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 14546 |
(const_int 8) |
| 14547 |
(const_int 8)) |
| 14548 |
(subreg:SWI248 |
| 14549 |
(neg:QI |
| 14550 |
(subreg:QI |
| 14551 |
(match_operator:SWI248 2 "extract_operator" |
| 14552 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 14553 |
(const_int 8) |
| 14554 |
(const_int 8)]) 0)) 0)) |
| 14555 |
(clobber (reg:CC FLAGS_REG))] |
| 14556 |
"" |
| 14557 |
"@ |
| 14558 |
neg{b}\t%h0 |
| 14559 |
#" |
| 14560 |
"reload_completed |
| 14561 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 14562 |
[(set (zero_extract:SWI248 |
| 14563 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 14564 |
(zero_extract:SWI248 |
| 14565 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 14566 |
(parallel |
| 14567 |
[(set (zero_extract:SWI248 |
| 14568 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 14569 |
(subreg:SWI248 |
| 14570 |
(neg:QI |
| 14571 |
(subreg:QI |
| 14572 |
(match_op_dup 2 |
| 14573 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0)) 0)) |
| 14574 |
(clobber (reg:CC FLAGS_REG))])] |
| 14575 |
"" |
| 14576 |
[(set_attr "type" "negnot") |
| 14577 |
(set_attr "mode" "QI")]) |
| 14578 |
|
| 14579 |
;; Negate with jump on overflow. |
| 14580 |
(define_expand "negv<mode>3" |
| 14581 |
[(parallel [(set (reg:CCO FLAGS_REG) |
| 14582 |
(unspec:CCO |
| 14583 |
[(match_operand:SWI 1 "register_operand") |
| 14584 |
(match_dup 3)] UNSPEC_CC_NE)) |
| 14585 |
(set (match_operand:SWI 0 "register_operand") |
| 14586 |
(neg:SWI (match_dup 1)))]) |
| 14587 |
(set (pc) (if_then_else |
| 14588 |
(eq (reg:CCO FLAGS_REG) (const_int 0)) |
| 14589 |
(label_ref (match_operand 2)) |
| 14590 |
(pc)))] |
| 14591 |
"" |
| 14592 |
{ |
| 14593 |
operands[3] |
| 14594 |
= gen_int_mode (HOST_WIDE_INT_1U << (GET_MODE_BITSIZE (<MODE>mode) - 1), |
| 14595 |
<MODE>mode); |
| 14596 |
}) |
| 14597 |
|
| 14598 |
(define_insn "*negv<mode>3" |
| 14599 |
[(set (reg:CCO FLAGS_REG) |
| 14600 |
(unspec:CCO [(match_operand:SWI 1 "nonimmediate_operand" "0") |
| 14601 |
(match_operand:SWI 2 "const_int_operand")] |
| 14602 |
UNSPEC_CC_NE)) |
| 14603 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m") |
| 14604 |
(neg:SWI (match_dup 1)))] |
| 14605 |
"ix86_unary_operator_ok (NEG, <MODE>mode, operands) |
| 14606 |
&& mode_signbit_p (<MODE>mode, operands[2])" |
| 14607 |
"neg{<imodesuffix>}\t%0" |
| 14608 |
[(set_attr "type" "negnot") |
| 14609 |
(set_attr "mode" "<MODE>")]) |
| 14610 |
|
| 14611 |
;; Optimize *negsi_1 followed by *cmpsi_ccno_1 (PR target/91384) |
| 14612 |
(define_peephole2 |
| 14613 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 14614 |
(match_operand:SWI 1 "general_reg_operand")) |
| 14615 |
(parallel [(set (match_dup 0) (neg:SWI (match_dup 0))) |
| 14616 |
(clobber (reg:CC FLAGS_REG))]) |
| 14617 |
(set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 1) (const_int 0)))] |
| 14618 |
"" |
| 14619 |
[(set (match_dup 0) (match_dup 1)) |
| 14620 |
(parallel [(set (reg:CCZ FLAGS_REG) |
| 14621 |
(compare:CCZ (neg:SWI (match_dup 0)) (const_int 0))) |
| 14622 |
(set (match_dup 0) (neg:SWI (match_dup 0)))])]) |
| 14623 |
|
| 14624 |
;; Special expand pattern to handle integer mode abs |
| 14625 |
|
| 14626 |
(define_expand "abs<mode>2" |
| 14627 |
[(parallel |
| 14628 |
[(set (match_operand:SDWIM 0 "register_operand") |
| 14629 |
(abs:SDWIM |
| 14630 |
(match_operand:SDWIM 1 "general_operand"))) |
| 14631 |
(clobber (reg:CC FLAGS_REG))])] |
| 14632 |
"TARGET_CMOVE |
| 14633 |
&& (<MODE>mode != QImode || !TARGET_PARTIAL_REG_STALL)" |
| 14634 |
{ |
| 14635 |
if (TARGET_EXPAND_ABS) |
| 14636 |
{ |
| 14637 |
machine_mode mode = <MODE>mode; |
| 14638 |
operands[1] = force_reg (mode, operands[1]); |
| 14639 |
|
| 14640 |
/* Generate rtx abs using: |
| 14641 |
abs (x) = (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)) */ |
| 14642 |
|
| 14643 |
rtx shift_amount = gen_int_mode (GET_MODE_PRECISION (mode) - 1, QImode); |
| 14644 |
rtx shift_dst = expand_simple_binop (mode, ASHIFTRT, operands[1], |
| 14645 |
shift_amount, NULL_RTX, |
| 14646 |
0, OPTAB_DIRECT); |
| 14647 |
rtx xor_dst = expand_simple_binop (mode, XOR, shift_dst, operands[1], |
| 14648 |
operands[0], 0, OPTAB_DIRECT); |
| 14649 |
rtx minus_dst = expand_simple_binop (mode, MINUS, xor_dst, shift_dst, |
| 14650 |
operands[0], 0, OPTAB_DIRECT); |
| 14651 |
if (!rtx_equal_p (minus_dst, operands[0])) |
| 14652 |
emit_move_insn (operands[0], minus_dst); |
| 14653 |
DONE; |
| 14654 |
} |
| 14655 |
}) |
| 14656 |
|
| 14657 |
(define_insn_and_split "*abs<dwi>2_doubleword" |
| 14658 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 14659 |
(abs:<DWI> |
| 14660 |
(match_operand:<DWI> 1 "general_operand"))) |
| 14661 |
(clobber (reg:CC FLAGS_REG))] |
| 14662 |
"TARGET_CMOVE |
| 14663 |
&& ix86_pre_reload_split ()" |
| 14664 |
"#" |
| 14665 |
"&& 1" |
| 14666 |
[(parallel |
| 14667 |
[(set (reg:CCC FLAGS_REG) |
| 14668 |
(unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE)) |
| 14669 |
(set (match_dup 2) (neg:DWIH (match_dup 1)))]) |
| 14670 |
(parallel |
| 14671 |
[(set (match_dup 5) |
| 14672 |
(plus:DWIH (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 14673 |
(match_dup 4)) |
| 14674 |
(const_int 0))) |
| 14675 |
(clobber (reg:CC FLAGS_REG))]) |
| 14676 |
(parallel |
| 14677 |
[(set (reg:CCGOC FLAGS_REG) |
| 14678 |
(compare:CCGOC |
| 14679 |
(neg:DWIH (match_dup 5)) |
| 14680 |
(const_int 0))) |
| 14681 |
(set (match_dup 5) |
| 14682 |
(neg:DWIH (match_dup 5)))]) |
| 14683 |
(set (match_dup 0) |
| 14684 |
(if_then_else:DWIH |
| 14685 |
(ge (reg:CCGOC FLAGS_REG) (const_int 0)) |
| 14686 |
(match_dup 2) |
| 14687 |
(match_dup 1))) |
| 14688 |
(set (match_dup 3) |
| 14689 |
(if_then_else:DWIH |
| 14690 |
(ge (reg:CCGOC FLAGS_REG) (const_int 0)) |
| 14691 |
(match_dup 5) |
| 14692 |
(match_dup 4)))] |
| 14693 |
{ |
| 14694 |
operands[1] = force_reg (<DWI>mode, operands[1]); |
| 14695 |
operands[2] = gen_reg_rtx (<DWI>mode); |
| 14696 |
|
| 14697 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 14698 |
}) |
| 14699 |
|
| 14700 |
(define_insn_and_split "*nabs<dwi>2_doubleword" |
| 14701 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 14702 |
(neg:<DWI> |
| 14703 |
(abs:<DWI> |
| 14704 |
(match_operand:<DWI> 1 "general_operand")))) |
| 14705 |
(clobber (reg:CC FLAGS_REG))] |
| 14706 |
"TARGET_CMOVE |
| 14707 |
&& ix86_pre_reload_split ()" |
| 14708 |
"#" |
| 14709 |
"&& 1" |
| 14710 |
[(parallel |
| 14711 |
[(set (reg:CCC FLAGS_REG) |
| 14712 |
(unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE)) |
| 14713 |
(set (match_dup 2) (neg:DWIH (match_dup 1)))]) |
| 14714 |
(parallel |
| 14715 |
[(set (match_dup 5) |
| 14716 |
(plus:DWIH (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) |
| 14717 |
(match_dup 4)) |
| 14718 |
(const_int 0))) |
| 14719 |
(clobber (reg:CC FLAGS_REG))]) |
| 14720 |
(parallel |
| 14721 |
[(set (reg:CCGOC FLAGS_REG) |
| 14722 |
(compare:CCGOC |
| 14723 |
(neg:DWIH (match_dup 5)) |
| 14724 |
(const_int 0))) |
| 14725 |
(set (match_dup 5) |
| 14726 |
(neg:DWIH (match_dup 5)))]) |
| 14727 |
(set (match_dup 0) |
| 14728 |
(if_then_else:DWIH |
| 14729 |
(lt (reg:CCGOC FLAGS_REG) (const_int 0)) |
| 14730 |
(match_dup 2) |
| 14731 |
(match_dup 1))) |
| 14732 |
(set (match_dup 3) |
| 14733 |
(if_then_else:DWIH |
| 14734 |
(lt (reg:CCGOC FLAGS_REG) (const_int 0)) |
| 14735 |
(match_dup 5) |
| 14736 |
(match_dup 4)))] |
| 14737 |
{ |
| 14738 |
operands[1] = force_reg (<DWI>mode, operands[1]); |
| 14739 |
operands[2] = gen_reg_rtx (<DWI>mode); |
| 14740 |
|
| 14741 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 14742 |
}) |
| 14743 |
|
| 14744 |
(define_insn_and_split "*abs<mode>2_1" |
| 14745 |
[(set (match_operand:SWI 0 "register_operand") |
| 14746 |
(abs:SWI |
| 14747 |
(match_operand:SWI 1 "general_operand"))) |
| 14748 |
(clobber (reg:CC FLAGS_REG))] |
| 14749 |
"TARGET_CMOVE |
| 14750 |
&& (<MODE>mode != QImode || !TARGET_PARTIAL_REG_STALL) |
| 14751 |
&& ix86_pre_reload_split ()" |
| 14752 |
"#" |
| 14753 |
"&& 1" |
| 14754 |
[(parallel |
| 14755 |
[(set (reg:CCGOC FLAGS_REG) |
| 14756 |
(compare:CCGOC |
| 14757 |
(neg:SWI (match_dup 1)) |
| 14758 |
(const_int 0))) |
| 14759 |
(set (match_dup 2) |
| 14760 |
(neg:SWI (match_dup 1)))]) |
| 14761 |
(set (match_dup 0) |
| 14762 |
(if_then_else:SWI |
| 14763 |
(ge (reg:CCGOC FLAGS_REG) (const_int 0)) |
| 14764 |
(match_dup 2) |
| 14765 |
(match_dup 1)))] |
| 14766 |
{ |
| 14767 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 14768 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 14769 |
}) |
| 14770 |
|
| 14771 |
(define_insn_and_split "*nabs<mode>2_1" |
| 14772 |
[(set (match_operand:SWI 0 "register_operand") |
| 14773 |
(neg:SWI |
| 14774 |
(abs:SWI |
| 14775 |
(match_operand:SWI 1 "general_operand")))) |
| 14776 |
(clobber (reg:CC FLAGS_REG))] |
| 14777 |
"TARGET_CMOVE |
| 14778 |
&& (<MODE>mode != QImode || !TARGET_PARTIAL_REG_STALL) |
| 14779 |
&& ix86_pre_reload_split ()" |
| 14780 |
"#" |
| 14781 |
"&& 1" |
| 14782 |
[(parallel |
| 14783 |
[(set (reg:CCGOC FLAGS_REG) |
| 14784 |
(compare:CCGOC |
| 14785 |
(neg:SWI (match_dup 1)) |
| 14786 |
(const_int 0))) |
| 14787 |
(set (match_dup 2) |
| 14788 |
(neg:SWI (match_dup 1)))]) |
| 14789 |
(set (match_dup 0) |
| 14790 |
(if_then_else:SWI |
| 14791 |
(lt (reg:CCGOC FLAGS_REG) (const_int 0)) |
| 14792 |
(match_dup 2) |
| 14793 |
(match_dup 1)))] |
| 14794 |
{ |
| 14795 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 14796 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 14797 |
}) |
| 14798 |
|
| 14799 |
(define_expand "<code>tf2" |
| 14800 |
[(set (match_operand:TF 0 "register_operand") |
| 14801 |
(absneg:TF (match_operand:TF 1 "register_operand")))] |
| 14802 |
"TARGET_SSE" |
| 14803 |
"ix86_expand_fp_absneg_operator (<CODE>, TFmode, operands); DONE;") |
| 14804 |
|
| 14805 |
(define_insn_and_split "*<code>tf2_1" |
| 14806 |
[(set (match_operand:TF 0 "register_operand" "=x,x,Yv,Yv") |
| 14807 |
(absneg:TF |
| 14808 |
(match_operand:TF 1 "vector_operand" "0,xBm,Yv,m"))) |
| 14809 |
(use (match_operand:TF 2 "vector_operand" "xBm,0,Yvm,Yv"))] |
| 14810 |
"TARGET_SSE" |
| 14811 |
"#" |
| 14812 |
"&& reload_completed" |
| 14813 |
[(set (match_dup 0) |
| 14814 |
(<absneg_op>:TF (match_dup 1) (match_dup 2)))] |
| 14815 |
{ |
| 14816 |
if (TARGET_AVX) |
| 14817 |
{ |
| 14818 |
if (MEM_P (operands[1])) |
| 14819 |
std::swap (operands[1], operands[2]); |
| 14820 |
} |
| 14821 |
else |
| 14822 |
{ |
| 14823 |
if (operands_match_p (operands[0], operands[2])) |
| 14824 |
std::swap (operands[1], operands[2]); |
| 14825 |
} |
| 14826 |
} |
| 14827 |
[(set_attr "isa" "noavx,noavx,avx,avx")]) |
| 14828 |
|
| 14829 |
(define_insn_and_split "*nabstf2_1" |
| 14830 |
[(set (match_operand:TF 0 "register_operand" "=x,x,Yv,Yv") |
| 14831 |
(neg:TF |
| 14832 |
(abs:TF |
| 14833 |
(match_operand:TF 1 "vector_operand" "0,xBm,Yv,m")))) |
| 14834 |
(use (match_operand:TF 2 "vector_operand" "xBm,0,Yvm,Yv"))] |
| 14835 |
"TARGET_SSE" |
| 14836 |
"#" |
| 14837 |
"&& reload_completed" |
| 14838 |
[(set (match_dup 0) |
| 14839 |
(ior:TF (match_dup 1) (match_dup 2)))] |
| 14840 |
{ |
| 14841 |
if (TARGET_AVX) |
| 14842 |
{ |
| 14843 |
if (MEM_P (operands[1])) |
| 14844 |
std::swap (operands[1], operands[2]); |
| 14845 |
} |
| 14846 |
else |
| 14847 |
{ |
| 14848 |
if (operands_match_p (operands[0], operands[2])) |
| 14849 |
std::swap (operands[1], operands[2]); |
| 14850 |
} |
| 14851 |
} |
| 14852 |
[(set_attr "isa" "noavx,noavx,avx,avx")]) |
| 14853 |
|
| 14854 |
(define_expand "<code>hf2" |
| 14855 |
[(set (match_operand:HF 0 "register_operand") |
| 14856 |
(absneg:HF (match_operand:HF 1 "register_operand")))] |
| 14857 |
"TARGET_AVX512FP16" |
| 14858 |
"ix86_expand_fp_absneg_operator (<CODE>, HFmode, operands); DONE;") |
| 14859 |
|
| 14860 |
(define_expand "<code><mode>2" |
| 14861 |
[(set (match_operand:X87MODEF 0 "register_operand") |
| 14862 |
(absneg:X87MODEF (match_operand:X87MODEF 1 "register_operand")))] |
| 14863 |
"TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 14864 |
"ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;") |
| 14865 |
|
| 14866 |
;; Changing of sign for FP values is doable using integer unit too. |
| 14867 |
(define_insn "*<code><mode>2_i387_1" |
| 14868 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f,!r") |
| 14869 |
(absneg:X87MODEF |
| 14870 |
(match_operand:X87MODEF 1 "register_operand" "0,0"))) |
| 14871 |
(clobber (reg:CC FLAGS_REG))] |
| 14872 |
"TARGET_80387 && !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 14873 |
"#") |
| 14874 |
|
| 14875 |
(define_split |
| 14876 |
[(set (match_operand:X87MODEF 0 "fp_register_operand") |
| 14877 |
(absneg:X87MODEF (match_operand:X87MODEF 1 "fp_register_operand"))) |
| 14878 |
(clobber (reg:CC FLAGS_REG))] |
| 14879 |
"TARGET_80387 && reload_completed" |
| 14880 |
[(set (match_dup 0) (absneg:X87MODEF (match_dup 1)))]) |
| 14881 |
|
| 14882 |
(define_split |
| 14883 |
[(set (match_operand:X87MODEF 0 "general_reg_operand") |
| 14884 |
(absneg:X87MODEF (match_operand:X87MODEF 1 "general_reg_operand"))) |
| 14885 |
(clobber (reg:CC FLAGS_REG))] |
| 14886 |
"TARGET_80387 && reload_completed" |
| 14887 |
[(const_int 0)] |
| 14888 |
"ix86_split_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;") |
| 14889 |
|
| 14890 |
(define_insn_and_split "*<code>hf2_1" |
| 14891 |
[(set (match_operand:HF 0 "register_operand" "=Yv") |
| 14892 |
(absneg:HF |
| 14893 |
(match_operand:HF 1 "register_operand" "Yv"))) |
| 14894 |
(use (match_operand:V8HF 2 "vector_operand" "Yvm")) |
| 14895 |
(clobber (reg:CC FLAGS_REG))] |
| 14896 |
"TARGET_AVX512FP16" |
| 14897 |
"#" |
| 14898 |
"&& reload_completed" |
| 14899 |
[(set (match_dup 0) |
| 14900 |
(<absneg_op>:V8HF (match_dup 1) (match_dup 2)))] |
| 14901 |
{ |
| 14902 |
operands[0] = lowpart_subreg (V8HFmode, operands[0], HFmode); |
| 14903 |
operands[1] = lowpart_subreg (V8HFmode, operands[1], HFmode); |
| 14904 |
}) |
| 14905 |
|
| 14906 |
(define_insn "*<code><mode>2_1" |
| 14907 |
[(set (match_operand:MODEF 0 "register_operand" "=x,x,Yv,f,!r") |
| 14908 |
(absneg:MODEF |
| 14909 |
(match_operand:MODEF 1 "register_operand" "0,x,Yv,0,0"))) |
| 14910 |
(use (match_operand:<ssevecmode> 2 "vector_operand" "xBm,0,Yvm,X,X")) |
| 14911 |
(clobber (reg:CC FLAGS_REG))] |
| 14912 |
"TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 14913 |
"#" |
| 14914 |
[(set_attr "isa" "noavx,noavx,avx,*,*") |
| 14915 |
(set (attr "enabled") |
| 14916 |
(if_then_else |
| 14917 |
(match_test ("SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH")) |
| 14918 |
(if_then_else |
| 14919 |
(eq_attr "alternative" "3,4") |
| 14920 |
(symbol_ref "TARGET_MIX_SSE_I387") |
| 14921 |
(const_string "*")) |
| 14922 |
(if_then_else |
| 14923 |
(eq_attr "alternative" "3,4") |
| 14924 |
(symbol_ref "true") |
| 14925 |
(symbol_ref "false"))))]) |
| 14926 |
|
| 14927 |
(define_split |
| 14928 |
[(set (match_operand:MODEF 0 "sse_reg_operand") |
| 14929 |
(absneg:MODEF |
| 14930 |
(match_operand:MODEF 1 "sse_reg_operand"))) |
| 14931 |
(use (match_operand:<ssevecmodef> 2 "vector_operand")) |
| 14932 |
(clobber (reg:CC FLAGS_REG))] |
| 14933 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 14934 |
&& reload_completed" |
| 14935 |
[(set (match_dup 0) |
| 14936 |
(<absneg_op>:<ssevecmodef> (match_dup 1) (match_dup 2)))] |
| 14937 |
{ |
| 14938 |
machine_mode mode = <MODE>mode; |
| 14939 |
machine_mode vmode = <ssevecmodef>mode; |
| 14940 |
|
| 14941 |
operands[0] = lowpart_subreg (vmode, operands[0], mode); |
| 14942 |
operands[1] = lowpart_subreg (vmode, operands[1], mode); |
| 14943 |
|
| 14944 |
if (!TARGET_AVX && operands_match_p (operands[0], operands[2])) |
| 14945 |
std::swap (operands[1], operands[2]); |
| 14946 |
}) |
| 14947 |
|
| 14948 |
(define_split |
| 14949 |
[(set (match_operand:MODEF 0 "fp_register_operand") |
| 14950 |
(absneg:MODEF (match_operand:MODEF 1 "fp_register_operand"))) |
| 14951 |
(use (match_operand 2)) |
| 14952 |
(clobber (reg:CC FLAGS_REG))] |
| 14953 |
"TARGET_80387 && reload_completed" |
| 14954 |
[(set (match_dup 0) (absneg:MODEF (match_dup 1)))]) |
| 14955 |
|
| 14956 |
(define_split |
| 14957 |
[(set (match_operand:MODEF 0 "general_reg_operand") |
| 14958 |
(absneg:MODEF (match_operand:MODEF 1 "general_reg_operand"))) |
| 14959 |
(use (match_operand 2)) |
| 14960 |
(clobber (reg:CC FLAGS_REG))] |
| 14961 |
"TARGET_80387 && reload_completed" |
| 14962 |
[(const_int 0)] |
| 14963 |
"ix86_split_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;") |
| 14964 |
|
| 14965 |
(define_insn_and_split "*nabs<mode>2_1" |
| 14966 |
[(set (match_operand:MODEF 0 "register_operand" "=x,x,Yv") |
| 14967 |
(neg:MODEF |
| 14968 |
(abs:MODEF |
| 14969 |
(match_operand:MODEF 1 "register_operand" "0,x,Yv")))) |
| 14970 |
(use (match_operand:<ssevecmode> 2 "vector_operand" "xBm,0,Yvm"))] |
| 14971 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH" |
| 14972 |
"#" |
| 14973 |
"&& reload_completed" |
| 14974 |
[(set (match_dup 0) |
| 14975 |
(ior:<ssevecmodef> (match_dup 1) (match_dup 2)))] |
| 14976 |
{ |
| 14977 |
machine_mode mode = <MODE>mode; |
| 14978 |
machine_mode vmode = <ssevecmodef>mode; |
| 14979 |
|
| 14980 |
operands[0] = lowpart_subreg (vmode, operands[0], mode); |
| 14981 |
operands[1] = lowpart_subreg (vmode, operands[1], mode); |
| 14982 |
|
| 14983 |
if (!TARGET_AVX && operands_match_p (operands[0], operands[2])) |
| 14984 |
std::swap (operands[1], operands[2]); |
| 14985 |
} |
| 14986 |
[(set_attr "isa" "noavx,noavx,avx")]) |
| 14987 |
|
| 14988 |
;; Conditionalize these after reload. If they match before reload, we |
| 14989 |
;; lose the clobber and ability to use integer instructions. |
| 14990 |
|
| 14991 |
(define_insn "*<code><mode>2_i387" |
| 14992 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f") |
| 14993 |
(absneg:X87MODEF (match_operand:X87MODEF 1 "register_operand" "0")))] |
| 14994 |
"TARGET_80387 && reload_completed" |
| 14995 |
"<absneg_mnemonic>" |
| 14996 |
[(set_attr "type" "fsgn") |
| 14997 |
(set_attr "mode" "<MODE>")]) |
| 14998 |
|
| 14999 |
;; Copysign instructions |
| 15000 |
|
| 15001 |
(define_expand "copysign<mode>3" |
| 15002 |
[(match_operand:SSEMODEF 0 "register_operand") |
| 15003 |
(match_operand:SSEMODEF 1 "register_operand") |
| 15004 |
(match_operand:SSEMODEF 2 "nonmemory_operand")] |
| 15005 |
"(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 15006 |
|| (TARGET_SSE && (<MODE>mode == TFmode)) |
| 15007 |
|| (TARGET_AVX512FP16 && (<MODE>mode ==HFmode))" |
| 15008 |
"ix86_expand_copysign (operands); DONE;") |
| 15009 |
|
| 15010 |
(define_expand "xorsign<mode>3" |
| 15011 |
[(match_operand:MODEFH 0 "register_operand") |
| 15012 |
(match_operand:MODEFH 1 "register_operand") |
| 15013 |
(match_operand:MODEFH 2 "register_operand")] |
| 15014 |
"(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 15015 |
|| <MODE>mode == HFmode" |
| 15016 |
{ |
| 15017 |
if (rtx_equal_p (operands[1], operands[2])) |
| 15018 |
emit_insn (gen_abs<mode>2 (operands[0], operands[1])); |
| 15019 |
else |
| 15020 |
ix86_expand_xorsign (operands); |
| 15021 |
DONE; |
| 15022 |
}) |
| 15023 |
|
| 15024 |
;; One complement instructions |
| 15025 |
|
| 15026 |
(define_expand "one_cmpl<mode>2" |
| 15027 |
[(set (match_operand:SDWIM 0 "nonimmediate_operand") |
| 15028 |
(not:SDWIM (match_operand:SDWIM 1 "nonimmediate_operand")))] |
| 15029 |
"" |
| 15030 |
{ |
| 15031 |
ix86_expand_unary_operator (NOT, <MODE>mode, operands, TARGET_APX_NDD); |
| 15032 |
DONE; |
| 15033 |
}) |
| 15034 |
|
| 15035 |
(define_insn_and_split "*one_cmpl<dwi>2_doubleword" |
| 15036 |
[(set (match_operand:<DWI> 0 "nonimmediate_operand" "=ro,&r") |
| 15037 |
(not:<DWI> (match_operand:<DWI> 1 "nonimmediate_operand" "0,ro")))] |
| 15038 |
"ix86_unary_operator_ok (NOT, <DWI>mode, operands, TARGET_APX_NDD)" |
| 15039 |
"#" |
| 15040 |
"&& reload_completed" |
| 15041 |
[(set (match_dup 0) |
| 15042 |
(not:DWIH (match_dup 1))) |
| 15043 |
(set (match_dup 2) |
| 15044 |
(not:DWIH (match_dup 3)))] |
| 15045 |
"split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[2]);" |
| 15046 |
[(set_attr "isa" "*,apx_ndd")]) |
| 15047 |
|
| 15048 |
(define_insn "*one_cmpl<mode>2_1" |
| 15049 |
[(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm,r,?k") |
| 15050 |
(not:SWI248 (match_operand:SWI248 1 "nonimmediate_operand" "0,rm,k")))] |
| 15051 |
"ix86_unary_operator_ok (NOT, <MODE>mode, operands, TARGET_APX_NDD)" |
| 15052 |
"@ |
| 15053 |
not{<imodesuffix>}\t%0 |
| 15054 |
not{<imodesuffix>}\t{%1, %0|%0, %1} |
| 15055 |
#" |
| 15056 |
[(set_attr "isa" "*,apx_ndd,<kmov_isa>") |
| 15057 |
(set_attr "type" "negnot,negnot,msklog") |
| 15058 |
(set_attr "mode" "<MODE>")]) |
| 15059 |
|
| 15060 |
(define_insn "*one_cmplqi2_1_zext<mode>" |
| 15061 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 15062 |
(zero_extend:SWI248x |
| 15063 |
(not:QI (match_operand:QI 1 "nonimmediate_operand" "rm"))))] |
| 15064 |
"TARGET_APX_NDD" |
| 15065 |
"not{b}\t{%1, %b0|%b0, %1}" |
| 15066 |
[(set_attr "type" "negnot") |
| 15067 |
(set_attr "mode" "QI")]) |
| 15068 |
|
| 15069 |
(define_insn "*one_cmplhi2_1_zext<mode>" |
| 15070 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 15071 |
(zero_extend:SWI48x |
| 15072 |
(not:HI (match_operand:HI 1 "nonimmediate_operand" "rm"))))] |
| 15073 |
"TARGET_APX_NDD" |
| 15074 |
"not{w}\t{%1, %w0|%w0, %1}" |
| 15075 |
[(set_attr "type" "negnot") |
| 15076 |
(set_attr "mode" "HI")]) |
| 15077 |
|
| 15078 |
(define_insn "*one_cmplsi2_1_zext" |
| 15079 |
[(set (match_operand:DI 0 "register_operand" "=r,r,?k") |
| 15080 |
(zero_extend:DI |
| 15081 |
(not:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm,k"))))] |
| 15082 |
"TARGET_64BIT |
| 15083 |
&& ix86_unary_operator_ok (NOT, SImode, operands, TARGET_APX_NDD)" |
| 15084 |
"@ |
| 15085 |
not{l}\t%k0 |
| 15086 |
not{l}\t{%1, %k0|%k0, %1} |
| 15087 |
#" |
| 15088 |
[(set_attr "isa" "x64,apx_ndd,avx512bw") |
| 15089 |
(set_attr "type" "negnot,negnot,msklog") |
| 15090 |
(set_attr "mode" "SI,SI,SI")]) |
| 15091 |
|
| 15092 |
(define_insn "*one_cmplqi2_1" |
| 15093 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,r,?k") |
| 15094 |
(not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,rm,k")))] |
| 15095 |
"ix86_unary_operator_ok (NOT, QImode, operands, TARGET_APX_NDD)" |
| 15096 |
"@ |
| 15097 |
not{b}\t%0 |
| 15098 |
not{l}\t%k0 |
| 15099 |
not{b}\t{%1, %0|%0, %1} |
| 15100 |
#" |
| 15101 |
[(set_attr "isa" "*,*,apx_ndd,avx512f") |
| 15102 |
(set_attr "type" "negnot,negnot,negnot,msklog") |
| 15103 |
(set (attr "mode") |
| 15104 |
(cond [(eq_attr "alternative" "1") |
| 15105 |
(const_string "SI") |
| 15106 |
(and (eq_attr "alternative" "3") |
| 15107 |
(match_test "!TARGET_AVX512DQ")) |
| 15108 |
(const_string "HI") |
| 15109 |
] |
| 15110 |
(const_string "QI"))) |
| 15111 |
;; Potential partial reg stall on alternative 1. |
| 15112 |
(set (attr "preferred_for_speed") |
| 15113 |
(cond [(eq_attr "alternative" "1") |
| 15114 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 15115 |
(symbol_ref "true")))]) |
| 15116 |
|
| 15117 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 15118 |
(define_insn_and_split "*one_cmpl<mode>_1_slp" |
| 15119 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 15120 |
(not:SWI12 (match_operand:SWI12 1 "register_operand" "0,!<r>")))] |
| 15121 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 15122 |
"@ |
| 15123 |
not{<imodesuffix>}\t%0 |
| 15124 |
#" |
| 15125 |
"&& reload_completed |
| 15126 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 15127 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 15128 |
(set (strict_low_part (match_dup 0)) |
| 15129 |
(not:SWI12 (match_dup 0)))] |
| 15130 |
"" |
| 15131 |
[(set_attr "type" "negnot") |
| 15132 |
(set_attr "mode" "<MODE>")]) |
| 15133 |
|
| 15134 |
(define_insn "*one_cmpl<mode>2_2" |
| 15135 |
[(set (reg FLAGS_REG) |
| 15136 |
(compare (not:SWI (match_operand:SWI 1 "nonimmediate_operand" "0,rm")) |
| 15137 |
(const_int 0))) |
| 15138 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 15139 |
(not:SWI (match_dup 1)))] |
| 15140 |
"ix86_match_ccmode (insn, CCNOmode) |
| 15141 |
&& ix86_unary_operator_ok (NOT, <MODE>mode, operands, TARGET_APX_NDD)" |
| 15142 |
"#" |
| 15143 |
[(set_attr "type" "alu1") |
| 15144 |
(set_attr "isa" "*,apx_ndd") |
| 15145 |
(set_attr "mode" "<MODE>")]) |
| 15146 |
|
| 15147 |
(define_split |
| 15148 |
[(set (match_operand 0 "flags_reg_operand") |
| 15149 |
(match_operator 2 "compare_operator" |
| 15150 |
[(not:SWI (match_operand:SWI 3 "nonimmediate_operand")) |
| 15151 |
(const_int 0)])) |
| 15152 |
(set (match_operand:SWI 1 "nonimmediate_operand") |
| 15153 |
(not:SWI (match_dup 3)))] |
| 15154 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 15155 |
[(parallel [(set (match_dup 0) |
| 15156 |
(match_op_dup 2 [(xor:SWI (match_dup 3) (const_int -1)) |
| 15157 |
(const_int 0)])) |
| 15158 |
(set (match_dup 1) |
| 15159 |
(xor:SWI (match_dup 3) (const_int -1)))])]) |
| 15160 |
|
| 15161 |
(define_insn "*one_cmplsi2_2_zext" |
| 15162 |
[(set (reg FLAGS_REG) |
| 15163 |
(compare (not:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm")) |
| 15164 |
(const_int 0))) |
| 15165 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 15166 |
(zero_extend:DI (not:SI (match_dup 1))))] |
| 15167 |
"TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode) |
| 15168 |
&& ix86_unary_operator_ok (NOT, SImode, operands, TARGET_APX_NDD)" |
| 15169 |
"#" |
| 15170 |
[(set_attr "type" "alu1") |
| 15171 |
(set_attr "isa" "*,apx_ndd") |
| 15172 |
(set_attr "mode" "SI")]) |
| 15173 |
|
| 15174 |
(define_split |
| 15175 |
[(set (match_operand 0 "flags_reg_operand") |
| 15176 |
(match_operator 2 "compare_operator" |
| 15177 |
[(not:SI (match_operand:SI 3 "nonimmediate_operand")) |
| 15178 |
(const_int 0)])) |
| 15179 |
(set (match_operand:DI 1 "register_operand") |
| 15180 |
(zero_extend:DI (not:SI (match_dup 3))))] |
| 15181 |
"ix86_match_ccmode (insn, CCNOmode)" |
| 15182 |
[(parallel [(set (match_dup 0) |
| 15183 |
(match_op_dup 2 [(xor:SI (match_dup 3) (const_int -1)) |
| 15184 |
(const_int 0)])) |
| 15185 |
(set (match_dup 1) |
| 15186 |
(zero_extend:DI (xor:SI (match_dup 3) (const_int -1))))])]) |
| 15187 |
|
| 15188 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 15189 |
(define_insn_and_split "*one_cmplqi_ext<mode>_1" |
| 15190 |
[(set (zero_extract:SWI248 |
| 15191 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 15192 |
(const_int 8) |
| 15193 |
(const_int 8)) |
| 15194 |
(subreg:SWI248 |
| 15195 |
(not:QI |
| 15196 |
(subreg:QI |
| 15197 |
(match_operator:SWI248 2 "extract_operator" |
| 15198 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 15199 |
(const_int 8) |
| 15200 |
(const_int 8)]) 0)) 0))] |
| 15201 |
"" |
| 15202 |
"@ |
| 15203 |
not{b}\t%h0 |
| 15204 |
#" |
| 15205 |
"reload_completed |
| 15206 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 15207 |
[(set (zero_extract:SWI248 |
| 15208 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 15209 |
(zero_extract:SWI248 |
| 15210 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 15211 |
(set (zero_extract:SWI248 |
| 15212 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 15213 |
(subreg:SWI248 |
| 15214 |
(not:QI |
| 15215 |
(subreg:QI |
| 15216 |
(match_op_dup 2 |
| 15217 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0)) 0))] |
| 15218 |
"" |
| 15219 |
[(set_attr "type" "negnot") |
| 15220 |
(set_attr "mode" "QI")]) |
| 15221 |
|
| 15222 |
;; Shift instructions |
| 15223 |
|
| 15224 |
;; DImode shifts are implemented using the i386 "shift double" opcode, |
| 15225 |
;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count |
| 15226 |
;; is variable, then the count is in %cl and the "imm" operand is dropped |
| 15227 |
;; from the assembler input. |
| 15228 |
;; |
| 15229 |
;; This instruction shifts the target reg/mem as usual, but instead of |
| 15230 |
;; shifting in zeros, bits are shifted in from reg operand. If the insn |
| 15231 |
;; is a left shift double, bits are taken from the high order bits of |
| 15232 |
;; reg, else if the insn is a shift right double, bits are taken from the |
| 15233 |
;; low order bits of reg. So if %eax is "1234" and %edx is "5678", |
| 15234 |
;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345". |
| 15235 |
;; |
| 15236 |
;; Since sh[lr]d does not change the `reg' operand, that is done |
| 15237 |
;; separately, making all shifts emit pairs of shift double and normal |
| 15238 |
;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to |
| 15239 |
;; support a 63 bit shift, each shift where the count is in a reg expands |
| 15240 |
;; to a pair of shifts, a branch, a shift by 32 and a label. |
| 15241 |
;; |
| 15242 |
;; If the shift count is a constant, we need never emit more than one |
| 15243 |
;; shift pair, instead using moves and sign extension for counts greater |
| 15244 |
;; than 31. |
| 15245 |
|
| 15246 |
(define_expand "ashl<mode>3" |
| 15247 |
[(set (match_operand:SDWIM 0 "<shift_operand>") |
| 15248 |
(ashift:SDWIM (match_operand:SDWIM 1 "<ashl_input_operand>") |
| 15249 |
(match_operand:QI 2 "nonmemory_operand")))] |
| 15250 |
"" |
| 15251 |
{ |
| 15252 |
ix86_expand_binary_operator (ASHIFT, <MODE>mode, operands, TARGET_APX_NDD); |
| 15253 |
DONE; |
| 15254 |
}) |
| 15255 |
|
| 15256 |
(define_insn_and_split "*ashl<dwi>3_doubleword_mask" |
| 15257 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 15258 |
(ashift:<DWI> |
| 15259 |
(match_operand:<DWI> 1 "register_operand") |
| 15260 |
(subreg:QI |
| 15261 |
(and |
| 15262 |
(match_operand 2 "int248_register_operand" "c") |
| 15263 |
(match_operand 3 "const_int_operand")) 0))) |
| 15264 |
(clobber (reg:CC FLAGS_REG))] |
| 15265 |
"((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) == 0 |
| 15266 |
|| ((INTVAL (operands[3]) & (2 * <MODE_SIZE> * BITS_PER_UNIT - 1)) |
| 15267 |
== (2 * <MODE_SIZE> * BITS_PER_UNIT - 1))) |
| 15268 |
&& ix86_pre_reload_split ()" |
| 15269 |
"#" |
| 15270 |
"&& 1" |
| 15271 |
[(parallel |
| 15272 |
[(set (match_dup 6) |
| 15273 |
(ior:DWIH (ashift:DWIH (match_dup 6) |
| 15274 |
(and:QI (match_dup 2) (match_dup 8))) |
| 15275 |
(subreg:DWIH |
| 15276 |
(lshiftrt:<DWI> (zero_extend:<DWI> (match_dup 5)) |
| 15277 |
(minus:QI (match_dup 9) |
| 15278 |
(and:QI (match_dup 2) (match_dup 8)))) 0))) |
| 15279 |
(clobber (reg:CC FLAGS_REG))]) |
| 15280 |
(parallel |
| 15281 |
[(set (match_dup 4) |
| 15282 |
(ashift:DWIH (match_dup 5) (match_dup 2))) |
| 15283 |
(clobber (reg:CC FLAGS_REG))])] |
| 15284 |
{ |
| 15285 |
if ((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) != 0) |
| 15286 |
{ |
| 15287 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 15288 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 15289 |
emit_insn (gen_ashl<dwi>3_doubleword (operands[0], operands[1], |
| 15290 |
operands[2])); |
| 15291 |
DONE; |
| 15292 |
} |
| 15293 |
|
| 15294 |
split_double_mode (<DWI>mode, &operands[0], 2, &operands[4], &operands[6]); |
| 15295 |
|
| 15296 |
operands[8] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT - 1); |
| 15297 |
operands[9] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT); |
| 15298 |
|
| 15299 |
if ((INTVAL (operands[3]) & ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 15300 |
!= ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 15301 |
{ |
| 15302 |
rtx xops[3]; |
| 15303 |
xops[0] = gen_reg_rtx (GET_MODE (operands[2])); |
| 15304 |
xops[1] = operands[2]; |
| 15305 |
xops[2] = GEN_INT (INTVAL (operands[3]) |
| 15306 |
& ((<MODE_SIZE> * BITS_PER_UNIT) - 1)); |
| 15307 |
ix86_expand_binary_operator (AND, GET_MODE (operands[2]), xops); |
| 15308 |
operands[2] = xops[0]; |
| 15309 |
} |
| 15310 |
|
| 15311 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 15312 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 15313 |
|
| 15314 |
if (!rtx_equal_p (operands[6], operands[7])) |
| 15315 |
emit_move_insn (operands[6], operands[7]); |
| 15316 |
}) |
| 15317 |
|
| 15318 |
(define_insn_and_split "*ashl<dwi>3_doubleword_mask_1" |
| 15319 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 15320 |
(ashift:<DWI> |
| 15321 |
(match_operand:<DWI> 1 "register_operand") |
| 15322 |
(and:QI |
| 15323 |
(match_operand:QI 2 "register_operand" "c") |
| 15324 |
(match_operand:QI 3 "const_int_operand")))) |
| 15325 |
(clobber (reg:CC FLAGS_REG))] |
| 15326 |
"((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) == 0 |
| 15327 |
|| ((INTVAL (operands[3]) & (2 * <MODE_SIZE> * BITS_PER_UNIT - 1)) |
| 15328 |
== (2 * <MODE_SIZE> * BITS_PER_UNIT - 1))) |
| 15329 |
&& ix86_pre_reload_split ()" |
| 15330 |
"#" |
| 15331 |
"&& 1" |
| 15332 |
[(parallel |
| 15333 |
[(set (match_dup 6) |
| 15334 |
(ior:DWIH (ashift:DWIH (match_dup 6) |
| 15335 |
(and:QI (match_dup 2) (match_dup 8))) |
| 15336 |
(subreg:DWIH |
| 15337 |
(lshiftrt:<DWI> (zero_extend:<DWI> (match_dup 5)) |
| 15338 |
(minus:QI (match_dup 9) |
| 15339 |
(and:QI (match_dup 2) (match_dup 8)))) 0))) |
| 15340 |
(clobber (reg:CC FLAGS_REG))]) |
| 15341 |
(parallel |
| 15342 |
[(set (match_dup 4) |
| 15343 |
(ashift:DWIH (match_dup 5) (match_dup 2))) |
| 15344 |
(clobber (reg:CC FLAGS_REG))])] |
| 15345 |
{ |
| 15346 |
if ((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) != 0) |
| 15347 |
{ |
| 15348 |
emit_insn (gen_ashl<dwi>3_doubleword (operands[0], operands[1], |
| 15349 |
operands[2])); |
| 15350 |
DONE; |
| 15351 |
} |
| 15352 |
|
| 15353 |
split_double_mode (<DWI>mode, &operands[0], 2, &operands[4], &operands[6]); |
| 15354 |
|
| 15355 |
operands[8] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT - 1); |
| 15356 |
operands[9] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT); |
| 15357 |
|
| 15358 |
if ((INTVAL (operands[3]) & ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 15359 |
!= ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 15360 |
{ |
| 15361 |
rtx tem = gen_reg_rtx (QImode); |
| 15362 |
emit_insn (gen_andqi3 (tem, operands[2], operands[3])); |
| 15363 |
operands[2] = tem; |
| 15364 |
} |
| 15365 |
|
| 15366 |
if (!rtx_equal_p (operands[6], operands[7])) |
| 15367 |
emit_move_insn (operands[6], operands[7]); |
| 15368 |
}) |
| 15369 |
|
| 15370 |
(define_insn "ashl<mode>3_doubleword" |
| 15371 |
[(set (match_operand:DWI 0 "register_operand" "=&r,&r") |
| 15372 |
(ashift:DWI (match_operand:DWI 1 "reg_or_pm1_operand" "0Wc,r") |
| 15373 |
(match_operand:QI 2 "nonmemory_operand" "<S>c,<S>c"))) |
| 15374 |
(clobber (reg:CC FLAGS_REG))] |
| 15375 |
"" |
| 15376 |
"#" |
| 15377 |
[(set_attr "type" "multi") |
| 15378 |
(set_attr "isa" "*,apx_ndd")]) |
| 15379 |
|
| 15380 |
(define_split |
| 15381 |
[(set (match_operand:DWI 0 "register_operand") |
| 15382 |
(ashift:DWI (match_operand:DWI 1 "nonmemory_operand") |
| 15383 |
(match_operand:QI 2 "nonmemory_operand"))) |
| 15384 |
(clobber (reg:CC FLAGS_REG))] |
| 15385 |
"epilogue_completed" |
| 15386 |
[(const_int 0)] |
| 15387 |
{ |
| 15388 |
if (TARGET_APX_NDD |
| 15389 |
&& !rtx_equal_p (operands[0], operands[1]) |
| 15390 |
&& REG_P (operands[1])) |
| 15391 |
ix86_split_ashl_ndd (operands, NULL_RTX); |
| 15392 |
else |
| 15393 |
ix86_split_ashl (operands, NULL_RTX, <MODE>mode); |
| 15394 |
DONE; |
| 15395 |
}) |
| 15396 |
|
| 15397 |
;; By default we don't ask for a scratch register, because when DWImode |
| 15398 |
;; values are manipulated, registers are already at a premium. But if |
| 15399 |
;; we have one handy, we won't turn it away. |
| 15400 |
|
| 15401 |
(define_peephole2 |
| 15402 |
[(match_scratch:DWIH 3 "r") |
| 15403 |
(parallel [(set (match_operand:<DWI> 0 "register_operand") |
| 15404 |
(ashift:<DWI> |
| 15405 |
(match_operand:<DWI> 1 "nonmemory_operand") |
| 15406 |
(match_operand:QI 2 "nonmemory_operand"))) |
| 15407 |
(clobber (reg:CC FLAGS_REG))]) |
| 15408 |
(match_dup 3)] |
| 15409 |
"TARGET_CMOVE" |
| 15410 |
[(const_int 0)] |
| 15411 |
{ |
| 15412 |
if (TARGET_APX_NDD |
| 15413 |
&& !rtx_equal_p (operands[0], operands[1]) |
| 15414 |
&& (REG_P (operands[1]))) |
| 15415 |
ix86_split_ashl_ndd (operands, operands[3]); |
| 15416 |
else |
| 15417 |
ix86_split_ashl (operands, operands[3], <DWI>mode); |
| 15418 |
DONE; |
| 15419 |
}) |
| 15420 |
|
| 15421 |
(define_insn_and_split "*ashl<dwi>3_doubleword_highpart" |
| 15422 |
[(set (match_operand:<DWI> 0 "register_operand" "=r") |
| 15423 |
(ashift:<DWI> |
| 15424 |
(any_extend:<DWI> (match_operand:DWIH 1 "nonimmediate_operand" "rm")) |
| 15425 |
(match_operand:QI 2 "const_int_operand"))) |
| 15426 |
(clobber (reg:CC FLAGS_REG))] |
| 15427 |
"INTVAL (operands[2]) >= <MODE_SIZE> * BITS_PER_UNIT |
| 15428 |
&& INTVAL (operands[2]) < <MODE_SIZE> * BITS_PER_UNIT * 2" |
| 15429 |
"#" |
| 15430 |
"&& reload_completed" |
| 15431 |
[(const_int 0)] |
| 15432 |
{ |
| 15433 |
split_double_mode (<DWI>mode, &operands[0], 1, &operands[0], &operands[3]); |
| 15434 |
int bits = INTVAL (operands[2]) - (<MODE_SIZE> * BITS_PER_UNIT); |
| 15435 |
bool op_equal_p = rtx_equal_p (operands[3], operands[1]); |
| 15436 |
if (bits == 0) |
| 15437 |
{ |
| 15438 |
if (!op_equal_p) |
| 15439 |
emit_move_insn (operands[3], operands[1]); |
| 15440 |
} |
| 15441 |
else |
| 15442 |
{ |
| 15443 |
if (!op_equal_p && !TARGET_APX_NDD) |
| 15444 |
emit_move_insn (operands[3], operands[1]); |
| 15445 |
rtx op_tmp = TARGET_APX_NDD ? operands[1] : operands[3]; |
| 15446 |
emit_insn (gen_ashl<mode>3 (operands[3], op_tmp, GEN_INT (bits))); |
| 15447 |
} |
| 15448 |
ix86_expand_clear (operands[0]); |
| 15449 |
DONE; |
| 15450 |
}) |
| 15451 |
|
| 15452 |
(define_insn "x86_64_shld<nf_name>" |
| 15453 |
[(set (match_operand:DI 0 "nonimmediate_operand" "+r*m") |
| 15454 |
(ior:DI (ashift:DI (match_dup 0) |
| 15455 |
(and:QI (match_operand:QI 2 "nonmemory_operand" "Jc") |
| 15456 |
(const_int 63))) |
| 15457 |
(subreg:DI |
| 15458 |
(lshiftrt:TI |
| 15459 |
(zero_extend:TI |
| 15460 |
(match_operand:DI 1 "register_operand" "r")) |
| 15461 |
(minus:QI (const_int 64) |
| 15462 |
(and:QI (match_dup 2) (const_int 63)))) 0)))] |
| 15463 |
"TARGET_64BIT && <nf_condition>" |
| 15464 |
"<nf_prefix>shld{q}\t{%2, %1, %0|%0, %1, %2}" |
| 15465 |
[(set_attr "type" "ishift") |
| 15466 |
(set_attr "prefix_0f" "1") |
| 15467 |
(set_attr "has_nf" "1") |
| 15468 |
(set_attr "mode" "DI") |
| 15469 |
(set_attr "athlon_decode" "vector") |
| 15470 |
(set_attr "amdfam10_decode" "vector") |
| 15471 |
(set_attr "bdver1_decode" "vector")]) |
| 15472 |
|
| 15473 |
(define_insn "x86_64_shld_ndd<nf_name>" |
| 15474 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 15475 |
(ior:DI (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "rm") |
| 15476 |
(and:QI (match_operand:QI 3 "nonmemory_operand" "Jc") |
| 15477 |
(const_int 63))) |
| 15478 |
(subreg:DI |
| 15479 |
(lshiftrt:TI |
| 15480 |
(zero_extend:TI |
| 15481 |
(match_operand:DI 2 "register_operand" "r")) |
| 15482 |
(minus:QI (const_int 64) |
| 15483 |
(and:QI (match_dup 3) (const_int 63)))) 0)))] |
| 15484 |
"TARGET_APX_NDD && <nf_condition>" |
| 15485 |
"<nf_prefix>shld{q}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 15486 |
[(set_attr "type" "ishift") |
| 15487 |
(set_attr "has_nf" "1") |
| 15488 |
(set_attr "mode" "DI")]) |
| 15489 |
|
| 15490 |
(define_insn "x86_64_shld_1<nf_name>" |
| 15491 |
[(set (match_operand:DI 0 "nonimmediate_operand" "+r*m") |
| 15492 |
(ior:DI (ashift:DI (match_dup 0) |
| 15493 |
(match_operand:QI 2 "const_0_to_63_operand")) |
| 15494 |
(subreg:DI |
| 15495 |
(lshiftrt:TI |
| 15496 |
(zero_extend:TI |
| 15497 |
(match_operand:DI 1 "register_operand" "r")) |
| 15498 |
(match_operand:QI 3 "const_0_to_255_operand")) 0)))] |
| 15499 |
"TARGET_64BIT |
| 15500 |
&& INTVAL (operands[3]) == 64 - INTVAL (operands[2]) |
| 15501 |
&& <nf_condition>" |
| 15502 |
"<nf_prefix>shld{q}\t{%2, %1, %0|%0, %1, %2}" |
| 15503 |
[(set_attr "type" "ishift") |
| 15504 |
(set_attr "prefix_0f" "1") |
| 15505 |
(set_attr "has_nf" "1") |
| 15506 |
(set_attr "mode" "DI") |
| 15507 |
(set_attr "length_immediate" "1") |
| 15508 |
(set_attr "athlon_decode" "vector") |
| 15509 |
(set_attr "amdfam10_decode" "vector") |
| 15510 |
(set_attr "bdver1_decode" "vector")]) |
| 15511 |
|
| 15512 |
(define_insn "x86_64_shld_ndd_1<nf_name>" |
| 15513 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 15514 |
(ior:DI (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "rm") |
| 15515 |
(match_operand:QI 3 "const_0_to_63_operand")) |
| 15516 |
(subreg:DI |
| 15517 |
(lshiftrt:TI |
| 15518 |
(zero_extend:TI |
| 15519 |
(match_operand:DI 2 "register_operand" "r")) |
| 15520 |
(match_operand:QI 4 "const_0_to_255_operand")) 0)))] |
| 15521 |
"TARGET_APX_NDD |
| 15522 |
&& INTVAL (operands[4]) == 64 - INTVAL (operands[3]) |
| 15523 |
&& <nf_condition>" |
| 15524 |
"<nf_prefix>shld{q}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 15525 |
[(set_attr "type" "ishift") |
| 15526 |
(set_attr "has_nf" "1") |
| 15527 |
(set_attr "mode" "DI") |
| 15528 |
(set_attr "length_immediate" "1")]) |
| 15529 |
|
| 15530 |
(define_insn_and_split "*x86_64_shld_shrd_1_nozext_nf" |
| 15531 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 15532 |
(ior:DI (ashift:DI (match_operand:DI 4 "nonimmediate_operand") |
| 15533 |
(match_operand:QI 2 "const_0_to_63_operand")) |
| 15534 |
(lshiftrt:DI |
| 15535 |
(match_operand:DI 1 "nonimmediate_operand") |
| 15536 |
(match_operand:QI 3 "const_0_to_63_operand"))))] |
| 15537 |
"TARGET_64BIT && TARGET_APX_NF |
| 15538 |
&& INTVAL (operands[3]) == 64 - INTVAL (operands[2]) |
| 15539 |
&& ix86_pre_reload_split ()" |
| 15540 |
"#" |
| 15541 |
"&& 1" |
| 15542 |
[(const_int 0)] |
| 15543 |
{ |
| 15544 |
if (rtx_equal_p (operands[4], operands[0])) |
| 15545 |
{ |
| 15546 |
operands[1] = force_reg (DImode, operands[1]); |
| 15547 |
emit_insn (gen_x86_64_shld_1_nf (operands[0], operands[1], |
| 15548 |
operands[2], operands[3])); |
| 15549 |
} |
| 15550 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 15551 |
{ |
| 15552 |
operands[4] = force_reg (DImode, operands[4]); |
| 15553 |
emit_insn (gen_x86_64_shrd_1_nf (operands[0], operands[4], |
| 15554 |
operands[3], operands[2])); |
| 15555 |
} |
| 15556 |
else if (TARGET_APX_NDD) |
| 15557 |
{ |
| 15558 |
rtx tmp = gen_reg_rtx (DImode); |
| 15559 |
if (MEM_P (operands[4])) |
| 15560 |
{ |
| 15561 |
operands[1] = force_reg (DImode, operands[1]); |
| 15562 |
emit_insn (gen_x86_64_shld_ndd_1_nf (tmp, operands[4], operands[1], |
| 15563 |
operands[2], operands[3])); |
| 15564 |
} |
| 15565 |
else if (MEM_P (operands[1])) |
| 15566 |
emit_insn (gen_x86_64_shrd_ndd_1_nf (tmp, operands[1], operands[4], |
| 15567 |
operands[3], operands[2])); |
| 15568 |
else |
| 15569 |
emit_insn (gen_x86_64_shld_ndd_1_nf (tmp, operands[4], operands[1], |
| 15570 |
operands[2], operands[3])); |
| 15571 |
emit_move_insn (operands[0], tmp); |
| 15572 |
} |
| 15573 |
else |
| 15574 |
{ |
| 15575 |
operands[1] = force_reg (DImode, operands[1]); |
| 15576 |
rtx tmp = gen_reg_rtx (DImode); |
| 15577 |
emit_move_insn (tmp, operands[4]); |
| 15578 |
emit_insn (gen_x86_64_shld_1_nf (tmp, operands[1], |
| 15579 |
operands[2], operands[3])); |
| 15580 |
emit_move_insn (operands[0], tmp); |
| 15581 |
} |
| 15582 |
DONE; |
| 15583 |
}) |
| 15584 |
|
| 15585 |
(define_insn_and_split "*x86_64_shld_shrd_1_nozext" |
| 15586 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 15587 |
(ior:DI (ashift:DI (match_operand:DI 4 "nonimmediate_operand") |
| 15588 |
(match_operand:QI 2 "const_0_to_63_operand")) |
| 15589 |
(lshiftrt:DI |
| 15590 |
(match_operand:DI 1 "nonimmediate_operand") |
| 15591 |
(match_operand:QI 3 "const_0_to_63_operand")))) |
| 15592 |
(clobber (reg:CC FLAGS_REG))] |
| 15593 |
"TARGET_64BIT |
| 15594 |
&& INTVAL (operands[3]) == 64 - INTVAL (operands[2]) |
| 15595 |
&& ix86_pre_reload_split ()" |
| 15596 |
"#" |
| 15597 |
"&& 1" |
| 15598 |
[(const_int 0)] |
| 15599 |
{ |
| 15600 |
if (rtx_equal_p (operands[4], operands[0])) |
| 15601 |
{ |
| 15602 |
operands[1] = force_reg (DImode, operands[1]); |
| 15603 |
emit_insn (gen_x86_64_shld_1 (operands[0], operands[1], operands[2], operands[3])); |
| 15604 |
} |
| 15605 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 15606 |
{ |
| 15607 |
operands[4] = force_reg (DImode, operands[4]); |
| 15608 |
emit_insn (gen_x86_64_shrd_1 (operands[0], operands[4], operands[3], operands[2])); |
| 15609 |
} |
| 15610 |
else if (TARGET_APX_NDD) |
| 15611 |
{ |
| 15612 |
rtx tmp = gen_reg_rtx (DImode); |
| 15613 |
if (MEM_P (operands[4])) |
| 15614 |
{ |
| 15615 |
operands[1] = force_reg (DImode, operands[1]); |
| 15616 |
emit_insn (gen_x86_64_shld_ndd_1 (tmp, operands[4], operands[1], |
| 15617 |
operands[2], operands[3])); |
| 15618 |
} |
| 15619 |
else if (MEM_P (operands[1])) |
| 15620 |
emit_insn (gen_x86_64_shrd_ndd_1 (tmp, operands[1], operands[4], |
| 15621 |
operands[3], operands[2])); |
| 15622 |
else |
| 15623 |
emit_insn (gen_x86_64_shld_ndd_1 (tmp, operands[4], operands[1], |
| 15624 |
operands[2], operands[3])); |
| 15625 |
emit_move_insn (operands[0], tmp); |
| 15626 |
} |
| 15627 |
else |
| 15628 |
{ |
| 15629 |
operands[1] = force_reg (DImode, operands[1]); |
| 15630 |
rtx tmp = gen_reg_rtx (DImode); |
| 15631 |
emit_move_insn (tmp, operands[4]); |
| 15632 |
emit_insn (gen_x86_64_shld_1 (tmp, operands[1], operands[2], operands[3])); |
| 15633 |
emit_move_insn (operands[0], tmp); |
| 15634 |
} |
| 15635 |
DONE; |
| 15636 |
} |
| 15637 |
[(set_attr "has_nf" "1")]) |
| 15638 |
|
| 15639 |
(define_insn_and_split "*x86_64_shld_2" |
| 15640 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 15641 |
(ior:DI (ashift:DI (match_dup 0) |
| 15642 |
(match_operand:QI 2 "nonmemory_operand")) |
| 15643 |
(lshiftrt:DI (match_operand:DI 1 "register_operand") |
| 15644 |
(minus:QI (const_int 64) (match_dup 2))))) |
| 15645 |
(clobber (reg:CC FLAGS_REG))] |
| 15646 |
"TARGET_64BIT && ix86_pre_reload_split ()" |
| 15647 |
"#" |
| 15648 |
"&& 1" |
| 15649 |
[(parallel [(set (match_dup 0) |
| 15650 |
(ior:DI (ashift:DI (match_dup 0) |
| 15651 |
(and:QI (match_dup 2) (const_int 63))) |
| 15652 |
(subreg:DI |
| 15653 |
(lshiftrt:TI |
| 15654 |
(zero_extend:TI (match_dup 1)) |
| 15655 |
(minus:QI (const_int 64) |
| 15656 |
(and:QI (match_dup 2) |
| 15657 |
(const_int 63)))) 0))) |
| 15658 |
(clobber (reg:CC FLAGS_REG))])]) |
| 15659 |
|
| 15660 |
(define_insn_and_split "*x86_64_shld_ndd_2" |
| 15661 |
[(set (match_operand:DI 0 "register_operand") |
| 15662 |
(ior:DI (ashift:DI (match_operand:DI 1 "nonimmediate_operand") |
| 15663 |
(match_operand:QI 3 "nonmemory_operand")) |
| 15664 |
(lshiftrt:DI (match_operand:DI 2 "register_operand") |
| 15665 |
(minus:QI (const_int 64) (match_dup 3))))) |
| 15666 |
(clobber (reg:CC FLAGS_REG))] |
| 15667 |
"TARGET_APX_NDD |
| 15668 |
&& ix86_pre_reload_split ()" |
| 15669 |
"#" |
| 15670 |
"&& 1" |
| 15671 |
[(parallel [(set (match_dup 0) |
| 15672 |
(ior:DI (ashift:DI (match_dup 1) |
| 15673 |
(and:QI (match_dup 3) (const_int 63))) |
| 15674 |
(subreg:DI |
| 15675 |
(lshiftrt:TI |
| 15676 |
(zero_extend:TI (match_dup 2)) |
| 15677 |
(minus:QI (const_int 64) |
| 15678 |
(and:QI (match_dup 3) |
| 15679 |
(const_int 63)))) 0))) |
| 15680 |
(clobber (reg:CC FLAGS_REG))])]) |
| 15681 |
|
| 15682 |
(define_insn "x86_shld<nf_name>" |
| 15683 |
[(set (match_operand:SI 0 "nonimmediate_operand" "+r*m") |
| 15684 |
(ior:SI (ashift:SI (match_dup 0) |
| 15685 |
(and:QI (match_operand:QI 2 "nonmemory_operand" "Ic") |
| 15686 |
(const_int 31))) |
| 15687 |
(subreg:SI |
| 15688 |
(lshiftrt:DI |
| 15689 |
(zero_extend:DI |
| 15690 |
(match_operand:SI 1 "register_operand" "r")) |
| 15691 |
(minus:QI (const_int 32) |
| 15692 |
(and:QI (match_dup 2) (const_int 31)))) 0)))] |
| 15693 |
"<nf_condition>" |
| 15694 |
"<nf_prefix>shld{l}\t{%2, %1, %0|%0, %1, %2}" |
| 15695 |
[(set_attr "type" "ishift") |
| 15696 |
(set_attr "prefix_0f" "1") |
| 15697 |
(set_attr "has_nf" "1") |
| 15698 |
(set_attr "mode" "SI") |
| 15699 |
(set_attr "pent_pair" "np") |
| 15700 |
(set_attr "athlon_decode" "vector") |
| 15701 |
(set_attr "amdfam10_decode" "vector") |
| 15702 |
(set_attr "bdver1_decode" "vector")]) |
| 15703 |
|
| 15704 |
(define_insn "x86_shld_ndd<nf_name>" |
| 15705 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=r") |
| 15706 |
(ior:SI (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 15707 |
(and:QI (match_operand:QI 3 "nonmemory_operand" "Ic") |
| 15708 |
(const_int 31))) |
| 15709 |
(subreg:SI |
| 15710 |
(lshiftrt:DI |
| 15711 |
(zero_extend:DI |
| 15712 |
(match_operand:SI 2 "register_operand" "r")) |
| 15713 |
(minus:QI (const_int 32) |
| 15714 |
(and:QI (match_dup 3) (const_int 31)))) 0)))] |
| 15715 |
"TARGET_APX_NDD && <nf_condition>" |
| 15716 |
"<nf_prefix>shld{l}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 15717 |
[(set_attr "type" "ishift") |
| 15718 |
(set_attr "has_nf" "1") |
| 15719 |
(set_attr "mode" "SI")]) |
| 15720 |
|
| 15721 |
|
| 15722 |
(define_insn "x86_shld_1<nf_name>" |
| 15723 |
[(set (match_operand:SI 0 "nonimmediate_operand" "+r*m") |
| 15724 |
(ior:SI (ashift:SI (match_dup 0) |
| 15725 |
(match_operand:QI 2 "const_0_to_31_operand")) |
| 15726 |
(subreg:SI |
| 15727 |
(lshiftrt:DI |
| 15728 |
(zero_extend:DI |
| 15729 |
(match_operand:SI 1 "register_operand" "r")) |
| 15730 |
(match_operand:QI 3 "const_0_to_63_operand")) 0)))] |
| 15731 |
"INTVAL (operands[3]) == 32 - INTVAL (operands[2]) |
| 15732 |
&& <nf_condition>" |
| 15733 |
"<nf_prefix>shld{l}\t{%2, %1, %0|%0, %1, %2}" |
| 15734 |
[(set_attr "type" "ishift") |
| 15735 |
(set_attr "prefix_0f" "1") |
| 15736 |
(set_attr "length_immediate" "1") |
| 15737 |
(set_attr "has_nf" "1") |
| 15738 |
(set_attr "mode" "SI") |
| 15739 |
(set_attr "pent_pair" "np") |
| 15740 |
(set_attr "athlon_decode" "vector") |
| 15741 |
(set_attr "amdfam10_decode" "vector") |
| 15742 |
(set_attr "bdver1_decode" "vector")]) |
| 15743 |
|
| 15744 |
(define_insn "x86_shld_ndd_1<nf_name>" |
| 15745 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 15746 |
(ior:SI (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 15747 |
(match_operand:QI 3 "const_0_to_31_operand")) |
| 15748 |
(subreg:SI |
| 15749 |
(lshiftrt:DI |
| 15750 |
(zero_extend:DI |
| 15751 |
(match_operand:SI 2 "register_operand" "r")) |
| 15752 |
(match_operand:QI 4 "const_0_to_63_operand")) 0)))] |
| 15753 |
"TARGET_APX_NDD |
| 15754 |
&& INTVAL (operands[4]) == 32 - INTVAL (operands[3]) |
| 15755 |
&& <nf_condition>" |
| 15756 |
"<nf_prefix>shld{l}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 15757 |
[(set_attr "type" "ishift") |
| 15758 |
(set_attr "length_immediate" "1") |
| 15759 |
(set_attr "has_nf" "1") |
| 15760 |
(set_attr "mode" "SI")]) |
| 15761 |
|
| 15762 |
(define_insn_and_split "*x86_shld_shrd_1_nozext_nf" |
| 15763 |
[(set (match_operand:SI 0 "nonimmediate_operand") |
| 15764 |
(ior:SI (ashift:SI (match_operand:SI 4 "nonimmediate_operand") |
| 15765 |
(match_operand:QI 2 "const_0_to_31_operand")) |
| 15766 |
(lshiftrt:SI |
| 15767 |
(match_operand:SI 1 "nonimmediate_operand") |
| 15768 |
(match_operand:QI 3 "const_0_to_31_operand"))))] |
| 15769 |
"TARGET_APX_NF |
| 15770 |
&& INTVAL (operands[3]) == 32 - INTVAL (operands[2]) |
| 15771 |
&& ix86_pre_reload_split ()" |
| 15772 |
"#" |
| 15773 |
"&& 1" |
| 15774 |
[(const_int 0)] |
| 15775 |
{ |
| 15776 |
if (rtx_equal_p (operands[4], operands[0])) |
| 15777 |
{ |
| 15778 |
operands[1] = force_reg (SImode, operands[1]); |
| 15779 |
emit_insn (gen_x86_shld_1_nf (operands[0], operands[1], |
| 15780 |
operands[2], operands[3])); |
| 15781 |
} |
| 15782 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 15783 |
{ |
| 15784 |
operands[4] = force_reg (SImode, operands[4]); |
| 15785 |
emit_insn (gen_x86_shrd_1_nf (operands[0], operands[4], |
| 15786 |
operands[3], operands[2])); |
| 15787 |
} |
| 15788 |
else if (TARGET_APX_NDD) |
| 15789 |
{ |
| 15790 |
rtx tmp = gen_reg_rtx (SImode); |
| 15791 |
if (MEM_P (operands[4])) |
| 15792 |
{ |
| 15793 |
operands[1] = force_reg (SImode, operands[1]); |
| 15794 |
emit_insn (gen_x86_shld_ndd_1_nf (tmp, operands[4], operands[1], |
| 15795 |
operands[2], operands[3])); |
| 15796 |
} |
| 15797 |
else if (MEM_P (operands[1])) |
| 15798 |
emit_insn (gen_x86_shrd_ndd_1_nf (tmp, operands[1], operands[4], |
| 15799 |
operands[3], operands[2])); |
| 15800 |
else |
| 15801 |
emit_insn (gen_x86_shld_ndd_1_nf (tmp, operands[4], operands[1], |
| 15802 |
operands[2], operands[3])); |
| 15803 |
emit_move_insn (operands[0], tmp); |
| 15804 |
} |
| 15805 |
else |
| 15806 |
{ |
| 15807 |
operands[1] = force_reg (SImode, operands[1]); |
| 15808 |
rtx tmp = gen_reg_rtx (SImode); |
| 15809 |
emit_move_insn (tmp, operands[4]); |
| 15810 |
emit_insn (gen_x86_shld_1_nf (tmp, operands[1], operands[2], |
| 15811 |
operands[3])); |
| 15812 |
emit_move_insn (operands[0], tmp); |
| 15813 |
} |
| 15814 |
DONE; |
| 15815 |
}) |
| 15816 |
|
| 15817 |
(define_insn_and_split "*x86_shld_shrd_1_nozext" |
| 15818 |
[(set (match_operand:SI 0 "nonimmediate_operand") |
| 15819 |
(ior:SI (ashift:SI (match_operand:SI 4 "nonimmediate_operand") |
| 15820 |
(match_operand:QI 2 "const_0_to_31_operand")) |
| 15821 |
(lshiftrt:SI |
| 15822 |
(match_operand:SI 1 "nonimmediate_operand") |
| 15823 |
(match_operand:QI 3 "const_0_to_31_operand")))) |
| 15824 |
(clobber (reg:CC FLAGS_REG))] |
| 15825 |
"INTVAL (operands[3]) == 32 - INTVAL (operands[2]) |
| 15826 |
&& ix86_pre_reload_split ()" |
| 15827 |
"#" |
| 15828 |
"&& 1" |
| 15829 |
[(const_int 0)] |
| 15830 |
{ |
| 15831 |
if (rtx_equal_p (operands[4], operands[0])) |
| 15832 |
{ |
| 15833 |
operands[1] = force_reg (SImode, operands[1]); |
| 15834 |
emit_insn (gen_x86_shld_1 (operands[0], operands[1], operands[2], operands[3])); |
| 15835 |
} |
| 15836 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 15837 |
{ |
| 15838 |
operands[4] = force_reg (SImode, operands[4]); |
| 15839 |
emit_insn (gen_x86_shrd_1 (operands[0], operands[4], operands[3], operands[2])); |
| 15840 |
} |
| 15841 |
else if (TARGET_APX_NDD) |
| 15842 |
{ |
| 15843 |
rtx tmp = gen_reg_rtx (SImode); |
| 15844 |
if (MEM_P (operands[4])) |
| 15845 |
{ |
| 15846 |
operands[1] = force_reg (SImode, operands[1]); |
| 15847 |
emit_insn (gen_x86_shld_ndd_1 (tmp, operands[4], operands[1], |
| 15848 |
operands[2], operands[3])); |
| 15849 |
} |
| 15850 |
else if (MEM_P (operands[1])) |
| 15851 |
emit_insn (gen_x86_shrd_ndd_1 (tmp, operands[1], operands[4], |
| 15852 |
operands[3], operands[2])); |
| 15853 |
else |
| 15854 |
emit_insn (gen_x86_shld_ndd_1 (tmp, operands[4], operands[1], |
| 15855 |
operands[2], operands[3])); |
| 15856 |
emit_move_insn (operands[0], tmp); |
| 15857 |
} |
| 15858 |
else |
| 15859 |
{ |
| 15860 |
operands[1] = force_reg (SImode, operands[1]); |
| 15861 |
rtx tmp = gen_reg_rtx (SImode); |
| 15862 |
emit_move_insn (tmp, operands[4]); |
| 15863 |
emit_insn (gen_x86_shld_1 (tmp, operands[1], operands[2], operands[3])); |
| 15864 |
emit_move_insn (operands[0], tmp); |
| 15865 |
} |
| 15866 |
DONE; |
| 15867 |
} |
| 15868 |
[(set_attr "has_nf" "1")]) |
| 15869 |
|
| 15870 |
(define_insn_and_split "*x86_shld_2" |
| 15871 |
[(set (match_operand:SI 0 "nonimmediate_operand") |
| 15872 |
(ior:SI (ashift:SI (match_dup 0) |
| 15873 |
(match_operand:QI 2 "nonmemory_operand")) |
| 15874 |
(lshiftrt:SI (match_operand:SI 1 "register_operand") |
| 15875 |
(minus:QI (const_int 32) (match_dup 2))))) |
| 15876 |
(clobber (reg:CC FLAGS_REG))] |
| 15877 |
"TARGET_64BIT && ix86_pre_reload_split ()" |
| 15878 |
"#" |
| 15879 |
"&& 1" |
| 15880 |
[(parallel [(set (match_dup 0) |
| 15881 |
(ior:SI (ashift:SI (match_dup 0) |
| 15882 |
(and:QI (match_dup 2) (const_int 31))) |
| 15883 |
(subreg:SI |
| 15884 |
(lshiftrt:DI |
| 15885 |
(zero_extend:DI (match_dup 1)) |
| 15886 |
(minus:QI (const_int 32) |
| 15887 |
(and:QI (match_dup 2) |
| 15888 |
(const_int 31)))) 0))) |
| 15889 |
(clobber (reg:CC FLAGS_REG))])]) |
| 15890 |
|
| 15891 |
(define_insn_and_split "*x86_shld_ndd_2" |
| 15892 |
[(set (match_operand:SI 0 "register_operand") |
| 15893 |
(ior:SI (ashift:SI (match_operand:SI 1 "nonimmediate_operand") |
| 15894 |
(match_operand:QI 3 "nonmemory_operand")) |
| 15895 |
(lshiftrt:SI (match_operand:SI 2 "register_operand") |
| 15896 |
(minus:QI (const_int 32) (match_dup 3))))) |
| 15897 |
(clobber (reg:CC FLAGS_REG))] |
| 15898 |
"TARGET_APX_NDD |
| 15899 |
&& ix86_pre_reload_split ()" |
| 15900 |
"#" |
| 15901 |
"&& 1" |
| 15902 |
[(parallel [(set (match_dup 0) |
| 15903 |
(ior:SI (ashift:SI (match_dup 1) |
| 15904 |
(and:QI (match_dup 3) (const_int 31))) |
| 15905 |
(subreg:SI |
| 15906 |
(lshiftrt:DI |
| 15907 |
(zero_extend:DI (match_dup 2)) |
| 15908 |
(minus:QI (const_int 32) |
| 15909 |
(and:QI (match_dup 3) |
| 15910 |
(const_int 31)))) 0))) |
| 15911 |
(clobber (reg:CC FLAGS_REG))])]) |
| 15912 |
|
| 15913 |
(define_expand "@x86_shift<mode>_adj_1" |
| 15914 |
[(set (reg:CCZ FLAGS_REG) |
| 15915 |
(compare:CCZ (and:QI (match_operand:QI 2 "register_operand") |
| 15916 |
(match_dup 4)) |
| 15917 |
(const_int 0))) |
| 15918 |
(set (match_operand:SWI48 0 "register_operand") |
| 15919 |
(if_then_else:SWI48 (ne (reg:CCZ FLAGS_REG) (const_int 0)) |
| 15920 |
(match_operand:SWI48 1 "register_operand") |
| 15921 |
(match_dup 0))) |
| 15922 |
(set (match_dup 1) |
| 15923 |
(if_then_else:SWI48 (ne (reg:CCZ FLAGS_REG) (const_int 0)) |
| 15924 |
(match_operand:SWI48 3 "register_operand") |
| 15925 |
(match_dup 1)))] |
| 15926 |
"TARGET_CMOVE" |
| 15927 |
"operands[4] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));") |
| 15928 |
|
| 15929 |
(define_expand "@x86_shift<mode>_adj_2" |
| 15930 |
[(use (match_operand:SWI48 0 "register_operand")) |
| 15931 |
(use (match_operand:SWI48 1 "register_operand")) |
| 15932 |
(use (match_operand:QI 2 "register_operand"))] |
| 15933 |
"" |
| 15934 |
{ |
| 15935 |
rtx_code_label *label = gen_label_rtx (); |
| 15936 |
rtx tmp; |
| 15937 |
|
| 15938 |
emit_insn (gen_testqi_ccz_1 (operands[2], |
| 15939 |
GEN_INT (GET_MODE_BITSIZE (<MODE>mode)))); |
| 15940 |
|
| 15941 |
tmp = gen_rtx_REG (CCZmode, FLAGS_REG); |
| 15942 |
tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx); |
| 15943 |
tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, |
| 15944 |
gen_rtx_LABEL_REF (VOIDmode, label), |
| 15945 |
pc_rtx); |
| 15946 |
tmp = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); |
| 15947 |
JUMP_LABEL (tmp) = label; |
| 15948 |
|
| 15949 |
emit_move_insn (operands[0], operands[1]); |
| 15950 |
ix86_expand_clear (operands[1]); |
| 15951 |
|
| 15952 |
emit_label (label); |
| 15953 |
LABEL_NUSES (label) = 1; |
| 15954 |
|
| 15955 |
DONE; |
| 15956 |
}) |
| 15957 |
|
| 15958 |
(define_insn "*bmi2_ashl<mode>3_1" |
| 15959 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 15960 |
(ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 15961 |
(match_operand:SWI48 2 "register_operand" "r")))] |
| 15962 |
"TARGET_BMI2" |
| 15963 |
"shlx\t{%2, %1, %0|%0, %1, %2}" |
| 15964 |
[(set_attr "type" "ishiftx") |
| 15965 |
(set_attr "mode" "<MODE>")]) |
| 15966 |
|
| 15967 |
(define_insn "*ashl<mode>3_1<nf_name>" |
| 15968 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,?k,r") |
| 15969 |
(ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0,l,rm,k,rm") |
| 15970 |
(match_operand:QI 2 "nonmemory_operand" "c<S>,M,r,<KS>,c<S>")))] |
| 15971 |
"ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands, TARGET_APX_NDD) |
| 15972 |
&& <nf_condition>" |
| 15973 |
{ |
| 15974 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 15975 |
switch (get_attr_type (insn)) |
| 15976 |
{ |
| 15977 |
case TYPE_LEA: |
| 15978 |
if (TARGET_APX_NDD && <nf_applied>) |
| 15979 |
return "%{nf%} sal{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}"; |
| 15980 |
else |
| 15981 |
return "#"; |
| 15982 |
|
| 15983 |
case TYPE_ISHIFTX: |
| 15984 |
case TYPE_MSKLOG: |
| 15985 |
return "#"; |
| 15986 |
|
| 15987 |
case TYPE_ALU: |
| 15988 |
gcc_assert (operands[2] == const1_rtx); |
| 15989 |
gcc_assert (rtx_equal_p (operands[0], operands[1])); |
| 15990 |
return "<nf_prefix>add{<imodesuffix>}\t%0, %0"; |
| 15991 |
|
| 15992 |
default: |
| 15993 |
if (operands[2] == const1_rtx |
| 15994 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 15995 |
/* For NDD form instructions related to TARGET_SHIFT1, the $1 |
| 15996 |
immediate do not need to be omitted as assembler will map it |
| 15997 |
to use shorter encoding. */ |
| 15998 |
&& !use_ndd && !<nf_applied>) |
| 15999 |
return "sal{<imodesuffix>}\t%0"; |
| 16000 |
else |
| 16001 |
return use_ndd ? "<nf_prefix>sal{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 16002 |
: "<nf_prefix>sal{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 16003 |
} |
| 16004 |
} |
| 16005 |
[(set_attr "isa" "*,*,bmi2,avx512bw,apx_ndd") |
| 16006 |
(set (attr "type") |
| 16007 |
(cond [(eq_attr "alternative" "1") |
| 16008 |
(const_string "lea") |
| 16009 |
(eq_attr "alternative" "2") |
| 16010 |
(const_string "ishiftx") |
| 16011 |
(eq_attr "alternative" "4") |
| 16012 |
(const_string "ishift") |
| 16013 |
(and (and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16014 |
(match_operand 0 "register_operand")) |
| 16015 |
(match_operand 2 "const1_operand")) |
| 16016 |
(const_string "alu") |
| 16017 |
(eq_attr "alternative" "3") |
| 16018 |
(const_string "msklog") |
| 16019 |
] |
| 16020 |
(const_string "ishift"))) |
| 16021 |
(set (attr "length_immediate") |
| 16022 |
(if_then_else |
| 16023 |
(ior (eq_attr "type" "alu") |
| 16024 |
(and (eq_attr "type" "ishift") |
| 16025 |
(and (match_operand 2 "const1_operand") |
| 16026 |
(ior (match_test "TARGET_SHIFT1") |
| 16027 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16028 |
(const_string "0") |
| 16029 |
(const_string "*"))) |
| 16030 |
(set_attr "has_nf" "1") |
| 16031 |
(set_attr "mode" "<MODE>")]) |
| 16032 |
|
| 16033 |
;; Convert shift to the shiftx pattern to avoid flags dependency. |
| 16034 |
;; For NF/NDD doesn't support shift count as r, it just support c<S>, |
| 16035 |
;; and it has no flag. |
| 16036 |
(define_split |
| 16037 |
[(set (match_operand:SWI48 0 "register_operand") |
| 16038 |
(ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 16039 |
(match_operand:QI 2 "register_operand")))] |
| 16040 |
"TARGET_BMI2 && reload_completed" |
| 16041 |
[(set (match_dup 0) |
| 16042 |
(ashift:SWI48 (match_dup 1) (match_dup 2)))] |
| 16043 |
"operands[2] = gen_lowpart (<MODE>mode, operands[2]);") |
| 16044 |
|
| 16045 |
(define_split |
| 16046 |
[(set (match_operand:SWI48 0 "register_operand") |
| 16047 |
(ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 16048 |
(match_operand:QI 2 "register_operand"))) |
| 16049 |
(clobber (reg:CC FLAGS_REG))] |
| 16050 |
"TARGET_BMI2 && reload_completed" |
| 16051 |
[(set (match_dup 0) |
| 16052 |
(ashift:SWI48 (match_dup 1) (match_dup 2)))] |
| 16053 |
"operands[2] = gen_lowpart (<MODE>mode, operands[2]);") |
| 16054 |
|
| 16055 |
(define_insn "*bmi2_ashlsi3_1_zext" |
| 16056 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 16057 |
(zero_extend:DI |
| 16058 |
(ashift:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 16059 |
(match_operand:SI 2 "register_operand" "r"))))] |
| 16060 |
"TARGET_64BIT && TARGET_BMI2" |
| 16061 |
"shlx\t{%2, %1, %k0|%k0, %1, %2}" |
| 16062 |
[(set_attr "type" "ishiftx") |
| 16063 |
(set_attr "mode" "SI")]) |
| 16064 |
|
| 16065 |
(define_insn "*ashlqi3_1_zext<mode><nf_name>" |
| 16066 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 16067 |
(zero_extend:SWI248x |
| 16068 |
(ashift:QI (match_operand:QI 1 "nonimmediate_operand" "rm") |
| 16069 |
(match_operand:QI 2 "nonmemory_operand" "cI"))))] |
| 16070 |
"TARGET_APX_NDD && <nf_condition>" |
| 16071 |
"<nf_prefix>sal{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 16072 |
[(set_attr "type" "ishiftx") |
| 16073 |
(set_attr "has_nf" "1") |
| 16074 |
(set_attr "mode" "QI")]) |
| 16075 |
|
| 16076 |
(define_insn "*ashlhi3_1_zext<mode><nf_name>" |
| 16077 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 16078 |
(zero_extend:SWI48x |
| 16079 |
(ashift:HI (match_operand:HI 1 "nonimmediate_operand" "rm") |
| 16080 |
(match_operand:QI 2 "nonmemory_operand" "cI"))))] |
| 16081 |
"TARGET_APX_NDD && <nf_condition>" |
| 16082 |
"<nf_prefix>sal{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 16083 |
[(set_attr "type" "ishiftx") |
| 16084 |
(set_attr "has_nf" "1") |
| 16085 |
(set_attr "mode" "HI")]) |
| 16086 |
|
| 16087 |
(define_insn "*ashlsi3_1_zext" |
| 16088 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 16089 |
(zero_extend:DI |
| 16090 |
(ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,l,rm,rm") |
| 16091 |
(match_operand:QI 2 "nonmemory_operand" "cI,M,r,cI")))) |
| 16092 |
(clobber (reg:CC FLAGS_REG))] |
| 16093 |
"TARGET_64BIT |
| 16094 |
&& ix86_binary_operator_ok (ASHIFT, SImode, operands, TARGET_APX_NDD)" |
| 16095 |
{ |
| 16096 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 16097 |
switch (get_attr_type (insn)) |
| 16098 |
{ |
| 16099 |
case TYPE_LEA: |
| 16100 |
case TYPE_ISHIFTX: |
| 16101 |
return "#"; |
| 16102 |
|
| 16103 |
case TYPE_ALU: |
| 16104 |
gcc_assert (operands[2] == const1_rtx); |
| 16105 |
return "add{l}\t%k0, %k0"; |
| 16106 |
|
| 16107 |
default: |
| 16108 |
if (operands[2] == const1_rtx |
| 16109 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 16110 |
&& !use_ndd) |
| 16111 |
return "sal{l}\t%k0"; |
| 16112 |
else |
| 16113 |
return use_ndd ? "sal{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 16114 |
: "sal{l}\t{%2, %k0|%k0, %2}"; |
| 16115 |
} |
| 16116 |
} |
| 16117 |
[(set_attr "isa" "*,*,bmi2,apx_ndd") |
| 16118 |
(set (attr "type") |
| 16119 |
(cond [(eq_attr "alternative" "1") |
| 16120 |
(const_string "lea") |
| 16121 |
(eq_attr "alternative" "2") |
| 16122 |
(const_string "ishiftx") |
| 16123 |
(eq_attr "alternative" "3") |
| 16124 |
(const_string "ishift") |
| 16125 |
(and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16126 |
(match_operand 2 "const1_operand")) |
| 16127 |
(const_string "alu") |
| 16128 |
] |
| 16129 |
(const_string "ishift"))) |
| 16130 |
(set (attr "length_immediate") |
| 16131 |
(if_then_else |
| 16132 |
(ior (eq_attr "type" "alu") |
| 16133 |
(and (eq_attr "type" "ishift") |
| 16134 |
(and (match_operand 2 "const1_operand") |
| 16135 |
(ior (match_test "TARGET_SHIFT1") |
| 16136 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16137 |
(const_string "0") |
| 16138 |
(const_string "*"))) |
| 16139 |
(set_attr "mode" "SI")]) |
| 16140 |
|
| 16141 |
;; Convert shift to the shiftx pattern to avoid flags dependency. |
| 16142 |
(define_split |
| 16143 |
[(set (match_operand:DI 0 "register_operand") |
| 16144 |
(zero_extend:DI |
| 16145 |
(ashift:SI (match_operand:SI 1 "nonimmediate_operand") |
| 16146 |
(match_operand:QI 2 "register_operand")))) |
| 16147 |
(clobber (reg:CC FLAGS_REG))] |
| 16148 |
"TARGET_64BIT && TARGET_BMI2 && reload_completed" |
| 16149 |
[(set (match_dup 0) |
| 16150 |
(zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))] |
| 16151 |
"operands[2] = gen_lowpart (SImode, operands[2]);") |
| 16152 |
|
| 16153 |
(define_insn "*ashlhi3_1<nf_name>" |
| 16154 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=rm,Yp,?k,r") |
| 16155 |
(ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,l,k,rm") |
| 16156 |
(match_operand:QI 2 "nonmemory_operand" "cI,M,Ww,cI")))] |
| 16157 |
"ix86_binary_operator_ok (ASHIFT, HImode, operands, TARGET_APX_NDD) |
| 16158 |
&& <nf_condition>" |
| 16159 |
{ |
| 16160 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 16161 |
switch (get_attr_type (insn)) |
| 16162 |
{ |
| 16163 |
case TYPE_LEA: |
| 16164 |
if (TARGET_APX_NDD && <nf_applied>) |
| 16165 |
return "%{nf%} sal{w}\t{%2, %1, %0|%0, %1, %2}"; |
| 16166 |
else |
| 16167 |
return "#"; |
| 16168 |
|
| 16169 |
case TYPE_MSKLOG: |
| 16170 |
return "#"; |
| 16171 |
|
| 16172 |
case TYPE_ALU: |
| 16173 |
gcc_assert (operands[2] == const1_rtx); |
| 16174 |
return "<nf_prefix>add{w}\t%0, %0"; |
| 16175 |
|
| 16176 |
default: |
| 16177 |
if (operands[2] == const1_rtx |
| 16178 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 16179 |
&& !use_ndd && !<nf_applied>) |
| 16180 |
return "sal{w}\t%0"; |
| 16181 |
else |
| 16182 |
return use_ndd ? "<nf_prefix>sal{w}\t{%2, %1, %0|%0, %1, %2}" |
| 16183 |
: "<nf_prefix>sal{w}\t{%2, %0|%0, %2}"; |
| 16184 |
} |
| 16185 |
} |
| 16186 |
[(set_attr "isa" "*,*,avx512f,apx_ndd") |
| 16187 |
(set (attr "type") |
| 16188 |
(cond [(eq_attr "alternative" "1") |
| 16189 |
(const_string "lea") |
| 16190 |
(eq_attr "alternative" "2") |
| 16191 |
(const_string "msklog") |
| 16192 |
(eq_attr "alternative" "3") |
| 16193 |
(const_string "ishift") |
| 16194 |
(and (and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16195 |
(match_operand 0 "register_operand")) |
| 16196 |
(match_operand 2 "const1_operand")) |
| 16197 |
(const_string "alu") |
| 16198 |
] |
| 16199 |
(const_string "ishift"))) |
| 16200 |
(set (attr "length_immediate") |
| 16201 |
(if_then_else |
| 16202 |
(ior (eq_attr "type" "alu") |
| 16203 |
(and (eq_attr "type" "ishift") |
| 16204 |
(and (match_operand 2 "const1_operand") |
| 16205 |
(ior (match_test "TARGET_SHIFT1") |
| 16206 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16207 |
(const_string "0") |
| 16208 |
(const_string "*"))) |
| 16209 |
(set_attr "has_nf" "1") |
| 16210 |
(set_attr "mode" "HI,SI,HI,HI")]) |
| 16211 |
|
| 16212 |
(define_insn "*ashlqi3_1<nf_name>" |
| 16213 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,Yp,?k,r") |
| 16214 |
(ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,l,k,rm") |
| 16215 |
(match_operand:QI 2 "nonmemory_operand" "cI,cI,M,Wb,cI")))] |
| 16216 |
"ix86_binary_operator_ok (ASHIFT, QImode, operands, TARGET_APX_NDD) |
| 16217 |
&& <nf_condition>" |
| 16218 |
{ |
| 16219 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 16220 |
switch (get_attr_type (insn)) |
| 16221 |
{ |
| 16222 |
case TYPE_LEA: |
| 16223 |
if (TARGET_APX_NDD && <nf_applied>) |
| 16224 |
return "%{nf%} sal{b}\t{%2, %1, %0|%0, %1, %2}"; |
| 16225 |
else |
| 16226 |
return "#"; |
| 16227 |
|
| 16228 |
case TYPE_MSKLOG: |
| 16229 |
return "#"; |
| 16230 |
|
| 16231 |
case TYPE_ALU: |
| 16232 |
gcc_assert (operands[2] == const1_rtx); |
| 16233 |
if (REG_P (operands[1]) && !ANY_QI_REGNO_P (REGNO (operands[1]))) |
| 16234 |
return "<nf_prefix>add{l}\t%k0, %k0"; |
| 16235 |
else |
| 16236 |
return "<nf_prefix>add{b}\t%0, %0"; |
| 16237 |
|
| 16238 |
default: |
| 16239 |
if (operands[2] == const1_rtx |
| 16240 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 16241 |
&& !use_ndd && !<nf_applied>) |
| 16242 |
{ |
| 16243 |
if (get_attr_mode (insn) == MODE_SI) |
| 16244 |
return "sal{l}\t%k0"; |
| 16245 |
else |
| 16246 |
return "sal{b}\t%0"; |
| 16247 |
} |
| 16248 |
else |
| 16249 |
{ |
| 16250 |
if (get_attr_mode (insn) == MODE_SI) |
| 16251 |
return "<nf_prefix>sal{l}\t{%2, %k0|%k0, %2}"; |
| 16252 |
else |
| 16253 |
return use_ndd ? "<nf_prefix>sal{b}\t{%2, %1, %0|%0, %1, %2}" |
| 16254 |
: "<nf_prefix>sal{b}\t{%2, %0|%0, %2}"; |
| 16255 |
} |
| 16256 |
} |
| 16257 |
} |
| 16258 |
[(set_attr "isa" "*,*,*,avx512dq,apx_ndd") |
| 16259 |
(set (attr "type") |
| 16260 |
(cond [(eq_attr "alternative" "2") |
| 16261 |
(const_string "lea") |
| 16262 |
(eq_attr "alternative" "3") |
| 16263 |
(const_string "msklog") |
| 16264 |
(eq_attr "alternative" "4") |
| 16265 |
(const_string "ishift") |
| 16266 |
(and (and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16267 |
(match_operand 0 "register_operand")) |
| 16268 |
(match_operand 2 "const1_operand")) |
| 16269 |
(const_string "alu") |
| 16270 |
] |
| 16271 |
(const_string "ishift"))) |
| 16272 |
(set (attr "length_immediate") |
| 16273 |
(if_then_else |
| 16274 |
(ior (eq_attr "type" "alu") |
| 16275 |
(and (eq_attr "type" "ishift") |
| 16276 |
(and (match_operand 2 "const1_operand") |
| 16277 |
(ior (match_test "TARGET_SHIFT1") |
| 16278 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16279 |
(const_string "0") |
| 16280 |
(const_string "*"))) |
| 16281 |
(set_attr "has_nf" "1") |
| 16282 |
(set_attr "mode" "QI,SI,SI,QI,QI") |
| 16283 |
;; Potential partial reg stall on alternative 1. |
| 16284 |
(set (attr "preferred_for_speed") |
| 16285 |
(cond [(eq_attr "alternative" "1,4") |
| 16286 |
(symbol_ref "!TARGET_PARTIAL_REG_STALL")] |
| 16287 |
(symbol_ref "true")))]) |
| 16288 |
|
| 16289 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 16290 |
(define_insn_and_split "*ashl<mode>3_1_slp" |
| 16291 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 16292 |
(ashift:SWI12 (match_operand:SWI12 1 "register_operand" "0,!<r>") |
| 16293 |
(match_operand:QI 2 "nonmemory_operand" "cI,cI"))) |
| 16294 |
(clobber (reg:CC FLAGS_REG))] |
| 16295 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 16296 |
{ |
| 16297 |
if (which_alternative) |
| 16298 |
return "#"; |
| 16299 |
|
| 16300 |
switch (get_attr_type (insn)) |
| 16301 |
{ |
| 16302 |
case TYPE_ALU: |
| 16303 |
gcc_assert (operands[2] == const1_rtx); |
| 16304 |
return "add{<imodesuffix>}\t%0, %0"; |
| 16305 |
|
| 16306 |
default: |
| 16307 |
if (operands[2] == const1_rtx |
| 16308 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun))) |
| 16309 |
return "sal{<imodesuffix>}\t%0"; |
| 16310 |
else |
| 16311 |
return "sal{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 16312 |
} |
| 16313 |
} |
| 16314 |
"&& reload_completed |
| 16315 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 16316 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 16317 |
(parallel |
| 16318 |
[(set (strict_low_part (match_dup 0)) |
| 16319 |
(ashift:SWI12 (match_dup 0) (match_dup 2))) |
| 16320 |
(clobber (reg:CC FLAGS_REG))])] |
| 16321 |
"" |
| 16322 |
[(set (attr "type") |
| 16323 |
(cond [(and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16324 |
(match_operand 2 "const1_operand")) |
| 16325 |
(const_string "alu") |
| 16326 |
] |
| 16327 |
(const_string "ishift"))) |
| 16328 |
(set (attr "length_immediate") |
| 16329 |
(if_then_else |
| 16330 |
(ior (eq_attr "type" "alu") |
| 16331 |
(and (eq_attr "type" "ishift") |
| 16332 |
(and (match_operand 2 "const1_operand") |
| 16333 |
(ior (match_test "TARGET_SHIFT1") |
| 16334 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16335 |
(const_string "0") |
| 16336 |
(const_string "*"))) |
| 16337 |
(set_attr "mode" "<MODE>")]) |
| 16338 |
|
| 16339 |
;; Convert ashift to the lea pattern to avoid flags dependency. |
| 16340 |
(define_split |
| 16341 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 16342 |
(ashift:SWI (match_operand:SWI 1 "index_reg_operand") |
| 16343 |
(match_operand 2 "const_0_to_3_operand"))) |
| 16344 |
(clobber (reg:CC FLAGS_REG))] |
| 16345 |
"reload_completed |
| 16346 |
&& REGNO (operands[0]) != REGNO (operands[1])" |
| 16347 |
[(set (match_dup 0) |
| 16348 |
(mult:<LEAMODE> (match_dup 1) (match_dup 2)))] |
| 16349 |
{ |
| 16350 |
if (<MODE>mode != <LEAMODE>mode) |
| 16351 |
{ |
| 16352 |
operands[0] = gen_lowpart (<LEAMODE>mode, operands[0]); |
| 16353 |
operands[1] = gen_lowpart (<LEAMODE>mode, operands[1]); |
| 16354 |
} |
| 16355 |
operands[2] = GEN_INT (1 << INTVAL (operands[2])); |
| 16356 |
}) |
| 16357 |
|
| 16358 |
(define_split |
| 16359 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 16360 |
(ashift:SWI (match_operand:SWI 1 "index_reg_operand") |
| 16361 |
(match_operand 2 "const_0_to_3_operand")))] |
| 16362 |
"reload_completed |
| 16363 |
&& REGNO (operands[0]) != REGNO (operands[1]) |
| 16364 |
&& !TARGET_APX_NDD" |
| 16365 |
[(set (match_dup 0) |
| 16366 |
(mult:<LEAMODE> (match_dup 1) (match_dup 2)))] |
| 16367 |
{ |
| 16368 |
if (<MODE>mode != <LEAMODE>mode) |
| 16369 |
{ |
| 16370 |
operands[0] = gen_lowpart (<LEAMODE>mode, operands[0]); |
| 16371 |
operands[1] = gen_lowpart (<LEAMODE>mode, operands[1]); |
| 16372 |
} |
| 16373 |
operands[2] = GEN_INT (1 << INTVAL (operands[2])); |
| 16374 |
}) |
| 16375 |
|
| 16376 |
;; Convert ashift to the lea pattern to avoid flags dependency. |
| 16377 |
(define_split |
| 16378 |
[(set (match_operand:DI 0 "general_reg_operand") |
| 16379 |
(zero_extend:DI |
| 16380 |
(ashift:SI (match_operand:SI 1 "index_reg_operand") |
| 16381 |
(match_operand 2 "const_0_to_3_operand")))) |
| 16382 |
(clobber (reg:CC FLAGS_REG))] |
| 16383 |
"TARGET_64BIT && reload_completed |
| 16384 |
&& REGNO (operands[0]) != REGNO (operands[1])" |
| 16385 |
[(set (match_dup 0) |
| 16386 |
(zero_extend:DI (mult:SI (match_dup 1) (match_dup 2))))] |
| 16387 |
{ |
| 16388 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 16389 |
operands[2] = GEN_INT (1 << INTVAL (operands[2])); |
| 16390 |
}) |
| 16391 |
|
| 16392 |
;; This pattern can't accept a variable shift count, since shifts by |
| 16393 |
;; zero don't affect the flags. We assume that shifts by constant |
| 16394 |
;; zero are optimized away. |
| 16395 |
(define_insn "*ashl<mode>3_cmp" |
| 16396 |
[(set (reg FLAGS_REG) |
| 16397 |
(compare |
| 16398 |
(ashift:SWI (match_operand:SWI 1 "nonimmediate_operand" "0,rm") |
| 16399 |
(match_operand:QI 2 "<shift_immediate_operand>" "<S>,<S>")) |
| 16400 |
(const_int 0))) |
| 16401 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 16402 |
(ashift:SWI (match_dup 1) (match_dup 2)))] |
| 16403 |
"(optimize_function_for_size_p (cfun) |
| 16404 |
|| !TARGET_PARTIAL_FLAG_REG_STALL |
| 16405 |
|| (operands[2] == const1_rtx |
| 16406 |
&& (TARGET_SHIFT1 |
| 16407 |
|| (TARGET_DOUBLE_WITH_ADD && REG_P (operands[0]))))) |
| 16408 |
&& ix86_match_ccmode (insn, CCGOCmode) |
| 16409 |
&& ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands, TARGET_APX_NDD)" |
| 16410 |
{ |
| 16411 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 16412 |
switch (get_attr_type (insn)) |
| 16413 |
{ |
| 16414 |
case TYPE_ALU: |
| 16415 |
gcc_assert (operands[2] == const1_rtx); |
| 16416 |
return "add{<imodesuffix>}\t%0, %0"; |
| 16417 |
|
| 16418 |
default: |
| 16419 |
if (operands[2] == const1_rtx |
| 16420 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 16421 |
&& !use_ndd) |
| 16422 |
return "sal{<imodesuffix>}\t%0"; |
| 16423 |
else |
| 16424 |
return use_ndd ? "sal{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 16425 |
: "sal{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 16426 |
} |
| 16427 |
} |
| 16428 |
[(set_attr "isa" "*,apx_ndd") |
| 16429 |
(set (attr "type") |
| 16430 |
(cond [(eq_attr "alternative" "1") |
| 16431 |
(const_string "ishift") |
| 16432 |
(and (and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16433 |
(match_operand 0 "register_operand")) |
| 16434 |
(match_operand 2 "const1_operand")) |
| 16435 |
(const_string "alu") |
| 16436 |
] |
| 16437 |
(const_string "ishift"))) |
| 16438 |
(set (attr "length_immediate") |
| 16439 |
(if_then_else |
| 16440 |
(ior (eq_attr "type" "alu") |
| 16441 |
(and (eq_attr "type" "ishift") |
| 16442 |
(and (match_operand 2 "const1_operand") |
| 16443 |
(ior (match_test "TARGET_SHIFT1") |
| 16444 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16445 |
(const_string "0") |
| 16446 |
(const_string "*"))) |
| 16447 |
(set_attr "mode" "<MODE>")]) |
| 16448 |
|
| 16449 |
(define_insn "*ashlsi3_cmp_zext" |
| 16450 |
[(set (reg FLAGS_REG) |
| 16451 |
(compare |
| 16452 |
(ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm") |
| 16453 |
(match_operand:QI 2 "const_1_to_31_operand")) |
| 16454 |
(const_int 0))) |
| 16455 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 16456 |
(zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2))))] |
| 16457 |
"TARGET_64BIT |
| 16458 |
&& (optimize_function_for_size_p (cfun) |
| 16459 |
|| !TARGET_PARTIAL_FLAG_REG_STALL |
| 16460 |
|| (operands[2] == const1_rtx |
| 16461 |
&& (TARGET_SHIFT1 |
| 16462 |
|| TARGET_DOUBLE_WITH_ADD))) |
| 16463 |
&& ix86_match_ccmode (insn, CCGOCmode) |
| 16464 |
&& ix86_binary_operator_ok (ASHIFT, SImode, operands, TARGET_APX_NDD)" |
| 16465 |
{ |
| 16466 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 16467 |
switch (get_attr_type (insn)) |
| 16468 |
{ |
| 16469 |
case TYPE_ALU: |
| 16470 |
gcc_assert (operands[2] == const1_rtx); |
| 16471 |
return "add{l}\t%k0, %k0"; |
| 16472 |
|
| 16473 |
default: |
| 16474 |
if (operands[2] == const1_rtx |
| 16475 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 16476 |
&& !use_ndd) |
| 16477 |
return "sal{l}\t%k0"; |
| 16478 |
else |
| 16479 |
return use_ndd ? "sal{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 16480 |
: "sal{l}\t{%2, %k0|%k0, %2}"; |
| 16481 |
} |
| 16482 |
} |
| 16483 |
[(set_attr "isa" "*,apx_ndd") |
| 16484 |
(set (attr "type") |
| 16485 |
(cond [(eq_attr "alternative" "1") |
| 16486 |
(const_string "ishift") |
| 16487 |
(and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16488 |
(match_operand 2 "const1_operand")) |
| 16489 |
(const_string "alu") |
| 16490 |
] |
| 16491 |
(const_string "ishift"))) |
| 16492 |
(set (attr "length_immediate") |
| 16493 |
(if_then_else |
| 16494 |
(ior (eq_attr "type" "alu") |
| 16495 |
(and (eq_attr "type" "ishift") |
| 16496 |
(and (match_operand 2 "const1_operand") |
| 16497 |
(ior (match_test "TARGET_SHIFT1") |
| 16498 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16499 |
(const_string "0") |
| 16500 |
(const_string "*"))) |
| 16501 |
(set_attr "mode" "SI")]) |
| 16502 |
|
| 16503 |
(define_insn "*ashl<mode>3_cconly" |
| 16504 |
[(set (reg FLAGS_REG) |
| 16505 |
(compare |
| 16506 |
(ashift:SWI (match_operand:SWI 1 "nonimmediate_operand" "0,rm") |
| 16507 |
(match_operand:QI 2 "<shift_immediate_operand>" "<S>,<S>")) |
| 16508 |
(const_int 0))) |
| 16509 |
(clobber (match_scratch:SWI 0 "=<r>,r"))] |
| 16510 |
"(optimize_function_for_size_p (cfun) |
| 16511 |
|| !TARGET_PARTIAL_FLAG_REG_STALL |
| 16512 |
|| (operands[2] == const1_rtx |
| 16513 |
&& (TARGET_SHIFT1 |
| 16514 |
|| TARGET_DOUBLE_WITH_ADD))) |
| 16515 |
&& ix86_match_ccmode (insn, CCGOCmode)" |
| 16516 |
{ |
| 16517 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 16518 |
switch (get_attr_type (insn)) |
| 16519 |
{ |
| 16520 |
case TYPE_ALU: |
| 16521 |
gcc_assert (operands[2] == const1_rtx); |
| 16522 |
return "add{<imodesuffix>}\t%0, %0"; |
| 16523 |
|
| 16524 |
default: |
| 16525 |
if (operands[2] == const1_rtx |
| 16526 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 16527 |
&& !use_ndd) |
| 16528 |
return "sal{<imodesuffix>}\t%0"; |
| 16529 |
else |
| 16530 |
return use_ndd ? "sal{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 16531 |
: "sal{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 16532 |
} |
| 16533 |
} |
| 16534 |
[(set_attr "isa" "*,apx_ndd") |
| 16535 |
(set (attr "type") |
| 16536 |
(cond [(eq_attr "alternative" "1") |
| 16537 |
(const_string "ishift") |
| 16538 |
(and (and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16539 |
(match_operand 0 "register_operand")) |
| 16540 |
(match_operand 2 "const1_operand")) |
| 16541 |
(const_string "alu") |
| 16542 |
] |
| 16543 |
(const_string "ishift"))) |
| 16544 |
(set (attr "length_immediate") |
| 16545 |
(if_then_else |
| 16546 |
(ior (eq_attr "type" "alu") |
| 16547 |
(and (eq_attr "type" "ishift") |
| 16548 |
(and (match_operand 2 "const1_operand") |
| 16549 |
(ior (match_test "TARGET_SHIFT1") |
| 16550 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16551 |
(const_string "0") |
| 16552 |
(const_string "*"))) |
| 16553 |
(set_attr "mode" "<MODE>")]) |
| 16554 |
|
| 16555 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 16556 |
(define_insn_and_split "*ashlqi_ext<mode>_1" |
| 16557 |
[(set (zero_extract:SWI248 |
| 16558 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 16559 |
(const_int 8) |
| 16560 |
(const_int 8)) |
| 16561 |
(subreg:SWI248 |
| 16562 |
(ashift:QI |
| 16563 |
(subreg:QI |
| 16564 |
(match_operator:SWI248 3 "extract_operator" |
| 16565 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 16566 |
(const_int 8) |
| 16567 |
(const_int 8)]) 0) |
| 16568 |
(match_operand:QI 2 "nonmemory_operand" "cI,cI")) 0)) |
| 16569 |
(clobber (reg:CC FLAGS_REG))] |
| 16570 |
"" |
| 16571 |
{ |
| 16572 |
if (which_alternative) |
| 16573 |
return "#"; |
| 16574 |
|
| 16575 |
switch (get_attr_type (insn)) |
| 16576 |
{ |
| 16577 |
case TYPE_ALU: |
| 16578 |
gcc_assert (operands[2] == const1_rtx); |
| 16579 |
return "add{b}\t%h0, %h0"; |
| 16580 |
|
| 16581 |
default: |
| 16582 |
if (operands[2] == const1_rtx |
| 16583 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun))) |
| 16584 |
return "sal{b}\t%h0"; |
| 16585 |
else |
| 16586 |
return "sal{b}\t{%2, %h0|%h0, %2}"; |
| 16587 |
} |
| 16588 |
} |
| 16589 |
"reload_completed |
| 16590 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 16591 |
[(set (zero_extract:SWI248 |
| 16592 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 16593 |
(zero_extract:SWI248 |
| 16594 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 16595 |
(parallel |
| 16596 |
[(set (zero_extract:SWI248 |
| 16597 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 16598 |
(subreg:SWI248 |
| 16599 |
(ashift:QI |
| 16600 |
(subreg:QI |
| 16601 |
(match_op_dup 3 |
| 16602 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 16603 |
(match_dup 2)) 0)) |
| 16604 |
(clobber (reg:CC FLAGS_REG))])] |
| 16605 |
"" |
| 16606 |
[(set (attr "type") |
| 16607 |
(cond [(and (match_test "TARGET_DOUBLE_WITH_ADD") |
| 16608 |
(match_operand 2 "const1_operand")) |
| 16609 |
(const_string "alu") |
| 16610 |
] |
| 16611 |
(const_string "ishift"))) |
| 16612 |
(set (attr "length_immediate") |
| 16613 |
(if_then_else |
| 16614 |
(ior (eq_attr "type" "alu") |
| 16615 |
(and (eq_attr "type" "ishift") |
| 16616 |
(and (match_operand 2 "const1_operand") |
| 16617 |
(ior (match_test "TARGET_SHIFT1") |
| 16618 |
(match_test "optimize_function_for_size_p (cfun)"))))) |
| 16619 |
(const_string "0") |
| 16620 |
(const_string "*"))) |
| 16621 |
(set_attr "mode" "QI")]) |
| 16622 |
|
| 16623 |
;; See comment above `ashl<mode>3' about how this works. |
| 16624 |
|
| 16625 |
(define_expand "<insn><mode>3" |
| 16626 |
[(set (match_operand:SDWIM 0 "<shift_operand>") |
| 16627 |
(any_shiftrt:SDWIM (match_operand:SDWIM 1 "<shift_operand>") |
| 16628 |
(match_operand:QI 2 "nonmemory_operand")))] |
| 16629 |
"" |
| 16630 |
{ |
| 16631 |
ix86_expand_binary_operator (<CODE>, <MODE>mode, operands, TARGET_APX_NDD); |
| 16632 |
DONE; |
| 16633 |
}) |
| 16634 |
|
| 16635 |
(define_insn_and_split "*<insn><dwi>3_doubleword_mask" |
| 16636 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 16637 |
(any_shiftrt:<DWI> |
| 16638 |
(match_operand:<DWI> 1 "register_operand") |
| 16639 |
(subreg:QI |
| 16640 |
(and |
| 16641 |
(match_operand 2 "int248_register_operand" "c") |
| 16642 |
(match_operand 3 "const_int_operand")) 0))) |
| 16643 |
(clobber (reg:CC FLAGS_REG))] |
| 16644 |
"((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) == 0 |
| 16645 |
|| ((INTVAL (operands[3]) & (2 * <MODE_SIZE> * BITS_PER_UNIT - 1)) |
| 16646 |
== (2 * <MODE_SIZE> * BITS_PER_UNIT - 1))) |
| 16647 |
&& ix86_pre_reload_split ()" |
| 16648 |
"#" |
| 16649 |
"&& 1" |
| 16650 |
[(parallel |
| 16651 |
[(set (match_dup 4) |
| 16652 |
(ior:DWIH (lshiftrt:DWIH (match_dup 4) |
| 16653 |
(and:QI (match_dup 2) (match_dup 8))) |
| 16654 |
(subreg:DWIH |
| 16655 |
(ashift:<DWI> (zero_extend:<DWI> (match_dup 7)) |
| 16656 |
(minus:QI (match_dup 9) |
| 16657 |
(and:QI (match_dup 2) (match_dup 8)))) 0))) |
| 16658 |
(clobber (reg:CC FLAGS_REG))]) |
| 16659 |
(parallel |
| 16660 |
[(set (match_dup 6) |
| 16661 |
(any_shiftrt:DWIH (match_dup 7) (match_dup 2))) |
| 16662 |
(clobber (reg:CC FLAGS_REG))])] |
| 16663 |
{ |
| 16664 |
if ((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) != 0) |
| 16665 |
{ |
| 16666 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 16667 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 16668 |
emit_insn (gen_<insn><dwi>3_doubleword (operands[0], operands[1], |
| 16669 |
operands[2])); |
| 16670 |
DONE; |
| 16671 |
} |
| 16672 |
|
| 16673 |
split_double_mode (<DWI>mode, &operands[0], 2, &operands[4], &operands[6]); |
| 16674 |
|
| 16675 |
operands[8] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT - 1); |
| 16676 |
operands[9] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT); |
| 16677 |
|
| 16678 |
if ((INTVAL (operands[3]) & ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 16679 |
!= ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 16680 |
{ |
| 16681 |
rtx xops[3]; |
| 16682 |
xops[0] = gen_reg_rtx (GET_MODE (operands[2])); |
| 16683 |
xops[1] = operands[2]; |
| 16684 |
xops[2] = GEN_INT (INTVAL (operands[3]) |
| 16685 |
& ((<MODE_SIZE> * BITS_PER_UNIT) - 1)); |
| 16686 |
ix86_expand_binary_operator (AND, GET_MODE (operands[2]), xops); |
| 16687 |
operands[2] = xops[0]; |
| 16688 |
} |
| 16689 |
|
| 16690 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 16691 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 16692 |
|
| 16693 |
if (!rtx_equal_p (operands[4], operands[5])) |
| 16694 |
emit_move_insn (operands[4], operands[5]); |
| 16695 |
}) |
| 16696 |
|
| 16697 |
(define_insn_and_split "*<insn><dwi>3_doubleword_mask_1" |
| 16698 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 16699 |
(any_shiftrt:<DWI> |
| 16700 |
(match_operand:<DWI> 1 "register_operand") |
| 16701 |
(and:QI |
| 16702 |
(match_operand:QI 2 "register_operand" "c") |
| 16703 |
(match_operand:QI 3 "const_int_operand")))) |
| 16704 |
(clobber (reg:CC FLAGS_REG))] |
| 16705 |
"((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) == 0 |
| 16706 |
|| ((INTVAL (operands[3]) & (2 * <MODE_SIZE> * BITS_PER_UNIT - 1)) |
| 16707 |
== (2 * <MODE_SIZE> * BITS_PER_UNIT - 1))) |
| 16708 |
&& ix86_pre_reload_split ()" |
| 16709 |
"#" |
| 16710 |
"&& 1" |
| 16711 |
[(parallel |
| 16712 |
[(set (match_dup 4) |
| 16713 |
(ior:DWIH (lshiftrt:DWIH (match_dup 4) |
| 16714 |
(and:QI (match_dup 2) (match_dup 8))) |
| 16715 |
(subreg:DWIH |
| 16716 |
(ashift:<DWI> (zero_extend:<DWI> (match_dup 7)) |
| 16717 |
(minus:QI (match_dup 9) |
| 16718 |
(and:QI (match_dup 2) (match_dup 8)))) 0))) |
| 16719 |
(clobber (reg:CC FLAGS_REG))]) |
| 16720 |
(parallel |
| 16721 |
[(set (match_dup 6) |
| 16722 |
(any_shiftrt:DWIH (match_dup 7) (match_dup 2))) |
| 16723 |
(clobber (reg:CC FLAGS_REG))])] |
| 16724 |
{ |
| 16725 |
if ((INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT)) != 0) |
| 16726 |
{ |
| 16727 |
emit_insn (gen_<insn><dwi>3_doubleword (operands[0], operands[1], |
| 16728 |
operands[2])); |
| 16729 |
DONE; |
| 16730 |
} |
| 16731 |
|
| 16732 |
split_double_mode (<DWI>mode, &operands[0], 2, &operands[4], &operands[6]); |
| 16733 |
|
| 16734 |
operands[8] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT - 1); |
| 16735 |
operands[9] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT); |
| 16736 |
|
| 16737 |
if ((INTVAL (operands[3]) & ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 16738 |
!= ((<MODE_SIZE> * BITS_PER_UNIT) - 1)) |
| 16739 |
{ |
| 16740 |
rtx tem = gen_reg_rtx (QImode); |
| 16741 |
emit_insn (gen_andqi3 (tem, operands[2], operands[3])); |
| 16742 |
operands[2] = tem; |
| 16743 |
} |
| 16744 |
|
| 16745 |
if (!rtx_equal_p (operands[4], operands[5])) |
| 16746 |
emit_move_insn (operands[4], operands[5]); |
| 16747 |
}) |
| 16748 |
|
| 16749 |
(define_insn_and_split "<insn><mode>3_doubleword" |
| 16750 |
[(set (match_operand:DWI 0 "register_operand" "=&r,&r") |
| 16751 |
(any_shiftrt:DWI (match_operand:DWI 1 "register_operand" "0,r") |
| 16752 |
(match_operand:QI 2 "nonmemory_operand" "<S>c,<S>c"))) |
| 16753 |
(clobber (reg:CC FLAGS_REG))] |
| 16754 |
"" |
| 16755 |
"#" |
| 16756 |
"epilogue_completed" |
| 16757 |
[(const_int 0)] |
| 16758 |
{ |
| 16759 |
if (TARGET_APX_NDD |
| 16760 |
&& !rtx_equal_p (operands[0], operands[1])) |
| 16761 |
ix86_split_rshift_ndd (<CODE>, operands, NULL_RTX); |
| 16762 |
else |
| 16763 |
ix86_split_<insn> (operands, NULL_RTX, <MODE>mode); |
| 16764 |
DONE; |
| 16765 |
} |
| 16766 |
[(set_attr "type" "multi") |
| 16767 |
(set_attr "isa" "*,apx_ndd")]) |
| 16768 |
|
| 16769 |
;; By default we don't ask for a scratch register, because when DWImode |
| 16770 |
;; values are manipulated, registers are already at a premium. But if |
| 16771 |
;; we have one handy, we won't turn it away. |
| 16772 |
|
| 16773 |
(define_peephole2 |
| 16774 |
[(match_scratch:DWIH 3 "r") |
| 16775 |
(parallel [(set (match_operand:<DWI> 0 "register_operand") |
| 16776 |
(any_shiftrt:<DWI> |
| 16777 |
(match_operand:<DWI> 1 "register_operand") |
| 16778 |
(match_operand:QI 2 "nonmemory_operand"))) |
| 16779 |
(clobber (reg:CC FLAGS_REG))]) |
| 16780 |
(match_dup 3)] |
| 16781 |
"TARGET_CMOVE" |
| 16782 |
[(const_int 0)] |
| 16783 |
{ |
| 16784 |
if (TARGET_APX_NDD |
| 16785 |
&& !rtx_equal_p (operands[0], operands[1])) |
| 16786 |
ix86_split_rshift_ndd (<CODE>, operands, operands[3]); |
| 16787 |
else |
| 16788 |
ix86_split_<insn> (operands, operands[3], <DWI>mode); |
| 16789 |
DONE; |
| 16790 |
}) |
| 16791 |
|
| 16792 |
;; Split truncations of double word right shifts into x86_shrd_1. |
| 16793 |
(define_insn_and_split "<insn><dwi>3_doubleword_lowpart_nf" |
| 16794 |
[(set (match_operand:DWIH 0 "register_operand" "=&r") |
| 16795 |
(subreg:DWIH |
| 16796 |
(any_shiftrt:<DWI> (match_operand:<DWI> 1 "register_operand" "r") |
| 16797 |
(match_operand:QI 2 "const_int_operand")) 0))] |
| 16798 |
"TARGET_APX_NF && UINTVAL (operands[2]) < <MODE_SIZE> * BITS_PER_UNIT" |
| 16799 |
"#" |
| 16800 |
"&& reload_completed" |
| 16801 |
[(set (match_dup 0) |
| 16802 |
(ior:DWIH (lshiftrt:DWIH (match_dup 0) (match_dup 2)) |
| 16803 |
(subreg:DWIH |
| 16804 |
(ashift:<DWI> (zero_extend:<DWI> (match_dup 3)) |
| 16805 |
(match_dup 4)) 0)))] |
| 16806 |
{ |
| 16807 |
split_double_mode (<DWI>mode, &operands[1], 1, &operands[1], &operands[3]); |
| 16808 |
operands[4] = GEN_INT ((<MODE_SIZE> * BITS_PER_UNIT) - INTVAL (operands[2])); |
| 16809 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 16810 |
emit_move_insn (operands[0], operands[1]); |
| 16811 |
}) |
| 16812 |
|
| 16813 |
(define_insn_and_split "<insn><dwi>3_doubleword_lowpart" |
| 16814 |
[(set (match_operand:DWIH 0 "register_operand" "=&r") |
| 16815 |
(subreg:DWIH |
| 16816 |
(any_shiftrt:<DWI> (match_operand:<DWI> 1 "register_operand" "r") |
| 16817 |
(match_operand:QI 2 "const_int_operand")) 0)) |
| 16818 |
(clobber (reg:CC FLAGS_REG))] |
| 16819 |
"UINTVAL (operands[2]) < <MODE_SIZE> * BITS_PER_UNIT" |
| 16820 |
"#" |
| 16821 |
"&& reload_completed" |
| 16822 |
[(parallel |
| 16823 |
[(set (match_dup 0) |
| 16824 |
(ior:DWIH (lshiftrt:DWIH (match_dup 0) (match_dup 2)) |
| 16825 |
(subreg:DWIH |
| 16826 |
(ashift:<DWI> (zero_extend:<DWI> (match_dup 3)) |
| 16827 |
(match_dup 4)) 0))) |
| 16828 |
(clobber (reg:CC FLAGS_REG))])] |
| 16829 |
{ |
| 16830 |
split_double_mode (<DWI>mode, &operands[1], 1, &operands[1], &operands[3]); |
| 16831 |
operands[4] = GEN_INT ((<MODE_SIZE> * BITS_PER_UNIT) - INTVAL (operands[2])); |
| 16832 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 16833 |
emit_move_insn (operands[0], operands[1]); |
| 16834 |
} |
| 16835 |
[(set_attr "has_nf" "1")]) |
| 16836 |
|
| 16837 |
(define_insn "x86_64_shrd<nf_name>" |
| 16838 |
[(set (match_operand:DI 0 "nonimmediate_operand" "+r*m") |
| 16839 |
(ior:DI (lshiftrt:DI (match_dup 0) |
| 16840 |
(and:QI (match_operand:QI 2 "nonmemory_operand" "Jc") |
| 16841 |
(const_int 63))) |
| 16842 |
(subreg:DI |
| 16843 |
(ashift:TI |
| 16844 |
(zero_extend:TI |
| 16845 |
(match_operand:DI 1 "register_operand" "r")) |
| 16846 |
(minus:QI (const_int 64) |
| 16847 |
(and:QI (match_dup 2) (const_int 63)))) 0)))] |
| 16848 |
"TARGET_64BIT && <nf_condition>" |
| 16849 |
"<nf_prefix>shrd{q}\t{%2, %1, %0|%0, %1, %2}" |
| 16850 |
[(set_attr "type" "ishift") |
| 16851 |
(set_attr "prefix_0f" "1") |
| 16852 |
(set_attr "has_nf" "1") |
| 16853 |
(set_attr "mode" "DI") |
| 16854 |
(set_attr "athlon_decode" "vector") |
| 16855 |
(set_attr "amdfam10_decode" "vector") |
| 16856 |
(set_attr "bdver1_decode" "vector")]) |
| 16857 |
|
| 16858 |
(define_insn "x86_64_shrd_ndd<nf_name>" |
| 16859 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 16860 |
(ior:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "rm") |
| 16861 |
(and:QI (match_operand:QI 3 "nonmemory_operand" "Jc") |
| 16862 |
(const_int 63))) |
| 16863 |
(subreg:DI |
| 16864 |
(ashift:TI |
| 16865 |
(zero_extend:TI |
| 16866 |
(match_operand:DI 2 "register_operand" "r")) |
| 16867 |
(minus:QI (const_int 64) |
| 16868 |
(and:QI (match_dup 3) (const_int 63)))) 0)))] |
| 16869 |
"TARGET_APX_NDD && <nf_condition>" |
| 16870 |
"<nf_prefix>shrd{q}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 16871 |
[(set_attr "type" "ishift") |
| 16872 |
(set_attr "has_nf" "1") |
| 16873 |
(set_attr "mode" "DI")]) |
| 16874 |
|
| 16875 |
(define_insn "x86_64_shrd_1<nf_name>" |
| 16876 |
[(set (match_operand:DI 0 "nonimmediate_operand" "+r*m") |
| 16877 |
(ior:DI (lshiftrt:DI (match_dup 0) |
| 16878 |
(match_operand:QI 2 "const_0_to_63_operand")) |
| 16879 |
(subreg:DI |
| 16880 |
(ashift:TI |
| 16881 |
(zero_extend:TI |
| 16882 |
(match_operand:DI 1 "register_operand" "r")) |
| 16883 |
(match_operand:QI 3 "const_0_to_255_operand")) 0)))] |
| 16884 |
"TARGET_64BIT |
| 16885 |
&& INTVAL (operands[3]) == 64 - INTVAL (operands[2]) |
| 16886 |
&& <nf_condition>" |
| 16887 |
"<nf_prefix>shrd{q}\t{%2, %1, %0|%0, %1, %2}" |
| 16888 |
[(set_attr "type" "ishift") |
| 16889 |
(set_attr "prefix_0f" "1") |
| 16890 |
(set_attr "length_immediate" "1") |
| 16891 |
(set_attr "has_nf" "1") |
| 16892 |
(set_attr "mode" "DI") |
| 16893 |
(set_attr "athlon_decode" "vector") |
| 16894 |
(set_attr "amdfam10_decode" "vector") |
| 16895 |
(set_attr "bdver1_decode" "vector")]) |
| 16896 |
|
| 16897 |
(define_insn "x86_64_shrd_ndd_1<nf_name>" |
| 16898 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 16899 |
(ior:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "rm") |
| 16900 |
(match_operand:QI 3 "const_0_to_63_operand")) |
| 16901 |
(subreg:DI |
| 16902 |
(ashift:TI |
| 16903 |
(zero_extend:TI |
| 16904 |
(match_operand:DI 2 "register_operand" "r")) |
| 16905 |
(match_operand:QI 4 "const_0_to_255_operand")) 0)))] |
| 16906 |
"TARGET_APX_NDD |
| 16907 |
&& INTVAL (operands[4]) == 64 - INTVAL (operands[3]) |
| 16908 |
&& <nf_condition>" |
| 16909 |
"<nf_prefix>shrd{q}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 16910 |
[(set_attr "type" "ishift") |
| 16911 |
(set_attr "length_immediate" "1") |
| 16912 |
(set_attr "has_nf" "1") |
| 16913 |
(set_attr "mode" "DI")]) |
| 16914 |
|
| 16915 |
(define_insn_and_split "*x86_64_shrd_shld_1_nozext_nf" |
| 16916 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 16917 |
(ior:DI (lshiftrt:DI (match_operand:DI 4 "nonimmediate_operand") |
| 16918 |
(match_operand:QI 2 "const_0_to_63_operand")) |
| 16919 |
(ashift:DI |
| 16920 |
(match_operand:DI 1 "nonimmediate_operand") |
| 16921 |
(match_operand:QI 3 "const_0_to_63_operand"))))] |
| 16922 |
"TARGET_64BIT && TARGET_APX_NF |
| 16923 |
&& INTVAL (operands[3]) == 64 - INTVAL (operands[2]) |
| 16924 |
&& ix86_pre_reload_split ()" |
| 16925 |
"#" |
| 16926 |
"&& 1" |
| 16927 |
[(const_int 0)] |
| 16928 |
{ |
| 16929 |
if (rtx_equal_p (operands[4], operands[0])) |
| 16930 |
{ |
| 16931 |
operands[1] = force_reg (DImode, operands[1]); |
| 16932 |
emit_insn (gen_x86_64_shrd_1_nf (operands[0], operands[1], |
| 16933 |
operands[2], operands[3])); |
| 16934 |
} |
| 16935 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 16936 |
{ |
| 16937 |
operands[4] = force_reg (DImode, operands[4]); |
| 16938 |
emit_insn (gen_x86_64_shld_1_nf (operands[0], operands[4], |
| 16939 |
operands[3], operands[2])); |
| 16940 |
} |
| 16941 |
else if (TARGET_APX_NDD) |
| 16942 |
{ |
| 16943 |
rtx tmp = gen_reg_rtx (DImode); |
| 16944 |
if (MEM_P (operands[4])) |
| 16945 |
{ |
| 16946 |
operands[1] = force_reg (DImode, operands[1]); |
| 16947 |
emit_insn (gen_x86_64_shrd_ndd_1_nf (tmp, operands[4], operands[1], |
| 16948 |
operands[2], operands[3])); |
| 16949 |
} |
| 16950 |
else if (MEM_P (operands[1])) |
| 16951 |
emit_insn (gen_x86_64_shld_ndd_1_nf (tmp, operands[1], operands[4], |
| 16952 |
operands[3], operands[2])); |
| 16953 |
else |
| 16954 |
emit_insn (gen_x86_64_shrd_ndd_1_nf (tmp, operands[4], operands[1], |
| 16955 |
operands[2], operands[3])); |
| 16956 |
emit_move_insn (operands[0], tmp); |
| 16957 |
} |
| 16958 |
else |
| 16959 |
{ |
| 16960 |
operands[1] = force_reg (DImode, operands[1]); |
| 16961 |
rtx tmp = gen_reg_rtx (DImode); |
| 16962 |
emit_move_insn (tmp, operands[4]); |
| 16963 |
emit_insn (gen_x86_64_shrd_1_nf (tmp, operands[1], |
| 16964 |
operands[2], operands[3])); |
| 16965 |
emit_move_insn (operands[0], tmp); |
| 16966 |
} |
| 16967 |
DONE; |
| 16968 |
}) |
| 16969 |
|
| 16970 |
(define_insn_and_split "*x86_64_shrd_shld_1_nozext" |
| 16971 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 16972 |
(ior:DI (lshiftrt:DI (match_operand:DI 4 "nonimmediate_operand") |
| 16973 |
(match_operand:QI 2 "const_0_to_63_operand")) |
| 16974 |
(ashift:DI |
| 16975 |
(match_operand:DI 1 "nonimmediate_operand") |
| 16976 |
(match_operand:QI 3 "const_0_to_63_operand")))) |
| 16977 |
(clobber (reg:CC FLAGS_REG))] |
| 16978 |
"TARGET_64BIT |
| 16979 |
&& INTVAL (operands[3]) == 64 - INTVAL (operands[2]) |
| 16980 |
&& ix86_pre_reload_split ()" |
| 16981 |
"#" |
| 16982 |
"&& 1" |
| 16983 |
[(const_int 0)] |
| 16984 |
{ |
| 16985 |
if (rtx_equal_p (operands[4], operands[0])) |
| 16986 |
{ |
| 16987 |
operands[1] = force_reg (DImode, operands[1]); |
| 16988 |
emit_insn (gen_x86_64_shrd_1 (operands[0], operands[1], operands[2], operands[3])); |
| 16989 |
} |
| 16990 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 16991 |
{ |
| 16992 |
operands[4] = force_reg (DImode, operands[4]); |
| 16993 |
emit_insn (gen_x86_64_shld_1 (operands[0], operands[4], operands[3], operands[2])); |
| 16994 |
} |
| 16995 |
else if (TARGET_APX_NDD) |
| 16996 |
{ |
| 16997 |
rtx tmp = gen_reg_rtx (DImode); |
| 16998 |
if (MEM_P (operands[4])) |
| 16999 |
{ |
| 17000 |
operands[1] = force_reg (DImode, operands[1]); |
| 17001 |
emit_insn (gen_x86_64_shrd_ndd_1 (tmp, operands[4], operands[1], |
| 17002 |
operands[2], operands[3])); |
| 17003 |
} |
| 17004 |
else if (MEM_P (operands[1])) |
| 17005 |
emit_insn (gen_x86_64_shld_ndd_1 (tmp, operands[1], operands[4], |
| 17006 |
operands[3], operands[2])); |
| 17007 |
else |
| 17008 |
emit_insn (gen_x86_64_shrd_ndd_1 (tmp, operands[4], operands[1], |
| 17009 |
operands[2], operands[3])); |
| 17010 |
emit_move_insn (operands[0], tmp); |
| 17011 |
} |
| 17012 |
else |
| 17013 |
{ |
| 17014 |
operands[1] = force_reg (DImode, operands[1]); |
| 17015 |
rtx tmp = gen_reg_rtx (DImode); |
| 17016 |
emit_move_insn (tmp, operands[4]); |
| 17017 |
emit_insn (gen_x86_64_shrd_1 (tmp, operands[1], operands[2], operands[3])); |
| 17018 |
emit_move_insn (operands[0], tmp); |
| 17019 |
} |
| 17020 |
DONE; |
| 17021 |
} |
| 17022 |
[(set_attr "has_nf" "1")]) |
| 17023 |
|
| 17024 |
(define_insn_and_split "*x86_64_shrd_2" |
| 17025 |
[(set (match_operand:DI 0 "nonimmediate_operand") |
| 17026 |
(ior:DI (lshiftrt:DI (match_dup 0) |
| 17027 |
(match_operand:QI 2 "nonmemory_operand")) |
| 17028 |
(ashift:DI (match_operand:DI 1 "register_operand") |
| 17029 |
(minus:QI (const_int 64) (match_dup 2))))) |
| 17030 |
(clobber (reg:CC FLAGS_REG))] |
| 17031 |
"TARGET_64BIT && ix86_pre_reload_split ()" |
| 17032 |
"#" |
| 17033 |
"&& 1" |
| 17034 |
[(parallel [(set (match_dup 0) |
| 17035 |
(ior:DI (lshiftrt:DI (match_dup 0) |
| 17036 |
(and:QI (match_dup 2) (const_int 63))) |
| 17037 |
(subreg:DI |
| 17038 |
(ashift:TI |
| 17039 |
(zero_extend:TI (match_dup 1)) |
| 17040 |
(minus:QI (const_int 64) |
| 17041 |
(and:QI (match_dup 2) |
| 17042 |
(const_int 63)))) 0))) |
| 17043 |
(clobber (reg:CC FLAGS_REG))])]) |
| 17044 |
|
| 17045 |
(define_insn_and_split "*x86_64_shrd_ndd_2" |
| 17046 |
[(set (match_operand:DI 0 "register_operand") |
| 17047 |
(ior:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand") |
| 17048 |
(match_operand:QI 3 "nonmemory_operand")) |
| 17049 |
(ashift:DI (match_operand:DI 2 "register_operand") |
| 17050 |
(minus:QI (const_int 64) (match_dup 2))))) |
| 17051 |
(clobber (reg:CC FLAGS_REG))] |
| 17052 |
"TARGET_APX_NDD |
| 17053 |
&& ix86_pre_reload_split ()" |
| 17054 |
"#" |
| 17055 |
"&& 1" |
| 17056 |
[(parallel [(set (match_dup 0) |
| 17057 |
(ior:DI (lshiftrt:DI (match_dup 1) |
| 17058 |
(and:QI (match_dup 3) (const_int 63))) |
| 17059 |
(subreg:DI |
| 17060 |
(ashift:TI |
| 17061 |
(zero_extend:TI (match_dup 2)) |
| 17062 |
(minus:QI (const_int 64) |
| 17063 |
(and:QI (match_dup 3) |
| 17064 |
(const_int 63)))) 0))) |
| 17065 |
(clobber (reg:CC FLAGS_REG))])]) |
| 17066 |
|
| 17067 |
(define_insn "x86_shrd<nf_name>" |
| 17068 |
[(set (match_operand:SI 0 "nonimmediate_operand" "+r*m") |
| 17069 |
(ior:SI (lshiftrt:SI (match_dup 0) |
| 17070 |
(and:QI (match_operand:QI 2 "nonmemory_operand" "Ic") |
| 17071 |
(const_int 31))) |
| 17072 |
(subreg:SI |
| 17073 |
(ashift:DI |
| 17074 |
(zero_extend:DI |
| 17075 |
(match_operand:SI 1 "register_operand" "r")) |
| 17076 |
(minus:QI (const_int 32) |
| 17077 |
(and:QI (match_dup 2) (const_int 31)))) 0)))] |
| 17078 |
"<nf_condition>" |
| 17079 |
"<nf_prefix>shrd{l}\t{%2, %1, %0|%0, %1, %2}" |
| 17080 |
[(set_attr "type" "ishift") |
| 17081 |
(set_attr "prefix_0f" "1") |
| 17082 |
(set_attr "has_nf" "1") |
| 17083 |
(set_attr "mode" "SI") |
| 17084 |
(set_attr "pent_pair" "np") |
| 17085 |
(set_attr "athlon_decode" "vector") |
| 17086 |
(set_attr "amdfam10_decode" "vector") |
| 17087 |
(set_attr "bdver1_decode" "vector")]) |
| 17088 |
|
| 17089 |
(define_insn "x86_shrd_ndd<nf_name>" |
| 17090 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 17091 |
(ior:SI (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 17092 |
(and:QI (match_operand:QI 3 "nonmemory_operand" "Ic") |
| 17093 |
(const_int 31))) |
| 17094 |
(subreg:SI |
| 17095 |
(ashift:DI |
| 17096 |
(zero_extend:DI |
| 17097 |
(match_operand:SI 2 "register_operand" "r")) |
| 17098 |
(minus:QI (const_int 32) |
| 17099 |
(and:QI (match_dup 3) (const_int 31)))) 0)))] |
| 17100 |
"TARGET_APX_NDD && <nf_condition>" |
| 17101 |
"<nf_prefix>shrd{l}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 17102 |
[(set_attr "type" "ishift") |
| 17103 |
(set_attr "has_nf" "1") |
| 17104 |
(set_attr "mode" "SI")]) |
| 17105 |
|
| 17106 |
(define_insn "x86_shrd_1<nf_name>" |
| 17107 |
[(set (match_operand:SI 0 "nonimmediate_operand" "+r*m") |
| 17108 |
(ior:SI (lshiftrt:SI (match_dup 0) |
| 17109 |
(match_operand:QI 2 "const_0_to_31_operand")) |
| 17110 |
(subreg:SI |
| 17111 |
(ashift:DI |
| 17112 |
(zero_extend:DI |
| 17113 |
(match_operand:SI 1 "register_operand" "r")) |
| 17114 |
(match_operand:QI 3 "const_0_to_63_operand")) 0)))] |
| 17115 |
"INTVAL (operands[3]) == 32 - INTVAL (operands[2]) |
| 17116 |
&& <nf_condition>" |
| 17117 |
"<nf_prefix>shrd{l}\t{%2, %1, %0|%0, %1, %2}" |
| 17118 |
[(set_attr "type" "ishift") |
| 17119 |
(set_attr "prefix_0f" "1") |
| 17120 |
(set_attr "length_immediate" "1") |
| 17121 |
(set_attr "has_nf" "1") |
| 17122 |
(set_attr "mode" "SI") |
| 17123 |
(set_attr "pent_pair" "np") |
| 17124 |
(set_attr "athlon_decode" "vector") |
| 17125 |
(set_attr "amdfam10_decode" "vector") |
| 17126 |
(set_attr "bdver1_decode" "vector")]) |
| 17127 |
|
| 17128 |
(define_insn "x86_shrd_ndd_1<nf_name>" |
| 17129 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 17130 |
(ior:SI (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 17131 |
(match_operand:QI 3 "const_0_to_31_operand")) |
| 17132 |
(subreg:SI |
| 17133 |
(ashift:DI |
| 17134 |
(zero_extend:DI |
| 17135 |
(match_operand:SI 2 "register_operand" "r")) |
| 17136 |
(match_operand:QI 4 "const_0_to_63_operand")) 0)))] |
| 17137 |
"TARGET_APX_NDD |
| 17138 |
&& (INTVAL (operands[4]) == 32 - INTVAL (operands[3])) |
| 17139 |
&& <nf_condition>" |
| 17140 |
"<nf_prefix>shrd{l}\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 17141 |
[(set_attr "type" "ishift") |
| 17142 |
(set_attr "length_immediate" "1") |
| 17143 |
(set_attr "has_nf" "1") |
| 17144 |
(set_attr "mode" "SI")]) |
| 17145 |
|
| 17146 |
(define_insn_and_split "*x86_shrd_shld_1_nozext_nf" |
| 17147 |
[(set (match_operand:SI 0 "nonimmediate_operand") |
| 17148 |
(ior:SI (lshiftrt:SI (match_operand:SI 4 "nonimmediate_operand") |
| 17149 |
(match_operand:QI 2 "const_0_to_31_operand")) |
| 17150 |
(ashift:SI |
| 17151 |
(match_operand:SI 1 "nonimmediate_operand") |
| 17152 |
(match_operand:QI 3 "const_0_to_31_operand"))))] |
| 17153 |
"TARGET_APX_NF |
| 17154 |
&& INTVAL (operands[3]) == 32 - INTVAL (operands[2]) |
| 17155 |
&& ix86_pre_reload_split ()" |
| 17156 |
"#" |
| 17157 |
"&& 1" |
| 17158 |
[(const_int 0)] |
| 17159 |
{ |
| 17160 |
if (rtx_equal_p (operands[4], operands[0])) |
| 17161 |
{ |
| 17162 |
operands[1] = force_reg (SImode, operands[1]); |
| 17163 |
emit_insn (gen_x86_shrd_1_nf (operands[0], operands[1], |
| 17164 |
operands[2], operands[3])); |
| 17165 |
} |
| 17166 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 17167 |
{ |
| 17168 |
operands[4] = force_reg (SImode, operands[4]); |
| 17169 |
emit_insn (gen_x86_shld_1_nf (operands[0], operands[4], |
| 17170 |
operands[3], operands[2])); |
| 17171 |
} |
| 17172 |
else if (TARGET_APX_NDD) |
| 17173 |
{ |
| 17174 |
rtx tmp = gen_reg_rtx (SImode); |
| 17175 |
if (MEM_P (operands[4])) |
| 17176 |
{ |
| 17177 |
operands[1] = force_reg (SImode, operands[1]); |
| 17178 |
emit_insn (gen_x86_shrd_ndd_1_nf (tmp, operands[4], operands[1], |
| 17179 |
operands[2], operands[3])); |
| 17180 |
} |
| 17181 |
else if (MEM_P (operands[1])) |
| 17182 |
emit_insn (gen_x86_shld_ndd_1_nf (tmp, operands[1], operands[4], |
| 17183 |
operands[3], operands[2])); |
| 17184 |
else |
| 17185 |
emit_insn (gen_x86_shrd_ndd_1_nf (tmp, operands[4], operands[1], |
| 17186 |
operands[2], operands[3])); |
| 17187 |
emit_move_insn (operands[0], tmp); |
| 17188 |
} |
| 17189 |
else |
| 17190 |
{ |
| 17191 |
operands[1] = force_reg (SImode, operands[1]); |
| 17192 |
rtx tmp = gen_reg_rtx (SImode); |
| 17193 |
emit_move_insn (tmp, operands[4]); |
| 17194 |
emit_insn (gen_x86_shrd_1_nf (tmp, operands[1], operands[2], |
| 17195 |
operands[3])); |
| 17196 |
emit_move_insn (operands[0], tmp); |
| 17197 |
} |
| 17198 |
DONE; |
| 17199 |
}) |
| 17200 |
|
| 17201 |
(define_insn_and_split "*x86_shrd_shld_1_nozext" |
| 17202 |
[(set (match_operand:SI 0 "nonimmediate_operand") |
| 17203 |
(ior:SI (lshiftrt:SI (match_operand:SI 4 "nonimmediate_operand") |
| 17204 |
(match_operand:QI 2 "const_0_to_31_operand")) |
| 17205 |
(ashift:SI |
| 17206 |
(match_operand:SI 1 "nonimmediate_operand") |
| 17207 |
(match_operand:QI 3 "const_0_to_31_operand")))) |
| 17208 |
(clobber (reg:CC FLAGS_REG))] |
| 17209 |
"INTVAL (operands[3]) == 32 - INTVAL (operands[2]) |
| 17210 |
&& ix86_pre_reload_split ()" |
| 17211 |
"#" |
| 17212 |
"&& 1" |
| 17213 |
[(const_int 0)] |
| 17214 |
{ |
| 17215 |
if (rtx_equal_p (operands[4], operands[0])) |
| 17216 |
{ |
| 17217 |
operands[1] = force_reg (SImode, operands[1]); |
| 17218 |
emit_insn (gen_x86_shrd_1 (operands[0], operands[1], operands[2], operands[3])); |
| 17219 |
} |
| 17220 |
else if (rtx_equal_p (operands[1], operands[0])) |
| 17221 |
{ |
| 17222 |
operands[4] = force_reg (SImode, operands[4]); |
| 17223 |
emit_insn (gen_x86_shld_1 (operands[0], operands[4], operands[3], operands[2])); |
| 17224 |
} |
| 17225 |
else if (TARGET_APX_NDD) |
| 17226 |
{ |
| 17227 |
rtx tmp = gen_reg_rtx (SImode); |
| 17228 |
if (MEM_P (operands[4])) |
| 17229 |
{ |
| 17230 |
operands[1] = force_reg (SImode, operands[1]); |
| 17231 |
emit_insn (gen_x86_shrd_ndd_1 (tmp, operands[4], operands[1], |
| 17232 |
operands[2], operands[3])); |
| 17233 |
} |
| 17234 |
else if (MEM_P (operands[1])) |
| 17235 |
emit_insn (gen_x86_shld_ndd_1 (tmp, operands[1], operands[4], |
| 17236 |
operands[3], operands[2])); |
| 17237 |
else |
| 17238 |
emit_insn (gen_x86_shrd_ndd_1 (tmp, operands[4], operands[1], |
| 17239 |
operands[2], operands[3])); |
| 17240 |
emit_move_insn (operands[0], tmp); |
| 17241 |
} |
| 17242 |
else |
| 17243 |
{ |
| 17244 |
operands[1] = force_reg (SImode, operands[1]); |
| 17245 |
rtx tmp = gen_reg_rtx (SImode); |
| 17246 |
emit_move_insn (tmp, operands[4]); |
| 17247 |
emit_insn (gen_x86_shrd_1 (tmp, operands[1], operands[2], operands[3])); |
| 17248 |
emit_move_insn (operands[0], tmp); |
| 17249 |
} |
| 17250 |
DONE; |
| 17251 |
} |
| 17252 |
[(set_attr "has_nf" "1")]) |
| 17253 |
|
| 17254 |
(define_insn_and_split "*x86_shrd_2" |
| 17255 |
[(set (match_operand:SI 0 "nonimmediate_operand") |
| 17256 |
(ior:SI (lshiftrt:SI (match_dup 0) |
| 17257 |
(match_operand:QI 2 "nonmemory_operand")) |
| 17258 |
(ashift:SI (match_operand:SI 1 "register_operand") |
| 17259 |
(minus:QI (const_int 32) (match_dup 2))))) |
| 17260 |
(clobber (reg:CC FLAGS_REG))] |
| 17261 |
"TARGET_64BIT && ix86_pre_reload_split ()" |
| 17262 |
"#" |
| 17263 |
"&& 1" |
| 17264 |
[(parallel [(set (match_dup 0) |
| 17265 |
(ior:SI (lshiftrt:SI (match_dup 0) |
| 17266 |
(and:QI (match_dup 2) (const_int 31))) |
| 17267 |
(subreg:SI |
| 17268 |
(ashift:DI |
| 17269 |
(zero_extend:DI (match_dup 1)) |
| 17270 |
(minus:QI (const_int 32) |
| 17271 |
(and:QI (match_dup 2) |
| 17272 |
(const_int 31)))) 0))) |
| 17273 |
(clobber (reg:CC FLAGS_REG))])]) |
| 17274 |
|
| 17275 |
(define_insn_and_split "*x86_shrd_ndd_2" |
| 17276 |
[(set (match_operand:SI 0 "register_operand") |
| 17277 |
(ior:SI (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand") |
| 17278 |
(match_operand:QI 3 "nonmemory_operand")) |
| 17279 |
(ashift:SI (match_operand:SI 2 "register_operand") |
| 17280 |
(minus:QI (const_int 32) (match_dup 3))))) |
| 17281 |
(clobber (reg:CC FLAGS_REG))] |
| 17282 |
"TARGET_APX_NDD |
| 17283 |
&& ix86_pre_reload_split ()" |
| 17284 |
"#" |
| 17285 |
"&& 1" |
| 17286 |
[(parallel [(set (match_dup 0) |
| 17287 |
(ior:SI (lshiftrt:SI (match_dup 1) |
| 17288 |
(and:QI (match_dup 3) (const_int 31))) |
| 17289 |
(subreg:SI |
| 17290 |
(ashift:DI |
| 17291 |
(zero_extend:DI (match_dup 2)) |
| 17292 |
(minus:QI (const_int 32) |
| 17293 |
(and:QI (match_dup 3) |
| 17294 |
(const_int 31)))) 0))) |
| 17295 |
(clobber (reg:CC FLAGS_REG))])]) |
| 17296 |
|
| 17297 |
;; Base name for insn mnemonic. |
| 17298 |
(define_mode_attr cvt_mnemonic |
| 17299 |
[(SI "{cltd|cdq}") (DI "{cqto|cqo}")]) |
| 17300 |
|
| 17301 |
(define_insn "ashr<mode>3_cvt<nf_name>" |
| 17302 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=*d,rm,r") |
| 17303 |
(ashiftrt:SWI48 |
| 17304 |
(match_operand:SWI48 1 "nonimmediate_operand" "*a,0,rm") |
| 17305 |
(match_operand:QI 2 "const_int_operand")))] |
| 17306 |
"INTVAL (operands[2]) == GET_MODE_BITSIZE (<MODE>mode)-1 |
| 17307 |
&& (TARGET_USE_CLTD || optimize_function_for_size_p (cfun)) |
| 17308 |
&& ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands, TARGET_APX_NDD) |
| 17309 |
&& <nf_condition>" |
| 17310 |
"@ |
| 17311 |
<cvt_mnemonic> |
| 17312 |
<nf_prefix>sar{<imodesuffix>}\t{%2, %0|%0, %2} |
| 17313 |
<nf_prefix>sar{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 17314 |
[(set_attr "isa" "*,*,apx_ndd") |
| 17315 |
(set_attr "type" "imovx,ishift,ishift") |
| 17316 |
(set_attr "prefix_0f" "0,*,*") |
| 17317 |
(set_attr "length_immediate" "0,*,*") |
| 17318 |
(set_attr "modrm" "0,1,1") |
| 17319 |
(set_attr "has_nf" "1") |
| 17320 |
(set_attr "mode" "<MODE>")]) |
| 17321 |
|
| 17322 |
(define_insn "*ashrsi3_cvt_zext" |
| 17323 |
[(set (match_operand:DI 0 "register_operand" "=*d,r,r") |
| 17324 |
(zero_extend:DI |
| 17325 |
(ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "*a,0,rm") |
| 17326 |
(match_operand:QI 2 "const_int_operand")))) |
| 17327 |
(clobber (reg:CC FLAGS_REG))] |
| 17328 |
"TARGET_64BIT && INTVAL (operands[2]) == 31 |
| 17329 |
&& (TARGET_USE_CLTD || optimize_function_for_size_p (cfun)) |
| 17330 |
&& ix86_binary_operator_ok (ASHIFTRT, SImode, operands, TARGET_APX_NDD)" |
| 17331 |
"@ |
| 17332 |
{cltd|cdq} |
| 17333 |
sar{l}\t{%2, %k0|%k0, %2} |
| 17334 |
sar{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 17335 |
[(set_attr "isa" "*,*,apx_ndd") |
| 17336 |
(set_attr "type" "imovx,ishift,ishift") |
| 17337 |
(set_attr "prefix_0f" "0,*,*") |
| 17338 |
(set_attr "length_immediate" "0,*,*") |
| 17339 |
(set_attr "modrm" "0,1,1") |
| 17340 |
(set_attr "mode" "SI")]) |
| 17341 |
|
| 17342 |
(define_expand "@x86_shift<mode>_adj_3" |
| 17343 |
[(use (match_operand:SWI48 0 "register_operand")) |
| 17344 |
(use (match_operand:SWI48 1 "register_operand")) |
| 17345 |
(use (match_operand:QI 2 "register_operand"))] |
| 17346 |
"" |
| 17347 |
{ |
| 17348 |
rtx_code_label *label = gen_label_rtx (); |
| 17349 |
rtx tmp; |
| 17350 |
|
| 17351 |
emit_insn (gen_testqi_ccz_1 (operands[2], |
| 17352 |
GEN_INT (GET_MODE_BITSIZE (<MODE>mode)))); |
| 17353 |
|
| 17354 |
tmp = gen_rtx_REG (CCZmode, FLAGS_REG); |
| 17355 |
tmp = gen_rtx_EQ (VOIDmode, tmp, const0_rtx); |
| 17356 |
tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, |
| 17357 |
gen_rtx_LABEL_REF (VOIDmode, label), |
| 17358 |
pc_rtx); |
| 17359 |
tmp = emit_jump_insn (gen_rtx_SET (pc_rtx, tmp)); |
| 17360 |
JUMP_LABEL (tmp) = label; |
| 17361 |
|
| 17362 |
emit_move_insn (operands[0], operands[1]); |
| 17363 |
emit_insn (gen_ashr<mode>3_cvt (operands[1], operands[1], |
| 17364 |
GEN_INT (GET_MODE_BITSIZE (<MODE>mode)-1))); |
| 17365 |
emit_label (label); |
| 17366 |
LABEL_NUSES (label) = 1; |
| 17367 |
|
| 17368 |
DONE; |
| 17369 |
}) |
| 17370 |
|
| 17371 |
(define_insn "*bmi2_<insn><mode>3_1" |
| 17372 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 17373 |
(any_shiftrt:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 17374 |
(match_operand:SWI48 2 "register_operand" "r")))] |
| 17375 |
"TARGET_BMI2" |
| 17376 |
"<shift>x\t{%2, %1, %0|%0, %1, %2}" |
| 17377 |
[(set_attr "type" "ishiftx") |
| 17378 |
(set_attr "mode" "<MODE>")]) |
| 17379 |
|
| 17380 |
(define_insn "*ashr<mode>3_1<nf_name>" |
| 17381 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r") |
| 17382 |
(ashiftrt:SWI48 |
| 17383 |
(match_operand:SWI48 1 "nonimmediate_operand" "0,rm,rm") |
| 17384 |
(match_operand:QI 2 "nonmemory_operand" "c<S>,r,c<S>")))] |
| 17385 |
"ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands, TARGET_APX_NDD) |
| 17386 |
&& <nf_condition>" |
| 17387 |
{ |
| 17388 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17389 |
switch (get_attr_type (insn)) |
| 17390 |
{ |
| 17391 |
case TYPE_ISHIFTX: |
| 17392 |
return "#"; |
| 17393 |
|
| 17394 |
default: |
| 17395 |
if (operands[2] == const1_rtx |
| 17396 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17397 |
&& !use_ndd && !<nf_applied>) |
| 17398 |
return "sar{<imodesuffix>}\t%0"; |
| 17399 |
else |
| 17400 |
return use_ndd ? "<nf_prefix>sar{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 17401 |
: "<nf_prefix>sar{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 17402 |
} |
| 17403 |
} |
| 17404 |
[(set_attr "isa" "*,bmi2,apx_ndd") |
| 17405 |
(set_attr "type" "ishift,ishiftx,ishift") |
| 17406 |
(set (attr "length_immediate") |
| 17407 |
(if_then_else |
| 17408 |
(and (match_operand 2 "const1_operand") |
| 17409 |
(ior (match_test "TARGET_SHIFT1") |
| 17410 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17411 |
(const_string "0") |
| 17412 |
(const_string "*"))) |
| 17413 |
(set_attr "has_nf" "1") |
| 17414 |
(set_attr "mode" "<MODE>")]) |
| 17415 |
|
| 17416 |
;; Specialization of *lshr<mode>3_1 below, extracting the SImode |
| 17417 |
;; highpart of a DI to be extracted, but allowing it to be clobbered. |
| 17418 |
(define_insn_and_split "*highpartdisi2" |
| 17419 |
[(set (subreg:DI (match_operand:SI 0 "register_operand" "=r,x,?k,r") 0) |
| 17420 |
(lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,0,k,rm") |
| 17421 |
(const_int 32))) |
| 17422 |
(clobber (reg:CC FLAGS_REG))] |
| 17423 |
"TARGET_64BIT" |
| 17424 |
"#" |
| 17425 |
"&& reload_completed" |
| 17426 |
[(parallel |
| 17427 |
[(set (match_dup 0) (lshiftrt:DI (match_dup 1) (const_int 32))) |
| 17428 |
(clobber (reg:CC FLAGS_REG))])] |
| 17429 |
{ |
| 17430 |
if (SSE_REG_P (operands[0])) |
| 17431 |
{ |
| 17432 |
rtx tmp = gen_rtx_REG (V4SImode, REGNO (operands[0])); |
| 17433 |
emit_insn (gen_sse_shufps_v4si (tmp, tmp, tmp, |
| 17434 |
const1_rtx, const1_rtx, |
| 17435 |
GEN_INT (5), GEN_INT (5))); |
| 17436 |
DONE; |
| 17437 |
} |
| 17438 |
operands[0] = gen_rtx_REG (DImode, REGNO (operands[0])); |
| 17439 |
} |
| 17440 |
[(set_attr "isa" "*,*,*,apx_ndd")]) |
| 17441 |
|
| 17442 |
(define_insn "*lshr<mode>3_1<nf_name>" |
| 17443 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,?k,r") |
| 17444 |
(lshiftrt:SWI48 |
| 17445 |
(match_operand:SWI48 1 "nonimmediate_operand" "0,rm,k,rm") |
| 17446 |
(match_operand:QI 2 "nonmemory_operand" "c<S>,r,<KS>,c<S>")))] |
| 17447 |
"ix86_binary_operator_ok (LSHIFTRT, <MODE>mode, operands, TARGET_APX_NDD) |
| 17448 |
&& <nf_condition>" |
| 17449 |
{ |
| 17450 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17451 |
switch (get_attr_type (insn)) |
| 17452 |
{ |
| 17453 |
case TYPE_ISHIFTX: |
| 17454 |
case TYPE_MSKLOG: |
| 17455 |
return "#"; |
| 17456 |
|
| 17457 |
default: |
| 17458 |
if (operands[2] == const1_rtx |
| 17459 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17460 |
&& !use_ndd && !<nf_applied>) |
| 17461 |
return "shr{<imodesuffix>}\t%0"; |
| 17462 |
else |
| 17463 |
return use_ndd ? "<nf_prefix>shr{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 17464 |
: "<nf_prefix>shr{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 17465 |
} |
| 17466 |
} |
| 17467 |
[(set_attr "isa" "*,bmi2,avx512bw,apx_ndd") |
| 17468 |
(set_attr "type" "ishift,ishiftx,msklog,ishift") |
| 17469 |
(set (attr "length_immediate") |
| 17470 |
(if_then_else |
| 17471 |
(and (and (match_operand 2 "const1_operand") |
| 17472 |
(eq_attr "alternative" "0")) |
| 17473 |
(ior (match_test "TARGET_SHIFT1") |
| 17474 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17475 |
(const_string "0") |
| 17476 |
(const_string "*"))) |
| 17477 |
(set_attr "has_nf" "1") |
| 17478 |
(set_attr "mode" "<MODE>")]) |
| 17479 |
|
| 17480 |
;; Convert shift to the shiftx pattern to avoid flags dependency. |
| 17481 |
;; For NF/NDD doesn't support shift count as r, it just support c<S>, |
| 17482 |
;; and it has no flag. |
| 17483 |
(define_split |
| 17484 |
[(set (match_operand:SWI48 0 "register_operand") |
| 17485 |
(any_shiftrt:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 17486 |
(match_operand:QI 2 "register_operand")))] |
| 17487 |
"TARGET_BMI2 && reload_completed" |
| 17488 |
[(set (match_dup 0) |
| 17489 |
(any_shiftrt:SWI48 (match_dup 1) (match_dup 2)))] |
| 17490 |
"operands[2] = gen_lowpart (<MODE>mode, operands[2]);") |
| 17491 |
|
| 17492 |
(define_split |
| 17493 |
[(set (match_operand:SWI48 0 "register_operand") |
| 17494 |
(any_shiftrt:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 17495 |
(match_operand:QI 2 "register_operand"))) |
| 17496 |
(clobber (reg:CC FLAGS_REG))] |
| 17497 |
"TARGET_BMI2 && reload_completed" |
| 17498 |
[(set (match_dup 0) |
| 17499 |
(any_shiftrt:SWI48 (match_dup 1) (match_dup 2)))] |
| 17500 |
"operands[2] = gen_lowpart (<MODE>mode, operands[2]);") |
| 17501 |
|
| 17502 |
(define_insn "*bmi2_<insn>si3_1_zext" |
| 17503 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 17504 |
(zero_extend:DI |
| 17505 |
(any_shiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 17506 |
(match_operand:SI 2 "register_operand" "r"))))] |
| 17507 |
"TARGET_64BIT && TARGET_BMI2" |
| 17508 |
"<shift>x\t{%2, %1, %k0|%k0, %1, %2}" |
| 17509 |
[(set_attr "type" "ishiftx") |
| 17510 |
(set_attr "mode" "SI")]) |
| 17511 |
|
| 17512 |
(define_insn "*<insn>qi3_1_zext<mode><nf_name>" |
| 17513 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 17514 |
(zero_extend:SWI248x |
| 17515 |
(any_shiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "rm") |
| 17516 |
(match_operand:QI 2 "nonmemory_operand" "cI"))))] |
| 17517 |
"TARGET_APX_NDD && <nf_condition>" |
| 17518 |
"<nf_prefix><shift>{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 17519 |
[(set_attr "type" "ishift") |
| 17520 |
(set_attr "has_nf" "1") |
| 17521 |
(set_attr "mode" "QI")]) |
| 17522 |
|
| 17523 |
(define_insn "*<insn>hi3_1_zext<mode><nf_name>" |
| 17524 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 17525 |
(zero_extend:SWI48x |
| 17526 |
(any_shiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "rm") |
| 17527 |
(match_operand:QI 2 "nonmemory_operand" "cI"))))] |
| 17528 |
"TARGET_APX_NDD && <nf_condition>" |
| 17529 |
"<nf_prefix><shift>{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 17530 |
[(set_attr "type" "ishift") |
| 17531 |
(set_attr "has_nf" "1") |
| 17532 |
(set_attr "mode" "HI")]) |
| 17533 |
|
| 17534 |
(define_insn "*<insn>si3_1_zext" |
| 17535 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,?k") |
| 17536 |
(zero_extend:DI |
| 17537 |
(any_shiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm,rm,k") |
| 17538 |
(match_operand:QI 2 "nonmemory_operand" "cI,r,cI,I")))) |
| 17539 |
(clobber (reg:CC FLAGS_REG))] |
| 17540 |
"TARGET_64BIT |
| 17541 |
&& ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" |
| 17542 |
{ |
| 17543 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17544 |
switch (get_attr_type (insn)) |
| 17545 |
{ |
| 17546 |
case TYPE_ISHIFTX: |
| 17547 |
return "#"; |
| 17548 |
|
| 17549 |
case TYPE_MSKLOG: |
| 17550 |
return "#"; |
| 17551 |
default: |
| 17552 |
if (operands[2] == const1_rtx |
| 17553 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17554 |
&& !use_ndd) |
| 17555 |
return "<shift>{l}\t%k0"; |
| 17556 |
else |
| 17557 |
return use_ndd ? "<shift>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 17558 |
: "<shift>{l}\t{%2, %k0|%k0, %2}"; |
| 17559 |
} |
| 17560 |
} |
| 17561 |
[(set_attr "isa" "*,bmi2,apx_ndd,avx512bw") |
| 17562 |
(set_attr "type" "ishift,ishiftx,ishift,msklog") |
| 17563 |
(set (attr "length_immediate") |
| 17564 |
(if_then_else |
| 17565 |
(and (match_operand 2 "const1_operand") |
| 17566 |
(ior (match_test "TARGET_SHIFT1") |
| 17567 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17568 |
(const_string "0") |
| 17569 |
(const_string "*"))) |
| 17570 |
(set_attr "mode" "SI") |
| 17571 |
(set (attr "enabled") |
| 17572 |
(if_then_else |
| 17573 |
(eq_attr "alternative" "3") |
| 17574 |
(symbol_ref "<CODE> == LSHIFTRT && TARGET_AVX512BW") |
| 17575 |
(const_string "*")))]) |
| 17576 |
|
| 17577 |
;; Convert shift to the shiftx pattern to avoid flags dependency. |
| 17578 |
(define_split |
| 17579 |
[(set (match_operand:DI 0 "register_operand") |
| 17580 |
(zero_extend:DI |
| 17581 |
(any_shiftrt:SI (match_operand:SI 1 "nonimmediate_operand") |
| 17582 |
(match_operand:QI 2 "register_operand")))) |
| 17583 |
(clobber (reg:CC FLAGS_REG))] |
| 17584 |
"TARGET_64BIT && TARGET_BMI2 && reload_completed" |
| 17585 |
[(set (match_dup 0) |
| 17586 |
(zero_extend:DI (any_shiftrt:SI (match_dup 1) (match_dup 2))))] |
| 17587 |
"operands[2] = gen_lowpart (SImode, operands[2]);") |
| 17588 |
|
| 17589 |
(define_insn "*ashr<mode>3_1<nf_name>" |
| 17590 |
[(set (match_operand:SWI12 0 "nonimmediate_operand" "=<r>m, r") |
| 17591 |
(ashiftrt:SWI12 |
| 17592 |
(match_operand:SWI12 1 "nonimmediate_operand" "0, rm") |
| 17593 |
(match_operand:QI 2 "nonmemory_operand" "c<S>, c<S>")))] |
| 17594 |
"ix86_binary_operator_ok (ASHIFTRT, <MODE>mode, operands, TARGET_APX_NDD) |
| 17595 |
&& <nf_condition>" |
| 17596 |
{ |
| 17597 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17598 |
if (operands[2] == const1_rtx |
| 17599 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17600 |
&& !use_ndd && !<nf_applied>) |
| 17601 |
return "sar{<imodesuffix>}\t%0"; |
| 17602 |
else |
| 17603 |
return use_ndd ? "<nf_prefix>sar{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 17604 |
: "<nf_prefix>sar{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 17605 |
} |
| 17606 |
[(set_attr "isa" "*, apx_ndd") |
| 17607 |
(set_attr "type" "ishift") |
| 17608 |
(set (attr "length_immediate") |
| 17609 |
(if_then_else |
| 17610 |
(and (match_operand 2 "const1_operand") |
| 17611 |
(ior (match_test "TARGET_SHIFT1") |
| 17612 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17613 |
(const_string "0") |
| 17614 |
(const_string "*"))) |
| 17615 |
(set_attr "has_nf" "1") |
| 17616 |
(set_attr "mode" "<MODE>")]) |
| 17617 |
|
| 17618 |
(define_insn "*lshrqi3_1<nf_name>" |
| 17619 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm,?k,r") |
| 17620 |
(lshiftrt:QI |
| 17621 |
(match_operand:QI 1 "nonimmediate_operand" "0, k, rm") |
| 17622 |
(match_operand:QI 2 "nonmemory_operand" "cI,Wb,cI")))] |
| 17623 |
"ix86_binary_operator_ok (LSHIFTRT, QImode, operands, TARGET_APX_NDD) |
| 17624 |
&& <nf_condition>" |
| 17625 |
{ |
| 17626 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17627 |
switch (get_attr_type (insn)) |
| 17628 |
{ |
| 17629 |
case TYPE_ISHIFT: |
| 17630 |
if (operands[2] == const1_rtx |
| 17631 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17632 |
&& !use_ndd && !<nf_applied>) |
| 17633 |
return "shr{b}\t%0"; |
| 17634 |
else |
| 17635 |
return use_ndd ? "<nf_prefix>shr{b}\t{%2, %1, %0|%0, %1, %2}" |
| 17636 |
: "<nf_prefix>shr{b}\t{%2, %0|%0, %2}"; |
| 17637 |
case TYPE_MSKLOG: |
| 17638 |
return "#"; |
| 17639 |
default: |
| 17640 |
gcc_unreachable (); |
| 17641 |
} |
| 17642 |
} |
| 17643 |
[(set_attr "isa" "*,avx512dq,apx_ndd") |
| 17644 |
(set_attr "type" "ishift,msklog,ishift") |
| 17645 |
(set (attr "length_immediate") |
| 17646 |
(if_then_else |
| 17647 |
(and (and (match_operand 2 "const1_operand") |
| 17648 |
(eq_attr "alternative" "0")) |
| 17649 |
(ior (match_test "TARGET_SHIFT1") |
| 17650 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17651 |
(const_string "0") |
| 17652 |
(const_string "*"))) |
| 17653 |
(set_attr "has_nf" "1") |
| 17654 |
(set_attr "mode" "QI")]) |
| 17655 |
|
| 17656 |
(define_insn "*lshrhi3_1<nf_name>" |
| 17657 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=rm, ?k, r") |
| 17658 |
(lshiftrt:HI |
| 17659 |
(match_operand:HI 1 "nonimmediate_operand" "0, k, rm") |
| 17660 |
(match_operand:QI 2 "nonmemory_operand" "cI, Ww, cI")))] |
| 17661 |
"ix86_binary_operator_ok (LSHIFTRT, HImode, operands, TARGET_APX_NDD) |
| 17662 |
&& <nf_condition>" |
| 17663 |
{ |
| 17664 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17665 |
switch (get_attr_type (insn)) |
| 17666 |
{ |
| 17667 |
case TYPE_ISHIFT: |
| 17668 |
if (operands[2] == const1_rtx |
| 17669 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17670 |
&& !use_ndd && !<nf_applied>) |
| 17671 |
return "shr{w}\t%0"; |
| 17672 |
else |
| 17673 |
return use_ndd ? "<nf_prefix>shr{w}\t{%2, %1, %0|%0, %1, %2}" |
| 17674 |
: "<nf_prefix>shr{w}\t{%2, %0|%0, %2}"; |
| 17675 |
case TYPE_MSKLOG: |
| 17676 |
return "#"; |
| 17677 |
default: |
| 17678 |
gcc_unreachable (); |
| 17679 |
} |
| 17680 |
} |
| 17681 |
[(set_attr "isa" "*, avx512f, apx_ndd") |
| 17682 |
(set_attr "type" "ishift,msklog,ishift") |
| 17683 |
(set (attr "length_immediate") |
| 17684 |
(if_then_else |
| 17685 |
(and (and (match_operand 2 "const1_operand") |
| 17686 |
(eq_attr "alternative" "0")) |
| 17687 |
(ior (match_test "TARGET_SHIFT1") |
| 17688 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17689 |
(const_string "0") |
| 17690 |
(const_string "*"))) |
| 17691 |
(set_attr "has_nf" "1") |
| 17692 |
(set_attr "mode" "HI")]) |
| 17693 |
|
| 17694 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 17695 |
(define_insn_and_split "*<insn><mode>3_1_slp" |
| 17696 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 17697 |
(any_shiftrt:SWI12 (match_operand:SWI12 1 "register_operand" "0,!<r>") |
| 17698 |
(match_operand:QI 2 "nonmemory_operand" "cI,cI"))) |
| 17699 |
(clobber (reg:CC FLAGS_REG))] |
| 17700 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 17701 |
{ |
| 17702 |
if (which_alternative) |
| 17703 |
return "#"; |
| 17704 |
|
| 17705 |
if (operands[2] == const1_rtx |
| 17706 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun))) |
| 17707 |
return "<shift>{<imodesuffix>}\t%0"; |
| 17708 |
else |
| 17709 |
return "<shift>{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 17710 |
} |
| 17711 |
"&& reload_completed |
| 17712 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 17713 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 17714 |
(parallel |
| 17715 |
[(set (strict_low_part (match_dup 0)) |
| 17716 |
(any_shiftrt:SWI12 (match_dup 0) (match_dup 2))) |
| 17717 |
(clobber (reg:CC FLAGS_REG))])] |
| 17718 |
"" |
| 17719 |
[(set_attr "type" "ishift") |
| 17720 |
(set (attr "length_immediate") |
| 17721 |
(if_then_else |
| 17722 |
(and (match_operand 2 "const1_operand") |
| 17723 |
(ior (match_test "TARGET_SHIFT1") |
| 17724 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17725 |
(const_string "0") |
| 17726 |
(const_string "*"))) |
| 17727 |
(set_attr "mode" "<MODE>")]) |
| 17728 |
|
| 17729 |
;; This pattern can't accept a variable shift count, since shifts by |
| 17730 |
;; zero don't affect the flags. We assume that shifts by constant |
| 17731 |
;; zero are optimized away. |
| 17732 |
(define_insn "*<insn><mode>3_cmp" |
| 17733 |
[(set (reg FLAGS_REG) |
| 17734 |
(compare |
| 17735 |
(any_shiftrt:SWI |
| 17736 |
(match_operand:SWI 1 "nonimmediate_operand" "0,rm") |
| 17737 |
(match_operand:QI 2 "<shift_immediate_operand>" "<S>,<S>")) |
| 17738 |
(const_int 0))) |
| 17739 |
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,r") |
| 17740 |
(any_shiftrt:SWI (match_dup 1) (match_dup 2)))] |
| 17741 |
"(optimize_function_for_size_p (cfun) |
| 17742 |
|| !TARGET_PARTIAL_FLAG_REG_STALL |
| 17743 |
|| (operands[2] == const1_rtx |
| 17744 |
&& TARGET_SHIFT1)) |
| 17745 |
&& ix86_match_ccmode (insn, CCGOCmode) |
| 17746 |
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD)" |
| 17747 |
{ |
| 17748 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17749 |
if (operands[2] == const1_rtx |
| 17750 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17751 |
&& !use_ndd) |
| 17752 |
return "<shift>{<imodesuffix>}\t%0"; |
| 17753 |
else |
| 17754 |
return use_ndd ? "<shift>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 17755 |
: "<shift>{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 17756 |
} |
| 17757 |
[(set_attr "isa" "*,apx_ndd") |
| 17758 |
(set_attr "type" "ishift") |
| 17759 |
(set (attr "length_immediate") |
| 17760 |
(if_then_else |
| 17761 |
(and (match_operand 2 "const1_operand") |
| 17762 |
(ior (match_test "TARGET_SHIFT1") |
| 17763 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17764 |
(const_string "0") |
| 17765 |
(const_string "*"))) |
| 17766 |
(set_attr "mode" "<MODE>")]) |
| 17767 |
|
| 17768 |
(define_insn "*<insn>si3_cmp_zext" |
| 17769 |
[(set (reg FLAGS_REG) |
| 17770 |
(compare |
| 17771 |
(any_shiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm") |
| 17772 |
(match_operand:QI 2 "const_1_to_31_operand")) |
| 17773 |
(const_int 0))) |
| 17774 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 17775 |
(zero_extend:DI (any_shiftrt:SI (match_dup 1) (match_dup 2))))] |
| 17776 |
"TARGET_64BIT |
| 17777 |
&& (optimize_function_for_size_p (cfun) |
| 17778 |
|| !TARGET_PARTIAL_FLAG_REG_STALL |
| 17779 |
|| (operands[2] == const1_rtx |
| 17780 |
&& TARGET_SHIFT1)) |
| 17781 |
&& ix86_match_ccmode (insn, CCGOCmode) |
| 17782 |
&& ix86_binary_operator_ok (<CODE>, SImode, operands, TARGET_APX_NDD)" |
| 17783 |
{ |
| 17784 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17785 |
if (operands[2] == const1_rtx |
| 17786 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17787 |
&& !use_ndd) |
| 17788 |
return "<shift>{l}\t%k0"; |
| 17789 |
else |
| 17790 |
return use_ndd ? "<shift>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 17791 |
: "<shift>{l}\t{%2, %k0|%k0, %2}"; |
| 17792 |
} |
| 17793 |
[(set_attr "isa" "*,apx_ndd") |
| 17794 |
(set_attr "type" "ishift") |
| 17795 |
(set (attr "length_immediate") |
| 17796 |
(if_then_else |
| 17797 |
(and (match_operand 2 "const1_operand") |
| 17798 |
(ior (match_test "TARGET_SHIFT1") |
| 17799 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17800 |
(const_string "0") |
| 17801 |
(const_string "*"))) |
| 17802 |
(set_attr "mode" "SI")]) |
| 17803 |
|
| 17804 |
(define_insn "*<insn><mode>3_cconly" |
| 17805 |
[(set (reg FLAGS_REG) |
| 17806 |
(compare |
| 17807 |
(any_shiftrt:SWI |
| 17808 |
(match_operand:SWI 1 "nonimmediate_operand" "0,rm") |
| 17809 |
(match_operand:QI 2 "<shift_immediate_operand>" "<S>,<S>")) |
| 17810 |
(const_int 0))) |
| 17811 |
(clobber (match_scratch:SWI 0 "=<r>,r"))] |
| 17812 |
"(optimize_function_for_size_p (cfun) |
| 17813 |
|| !TARGET_PARTIAL_FLAG_REG_STALL |
| 17814 |
|| (operands[2] == const1_rtx |
| 17815 |
&& TARGET_SHIFT1)) |
| 17816 |
&& ix86_match_ccmode (insn, CCGOCmode)" |
| 17817 |
{ |
| 17818 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 17819 |
if (operands[2] == const1_rtx |
| 17820 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 17821 |
&& !use_ndd) |
| 17822 |
return "<shift>{<imodesuffix>}\t%0"; |
| 17823 |
else |
| 17824 |
return use_ndd |
| 17825 |
? "<shift>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 17826 |
: "<shift>{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 17827 |
} |
| 17828 |
[(set_attr "isa" "*,apx_ndd") |
| 17829 |
(set_attr "type" "ishift") |
| 17830 |
(set (attr "length_immediate") |
| 17831 |
(if_then_else |
| 17832 |
(and (match_operand 2 "const1_operand") |
| 17833 |
(ior (match_test "TARGET_SHIFT1") |
| 17834 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17835 |
(const_string "0") |
| 17836 |
(const_string "*"))) |
| 17837 |
(set_attr "mode" "<MODE>")]) |
| 17838 |
|
| 17839 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 17840 |
(define_insn_and_split "*<insn>qi_ext<mode>_1" |
| 17841 |
[(set (zero_extract:SWI248 |
| 17842 |
(match_operand 0 "int248_register_operand" "+Q,&Q") |
| 17843 |
(const_int 8) |
| 17844 |
(const_int 8)) |
| 17845 |
(subreg:SWI248 |
| 17846 |
(any_shiftrt:QI |
| 17847 |
(subreg:QI |
| 17848 |
(match_operator:SWI248 3 "extract_operator" |
| 17849 |
[(match_operand 1 "int248_register_operand" "0,!Q") |
| 17850 |
(const_int 8) |
| 17851 |
(const_int 8)]) 0) |
| 17852 |
(match_operand:QI 2 "nonmemory_operand" "cI,cI")) 0)) |
| 17853 |
(clobber (reg:CC FLAGS_REG))] |
| 17854 |
"" |
| 17855 |
{ |
| 17856 |
if (which_alternative) |
| 17857 |
return "#"; |
| 17858 |
|
| 17859 |
if (operands[2] == const1_rtx |
| 17860 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun))) |
| 17861 |
return "<shift>{b}\t%h0"; |
| 17862 |
else |
| 17863 |
return "<shift>{b}\t{%2, %h0|%h0, %2}"; |
| 17864 |
} |
| 17865 |
"reload_completed |
| 17866 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 17867 |
[(set (zero_extract:SWI248 |
| 17868 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 17869 |
(zero_extract:SWI248 |
| 17870 |
(match_dup 1) (const_int 8) (const_int 8))) |
| 17871 |
(parallel |
| 17872 |
[(set (zero_extract:SWI248 |
| 17873 |
(match_dup 0) (const_int 8) (const_int 8)) |
| 17874 |
(subreg:SWI248 |
| 17875 |
(any_shiftrt:QI |
| 17876 |
(subreg:QI |
| 17877 |
(match_op_dup 3 |
| 17878 |
[(match_dup 0) (const_int 8) (const_int 8)]) 0) |
| 17879 |
(match_dup 2)) 0)) |
| 17880 |
(clobber (reg:CC FLAGS_REG))])] |
| 17881 |
"" |
| 17882 |
[(set_attr "type" "ishift") |
| 17883 |
(set (attr "length_immediate") |
| 17884 |
(if_then_else |
| 17885 |
(and (match_operand 2 "const1_operand") |
| 17886 |
(ior (match_test "TARGET_SHIFT1") |
| 17887 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 17888 |
(const_string "0") |
| 17889 |
(const_string "*"))) |
| 17890 |
(set_attr "mode" "QI")]) |
| 17891 |
|
| 17892 |
;; Avoid useless masking of count operand. |
| 17893 |
(define_insn_and_split "*<insn><mode>3_mask" |
| 17894 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 17895 |
(any_shift:SWI48 |
| 17896 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 17897 |
(subreg:QI |
| 17898 |
(and |
| 17899 |
(match_operand 2 "int248_register_operand" "c,r") |
| 17900 |
(match_operand 3 "const_int_operand")) 0))) |
| 17901 |
(clobber (reg:CC FLAGS_REG))] |
| 17902 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 17903 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) |
| 17904 |
== <MODE_SIZE> * BITS_PER_UNIT - 1 |
| 17905 |
&& ix86_pre_reload_split ()" |
| 17906 |
"#" |
| 17907 |
"&& 1" |
| 17908 |
[(parallel |
| 17909 |
[(set (match_dup 0) |
| 17910 |
(any_shift:SWI48 (match_dup 1) |
| 17911 |
(match_dup 2))) |
| 17912 |
(clobber (reg:CC FLAGS_REG))])] |
| 17913 |
{ |
| 17914 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 17915 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 17916 |
} |
| 17917 |
[(set_attr "isa" "*,bmi2")]) |
| 17918 |
|
| 17919 |
(define_insn_and_split "*<insn><mode>3_mask_1" |
| 17920 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 17921 |
(any_shift:SWI48 |
| 17922 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 17923 |
(and:QI |
| 17924 |
(match_operand:QI 2 "register_operand" "c,r") |
| 17925 |
(match_operand:QI 3 "const_int_operand")))) |
| 17926 |
(clobber (reg:CC FLAGS_REG))] |
| 17927 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 17928 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) |
| 17929 |
== <MODE_SIZE> * BITS_PER_UNIT - 1 |
| 17930 |
&& ix86_pre_reload_split ()" |
| 17931 |
"#" |
| 17932 |
"&& 1" |
| 17933 |
[(parallel |
| 17934 |
[(set (match_dup 0) |
| 17935 |
(any_shift:SWI48 (match_dup 1) |
| 17936 |
(match_dup 2))) |
| 17937 |
(clobber (reg:CC FLAGS_REG))])] |
| 17938 |
"" |
| 17939 |
[(set_attr "isa" "*,bmi2")]) |
| 17940 |
|
| 17941 |
(define_insn_and_split "*<insn><mode>3_add" |
| 17942 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 17943 |
(any_shift:SWI48 |
| 17944 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 17945 |
(subreg:QI |
| 17946 |
(plus |
| 17947 |
(match_operand 2 "int248_register_operand" "c,r") |
| 17948 |
(match_operand 3 "const_int_operand")) 0))) |
| 17949 |
(clobber (reg:CC FLAGS_REG))] |
| 17950 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 17951 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 17952 |
&& ix86_pre_reload_split ()" |
| 17953 |
"#" |
| 17954 |
"&& 1" |
| 17955 |
[(parallel |
| 17956 |
[(set (match_dup 0) |
| 17957 |
(any_shift:SWI48 (match_dup 1) |
| 17958 |
(match_dup 2))) |
| 17959 |
(clobber (reg:CC FLAGS_REG))])] |
| 17960 |
{ |
| 17961 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 17962 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 17963 |
} |
| 17964 |
[(set_attr "isa" "*,bmi2")]) |
| 17965 |
|
| 17966 |
(define_insn_and_split "*<insn><mode>3_add_1" |
| 17967 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 17968 |
(any_shift:SWI48 |
| 17969 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 17970 |
(plus:QI |
| 17971 |
(match_operand:QI 2 "register_operand" "c,r") |
| 17972 |
(match_operand:QI 3 "const_int_operand")))) |
| 17973 |
(clobber (reg:CC FLAGS_REG))] |
| 17974 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 17975 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 17976 |
&& ix86_pre_reload_split ()" |
| 17977 |
"#" |
| 17978 |
"&& 1" |
| 17979 |
[(parallel |
| 17980 |
[(set (match_dup 0) |
| 17981 |
(any_shift:SWI48 (match_dup 1) |
| 17982 |
(match_dup 2))) |
| 17983 |
(clobber (reg:CC FLAGS_REG))])] |
| 17984 |
"" |
| 17985 |
[(set_attr "isa" "*,bmi2")]) |
| 17986 |
|
| 17987 |
(define_insn_and_split "*<insn><mode>3_sub" |
| 17988 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 17989 |
(any_shift:SWI48 |
| 17990 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 17991 |
(subreg:QI |
| 17992 |
(minus |
| 17993 |
(match_operand 3 "const_int_operand") |
| 17994 |
(match_operand 2 "int248_register_operand" "c,r")) 0))) |
| 17995 |
(clobber (reg:CC FLAGS_REG))] |
| 17996 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 17997 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 17998 |
&& ix86_pre_reload_split ()" |
| 17999 |
"#" |
| 18000 |
"&& 1" |
| 18001 |
[(parallel |
| 18002 |
[(set (match_dup 4) |
| 18003 |
(neg:QI (match_dup 2))) |
| 18004 |
(clobber (reg:CC FLAGS_REG))]) |
| 18005 |
(parallel |
| 18006 |
[(set (match_dup 0) |
| 18007 |
(any_shift:SWI48 (match_dup 1) |
| 18008 |
(match_dup 4))) |
| 18009 |
(clobber (reg:CC FLAGS_REG))])] |
| 18010 |
{ |
| 18011 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 18012 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 18013 |
|
| 18014 |
operands[4] = gen_reg_rtx (QImode); |
| 18015 |
} |
| 18016 |
[(set_attr "isa" "*,bmi2")]) |
| 18017 |
|
| 18018 |
(define_insn_and_split "*<insn><mode>3_sub_1" |
| 18019 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 18020 |
(any_shift:SWI48 |
| 18021 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 18022 |
(minus:QI |
| 18023 |
(match_operand:QI 3 "const_int_operand") |
| 18024 |
(match_operand:QI 2 "register_operand" "c,r")))) |
| 18025 |
(clobber (reg:CC FLAGS_REG))] |
| 18026 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18027 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 18028 |
&& ix86_pre_reload_split ()" |
| 18029 |
"#" |
| 18030 |
"&& 1" |
| 18031 |
[(parallel |
| 18032 |
[(set (match_dup 4) |
| 18033 |
(neg:QI (match_dup 2))) |
| 18034 |
(clobber (reg:CC FLAGS_REG))]) |
| 18035 |
(parallel |
| 18036 |
[(set (match_dup 0) |
| 18037 |
(any_shift:SWI48 (match_dup 1) |
| 18038 |
(match_dup 4))) |
| 18039 |
(clobber (reg:CC FLAGS_REG))])] |
| 18040 |
"operands[4] = gen_reg_rtx (QImode);" |
| 18041 |
[(set_attr "isa" "*,bmi2")]) |
| 18042 |
|
| 18043 |
(define_insn_and_split "*extend<dwi>2_doubleword_highpart" |
| 18044 |
[(set (match_operand:<DWI> 0 "register_operand" "=r") |
| 18045 |
(ashiftrt:<DWI> |
| 18046 |
(ashift:<DWI> (match_operand:<DWI> 1 "nonimmediate_operand" "0") |
| 18047 |
(match_operand:QI 2 "const_int_operand")) |
| 18048 |
(match_operand:QI 3 "const_int_operand"))) |
| 18049 |
(clobber (reg:CC FLAGS_REG))] |
| 18050 |
"INTVAL (operands[2]) == INTVAL (operands[3]) |
| 18051 |
&& UINTVAL (operands[2]) < <MODE_SIZE> * BITS_PER_UNIT" |
| 18052 |
"#" |
| 18053 |
"&& reload_completed" |
| 18054 |
[(parallel [(set (match_dup 4) |
| 18055 |
(ashift:DWIH (match_dup 4) (match_dup 2))) |
| 18056 |
(clobber (reg:CC FLAGS_REG))]) |
| 18057 |
(parallel [(set (match_dup 4) |
| 18058 |
(ashiftrt:DWIH (match_dup 4) (match_dup 2))) |
| 18059 |
(clobber (reg:CC FLAGS_REG))])] |
| 18060 |
"split_double_mode (<DWI>mode, &operands[0], 1, &operands[0], &operands[4]);") |
| 18061 |
|
| 18062 |
(define_insn_and_split "*extendv2di2_highpart_stv" |
| 18063 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 18064 |
(ashiftrt:V2DI |
| 18065 |
(ashift:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "vm") |
| 18066 |
(match_operand:QI 2 "const_int_operand")) |
| 18067 |
(match_operand:QI 3 "const_int_operand")))] |
| 18068 |
"!TARGET_64BIT && TARGET_STV && TARGET_AVX512VL |
| 18069 |
&& INTVAL (operands[2]) == INTVAL (operands[3]) |
| 18070 |
&& UINTVAL (operands[2]) < 32" |
| 18071 |
"#" |
| 18072 |
"&& reload_completed" |
| 18073 |
[(set (match_dup 0) |
| 18074 |
(ashift:V2DI (match_dup 1) (match_dup 2))) |
| 18075 |
(set (match_dup 0) |
| 18076 |
(ashiftrt:V2DI (match_dup 0) (match_dup 2)))]) |
| 18077 |
|
| 18078 |
;; Without AVX512VL, split this instruction before reload. |
| 18079 |
(define_insn_and_split "*extendv2di2_highpart_stv_noavx512vl" |
| 18080 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 18081 |
(ashiftrt:V2DI |
| 18082 |
(ashift:V2DI (match_operand:V2DI 1 "nonimmediate_operand" "vm") |
| 18083 |
(match_operand:QI 2 "const_int_operand")) |
| 18084 |
(match_operand:QI 3 "const_int_operand")))] |
| 18085 |
"!TARGET_AVX512VL |
| 18086 |
&& INTVAL (operands[2]) == INTVAL (operands[3]) |
| 18087 |
&& UINTVAL (operands[2]) < 32 |
| 18088 |
&& ix86_pre_reload_split ()" |
| 18089 |
"#" |
| 18090 |
"&& 1" |
| 18091 |
[(set (match_dup 4) |
| 18092 |
(ashift:V2DI (match_dup 1) (match_dup 2))) |
| 18093 |
(set (match_dup 0) |
| 18094 |
(ashiftrt:V2DI (match_dup 4) (match_dup 2)))] |
| 18095 |
{ |
| 18096 |
if (!TARGET_XOP) |
| 18097 |
{ |
| 18098 |
rtx op0 = operands[0]; |
| 18099 |
rtx op2 = operands[2]; |
| 18100 |
rtx tmp1 = gen_reg_rtx (V4SImode); |
| 18101 |
rtx tmp2 = gen_reg_rtx (V4SImode); |
| 18102 |
rtx tmp3 = gen_reg_rtx (V4SImode); |
| 18103 |
rtx tmp4 = gen_reg_rtx (V4SImode); |
| 18104 |
emit_move_insn (tmp1, lowpart_subreg (V4SImode, operands[1], V2DImode)); |
| 18105 |
emit_insn (gen_ashlv4si3 (tmp2, tmp1, op2)); |
| 18106 |
emit_insn (gen_ashrv4si3 (tmp3, tmp2, op2)); |
| 18107 |
vec_perm_builder sel (4, 4, 1); |
| 18108 |
sel.quick_grow (4); |
| 18109 |
sel[0] = 0; |
| 18110 |
sel[1] = 5; |
| 18111 |
sel[2] = 2; |
| 18112 |
sel[3] = 7; |
| 18113 |
vec_perm_indices indices(sel, 2, 4); |
| 18114 |
bool ok = targetm.vectorize.vec_perm_const (V4SImode, V4SImode, tmp4, |
| 18115 |
tmp1, tmp3, indices); |
| 18116 |
gcc_assert (ok); |
| 18117 |
emit_move_insn (op0, lowpart_subreg (V2DImode, tmp4, V4SImode)); |
| 18118 |
DONE; |
| 18119 |
} |
| 18120 |
else |
| 18121 |
operands[4] = gen_reg_rtx (V2DImode); |
| 18122 |
}) |
| 18123 |
|
| 18124 |
;; Rotate instructions |
| 18125 |
|
| 18126 |
(define_expand "<insn>ti3" |
| 18127 |
[(set (match_operand:TI 0 "register_operand") |
| 18128 |
(any_rotate:TI (match_operand:TI 1 "register_operand") |
| 18129 |
(match_operand:QI 2 "nonmemory_operand")))] |
| 18130 |
"TARGET_64BIT" |
| 18131 |
{ |
| 18132 |
if (const_1_to_63_operand (operands[2], VOIDmode)) |
| 18133 |
emit_insn (gen_ix86_<insn>ti3_doubleword |
| 18134 |
(operands[0], operands[1], operands[2])); |
| 18135 |
else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) |
| 18136 |
{ |
| 18137 |
operands[1] = force_reg (TImode, operands[1]); |
| 18138 |
emit_insn (gen_<insn>64ti2_doubleword (operands[0], operands[1])); |
| 18139 |
} |
| 18140 |
else |
| 18141 |
{ |
| 18142 |
rtx amount = force_reg (QImode, operands[2]); |
| 18143 |
rtx src_lo = gen_lowpart (DImode, operands[1]); |
| 18144 |
rtx src_hi = gen_highpart (DImode, operands[1]); |
| 18145 |
rtx tmp_lo = gen_reg_rtx (DImode); |
| 18146 |
rtx tmp_hi = gen_reg_rtx (DImode); |
| 18147 |
emit_move_insn (tmp_lo, src_lo); |
| 18148 |
emit_move_insn (tmp_hi, src_hi); |
| 18149 |
rtx (*shiftd) (rtx, rtx, rtx) |
| 18150 |
= (<CODE> == ROTATE) ? gen_x86_64_shld : gen_x86_64_shrd; |
| 18151 |
emit_insn (shiftd (tmp_lo, src_hi, amount)); |
| 18152 |
emit_insn (shiftd (tmp_hi, src_lo, amount)); |
| 18153 |
rtx dst_lo = gen_lowpart (DImode, operands[0]); |
| 18154 |
rtx dst_hi = gen_highpart (DImode, operands[0]); |
| 18155 |
emit_move_insn (dst_lo, tmp_lo); |
| 18156 |
emit_move_insn (dst_hi, tmp_hi); |
| 18157 |
emit_insn (gen_x86_shiftdi_adj_1 (dst_lo, dst_hi, amount, tmp_lo)); |
| 18158 |
} |
| 18159 |
DONE; |
| 18160 |
}) |
| 18161 |
|
| 18162 |
(define_expand "<insn>di3" |
| 18163 |
[(set (match_operand:DI 0 "shiftdi_operand") |
| 18164 |
(any_rotate:DI (match_operand:DI 1 "shiftdi_operand") |
| 18165 |
(match_operand:QI 2 "nonmemory_operand")))] |
| 18166 |
"" |
| 18167 |
{ |
| 18168 |
if (TARGET_64BIT) |
| 18169 |
ix86_expand_binary_operator (<CODE>, DImode, operands, TARGET_APX_NDD); |
| 18170 |
else if (const_1_to_31_operand (operands[2], VOIDmode)) |
| 18171 |
emit_insn (gen_ix86_<insn>di3_doubleword |
| 18172 |
(operands[0], operands[1], operands[2])); |
| 18173 |
else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) |
| 18174 |
{ |
| 18175 |
operands[1] = force_reg (DImode, operands[1]); |
| 18176 |
emit_insn (gen_<insn>32di2_doubleword (operands[0], operands[1])); |
| 18177 |
} |
| 18178 |
else |
| 18179 |
FAIL; |
| 18180 |
|
| 18181 |
DONE; |
| 18182 |
}) |
| 18183 |
|
| 18184 |
(define_expand "<insn><mode>3" |
| 18185 |
[(set (match_operand:SWIM124 0 "nonimmediate_operand") |
| 18186 |
(any_rotate:SWIM124 (match_operand:SWIM124 1 "nonimmediate_operand") |
| 18187 |
(match_operand:QI 2 "nonmemory_operand")))] |
| 18188 |
"" |
| 18189 |
{ |
| 18190 |
ix86_expand_binary_operator (<CODE>, <MODE>mode, operands, TARGET_APX_NDD); |
| 18191 |
DONE; |
| 18192 |
}) |
| 18193 |
|
| 18194 |
;; Avoid useless masking of count operand. |
| 18195 |
(define_insn_and_split "*<insn><mode>3_mask" |
| 18196 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 18197 |
(any_rotate:SWI |
| 18198 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 18199 |
(subreg:QI |
| 18200 |
(and |
| 18201 |
(match_operand 2 "int248_register_operand" "c") |
| 18202 |
(match_operand 3 "const_int_operand")) 0))) |
| 18203 |
(clobber (reg:CC FLAGS_REG))] |
| 18204 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18205 |
&& (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 18206 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 18207 |
&& ix86_pre_reload_split ()" |
| 18208 |
"#" |
| 18209 |
"&& 1" |
| 18210 |
[(parallel |
| 18211 |
[(set (match_dup 0) |
| 18212 |
(any_rotate:SWI (match_dup 1) |
| 18213 |
(match_dup 2))) |
| 18214 |
(clobber (reg:CC FLAGS_REG))])] |
| 18215 |
{ |
| 18216 |
operands[2] = force_lowpart_subreg (QImode, operands[2], |
| 18217 |
GET_MODE (operands[2])); |
| 18218 |
if (TARGET_APX_NF) |
| 18219 |
{ |
| 18220 |
emit_move_insn (operands[0], |
| 18221 |
gen_rtx_<CODE> (<MODE>mode, operands[1], |
| 18222 |
operands[2])); |
| 18223 |
DONE; |
| 18224 |
} |
| 18225 |
}) |
| 18226 |
|
| 18227 |
(define_split |
| 18228 |
[(set (match_operand:SWI 0 "register_operand") |
| 18229 |
(any_rotate:SWI |
| 18230 |
(match_operand:SWI 1 "const_int_operand") |
| 18231 |
(subreg:QI |
| 18232 |
(match_operator 4 "and_operator" |
| 18233 |
[(match_operand 2 "int248_register_operand") |
| 18234 |
(match_operand 3 "const_int_operand")]) 0)))] |
| 18235 |
"(INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode) - 1)) |
| 18236 |
== GET_MODE_BITSIZE (<MODE>mode) - 1" |
| 18237 |
[(set (match_dup 5) (match_dup 1)) |
| 18238 |
(set (match_dup 0) |
| 18239 |
(any_rotate:SWI (match_dup 5) |
| 18240 |
(subreg:QI |
| 18241 |
(match_op_dup 4 [(match_dup 2) (match_dup 3)]) 0)))] |
| 18242 |
"operands[5] = gen_reg_rtx (<MODE>mode);") |
| 18243 |
|
| 18244 |
(define_insn_and_split "*<insn><mode>3_mask_1" |
| 18245 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 18246 |
(any_rotate:SWI |
| 18247 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 18248 |
(and:QI |
| 18249 |
(match_operand:QI 2 "register_operand" "c") |
| 18250 |
(match_operand:QI 3 "const_int_operand")))) |
| 18251 |
(clobber (reg:CC FLAGS_REG))] |
| 18252 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18253 |
&& (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 18254 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 18255 |
&& ix86_pre_reload_split ()" |
| 18256 |
"#" |
| 18257 |
"&& 1" |
| 18258 |
[(parallel |
| 18259 |
[(set (match_dup 0) |
| 18260 |
(any_rotate:SWI (match_dup 1) |
| 18261 |
(match_dup 2))) |
| 18262 |
(clobber (reg:CC FLAGS_REG))])] |
| 18263 |
{ |
| 18264 |
if (TARGET_APX_NF) |
| 18265 |
{ |
| 18266 |
emit_move_insn (operands[0], |
| 18267 |
gen_rtx_<CODE> (<MODE>mode, operands[1], |
| 18268 |
operands[2])); |
| 18269 |
DONE; |
| 18270 |
} |
| 18271 |
}) |
| 18272 |
|
| 18273 |
(define_split |
| 18274 |
[(set (match_operand:SWI 0 "register_operand") |
| 18275 |
(any_rotate:SWI |
| 18276 |
(match_operand:SWI 1 "const_int_operand") |
| 18277 |
(and:QI |
| 18278 |
(match_operand:QI 2 "register_operand") |
| 18279 |
(match_operand:QI 3 "const_int_operand"))))] |
| 18280 |
"(INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode) - 1)) |
| 18281 |
== GET_MODE_BITSIZE (<MODE>mode) - 1" |
| 18282 |
[(set (match_dup 4) (match_dup 1)) |
| 18283 |
(set (match_dup 0) |
| 18284 |
(any_rotate:SWI (match_dup 4) |
| 18285 |
(and:QI (match_dup 2) (match_dup 3))))] |
| 18286 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 18287 |
|
| 18288 |
(define_insn_and_split "*<insn><mode>3_add" |
| 18289 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 18290 |
(any_rotate:SWI |
| 18291 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 18292 |
(subreg:QI |
| 18293 |
(plus |
| 18294 |
(match_operand 2 "int_nonimmediate_operand") |
| 18295 |
(match_operand 3 "const_int_operand")) 0))) |
| 18296 |
(clobber (reg:CC FLAGS_REG))] |
| 18297 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18298 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 18299 |
&& ix86_pre_reload_split ()" |
| 18300 |
"#" |
| 18301 |
"&& 1" |
| 18302 |
[(parallel |
| 18303 |
[(set (match_dup 0) |
| 18304 |
(any_rotate:SWI (match_dup 1) (match_dup 2))) |
| 18305 |
(clobber (reg:CC FLAGS_REG))])] |
| 18306 |
{ |
| 18307 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 18308 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 18309 |
}) |
| 18310 |
|
| 18311 |
(define_split |
| 18312 |
[(set (match_operand:SWI 0 "register_operand") |
| 18313 |
(any_rotate:SWI |
| 18314 |
(match_operand:SWI 1 "const_int_operand") |
| 18315 |
(subreg:QI |
| 18316 |
(plus |
| 18317 |
(match_operand 2 "int248_register_operand") |
| 18318 |
(match_operand 3 "const_int_operand")) 0)))] |
| 18319 |
"(INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0" |
| 18320 |
[(set (match_dup 4) (match_dup 1)) |
| 18321 |
(set (match_dup 0) |
| 18322 |
(any_rotate:SWI (match_dup 4) (subreg:QI (match_dup 2) 0)))] |
| 18323 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 18324 |
|
| 18325 |
(define_insn_and_split "*<insn><mode>3_add_1" |
| 18326 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 18327 |
(any_rotate:SWI |
| 18328 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 18329 |
(plus:QI |
| 18330 |
(match_operand:QI 2 "nonimmediate_operand") |
| 18331 |
(match_operand:QI 3 "const_int_operand")))) |
| 18332 |
(clobber (reg:CC FLAGS_REG))] |
| 18333 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18334 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 18335 |
&& ix86_pre_reload_split ()" |
| 18336 |
"#" |
| 18337 |
"&& 1" |
| 18338 |
[(parallel |
| 18339 |
[(set (match_dup 0) |
| 18340 |
(any_rotate:SWI (match_dup 1) (match_dup 2))) |
| 18341 |
(clobber (reg:CC FLAGS_REG))])] |
| 18342 |
"operands[2] = force_reg (GET_MODE (operands[2]), operands[2]);") |
| 18343 |
|
| 18344 |
(define_split |
| 18345 |
[(set (match_operand:SWI 0 "register_operand") |
| 18346 |
(any_rotate:SWI |
| 18347 |
(match_operand:SWI 1 "const_int_operand") |
| 18348 |
(plus:QI |
| 18349 |
(match_operand:QI 2 "register_operand") |
| 18350 |
(match_operand:QI 3 "const_int_operand"))))] |
| 18351 |
"(INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0" |
| 18352 |
[(set (match_dup 4) (match_dup 1)) |
| 18353 |
(set (match_dup 0) |
| 18354 |
(any_rotate:SWI (match_dup 4) (match_dup 2)))] |
| 18355 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 18356 |
|
| 18357 |
(define_insn_and_split "*<insn><mode>3_sub" |
| 18358 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 18359 |
(any_rotate:SWI |
| 18360 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 18361 |
(subreg:QI |
| 18362 |
(minus |
| 18363 |
(match_operand 3 "const_int_operand") |
| 18364 |
(match_operand 2 "int_nonimmediate_operand")) 0))) |
| 18365 |
(clobber (reg:CC FLAGS_REG))] |
| 18366 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18367 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 18368 |
&& ix86_pre_reload_split ()" |
| 18369 |
"#" |
| 18370 |
"&& 1" |
| 18371 |
[(parallel |
| 18372 |
[(set (match_dup 0) |
| 18373 |
(<crotate>:SWI (match_dup 1) (match_dup 2))) |
| 18374 |
(clobber (reg:CC FLAGS_REG))])] |
| 18375 |
{ |
| 18376 |
operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); |
| 18377 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 18378 |
}) |
| 18379 |
|
| 18380 |
(define_split |
| 18381 |
[(set (match_operand:SWI 0 "register_operand") |
| 18382 |
(any_rotate:SWI |
| 18383 |
(match_operand:SWI 1 "const_int_operand") |
| 18384 |
(subreg:QI |
| 18385 |
(minus |
| 18386 |
(match_operand 3 "const_int_operand") |
| 18387 |
(match_operand 2 "int248_register_operand")) 0)))] |
| 18388 |
"(INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0" |
| 18389 |
[(set (match_dup 4) (match_dup 1)) |
| 18390 |
(set (match_dup 0) |
| 18391 |
(<crotate>:SWI (match_dup 4) (subreg:QI (match_dup 2) 0)))] |
| 18392 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 18393 |
|
| 18394 |
(define_insn_and_split "*<insn><mode>3_sub_1" |
| 18395 |
[(set (match_operand:SWI 0 "nonimmediate_operand") |
| 18396 |
(any_rotate:SWI |
| 18397 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 18398 |
(minus:QI |
| 18399 |
(match_operand:QI 3 "const_int_operand") |
| 18400 |
(match_operand:QI 2 "nonimmediate_operand")))) |
| 18401 |
(clobber (reg:CC FLAGS_REG))] |
| 18402 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) |
| 18403 |
&& (INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0 |
| 18404 |
&& ix86_pre_reload_split ()" |
| 18405 |
"#" |
| 18406 |
"&& 1" |
| 18407 |
[(parallel |
| 18408 |
[(set (match_dup 0) |
| 18409 |
(<crotate>:SWI (match_dup 1) (match_dup 2))) |
| 18410 |
(clobber (reg:CC FLAGS_REG))])] |
| 18411 |
"operands[2] = force_reg (GET_MODE (operands[2]), operands[2]);") |
| 18412 |
|
| 18413 |
(define_split |
| 18414 |
[(set (match_operand:SWI 0 "register_operand") |
| 18415 |
(any_rotate:SWI |
| 18416 |
(match_operand:SWI 1 "const_int_operand") |
| 18417 |
(minus:QI |
| 18418 |
(match_operand:QI 3 "const_int_operand") |
| 18419 |
(match_operand:QI 2 "register_operand"))))] |
| 18420 |
"(INTVAL (operands[3]) & (<MODE_SIZE> * BITS_PER_UNIT - 1)) == 0" |
| 18421 |
[(set (match_dup 4) (match_dup 1)) |
| 18422 |
(set (match_dup 0) |
| 18423 |
(<crotate>:SWI (match_dup 4) (match_dup 2)))] |
| 18424 |
"operands[4] = gen_reg_rtx (<MODE>mode);") |
| 18425 |
|
| 18426 |
;; Implement rotation using two double-precision |
| 18427 |
;; shift instructions and a scratch register. |
| 18428 |
|
| 18429 |
(define_insn_and_split "ix86_rotl<dwi>3_doubleword" |
| 18430 |
[(set (match_operand:<DWI> 0 "register_operand" "=r") |
| 18431 |
(rotate:<DWI> (match_operand:<DWI> 1 "register_operand" "0") |
| 18432 |
(match_operand:QI 2 "<shift_immediate_operand>" "<S>"))) |
| 18433 |
(clobber (reg:CC FLAGS_REG)) |
| 18434 |
(clobber (match_scratch:DWIH 3 "=&r"))] |
| 18435 |
"" |
| 18436 |
"#" |
| 18437 |
"reload_completed" |
| 18438 |
[(set (match_dup 3) (match_dup 4)) |
| 18439 |
(parallel |
| 18440 |
[(set (match_dup 4) |
| 18441 |
(ior:DWIH (ashift:DWIH (match_dup 4) |
| 18442 |
(and:QI (match_dup 2) (match_dup 6))) |
| 18443 |
(subreg:DWIH |
| 18444 |
(lshiftrt:<DWI> (zero_extend:<DWI> (match_dup 5)) |
| 18445 |
(minus:QI (match_dup 7) |
| 18446 |
(and:QI (match_dup 2) |
| 18447 |
(match_dup 6)))) 0))) |
| 18448 |
(clobber (reg:CC FLAGS_REG))]) |
| 18449 |
(parallel |
| 18450 |
[(set (match_dup 5) |
| 18451 |
(ior:DWIH (ashift:DWIH (match_dup 5) |
| 18452 |
(and:QI (match_dup 2) (match_dup 6))) |
| 18453 |
(subreg:DWIH |
| 18454 |
(lshiftrt:<DWI> (zero_extend:<DWI> (match_dup 3)) |
| 18455 |
(minus:QI (match_dup 7) |
| 18456 |
(and:QI (match_dup 2) |
| 18457 |
(match_dup 6)))) 0))) |
| 18458 |
(clobber (reg:CC FLAGS_REG))])] |
| 18459 |
{ |
| 18460 |
operands[6] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1); |
| 18461 |
operands[7] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)); |
| 18462 |
|
| 18463 |
split_double_mode (<DWI>mode, &operands[0], 1, &operands[4], &operands[5]); |
| 18464 |
}) |
| 18465 |
|
| 18466 |
(define_insn_and_split "ix86_rotr<dwi>3_doubleword" |
| 18467 |
[(set (match_operand:<DWI> 0 "register_operand" "=r") |
| 18468 |
(rotatert:<DWI> (match_operand:<DWI> 1 "register_operand" "0") |
| 18469 |
(match_operand:QI 2 "<shift_immediate_operand>" "<S>"))) |
| 18470 |
(clobber (reg:CC FLAGS_REG)) |
| 18471 |
(clobber (match_scratch:DWIH 3 "=&r"))] |
| 18472 |
"" |
| 18473 |
"#" |
| 18474 |
"reload_completed" |
| 18475 |
[(set (match_dup 3) (match_dup 4)) |
| 18476 |
(parallel |
| 18477 |
[(set (match_dup 4) |
| 18478 |
(ior:DWIH (lshiftrt:DWIH (match_dup 4) |
| 18479 |
(and:QI (match_dup 2) (match_dup 6))) |
| 18480 |
(subreg:DWIH |
| 18481 |
(ashift:<DWI> (zero_extend:<DWI> (match_dup 5)) |
| 18482 |
(minus:QI (match_dup 7) |
| 18483 |
(and:QI (match_dup 2) |
| 18484 |
(match_dup 6)))) 0))) |
| 18485 |
(clobber (reg:CC FLAGS_REG))]) |
| 18486 |
(parallel |
| 18487 |
[(set (match_dup 5) |
| 18488 |
(ior:DWIH (lshiftrt:DWIH (match_dup 5) |
| 18489 |
(and:QI (match_dup 2) (match_dup 6))) |
| 18490 |
(subreg:DWIH |
| 18491 |
(ashift:<DWI> (zero_extend:<DWI> (match_dup 3)) |
| 18492 |
(minus:QI (match_dup 7) |
| 18493 |
(and:QI (match_dup 2) |
| 18494 |
(match_dup 6)))) 0))) |
| 18495 |
(clobber (reg:CC FLAGS_REG))])] |
| 18496 |
{ |
| 18497 |
operands[6] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1); |
| 18498 |
operands[7] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)); |
| 18499 |
|
| 18500 |
split_double_mode (<DWI>mode, &operands[0], 1, &operands[4], &operands[5]); |
| 18501 |
}) |
| 18502 |
|
| 18503 |
(define_insn_and_split "<insn>32di2_doubleword" |
| 18504 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 18505 |
(any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") |
| 18506 |
(const_int 32)))] |
| 18507 |
"!TARGET_64BIT" |
| 18508 |
"#" |
| 18509 |
"&& reload_completed" |
| 18510 |
[(set (match_dup 0) (match_dup 3)) |
| 18511 |
(set (match_dup 2) (match_dup 1))] |
| 18512 |
{ |
| 18513 |
split_double_mode (DImode, &operands[0], 2, &operands[0], &operands[2]); |
| 18514 |
if (rtx_equal_p (operands[0], operands[1])) |
| 18515 |
{ |
| 18516 |
emit_insn (gen_swapsi (operands[0], operands[2])); |
| 18517 |
DONE; |
| 18518 |
} |
| 18519 |
}) |
| 18520 |
|
| 18521 |
(define_insn_and_split "<insn>64ti2_doubleword" |
| 18522 |
[(set (match_operand:TI 0 "register_operand" "=r,r") |
| 18523 |
(any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") |
| 18524 |
(const_int 64)))] |
| 18525 |
"TARGET_64BIT" |
| 18526 |
"#" |
| 18527 |
"&& reload_completed" |
| 18528 |
[(set (match_dup 0) (match_dup 3)) |
| 18529 |
(set (match_dup 2) (match_dup 1))] |
| 18530 |
{ |
| 18531 |
split_double_mode (TImode, &operands[0], 2, &operands[0], &operands[2]); |
| 18532 |
if (rtx_equal_p (operands[0], operands[1])) |
| 18533 |
{ |
| 18534 |
emit_insn (gen_swapdi (operands[0], operands[2])); |
| 18535 |
DONE; |
| 18536 |
} |
| 18537 |
}) |
| 18538 |
|
| 18539 |
(define_mode_attr rorx_immediate_operand |
| 18540 |
[(SI "const_0_to_31_operand") |
| 18541 |
(DI "const_0_to_63_operand")]) |
| 18542 |
|
| 18543 |
(define_insn "*bmi2_rorx<mode>3_1" |
| 18544 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 18545 |
(rotatert:SWI48 |
| 18546 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 18547 |
(match_operand:QI 2 "<rorx_immediate_operand>" "<S>")))] |
| 18548 |
"TARGET_BMI2 && !optimize_function_for_size_p (cfun)" |
| 18549 |
"rorx\t{%2, %1, %0|%0, %1, %2}" |
| 18550 |
[(set_attr "type" "rotatex") |
| 18551 |
(set_attr "mode" "<MODE>")]) |
| 18552 |
|
| 18553 |
(define_insn "*<insn><mode>3_1<nf_name>" |
| 18554 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r") |
| 18555 |
(any_rotate:SWI48 |
| 18556 |
(match_operand:SWI48 1 "nonimmediate_operand" "0,rm,rm") |
| 18557 |
(match_operand:QI 2 "nonmemory_operand" "c<S>,<S>,c<S>")))] |
| 18558 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD) |
| 18559 |
&& <nf_condition>" |
| 18560 |
{ |
| 18561 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 18562 |
switch (get_attr_type (insn)) |
| 18563 |
{ |
| 18564 |
case TYPE_ROTATEX: |
| 18565 |
if (TARGET_APX_NDD && <nf_applied>) |
| 18566 |
return "%{nf%} <rotate>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}"; |
| 18567 |
else |
| 18568 |
return "#"; |
| 18569 |
|
| 18570 |
default: |
| 18571 |
if (operands[2] == const1_rtx |
| 18572 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 18573 |
&& !use_ndd && !<nf_applied>) |
| 18574 |
return "<rotate>{<imodesuffix>}\t%0"; |
| 18575 |
else |
| 18576 |
return use_ndd ? "<nf_prefix><rotate>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 18577 |
: "<nf_prefix><rotate>{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 18578 |
} |
| 18579 |
} |
| 18580 |
[(set_attr "isa" "*,bmi2,apx_ndd") |
| 18581 |
(set_attr "type" "rotate,rotatex,rotate") |
| 18582 |
(set (attr "preferred_for_size") |
| 18583 |
(cond [(eq_attr "alternative" "0") |
| 18584 |
(symbol_ref "true")] |
| 18585 |
(symbol_ref "false"))) |
| 18586 |
(set (attr "length_immediate") |
| 18587 |
(if_then_else |
| 18588 |
(and (eq_attr "type" "rotate") |
| 18589 |
(and (match_operand 2 "const1_operand") |
| 18590 |
(ior (match_test "TARGET_SHIFT1") |
| 18591 |
(match_test "optimize_function_for_size_p (cfun)")))) |
| 18592 |
(const_string "0") |
| 18593 |
(const_string "*"))) |
| 18594 |
(set_attr "has_nf" "1") |
| 18595 |
(set_attr "mode" "<MODE>")]) |
| 18596 |
|
| 18597 |
;; Convert rotate to the rotatex pattern to avoid flags dependency. |
| 18598 |
(define_split |
| 18599 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18600 |
(rotate:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 18601 |
(match_operand:QI 2 "const_int_operand"))) |
| 18602 |
(clobber (reg:CC FLAGS_REG))] |
| 18603 |
"TARGET_BMI2 && reload_completed && !optimize_function_for_size_p (cfun)" |
| 18604 |
[(set (match_dup 0) |
| 18605 |
(rotatert:SWI48 (match_dup 1) (match_dup 2)))] |
| 18606 |
{ |
| 18607 |
int bitsize = GET_MODE_BITSIZE (<MODE>mode); |
| 18608 |
|
| 18609 |
operands[2] = GEN_INT ((bitsize - INTVAL (operands[2])) % bitsize); |
| 18610 |
}) |
| 18611 |
|
| 18612 |
(define_split |
| 18613 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18614 |
(rotate:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 18615 |
(match_operand:QI 2 "const_int_operand")))] |
| 18616 |
"TARGET_BMI2 && reload_completed && !optimize_function_for_size_p (cfun) |
| 18617 |
&& !TARGET_APX_NDD" |
| 18618 |
[(set (match_dup 0) |
| 18619 |
(rotatert:SWI48 (match_dup 1) (match_dup 2)))] |
| 18620 |
{ |
| 18621 |
int bitsize = GET_MODE_BITSIZE (<MODE>mode); |
| 18622 |
|
| 18623 |
operands[2] = GEN_INT ((bitsize - INTVAL (operands[2])) % bitsize); |
| 18624 |
}) |
| 18625 |
|
| 18626 |
(define_split |
| 18627 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18628 |
(rotatert:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 18629 |
(match_operand:QI 2 "const_int_operand"))) |
| 18630 |
(clobber (reg:CC FLAGS_REG))] |
| 18631 |
"TARGET_BMI2 && reload_completed && !optimize_function_for_size_p (cfun)" |
| 18632 |
[(set (match_dup 0) |
| 18633 |
(rotatert:SWI48 (match_dup 1) (match_dup 2)))]) |
| 18634 |
|
| 18635 |
(define_insn "*bmi2_rorxsi3_1_zext" |
| 18636 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 18637 |
(zero_extend:DI |
| 18638 |
(rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 18639 |
(match_operand:QI 2 "const_0_to_31_operand"))))] |
| 18640 |
"TARGET_64BIT && TARGET_BMI2 && !optimize_function_for_size_p (cfun)" |
| 18641 |
"rorx\t{%2, %1, %k0|%k0, %1, %2}" |
| 18642 |
[(set_attr "type" "rotatex") |
| 18643 |
(set_attr "mode" "SI")]) |
| 18644 |
|
| 18645 |
(define_insn "*<insn>qi3_1_zext<mode><nf_name>" |
| 18646 |
[(set (match_operand:SWI248x 0 "register_operand" "=r") |
| 18647 |
(zero_extend:SWI248x |
| 18648 |
(any_rotate:QI (match_operand:QI 1 "nonimmediate_operand" "rm") |
| 18649 |
(match_operand:QI 2 "nonmemory_operand" "cI"))))] |
| 18650 |
"TARGET_APX_NDD && <nf_condition>" |
| 18651 |
"<nf_prefix><rotate>{b}\t{%2, %1, %b0|%b0, %1, %2}" |
| 18652 |
[(set_attr "type" "rotate") |
| 18653 |
(set_attr "has_nf" "1") |
| 18654 |
(set_attr "mode" "QI")]) |
| 18655 |
|
| 18656 |
(define_insn "*<insn>hi3_1_zext<mode><nf_name>" |
| 18657 |
[(set (match_operand:SWI48x 0 "register_operand" "=r") |
| 18658 |
(zero_extend:SWI48x |
| 18659 |
(any_rotate:HI (match_operand:HI 1 "nonimmediate_operand" "rm") |
| 18660 |
(match_operand:QI 2 "nonmemory_operand" "cI"))))] |
| 18661 |
"TARGET_APX_NDD && <nf_condition>" |
| 18662 |
"<nf_prefix><rotate>{w}\t{%2, %1, %w0|%w0, %1, %2}" |
| 18663 |
[(set_attr "type" "rotate") |
| 18664 |
(set_attr "has_nf" "1") |
| 18665 |
(set_attr "mode" "HI")]) |
| 18666 |
|
| 18667 |
(define_insn "*<insn>si3_1_zext" |
| 18668 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 18669 |
(zero_extend:DI |
| 18670 |
(any_rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm,rm") |
| 18671 |
(match_operand:QI 2 "nonmemory_operand" "cI,I,cI")))) |
| 18672 |
(clobber (reg:CC FLAGS_REG))] |
| 18673 |
"TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands)" |
| 18674 |
{ |
| 18675 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 18676 |
switch (get_attr_type (insn)) |
| 18677 |
{ |
| 18678 |
case TYPE_ROTATEX: |
| 18679 |
return "#"; |
| 18680 |
|
| 18681 |
default: |
| 18682 |
if (operands[2] == const1_rtx |
| 18683 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 18684 |
&& !use_ndd) |
| 18685 |
return "<rotate>{l}\t%k0"; |
| 18686 |
else |
| 18687 |
return use_ndd ? "<rotate>{l}\t{%2, %1, %k0|%k0, %1, %2}" |
| 18688 |
: "<rotate>{l}\t{%2, %k0|%k0, %2}"; |
| 18689 |
} |
| 18690 |
} |
| 18691 |
[(set_attr "isa" "*,bmi2,apx_ndd") |
| 18692 |
(set_attr "type" "rotate,rotatex,rotate") |
| 18693 |
(set (attr "preferred_for_size") |
| 18694 |
(cond [(eq_attr "alternative" "0") |
| 18695 |
(symbol_ref "true")] |
| 18696 |
(symbol_ref "false"))) |
| 18697 |
(set (attr "length_immediate") |
| 18698 |
(if_then_else |
| 18699 |
(and (eq_attr "type" "rotate") |
| 18700 |
(and (match_operand 2 "const1_operand") |
| 18701 |
(ior (match_test "TARGET_SHIFT1") |
| 18702 |
(match_test "optimize_function_for_size_p (cfun)")))) |
| 18703 |
(const_string "0") |
| 18704 |
(const_string "*"))) |
| 18705 |
(set_attr "mode" "SI")]) |
| 18706 |
|
| 18707 |
;; Convert rotate to the rotatex pattern to avoid flags dependency. |
| 18708 |
(define_split |
| 18709 |
[(set (match_operand:DI 0 "register_operand") |
| 18710 |
(zero_extend:DI |
| 18711 |
(rotate:SI (match_operand:SI 1 "nonimmediate_operand") |
| 18712 |
(match_operand:QI 2 "const_int_operand")))) |
| 18713 |
(clobber (reg:CC FLAGS_REG))] |
| 18714 |
"TARGET_64BIT && TARGET_BMI2 && reload_completed |
| 18715 |
&& !optimize_function_for_size_p (cfun)" |
| 18716 |
[(set (match_dup 0) |
| 18717 |
(zero_extend:DI (rotatert:SI (match_dup 1) (match_dup 2))))] |
| 18718 |
{ |
| 18719 |
int bitsize = GET_MODE_BITSIZE (SImode); |
| 18720 |
|
| 18721 |
operands[2] = GEN_INT ((bitsize - INTVAL (operands[2])) % bitsize); |
| 18722 |
}) |
| 18723 |
|
| 18724 |
(define_split |
| 18725 |
[(set (match_operand:DI 0 "register_operand") |
| 18726 |
(zero_extend:DI |
| 18727 |
(rotatert:SI (match_operand:SI 1 "nonimmediate_operand") |
| 18728 |
(match_operand:QI 2 "const_int_operand")))) |
| 18729 |
(clobber (reg:CC FLAGS_REG))] |
| 18730 |
"TARGET_64BIT && TARGET_BMI2 && reload_completed |
| 18731 |
&& !optimize_function_for_size_p (cfun)" |
| 18732 |
[(set (match_dup 0) |
| 18733 |
(zero_extend:DI (rotatert:SI (match_dup 1) (match_dup 2))))]) |
| 18734 |
|
| 18735 |
(define_insn "*<insn><mode>3_1<nf_name>" |
| 18736 |
[(set (match_operand:SWI12 0 "nonimmediate_operand" "=<r>m,r") |
| 18737 |
(any_rotate:SWI12 (match_operand:SWI12 1 "nonimmediate_operand" "0,rm") |
| 18738 |
(match_operand:QI 2 "nonmemory_operand" "c<S>,c<S>")))] |
| 18739 |
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands, TARGET_APX_NDD) |
| 18740 |
&& <nf_condition>" |
| 18741 |
{ |
| 18742 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 18743 |
if (operands[2] == const1_rtx |
| 18744 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 18745 |
&& !use_ndd && !<nf_applied>) |
| 18746 |
return "<rotate>{<imodesuffix>}\t%0"; |
| 18747 |
else |
| 18748 |
return use_ndd |
| 18749 |
? "<nf_prefix><rotate>{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" |
| 18750 |
: "<nf_prefix><rotate>{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 18751 |
} |
| 18752 |
[(set_attr "isa" "*,apx_ndd") |
| 18753 |
(set_attr "type" "rotate") |
| 18754 |
(set (attr "length_immediate") |
| 18755 |
(if_then_else |
| 18756 |
(and (match_operand 2 "const1_operand") |
| 18757 |
(ior (match_test "TARGET_SHIFT1") |
| 18758 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 18759 |
(const_string "0") |
| 18760 |
(const_string "*"))) |
| 18761 |
(set_attr "has_nf" "1") |
| 18762 |
(set_attr "mode" "<MODE>")]) |
| 18763 |
|
| 18764 |
;; Alternative 1 is needed to work around LRA limitation, see PR82524. |
| 18765 |
(define_insn_and_split "*<insn><mode>3_1_slp" |
| 18766 |
[(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>,&<r>")) |
| 18767 |
(any_rotate:SWI12 (match_operand:SWI12 1 "register_operand" "0,!<r>") |
| 18768 |
(match_operand:QI 2 "nonmemory_operand" "cI,cI"))) |
| 18769 |
(clobber (reg:CC FLAGS_REG))] |
| 18770 |
"!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" |
| 18771 |
{ |
| 18772 |
if (which_alternative) |
| 18773 |
return "#"; |
| 18774 |
|
| 18775 |
if (operands[2] == const1_rtx |
| 18776 |
&& (TARGET_SHIFT1 || optimize_function_for_size_p (cfun))) |
| 18777 |
return "<rotate>{<imodesuffix>}\t%0"; |
| 18778 |
else |
| 18779 |
return "<rotate>{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 18780 |
} |
| 18781 |
"&& reload_completed |
| 18782 |
&& !(rtx_equal_p (operands[0], operands[1]))" |
| 18783 |
[(set (strict_low_part (match_dup 0)) (match_dup 1)) |
| 18784 |
(parallel |
| 18785 |
[(set (strict_low_part (match_dup 0)) |
| 18786 |
(any_rotate:SWI12 (match_dup 0) (match_dup 2))) |
| 18787 |
(clobber (reg:CC FLAGS_REG))])] |
| 18788 |
"" |
| 18789 |
[(set_attr "type" "rotate") |
| 18790 |
(set (attr "length_immediate") |
| 18791 |
(if_then_else |
| 18792 |
(and (match_operand 2 "const1_operand") |
| 18793 |
(ior (match_test "TARGET_SHIFT1") |
| 18794 |
(match_test "optimize_function_for_size_p (cfun)"))) |
| 18795 |
(const_string "0") |
| 18796 |
(const_string "*"))) |
| 18797 |
(set_attr "mode" "<MODE>")]) |
| 18798 |
|
| 18799 |
(define_split |
| 18800 |
[(set (match_operand:HI 0 "QIreg_operand") |
| 18801 |
(any_rotate:HI (match_dup 0) (const_int 8))) |
| 18802 |
(clobber (reg:CC FLAGS_REG))] |
| 18803 |
"reload_completed |
| 18804 |
&& (TARGET_USE_XCHGB || optimize_function_for_size_p (cfun))" |
| 18805 |
[(set (match_dup 0) (bswap:HI (match_dup 0)))]) |
| 18806 |
|
| 18807 |
;; Rotations through carry flag |
| 18808 |
(define_insn "rcrsi2" |
| 18809 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 18810 |
(plus:SI |
| 18811 |
(lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,rm") |
| 18812 |
(const_int 1)) |
| 18813 |
(ashift:SI (ltu:SI (reg:CCC FLAGS_REG) (const_int 0)) |
| 18814 |
(const_int 31)))) |
| 18815 |
(clobber (reg:CC FLAGS_REG))] |
| 18816 |
"" |
| 18817 |
"@ |
| 18818 |
rcr{l}\t%0 |
| 18819 |
rcr{l}\t{%1, %0|%0, %1}" |
| 18820 |
[(set_attr "isa" "*,apx_ndd") |
| 18821 |
(set_attr "type" "ishift1") |
| 18822 |
(set_attr "memory" "none") |
| 18823 |
(set_attr "length_immediate" "0") |
| 18824 |
(set_attr "mode" "SI")]) |
| 18825 |
|
| 18826 |
(define_insn "rcrdi2" |
| 18827 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 18828 |
(plus:DI |
| 18829 |
(lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0,rm") |
| 18830 |
(const_int 1)) |
| 18831 |
(ashift:DI (ltu:DI (reg:CCC FLAGS_REG) (const_int 0)) |
| 18832 |
(const_int 63)))) |
| 18833 |
(clobber (reg:CC FLAGS_REG))] |
| 18834 |
"TARGET_64BIT" |
| 18835 |
"@ |
| 18836 |
rcr{q}\t%0 |
| 18837 |
rcr{q}\t{%1, %0|%0, %1}" |
| 18838 |
[(set_attr "isa" "*,apx_ndd") |
| 18839 |
(set_attr "type" "ishift1") |
| 18840 |
(set_attr "length_immediate" "0") |
| 18841 |
(set_attr "mode" "DI")]) |
| 18842 |
|
| 18843 |
;; Versions of sar and shr that set the carry flag. |
| 18844 |
(define_insn "<insn><mode>3_carry" |
| 18845 |
[(set (reg:CCC FLAGS_REG) |
| 18846 |
(unspec:CCC [(and:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0,rm") |
| 18847 |
(const_int 1)) |
| 18848 |
(const_int 0)] UNSPEC_CC_NE)) |
| 18849 |
(set (match_operand:SWI48 0 "register_operand" "=r,r") |
| 18850 |
(any_shiftrt:SWI48 (match_dup 1) (const_int 1)))] |
| 18851 |
"" |
| 18852 |
{ |
| 18853 |
bool use_ndd = get_attr_isa (insn) == ISA_APX_NDD; |
| 18854 |
if ((TARGET_SHIFT1 || optimize_function_for_size_p (cfun)) |
| 18855 |
&& !use_ndd) |
| 18856 |
return "<shift>{<imodesuffix>}\t%0"; |
| 18857 |
return use_ndd ? "<shift>{<imodesuffix>}\t{$1, %1, %0|%0, %1, 1}" |
| 18858 |
: "<shift>{<imodesuffix>}\t{$1, %0|%0, 1}"; |
| 18859 |
} |
| 18860 |
[(set_attr "isa" "*, apx_ndd") |
| 18861 |
(set_attr "type" "ishift1") |
| 18862 |
(set (attr "length_immediate") |
| 18863 |
(if_then_else |
| 18864 |
(ior (match_test "TARGET_SHIFT1") |
| 18865 |
(match_test "optimize_function_for_size_p (cfun)")) |
| 18866 |
(const_string "0") |
| 18867 |
(const_string "*"))) |
| 18868 |
(set_attr "mode" "<MODE>")]) |
| 18869 |
|
| 18870 |
;; Bit set / bit test instructions |
| 18871 |
|
| 18872 |
;; %%% bts, btr, btc |
| 18873 |
|
| 18874 |
;; These instructions are *slow* when applied to memory. |
| 18875 |
|
| 18876 |
(define_code_attr btsc [(ior "bts") (xor "btc")]) |
| 18877 |
|
| 18878 |
(define_insn "*<btsc><mode>" |
| 18879 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 18880 |
(any_or:SWI48 |
| 18881 |
(ashift:SWI48 (const_int 1) |
| 18882 |
(match_operand:QI 2 "register_operand" "r")) |
| 18883 |
(match_operand:SWI48 1 "register_operand" "0"))) |
| 18884 |
(clobber (reg:CC FLAGS_REG))] |
| 18885 |
"TARGET_USE_BT" |
| 18886 |
"<btsc>{<imodesuffix>}\t{%<k>2, %0|%0, %<k>2}" |
| 18887 |
[(set_attr "type" "alu1") |
| 18888 |
(set_attr "prefix_0f" "1") |
| 18889 |
(set_attr "znver1_decode" "double") |
| 18890 |
(set_attr "c86_decode" "double") |
| 18891 |
(set_attr "mode" "<MODE>")]) |
| 18892 |
|
| 18893 |
;; Avoid useless masking of count operand. |
| 18894 |
(define_insn_and_split "*<btsc><mode>_mask" |
| 18895 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18896 |
(any_or:SWI48 |
| 18897 |
(ashift:SWI48 |
| 18898 |
(const_int 1) |
| 18899 |
(subreg:QI |
| 18900 |
(and |
| 18901 |
(match_operand 1 "int248_register_operand") |
| 18902 |
(match_operand 2 "const_int_operand")) 0)) |
| 18903 |
(match_operand:SWI48 3 "register_operand"))) |
| 18904 |
(clobber (reg:CC FLAGS_REG))] |
| 18905 |
"TARGET_USE_BT |
| 18906 |
&& (INTVAL (operands[2]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 18907 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 18908 |
&& ix86_pre_reload_split ()" |
| 18909 |
"#" |
| 18910 |
"&& 1" |
| 18911 |
[(parallel |
| 18912 |
[(set (match_dup 0) |
| 18913 |
(any_or:SWI48 |
| 18914 |
(ashift:SWI48 (const_int 1) |
| 18915 |
(match_dup 1)) |
| 18916 |
(match_dup 3))) |
| 18917 |
(clobber (reg:CC FLAGS_REG))])] |
| 18918 |
{ |
| 18919 |
operands[1] = force_reg (GET_MODE (operands[1]), operands[1]); |
| 18920 |
operands[1] = gen_lowpart (QImode, operands[1]); |
| 18921 |
}) |
| 18922 |
|
| 18923 |
(define_insn_and_split "*<btsc><mode>_mask_1" |
| 18924 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18925 |
(any_or:SWI48 |
| 18926 |
(ashift:SWI48 |
| 18927 |
(const_int 1) |
| 18928 |
(and:QI |
| 18929 |
(match_operand:QI 1 "register_operand") |
| 18930 |
(match_operand:QI 2 "const_int_operand"))) |
| 18931 |
(match_operand:SWI48 3 "register_operand"))) |
| 18932 |
(clobber (reg:CC FLAGS_REG))] |
| 18933 |
"TARGET_USE_BT |
| 18934 |
&& (INTVAL (operands[2]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 18935 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 18936 |
&& ix86_pre_reload_split ()" |
| 18937 |
"#" |
| 18938 |
"&& 1" |
| 18939 |
[(parallel |
| 18940 |
[(set (match_dup 0) |
| 18941 |
(any_or:SWI48 |
| 18942 |
(ashift:SWI48 (const_int 1) |
| 18943 |
(match_dup 1)) |
| 18944 |
(match_dup 3))) |
| 18945 |
(clobber (reg:CC FLAGS_REG))])]) |
| 18946 |
|
| 18947 |
(define_insn "*btr<mode>" |
| 18948 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 18949 |
(and:SWI48 |
| 18950 |
(rotate:SWI48 (const_int -2) |
| 18951 |
(match_operand:QI 2 "register_operand" "r")) |
| 18952 |
(match_operand:SWI48 1 "register_operand" "0"))) |
| 18953 |
(clobber (reg:CC FLAGS_REG))] |
| 18954 |
"TARGET_USE_BT" |
| 18955 |
"btr{<imodesuffix>}\t{%<k>2, %0|%0, %<k>2}" |
| 18956 |
[(set_attr "type" "alu1") |
| 18957 |
(set_attr "prefix_0f" "1") |
| 18958 |
(set_attr "znver1_decode" "double") |
| 18959 |
(set_attr "c86_decode" "double") |
| 18960 |
(set_attr "mode" "<MODE>")]) |
| 18961 |
|
| 18962 |
;; Avoid useless masking of count operand. |
| 18963 |
(define_insn_and_split "*btr<mode>_mask" |
| 18964 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18965 |
(and:SWI48 |
| 18966 |
(rotate:SWI48 |
| 18967 |
(const_int -2) |
| 18968 |
(subreg:QI |
| 18969 |
(and |
| 18970 |
(match_operand 1 "int248_register_operand") |
| 18971 |
(match_operand 2 "const_int_operand")) 0)) |
| 18972 |
(match_operand:SWI48 3 "register_operand"))) |
| 18973 |
(clobber (reg:CC FLAGS_REG))] |
| 18974 |
"TARGET_USE_BT |
| 18975 |
&& (INTVAL (operands[2]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 18976 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 18977 |
&& ix86_pre_reload_split ()" |
| 18978 |
"#" |
| 18979 |
"&& 1" |
| 18980 |
[(parallel |
| 18981 |
[(set (match_dup 0) |
| 18982 |
(and:SWI48 |
| 18983 |
(rotate:SWI48 (const_int -2) |
| 18984 |
(match_dup 1)) |
| 18985 |
(match_dup 3))) |
| 18986 |
(clobber (reg:CC FLAGS_REG))])] |
| 18987 |
{ |
| 18988 |
operands[1] = force_reg (GET_MODE (operands[1]), operands[1]); |
| 18989 |
operands[1] = gen_lowpart (QImode, operands[1]); |
| 18990 |
}) |
| 18991 |
|
| 18992 |
(define_insn_and_split "*btr<mode>_mask_1" |
| 18993 |
[(set (match_operand:SWI48 0 "register_operand") |
| 18994 |
(and:SWI48 |
| 18995 |
(rotate:SWI48 |
| 18996 |
(const_int -2) |
| 18997 |
(and:QI |
| 18998 |
(match_operand:QI 1 "register_operand") |
| 18999 |
(match_operand:QI 2 "const_int_operand"))) |
| 19000 |
(match_operand:SWI48 3 "register_operand"))) |
| 19001 |
(clobber (reg:CC FLAGS_REG))] |
| 19002 |
"TARGET_USE_BT |
| 19003 |
&& (INTVAL (operands[2]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 19004 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 19005 |
&& ix86_pre_reload_split ()" |
| 19006 |
"#" |
| 19007 |
"&& 1" |
| 19008 |
[(parallel |
| 19009 |
[(set (match_dup 0) |
| 19010 |
(and:SWI48 |
| 19011 |
(rotate:SWI48 (const_int -2) |
| 19012 |
(match_dup 1)) |
| 19013 |
(match_dup 3))) |
| 19014 |
(clobber (reg:CC FLAGS_REG))])]) |
| 19015 |
|
| 19016 |
(define_insn_and_split "*btr<mode>_1" |
| 19017 |
[(set (match_operand:SWI12 0 "register_operand") |
| 19018 |
(and:SWI12 |
| 19019 |
(subreg:SWI12 |
| 19020 |
(rotate:SI (const_int -2) |
| 19021 |
(match_operand:QI 2 "register_operand")) 0) |
| 19022 |
(match_operand:SWI12 1 "nonimmediate_operand"))) |
| 19023 |
(clobber (reg:CC FLAGS_REG))] |
| 19024 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19025 |
"#" |
| 19026 |
"&& 1" |
| 19027 |
[(parallel |
| 19028 |
[(set (match_dup 0) |
| 19029 |
(and:SI (rotate:SI (const_int -2) (match_dup 2)) |
| 19030 |
(match_dup 1))) |
| 19031 |
(clobber (reg:CC FLAGS_REG))])] |
| 19032 |
{ |
| 19033 |
operands[0] = lowpart_subreg (SImode, operands[0], <MODE>mode); |
| 19034 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 19035 |
operands[1] = lowpart_subreg (SImode, operands[1], <MODE>mode); |
| 19036 |
}) |
| 19037 |
|
| 19038 |
(define_insn_and_split "*btr<mode>_2" |
| 19039 |
[(set (zero_extract:HI |
| 19040 |
(match_operand:SWI12 0 "nonimmediate_operand") |
| 19041 |
(const_int 1) |
| 19042 |
(match_operand:QI 1 "register_operand")) |
| 19043 |
(const_int 0)) |
| 19044 |
(clobber (reg:CC FLAGS_REG))] |
| 19045 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19046 |
"#" |
| 19047 |
"&& MEM_P (operands[0])" |
| 19048 |
[(set (match_dup 2) (match_dup 0)) |
| 19049 |
(parallel |
| 19050 |
[(set (match_dup 3) |
| 19051 |
(and:SI (rotate:SI (const_int -2) (match_dup 1)) |
| 19052 |
(match_dup 4))) |
| 19053 |
(clobber (reg:CC FLAGS_REG))]) |
| 19054 |
(set (match_dup 0) (match_dup 5))] |
| 19055 |
{ |
| 19056 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 19057 |
operands[5] = gen_reg_rtx (<MODE>mode); |
| 19058 |
operands[3] = lowpart_subreg (SImode, operands[5], <MODE>mode); |
| 19059 |
operands[4] = lowpart_subreg (SImode, operands[2], <MODE>mode); |
| 19060 |
}) |
| 19061 |
|
| 19062 |
(define_split |
| 19063 |
[(set (zero_extract:HI |
| 19064 |
(match_operand:SWI12 0 "register_operand") |
| 19065 |
(const_int 1) |
| 19066 |
(match_operand:QI 1 "register_operand")) |
| 19067 |
(const_int 0)) |
| 19068 |
(clobber (reg:CC FLAGS_REG))] |
| 19069 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19070 |
[(parallel |
| 19071 |
[(set (match_dup 0) |
| 19072 |
(and:SI (rotate:SI (const_int -2) (match_dup 1)) |
| 19073 |
(match_dup 2))) |
| 19074 |
(clobber (reg:CC FLAGS_REG))])] |
| 19075 |
{ |
| 19076 |
operands[2] = lowpart_subreg (SImode, operands[0], <MODE>mode); |
| 19077 |
operands[0] = lowpart_subreg (SImode, operands[0], <MODE>mode); |
| 19078 |
}) |
| 19079 |
|
| 19080 |
;; These instructions are never faster than the corresponding |
| 19081 |
;; and/ior/xor operations when using immediate operand, so with |
| 19082 |
;; 32-bit there's no point. But in 64-bit, we can't hold the |
| 19083 |
;; relevant immediates within the instruction itself, so operating |
| 19084 |
;; on bits in the high 32-bits of a register becomes easier. |
| 19085 |
;; |
| 19086 |
;; These are slow on Nocona, but fast on Athlon64. We do require the use |
| 19087 |
;; of btrq and btcq for corner cases of post-reload expansion of absdf and |
| 19088 |
;; negdf respectively, so they can never be disabled entirely. |
| 19089 |
|
| 19090 |
(define_insn "*btsq_imm" |
| 19091 |
[(set (zero_extract:DI (match_operand:DI 0 "nonimmediate_operand" "+rm") |
| 19092 |
(const_int 1) |
| 19093 |
(match_operand:QI 1 "const_0_to_63_operand")) |
| 19094 |
(const_int 1)) |
| 19095 |
(clobber (reg:CC FLAGS_REG))] |
| 19096 |
"TARGET_64BIT && (TARGET_USE_BT || reload_completed)" |
| 19097 |
"bts{q}\t{%1, %0|%0, %1}" |
| 19098 |
[(set_attr "type" "alu1") |
| 19099 |
(set_attr "prefix_0f" "1") |
| 19100 |
(set_attr "znver1_decode" "double") |
| 19101 |
(set_attr "c86_decode" "double") |
| 19102 |
(set_attr "mode" "DI")]) |
| 19103 |
|
| 19104 |
(define_insn "*btrq_imm" |
| 19105 |
[(set (zero_extract:DI (match_operand:DI 0 "nonimmediate_operand" "+rm") |
| 19106 |
(const_int 1) |
| 19107 |
(match_operand:QI 1 "const_0_to_63_operand")) |
| 19108 |
(const_int 0)) |
| 19109 |
(clobber (reg:CC FLAGS_REG))] |
| 19110 |
"TARGET_64BIT && (TARGET_USE_BT || reload_completed)" |
| 19111 |
"btr{q}\t{%1, %0|%0, %1}" |
| 19112 |
[(set_attr "type" "alu1") |
| 19113 |
(set_attr "prefix_0f" "1") |
| 19114 |
(set_attr "znver1_decode" "double") |
| 19115 |
(set_attr "c86_decode" "double") |
| 19116 |
(set_attr "mode" "DI")]) |
| 19117 |
|
| 19118 |
(define_insn "*btcq_imm" |
| 19119 |
[(set (zero_extract:DI (match_operand:DI 0 "nonimmediate_operand" "+rm") |
| 19120 |
(const_int 1) |
| 19121 |
(match_operand:QI 1 "const_0_to_63_operand")) |
| 19122 |
(not:DI (zero_extract:DI (match_dup 0) (const_int 1) (match_dup 1)))) |
| 19123 |
(clobber (reg:CC FLAGS_REG))] |
| 19124 |
"TARGET_64BIT && (TARGET_USE_BT || reload_completed)" |
| 19125 |
"btc{q}\t{%1, %0|%0, %1}" |
| 19126 |
[(set_attr "type" "alu1") |
| 19127 |
(set_attr "prefix_0f" "1") |
| 19128 |
(set_attr "znver1_decode" "double") |
| 19129 |
(set_attr "c86_decode" "double") |
| 19130 |
(set_attr "mode" "DI")]) |
| 19131 |
|
| 19132 |
;; Allow Nocona to avoid these instructions if a register is available. |
| 19133 |
|
| 19134 |
(define_peephole2 |
| 19135 |
[(match_scratch:DI 2 "r") |
| 19136 |
(parallel [(set (zero_extract:DI |
| 19137 |
(match_operand:DI 0 "nonimmediate_operand") |
| 19138 |
(const_int 1) |
| 19139 |
(match_operand:QI 1 "const_0_to_63_operand")) |
| 19140 |
(const_int 1)) |
| 19141 |
(clobber (reg:CC FLAGS_REG))])] |
| 19142 |
"TARGET_64BIT && !TARGET_USE_BT" |
| 19143 |
[(parallel [(set (match_dup 0) |
| 19144 |
(ior:DI (match_dup 0) (match_dup 3))) |
| 19145 |
(clobber (reg:CC FLAGS_REG))])] |
| 19146 |
{ |
| 19147 |
int i = INTVAL (operands[1]); |
| 19148 |
|
| 19149 |
operands[3] = gen_int_mode (HOST_WIDE_INT_1U << i, DImode); |
| 19150 |
|
| 19151 |
if (!x86_64_immediate_operand (operands[3], DImode)) |
| 19152 |
{ |
| 19153 |
emit_move_insn (operands[2], operands[3]); |
| 19154 |
operands[3] = operands[2]; |
| 19155 |
} |
| 19156 |
}) |
| 19157 |
|
| 19158 |
(define_peephole2 |
| 19159 |
[(match_scratch:DI 2 "r") |
| 19160 |
(parallel [(set (zero_extract:DI |
| 19161 |
(match_operand:DI 0 "nonimmediate_operand") |
| 19162 |
(const_int 1) |
| 19163 |
(match_operand:QI 1 "const_0_to_63_operand")) |
| 19164 |
(const_int 0)) |
| 19165 |
(clobber (reg:CC FLAGS_REG))])] |
| 19166 |
"TARGET_64BIT && !TARGET_USE_BT" |
| 19167 |
[(parallel [(set (match_dup 0) |
| 19168 |
(and:DI (match_dup 0) (match_dup 3))) |
| 19169 |
(clobber (reg:CC FLAGS_REG))])] |
| 19170 |
{ |
| 19171 |
int i = INTVAL (operands[1]); |
| 19172 |
|
| 19173 |
operands[3] = gen_int_mode (~(HOST_WIDE_INT_1U << i), DImode); |
| 19174 |
|
| 19175 |
if (!x86_64_immediate_operand (operands[3], DImode)) |
| 19176 |
{ |
| 19177 |
emit_move_insn (operands[2], operands[3]); |
| 19178 |
operands[3] = operands[2]; |
| 19179 |
} |
| 19180 |
}) |
| 19181 |
|
| 19182 |
(define_peephole2 |
| 19183 |
[(match_scratch:DI 2 "r") |
| 19184 |
(parallel [(set (zero_extract:DI |
| 19185 |
(match_operand:DI 0 "nonimmediate_operand") |
| 19186 |
(const_int 1) |
| 19187 |
(match_operand:QI 1 "const_0_to_63_operand")) |
| 19188 |
(not:DI (zero_extract:DI |
| 19189 |
(match_dup 0) (const_int 1) (match_dup 1)))) |
| 19190 |
(clobber (reg:CC FLAGS_REG))])] |
| 19191 |
"TARGET_64BIT && !TARGET_USE_BT" |
| 19192 |
[(parallel [(set (match_dup 0) |
| 19193 |
(xor:DI (match_dup 0) (match_dup 3))) |
| 19194 |
(clobber (reg:CC FLAGS_REG))])] |
| 19195 |
{ |
| 19196 |
int i = INTVAL (operands[1]); |
| 19197 |
|
| 19198 |
operands[3] = gen_int_mode (HOST_WIDE_INT_1U << i, DImode); |
| 19199 |
|
| 19200 |
if (!x86_64_immediate_operand (operands[3], DImode)) |
| 19201 |
{ |
| 19202 |
emit_move_insn (operands[2], operands[3]); |
| 19203 |
operands[3] = operands[2]; |
| 19204 |
} |
| 19205 |
}) |
| 19206 |
|
| 19207 |
;; %%% bt |
| 19208 |
|
| 19209 |
(define_insn "*bt<mode>" |
| 19210 |
[(set (reg:CCC FLAGS_REG) |
| 19211 |
(compare:CCC |
| 19212 |
(const_int 0) |
| 19213 |
(zero_extract:SWI48 |
| 19214 |
(match_operand:SWI48 0 "nonimmediate_operand" "r,m") |
| 19215 |
(const_int 1) |
| 19216 |
(match_operand:QI 1 "nonmemory_operand" "q<S>,<S>"))))] |
| 19217 |
"" |
| 19218 |
{ |
| 19219 |
switch (get_attr_mode (insn)) |
| 19220 |
{ |
| 19221 |
case MODE_SI: |
| 19222 |
return "bt{l}\t{%k1, %k0|%k0, %k1}"; |
| 19223 |
|
| 19224 |
case MODE_DI: |
| 19225 |
return "bt{q}\t{%q1, %0|%0, %q1}"; |
| 19226 |
|
| 19227 |
default: |
| 19228 |
gcc_unreachable (); |
| 19229 |
} |
| 19230 |
} |
| 19231 |
[(set_attr "type" "alu1") |
| 19232 |
(set_attr "prefix_0f" "1") |
| 19233 |
(set (attr "mode") |
| 19234 |
(if_then_else |
| 19235 |
(and (match_test "CONST_INT_P (operands[1])") |
| 19236 |
(match_test "INTVAL (operands[1]) < 32")) |
| 19237 |
(const_string "SI") |
| 19238 |
(const_string "<MODE>")))]) |
| 19239 |
|
| 19240 |
(define_insn_and_split "*bt<SWI48:mode>_mask" |
| 19241 |
[(set (reg:CCC FLAGS_REG) |
| 19242 |
(compare:CCC |
| 19243 |
(const_int 0) |
| 19244 |
(zero_extract:SWI48 |
| 19245 |
(match_operand:SWI48 0 "nonimmediate_operand" "r,m") |
| 19246 |
(const_int 1) |
| 19247 |
(subreg:QI |
| 19248 |
(and:SWI248 |
| 19249 |
(match_operand:SWI248 1 "register_operand") |
| 19250 |
(match_operand 2 "const_int_operand")) 0))))] |
| 19251 |
"TARGET_USE_BT |
| 19252 |
&& (INTVAL (operands[2]) & (GET_MODE_BITSIZE (<SWI48:MODE>mode)-1)) |
| 19253 |
== GET_MODE_BITSIZE (<SWI48:MODE>mode)-1 |
| 19254 |
&& ix86_pre_reload_split ()" |
| 19255 |
"#" |
| 19256 |
"&& 1" |
| 19257 |
[(set (reg:CCC FLAGS_REG) |
| 19258 |
(compare:CCC |
| 19259 |
(const_int 0) |
| 19260 |
(zero_extract:SWI48 (match_dup 0) (const_int 1) (match_dup 1))))] |
| 19261 |
"operands[1] = gen_lowpart (QImode, operands[1]);") |
| 19262 |
|
| 19263 |
(define_insn_and_split "*jcc_bt<mode>" |
| 19264 |
[(set (pc) |
| 19265 |
(if_then_else (match_operator 0 "bt_comparison_operator" |
| 19266 |
[(zero_extract:SWI48 |
| 19267 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 19268 |
(const_int 1) |
| 19269 |
(match_operand:QI 2 "nonmemory_operand")) |
| 19270 |
(const_int 0)]) |
| 19271 |
(label_ref (match_operand 3)) |
| 19272 |
(pc))) |
| 19273 |
(clobber (reg:CC FLAGS_REG))] |
| 19274 |
"(TARGET_USE_BT || optimize_function_for_size_p (cfun)) |
| 19275 |
&& (CONST_INT_P (operands[2]) |
| 19276 |
? (INTVAL (operands[2]) < GET_MODE_BITSIZE (<MODE>mode) |
| 19277 |
&& INTVAL (operands[2]) |
| 19278 |
>= (optimize_function_for_size_p (cfun) ? 8 : 32)) |
| 19279 |
: !memory_operand (operands[1], <MODE>mode)) |
| 19280 |
&& ix86_pre_reload_split ()" |
| 19281 |
"#" |
| 19282 |
"&& 1" |
| 19283 |
[(set (reg:CCC FLAGS_REG) |
| 19284 |
(compare:CCC |
| 19285 |
(const_int 0) |
| 19286 |
(zero_extract:SWI48 |
| 19287 |
(match_dup 1) |
| 19288 |
(const_int 1) |
| 19289 |
(match_dup 2)))) |
| 19290 |
(set (pc) |
| 19291 |
(if_then_else (match_op_dup 0 [(reg:CCC FLAGS_REG) (const_int 0)]) |
| 19292 |
(label_ref (match_dup 3)) |
| 19293 |
(pc)))] |
| 19294 |
{ |
| 19295 |
operands[0] = shallow_copy_rtx (operands[0]); |
| 19296 |
PUT_CODE (operands[0], GET_CODE (operands[0]) == NE ? LTU : GEU); |
| 19297 |
}) |
| 19298 |
|
| 19299 |
;; Avoid useless masking of bit offset operand. |
| 19300 |
(define_insn_and_split "*jcc_bt<mode>_mask" |
| 19301 |
[(set (pc) |
| 19302 |
(if_then_else (match_operator 0 "bt_comparison_operator" |
| 19303 |
[(zero_extract:SWI48 |
| 19304 |
(match_operand:SWI48 1 "register_operand") |
| 19305 |
(const_int 1) |
| 19306 |
(and:QI |
| 19307 |
(match_operand:QI 2 "register_operand") |
| 19308 |
(match_operand 3 "const_int_operand"))) |
| 19309 |
(const_int 0)]) |
| 19310 |
(label_ref (match_operand 4)) |
| 19311 |
(pc))) |
| 19312 |
(clobber (reg:CC FLAGS_REG))] |
| 19313 |
"(TARGET_USE_BT || optimize_function_for_size_p (cfun)) |
| 19314 |
&& (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 19315 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 19316 |
&& ix86_pre_reload_split ()" |
| 19317 |
"#" |
| 19318 |
"&& 1" |
| 19319 |
[(set (reg:CCC FLAGS_REG) |
| 19320 |
(compare:CCC |
| 19321 |
(const_int 0) |
| 19322 |
(zero_extract:SWI48 |
| 19323 |
(match_dup 1) |
| 19324 |
(const_int 1) |
| 19325 |
(match_dup 2)))) |
| 19326 |
(set (pc) |
| 19327 |
(if_then_else (match_op_dup 0 [(reg:CCC FLAGS_REG) (const_int 0)]) |
| 19328 |
(label_ref (match_dup 4)) |
| 19329 |
(pc)))] |
| 19330 |
{ |
| 19331 |
operands[0] = shallow_copy_rtx (operands[0]); |
| 19332 |
PUT_CODE (operands[0], GET_CODE (operands[0]) == NE ? LTU : GEU); |
| 19333 |
}) |
| 19334 |
|
| 19335 |
;; Avoid useless masking of bit offset operand. |
| 19336 |
(define_insn_and_split "*jcc_bt<SWI48:mode>_mask_1" |
| 19337 |
[(set (pc) |
| 19338 |
(if_then_else (match_operator 0 "bt_comparison_operator" |
| 19339 |
[(zero_extract:SWI48 |
| 19340 |
(match_operand:SWI48 1 "register_operand") |
| 19341 |
(const_int 1) |
| 19342 |
(subreg:QI |
| 19343 |
(and:SWI248 |
| 19344 |
(match_operand:SWI248 2 "register_operand") |
| 19345 |
(match_operand 3 "const_int_operand")) 0)) |
| 19346 |
(const_int 0)]) |
| 19347 |
(label_ref (match_operand 4)) |
| 19348 |
(pc))) |
| 19349 |
(clobber (reg:CC FLAGS_REG))] |
| 19350 |
"(TARGET_USE_BT || optimize_function_for_size_p (cfun)) |
| 19351 |
&& (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<SWI48:MODE>mode)-1)) |
| 19352 |
== GET_MODE_BITSIZE (<SWI48:MODE>mode)-1 |
| 19353 |
&& ix86_pre_reload_split ()" |
| 19354 |
"#" |
| 19355 |
"&& 1" |
| 19356 |
[(set (reg:CCC FLAGS_REG) |
| 19357 |
(compare:CCC |
| 19358 |
(const_int 0) |
| 19359 |
(zero_extract:SWI48 |
| 19360 |
(match_dup 1) |
| 19361 |
(const_int 1) |
| 19362 |
(match_dup 2)))) |
| 19363 |
(set (pc) |
| 19364 |
(if_then_else (match_op_dup 0 [(reg:CCC FLAGS_REG) (const_int 0)]) |
| 19365 |
(label_ref (match_dup 4)) |
| 19366 |
(pc)))] |
| 19367 |
{ |
| 19368 |
operands[0] = shallow_copy_rtx (operands[0]); |
| 19369 |
PUT_CODE (operands[0], GET_CODE (operands[0]) == NE ? LTU : GEU); |
| 19370 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 19371 |
}) |
| 19372 |
|
| 19373 |
;; Help combine recognize bt followed by cmov |
| 19374 |
(define_split |
| 19375 |
[(set (match_operand:SWI248 0 "register_operand") |
| 19376 |
(if_then_else:SWI248 |
| 19377 |
(match_operator 5 "bt_comparison_operator" |
| 19378 |
[(zero_extract:SWI48 |
| 19379 |
(match_operand:SWI48 1 "register_operand") |
| 19380 |
(const_int 1) |
| 19381 |
(match_operand:QI 2 "register_operand")) |
| 19382 |
(const_int 0)]) |
| 19383 |
(match_operand:SWI248 3 "nonimmediate_operand") |
| 19384 |
(match_operand:SWI248 4 "nonimmediate_operand")))] |
| 19385 |
"TARGET_USE_BT && TARGET_CMOVE |
| 19386 |
&& !(MEM_P (operands[3]) && MEM_P (operands[4])) |
| 19387 |
&& ix86_pre_reload_split ()" |
| 19388 |
[(set (reg:CCC FLAGS_REG) |
| 19389 |
(compare:CCC |
| 19390 |
(const_int 0) |
| 19391 |
(zero_extract:SWI48 (match_dup 1) (const_int 1) (match_dup 2)))) |
| 19392 |
(set (match_dup 0) |
| 19393 |
(if_then_else:SWI248 (ltu (reg:CCC FLAGS_REG) (const_int 0)) |
| 19394 |
(match_dup 3) |
| 19395 |
(match_dup 4)))] |
| 19396 |
{ |
| 19397 |
if (GET_CODE (operands[5]) == EQ) |
| 19398 |
std::swap (operands[3], operands[4]); |
| 19399 |
}) |
| 19400 |
|
| 19401 |
;; Help combine recognize bt followed by setc |
| 19402 |
(define_insn_and_split "*bt<mode>_setcqi" |
| 19403 |
[(set (subreg:SWI48 (match_operand:QI 0 "register_operand") 0) |
| 19404 |
(zero_extract:SWI48 |
| 19405 |
(match_operand:SWI48 1 "register_operand") |
| 19406 |
(const_int 1) |
| 19407 |
(match_operand:QI 2 "register_operand"))) |
| 19408 |
(clobber (reg:CC FLAGS_REG))] |
| 19409 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19410 |
"#" |
| 19411 |
"&& 1" |
| 19412 |
[(set (reg:CCC FLAGS_REG) |
| 19413 |
(compare:CCC |
| 19414 |
(const_int 0) |
| 19415 |
(zero_extract:SWI48 (match_dup 1) (const_int 1) (match_dup 2)))) |
| 19416 |
(set (match_dup 0) |
| 19417 |
(ltu:QI (reg:CCC FLAGS_REG) (const_int 0)))]) |
| 19418 |
|
| 19419 |
;; Help combine recognize bt followed by setnc |
| 19420 |
(define_insn_and_split "*bt<mode>_setncqi" |
| 19421 |
[(set (match_operand:QI 0 "register_operand") |
| 19422 |
(and:QI |
| 19423 |
(not:QI |
| 19424 |
(subreg:QI |
| 19425 |
(lshiftrt:SWI48 (match_operand:SWI48 1 "register_operand") |
| 19426 |
(match_operand:QI 2 "register_operand")) 0)) |
| 19427 |
(const_int 1))) |
| 19428 |
(clobber (reg:CC FLAGS_REG))] |
| 19429 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19430 |
"#" |
| 19431 |
"&& 1" |
| 19432 |
[(set (reg:CCC FLAGS_REG) |
| 19433 |
(compare:CCC |
| 19434 |
(const_int 0) |
| 19435 |
(zero_extract:SWI48 (match_dup 1) (const_int 1) (match_dup 2)))) |
| 19436 |
(set (match_dup 0) |
| 19437 |
(geu:QI (reg:CCC FLAGS_REG) (const_int 0)))]) |
| 19438 |
|
| 19439 |
(define_insn_and_split "*bt<mode>_setnc<mode>" |
| 19440 |
[(set (match_operand:SWI48 0 "register_operand") |
| 19441 |
(and:SWI48 |
| 19442 |
(not:SWI48 |
| 19443 |
(lshiftrt:SWI48 (match_operand:SWI48 1 "register_operand") |
| 19444 |
(match_operand:QI 2 "register_operand"))) |
| 19445 |
(const_int 1))) |
| 19446 |
(clobber (reg:CC FLAGS_REG))] |
| 19447 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19448 |
"#" |
| 19449 |
"&& 1" |
| 19450 |
[(set (reg:CCC FLAGS_REG) |
| 19451 |
(compare:CCC |
| 19452 |
(const_int 0) |
| 19453 |
(zero_extract:SWI48 (match_dup 1) (const_int 1) (match_dup 2)))) |
| 19454 |
(set (match_dup 3) |
| 19455 |
(geu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 19456 |
(set (match_dup 0) (zero_extend:SWI48 (match_dup 3)))] |
| 19457 |
"operands[3] = gen_reg_rtx (QImode);") |
| 19458 |
|
| 19459 |
;; Help combine recognize bt followed by setnc (PR target/110588) |
| 19460 |
(define_insn_and_split "*bt<mode>_setncqi_2" |
| 19461 |
[(set (match_operand:QI 0 "register_operand") |
| 19462 |
(eq:QI |
| 19463 |
(zero_extract:SWI48 |
| 19464 |
(match_operand:SWI48 1 "register_operand") |
| 19465 |
(const_int 1) |
| 19466 |
(match_operand:QI 2 "register_operand")) |
| 19467 |
(const_int 0))) |
| 19468 |
(clobber (reg:CC FLAGS_REG))] |
| 19469 |
"TARGET_USE_BT && ix86_pre_reload_split ()" |
| 19470 |
"#" |
| 19471 |
"&& 1" |
| 19472 |
[(set (reg:CCC FLAGS_REG) |
| 19473 |
(compare:CCC |
| 19474 |
(const_int 0) |
| 19475 |
(zero_extract:SWI48 (match_dup 1) (const_int 1) (match_dup 2)))) |
| 19476 |
(set (match_dup 0) |
| 19477 |
(geu:QI (reg:CCC FLAGS_REG) (const_int 0)))]) |
| 19478 |
|
| 19479 |
;; Help combine recognize bt followed by setc |
| 19480 |
(define_insn_and_split "*bt<mode>_setc<mode>_mask" |
| 19481 |
[(set (match_operand:SWI48 0 "register_operand") |
| 19482 |
(zero_extract:SWI48 |
| 19483 |
(match_operand:SWI48 1 "register_operand") |
| 19484 |
(const_int 1) |
| 19485 |
(subreg:QI |
| 19486 |
(and:SWI48 |
| 19487 |
(match_operand:SWI48 2 "register_operand") |
| 19488 |
(match_operand 3 "const_int_operand")) 0))) |
| 19489 |
(clobber (reg:CC FLAGS_REG))] |
| 19490 |
"TARGET_USE_BT |
| 19491 |
&& (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) |
| 19492 |
== GET_MODE_BITSIZE (<MODE>mode)-1 |
| 19493 |
&& ix86_pre_reload_split ()" |
| 19494 |
"#" |
| 19495 |
"&& 1" |
| 19496 |
[(set (reg:CCC FLAGS_REG) |
| 19497 |
(compare:CCC |
| 19498 |
(const_int 0) |
| 19499 |
(zero_extract:SWI48 (match_dup 1) (const_int 1) (match_dup 2)))) |
| 19500 |
(set (match_dup 3) |
| 19501 |
(ltu:QI (reg:CCC FLAGS_REG) (const_int 0))) |
| 19502 |
(set (match_dup 0) (zero_extend:SWI48 (match_dup 3)))] |
| 19503 |
{ |
| 19504 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 19505 |
operands[3] = gen_reg_rtx (QImode); |
| 19506 |
}) |
| 19507 |
|
| 19508 |
;; Store-flag instructions. |
| 19509 |
|
| 19510 |
(define_split |
| 19511 |
[(set (match_operand:QI 0 "nonimmediate_operand") |
| 19512 |
(match_operator:QI 1 "add_comparison_operator" |
| 19513 |
[(not:SWI (match_operand:SWI 2 "register_operand")) |
| 19514 |
(match_operand:SWI 3 "nonimmediate_operand")]))] |
| 19515 |
"" |
| 19516 |
[(set (reg:CCC FLAGS_REG) |
| 19517 |
(compare:CCC |
| 19518 |
(plus:SWI (match_dup 2) (match_dup 3)) |
| 19519 |
(match_dup 2))) |
| 19520 |
(set (match_dup 0) |
| 19521 |
(match_op_dup 1 [(reg:CCC FLAGS_REG) (const_int 0)]))]) |
| 19522 |
|
| 19523 |
(define_split |
| 19524 |
[(set (match_operand:QI 0 "nonimmediate_operand") |
| 19525 |
(match_operator:QI 1 "shr_comparison_operator" |
| 19526 |
[(match_operand:DI 2 "register_operand") |
| 19527 |
(match_operand 3 "const_int_operand")]))] |
| 19528 |
"TARGET_64BIT |
| 19529 |
&& IN_RANGE (exact_log2 (UINTVAL (operands[3]) + 1), 32, 63)" |
| 19530 |
[(set (reg:CCZ FLAGS_REG) |
| 19531 |
(compare:CCZ |
| 19532 |
(lshiftrt:DI (match_dup 2) (match_dup 4)) |
| 19533 |
(const_int 0))) |
| 19534 |
(set (match_dup 0) |
| 19535 |
(match_op_dup 1 [(reg:CCZ FLAGS_REG) (const_int 0)]))] |
| 19536 |
{ |
| 19537 |
enum rtx_code new_code; |
| 19538 |
|
| 19539 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19540 |
switch (GET_CODE (operands[1])) |
| 19541 |
{ |
| 19542 |
case GTU: new_code = NE; break; |
| 19543 |
case LEU: new_code = EQ; break; |
| 19544 |
default: gcc_unreachable (); |
| 19545 |
} |
| 19546 |
PUT_CODE (operands[1], new_code); |
| 19547 |
|
| 19548 |
operands[4] = GEN_INT (exact_log2 (UINTVAL (operands[3]) + 1)); |
| 19549 |
}) |
| 19550 |
|
| 19551 |
;; For all sCOND expanders, also expand the compare or test insn that |
| 19552 |
;; generates cc0. Generate an equality comparison if `seq' or `sne'. |
| 19553 |
|
| 19554 |
(define_insn "*setcc_<mode>_zu" |
| 19555 |
[(set (match_operand:SWI248 0 "register_operand" "=r") |
| 19556 |
(match_operator:SWI248 1 "ix86_comparison_operator" |
| 19557 |
[(reg FLAGS_REG) (const_int 0)]))] |
| 19558 |
"TARGET_APX_ZU" |
| 19559 |
"setzu%C1\t%b0" |
| 19560 |
[(set_attr "type" "setcc")]) |
| 19561 |
|
| 19562 |
(define_insn_and_split "*setcc_di_1" |
| 19563 |
[(set (match_operand:DI 0 "register_operand" "=q") |
| 19564 |
(match_operator:DI 1 "ix86_comparison_operator" |
| 19565 |
[(reg FLAGS_REG) (const_int 0)]))] |
| 19566 |
"!TARGET_APX_ZU && TARGET_64BIT && !TARGET_PARTIAL_REG_STALL" |
| 19567 |
"#" |
| 19568 |
"&& reload_completed" |
| 19569 |
[(set (match_dup 2) (match_dup 1)) |
| 19570 |
(set (match_dup 0) (zero_extend:DI (match_dup 2)))] |
| 19571 |
{ |
| 19572 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19573 |
PUT_MODE (operands[1], QImode); |
| 19574 |
operands[2] = gen_lowpart (QImode, operands[0]); |
| 19575 |
}) |
| 19576 |
|
| 19577 |
(define_insn_and_split "*setcc_<mode>_1_and" |
| 19578 |
[(set (match_operand:SWI24 0 "register_operand" "=q") |
| 19579 |
(match_operator:SWI24 1 "ix86_comparison_operator" |
| 19580 |
[(reg FLAGS_REG) (const_int 0)])) |
| 19581 |
(clobber (reg:CC FLAGS_REG))] |
| 19582 |
"!TARGET_PARTIAL_REG_STALL |
| 19583 |
&& TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)" |
| 19584 |
"#" |
| 19585 |
"&& reload_completed" |
| 19586 |
[(set (match_dup 2) (match_dup 1)) |
| 19587 |
(parallel [(set (match_dup 0) (zero_extend:SWI24 (match_dup 2))) |
| 19588 |
(clobber (reg:CC FLAGS_REG))])] |
| 19589 |
{ |
| 19590 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19591 |
PUT_MODE (operands[1], QImode); |
| 19592 |
operands[2] = gen_lowpart (QImode, operands[0]); |
| 19593 |
}) |
| 19594 |
|
| 19595 |
(define_insn_and_split "*setcc_<mode>_1_movzbl" |
| 19596 |
[(set (match_operand:SWI24 0 "register_operand" "=q") |
| 19597 |
(match_operator:SWI24 1 "ix86_comparison_operator" |
| 19598 |
[(reg FLAGS_REG) (const_int 0)]))] |
| 19599 |
"!TARGET_APX_ZU && !TARGET_PARTIAL_REG_STALL |
| 19600 |
&& (!TARGET_ZERO_EXTEND_WITH_AND || optimize_function_for_size_p (cfun))" |
| 19601 |
"#" |
| 19602 |
"&& reload_completed" |
| 19603 |
[(set (match_dup 2) (match_dup 1)) |
| 19604 |
(set (match_dup 0) (zero_extend:SWI24 (match_dup 2)))] |
| 19605 |
{ |
| 19606 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19607 |
PUT_MODE (operands[1], QImode); |
| 19608 |
operands[2] = gen_lowpart (QImode, operands[0]); |
| 19609 |
}) |
| 19610 |
|
| 19611 |
(define_insn "*setcc_qi" |
| 19612 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=qm") |
| 19613 |
(match_operator:QI 1 "ix86_comparison_operator" |
| 19614 |
[(reg FLAGS_REG) (const_int 0)]))] |
| 19615 |
"" |
| 19616 |
"set%C1\t%0" |
| 19617 |
[(set_attr "type" "setcc") |
| 19618 |
(set_attr "mode" "QI")]) |
| 19619 |
|
| 19620 |
(define_insn "*setcc_qi_slp" |
| 19621 |
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+q")) |
| 19622 |
(match_operator:QI 1 "ix86_comparison_operator" |
| 19623 |
[(reg FLAGS_REG) (const_int 0)]))] |
| 19624 |
"" |
| 19625 |
"set%C1\t%0" |
| 19626 |
[(set_attr "type" "setcc") |
| 19627 |
(set_attr "mode" "QI")]) |
| 19628 |
|
| 19629 |
(define_expand "setcc_si_slp" |
| 19630 |
[(set (match_operand:SI 0 "register_operand") |
| 19631 |
(unspec:SI |
| 19632 |
[(match_operand:QI 1) |
| 19633 |
(match_operand:SI 2 "register_operand")] UNSPEC_SETCC_SI_SLP))]) |
| 19634 |
|
| 19635 |
(define_insn_and_split "*setcc_si_slp" |
| 19636 |
[(set (match_operand:SI 0 "register_operand" "=q") |
| 19637 |
(unspec:SI |
| 19638 |
[(match_operator:QI 1 "ix86_comparison_operator" |
| 19639 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19640 |
(match_operand:SI 2 "register_operand" "0")] UNSPEC_SETCC_SI_SLP))] |
| 19641 |
"ix86_pre_reload_split ()" |
| 19642 |
"#" |
| 19643 |
"&& 1" |
| 19644 |
[(set (match_dup 0) (match_dup 2)) |
| 19645 |
(set (strict_low_part (match_dup 3)) (match_dup 1))] |
| 19646 |
{ |
| 19647 |
operands[3] = gen_lowpart (QImode, operands[0]); |
| 19648 |
}) |
| 19649 |
|
| 19650 |
;; In general it is not safe to assume too much about CCmode registers, |
| 19651 |
;; so simplify-rtx stops when it sees a second one. Under certain |
| 19652 |
;; conditions this is safe on x86, so help combine not create |
| 19653 |
;; |
| 19654 |
;; seta %al |
| 19655 |
;; testb %al, %al |
| 19656 |
;; sete %al |
| 19657 |
|
| 19658 |
(define_split |
| 19659 |
[(set (match_operand:QI 0 "nonimmediate_operand") |
| 19660 |
(ne:QI (match_operator 1 "ix86_comparison_operator" |
| 19661 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19662 |
(const_int 0)))] |
| 19663 |
"" |
| 19664 |
[(set (match_dup 0) (match_dup 1))] |
| 19665 |
{ |
| 19666 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19667 |
PUT_MODE (operands[1], QImode); |
| 19668 |
}) |
| 19669 |
|
| 19670 |
(define_split |
| 19671 |
[(set (strict_low_part (match_operand:QI 0 "register_operand")) |
| 19672 |
(ne:QI (match_operator 1 "ix86_comparison_operator" |
| 19673 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19674 |
(const_int 0)))] |
| 19675 |
"" |
| 19676 |
[(set (match_dup 0) (match_dup 1))] |
| 19677 |
{ |
| 19678 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19679 |
PUT_MODE (operands[1], QImode); |
| 19680 |
}) |
| 19681 |
|
| 19682 |
(define_split |
| 19683 |
[(set (match_operand:QI 0 "nonimmediate_operand") |
| 19684 |
(eq:QI (match_operator 1 "ix86_comparison_operator" |
| 19685 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19686 |
(const_int 0)))] |
| 19687 |
"" |
| 19688 |
[(set (match_dup 0) (match_dup 1))] |
| 19689 |
{ |
| 19690 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19691 |
PUT_MODE (operands[1], QImode); |
| 19692 |
PUT_CODE (operands[1], |
| 19693 |
ix86_reverse_condition (GET_CODE (operands[1]), |
| 19694 |
GET_MODE (XEXP (operands[1], 0)))); |
| 19695 |
|
| 19696 |
/* Make sure that (a) the CCmode we have for the flags is strong |
| 19697 |
enough for the reversed compare or (b) we have a valid FP compare. */ |
| 19698 |
if (! ix86_comparison_operator (operands[1], VOIDmode)) |
| 19699 |
FAIL; |
| 19700 |
}) |
| 19701 |
|
| 19702 |
(define_split |
| 19703 |
[(set (strict_low_part (match_operand:QI 0 "register_operand")) |
| 19704 |
(eq:QI (match_operator 1 "ix86_comparison_operator" |
| 19705 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19706 |
(const_int 0)))] |
| 19707 |
"" |
| 19708 |
[(set (match_dup 0) (match_dup 1))] |
| 19709 |
{ |
| 19710 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19711 |
PUT_MODE (operands[1], QImode); |
| 19712 |
PUT_CODE (operands[1], |
| 19713 |
ix86_reverse_condition (GET_CODE (operands[1]), |
| 19714 |
GET_MODE (XEXP (operands[1], 0)))); |
| 19715 |
|
| 19716 |
/* Make sure that (a) the CCmode we have for the flags is strong |
| 19717 |
enough for the reversed compare or (b) we have a valid FP compare. */ |
| 19718 |
if (! ix86_comparison_operator (operands[1], VOIDmode)) |
| 19719 |
FAIL; |
| 19720 |
}) |
| 19721 |
|
| 19722 |
;; Eliminate redundant compare between set{z,nz} and j{z,nz}: |
| 19723 |
;; setz %al; test %al,%al; jz <...> -> setz %al; jnz <...> and |
| 19724 |
;; setnz %al, test %al,%al; jz <...> -> setnz %al; jz <...>. |
| 19725 |
(define_peephole2 |
| 19726 |
[(set (match_operand:QI 0 "nonimmediate_operand") |
| 19727 |
(match_operator:QI 1 "bt_comparison_operator" |
| 19728 |
[(reg:CCZ FLAGS_REG) (const_int 0)])) |
| 19729 |
(set (reg:CCZ FLAGS_REG) |
| 19730 |
(compare:CCZ (match_dup 0) (const_int 0))) |
| 19731 |
(set (pc) |
| 19732 |
(if_then_else (match_operator 2 "bt_comparison_operator" |
| 19733 |
[(reg:CCZ FLAGS_REG) (const_int 0)]) |
| 19734 |
(match_operand 3) |
| 19735 |
(pc)))] |
| 19736 |
"peep2_regno_dead_p (3, FLAGS_REG)" |
| 19737 |
[(set (match_dup 0) |
| 19738 |
(match_op_dup 1 [(reg:CCZ FLAGS_REG) (const_int 0)])) |
| 19739 |
(set (pc) |
| 19740 |
(if_then_else (match_dup 2) |
| 19741 |
(match_dup 3) |
| 19742 |
(pc)))] |
| 19743 |
{ |
| 19744 |
if (GET_CODE (operands[1]) == EQ) |
| 19745 |
{ |
| 19746 |
operands[2] = shallow_copy_rtx (operands[2]); |
| 19747 |
PUT_CODE (operands[2], reverse_condition (GET_CODE (operands[2]))); |
| 19748 |
} |
| 19749 |
}) |
| 19750 |
|
| 19751 |
;; The SSE store flag instructions saves 0 or 0xffffffff to the result. |
| 19752 |
;; subsequent logical operations are used to imitate conditional moves. |
| 19753 |
;; 0xffffffff is NaN, but not in normalized form, so we can't represent |
| 19754 |
;; it directly. |
| 19755 |
|
| 19756 |
(define_insn "setcc_<mode>_sse" |
| 19757 |
[(set (match_operand:MODEF 0 "register_operand" "=x,x") |
| 19758 |
(match_operator:MODEF 3 "sse_comparison_operator" |
| 19759 |
[(match_operand:MODEF 1 "register_operand" "0,x") |
| 19760 |
(match_operand:MODEF 2 "nonimmediate_operand" "xm,xjm")]))] |
| 19761 |
"SSE_FLOAT_MODE_P (<MODE>mode)" |
| 19762 |
"@ |
| 19763 |
cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2} |
| 19764 |
vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}" |
| 19765 |
[(set_attr "isa" "noavx,avx") |
| 19766 |
(set_attr "addr" "*,gpr16") |
| 19767 |
(set_attr "type" "ssecmp") |
| 19768 |
(set_attr "length_immediate" "1") |
| 19769 |
(set_attr "prefix" "orig,vex") |
| 19770 |
(set_attr "mode" "<MODE>")]) |
| 19771 |
|
| 19772 |
(define_insn "setcc_hf_mask" |
| 19773 |
[(set (match_operand:QI 0 "register_operand" "=k") |
| 19774 |
(unspec:QI |
| 19775 |
[(match_operand:HF 1 "register_operand" "v") |
| 19776 |
(match_operand:HF 2 "nonimmediate_operand" "vm") |
| 19777 |
(match_operand:SI 3 "const_0_to_31_operand")] |
| 19778 |
UNSPEC_PCMP))] |
| 19779 |
"TARGET_AVX512FP16" |
| 19780 |
"vcmpsh\t{%3, %2, %1, %0|%0, %1, %2, %3}" |
| 19781 |
[(set_attr "type" "ssecmp") |
| 19782 |
(set_attr "prefix" "evex") |
| 19783 |
(set_attr "mode" "HF")]) |
| 19784 |
|
| 19785 |
|
| 19786 |
;; Basic conditional jump instructions. |
| 19787 |
|
| 19788 |
(define_split |
| 19789 |
[(set (pc) |
| 19790 |
(if_then_else |
| 19791 |
(match_operator 1 "add_comparison_operator" |
| 19792 |
[(not:SWI (match_operand:SWI 2 "register_operand")) |
| 19793 |
(match_operand:SWI 3 "nonimmediate_operand")]) |
| 19794 |
(label_ref (match_operand 0)) |
| 19795 |
(pc)))] |
| 19796 |
"" |
| 19797 |
[(set (reg:CCC FLAGS_REG) |
| 19798 |
(compare:CCC |
| 19799 |
(plus:SWI (match_dup 2) (match_dup 3)) |
| 19800 |
(match_dup 2))) |
| 19801 |
(set (pc) |
| 19802 |
(if_then_else (match_op_dup 1 [(reg:CCC FLAGS_REG) (const_int 0)]) |
| 19803 |
(label_ref (match_operand 0)) |
| 19804 |
(pc)))]) |
| 19805 |
|
| 19806 |
(define_split |
| 19807 |
[(set (pc) |
| 19808 |
(if_then_else |
| 19809 |
(match_operator 1 "shr_comparison_operator" |
| 19810 |
[(match_operand:DI 2 "register_operand") |
| 19811 |
(match_operand 3 "const_int_operand")]) |
| 19812 |
(label_ref (match_operand 0)) |
| 19813 |
(pc)))] |
| 19814 |
"TARGET_64BIT |
| 19815 |
&& IN_RANGE (exact_log2 (UINTVAL (operands[3]) + 1), 32, 63)" |
| 19816 |
[(set (reg:CCZ FLAGS_REG) |
| 19817 |
(compare:CCZ |
| 19818 |
(lshiftrt:DI (match_dup 2) (match_dup 4)) |
| 19819 |
(const_int 0))) |
| 19820 |
(set (pc) |
| 19821 |
(if_then_else (match_op_dup 1 [(reg:CCZ FLAGS_REG) (const_int 0)]) |
| 19822 |
(label_ref (match_operand 0)) |
| 19823 |
(pc)))] |
| 19824 |
{ |
| 19825 |
enum rtx_code new_code; |
| 19826 |
|
| 19827 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 19828 |
switch (GET_CODE (operands[1])) |
| 19829 |
{ |
| 19830 |
case GTU: new_code = NE; break; |
| 19831 |
case LEU: new_code = EQ; break; |
| 19832 |
default: gcc_unreachable (); |
| 19833 |
} |
| 19834 |
PUT_CODE (operands[1], new_code); |
| 19835 |
|
| 19836 |
operands[4] = GEN_INT (exact_log2 (UINTVAL (operands[3]) + 1)); |
| 19837 |
}) |
| 19838 |
|
| 19839 |
;; We ignore the overflow flag for signed branch instructions. |
| 19840 |
|
| 19841 |
(define_insn "*jcc" |
| 19842 |
[(set (pc) |
| 19843 |
(if_then_else (match_operator 1 "ix86_comparison_operator" |
| 19844 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19845 |
(label_ref (match_operand 0)) |
| 19846 |
(pc)))] |
| 19847 |
"" |
| 19848 |
"%!%+j%C1\t%l0" |
| 19849 |
[(set_attr "type" "ibr") |
| 19850 |
(set_attr "modrm" "0") |
| 19851 |
(set (attr "length") |
| 19852 |
(if_then_else |
| 19853 |
(and (ge (minus (match_dup 0) (pc)) |
| 19854 |
(const_int -126)) |
| 19855 |
(lt (minus (match_dup 0) (pc)) |
| 19856 |
(const_int 128))) |
| 19857 |
(const_int 2) |
| 19858 |
(const_int 6)))]) |
| 19859 |
|
| 19860 |
;; In general it is not safe to assume too much about CCmode registers, |
| 19861 |
;; so simplify-rtx stops when it sees a second one. Under certain |
| 19862 |
;; conditions this is safe on x86, so help combine not create |
| 19863 |
;; |
| 19864 |
;; seta %al |
| 19865 |
;; testb %al, %al |
| 19866 |
;; je Lfoo |
| 19867 |
|
| 19868 |
(define_split |
| 19869 |
[(set (pc) |
| 19870 |
(if_then_else (ne (match_operator 0 "ix86_comparison_operator" |
| 19871 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19872 |
(const_int 0)) |
| 19873 |
(label_ref (match_operand 1)) |
| 19874 |
(pc)))] |
| 19875 |
"" |
| 19876 |
[(set (pc) |
| 19877 |
(if_then_else (match_dup 0) |
| 19878 |
(label_ref (match_dup 1)) |
| 19879 |
(pc)))] |
| 19880 |
{ |
| 19881 |
operands[0] = shallow_copy_rtx (operands[0]); |
| 19882 |
PUT_MODE (operands[0], VOIDmode); |
| 19883 |
}) |
| 19884 |
|
| 19885 |
(define_split |
| 19886 |
[(set (pc) |
| 19887 |
(if_then_else (eq (match_operator 0 "ix86_comparison_operator" |
| 19888 |
[(reg FLAGS_REG) (const_int 0)]) |
| 19889 |
(const_int 0)) |
| 19890 |
(label_ref (match_operand 1)) |
| 19891 |
(pc)))] |
| 19892 |
"" |
| 19893 |
[(set (pc) |
| 19894 |
(if_then_else (match_dup 0) |
| 19895 |
(label_ref (match_dup 1)) |
| 19896 |
(pc)))] |
| 19897 |
{ |
| 19898 |
operands[0] = shallow_copy_rtx (operands[0]); |
| 19899 |
PUT_MODE (operands[0], VOIDmode); |
| 19900 |
PUT_CODE (operands[0], |
| 19901 |
ix86_reverse_condition (GET_CODE (operands[0]), |
| 19902 |
GET_MODE (XEXP (operands[0], 0)))); |
| 19903 |
|
| 19904 |
/* Make sure that (a) the CCmode we have for the flags is strong |
| 19905 |
enough for the reversed compare or (b) we have a valid FP compare. */ |
| 19906 |
if (! ix86_comparison_operator (operands[0], VOIDmode)) |
| 19907 |
FAIL; |
| 19908 |
}) |
| 19909 |
|
| 19910 |
;; Unconditional and other jump instructions |
| 19911 |
|
| 19912 |
(define_insn "jump" |
| 19913 |
[(set (pc) |
| 19914 |
(label_ref (match_operand 0)))] |
| 19915 |
"" |
| 19916 |
"%!jmp\t%l0" |
| 19917 |
[(set_attr "type" "ibr") |
| 19918 |
(set_attr "modrm" "0") |
| 19919 |
(set (attr "length") |
| 19920 |
(if_then_else |
| 19921 |
(and (ge (minus (match_dup 0) (pc)) |
| 19922 |
(const_int -126)) |
| 19923 |
(lt (minus (match_dup 0) (pc)) |
| 19924 |
(const_int 128))) |
| 19925 |
(const_int 2) |
| 19926 |
(const_int 5)))]) |
| 19927 |
|
| 19928 |
(define_expand "indirect_jump" |
| 19929 |
[(set (pc) (match_operand 0 "indirect_branch_operand"))] |
| 19930 |
"" |
| 19931 |
{ |
| 19932 |
if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER) |
| 19933 |
operands[0] = convert_memory_address (word_mode, operands[0]); |
| 19934 |
cfun->machine->has_local_indirect_jump = true; |
| 19935 |
}) |
| 19936 |
|
| 19937 |
(define_insn "*indirect_jump" |
| 19938 |
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))] |
| 19939 |
"" |
| 19940 |
"* return ix86_output_indirect_jmp (operands[0]);" |
| 19941 |
[(set (attr "type") |
| 19942 |
(if_then_else (match_test "(cfun->machine->indirect_branch_type |
| 19943 |
!= indirect_branch_keep)") |
| 19944 |
(const_string "multi") |
| 19945 |
(const_string "ibr"))) |
| 19946 |
(set_attr "length_immediate" "0")]) |
| 19947 |
|
| 19948 |
(define_expand "tablejump" |
| 19949 |
[(parallel [(set (pc) (match_operand 0 "indirect_branch_operand")) |
| 19950 |
(use (label_ref (match_operand 1)))])] |
| 19951 |
"" |
| 19952 |
{ |
| 19953 |
/* In PIC mode, the table entries are stored GOT (32-bit) or PC (64-bit) |
| 19954 |
relative. Convert the relative address to an absolute address. */ |
| 19955 |
if (flag_pic) |
| 19956 |
{ |
| 19957 |
rtx op0, op1; |
| 19958 |
enum rtx_code code; |
| 19959 |
|
| 19960 |
/* We can't use @GOTOFF for text labels on VxWorks; |
| 19961 |
see gotoff_operand. */ |
| 19962 |
if (TARGET_64BIT || TARGET_VXWORKS_RTP) |
| 19963 |
{ |
| 19964 |
code = PLUS; |
| 19965 |
op0 = operands[0]; |
| 19966 |
op1 = gen_rtx_LABEL_REF (Pmode, operands[1]); |
| 19967 |
} |
| 19968 |
else if (TARGET_MACHO || HAVE_AS_GOTOFF_IN_DATA) |
| 19969 |
{ |
| 19970 |
code = PLUS; |
| 19971 |
op0 = operands[0]; |
| 19972 |
op1 = pic_offset_table_rtx; |
| 19973 |
} |
| 19974 |
else |
| 19975 |
{ |
| 19976 |
code = MINUS; |
| 19977 |
op0 = pic_offset_table_rtx; |
| 19978 |
op1 = operands[0]; |
| 19979 |
} |
| 19980 |
|
| 19981 |
operands[0] = expand_simple_binop (Pmode, code, op0, op1, NULL_RTX, 0, |
| 19982 |
OPTAB_DIRECT); |
| 19983 |
} |
| 19984 |
|
| 19985 |
if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER) |
| 19986 |
operands[0] = convert_memory_address (word_mode, operands[0]); |
| 19987 |
cfun->machine->has_local_indirect_jump = true; |
| 19988 |
}) |
| 19989 |
|
| 19990 |
(define_insn "*tablejump_1" |
| 19991 |
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw")) |
| 19992 |
(use (label_ref (match_operand 1)))] |
| 19993 |
"" |
| 19994 |
"* return ix86_output_indirect_jmp (operands[0]);" |
| 19995 |
[(set (attr "type") |
| 19996 |
(if_then_else (match_test "(cfun->machine->indirect_branch_type |
| 19997 |
!= indirect_branch_keep)") |
| 19998 |
(const_string "multi") |
| 19999 |
(const_string "ibr"))) |
| 20000 |
(set_attr "length_immediate" "0")]) |
| 20001 |
|
| 20002 |
;; Convert setcc + movzbl to xor + setcc if operands don't overlap. |
| 20003 |
|
| 20004 |
(define_peephole2 |
| 20005 |
[(set (match_operand 4 "flags_reg_operand") (match_operand 0)) |
| 20006 |
(set (match_operand:QI 1 "register_operand") |
| 20007 |
(match_operator:QI 2 "ix86_comparison_operator" |
| 20008 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20009 |
(set (match_operand 3 "any_QIreg_operand") |
| 20010 |
(zero_extend (match_dup 1)))] |
| 20011 |
"(peep2_reg_dead_p (3, operands[1]) |
| 20012 |
|| operands_match_p (operands[1], operands[3])) |
| 20013 |
&& ! reg_overlap_mentioned_p (operands[3], operands[0]) |
| 20014 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20015 |
[(set (match_dup 4) (match_dup 0)) |
| 20016 |
(set (strict_low_part (match_dup 5)) |
| 20017 |
(match_dup 2))] |
| 20018 |
{ |
| 20019 |
operands[5] = gen_lowpart (QImode, operands[3]); |
| 20020 |
ix86_expand_clear (operands[3]); |
| 20021 |
}) |
| 20022 |
|
| 20023 |
(define_peephole2 |
| 20024 |
[(parallel [(set (match_operand 5 "flags_reg_operand") (match_operand 0)) |
| 20025 |
(match_operand 4)]) |
| 20026 |
(set (match_operand:QI 1 "register_operand") |
| 20027 |
(match_operator:QI 2 "ix86_comparison_operator" |
| 20028 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20029 |
(set (match_operand 3 "any_QIreg_operand") |
| 20030 |
(zero_extend (match_dup 1)))] |
| 20031 |
"(peep2_reg_dead_p (3, operands[1]) |
| 20032 |
|| operands_match_p (operands[1], operands[3])) |
| 20033 |
&& ! reg_overlap_mentioned_p (operands[3], operands[0]) |
| 20034 |
&& ! reg_overlap_mentioned_p (operands[3], operands[4]) |
| 20035 |
&& ! reg_set_p (operands[3], operands[4]) |
| 20036 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20037 |
[(parallel [(set (match_dup 5) (match_dup 0)) |
| 20038 |
(match_dup 4)]) |
| 20039 |
(set (strict_low_part (match_dup 6)) |
| 20040 |
(match_dup 2))] |
| 20041 |
{ |
| 20042 |
operands[6] = gen_lowpart (QImode, operands[3]); |
| 20043 |
ix86_expand_clear (operands[3]); |
| 20044 |
}) |
| 20045 |
|
| 20046 |
(define_peephole2 |
| 20047 |
[(set (match_operand 6 "flags_reg_operand") (match_operand 0)) |
| 20048 |
(parallel [(set (match_operand 7 "flags_reg_operand") (match_operand 1)) |
| 20049 |
(match_operand 5)]) |
| 20050 |
(set (match_operand:QI 2 "register_operand") |
| 20051 |
(match_operator:QI 3 "ix86_comparison_operator" |
| 20052 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20053 |
(set (match_operand 4 "any_QIreg_operand") |
| 20054 |
(zero_extend (match_dup 2)))] |
| 20055 |
"(peep2_reg_dead_p (4, operands[2]) |
| 20056 |
|| operands_match_p (operands[2], operands[4])) |
| 20057 |
&& ! reg_overlap_mentioned_p (operands[4], operands[0]) |
| 20058 |
&& ! reg_overlap_mentioned_p (operands[4], operands[1]) |
| 20059 |
&& ! reg_overlap_mentioned_p (operands[4], operands[5]) |
| 20060 |
&& ! reg_set_p (operands[4], operands[5]) |
| 20061 |
&& refers_to_regno_p (FLAGS_REG, operands[1], (rtx *)NULL) |
| 20062 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20063 |
[(set (match_dup 6) (match_dup 0)) |
| 20064 |
(parallel [(set (match_dup 7) (match_dup 1)) |
| 20065 |
(match_dup 5)]) |
| 20066 |
(set (strict_low_part (match_dup 8)) |
| 20067 |
(match_dup 3))] |
| 20068 |
{ |
| 20069 |
operands[8] = gen_lowpart (QImode, operands[4]); |
| 20070 |
ix86_expand_clear (operands[4]); |
| 20071 |
}) |
| 20072 |
|
| 20073 |
;; Similar, but match zero extend with andsi3. |
| 20074 |
|
| 20075 |
(define_peephole2 |
| 20076 |
[(set (match_operand 4 "flags_reg_operand") (match_operand 0)) |
| 20077 |
(set (match_operand:QI 1 "register_operand") |
| 20078 |
(match_operator:QI 2 "ix86_comparison_operator" |
| 20079 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20080 |
(parallel [(set (match_operand:SI 3 "any_QIreg_operand") |
| 20081 |
(and:SI (match_dup 3) (const_int 255))) |
| 20082 |
(clobber (reg:CC FLAGS_REG))])] |
| 20083 |
"REGNO (operands[1]) == REGNO (operands[3]) |
| 20084 |
&& ! reg_overlap_mentioned_p (operands[3], operands[0]) |
| 20085 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20086 |
[(set (match_dup 4) (match_dup 0)) |
| 20087 |
(set (strict_low_part (match_dup 5)) |
| 20088 |
(match_dup 2))] |
| 20089 |
{ |
| 20090 |
operands[5] = gen_lowpart (QImode, operands[3]); |
| 20091 |
ix86_expand_clear (operands[3]); |
| 20092 |
}) |
| 20093 |
|
| 20094 |
(define_peephole2 |
| 20095 |
[(parallel [(set (match_operand 5 "flags_reg_operand") (match_operand 0)) |
| 20096 |
(match_operand 4)]) |
| 20097 |
(set (match_operand:QI 1 "register_operand") |
| 20098 |
(match_operator:QI 2 "ix86_comparison_operator" |
| 20099 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20100 |
(parallel [(set (match_operand 3 "any_QIreg_operand") |
| 20101 |
(zero_extend (match_dup 1))) |
| 20102 |
(clobber (reg:CC FLAGS_REG))])] |
| 20103 |
"(peep2_reg_dead_p (3, operands[1]) |
| 20104 |
|| operands_match_p (operands[1], operands[3])) |
| 20105 |
&& ! reg_overlap_mentioned_p (operands[3], operands[0]) |
| 20106 |
&& ! reg_overlap_mentioned_p (operands[3], operands[4]) |
| 20107 |
&& ! reg_set_p (operands[3], operands[4]) |
| 20108 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20109 |
[(parallel [(set (match_dup 5) (match_dup 0)) |
| 20110 |
(match_dup 4)]) |
| 20111 |
(set (strict_low_part (match_dup 6)) |
| 20112 |
(match_dup 2))] |
| 20113 |
{ |
| 20114 |
operands[6] = gen_lowpart (QImode, operands[3]); |
| 20115 |
ix86_expand_clear (operands[3]); |
| 20116 |
}) |
| 20117 |
|
| 20118 |
(define_peephole2 |
| 20119 |
[(set (match_operand 6 "flags_reg_operand") (match_operand 0)) |
| 20120 |
(parallel [(set (match_operand 7 "flags_reg_operand") (match_operand 1)) |
| 20121 |
(match_operand 5)]) |
| 20122 |
(set (match_operand:QI 2 "register_operand") |
| 20123 |
(match_operator:QI 3 "ix86_comparison_operator" |
| 20124 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20125 |
(parallel [(set (match_operand 4 "any_QIreg_operand") |
| 20126 |
(zero_extend (match_dup 2))) |
| 20127 |
(clobber (reg:CC FLAGS_REG))])] |
| 20128 |
"(peep2_reg_dead_p (4, operands[2]) |
| 20129 |
|| operands_match_p (operands[2], operands[4])) |
| 20130 |
&& ! reg_overlap_mentioned_p (operands[4], operands[0]) |
| 20131 |
&& ! reg_overlap_mentioned_p (operands[4], operands[1]) |
| 20132 |
&& ! reg_overlap_mentioned_p (operands[4], operands[5]) |
| 20133 |
&& ! reg_set_p (operands[4], operands[5]) |
| 20134 |
&& refers_to_regno_p (FLAGS_REG, operands[1], (rtx *)NULL) |
| 20135 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20136 |
[(set (match_dup 6) (match_dup 0)) |
| 20137 |
(parallel [(set (match_dup 7) (match_dup 1)) |
| 20138 |
(match_dup 5)]) |
| 20139 |
(set (strict_low_part (match_dup 8)) |
| 20140 |
(match_dup 3))] |
| 20141 |
{ |
| 20142 |
operands[8] = gen_lowpart (QImode, operands[4]); |
| 20143 |
ix86_expand_clear (operands[4]); |
| 20144 |
}) |
| 20145 |
|
| 20146 |
(define_peephole2 |
| 20147 |
[(set (match_operand 4 "flags_reg_operand") (match_operand 0)) |
| 20148 |
(set (strict_low_part (match_operand:QI 5 "register_operand")) |
| 20149 |
(match_operator:QI 6 "ix86_comparison_operator" |
| 20150 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20151 |
(set (match_operand:QI 1 "register_operand") |
| 20152 |
(match_operator:QI 2 "ix86_comparison_operator" |
| 20153 |
[(reg FLAGS_REG) (const_int 0)])) |
| 20154 |
(set (match_operand 3 "any_QIreg_operand") |
| 20155 |
(zero_extend (match_dup 1)))] |
| 20156 |
"(peep2_reg_dead_p (4, operands[1]) |
| 20157 |
|| operands_match_p (operands[1], operands[3])) |
| 20158 |
&& ! reg_overlap_mentioned_p (operands[3], operands[0]) |
| 20159 |
&& ! reg_overlap_mentioned_p (operands[3], operands[5]) |
| 20160 |
&& ! reg_overlap_mentioned_p (operands[1], operands[5]) |
| 20161 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 20162 |
[(set (match_dup 4) (match_dup 0)) |
| 20163 |
(set (strict_low_part (match_dup 5)) |
| 20164 |
(match_dup 6)) |
| 20165 |
(set (strict_low_part (match_dup 7)) |
| 20166 |
(match_dup 2))] |
| 20167 |
{ |
| 20168 |
operands[7] = gen_lowpart (QImode, operands[3]); |
| 20169 |
ix86_expand_clear (operands[3]); |
| 20170 |
}) |
| 20171 |
|
| 20172 |
;; Call instructions. |
| 20173 |
|
| 20174 |
;; The predicates normally associated with named expanders are not properly |
| 20175 |
;; checked for calls. This is a bug in the generic code, but it isn't that |
| 20176 |
;; easy to fix. Ignore it for now and be prepared to fix things up. |
| 20177 |
|
| 20178 |
;; P6 processors will jump to the address after the decrement when %esp |
| 20179 |
;; is used as a call operand, so they will execute return address as a code. |
| 20180 |
;; See Pentium Pro errata 70, Pentium 2 errata A33 and Pentium 3 errata E17. |
| 20181 |
|
| 20182 |
;; Register constraint for call instruction. |
| 20183 |
(define_mode_attr c [(SI "l") (DI "r")]) |
| 20184 |
|
| 20185 |
;; Call subroutine returning no value. |
| 20186 |
|
| 20187 |
(define_expand "call" |
| 20188 |
[(call (match_operand:QI 0) |
| 20189 |
(match_operand 1)) |
| 20190 |
(use (match_operand 2))] |
| 20191 |
"" |
| 20192 |
{ |
| 20193 |
ix86_expand_call (NULL, operands[0], operands[1], |
| 20194 |
operands[2], NULL, false); |
| 20195 |
DONE; |
| 20196 |
}) |
| 20197 |
|
| 20198 |
(define_expand "sibcall" |
| 20199 |
[(call (match_operand:QI 0) |
| 20200 |
(match_operand 1)) |
| 20201 |
(use (match_operand 2))] |
| 20202 |
"" |
| 20203 |
{ |
| 20204 |
ix86_expand_call (NULL, operands[0], operands[1], |
| 20205 |
operands[2], NULL, true); |
| 20206 |
DONE; |
| 20207 |
}) |
| 20208 |
|
| 20209 |
(define_insn "*call" |
| 20210 |
[(call (mem:QI (match_operand:W 0 "call_insn_operand" "<c>BwBz")) |
| 20211 |
(match_operand 1))] |
| 20212 |
"!SIBLING_CALL_P (insn)" |
| 20213 |
"* return ix86_output_call_insn (insn, operands[0]);" |
| 20214 |
[(set_attr "type" "call")]) |
| 20215 |
|
| 20216 |
;; This covers both call and sibcall since only GOT slot is allowed. |
| 20217 |
(define_insn "*call_got_x32" |
| 20218 |
[(call (mem:QI (zero_extend:DI |
| 20219 |
(match_operand:SI 0 "GOT_memory_operand" "Bg"))) |
| 20220 |
(match_operand 1))] |
| 20221 |
"TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER" |
| 20222 |
{ |
| 20223 |
rtx fnaddr = gen_const_mem (DImode, XEXP (operands[0], 0)); |
| 20224 |
return ix86_output_call_insn (insn, fnaddr); |
| 20225 |
} |
| 20226 |
[(set_attr "type" "call")]) |
| 20227 |
|
| 20228 |
;; Since sibcall never returns, we can only use call-clobbered register |
| 20229 |
;; as GOT base. |
| 20230 |
(define_insn "*sibcall_GOT_32" |
| 20231 |
[(call (mem:QI |
| 20232 |
(mem:SI (plus:SI |
| 20233 |
(match_operand:SI 0 "register_no_elim_operand" "U") |
| 20234 |
(match_operand:SI 1 "GOT32_symbol_operand")))) |
| 20235 |
(match_operand 2))] |
| 20236 |
"!TARGET_MACHO |
| 20237 |
&& !TARGET_64BIT && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20238 |
&& SIBLING_CALL_P (insn)" |
| 20239 |
{ |
| 20240 |
rtx fnaddr = gen_rtx_PLUS (SImode, operands[0], operands[1]); |
| 20241 |
fnaddr = gen_const_mem (SImode, fnaddr); |
| 20242 |
return ix86_output_call_insn (insn, fnaddr); |
| 20243 |
} |
| 20244 |
[(set_attr "type" "call")]) |
| 20245 |
|
| 20246 |
(define_insn "*sibcall" |
| 20247 |
[(call (mem:QI (match_operand:W 0 "sibcall_insn_operand" "UBsBz")) |
| 20248 |
(match_operand 1))] |
| 20249 |
"SIBLING_CALL_P (insn)" |
| 20250 |
"* return ix86_output_call_insn (insn, operands[0]);" |
| 20251 |
[(set_attr "type" "call")]) |
| 20252 |
|
| 20253 |
(define_insn "*sibcall_memory" |
| 20254 |
[(call (mem:QI (match_operand:W 0 "memory_operand" "m")) |
| 20255 |
(match_operand 1)) |
| 20256 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)] |
| 20257 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER" |
| 20258 |
"* return ix86_output_call_insn (insn, operands[0]);" |
| 20259 |
[(set_attr "type" "call")]) |
| 20260 |
|
| 20261 |
(define_peephole2 |
| 20262 |
[(set (match_operand:W 0 "register_operand") |
| 20263 |
(match_operand:W 1 "memory_operand")) |
| 20264 |
(call (mem:QI (match_dup 0)) |
| 20265 |
(match_operand 3))] |
| 20266 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20267 |
&& SIBLING_CALL_P (peep2_next_insn (1)) |
| 20268 |
&& !reg_mentioned_p (operands[0], |
| 20269 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" |
| 20270 |
[(parallel [(call (mem:QI (match_dup 1)) |
| 20271 |
(match_dup 3)) |
| 20272 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20273 |
|
| 20274 |
(define_peephole2 |
| 20275 |
[(set (match_operand:W 0 "register_operand") |
| 20276 |
(match_operand:W 1 "memory_operand")) |
| 20277 |
(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20278 |
(call (mem:QI (match_dup 0)) |
| 20279 |
(match_operand 3))] |
| 20280 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20281 |
&& SIBLING_CALL_P (peep2_next_insn (2)) |
| 20282 |
&& !reg_mentioned_p (operands[0], |
| 20283 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" |
| 20284 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20285 |
(parallel [(call (mem:QI (match_dup 1)) |
| 20286 |
(match_dup 3)) |
| 20287 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20288 |
|
| 20289 |
(define_expand "call_pop" |
| 20290 |
[(parallel [(call (match_operand:QI 0) |
| 20291 |
(match_operand:SI 1)) |
| 20292 |
(set (reg:SI SP_REG) |
| 20293 |
(plus:SI (reg:SI SP_REG) |
| 20294 |
(match_operand:SI 3)))])] |
| 20295 |
"!TARGET_64BIT" |
| 20296 |
{ |
| 20297 |
ix86_expand_call (NULL, operands[0], operands[1], |
| 20298 |
operands[2], operands[3], false); |
| 20299 |
DONE; |
| 20300 |
}) |
| 20301 |
|
| 20302 |
(define_insn "*call_pop" |
| 20303 |
[(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lBwBz")) |
| 20304 |
(match_operand 1)) |
| 20305 |
(set (reg:SI SP_REG) |
| 20306 |
(plus:SI (reg:SI SP_REG) |
| 20307 |
(match_operand:SI 2 "immediate_operand" "i")))] |
| 20308 |
"!TARGET_64BIT && !SIBLING_CALL_P (insn)" |
| 20309 |
"* return ix86_output_call_insn (insn, operands[0]);" |
| 20310 |
[(set_attr "type" "call")]) |
| 20311 |
|
| 20312 |
(define_insn "*sibcall_pop" |
| 20313 |
[(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "UBsBz")) |
| 20314 |
(match_operand 1)) |
| 20315 |
(set (reg:SI SP_REG) |
| 20316 |
(plus:SI (reg:SI SP_REG) |
| 20317 |
(match_operand:SI 2 "immediate_operand" "i")))] |
| 20318 |
"!TARGET_64BIT && SIBLING_CALL_P (insn)" |
| 20319 |
"* return ix86_output_call_insn (insn, operands[0]);" |
| 20320 |
[(set_attr "type" "call")]) |
| 20321 |
|
| 20322 |
(define_insn "*sibcall_pop_memory" |
| 20323 |
[(call (mem:QI (match_operand:SI 0 "memory_operand" "Bs")) |
| 20324 |
(match_operand 1)) |
| 20325 |
(set (reg:SI SP_REG) |
| 20326 |
(plus:SI (reg:SI SP_REG) |
| 20327 |
(match_operand:SI 2 "immediate_operand" "i"))) |
| 20328 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)] |
| 20329 |
"!TARGET_64BIT && !TARGET_INDIRECT_BRANCH_REGISTER" |
| 20330 |
"* return ix86_output_call_insn (insn, operands[0]);" |
| 20331 |
[(set_attr "type" "call")]) |
| 20332 |
|
| 20333 |
(define_peephole2 |
| 20334 |
[(set (match_operand:SI 0 "register_operand") |
| 20335 |
(match_operand:SI 1 "memory_operand")) |
| 20336 |
(parallel [(call (mem:QI (match_dup 0)) |
| 20337 |
(match_operand 3)) |
| 20338 |
(set (reg:SI SP_REG) |
| 20339 |
(plus:SI (reg:SI SP_REG) |
| 20340 |
(match_operand:SI 4 "immediate_operand")))])] |
| 20341 |
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1)) |
| 20342 |
&& !reg_mentioned_p (operands[0], |
| 20343 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" |
| 20344 |
[(parallel [(call (mem:QI (match_dup 1)) |
| 20345 |
(match_dup 3)) |
| 20346 |
(set (reg:SI SP_REG) |
| 20347 |
(plus:SI (reg:SI SP_REG) |
| 20348 |
(match_dup 4))) |
| 20349 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20350 |
|
| 20351 |
(define_peephole2 |
| 20352 |
[(set (match_operand:SI 0 "register_operand") |
| 20353 |
(match_operand:SI 1 "memory_operand")) |
| 20354 |
(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20355 |
(parallel [(call (mem:QI (match_dup 0)) |
| 20356 |
(match_operand 3)) |
| 20357 |
(set (reg:SI SP_REG) |
| 20358 |
(plus:SI (reg:SI SP_REG) |
| 20359 |
(match_operand:SI 4 "immediate_operand")))])] |
| 20360 |
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2)) |
| 20361 |
&& !reg_mentioned_p (operands[0], |
| 20362 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" |
| 20363 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20364 |
(parallel [(call (mem:QI (match_dup 1)) |
| 20365 |
(match_dup 3)) |
| 20366 |
(set (reg:SI SP_REG) |
| 20367 |
(plus:SI (reg:SI SP_REG) |
| 20368 |
(match_dup 4))) |
| 20369 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20370 |
|
| 20371 |
;; Combining simple memory jump instruction |
| 20372 |
|
| 20373 |
(define_peephole2 |
| 20374 |
[(set (match_operand:W 0 "register_operand") |
| 20375 |
(match_operand:W 1 "memory_operand")) |
| 20376 |
(set (pc) (match_dup 0))] |
| 20377 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20378 |
&& peep2_reg_dead_p (2, operands[0])" |
| 20379 |
[(set (pc) (match_dup 1))]) |
| 20380 |
|
| 20381 |
;; Call subroutine, returning value in operand 0 |
| 20382 |
|
| 20383 |
(define_expand "call_value" |
| 20384 |
[(set (match_operand 0) |
| 20385 |
(call (match_operand:QI 1) |
| 20386 |
(match_operand 2))) |
| 20387 |
(use (match_operand 3))] |
| 20388 |
"" |
| 20389 |
{ |
| 20390 |
ix86_expand_call (operands[0], operands[1], operands[2], |
| 20391 |
operands[3], NULL, false); |
| 20392 |
DONE; |
| 20393 |
}) |
| 20394 |
|
| 20395 |
(define_expand "sibcall_value" |
| 20396 |
[(set (match_operand 0) |
| 20397 |
(call (match_operand:QI 1) |
| 20398 |
(match_operand 2))) |
| 20399 |
(use (match_operand 3))] |
| 20400 |
"" |
| 20401 |
{ |
| 20402 |
ix86_expand_call (operands[0], operands[1], operands[2], |
| 20403 |
operands[3], NULL, true); |
| 20404 |
DONE; |
| 20405 |
}) |
| 20406 |
|
| 20407 |
(define_insn "*call_value" |
| 20408 |
[(set (match_operand 0) |
| 20409 |
(call (mem:QI (match_operand:W 1 "call_insn_operand" "<c>BwBz")) |
| 20410 |
(match_operand 2)))] |
| 20411 |
"!SIBLING_CALL_P (insn)" |
| 20412 |
"* return ix86_output_call_insn (insn, operands[1]);" |
| 20413 |
[(set_attr "type" "callv")]) |
| 20414 |
|
| 20415 |
;; This covers both call and sibcall since only GOT slot is allowed. |
| 20416 |
(define_insn "*call_value_got_x32" |
| 20417 |
[(set (match_operand 0) |
| 20418 |
(call (mem:QI |
| 20419 |
(zero_extend:DI |
| 20420 |
(match_operand:SI 1 "GOT_memory_operand" "Bg"))) |
| 20421 |
(match_operand 2)))] |
| 20422 |
"TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER" |
| 20423 |
{ |
| 20424 |
rtx fnaddr = gen_const_mem (DImode, XEXP (operands[1], 0)); |
| 20425 |
return ix86_output_call_insn (insn, fnaddr); |
| 20426 |
} |
| 20427 |
[(set_attr "type" "callv")]) |
| 20428 |
|
| 20429 |
;; Since sibcall never returns, we can only use call-clobbered register |
| 20430 |
;; as GOT base. |
| 20431 |
(define_insn "*sibcall_value_GOT_32" |
| 20432 |
[(set (match_operand 0) |
| 20433 |
(call (mem:QI |
| 20434 |
(mem:SI (plus:SI |
| 20435 |
(match_operand:SI 1 "register_no_elim_operand" "U") |
| 20436 |
(match_operand:SI 2 "GOT32_symbol_operand")))) |
| 20437 |
(match_operand 3)))] |
| 20438 |
"!TARGET_MACHO |
| 20439 |
&& !TARGET_64BIT && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20440 |
&& SIBLING_CALL_P (insn)" |
| 20441 |
{ |
| 20442 |
rtx fnaddr = gen_rtx_PLUS (SImode, operands[1], operands[2]); |
| 20443 |
fnaddr = gen_const_mem (SImode, fnaddr); |
| 20444 |
return ix86_output_call_insn (insn, fnaddr); |
| 20445 |
} |
| 20446 |
[(set_attr "type" "callv")]) |
| 20447 |
|
| 20448 |
(define_insn "*sibcall_value" |
| 20449 |
[(set (match_operand 0) |
| 20450 |
(call (mem:QI (match_operand:W 1 "sibcall_insn_operand" "UBsBz")) |
| 20451 |
(match_operand 2)))] |
| 20452 |
"SIBLING_CALL_P (insn)" |
| 20453 |
"* return ix86_output_call_insn (insn, operands[1]);" |
| 20454 |
[(set_attr "type" "callv")]) |
| 20455 |
|
| 20456 |
(define_insn "*sibcall_value_memory" |
| 20457 |
[(set (match_operand 0) |
| 20458 |
(call (mem:QI (match_operand:W 1 "memory_operand" "m")) |
| 20459 |
(match_operand 2))) |
| 20460 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)] |
| 20461 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER" |
| 20462 |
"* return ix86_output_call_insn (insn, operands[1]);" |
| 20463 |
[(set_attr "type" "callv")]) |
| 20464 |
|
| 20465 |
(define_peephole2 |
| 20466 |
[(set (match_operand:W 0 "register_operand") |
| 20467 |
(match_operand:W 1 "memory_operand")) |
| 20468 |
(set (match_operand 2) |
| 20469 |
(call (mem:QI (match_dup 0)) |
| 20470 |
(match_operand 3)))] |
| 20471 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20472 |
&& SIBLING_CALL_P (peep2_next_insn (1)) |
| 20473 |
&& !reg_mentioned_p (operands[0], |
| 20474 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" |
| 20475 |
[(parallel [(set (match_dup 2) |
| 20476 |
(call (mem:QI (match_dup 1)) |
| 20477 |
(match_dup 3))) |
| 20478 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20479 |
|
| 20480 |
(define_peephole2 |
| 20481 |
[(set (match_operand:W 0 "register_operand") |
| 20482 |
(match_operand:W 1 "memory_operand")) |
| 20483 |
(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20484 |
(set (match_operand 2) |
| 20485 |
(call (mem:QI (match_dup 0)) |
| 20486 |
(match_operand 3)))] |
| 20487 |
"!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER |
| 20488 |
&& SIBLING_CALL_P (peep2_next_insn (2)) |
| 20489 |
&& !reg_mentioned_p (operands[0], |
| 20490 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" |
| 20491 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20492 |
(parallel [(set (match_dup 2) |
| 20493 |
(call (mem:QI (match_dup 1)) |
| 20494 |
(match_dup 3))) |
| 20495 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20496 |
|
| 20497 |
(define_expand "call_value_pop" |
| 20498 |
[(parallel [(set (match_operand 0) |
| 20499 |
(call (match_operand:QI 1) |
| 20500 |
(match_operand:SI 2))) |
| 20501 |
(set (reg:SI SP_REG) |
| 20502 |
(plus:SI (reg:SI SP_REG) |
| 20503 |
(match_operand:SI 4)))])] |
| 20504 |
"!TARGET_64BIT" |
| 20505 |
{ |
| 20506 |
ix86_expand_call (operands[0], operands[1], operands[2], |
| 20507 |
operands[3], operands[4], false); |
| 20508 |
DONE; |
| 20509 |
}) |
| 20510 |
|
| 20511 |
(define_insn "*call_value_pop" |
| 20512 |
[(set (match_operand 0) |
| 20513 |
(call (mem:QI (match_operand:SI 1 "call_insn_operand" "lBwBz")) |
| 20514 |
(match_operand 2))) |
| 20515 |
(set (reg:SI SP_REG) |
| 20516 |
(plus:SI (reg:SI SP_REG) |
| 20517 |
(match_operand:SI 3 "immediate_operand" "i")))] |
| 20518 |
"!TARGET_64BIT && !SIBLING_CALL_P (insn)" |
| 20519 |
"* return ix86_output_call_insn (insn, operands[1]);" |
| 20520 |
[(set_attr "type" "callv")]) |
| 20521 |
|
| 20522 |
(define_insn "*sibcall_value_pop" |
| 20523 |
[(set (match_operand 0) |
| 20524 |
(call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "UBsBz")) |
| 20525 |
(match_operand 2))) |
| 20526 |
(set (reg:SI SP_REG) |
| 20527 |
(plus:SI (reg:SI SP_REG) |
| 20528 |
(match_operand:SI 3 "immediate_operand" "i")))] |
| 20529 |
"!TARGET_64BIT && SIBLING_CALL_P (insn)" |
| 20530 |
"* return ix86_output_call_insn (insn, operands[1]);" |
| 20531 |
[(set_attr "type" "callv")]) |
| 20532 |
|
| 20533 |
(define_insn "*sibcall_value_pop_memory" |
| 20534 |
[(set (match_operand 0) |
| 20535 |
(call (mem:QI (match_operand:SI 1 "memory_operand" "m")) |
| 20536 |
(match_operand 2))) |
| 20537 |
(set (reg:SI SP_REG) |
| 20538 |
(plus:SI (reg:SI SP_REG) |
| 20539 |
(match_operand:SI 3 "immediate_operand" "i"))) |
| 20540 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)] |
| 20541 |
"!TARGET_64BIT && !TARGET_INDIRECT_BRANCH_REGISTER" |
| 20542 |
"* return ix86_output_call_insn (insn, operands[1]);" |
| 20543 |
[(set_attr "type" "callv")]) |
| 20544 |
|
| 20545 |
(define_peephole2 |
| 20546 |
[(set (match_operand:SI 0 "register_operand") |
| 20547 |
(match_operand:SI 1 "memory_operand")) |
| 20548 |
(parallel [(set (match_operand 2) |
| 20549 |
(call (mem:QI (match_dup 0)) |
| 20550 |
(match_operand 3))) |
| 20551 |
(set (reg:SI SP_REG) |
| 20552 |
(plus:SI (reg:SI SP_REG) |
| 20553 |
(match_operand:SI 4 "immediate_operand")))])] |
| 20554 |
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (1)) |
| 20555 |
&& !reg_mentioned_p (operands[0], |
| 20556 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" |
| 20557 |
[(parallel [(set (match_dup 2) |
| 20558 |
(call (mem:QI (match_dup 1)) |
| 20559 |
(match_dup 3))) |
| 20560 |
(set (reg:SI SP_REG) |
| 20561 |
(plus:SI (reg:SI SP_REG) |
| 20562 |
(match_dup 4))) |
| 20563 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20564 |
|
| 20565 |
(define_peephole2 |
| 20566 |
[(set (match_operand:SI 0 "register_operand") |
| 20567 |
(match_operand:SI 1 "memory_operand")) |
| 20568 |
(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20569 |
(parallel [(set (match_operand 2) |
| 20570 |
(call (mem:QI (match_dup 0)) |
| 20571 |
(match_operand 3))) |
| 20572 |
(set (reg:SI SP_REG) |
| 20573 |
(plus:SI (reg:SI SP_REG) |
| 20574 |
(match_operand:SI 4 "immediate_operand")))])] |
| 20575 |
"!TARGET_64BIT && SIBLING_CALL_P (peep2_next_insn (2)) |
| 20576 |
&& !reg_mentioned_p (operands[0], |
| 20577 |
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" |
| 20578 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) |
| 20579 |
(parallel [(set (match_dup 2) |
| 20580 |
(call (mem:QI (match_dup 1)) |
| 20581 |
(match_dup 3))) |
| 20582 |
(set (reg:SI SP_REG) |
| 20583 |
(plus:SI (reg:SI SP_REG) |
| 20584 |
(match_dup 4))) |
| 20585 |
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])]) |
| 20586 |
|
| 20587 |
;; Call subroutine returning any type. |
| 20588 |
|
| 20589 |
(define_expand "untyped_call" |
| 20590 |
[(parallel [(call (match_operand 0) |
| 20591 |
(const_int 0)) |
| 20592 |
(match_operand 1) |
| 20593 |
(match_operand 2)])] |
| 20594 |
"" |
| 20595 |
{ |
| 20596 |
int i; |
| 20597 |
|
| 20598 |
/* In order to give reg-stack an easier job in validating two |
| 20599 |
coprocessor registers as containing a possible return value, |
| 20600 |
simply pretend the untyped call returns a complex long double |
| 20601 |
value. |
| 20602 |
|
| 20603 |
We can't use SSE_REGPARM_MAX here since callee is unprototyped |
| 20604 |
and should have the default ABI. */ |
| 20605 |
|
| 20606 |
ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387 |
| 20607 |
? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL), |
| 20608 |
operands[0], const0_rtx, |
| 20609 |
GEN_INT ((TARGET_64BIT |
| 20610 |
? (ix86_abi == SYSV_ABI |
| 20611 |
? X86_64_SSE_REGPARM_MAX |
| 20612 |
: X86_64_MS_SSE_REGPARM_MAX) |
| 20613 |
: X86_32_SSE_REGPARM_MAX) |
| 20614 |
- 1), |
| 20615 |
NULL, false); |
| 20616 |
|
| 20617 |
for (i = 0; i < XVECLEN (operands[2], 0); i++) |
| 20618 |
{ |
| 20619 |
rtx set = XVECEXP (operands[2], 0, i); |
| 20620 |
emit_move_insn (SET_DEST (set), SET_SRC (set)); |
| 20621 |
} |
| 20622 |
|
| 20623 |
/* The optimizer does not know that the call sets the function value |
| 20624 |
registers we stored in the result block. We avoid problems by |
| 20625 |
claiming that all hard registers are used and clobbered at this |
| 20626 |
point. */ |
| 20627 |
emit_insn (gen_blockage ()); |
| 20628 |
|
| 20629 |
DONE; |
| 20630 |
}) |
| 20631 |
|
| 20632 |
;; Prologue and epilogue instructions |
| 20633 |
|
| 20634 |
;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and |
| 20635 |
;; all of memory. This blocks insns from being moved across this point. |
| 20636 |
|
| 20637 |
(define_insn "blockage" |
| 20638 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)] |
| 20639 |
"" |
| 20640 |
"" |
| 20641 |
[(set_attr "length" "0")]) |
| 20642 |
|
| 20643 |
;; Do not schedule instructions accessing memory across this point. |
| 20644 |
|
| 20645 |
(define_expand "memory_blockage" |
| 20646 |
[(set (match_dup 0) |
| 20647 |
(unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BLOCKAGE))] |
| 20648 |
"" |
| 20649 |
{ |
| 20650 |
operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); |
| 20651 |
MEM_VOLATILE_P (operands[0]) = 1; |
| 20652 |
}) |
| 20653 |
|
| 20654 |
(define_insn "*memory_blockage" |
| 20655 |
[(set (match_operand:BLK 0) |
| 20656 |
(unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BLOCKAGE))] |
| 20657 |
"" |
| 20658 |
"" |
| 20659 |
[(set_attr "length" "0")]) |
| 20660 |
|
| 20661 |
;; As USE insns aren't meaningful after reload, this is used instead |
| 20662 |
;; to prevent deleting instructions setting registers for PIC code |
| 20663 |
(define_insn "prologue_use" |
| 20664 |
[(unspec_volatile [(match_operand 0)] UNSPECV_PROLOGUE_USE)] |
| 20665 |
"" |
| 20666 |
"" |
| 20667 |
[(set_attr "length" "0")]) |
| 20668 |
|
| 20669 |
;; Insn emitted into the body of a function to return from a function. |
| 20670 |
;; This is only done if the function's epilogue is known to be simple. |
| 20671 |
;; See comments for ix86_can_use_return_insn_p in i386.cc. |
| 20672 |
|
| 20673 |
(define_expand "return" |
| 20674 |
[(simple_return)] |
| 20675 |
"ix86_can_use_return_insn_p ()" |
| 20676 |
{ |
| 20677 |
if (crtl->args.pops_args) |
| 20678 |
{ |
| 20679 |
rtx popc = GEN_INT (crtl->args.pops_args); |
| 20680 |
emit_jump_insn (gen_simple_return_pop_internal (popc)); |
| 20681 |
DONE; |
| 20682 |
} |
| 20683 |
}) |
| 20684 |
|
| 20685 |
;; We need to disable this for TARGET_SEH, as otherwise |
| 20686 |
;; shrink-wrapped prologue gets enabled too. This might exceed |
| 20687 |
;; the maximum size of prologue in unwind information. |
| 20688 |
;; Also disallow shrink-wrapping if using stack slot to pass the |
| 20689 |
;; static chain pointer - the first instruction has to be pushl %esi |
| 20690 |
;; and it can't be moved around, as we use alternate entry points |
| 20691 |
;; in that case. |
| 20692 |
;; Also disallow for ms_hook_prologue functions which have frame |
| 20693 |
;; pointer set up in function label which is correctly handled in |
| 20694 |
;; ix86_expand_{prologue|epligoue}() only. |
| 20695 |
|
| 20696 |
(define_expand "simple_return" |
| 20697 |
[(simple_return)] |
| 20698 |
"!TARGET_SEH && !ix86_static_chain_on_stack && !ix86_function_ms_hook_prologue (cfun->decl)" |
| 20699 |
{ |
| 20700 |
if (crtl->args.pops_args) |
| 20701 |
{ |
| 20702 |
rtx popc = GEN_INT (crtl->args.pops_args); |
| 20703 |
emit_jump_insn (gen_simple_return_pop_internal (popc)); |
| 20704 |
DONE; |
| 20705 |
} |
| 20706 |
}) |
| 20707 |
|
| 20708 |
(define_insn "simple_return_internal" |
| 20709 |
[(simple_return)] |
| 20710 |
"reload_completed" |
| 20711 |
"* return ix86_output_function_return (false);" |
| 20712 |
[(set_attr "length" "1") |
| 20713 |
(set_attr "atom_unit" "jeu") |
| 20714 |
(set_attr "length_immediate" "0") |
| 20715 |
(set_attr "modrm" "0")]) |
| 20716 |
|
| 20717 |
(define_insn "interrupt_return" |
| 20718 |
[(simple_return) |
| 20719 |
(unspec [(const_int 0)] UNSPEC_INTERRUPT_RETURN)] |
| 20720 |
"reload_completed" |
| 20721 |
{ |
| 20722 |
return TARGET_64BIT ? (TARGET_UINTR ? "uiret" : "iretq") : "iret"; |
| 20723 |
}) |
| 20724 |
|
| 20725 |
;; Used by x86_machine_dependent_reorg to avoid penalty on single byte RET |
| 20726 |
;; instruction Athlon and K8 have. |
| 20727 |
|
| 20728 |
(define_insn "simple_return_internal_long" |
| 20729 |
[(simple_return) |
| 20730 |
(unspec [(const_int 0)] UNSPEC_REP)] |
| 20731 |
"reload_completed" |
| 20732 |
"* return ix86_output_function_return (true);" |
| 20733 |
[(set_attr "length" "2") |
| 20734 |
(set_attr "atom_unit" "jeu") |
| 20735 |
(set_attr "length_immediate" "0") |
| 20736 |
(set_attr "prefix_rep" "1") |
| 20737 |
(set_attr "modrm" "0")]) |
| 20738 |
|
| 20739 |
(define_insn_and_split "simple_return_pop_internal" |
| 20740 |
[(simple_return) |
| 20741 |
(use (match_operand:SI 0 "const_int_operand"))] |
| 20742 |
"reload_completed" |
| 20743 |
"ret\t%0" |
| 20744 |
"&& cfun->machine->function_return_type != indirect_branch_keep" |
| 20745 |
[(const_int 0)] |
| 20746 |
"ix86_split_simple_return_pop_internal (operands[0]); DONE;" |
| 20747 |
[(set_attr "length" "3") |
| 20748 |
(set_attr "atom_unit" "jeu") |
| 20749 |
(set_attr "length_immediate" "2") |
| 20750 |
(set_attr "modrm" "0")]) |
| 20751 |
|
| 20752 |
(define_expand "simple_return_indirect_internal" |
| 20753 |
[(parallel |
| 20754 |
[(simple_return) |
| 20755 |
(use (match_operand 0 "register_operand"))])]) |
| 20756 |
|
| 20757 |
(define_insn "*simple_return_indirect_internal<mode>" |
| 20758 |
[(simple_return) |
| 20759 |
(use (match_operand:W 0 "register_operand" "r"))] |
| 20760 |
"reload_completed" |
| 20761 |
"* return ix86_output_indirect_function_return (operands[0]);" |
| 20762 |
[(set (attr "type") |
| 20763 |
(if_then_else (match_test "(cfun->machine->indirect_branch_type |
| 20764 |
!= indirect_branch_keep)") |
| 20765 |
(const_string "multi") |
| 20766 |
(const_string "ibr"))) |
| 20767 |
(set_attr "length_immediate" "0")]) |
| 20768 |
|
| 20769 |
(define_insn "nop" |
| 20770 |
[(const_int 0)] |
| 20771 |
"" |
| 20772 |
"nop" |
| 20773 |
[(set_attr "length" "1") |
| 20774 |
(set_attr "length_immediate" "0") |
| 20775 |
(set_attr "modrm" "0")]) |
| 20776 |
|
| 20777 |
;; Generate nops. Operand 0 is the number of nops, up to 8. |
| 20778 |
(define_insn "nops" |
| 20779 |
[(unspec_volatile [(match_operand 0 "const_int_operand")] |
| 20780 |
UNSPECV_NOPS)] |
| 20781 |
"reload_completed" |
| 20782 |
{ |
| 20783 |
int num = INTVAL (operands[0]); |
| 20784 |
|
| 20785 |
gcc_assert (IN_RANGE (num, 1, 8)); |
| 20786 |
|
| 20787 |
while (num--) |
| 20788 |
fputs ("\tnop\n", asm_out_file); |
| 20789 |
|
| 20790 |
return ""; |
| 20791 |
} |
| 20792 |
[(set (attr "length") (symbol_ref "INTVAL (operands[0])")) |
| 20793 |
(set_attr "length_immediate" "0") |
| 20794 |
(set_attr "modrm" "0")]) |
| 20795 |
|
| 20796 |
;; Pad to 1 << op0 byte boundary, max skip in op1. Used to avoid |
| 20797 |
;; branch prediction penalty for the third jump in a 16-byte |
| 20798 |
;; block on K8. |
| 20799 |
;; Also it's used to align tight loops which can be fix into 1 cacheline. |
| 20800 |
;; It can help code prefetch and reduce DSB miss. |
| 20801 |
|
| 20802 |
(define_insn "max_skip_align" |
| 20803 |
[(unspec_volatile [(match_operand 0) (match_operand 1)] UNSPECV_ALIGN)] |
| 20804 |
"" |
| 20805 |
{ |
| 20806 |
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN |
| 20807 |
ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file, (int)INTVAL (operands[0]), (int)INTVAL (operands[1])); |
| 20808 |
#else |
| 20809 |
/* It is tempting to use ASM_OUTPUT_ALIGN here, but we don't want to do that. |
| 20810 |
The align insn is used to avoid 3 jump instructions in the row to improve |
| 20811 |
branch prediction and the benefits hardly outweigh the cost of extra 8 |
| 20812 |
nops on the average inserted by full alignment pseudo operation. */ |
| 20813 |
#endif |
| 20814 |
return ""; |
| 20815 |
} |
| 20816 |
[(set_attr "length" "16")]) |
| 20817 |
|
| 20818 |
(define_expand "prologue" |
| 20819 |
[(const_int 0)] |
| 20820 |
"" |
| 20821 |
"ix86_expand_prologue (); DONE;") |
| 20822 |
|
| 20823 |
(define_expand "set_got" |
| 20824 |
[(parallel |
| 20825 |
[(set (match_operand:SI 0 "register_operand") |
| 20826 |
(unspec:SI [(const_int 0)] UNSPEC_SET_GOT)) |
| 20827 |
(clobber (reg:CC FLAGS_REG))])] |
| 20828 |
"!TARGET_64BIT" |
| 20829 |
{ |
| 20830 |
if (flag_pic && !TARGET_VXWORKS_RTP) |
| 20831 |
ix86_pc_thunk_call_expanded = true; |
| 20832 |
}) |
| 20833 |
|
| 20834 |
(define_insn "*set_got" |
| 20835 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 20836 |
(unspec:SI [(const_int 0)] UNSPEC_SET_GOT)) |
| 20837 |
(clobber (reg:CC FLAGS_REG))] |
| 20838 |
"!TARGET_64BIT" |
| 20839 |
"* return output_set_got (operands[0], NULL_RTX);" |
| 20840 |
[(set_attr "type" "multi") |
| 20841 |
(set_attr "length" "12")]) |
| 20842 |
|
| 20843 |
(define_expand "set_got_labelled" |
| 20844 |
[(parallel |
| 20845 |
[(set (match_operand:SI 0 "register_operand") |
| 20846 |
(unspec:SI [(label_ref (match_operand 1))] |
| 20847 |
UNSPEC_SET_GOT)) |
| 20848 |
(clobber (reg:CC FLAGS_REG))])] |
| 20849 |
"!TARGET_64BIT" |
| 20850 |
{ |
| 20851 |
if (flag_pic && !TARGET_VXWORKS_RTP) |
| 20852 |
ix86_pc_thunk_call_expanded = true; |
| 20853 |
}) |
| 20854 |
|
| 20855 |
(define_insn "*set_got_labelled" |
| 20856 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 20857 |
(unspec:SI [(label_ref (match_operand 1))] |
| 20858 |
UNSPEC_SET_GOT)) |
| 20859 |
(clobber (reg:CC FLAGS_REG))] |
| 20860 |
"!TARGET_64BIT" |
| 20861 |
"* return output_set_got (operands[0], operands[1]);" |
| 20862 |
[(set_attr "type" "multi") |
| 20863 |
(set_attr "length" "12")]) |
| 20864 |
|
| 20865 |
(define_insn "set_got_rex64" |
| 20866 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 20867 |
(unspec:DI [(const_int 0)] UNSPEC_SET_GOT))] |
| 20868 |
"TARGET_64BIT" |
| 20869 |
"lea{q}\t{_GLOBAL_OFFSET_TABLE_(%%rip), %0|%0, _GLOBAL_OFFSET_TABLE_[rip]}" |
| 20870 |
[(set_attr "type" "lea") |
| 20871 |
(set_attr "length_address" "4") |
| 20872 |
(set_attr "mode" "DI")]) |
| 20873 |
|
| 20874 |
(define_insn "set_rip_rex64" |
| 20875 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 20876 |
(unspec:DI [(label_ref (match_operand 1))] UNSPEC_SET_RIP))] |
| 20877 |
"TARGET_64BIT" |
| 20878 |
"lea{q}\t{%l1(%%rip), %0|%0, %l1[rip]}" |
| 20879 |
[(set_attr "type" "lea") |
| 20880 |
(set_attr "length_address" "4") |
| 20881 |
(set_attr "mode" "DI")]) |
| 20882 |
|
| 20883 |
(define_insn "set_got_offset_rex64" |
| 20884 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 20885 |
(unspec:DI |
| 20886 |
[(label_ref (match_operand 1))] |
| 20887 |
UNSPEC_SET_GOT_OFFSET))] |
| 20888 |
"TARGET_LP64" |
| 20889 |
"movabs{q}\t{$_GLOBAL_OFFSET_TABLE_-%l1, %0|%0, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_-%l1}" |
| 20890 |
[(set_attr "type" "imov") |
| 20891 |
(set_attr "length_immediate" "0") |
| 20892 |
(set_attr "length_address" "8") |
| 20893 |
(set_attr "mode" "DI")]) |
| 20894 |
|
| 20895 |
(define_expand "epilogue" |
| 20896 |
[(const_int 0)] |
| 20897 |
"" |
| 20898 |
"ix86_expand_epilogue (1); DONE;") |
| 20899 |
|
| 20900 |
(define_expand "sibcall_epilogue" |
| 20901 |
[(const_int 0)] |
| 20902 |
"" |
| 20903 |
"ix86_expand_epilogue (0); DONE;") |
| 20904 |
|
| 20905 |
(define_expand "eh_return" |
| 20906 |
[(use (match_operand 0 "register_operand"))] |
| 20907 |
"" |
| 20908 |
{ |
| 20909 |
rtx tmp, sa = EH_RETURN_STACKADJ_RTX, ra = operands[0]; |
| 20910 |
|
| 20911 |
/* Tricky bit: we write the address of the handler to which we will |
| 20912 |
be returning into someone else's stack frame, one word below the |
| 20913 |
stack address we wish to restore. */ |
| 20914 |
tmp = gen_rtx_PLUS (Pmode, arg_pointer_rtx, sa); |
| 20915 |
tmp = plus_constant (Pmode, tmp, -UNITS_PER_WORD); |
| 20916 |
/* Return address is always in word_mode. */ |
| 20917 |
tmp = gen_rtx_MEM (word_mode, tmp); |
| 20918 |
if (GET_MODE (ra) != word_mode) |
| 20919 |
ra = convert_to_mode (word_mode, ra, 1); |
| 20920 |
emit_move_insn (tmp, ra); |
| 20921 |
|
| 20922 |
emit_jump_insn (gen_eh_return_internal ()); |
| 20923 |
emit_barrier (); |
| 20924 |
DONE; |
| 20925 |
}) |
| 20926 |
|
| 20927 |
(define_insn_and_split "eh_return_internal" |
| 20928 |
[(eh_return)] |
| 20929 |
"" |
| 20930 |
"#" |
| 20931 |
"epilogue_completed" |
| 20932 |
[(const_int 0)] |
| 20933 |
"ix86_expand_epilogue (2); DONE;") |
| 20934 |
|
| 20935 |
(define_expand "@leave_<mode>" |
| 20936 |
[(parallel |
| 20937 |
[(set (reg:W SP_REG) (plus:W (reg:W BP_REG) (match_dup 0))) |
| 20938 |
(set (reg:W BP_REG) (mem:W (reg:W BP_REG))) |
| 20939 |
(clobber (mem:BLK (scratch)))])] |
| 20940 |
"" |
| 20941 |
"operands[0] = GEN_INT (<MODE_SIZE>);") |
| 20942 |
|
| 20943 |
(define_insn "*leave" |
| 20944 |
[(set (reg:SI SP_REG) (plus:SI (reg:SI BP_REG) (const_int 4))) |
| 20945 |
(set (reg:SI BP_REG) (mem:SI (reg:SI BP_REG))) |
| 20946 |
(clobber (mem:BLK (scratch)))] |
| 20947 |
"!TARGET_64BIT" |
| 20948 |
"leave" |
| 20949 |
[(set_attr "type" "leave")]) |
| 20950 |
|
| 20951 |
(define_insn "*leave_rex64" |
| 20952 |
[(set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8))) |
| 20953 |
(set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG))) |
| 20954 |
(clobber (mem:BLK (scratch)))] |
| 20955 |
"TARGET_64BIT" |
| 20956 |
"leave" |
| 20957 |
[(set_attr "type" "leave")]) |
| 20958 |
|
| 20959 |
;; Handle -fsplit-stack. |
| 20960 |
|
| 20961 |
(define_expand "split_stack_prologue" |
| 20962 |
[(const_int 0)] |
| 20963 |
"" |
| 20964 |
{ |
| 20965 |
ix86_expand_split_stack_prologue (); |
| 20966 |
DONE; |
| 20967 |
}) |
| 20968 |
|
| 20969 |
;; In order to support the call/return predictor, we use a return |
| 20970 |
;; instruction which the middle-end doesn't see. |
| 20971 |
(define_insn "split_stack_return" |
| 20972 |
[(unspec_volatile [(match_operand:SI 0 "const_int_operand")] |
| 20973 |
UNSPECV_SPLIT_STACK_RETURN)] |
| 20974 |
"" |
| 20975 |
{ |
| 20976 |
if (operands[0] == const0_rtx) |
| 20977 |
return "ret"; |
| 20978 |
else |
| 20979 |
return "ret\t%0"; |
| 20980 |
} |
| 20981 |
[(set_attr "atom_unit" "jeu") |
| 20982 |
(set_attr "modrm" "0") |
| 20983 |
(set (attr "length") |
| 20984 |
(if_then_else (match_operand:SI 0 "const0_operand") |
| 20985 |
(const_int 1) |
| 20986 |
(const_int 3))) |
| 20987 |
(set (attr "length_immediate") |
| 20988 |
(if_then_else (match_operand:SI 0 "const0_operand") |
| 20989 |
(const_int 0) |
| 20990 |
(const_int 2)))]) |
| 20991 |
|
| 20992 |
;; If there are operand 0 bytes available on the stack, jump to |
| 20993 |
;; operand 1. |
| 20994 |
|
| 20995 |
(define_expand "split_stack_space_check" |
| 20996 |
[(set (pc) (if_then_else |
| 20997 |
(ltu (minus (reg SP_REG) |
| 20998 |
(match_operand 0 "register_operand")) |
| 20999 |
(match_dup 2)) |
| 21000 |
(label_ref (match_operand 1)) |
| 21001 |
(pc)))] |
| 21002 |
"" |
| 21003 |
{ |
| 21004 |
rtx reg = gen_reg_rtx (Pmode); |
| 21005 |
|
| 21006 |
emit_insn (gen_sub3_insn (reg, stack_pointer_rtx, operands[0])); |
| 21007 |
|
| 21008 |
operands[2] = ix86_split_stack_guard (); |
| 21009 |
ix86_expand_branch (GEU, reg, operands[2], operands[1]); |
| 21010 |
|
| 21011 |
DONE; |
| 21012 |
}) |
| 21013 |
|
| 21014 |
;; Bit manipulation instructions. |
| 21015 |
|
| 21016 |
(define_expand "ffs<mode>2" |
| 21017 |
[(set (match_dup 2) (const_int -1)) |
| 21018 |
(parallel [(set (match_dup 3) (match_dup 4)) |
| 21019 |
(set (match_operand:SWI48 0 "register_operand") |
| 21020 |
(ctz:SWI48 |
| 21021 |
(match_operand:SWI48 1 "nonimmediate_operand")))]) |
| 21022 |
(set (match_dup 0) (if_then_else:SWI48 |
| 21023 |
(eq (match_dup 3) (const_int 0)) |
| 21024 |
(match_dup 2) |
| 21025 |
(match_dup 0))) |
| 21026 |
(parallel [(set (match_dup 0) (plus:SWI48 (match_dup 0) (const_int 1))) |
| 21027 |
(clobber (reg:CC FLAGS_REG))])] |
| 21028 |
"" |
| 21029 |
{ |
| 21030 |
machine_mode flags_mode; |
| 21031 |
|
| 21032 |
if (<MODE>mode == SImode && !TARGET_CMOVE) |
| 21033 |
{ |
| 21034 |
emit_insn (gen_ffssi2_no_cmove (operands[0], operands [1])); |
| 21035 |
DONE; |
| 21036 |
} |
| 21037 |
|
| 21038 |
flags_mode = TARGET_BMI ? CCCmode : CCZmode; |
| 21039 |
|
| 21040 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 21041 |
operands[3] = gen_rtx_REG (flags_mode, FLAGS_REG); |
| 21042 |
operands[4] = gen_rtx_COMPARE (flags_mode, operands[1], const0_rtx); |
| 21043 |
}) |
| 21044 |
|
| 21045 |
(define_insn_and_split "ffssi2_no_cmove" |
| 21046 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 21047 |
(ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))) |
| 21048 |
(clobber (match_scratch:SI 2 "=&q")) |
| 21049 |
(clobber (reg:CC FLAGS_REG))] |
| 21050 |
"!TARGET_CMOVE" |
| 21051 |
"#" |
| 21052 |
"&& reload_completed" |
| 21053 |
[(parallel [(set (match_dup 4) (match_dup 5)) |
| 21054 |
(set (match_dup 0) (ctz:SI (match_dup 1)))]) |
| 21055 |
(set (strict_low_part (match_dup 3)) |
| 21056 |
(eq:QI (match_dup 4) (const_int 0))) |
| 21057 |
(parallel [(set (match_dup 2) (neg:SI (match_dup 2))) |
| 21058 |
(clobber (reg:CC FLAGS_REG))]) |
| 21059 |
(parallel [(set (match_dup 0) (ior:SI (match_dup 0) (match_dup 2))) |
| 21060 |
(clobber (reg:CC FLAGS_REG))]) |
| 21061 |
(parallel [(set (match_dup 0) (plus:SI (match_dup 0) (const_int 1))) |
| 21062 |
(clobber (reg:CC FLAGS_REG))])] |
| 21063 |
{ |
| 21064 |
machine_mode flags_mode = TARGET_BMI ? CCCmode : CCZmode; |
| 21065 |
|
| 21066 |
operands[3] = gen_lowpart (QImode, operands[2]); |
| 21067 |
operands[4] = gen_rtx_REG (flags_mode, FLAGS_REG); |
| 21068 |
operands[5] = gen_rtx_COMPARE (flags_mode, operands[1], const0_rtx); |
| 21069 |
|
| 21070 |
ix86_expand_clear (operands[2]); |
| 21071 |
}) |
| 21072 |
|
| 21073 |
(define_insn_and_split "*tzcnt<mode>_1" |
| 21074 |
[(set (reg:CCC FLAGS_REG) |
| 21075 |
(compare:CCC (match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 21076 |
(const_int 0))) |
| 21077 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21078 |
(ctz:SWI48 (match_dup 1)))] |
| 21079 |
"TARGET_BMI" |
| 21080 |
"tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21081 |
"&& (TARGET_AVOID_FALSE_DEP_FOR_BMI || TARGET_AVOID_FALSE_DEP_FOR_TZCNT) |
| 21082 |
&& epilogue_completed |
| 21083 |
&& optimize_function_for_speed_p (cfun) |
| 21084 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21085 |
[(parallel |
| 21086 |
[(set (reg:CCC FLAGS_REG) |
| 21087 |
(compare:CCC (match_dup 1) (const_int 0))) |
| 21088 |
(set (match_dup 0) |
| 21089 |
(ctz:SWI48 (match_dup 1))) |
| 21090 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 21091 |
"ix86_expand_clear (operands[0]);" |
| 21092 |
[(set_attr "type" "alu1") |
| 21093 |
(set_attr "prefix_0f" "1") |
| 21094 |
(set_attr "prefix_rep" "1") |
| 21095 |
(set_attr "btver2_decode" "double") |
| 21096 |
(set_attr "c86_decode" "double") |
| 21097 |
(set_attr "mode" "<MODE>")]) |
| 21098 |
|
| 21099 |
; False dependency happens when destination is only updated by tzcnt, |
| 21100 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21101 |
; also used in source. |
| 21102 |
(define_insn "*tzcnt<mode>_1_falsedep" |
| 21103 |
[(set (reg:CCC FLAGS_REG) |
| 21104 |
(compare:CCC (match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 21105 |
(const_int 0))) |
| 21106 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21107 |
(ctz:SWI48 (match_dup 1))) |
| 21108 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21109 |
UNSPEC_INSN_FALSE_DEP)] |
| 21110 |
"TARGET_BMI" |
| 21111 |
"tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21112 |
[(set_attr "type" "alu1") |
| 21113 |
(set_attr "prefix_0f" "1") |
| 21114 |
(set_attr "prefix_rep" "1") |
| 21115 |
(set_attr "btver2_decode" "double") |
| 21116 |
(set_attr "c86_decode" "double") |
| 21117 |
(set_attr "mode" "<MODE>")]) |
| 21118 |
|
| 21119 |
(define_insn "*bsf<mode>_1" |
| 21120 |
[(set (reg:CCZ FLAGS_REG) |
| 21121 |
(compare:CCZ (match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 21122 |
(const_int 0))) |
| 21123 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21124 |
(ctz:SWI48 (match_dup 1)))] |
| 21125 |
"" |
| 21126 |
"bsf{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21127 |
[(set_attr "type" "alu1") |
| 21128 |
(set_attr "prefix_0f" "1") |
| 21129 |
(set_attr "btver2_decode" "double") |
| 21130 |
(set_attr "znver1_decode" "vector") |
| 21131 |
(set_attr "c86_decode" "vector") |
| 21132 |
(set_attr "mode" "<MODE>")]) |
| 21133 |
|
| 21134 |
(define_insn_and_split "ctz<mode>2" |
| 21135 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21136 |
(ctz:SWI48 |
| 21137 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 21138 |
(clobber (reg:CC FLAGS_REG))] |
| 21139 |
"" |
| 21140 |
{ |
| 21141 |
if (TARGET_BMI) |
| 21142 |
return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21143 |
else if (optimize_function_for_size_p (cfun)) |
| 21144 |
; |
| 21145 |
else if (TARGET_CPU_P (GENERIC)) |
| 21146 |
/* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */ |
| 21147 |
return "rep%; bsf{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21148 |
|
| 21149 |
return "bsf{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21150 |
} |
| 21151 |
"(TARGET_BMI || TARGET_CPU_P (GENERIC)) |
| 21152 |
&& (TARGET_AVOID_FALSE_DEP_FOR_BMI || TARGET_AVOID_FALSE_DEP_FOR_TZCNT) |
| 21153 |
&& epilogue_completed |
| 21154 |
&& optimize_function_for_speed_p (cfun) |
| 21155 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21156 |
[(parallel |
| 21157 |
[(set (match_dup 0) |
| 21158 |
(ctz:SWI48 (match_dup 1))) |
| 21159 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21160 |
(clobber (reg:CC FLAGS_REG))])] |
| 21161 |
"ix86_expand_clear (operands[0]);" |
| 21162 |
[(set_attr "type" "alu1") |
| 21163 |
(set_attr "prefix_0f" "1") |
| 21164 |
(set (attr "prefix_rep") |
| 21165 |
(if_then_else |
| 21166 |
(ior (match_test "TARGET_BMI") |
| 21167 |
(and (not (match_test "optimize_function_for_size_p (cfun)")) |
| 21168 |
(match_test "TARGET_CPU_P (GENERIC)"))) |
| 21169 |
(const_string "1") |
| 21170 |
(const_string "0"))) |
| 21171 |
(set_attr "mode" "<MODE>")]) |
| 21172 |
|
| 21173 |
; False dependency happens when destination is only updated by tzcnt, |
| 21174 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21175 |
; also used in source. |
| 21176 |
(define_insn "*ctz<mode>2_falsedep" |
| 21177 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21178 |
(ctz:SWI48 |
| 21179 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 21180 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21181 |
UNSPEC_INSN_FALSE_DEP) |
| 21182 |
(clobber (reg:CC FLAGS_REG))] |
| 21183 |
"" |
| 21184 |
{ |
| 21185 |
if (TARGET_BMI) |
| 21186 |
return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21187 |
else if (TARGET_CPU_P (GENERIC)) |
| 21188 |
/* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */ |
| 21189 |
return "rep%; bsf{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 21190 |
else |
| 21191 |
gcc_unreachable (); |
| 21192 |
} |
| 21193 |
[(set_attr "type" "alu1") |
| 21194 |
(set_attr "c86_decode" "double") |
| 21195 |
(set_attr "prefix_0f" "1") |
| 21196 |
(set_attr "prefix_rep" "1") |
| 21197 |
(set_attr "mode" "<MODE>")]) |
| 21198 |
|
| 21199 |
(define_insn_and_split "*ctzsi2_zext" |
| 21200 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21201 |
(and:DI |
| 21202 |
(subreg:DI |
| 21203 |
(ctz:SI |
| 21204 |
(match_operand:SI 1 "nonimmediate_operand" "rm")) 0) |
| 21205 |
(const_int 63))) |
| 21206 |
(clobber (reg:CC FLAGS_REG))] |
| 21207 |
"TARGET_BMI && TARGET_64BIT" |
| 21208 |
"tzcnt{l}\t{%1, %k0|%k0, %1}" |
| 21209 |
"&& (TARGET_AVOID_FALSE_DEP_FOR_BMI || TARGET_AVOID_FALSE_DEP_FOR_TZCNT) |
| 21210 |
&& epilogue_completed |
| 21211 |
&& optimize_function_for_speed_p (cfun) |
| 21212 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21213 |
[(parallel |
| 21214 |
[(set (match_dup 0) |
| 21215 |
(and:DI (subreg:DI (ctz:SI (match_dup 1)) 0) (const_int 63))) |
| 21216 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21217 |
(clobber (reg:CC FLAGS_REG))])] |
| 21218 |
"ix86_expand_clear (operands[0]);" |
| 21219 |
[(set_attr "type" "alu1") |
| 21220 |
(set_attr "c86_decode" "double") |
| 21221 |
(set_attr "prefix_0f" "1") |
| 21222 |
(set_attr "prefix_rep" "1") |
| 21223 |
(set_attr "mode" "SI")]) |
| 21224 |
|
| 21225 |
; False dependency happens when destination is only updated by tzcnt, |
| 21226 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21227 |
; also used in source. |
| 21228 |
(define_insn "*ctzsi2_zext_falsedep" |
| 21229 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21230 |
(and:DI |
| 21231 |
(subreg:DI |
| 21232 |
(ctz:SI |
| 21233 |
(match_operand:SI 1 "nonimmediate_operand" "rm")) 0) |
| 21234 |
(const_int 63))) |
| 21235 |
(unspec [(match_operand:DI 2 "register_operand" "0")] |
| 21236 |
UNSPEC_INSN_FALSE_DEP) |
| 21237 |
(clobber (reg:CC FLAGS_REG))] |
| 21238 |
"TARGET_BMI && TARGET_64BIT" |
| 21239 |
"tzcnt{l}\t{%1, %k0|%k0, %1}" |
| 21240 |
[(set_attr "type" "alu1") |
| 21241 |
(set_attr "c86_decode" "double") |
| 21242 |
(set_attr "prefix_0f" "1") |
| 21243 |
(set_attr "prefix_rep" "1") |
| 21244 |
(set_attr "mode" "SI")]) |
| 21245 |
|
| 21246 |
(define_insn_and_split "*ctzsidi2_<s>ext" |
| 21247 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21248 |
(any_extend:DI |
| 21249 |
(ctz:SI |
| 21250 |
(match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 21251 |
(clobber (reg:CC FLAGS_REG))] |
| 21252 |
"TARGET_64BIT" |
| 21253 |
{ |
| 21254 |
if (TARGET_BMI) |
| 21255 |
return "tzcnt{l}\t{%1, %k0|%k0, %1}"; |
| 21256 |
else if (TARGET_CPU_P (GENERIC) |
| 21257 |
&& !optimize_function_for_size_p (cfun)) |
| 21258 |
/* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */ |
| 21259 |
return "rep%; bsf{l}\t{%1, %k0|%k0, %1}"; |
| 21260 |
return "bsf{l}\t{%1, %k0|%k0, %1}"; |
| 21261 |
} |
| 21262 |
"(TARGET_BMI || TARGET_CPU_P (GENERIC)) |
| 21263 |
&& (TARGET_AVOID_FALSE_DEP_FOR_BMI || TARGET_AVOID_FALSE_DEP_FOR_TZCNT) |
| 21264 |
&& epilogue_completed |
| 21265 |
&& optimize_function_for_speed_p (cfun) |
| 21266 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21267 |
[(parallel |
| 21268 |
[(set (match_dup 0) |
| 21269 |
(any_extend:DI (ctz:SI (match_dup 1)))) |
| 21270 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21271 |
(clobber (reg:CC FLAGS_REG))])] |
| 21272 |
"ix86_expand_clear (operands[0]);" |
| 21273 |
[(set_attr "type" "alu1") |
| 21274 |
(set_attr "prefix_0f" "1") |
| 21275 |
(set (attr "prefix_rep") |
| 21276 |
(if_then_else |
| 21277 |
(ior (match_test "TARGET_BMI") |
| 21278 |
(and (not (match_test "optimize_function_for_size_p (cfun)")) |
| 21279 |
(match_test "TARGET_CPU_P (GENERIC)"))) |
| 21280 |
(const_string "1") |
| 21281 |
(const_string "0"))) |
| 21282 |
(set_attr "mode" "SI")]) |
| 21283 |
|
| 21284 |
(define_insn "*ctzsidi2_<s>ext_falsedep" |
| 21285 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21286 |
(any_extend:DI |
| 21287 |
(ctz:SI |
| 21288 |
(match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 21289 |
(unspec [(match_operand:DI 2 "register_operand" "0")] |
| 21290 |
UNSPEC_INSN_FALSE_DEP) |
| 21291 |
(clobber (reg:CC FLAGS_REG))] |
| 21292 |
"TARGET_64BIT" |
| 21293 |
{ |
| 21294 |
if (TARGET_BMI) |
| 21295 |
return "tzcnt{l}\t{%1, %k0|%k0, %1}"; |
| 21296 |
else if (TARGET_CPU_P (GENERIC)) |
| 21297 |
/* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */ |
| 21298 |
return "rep%; bsf{l}\t{%1, %k0|%k0, %1}"; |
| 21299 |
else |
| 21300 |
gcc_unreachable (); |
| 21301 |
} |
| 21302 |
[(set_attr "type" "alu1") |
| 21303 |
(set_attr "prefix_0f" "1") |
| 21304 |
(set_attr "prefix_rep" "1") |
| 21305 |
(set_attr "mode" "SI")]) |
| 21306 |
|
| 21307 |
(define_insn "bsr_rex64" |
| 21308 |
[(set (reg:CCZ FLAGS_REG) |
| 21309 |
(compare:CCZ (match_operand:DI 1 "nonimmediate_operand" "rm") |
| 21310 |
(const_int 0))) |
| 21311 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 21312 |
(minus:DI (const_int 63) |
| 21313 |
(clz:DI (match_dup 1))))] |
| 21314 |
"TARGET_64BIT" |
| 21315 |
"bsr{q}\t{%1, %0|%0, %1}" |
| 21316 |
[(set_attr "type" "alu1") |
| 21317 |
(set_attr "prefix_0f" "1") |
| 21318 |
(set_attr "znver1_decode" "vector") |
| 21319 |
(set_attr "c86_decode" "vector") |
| 21320 |
(set_attr "mode" "DI")]) |
| 21321 |
|
| 21322 |
(define_insn "bsr_rex64_1" |
| 21323 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21324 |
(minus:DI (const_int 63) |
| 21325 |
(clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))) |
| 21326 |
(clobber (reg:CC FLAGS_REG))] |
| 21327 |
"!TARGET_LZCNT && TARGET_64BIT" |
| 21328 |
"bsr{q}\t{%1, %0|%0, %1}" |
| 21329 |
[(set_attr "type" "alu1") |
| 21330 |
(set_attr "prefix_0f" "1") |
| 21331 |
(set_attr "znver1_decode" "vector") |
| 21332 |
(set_attr "c86_decode" "vector") |
| 21333 |
(set_attr "mode" "DI")]) |
| 21334 |
|
| 21335 |
(define_insn "bsr_rex64_1_zext" |
| 21336 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21337 |
(zero_extend:DI |
| 21338 |
(minus:SI (const_int 63) |
| 21339 |
(subreg:SI |
| 21340 |
(clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm")) |
| 21341 |
0)))) |
| 21342 |
(clobber (reg:CC FLAGS_REG))] |
| 21343 |
"!TARGET_LZCNT && TARGET_64BIT" |
| 21344 |
"bsr{q}\t{%1, %0|%0, %1}" |
| 21345 |
[(set_attr "type" "alu1") |
| 21346 |
(set_attr "prefix_0f" "1") |
| 21347 |
(set_attr "znver1_decode" "vector") |
| 21348 |
(set_attr "c86_decode" "vector") |
| 21349 |
(set_attr "mode" "DI")]) |
| 21350 |
|
| 21351 |
(define_insn "bsr" |
| 21352 |
[(set (reg:CCZ FLAGS_REG) |
| 21353 |
(compare:CCZ (match_operand:SI 1 "nonimmediate_operand" "rm") |
| 21354 |
(const_int 0))) |
| 21355 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 21356 |
(minus:SI (const_int 31) |
| 21357 |
(clz:SI (match_dup 1))))] |
| 21358 |
"" |
| 21359 |
"bsr{l}\t{%1, %0|%0, %1}" |
| 21360 |
[(set_attr "type" "alu1") |
| 21361 |
(set_attr "prefix_0f" "1") |
| 21362 |
(set_attr "znver1_decode" "vector") |
| 21363 |
(set_attr "c86_decode" "vector") |
| 21364 |
(set_attr "mode" "SI")]) |
| 21365 |
|
| 21366 |
(define_insn "bsr_1" |
| 21367 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 21368 |
(minus:SI (const_int 31) |
| 21369 |
(clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 21370 |
(clobber (reg:CC FLAGS_REG))] |
| 21371 |
"!TARGET_LZCNT" |
| 21372 |
"bsr{l}\t{%1, %0|%0, %1}" |
| 21373 |
[(set_attr "type" "alu1") |
| 21374 |
(set_attr "prefix_0f" "1") |
| 21375 |
(set_attr "znver1_decode" "vector") |
| 21376 |
(set_attr "c86_decode" "vector") |
| 21377 |
(set_attr "mode" "SI")]) |
| 21378 |
|
| 21379 |
(define_insn "bsr_zext_1" |
| 21380 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21381 |
(zero_extend:DI |
| 21382 |
(minus:SI |
| 21383 |
(const_int 31) |
| 21384 |
(clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))))) |
| 21385 |
(clobber (reg:CC FLAGS_REG))] |
| 21386 |
"!TARGET_LZCNT && TARGET_64BIT" |
| 21387 |
"bsr{l}\t{%1, %k0|%k0, %1}" |
| 21388 |
[(set_attr "type" "alu1") |
| 21389 |
(set_attr "prefix_0f" "1") |
| 21390 |
(set_attr "znver1_decode" "vector") |
| 21391 |
(set_attr "c86_decode" "vector") |
| 21392 |
(set_attr "mode" "SI")]) |
| 21393 |
|
| 21394 |
; As bsr is undefined behavior on zero and for other input |
| 21395 |
; values it is in range 0 to 63, we can optimize away sign-extends. |
| 21396 |
(define_insn_and_split "*bsr_rex64_2" |
| 21397 |
[(set (match_operand:DI 0 "register_operand") |
| 21398 |
(xor:DI |
| 21399 |
(sign_extend:DI |
| 21400 |
(minus:SI |
| 21401 |
(const_int 63) |
| 21402 |
(subreg:SI (clz:DI (match_operand:DI 1 "nonimmediate_operand")) |
| 21403 |
0))) |
| 21404 |
(const_int 63))) |
| 21405 |
(clobber (reg:CC FLAGS_REG))] |
| 21406 |
"!TARGET_LZCNT && TARGET_64BIT && ix86_pre_reload_split ()" |
| 21407 |
"#" |
| 21408 |
"&& 1" |
| 21409 |
[(parallel [(set (reg:CCZ FLAGS_REG) |
| 21410 |
(compare:CCZ (match_dup 1) (const_int 0))) |
| 21411 |
(set (match_dup 2) |
| 21412 |
(minus:DI (const_int 63) (clz:DI (match_dup 1))))]) |
| 21413 |
(parallel [(set (match_dup 0) |
| 21414 |
(zero_extend:DI (xor:SI (match_dup 3) (const_int 63)))) |
| 21415 |
(clobber (reg:CC FLAGS_REG))])] |
| 21416 |
{ |
| 21417 |
operands[2] = gen_reg_rtx (DImode); |
| 21418 |
operands[3] = lowpart_subreg (SImode, operands[2], DImode); |
| 21419 |
}) |
| 21420 |
|
| 21421 |
(define_insn_and_split "*bsr_2" |
| 21422 |
[(set (match_operand:DI 0 "register_operand") |
| 21423 |
(sign_extend:DI |
| 21424 |
(xor:SI |
| 21425 |
(minus:SI |
| 21426 |
(const_int 31) |
| 21427 |
(clz:SI (match_operand:SI 1 "nonimmediate_operand"))) |
| 21428 |
(const_int 31)))) |
| 21429 |
(clobber (reg:CC FLAGS_REG))] |
| 21430 |
"!TARGET_LZCNT && TARGET_64BIT && ix86_pre_reload_split ()" |
| 21431 |
"#" |
| 21432 |
"&& 1" |
| 21433 |
[(parallel [(set (reg:CCZ FLAGS_REG) |
| 21434 |
(compare:CCZ (match_dup 1) (const_int 0))) |
| 21435 |
(set (match_dup 2) |
| 21436 |
(minus:SI (const_int 31) (clz:SI (match_dup 1))))]) |
| 21437 |
(parallel [(set (match_dup 0) |
| 21438 |
(zero_extend:DI (xor:SI (match_dup 2) (const_int 31)))) |
| 21439 |
(clobber (reg:CC FLAGS_REG))])] |
| 21440 |
"operands[2] = gen_reg_rtx (SImode);") |
| 21441 |
|
| 21442 |
; Splitters to optimize 64 - __builtin_clzl (x) or 32 - __builtin_clz (x). |
| 21443 |
; Again, as for !TARGET_LZCNT CLZ is UB at zero, CLZ is guaranteed to be |
| 21444 |
; in [0, 63] or [0, 31] range. |
| 21445 |
(define_split |
| 21446 |
[(set (match_operand:SI 0 "register_operand") |
| 21447 |
(minus:SI |
| 21448 |
(match_operand:SI 2 "const_int_operand") |
| 21449 |
(xor:SI |
| 21450 |
(minus:SI (const_int 63) |
| 21451 |
(subreg:SI |
| 21452 |
(clz:DI (match_operand:DI 1 "nonimmediate_operand")) |
| 21453 |
0)) |
| 21454 |
(const_int 63))))] |
| 21455 |
"!TARGET_LZCNT && TARGET_64BIT && ix86_pre_reload_split ()" |
| 21456 |
[(set (match_dup 3) |
| 21457 |
(minus:DI (const_int 63) (clz:DI (match_dup 1)))) |
| 21458 |
(set (match_dup 0) |
| 21459 |
(plus:SI (match_dup 5) (match_dup 4)))] |
| 21460 |
{ |
| 21461 |
operands[3] = gen_reg_rtx (DImode); |
| 21462 |
operands[5] = lowpart_subreg (SImode, operands[3], DImode); |
| 21463 |
if (INTVAL (operands[2]) == 63) |
| 21464 |
{ |
| 21465 |
emit_insn (gen_bsr_rex64_1_zext (operands[3], operands[1])); |
| 21466 |
emit_move_insn (operands[0], operands[5]); |
| 21467 |
DONE; |
| 21468 |
} |
| 21469 |
operands[4] = gen_int_mode (UINTVAL (operands[2]) - 63, SImode); |
| 21470 |
}) |
| 21471 |
|
| 21472 |
(define_split |
| 21473 |
[(set (match_operand:SI 0 "register_operand") |
| 21474 |
(minus:SI |
| 21475 |
(match_operand:SI 2 "const_int_operand") |
| 21476 |
(xor:SI |
| 21477 |
(minus:SI (const_int 31) |
| 21478 |
(clz:SI (match_operand:SI 1 "nonimmediate_operand"))) |
| 21479 |
(const_int 31))))] |
| 21480 |
"!TARGET_LZCNT && ix86_pre_reload_split ()" |
| 21481 |
[(set (match_dup 3) |
| 21482 |
(minus:SI (const_int 31) (clz:SI (match_dup 1)))) |
| 21483 |
(set (match_dup 0) |
| 21484 |
(plus:SI (match_dup 3) (match_dup 4)))] |
| 21485 |
{ |
| 21486 |
if (INTVAL (operands[2]) == 31) |
| 21487 |
{ |
| 21488 |
emit_insn (gen_bsr_1 (operands[0], operands[1])); |
| 21489 |
DONE; |
| 21490 |
} |
| 21491 |
operands[3] = gen_reg_rtx (SImode); |
| 21492 |
operands[4] = gen_int_mode (UINTVAL (operands[2]) - 31, SImode); |
| 21493 |
}) |
| 21494 |
|
| 21495 |
(define_split |
| 21496 |
[(set (match_operand:DI 0 "register_operand") |
| 21497 |
(minus:DI |
| 21498 |
(match_operand:DI 2 "const_int_operand") |
| 21499 |
(xor:DI |
| 21500 |
(sign_extend:DI |
| 21501 |
(minus:SI (const_int 63) |
| 21502 |
(subreg:SI |
| 21503 |
(clz:DI (match_operand:DI 1 "nonimmediate_operand")) |
| 21504 |
0))) |
| 21505 |
(const_int 63))))] |
| 21506 |
"!TARGET_LZCNT |
| 21507 |
&& TARGET_64BIT |
| 21508 |
&& ix86_pre_reload_split () |
| 21509 |
&& ((unsigned HOST_WIDE_INT) |
| 21510 |
trunc_int_for_mode (UINTVAL (operands[2]) - 63, SImode) |
| 21511 |
== UINTVAL (operands[2]) - 63)" |
| 21512 |
[(set (match_dup 3) |
| 21513 |
(minus:DI (const_int 63) (clz:DI (match_dup 1)))) |
| 21514 |
(set (match_dup 0) |
| 21515 |
(plus:DI (match_dup 3) (match_dup 4)))] |
| 21516 |
{ |
| 21517 |
if (INTVAL (operands[2]) == 63) |
| 21518 |
{ |
| 21519 |
emit_insn (gen_bsr_rex64_1 (operands[0], operands[1])); |
| 21520 |
DONE; |
| 21521 |
} |
| 21522 |
operands[3] = gen_reg_rtx (DImode); |
| 21523 |
operands[4] = GEN_INT (UINTVAL (operands[2]) - 63); |
| 21524 |
}) |
| 21525 |
|
| 21526 |
(define_split |
| 21527 |
[(set (match_operand:DI 0 "register_operand") |
| 21528 |
(minus:DI |
| 21529 |
(match_operand:DI 2 "const_int_operand") |
| 21530 |
(sign_extend:DI |
| 21531 |
(xor:SI |
| 21532 |
(minus:SI (const_int 31) |
| 21533 |
(clz:SI (match_operand:SI 1 "nonimmediate_operand"))) |
| 21534 |
(const_int 31)))))] |
| 21535 |
"!TARGET_LZCNT |
| 21536 |
&& TARGET_64BIT |
| 21537 |
&& ix86_pre_reload_split () |
| 21538 |
&& ((unsigned HOST_WIDE_INT) |
| 21539 |
trunc_int_for_mode (UINTVAL (operands[2]) - 31, SImode) |
| 21540 |
== UINTVAL (operands[2]) - 31)" |
| 21541 |
[(set (match_dup 3) |
| 21542 |
(zero_extend:DI (minus:SI (const_int 31) (clz:SI (match_dup 1))))) |
| 21543 |
(set (match_dup 0) |
| 21544 |
(plus:DI (match_dup 3) (match_dup 4)))] |
| 21545 |
{ |
| 21546 |
if (INTVAL (operands[2]) == 31) |
| 21547 |
{ |
| 21548 |
emit_insn (gen_bsr_zext_1 (operands[0], operands[1])); |
| 21549 |
DONE; |
| 21550 |
} |
| 21551 |
operands[3] = gen_reg_rtx (DImode); |
| 21552 |
operands[4] = GEN_INT (UINTVAL (operands[2]) - 31); |
| 21553 |
}) |
| 21554 |
|
| 21555 |
(define_expand "clz<mode>2" |
| 21556 |
[(parallel |
| 21557 |
[(set (reg:CCZ FLAGS_REG) |
| 21558 |
(compare:CCZ (match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 21559 |
(const_int 0))) |
| 21560 |
(set (match_dup 3) (minus:SWI48 |
| 21561 |
(match_dup 2) |
| 21562 |
(clz:SWI48 (match_dup 1))))]) |
| 21563 |
(parallel |
| 21564 |
[(set (match_operand:SWI48 0 "register_operand") |
| 21565 |
(xor:SWI48 (match_dup 3) (match_dup 2))) |
| 21566 |
(clobber (reg:CC FLAGS_REG))])] |
| 21567 |
"" |
| 21568 |
{ |
| 21569 |
if (TARGET_LZCNT) |
| 21570 |
{ |
| 21571 |
emit_insn (gen_clz<mode>2_lzcnt (operands[0], operands[1])); |
| 21572 |
DONE; |
| 21573 |
} |
| 21574 |
operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)-1); |
| 21575 |
operands[3] = gen_reg_rtx (<MODE>mode); |
| 21576 |
}) |
| 21577 |
|
| 21578 |
(define_insn_and_split "clz<mode>2_lzcnt_nf" |
| 21579 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21580 |
(clz:SWI48 |
| 21581 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm")))] |
| 21582 |
"TARGET_APX_NF && TARGET_LZCNT" |
| 21583 |
"%{nf%} lzcnt{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21584 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 21585 |
&& optimize_function_for_speed_p (cfun) |
| 21586 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21587 |
[(set (match_dup 0) (const_int 0)) |
| 21588 |
(parallel |
| 21589 |
[(set (match_dup 0) |
| 21590 |
(clz:SWI48 (match_dup 1))) |
| 21591 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 21592 |
"" |
| 21593 |
[(set_attr "prefix_rep" "1") |
| 21594 |
(set_attr "type" "bitmanip") |
| 21595 |
(set_attr "mode" "<MODE>")]) |
| 21596 |
|
| 21597 |
(define_insn_and_split "clz<mode>2_lzcnt" |
| 21598 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21599 |
(clz:SWI48 |
| 21600 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 21601 |
(clobber (reg:CC FLAGS_REG))] |
| 21602 |
"TARGET_LZCNT" |
| 21603 |
"lzcnt{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21604 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 21605 |
&& optimize_function_for_speed_p (cfun) |
| 21606 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21607 |
[(parallel |
| 21608 |
[(set (match_dup 0) |
| 21609 |
(clz:SWI48 (match_dup 1))) |
| 21610 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21611 |
(clobber (reg:CC FLAGS_REG))])] |
| 21612 |
"ix86_expand_clear (operands[0]);" |
| 21613 |
[(set_attr "prefix_rep" "1") |
| 21614 |
(set_attr "type" "bitmanip") |
| 21615 |
(set_attr "has_nf" "1") |
| 21616 |
(set_attr "mode" "<MODE>")]) |
| 21617 |
|
| 21618 |
; False dependency happens when destination is only updated by tzcnt, |
| 21619 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21620 |
; also used in source. |
| 21621 |
(define_insn "*clz<mode>2_lzcnt_falsedep_nf" |
| 21622 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21623 |
(clz:SWI48 |
| 21624 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 21625 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21626 |
UNSPEC_INSN_FALSE_DEP)] |
| 21627 |
"TARGET_APX_NF && TARGET_LZCNT" |
| 21628 |
"%{nf%} lzcnt{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21629 |
[(set_attr "prefix_rep" "1") |
| 21630 |
(set_attr "type" "bitmanip") |
| 21631 |
(set_attr "mode" "<MODE>")]) |
| 21632 |
|
| 21633 |
(define_insn "*clz<mode>2_lzcnt_falsedep" |
| 21634 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21635 |
(clz:SWI48 |
| 21636 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 21637 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21638 |
UNSPEC_INSN_FALSE_DEP) |
| 21639 |
(clobber (reg:CC FLAGS_REG))] |
| 21640 |
"TARGET_LZCNT" |
| 21641 |
"lzcnt{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21642 |
[(set_attr "prefix_rep" "1") |
| 21643 |
(set_attr "type" "bitmanip") |
| 21644 |
(set_attr "has_nf" "1") |
| 21645 |
(set_attr "mode" "<MODE>")]) |
| 21646 |
|
| 21647 |
(define_insn_and_split "*clzsi2_lzcnt_zext" |
| 21648 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21649 |
(and:DI |
| 21650 |
(subreg:DI |
| 21651 |
(clz:SI |
| 21652 |
(match_operand:SI 1 "nonimmediate_operand" "rm")) 0) |
| 21653 |
(const_int 63))) |
| 21654 |
(clobber (reg:CC FLAGS_REG))] |
| 21655 |
"TARGET_LZCNT && TARGET_64BIT" |
| 21656 |
"lzcnt{l}\t{%1, %k0|%k0, %1}" |
| 21657 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 21658 |
&& optimize_function_for_speed_p (cfun) |
| 21659 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21660 |
[(parallel |
| 21661 |
[(set (match_dup 0) |
| 21662 |
(and:DI (subreg:DI (clz:SI (match_dup 1)) 0) (const_int 63))) |
| 21663 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21664 |
(clobber (reg:CC FLAGS_REG))])] |
| 21665 |
"ix86_expand_clear (operands[0]);" |
| 21666 |
[(set_attr "prefix_rep" "1") |
| 21667 |
(set_attr "type" "bitmanip") |
| 21668 |
(set_attr "mode" "SI")]) |
| 21669 |
|
| 21670 |
; False dependency happens when destination is only updated by tzcnt, |
| 21671 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21672 |
; also used in source. |
| 21673 |
(define_insn "*clzsi2_lzcnt_zext_falsedep" |
| 21674 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21675 |
(and:DI |
| 21676 |
(subreg:DI |
| 21677 |
(clz:SI |
| 21678 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm")) 0) |
| 21679 |
(const_int 63))) |
| 21680 |
(unspec [(match_operand:DI 2 "register_operand" "0")] |
| 21681 |
UNSPEC_INSN_FALSE_DEP) |
| 21682 |
(clobber (reg:CC FLAGS_REG))] |
| 21683 |
"TARGET_LZCNT" |
| 21684 |
"lzcnt{l}\t{%1, %k0|%k0, %1}" |
| 21685 |
[(set_attr "prefix_rep" "1") |
| 21686 |
(set_attr "type" "bitmanip") |
| 21687 |
(set_attr "mode" "SI")]) |
| 21688 |
|
| 21689 |
(define_insn_and_split "*clzsi2_lzcnt_zext_2" |
| 21690 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21691 |
(zero_extend:DI |
| 21692 |
(clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 21693 |
(clobber (reg:CC FLAGS_REG))] |
| 21694 |
"TARGET_LZCNT && TARGET_64BIT" |
| 21695 |
"lzcnt{l}\t{%1, %k0|%k0, %1}" |
| 21696 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 21697 |
&& optimize_function_for_speed_p (cfun) |
| 21698 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21699 |
[(parallel |
| 21700 |
[(set (match_dup 0) |
| 21701 |
(zero_extend:DI (clz:SI (match_dup 1)))) |
| 21702 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21703 |
(clobber (reg:CC FLAGS_REG))])] |
| 21704 |
"ix86_expand_clear (operands[0]);" |
| 21705 |
[(set_attr "prefix_rep" "1") |
| 21706 |
(set_attr "type" "bitmanip") |
| 21707 |
(set_attr "mode" "SI")]) |
| 21708 |
|
| 21709 |
; False dependency happens when destination is only updated by tzcnt, |
| 21710 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21711 |
; also used in source. |
| 21712 |
(define_insn "*clzsi2_lzcnt_zext_2_falsedep" |
| 21713 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 21714 |
(zero_extend:DI |
| 21715 |
(clz:SI (match_operand:SWI48 1 "nonimmediate_operand" "rm")))) |
| 21716 |
(unspec [(match_operand:DI 2 "register_operand" "0")] |
| 21717 |
UNSPEC_INSN_FALSE_DEP) |
| 21718 |
(clobber (reg:CC FLAGS_REG))] |
| 21719 |
"TARGET_LZCNT" |
| 21720 |
"lzcnt{l}\t{%1, %k0|%k0, %1}" |
| 21721 |
[(set_attr "prefix_rep" "1") |
| 21722 |
(set_attr "type" "bitmanip") |
| 21723 |
(set_attr "mode" "SI")]) |
| 21724 |
|
| 21725 |
(define_int_iterator LT_ZCNT |
| 21726 |
[(UNSPEC_TZCNT "TARGET_BMI") |
| 21727 |
(UNSPEC_LZCNT "TARGET_LZCNT")]) |
| 21728 |
|
| 21729 |
(define_int_attr lt_zcnt |
| 21730 |
[(UNSPEC_TZCNT "tzcnt") |
| 21731 |
(UNSPEC_LZCNT "lzcnt")]) |
| 21732 |
|
| 21733 |
(define_int_attr lt_zcnt_type |
| 21734 |
[(UNSPEC_TZCNT "alu1") |
| 21735 |
(UNSPEC_LZCNT "bitmanip")]) |
| 21736 |
|
| 21737 |
;; Version of lzcnt/tzcnt that is expanded from intrinsics. This version |
| 21738 |
;; provides operand size as output when source operand is zero. |
| 21739 |
|
| 21740 |
(define_insn_and_split "<lt_zcnt>_<mode>_nf" |
| 21741 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21742 |
(unspec:SWI48 |
| 21743 |
[(match_operand:SWI48 1 "nonimmediate_operand" "rm")] LT_ZCNT))] |
| 21744 |
"TARGET_APX_NF" |
| 21745 |
"%{nf%} <lt_zcnt>{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21746 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 21747 |
&& optimize_function_for_speed_p (cfun) |
| 21748 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21749 |
[(set (match_dup 0) (const_int 0)) |
| 21750 |
(parallel |
| 21751 |
[(set (match_dup 0) |
| 21752 |
(unspec:SWI48 [(match_dup 1)] LT_ZCNT)) |
| 21753 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 21754 |
"" |
| 21755 |
[(set_attr "type" "<lt_zcnt_type>") |
| 21756 |
(set_attr "prefix_0f" "1") |
| 21757 |
(set_attr "prefix_rep" "1") |
| 21758 |
(set_attr "mode" "<MODE>")]) |
| 21759 |
|
| 21760 |
(define_insn_and_split "<lt_zcnt>_<mode>" |
| 21761 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21762 |
(unspec:SWI48 |
| 21763 |
[(match_operand:SWI48 1 "nonimmediate_operand" "rm")] LT_ZCNT)) |
| 21764 |
(clobber (reg:CC FLAGS_REG))] |
| 21765 |
"" |
| 21766 |
"<lt_zcnt>{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21767 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 21768 |
&& optimize_function_for_speed_p (cfun) |
| 21769 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21770 |
[(parallel |
| 21771 |
[(set (match_dup 0) |
| 21772 |
(unspec:SWI48 [(match_dup 1)] LT_ZCNT)) |
| 21773 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 21774 |
(clobber (reg:CC FLAGS_REG))])] |
| 21775 |
"ix86_expand_clear (operands[0]);" |
| 21776 |
[(set_attr "type" "<lt_zcnt_type>") |
| 21777 |
(set_attr "prefix_0f" "1") |
| 21778 |
(set_attr "prefix_rep" "1") |
| 21779 |
(set_attr "has_nf" "1") |
| 21780 |
(set_attr "mode" "<MODE>")]) |
| 21781 |
|
| 21782 |
; False dependency happens when destination is only updated by tzcnt, |
| 21783 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 21784 |
; also used in source. |
| 21785 |
(define_insn "*<lt_zcnt>_<mode>_falsedep_nf" |
| 21786 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21787 |
(unspec:SWI48 |
| 21788 |
[(match_operand:SWI48 1 "nonimmediate_operand" "rm")] LT_ZCNT)) |
| 21789 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21790 |
UNSPEC_INSN_FALSE_DEP)] |
| 21791 |
"TARGET_APX_NF" |
| 21792 |
"%{nf%} <lt_zcnt>{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21793 |
[(set_attr "type" "<lt_zcnt_type>") |
| 21794 |
(set_attr "prefix_0f" "1") |
| 21795 |
(set_attr "prefix_rep" "1") |
| 21796 |
(set_attr "mode" "<MODE>")]) |
| 21797 |
|
| 21798 |
(define_insn "*<lt_zcnt>_<mode>_falsedep" |
| 21799 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21800 |
(unspec:SWI48 |
| 21801 |
[(match_operand:SWI48 1 "nonimmediate_operand" "rm")] LT_ZCNT)) |
| 21802 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21803 |
UNSPEC_INSN_FALSE_DEP) |
| 21804 |
(clobber (reg:CC FLAGS_REG))] |
| 21805 |
"" |
| 21806 |
"<lt_zcnt>{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 21807 |
[(set_attr "type" "<lt_zcnt_type>") |
| 21808 |
(set_attr "prefix_0f" "1") |
| 21809 |
(set_attr "prefix_rep" "1") |
| 21810 |
(set_attr "has_nf" "1") |
| 21811 |
(set_attr "mode" "<MODE>")]) |
| 21812 |
|
| 21813 |
(define_insn "<lt_zcnt>_hi<nf_name>" |
| 21814 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 21815 |
(unspec:HI |
| 21816 |
[(match_operand:HI 1 "nonimmediate_operand" "rm")] LT_ZCNT))] |
| 21817 |
"<nf_condition>" |
| 21818 |
"<nf_prefix><lt_zcnt>{w}\t{%1, %0|%0, %1}" |
| 21819 |
[(set_attr "type" "<lt_zcnt_type>") |
| 21820 |
(set_attr "prefix_0f" "1") |
| 21821 |
(set_attr "prefix_rep" "1") |
| 21822 |
(set_attr "has_nf" "1") |
| 21823 |
(set_attr "mode" "HI")]) |
| 21824 |
|
| 21825 |
;; BMI instructions. |
| 21826 |
|
| 21827 |
(define_insn "bmi_bextr_<mode>" |
| 21828 |
[(set (match_operand:SWI48 0 "register_operand" "=r,r") |
| 21829 |
(unspec:SWI48 [(match_operand:SWI48 1 "nonimmediate_operand" "r,m") |
| 21830 |
(match_operand:SWI48 2 "register_operand" "r,r")] |
| 21831 |
UNSPEC_BEXTR)) |
| 21832 |
(clobber (reg:CC FLAGS_REG))] |
| 21833 |
"TARGET_BMI" |
| 21834 |
"bextr\t{%2, %1, %0|%0, %1, %2}" |
| 21835 |
[(set_attr "type" "bitmanip") |
| 21836 |
(set_attr "btver2_decode" "direct, double") |
| 21837 |
(set_attr "mode" "<MODE>")]) |
| 21838 |
|
| 21839 |
(define_insn "*bmi_bextr_<mode>_ccz" |
| 21840 |
[(set (reg:CCZ FLAGS_REG) |
| 21841 |
(compare:CCZ |
| 21842 |
(unspec:SWI48 [(match_operand:SWI48 1 "nonimmediate_operand" "r,m") |
| 21843 |
(match_operand:SWI48 2 "register_operand" "r,r")] |
| 21844 |
UNSPEC_BEXTR) |
| 21845 |
(const_int 0))) |
| 21846 |
(clobber (match_scratch:SWI48 0 "=r,r"))] |
| 21847 |
"TARGET_BMI" |
| 21848 |
"bextr\t{%2, %1, %0|%0, %1, %2}" |
| 21849 |
[(set_attr "type" "bitmanip") |
| 21850 |
(set_attr "btver2_decode" "direct, double") |
| 21851 |
(set_attr "mode" "<MODE>")]) |
| 21852 |
|
| 21853 |
(define_insn_and_split "*bmi_blsi_<mode>" |
| 21854 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21855 |
(and:SWI48 |
| 21856 |
(neg:SWI48 |
| 21857 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm")) |
| 21858 |
(match_dup 1))) |
| 21859 |
(clobber (reg:CC FLAGS_REG))] |
| 21860 |
"TARGET_BMI" |
| 21861 |
"blsi\t{%1, %0|%0, %1}" |
| 21862 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BLS |
| 21863 |
&& epilogue_completed |
| 21864 |
&& optimize_function_for_speed_p (cfun) |
| 21865 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21866 |
[(parallel |
| 21867 |
[(set (reg:CCNO FLAGS_REG) |
| 21868 |
(compare:CCNO |
| 21869 |
(and:SWI48 |
| 21870 |
(neg:SWI48 (match_dup 1)) |
| 21871 |
(match_dup 1)) |
| 21872 |
(const_int 0))) |
| 21873 |
(set (match_dup 0) (and:SWI48 (neg:SWI48 (match_dup 1)) (match_dup 1))) |
| 21874 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 21875 |
"ix86_expand_clear (operands[0]);" |
| 21876 |
[(set_attr "type" "bitmanip") |
| 21877 |
(set_attr "btver2_decode" "double") |
| 21878 |
(set_attr "mode" "<MODE>")]) |
| 21879 |
|
| 21880 |
(define_insn "*bmi_blsi_<mode>_cmp" |
| 21881 |
[(set (reg FLAGS_REG) |
| 21882 |
(compare |
| 21883 |
(and:SWI48 |
| 21884 |
(neg:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "rm")) |
| 21885 |
(match_dup 1)) |
| 21886 |
(const_int 0))) |
| 21887 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21888 |
(and:SWI48 (neg:SWI48 (match_dup 1)) (match_dup 1)))] |
| 21889 |
"TARGET_BMI && ix86_match_ccmode (insn, CCNOmode)" |
| 21890 |
"blsi\t{%1, %0|%0, %1}" |
| 21891 |
[(set_attr "type" "bitmanip") |
| 21892 |
(set_attr "btver2_decode" "double") |
| 21893 |
(set_attr "mode" "<MODE>")]) |
| 21894 |
|
| 21895 |
(define_split |
| 21896 |
[(set (match_operand 3 "flags_reg_operand") |
| 21897 |
(match_operator 4 "compare_operator" |
| 21898 |
[(and:SWI48 |
| 21899 |
(neg:SWI48 (match_operand:SWI48 1 "nonimmediate_operand")) |
| 21900 |
(match_dup 1)) |
| 21901 |
(const_int 0)])) |
| 21902 |
(set (match_operand:SWI48 0 "register_operand") |
| 21903 |
(and:SWI48 (neg:SWI48 (match_dup 1)) (match_dup 1)))] |
| 21904 |
"TARGET_BMI |
| 21905 |
&& TARGET_AVOID_FALSE_DEP_FOR_BLS |
| 21906 |
&& epilogue_completed |
| 21907 |
&& optimize_function_for_speed_p (cfun) |
| 21908 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21909 |
[(parallel |
| 21910 |
[(set (match_dup 3) |
| 21911 |
(match_op_dup 4 |
| 21912 |
[(and:SWI48 |
| 21913 |
(neg:SWI48 (match_dup 1)) |
| 21914 |
(match_dup 1)) |
| 21915 |
(const_int 0)])) |
| 21916 |
(set (match_dup 0) (and:SWI48 (neg:SWI48 (match_dup 1)) (match_dup 1))) |
| 21917 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 21918 |
"ix86_expand_clear (operands[0]);") |
| 21919 |
|
| 21920 |
; False dependency happens when destination is only updated by blsi. |
| 21921 |
(define_insn "*bmi_blsi_<mode>_falsedep" |
| 21922 |
[(set (reg FLAGS_REG) |
| 21923 |
(compare |
| 21924 |
(and:SWI48 |
| 21925 |
(neg:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "rm")) |
| 21926 |
(match_dup 1)) |
| 21927 |
(const_int 0))) |
| 21928 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21929 |
(and:SWI48 (neg:SWI48 (match_dup 1)) (match_dup 1))) |
| 21930 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21931 |
UNSPEC_INSN_FALSE_DEP)] |
| 21932 |
"TARGET_BMI && ix86_match_ccmode (insn, CCNOmode)" |
| 21933 |
"blsi\t{%1, %0|%0, %1}" |
| 21934 |
[(set_attr "type" "bitmanip") |
| 21935 |
(set_attr "btver2_decode" "double") |
| 21936 |
(set_attr "mode" "<MODE>")]) |
| 21937 |
|
| 21938 |
;; No need for splitter of the false dependency, since the output is unused |
| 21939 |
;; so it will not extend dependency chain. |
| 21940 |
(define_insn "*bmi_blsi_<mode>_ccno" |
| 21941 |
[(set (reg FLAGS_REG) |
| 21942 |
(compare |
| 21943 |
(and:SWI48 |
| 21944 |
(neg:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "rm")) |
| 21945 |
(match_dup 1)) |
| 21946 |
(const_int 0))) |
| 21947 |
(clobber (match_scratch:SWI48 0 "=r"))] |
| 21948 |
"TARGET_BMI && ix86_match_ccmode (insn, CCNOmode)" |
| 21949 |
"blsi\t{%1, %0|%0, %1}" |
| 21950 |
[(set_attr "type" "bitmanip") |
| 21951 |
(set_attr "btver2_decode" "double") |
| 21952 |
(set_attr "mode" "<MODE>")]) |
| 21953 |
|
| 21954 |
(define_insn_and_split "*bmi_blsmsk_<mode>" |
| 21955 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21956 |
(xor:SWI48 |
| 21957 |
(plus:SWI48 |
| 21958 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 21959 |
(const_int -1)) |
| 21960 |
(match_dup 1))) |
| 21961 |
(clobber (reg:CC FLAGS_REG))] |
| 21962 |
"TARGET_BMI" |
| 21963 |
"blsmsk\t{%1, %0|%0, %1}" |
| 21964 |
"TARGET_AVOID_FALSE_DEP_FOR_BLS |
| 21965 |
&& epilogue_completed |
| 21966 |
&& optimize_function_for_speed_p (cfun) |
| 21967 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 21968 |
[(parallel |
| 21969 |
[(set (match_dup 0) |
| 21970 |
(xor:SWI48 |
| 21971 |
(plus:SWI48 (match_dup 1) (const_int -1)) |
| 21972 |
(match_dup 1))) |
| 21973 |
(clobber (reg:CC FLAGS_REG)) |
| 21974 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 21975 |
"ix86_expand_clear (operands[0]);" |
| 21976 |
[(set_attr "type" "bitmanip") |
| 21977 |
(set_attr "btver2_decode" "double") |
| 21978 |
(set_attr "mode" "<MODE>")]) |
| 21979 |
|
| 21980 |
; False dependency happens when destination is only updated by blmsk. |
| 21981 |
(define_insn "*bmi_blsmsk_<mode>_falsedep" |
| 21982 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21983 |
(xor:SWI48 |
| 21984 |
(plus:SWI48 |
| 21985 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 21986 |
(const_int -1)) |
| 21987 |
(match_dup 1))) |
| 21988 |
(clobber (reg:CC FLAGS_REG)) |
| 21989 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 21990 |
UNSPEC_INSN_FALSE_DEP)] |
| 21991 |
"TARGET_BMI" |
| 21992 |
"blsmsk\t{%1, %0|%0, %1}" |
| 21993 |
[(set_attr "type" "bitmanip") |
| 21994 |
(set_attr "btver2_decode" "double") |
| 21995 |
(set_attr "mode" "<MODE>")]) |
| 21996 |
|
| 21997 |
(define_insn_and_split "*bmi_blsr_<mode>" |
| 21998 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 21999 |
(and:SWI48 |
| 22000 |
(plus:SWI48 |
| 22001 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22002 |
(const_int -1)) |
| 22003 |
(match_dup 1))) |
| 22004 |
(clobber (reg:CC FLAGS_REG))] |
| 22005 |
"TARGET_BMI" |
| 22006 |
"blsr\t{%1, %0|%0, %1}" |
| 22007 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BLS |
| 22008 |
&& epilogue_completed |
| 22009 |
&& optimize_function_for_speed_p (cfun) |
| 22010 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 22011 |
[(parallel |
| 22012 |
[(set (reg:CCZ FLAGS_REG) |
| 22013 |
(compare:CCZ |
| 22014 |
(and:SWI48 |
| 22015 |
(plus:SWI48 (match_dup 1) (const_int -1)) |
| 22016 |
(match_dup 1)) |
| 22017 |
(const_int 0))) |
| 22018 |
(set (match_dup 0) (and:SWI48 (plus:SWI48 (match_dup 1) (const_int -1)) |
| 22019 |
(match_dup 1))) |
| 22020 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 22021 |
"ix86_expand_clear (operands[0]);" |
| 22022 |
[(set_attr "type" "bitmanip") |
| 22023 |
(set_attr "btver2_decode" "double") |
| 22024 |
(set_attr "mode" "<MODE>")]) |
| 22025 |
|
| 22026 |
(define_insn_and_split "*bmi_blsr_<mode>_cmp" |
| 22027 |
[(set (reg:CCZ FLAGS_REG) |
| 22028 |
(compare:CCZ |
| 22029 |
(and:SWI48 |
| 22030 |
(plus:SWI48 |
| 22031 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22032 |
(const_int -1)) |
| 22033 |
(match_dup 1)) |
| 22034 |
(const_int 0))) |
| 22035 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22036 |
(and:SWI48 |
| 22037 |
(plus:SWI48 |
| 22038 |
(match_dup 1) |
| 22039 |
(const_int -1)) |
| 22040 |
(match_dup 1)))] |
| 22041 |
"TARGET_BMI" |
| 22042 |
"blsr\t{%1, %0|%0, %1}" |
| 22043 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BLS |
| 22044 |
&& epilogue_completed |
| 22045 |
&& optimize_function_for_speed_p (cfun) |
| 22046 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 22047 |
[(parallel |
| 22048 |
[(set (reg:CCZ FLAGS_REG) |
| 22049 |
(compare:CCZ |
| 22050 |
(and:SWI48 |
| 22051 |
(plus:SWI48 (match_dup 1) (const_int -1)) |
| 22052 |
(match_dup 1)) |
| 22053 |
(const_int 0))) |
| 22054 |
(set (match_dup 0) (and:SWI48 (plus:SWI48 (match_dup 1) (const_int -1)) |
| 22055 |
(match_dup 1))) |
| 22056 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 22057 |
"ix86_expand_clear (operands[0]);" |
| 22058 |
[(set_attr "type" "bitmanip") |
| 22059 |
(set_attr "btver2_decode" "double") |
| 22060 |
(set_attr "mode" "<MODE>")]) |
| 22061 |
|
| 22062 |
; False dependency happens when destination is only updated by bslr. |
| 22063 |
(define_insn "*bmi_blsr_<mode>_cmp_falsedep" |
| 22064 |
[(set (reg:CCZ FLAGS_REG) |
| 22065 |
(compare:CCZ |
| 22066 |
(and:SWI48 |
| 22067 |
(plus:SWI48 |
| 22068 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22069 |
(const_int -1)) |
| 22070 |
(match_dup 1)) |
| 22071 |
(const_int 0))) |
| 22072 |
(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22073 |
(and:SWI48 |
| 22074 |
(plus:SWI48 |
| 22075 |
(match_dup 1) |
| 22076 |
(const_int -1)) |
| 22077 |
(match_dup 1))) |
| 22078 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 22079 |
UNSPEC_INSN_FALSE_DEP)] |
| 22080 |
"TARGET_BMI" |
| 22081 |
"blsr\t{%1, %0|%0, %1}" |
| 22082 |
[(set_attr "type" "bitmanip") |
| 22083 |
(set_attr "btver2_decode" "double") |
| 22084 |
(set_attr "mode" "<MODE>")]) |
| 22085 |
|
| 22086 |
;; No need for splitter of the false dependency, since the output is unused |
| 22087 |
;; so it will not extend dependency chain. |
| 22088 |
(define_insn "*bmi_blsr_<mode>_ccz" |
| 22089 |
[(set (reg:CCZ FLAGS_REG) |
| 22090 |
(compare:CCZ |
| 22091 |
(and:SWI48 |
| 22092 |
(plus:SWI48 |
| 22093 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22094 |
(const_int -1)) |
| 22095 |
(match_dup 1)) |
| 22096 |
(const_int 0))) |
| 22097 |
(clobber (match_scratch:SWI48 0 "=r"))] |
| 22098 |
"TARGET_BMI" |
| 22099 |
"blsr\t{%1, %0|%0, %1}" |
| 22100 |
[(set_attr "type" "bitmanip") |
| 22101 |
(set_attr "btver2_decode" "double") |
| 22102 |
(set_attr "mode" "<MODE>")]) |
| 22103 |
|
| 22104 |
;; BMI2 instructions. |
| 22105 |
(define_expand "bmi2_bzhi_<mode>3" |
| 22106 |
[(parallel |
| 22107 |
[(set (match_operand:SWI48 0 "register_operand") |
| 22108 |
(if_then_else:SWI48 |
| 22109 |
(ne:QI (match_operand:QI 2 "register_operand") |
| 22110 |
(const_int 0)) |
| 22111 |
(zero_extract:SWI48 |
| 22112 |
(match_operand:SWI48 1 "nonimmediate_operand") |
| 22113 |
(umin:QI (match_dup 2) (match_dup 3)) |
| 22114 |
(const_int 0)) |
| 22115 |
(const_int 0))) |
| 22116 |
(clobber (reg:CC FLAGS_REG))])] |
| 22117 |
"TARGET_BMI2" |
| 22118 |
{ |
| 22119 |
operands[2] = gen_lowpart (QImode, operands[2]); |
| 22120 |
operands[3] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT); |
| 22121 |
}) |
| 22122 |
|
| 22123 |
(define_insn "*bmi2_bzhi_<mode>3" |
| 22124 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22125 |
(if_then_else:SWI48 |
| 22126 |
(ne:QI (match_operand:QI 2 "register_operand" "q") |
| 22127 |
(const_int 0)) |
| 22128 |
(zero_extract:SWI48 |
| 22129 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22130 |
(umin:QI (match_dup 2) |
| 22131 |
(match_operand:QI 3 "const_int_operand")) |
| 22132 |
(const_int 0)) |
| 22133 |
(const_int 0))) |
| 22134 |
(clobber (reg:CC FLAGS_REG))] |
| 22135 |
"TARGET_BMI2 && INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 22136 |
"bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}" |
| 22137 |
[(set_attr "type" "bitmanip") |
| 22138 |
(set_attr "prefix" "vex") |
| 22139 |
(set_attr "mode" "<MODE>")]) |
| 22140 |
|
| 22141 |
(define_insn "*bmi2_bzhi_<mode>3_1_ccz" |
| 22142 |
[(set (reg:CCZ FLAGS_REG) |
| 22143 |
(compare:CCZ |
| 22144 |
(if_then_else:SWI48 |
| 22145 |
(ne:QI (match_operand:QI 2 "register_operand" "r") (const_int 0)) |
| 22146 |
(zero_extract:SWI48 |
| 22147 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22148 |
(umin:QI (match_dup 2) |
| 22149 |
(match_operand:QI 3 "const_int_operand")) |
| 22150 |
(const_int 0)) |
| 22151 |
(const_int 0)) |
| 22152 |
(const_int 0))) |
| 22153 |
(clobber (match_scratch:SWI48 0 "=r"))] |
| 22154 |
"TARGET_BMI2 && INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT" |
| 22155 |
"bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}" |
| 22156 |
[(set_attr "type" "bitmanip") |
| 22157 |
(set_attr "prefix" "vex") |
| 22158 |
(set_attr "mode" "<MODE>")]) |
| 22159 |
|
| 22160 |
(define_insn "*bmi2_bzhi_<mode>3_2" |
| 22161 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22162 |
(and:SWI48 |
| 22163 |
(plus:SWI48 |
| 22164 |
(ashift:SWI48 (const_int 1) |
| 22165 |
(match_operand:QI 2 "register_operand" "r")) |
| 22166 |
(const_int -1)) |
| 22167 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 22168 |
(clobber (reg:CC FLAGS_REG))] |
| 22169 |
"TARGET_BMI2" |
| 22170 |
"bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}" |
| 22171 |
[(set_attr "type" "bitmanip") |
| 22172 |
(set_attr "prefix" "vex") |
| 22173 |
(set_attr "mode" "<MODE>")]) |
| 22174 |
|
| 22175 |
(define_insn "*bmi2_bzhi_<mode>3_3" |
| 22176 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22177 |
(and:SWI48 |
| 22178 |
(not:SWI48 |
| 22179 |
(ashift:SWI48 (const_int -1) |
| 22180 |
(match_operand:QI 2 "register_operand" "r"))) |
| 22181 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 22182 |
(clobber (reg:CC FLAGS_REG))] |
| 22183 |
"TARGET_BMI2" |
| 22184 |
"bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}" |
| 22185 |
[(set_attr "type" "bitmanip") |
| 22186 |
(set_attr "prefix" "vex") |
| 22187 |
(set_attr "mode" "<MODE>")]) |
| 22188 |
|
| 22189 |
(define_insn "*bmi2_bzhi_zero_extendsidi_4" |
| 22190 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 22191 |
(zero_extend:DI |
| 22192 |
(and:SI |
| 22193 |
(plus:SI |
| 22194 |
(ashift:SI (const_int 1) |
| 22195 |
(match_operand:QI 2 "register_operand" "r")) |
| 22196 |
(const_int -1)) |
| 22197 |
(match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 22198 |
(clobber (reg:CC FLAGS_REG))] |
| 22199 |
"TARGET_64BIT && TARGET_BMI2" |
| 22200 |
"bzhi\t{%q2, %q1, %q0|%q0, %q1, %q2}" |
| 22201 |
[(set_attr "type" "bitmanip") |
| 22202 |
(set_attr "prefix" "vex") |
| 22203 |
(set_attr "mode" "DI")]) |
| 22204 |
|
| 22205 |
(define_insn "*bmi2_bzhi_zero_extendsidi_5" |
| 22206 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 22207 |
(and:DI |
| 22208 |
(zero_extend:DI |
| 22209 |
(plus:SI |
| 22210 |
(ashift:SI (const_int 1) |
| 22211 |
(match_operand:QI 2 "register_operand" "r")) |
| 22212 |
(const_int -1))) |
| 22213 |
(match_operand:DI 1 "nonimmediate_operand" "rm"))) |
| 22214 |
(clobber (reg:CC FLAGS_REG))] |
| 22215 |
"TARGET_64BIT && TARGET_BMI2" |
| 22216 |
"bzhi\t{%q2, %q1, %q0|%q0, %q1, %q2}" |
| 22217 |
[(set_attr "type" "bitmanip") |
| 22218 |
(set_attr "prefix" "vex") |
| 22219 |
(set_attr "mode" "DI")]) |
| 22220 |
|
| 22221 |
(define_insn "bmi2_pdep_<mode>3" |
| 22222 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22223 |
(unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r") |
| 22224 |
(match_operand:SWI48 2 "nonimmediate_operand" "rm")] |
| 22225 |
UNSPEC_PDEP))] |
| 22226 |
"TARGET_BMI2" |
| 22227 |
"pdep\t{%2, %1, %0|%0, %1, %2}" |
| 22228 |
[(set_attr "type" "bitmanip") |
| 22229 |
(set_attr "prefix" "vex") |
| 22230 |
(set_attr "mode" "<MODE>")]) |
| 22231 |
|
| 22232 |
(define_insn "bmi2_pext_<mode>3" |
| 22233 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22234 |
(unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r") |
| 22235 |
(match_operand:SWI48 2 "nonimmediate_operand" "rm")] |
| 22236 |
UNSPEC_PEXT))] |
| 22237 |
"TARGET_BMI2" |
| 22238 |
"pext\t{%2, %1, %0|%0, %1, %2}" |
| 22239 |
[(set_attr "type" "bitmanip") |
| 22240 |
(set_attr "prefix" "vex") |
| 22241 |
(set_attr "mode" "<MODE>")]) |
| 22242 |
|
| 22243 |
;; TBM instructions. |
| 22244 |
(define_insn "@tbm_bextri_<mode>" |
| 22245 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22246 |
(zero_extract:SWI48 |
| 22247 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22248 |
(match_operand:QI 2 "const_0_to_255_operand") |
| 22249 |
(match_operand:QI 3 "const_0_to_255_operand"))) |
| 22250 |
(clobber (reg:CC FLAGS_REG))] |
| 22251 |
"TARGET_TBM" |
| 22252 |
{ |
| 22253 |
operands[2] = GEN_INT (INTVAL (operands[2]) << 8 | INTVAL (operands[3])); |
| 22254 |
return "bextr\t{%2, %1, %0|%0, %1, %2}"; |
| 22255 |
} |
| 22256 |
[(set_attr "type" "bitmanip") |
| 22257 |
(set_attr "mode" "<MODE>")]) |
| 22258 |
|
| 22259 |
(define_insn "*tbm_blcfill_<mode>" |
| 22260 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22261 |
(and:SWI48 |
| 22262 |
(plus:SWI48 |
| 22263 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22264 |
(const_int 1)) |
| 22265 |
(match_dup 1))) |
| 22266 |
(clobber (reg:CC FLAGS_REG))] |
| 22267 |
"TARGET_TBM" |
| 22268 |
"blcfill\t{%1, %0|%0, %1}" |
| 22269 |
[(set_attr "type" "bitmanip") |
| 22270 |
(set_attr "mode" "<MODE>")]) |
| 22271 |
|
| 22272 |
(define_insn "*tbm_blci_<mode>" |
| 22273 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22274 |
(ior:SWI48 |
| 22275 |
(not:SWI48 |
| 22276 |
(plus:SWI48 |
| 22277 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22278 |
(const_int 1))) |
| 22279 |
(match_dup 1))) |
| 22280 |
(clobber (reg:CC FLAGS_REG))] |
| 22281 |
"TARGET_TBM" |
| 22282 |
"blci\t{%1, %0|%0, %1}" |
| 22283 |
[(set_attr "type" "bitmanip") |
| 22284 |
(set_attr "mode" "<MODE>")]) |
| 22285 |
|
| 22286 |
(define_insn "*tbm_blcic_<mode>" |
| 22287 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22288 |
(and:SWI48 |
| 22289 |
(plus:SWI48 |
| 22290 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22291 |
(const_int 1)) |
| 22292 |
(not:SWI48 |
| 22293 |
(match_dup 1)))) |
| 22294 |
(clobber (reg:CC FLAGS_REG))] |
| 22295 |
"TARGET_TBM" |
| 22296 |
"blcic\t{%1, %0|%0, %1}" |
| 22297 |
[(set_attr "type" "bitmanip") |
| 22298 |
(set_attr "mode" "<MODE>")]) |
| 22299 |
|
| 22300 |
(define_insn "*tbm_blcmsk_<mode>" |
| 22301 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22302 |
(xor:SWI48 |
| 22303 |
(plus:SWI48 |
| 22304 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22305 |
(const_int 1)) |
| 22306 |
(match_dup 1))) |
| 22307 |
(clobber (reg:CC FLAGS_REG))] |
| 22308 |
"TARGET_TBM" |
| 22309 |
"blcmsk\t{%1, %0|%0, %1}" |
| 22310 |
[(set_attr "type" "bitmanip") |
| 22311 |
(set_attr "mode" "<MODE>")]) |
| 22312 |
|
| 22313 |
(define_insn "*tbm_blcs_<mode>" |
| 22314 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22315 |
(ior:SWI48 |
| 22316 |
(plus:SWI48 |
| 22317 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22318 |
(const_int 1)) |
| 22319 |
(match_dup 1))) |
| 22320 |
(clobber (reg:CC FLAGS_REG))] |
| 22321 |
"TARGET_TBM" |
| 22322 |
"blcs\t{%1, %0|%0, %1}" |
| 22323 |
[(set_attr "type" "bitmanip") |
| 22324 |
(set_attr "mode" "<MODE>")]) |
| 22325 |
|
| 22326 |
(define_insn "*tbm_blsfill_<mode>" |
| 22327 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22328 |
(ior:SWI48 |
| 22329 |
(plus:SWI48 |
| 22330 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22331 |
(const_int -1)) |
| 22332 |
(match_dup 1))) |
| 22333 |
(clobber (reg:CC FLAGS_REG))] |
| 22334 |
"TARGET_TBM" |
| 22335 |
"blsfill\t{%1, %0|%0, %1}" |
| 22336 |
[(set_attr "type" "bitmanip") |
| 22337 |
(set_attr "mode" "<MODE>")]) |
| 22338 |
|
| 22339 |
(define_insn "*tbm_blsic_<mode>" |
| 22340 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22341 |
(ior:SWI48 |
| 22342 |
(plus:SWI48 |
| 22343 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22344 |
(const_int -1)) |
| 22345 |
(not:SWI48 |
| 22346 |
(match_dup 1)))) |
| 22347 |
(clobber (reg:CC FLAGS_REG))] |
| 22348 |
"TARGET_TBM" |
| 22349 |
"blsic\t{%1, %0|%0, %1}" |
| 22350 |
[(set_attr "type" "bitmanip") |
| 22351 |
(set_attr "mode" "<MODE>")]) |
| 22352 |
|
| 22353 |
(define_insn "*tbm_t1mskc_<mode>" |
| 22354 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22355 |
(ior:SWI48 |
| 22356 |
(plus:SWI48 |
| 22357 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22358 |
(const_int 1)) |
| 22359 |
(not:SWI48 |
| 22360 |
(match_dup 1)))) |
| 22361 |
(clobber (reg:CC FLAGS_REG))] |
| 22362 |
"TARGET_TBM" |
| 22363 |
"t1mskc\t{%1, %0|%0, %1}" |
| 22364 |
[(set_attr "type" "bitmanip") |
| 22365 |
(set_attr "mode" "<MODE>")]) |
| 22366 |
|
| 22367 |
(define_insn "*tbm_tzmsk_<mode>" |
| 22368 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22369 |
(and:SWI48 |
| 22370 |
(plus:SWI48 |
| 22371 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm") |
| 22372 |
(const_int -1)) |
| 22373 |
(not:SWI48 |
| 22374 |
(match_dup 1)))) |
| 22375 |
(clobber (reg:CC FLAGS_REG))] |
| 22376 |
"TARGET_TBM" |
| 22377 |
"tzmsk\t{%1, %0|%0, %1}" |
| 22378 |
[(set_attr "type" "bitmanip") |
| 22379 |
(set_attr "mode" "<MODE>")]) |
| 22380 |
|
| 22381 |
(define_insn_and_split "popcount<mode>2_nf" |
| 22382 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22383 |
(popcount:SWI48 |
| 22384 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm")))] |
| 22385 |
"TARGET_APX_NF && TARGET_POPCNT" |
| 22386 |
{ |
| 22387 |
#if TARGET_MACHO |
| 22388 |
return "%{nf%} popcnt\t{%1, %0|%0, %1}"; |
| 22389 |
#else |
| 22390 |
return "%{nf%} popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 22391 |
#endif |
| 22392 |
} |
| 22393 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 22394 |
&& optimize_function_for_speed_p (cfun) |
| 22395 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 22396 |
[(set (match_dup 0) (const_int 0)) |
| 22397 |
(parallel |
| 22398 |
[(set (match_dup 0) |
| 22399 |
(popcount:SWI48 (match_dup 1))) |
| 22400 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])] |
| 22401 |
"" |
| 22402 |
[(set_attr "prefix_rep" "1") |
| 22403 |
(set_attr "type" "bitmanip") |
| 22404 |
(set_attr "mode" "<MODE>")]) |
| 22405 |
|
| 22406 |
(define_insn_and_split "popcount<mode>2" |
| 22407 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22408 |
(popcount:SWI48 |
| 22409 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 22410 |
(clobber (reg:CC FLAGS_REG))] |
| 22411 |
"TARGET_POPCNT" |
| 22412 |
{ |
| 22413 |
#if TARGET_MACHO |
| 22414 |
return "popcnt\t{%1, %0|%0, %1}"; |
| 22415 |
#else |
| 22416 |
return "popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 22417 |
#endif |
| 22418 |
} |
| 22419 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 22420 |
&& optimize_function_for_speed_p (cfun) |
| 22421 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 22422 |
[(parallel |
| 22423 |
[(set (match_dup 0) |
| 22424 |
(popcount:SWI48 (match_dup 1))) |
| 22425 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 22426 |
(clobber (reg:CC FLAGS_REG))])] |
| 22427 |
"ix86_expand_clear (operands[0]);" |
| 22428 |
[(set_attr "prefix_rep" "1") |
| 22429 |
(set_attr "type" "bitmanip") |
| 22430 |
(set_attr "has_nf" "1") |
| 22431 |
(set_attr "mode" "<MODE>")]) |
| 22432 |
|
| 22433 |
; False dependency happens when destination is only updated by tzcnt, |
| 22434 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 22435 |
; also used in source. |
| 22436 |
(define_insn "*popcount<mode>2_falsedep_nf" |
| 22437 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22438 |
(popcount:SWI48 |
| 22439 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 22440 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 22441 |
UNSPEC_INSN_FALSE_DEP)] |
| 22442 |
"TARGET_APX_NF && TARGET_POPCNT" |
| 22443 |
{ |
| 22444 |
#if TARGET_MACHO |
| 22445 |
return "%{nf%} popcnt\t{%1, %0|%0, %1}"; |
| 22446 |
#else |
| 22447 |
return "%{nf%} popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 22448 |
#endif |
| 22449 |
} |
| 22450 |
[(set_attr "prefix_rep" "1") |
| 22451 |
(set_attr "type" "bitmanip") |
| 22452 |
(set_attr "mode" "<MODE>")]) |
| 22453 |
|
| 22454 |
(define_insn "*popcount<mode>2_falsedep" |
| 22455 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22456 |
(popcount:SWI48 |
| 22457 |
(match_operand:SWI48 1 "nonimmediate_operand" "rm"))) |
| 22458 |
(unspec [(match_operand:SWI48 2 "register_operand" "0")] |
| 22459 |
UNSPEC_INSN_FALSE_DEP) |
| 22460 |
(clobber (reg:CC FLAGS_REG))] |
| 22461 |
"TARGET_POPCNT" |
| 22462 |
{ |
| 22463 |
#if TARGET_MACHO |
| 22464 |
return "popcnt\t{%1, %0|%0, %1}"; |
| 22465 |
#else |
| 22466 |
return "popcnt{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 22467 |
#endif |
| 22468 |
} |
| 22469 |
[(set_attr "prefix_rep" "1") |
| 22470 |
(set_attr "type" "bitmanip") |
| 22471 |
(set_attr "has_nf" "1") |
| 22472 |
(set_attr "mode" "<MODE>")]) |
| 22473 |
|
| 22474 |
(define_insn_and_split "*popcountsi2_zext" |
| 22475 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 22476 |
(and:DI |
| 22477 |
(subreg:DI |
| 22478 |
(popcount:SI |
| 22479 |
(match_operand:SI 1 "nonimmediate_operand" "rm")) 0) |
| 22480 |
(const_int 63))) |
| 22481 |
(clobber (reg:CC FLAGS_REG))] |
| 22482 |
"TARGET_POPCNT && TARGET_64BIT" |
| 22483 |
{ |
| 22484 |
#if TARGET_MACHO |
| 22485 |
return "popcnt\t{%1, %k0|%k0, %1}"; |
| 22486 |
#else |
| 22487 |
return "popcnt{l}\t{%1, %k0|%k0, %1}"; |
| 22488 |
#endif |
| 22489 |
} |
| 22490 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 22491 |
&& optimize_function_for_speed_p (cfun) |
| 22492 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 22493 |
[(parallel |
| 22494 |
[(set (match_dup 0) |
| 22495 |
(and:DI (subreg:DI (popcount:SI (match_dup 1)) 0) (const_int 63))) |
| 22496 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 22497 |
(clobber (reg:CC FLAGS_REG))])] |
| 22498 |
"ix86_expand_clear (operands[0]);" |
| 22499 |
[(set_attr "prefix_rep" "1") |
| 22500 |
(set_attr "type" "bitmanip") |
| 22501 |
(set_attr "mode" "SI")]) |
| 22502 |
|
| 22503 |
; False dependency happens when destination is only updated by tzcnt, |
| 22504 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 22505 |
; also used in source. |
| 22506 |
(define_insn "*popcountsi2_zext_falsedep" |
| 22507 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 22508 |
(and:DI |
| 22509 |
(subreg:DI |
| 22510 |
(popcount:SI |
| 22511 |
(match_operand:SI 1 "nonimmediate_operand" "rm")) 0) |
| 22512 |
(const_int 63))) |
| 22513 |
(unspec [(match_operand:DI 2 "register_operand" "0")] |
| 22514 |
UNSPEC_INSN_FALSE_DEP) |
| 22515 |
(clobber (reg:CC FLAGS_REG))] |
| 22516 |
"TARGET_POPCNT && TARGET_64BIT" |
| 22517 |
{ |
| 22518 |
#if TARGET_MACHO |
| 22519 |
return "popcnt\t{%1, %k0|%k0, %1}"; |
| 22520 |
#else |
| 22521 |
return "popcnt{l}\t{%1, %k0|%k0, %1}"; |
| 22522 |
#endif |
| 22523 |
} |
| 22524 |
[(set_attr "prefix_rep" "1") |
| 22525 |
(set_attr "type" "bitmanip") |
| 22526 |
(set_attr "mode" "SI")]) |
| 22527 |
|
| 22528 |
(define_insn_and_split "*popcountsi2_zext_2" |
| 22529 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 22530 |
(zero_extend:DI |
| 22531 |
(popcount:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 22532 |
(clobber (reg:CC FLAGS_REG))] |
| 22533 |
"TARGET_POPCNT && TARGET_64BIT" |
| 22534 |
{ |
| 22535 |
#if TARGET_MACHO |
| 22536 |
return "popcnt\t{%1, %k0|%k0, %1}"; |
| 22537 |
#else |
| 22538 |
return "popcnt{l}\t{%1, %k0|%k0, %1}"; |
| 22539 |
#endif |
| 22540 |
} |
| 22541 |
"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed |
| 22542 |
&& optimize_function_for_speed_p (cfun) |
| 22543 |
&& !reg_mentioned_p (operands[0], operands[1])" |
| 22544 |
[(parallel |
| 22545 |
[(set (match_dup 0) |
| 22546 |
(zero_extend:DI (popcount:SI (match_dup 1)))) |
| 22547 |
(unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP) |
| 22548 |
(clobber (reg:CC FLAGS_REG))])] |
| 22549 |
"ix86_expand_clear (operands[0]);" |
| 22550 |
[(set_attr "prefix_rep" "1") |
| 22551 |
(set_attr "type" "bitmanip") |
| 22552 |
(set_attr "mode" "SI")]) |
| 22553 |
|
| 22554 |
; False dependency happens when destination is only updated by tzcnt, |
| 22555 |
; lzcnt or popcnt. There is no false dependency when destination is |
| 22556 |
; also used in source. |
| 22557 |
(define_insn "*popcountsi2_zext_2_falsedep" |
| 22558 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 22559 |
(zero_extend:DI |
| 22560 |
(popcount:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))) |
| 22561 |
(unspec [(match_operand:DI 2 "register_operand" "0")] |
| 22562 |
UNSPEC_INSN_FALSE_DEP) |
| 22563 |
(clobber (reg:CC FLAGS_REG))] |
| 22564 |
"TARGET_POPCNT && TARGET_64BIT" |
| 22565 |
{ |
| 22566 |
#if TARGET_MACHO |
| 22567 |
return "popcnt\t{%1, %k0|%k0, %1}"; |
| 22568 |
#else |
| 22569 |
return "popcnt{l}\t{%1, %k0|%k0, %1}"; |
| 22570 |
#endif |
| 22571 |
} |
| 22572 |
[(set_attr "prefix_rep" "1") |
| 22573 |
(set_attr "type" "bitmanip") |
| 22574 |
(set_attr "mode" "SI")]) |
| 22575 |
|
| 22576 |
(define_insn_and_split "*popcounthi2_1" |
| 22577 |
[(set (match_operand:SI 0 "register_operand") |
| 22578 |
(popcount:SI |
| 22579 |
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand")))) |
| 22580 |
(clobber (reg:CC FLAGS_REG))] |
| 22581 |
"TARGET_POPCNT |
| 22582 |
&& ix86_pre_reload_split ()" |
| 22583 |
"#" |
| 22584 |
"&& 1" |
| 22585 |
[(const_int 0)] |
| 22586 |
{ |
| 22587 |
rtx tmp = gen_reg_rtx (HImode); |
| 22588 |
|
| 22589 |
emit_insn (gen_popcounthi2 (tmp, operands[1])); |
| 22590 |
emit_insn (gen_zero_extendhisi2 (operands[0], tmp)); |
| 22591 |
DONE; |
| 22592 |
}) |
| 22593 |
|
| 22594 |
(define_insn_and_split "*popcounthi2_2" |
| 22595 |
[(set (match_operand:SI 0 "register_operand") |
| 22596 |
(zero_extend:SI |
| 22597 |
(popcount:HI (match_operand:HI 1 "nonimmediate_operand")))) |
| 22598 |
(clobber (reg:CC FLAGS_REG))] |
| 22599 |
"TARGET_POPCNT |
| 22600 |
&& ix86_pre_reload_split ()" |
| 22601 |
"#" |
| 22602 |
"&& 1" |
| 22603 |
[(const_int 0)] |
| 22604 |
{ |
| 22605 |
rtx tmp = gen_reg_rtx (HImode); |
| 22606 |
|
| 22607 |
emit_insn (gen_popcounthi2 (tmp, operands[1])); |
| 22608 |
emit_insn (gen_zero_extendhisi2 (operands[0], tmp)); |
| 22609 |
DONE; |
| 22610 |
}) |
| 22611 |
|
| 22612 |
(define_insn "popcounthi2<nf_name>" |
| 22613 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 22614 |
(popcount:HI |
| 22615 |
(match_operand:HI 1 "nonimmediate_operand" "rm")))] |
| 22616 |
"TARGET_POPCNT && <nf_condition>" |
| 22617 |
{ |
| 22618 |
#if TARGET_MACHO |
| 22619 |
return "<nf_prefix>popcnt\t{%1, %0|%0, %1}"; |
| 22620 |
#else |
| 22621 |
return "<nf_prefix>popcnt{w}\t{%1, %0|%0, %1}"; |
| 22622 |
#endif |
| 22623 |
} |
| 22624 |
[(set_attr "prefix_rep" "1") |
| 22625 |
(set_attr "type" "bitmanip") |
| 22626 |
(set_attr "has_nf" "1") |
| 22627 |
(set_attr "mode" "HI")]) |
| 22628 |
|
| 22629 |
(define_expand "bswapdi2" |
| 22630 |
[(set (match_operand:DI 0 "register_operand") |
| 22631 |
(bswap:DI (match_operand:DI 1 "nonimmediate_operand")))] |
| 22632 |
"TARGET_64BIT" |
| 22633 |
{ |
| 22634 |
if (!TARGET_MOVBE) |
| 22635 |
operands[1] = force_reg (DImode, operands[1]); |
| 22636 |
}) |
| 22637 |
|
| 22638 |
(define_expand "bswapsi2" |
| 22639 |
[(set (match_operand:SI 0 "register_operand") |
| 22640 |
(bswap:SI (match_operand:SI 1 "nonimmediate_operand")))] |
| 22641 |
"" |
| 22642 |
{ |
| 22643 |
if (!TARGET_MOVBE) |
| 22644 |
{ |
| 22645 |
operands[1] = force_reg (SImode, operands[1]); |
| 22646 |
|
| 22647 |
if (!TARGET_BSWAP) |
| 22648 |
{ |
| 22649 |
rtx x = gen_reg_rtx (SImode); |
| 22650 |
|
| 22651 |
emit_insn (gen_bswaphisi2_lowpart (x, operands[1])); |
| 22652 |
emit_insn (gen_rotlsi3 (x, x, GEN_INT (16))); |
| 22653 |
emit_insn (gen_bswaphisi2_lowpart (operands[0], x)); |
| 22654 |
DONE; |
| 22655 |
} |
| 22656 |
} |
| 22657 |
}) |
| 22658 |
|
| 22659 |
(define_insn "*bswap<mode>2_movbe" |
| 22660 |
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,r,m") |
| 22661 |
(bswap:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0,m,r")))] |
| 22662 |
"TARGET_MOVBE |
| 22663 |
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))" |
| 22664 |
"@ |
| 22665 |
bswap\t%0 |
| 22666 |
movbe{<imodesuffix>}\t{%1, %0|%0, %1} |
| 22667 |
movbe{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 22668 |
[(set_attr "type" "bitmanip,imov,imov") |
| 22669 |
(set_attr "modrm" "0,1,1") |
| 22670 |
(set_attr "prefix_0f" "*,1,1") |
| 22671 |
(set_attr "prefix_extra" "*,1,1") |
| 22672 |
(set_attr "mode" "<MODE>")]) |
| 22673 |
|
| 22674 |
(define_insn "*bswap<mode>2" |
| 22675 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 22676 |
(bswap:SWI48 (match_operand:SWI48 1 "register_operand" "0")))] |
| 22677 |
"TARGET_BSWAP" |
| 22678 |
"bswap\t%0" |
| 22679 |
[(set_attr "type" "bitmanip") |
| 22680 |
(set_attr "modrm" "0") |
| 22681 |
(set_attr "mode" "<MODE>")]) |
| 22682 |
|
| 22683 |
(define_expand "bswaphi2" |
| 22684 |
[(set (match_operand:HI 0 "register_operand") |
| 22685 |
(bswap:HI (match_operand:HI 1 "nonimmediate_operand")))] |
| 22686 |
"" |
| 22687 |
{ |
| 22688 |
if (!TARGET_MOVBE) |
| 22689 |
operands[1] = force_reg (HImode, operands[1]); |
| 22690 |
}) |
| 22691 |
|
| 22692 |
(define_insn "*bswaphi2_movbe" |
| 22693 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=Q,r,m") |
| 22694 |
(bswap:HI (match_operand:HI 1 "nonimmediate_operand" "0,m,r")))] |
| 22695 |
"TARGET_MOVBE |
| 22696 |
&& !(MEM_P (operands[0]) && MEM_P (operands[1]))" |
| 22697 |
"@ |
| 22698 |
xchg{b}\t{%h0, %b0|%b0, %h0} |
| 22699 |
movbe{w}\t{%1, %0|%0, %1} |
| 22700 |
movbe{w}\t{%1, %0|%0, %1}" |
| 22701 |
[(set_attr "type" "imov") |
| 22702 |
(set_attr "modrm" "*,1,1") |
| 22703 |
(set_attr "prefix_0f" "*,1,1") |
| 22704 |
(set_attr "prefix_extra" "*,1,1") |
| 22705 |
(set_attr "pent_pair" "np,*,*") |
| 22706 |
(set_attr "athlon_decode" "vector,*,*") |
| 22707 |
(set_attr "amdfam10_decode" "double,*,*") |
| 22708 |
(set_attr "c86_decode" "vector,*,*") |
| 22709 |
(set_attr "bdver1_decode" "double,*,*") |
| 22710 |
(set_attr "mode" "QI,HI,HI")]) |
| 22711 |
|
| 22712 |
(define_insn "*bswaphi2" |
| 22713 |
[(set (match_operand:HI 0 "register_operand" "=Q") |
| 22714 |
(bswap:HI (match_operand:HI 1 "register_operand" "0")))] |
| 22715 |
"!TARGET_MOVBE" |
| 22716 |
"xchg{b}\t{%h0, %b0|%b0, %h0}" |
| 22717 |
[(set_attr "type" "imov") |
| 22718 |
(set_attr "pent_pair" "np") |
| 22719 |
(set_attr "athlon_decode" "vector") |
| 22720 |
(set_attr "amdfam10_decode" "double") |
| 22721 |
(set_attr "c86_decode" "vector") |
| 22722 |
(set_attr "bdver1_decode" "double") |
| 22723 |
(set_attr "mode" "QI")]) |
| 22724 |
|
| 22725 |
(define_peephole2 |
| 22726 |
[(set (match_operand:HI 0 "general_reg_operand") |
| 22727 |
(bswap:HI (match_dup 0)))] |
| 22728 |
"!(TARGET_USE_XCHGB || |
| 22729 |
TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 22730 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 22731 |
[(parallel [(set (match_dup 0) (rotate:HI (match_dup 0) (const_int 8))) |
| 22732 |
(clobber (reg:CC FLAGS_REG))])]) |
| 22733 |
|
| 22734 |
(define_insn "bswaphisi2_lowpart" |
| 22735 |
[(set (match_operand:SI 0 "register_operand" "=Q") |
| 22736 |
(ior:SI (and:SI (match_operand:SI 1 "register_operand" "0") |
| 22737 |
(const_int -65536)) |
| 22738 |
(lshiftrt:SI (bswap:SI (match_dup 1)) |
| 22739 |
(const_int 16))))] |
| 22740 |
"" |
| 22741 |
"xchg{b}\t{%h0, %b0|%b0, %h0}" |
| 22742 |
[(set_attr "type" "imov") |
| 22743 |
(set_attr "pent_pair" "np") |
| 22744 |
(set_attr "athlon_decode" "vector") |
| 22745 |
(set_attr "amdfam10_decode" "double") |
| 22746 |
(set_attr "c86_decode" "vector") |
| 22747 |
(set_attr "bdver1_decode" "double") |
| 22748 |
(set_attr "mode" "QI")]) |
| 22749 |
|
| 22750 |
(define_peephole2 |
| 22751 |
[(set (match_operand:SI 0 "general_reg_operand") |
| 22752 |
(ior:SI (and:SI (match_dup 0) |
| 22753 |
(const_int -65536)) |
| 22754 |
(lshiftrt:SI (bswap:SI (match_dup 0)) |
| 22755 |
(const_int 16))))] |
| 22756 |
"!(TARGET_USE_XCHGB || |
| 22757 |
TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 22758 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 22759 |
[(parallel [(set (strict_low_part (match_dup 0)) |
| 22760 |
(rotate:HI (match_dup 0) (const_int 8))) |
| 22761 |
(clobber (reg:CC FLAGS_REG))])] |
| 22762 |
"operands[0] = gen_lowpart (HImode, operands[0]);") |
| 22763 |
|
| 22764 |
;; Variant of above peephole2 to improve register allocation. |
| 22765 |
(define_peephole2 |
| 22766 |
[(set (match_operand:SI 0 "general_reg_operand") |
| 22767 |
(match_operand:SI 1 "register_operand")) |
| 22768 |
(set (match_dup 0) |
| 22769 |
(ior:SI (and:SI (match_dup 0) |
| 22770 |
(const_int -65536)) |
| 22771 |
(lshiftrt:SI (bswap:SI (match_dup 0)) |
| 22772 |
(const_int 16)))) |
| 22773 |
(set (match_operand:SI 2 "general_reg_operand") (match_dup 0))] |
| 22774 |
"!(TARGET_USE_XCHGB || |
| 22775 |
TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) |
| 22776 |
&& peep2_regno_dead_p (0, FLAGS_REG) |
| 22777 |
&& peep2_reg_dead_p(3, operands[0])" |
| 22778 |
[(parallel |
| 22779 |
[(set (strict_low_part (match_dup 3)) |
| 22780 |
(rotate:HI (match_dup 3) (const_int 8))) |
| 22781 |
(clobber (reg:CC FLAGS_REG))])] |
| 22782 |
{ |
| 22783 |
if (!rtx_equal_p (operands[1], operands[2])) |
| 22784 |
emit_move_insn (operands[2], operands[1]); |
| 22785 |
operands[3] = gen_lowpart (HImode, operands[2]); |
| 22786 |
}) |
| 22787 |
|
| 22788 |
(define_expand "paritydi2" |
| 22789 |
[(set (match_operand:DI 0 "register_operand") |
| 22790 |
(parity:DI (match_operand:DI 1 "register_operand")))] |
| 22791 |
"! TARGET_POPCNT" |
| 22792 |
{ |
| 22793 |
rtx scratch = gen_reg_rtx (QImode); |
| 22794 |
rtx hipart1 = gen_reg_rtx (SImode); |
| 22795 |
rtx lopart1 = gen_reg_rtx (SImode); |
| 22796 |
rtx xor1 = gen_reg_rtx (SImode); |
| 22797 |
rtx shift2 = gen_reg_rtx (SImode); |
| 22798 |
rtx hipart2 = gen_reg_rtx (HImode); |
| 22799 |
rtx lopart2 = gen_reg_rtx (HImode); |
| 22800 |
rtx xor2 = gen_reg_rtx (HImode); |
| 22801 |
|
| 22802 |
if (TARGET_64BIT) |
| 22803 |
{ |
| 22804 |
rtx shift1 = gen_reg_rtx (DImode); |
| 22805 |
emit_insn (gen_lshrdi3 (shift1, operands[1], GEN_INT (32))); |
| 22806 |
emit_move_insn (hipart1, gen_lowpart (SImode, shift1)); |
| 22807 |
} |
| 22808 |
else |
| 22809 |
emit_move_insn (hipart1, gen_highpart (SImode, operands[1])); |
| 22810 |
|
| 22811 |
emit_move_insn (lopart1, gen_lowpart (SImode, operands[1])); |
| 22812 |
emit_insn (gen_xorsi3 (xor1, hipart1, lopart1)); |
| 22813 |
|
| 22814 |
emit_insn (gen_lshrsi3 (shift2, xor1, GEN_INT (16))); |
| 22815 |
emit_move_insn (hipart2, gen_lowpart (HImode, shift2)); |
| 22816 |
emit_move_insn (lopart2, gen_lowpart (HImode, xor1)); |
| 22817 |
emit_insn (gen_xorhi3 (xor2, hipart2, lopart2)); |
| 22818 |
|
| 22819 |
emit_insn (gen_parityhi2_cmp (xor2)); |
| 22820 |
|
| 22821 |
ix86_expand_setcc (scratch, ORDERED, |
| 22822 |
gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); |
| 22823 |
|
| 22824 |
if (TARGET_64BIT) |
| 22825 |
emit_insn (gen_zero_extendqidi2 (operands[0], scratch)); |
| 22826 |
else |
| 22827 |
{ |
| 22828 |
rtx tmp = gen_reg_rtx (SImode); |
| 22829 |
|
| 22830 |
emit_insn (gen_zero_extendqisi2 (tmp, scratch)); |
| 22831 |
emit_insn (gen_zero_extendsidi2 (operands[0], tmp)); |
| 22832 |
} |
| 22833 |
DONE; |
| 22834 |
}) |
| 22835 |
|
| 22836 |
(define_expand "paritysi2" |
| 22837 |
[(set (match_operand:SI 0 "register_operand") |
| 22838 |
(parity:SI (match_operand:SI 1 "register_operand")))] |
| 22839 |
"! TARGET_POPCNT" |
| 22840 |
{ |
| 22841 |
rtx scratch = gen_reg_rtx (QImode); |
| 22842 |
rtx shift = gen_reg_rtx (SImode); |
| 22843 |
rtx hipart = gen_reg_rtx (HImode); |
| 22844 |
rtx lopart = gen_reg_rtx (HImode); |
| 22845 |
rtx tmp = gen_reg_rtx (HImode); |
| 22846 |
|
| 22847 |
emit_insn (gen_lshrsi3 (shift, operands[1], GEN_INT (16))); |
| 22848 |
emit_move_insn (hipart, gen_lowpart (HImode, shift)); |
| 22849 |
emit_move_insn (lopart, gen_lowpart (HImode, operands[1])); |
| 22850 |
emit_insn (gen_xorhi3 (tmp, hipart, lopart)); |
| 22851 |
|
| 22852 |
emit_insn (gen_parityhi2_cmp (tmp)); |
| 22853 |
|
| 22854 |
ix86_expand_setcc (scratch, ORDERED, |
| 22855 |
gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); |
| 22856 |
|
| 22857 |
emit_insn (gen_zero_extendqisi2 (operands[0], scratch)); |
| 22858 |
DONE; |
| 22859 |
}) |
| 22860 |
|
| 22861 |
(define_expand "parityhi2" |
| 22862 |
[(set (match_operand:HI 0 "register_operand") |
| 22863 |
(parity:HI (match_operand:HI 1 "register_operand")))] |
| 22864 |
"! TARGET_POPCNT" |
| 22865 |
{ |
| 22866 |
rtx scratch = gen_reg_rtx (QImode); |
| 22867 |
rtx tmp = gen_reg_rtx (HImode); |
| 22868 |
|
| 22869 |
emit_move_insn (tmp, operands[1]); |
| 22870 |
emit_insn (gen_parityhi2_cmp (tmp)); |
| 22871 |
|
| 22872 |
ix86_expand_setcc (scratch, ORDERED, |
| 22873 |
gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); |
| 22874 |
|
| 22875 |
emit_insn (gen_zero_extendqihi2 (operands[0], scratch)); |
| 22876 |
DONE; |
| 22877 |
}) |
| 22878 |
|
| 22879 |
(define_expand "parityqi2" |
| 22880 |
[(set (match_operand:QI 0 "register_operand") |
| 22881 |
(parity:QI (match_operand:QI 1 "register_operand")))] |
| 22882 |
"! TARGET_POPCNT" |
| 22883 |
{ |
| 22884 |
emit_insn (gen_parityqi2_cmp (operands[1])); |
| 22885 |
|
| 22886 |
ix86_expand_setcc (operands[0], ORDERED, |
| 22887 |
gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx); |
| 22888 |
DONE; |
| 22889 |
}) |
| 22890 |
|
| 22891 |
(define_insn "parityhi2_cmp" |
| 22892 |
[(set (reg:CC FLAGS_REG) |
| 22893 |
(unspec:CC [(match_operand:HI 0 "register_operand" "+Q")] |
| 22894 |
UNSPEC_PARITY)) |
| 22895 |
(clobber (match_dup 0))] |
| 22896 |
"" |
| 22897 |
"xor{b}\t{%h0, %b0|%b0, %h0}" |
| 22898 |
[(set_attr "length" "2") |
| 22899 |
(set_attr "mode" "QI")]) |
| 22900 |
|
| 22901 |
(define_insn "parityqi2_cmp" |
| 22902 |
[(set (reg:CC FLAGS_REG) |
| 22903 |
(unspec:CC [(match_operand:QI 0 "register_operand" "q")] |
| 22904 |
UNSPEC_PARITY))] |
| 22905 |
"" |
| 22906 |
"test{b}\t%0, %0" |
| 22907 |
[(set_attr "mode" "QI")]) |
| 22908 |
|
| 22909 |
;; Replace zero_extend:HI followed by parityhi2_cmp with parityqi2_cmp |
| 22910 |
(define_peephole2 |
| 22911 |
[(set (match_operand:HI 0 "register_operand") |
| 22912 |
(zero_extend:HI (match_operand:QI 1 "general_reg_operand"))) |
| 22913 |
(parallel [(set (reg:CC FLAGS_REG) |
| 22914 |
(unspec:CC [(match_dup 0)] UNSPEC_PARITY)) |
| 22915 |
(clobber (match_dup 0))])] |
| 22916 |
"" |
| 22917 |
[(set (reg:CC FLAGS_REG) |
| 22918 |
(unspec:CC [(match_dup 1)] UNSPEC_PARITY))]) |
| 22919 |
|
| 22920 |
;; Eliminate QImode popcount&1 using parity flag |
| 22921 |
(define_peephole2 |
| 22922 |
[(set (match_operand:SI 0 "register_operand") |
| 22923 |
(zero_extend:SI (match_operand:QI 1 "general_reg_operand"))) |
| 22924 |
(parallel [(set (match_operand:SI 2 "register_operand") |
| 22925 |
(popcount:SI (match_dup 0))) |
| 22926 |
(clobber (reg:CC FLAGS_REG))]) |
| 22927 |
(set (reg:CCZ FLAGS_REG) |
| 22928 |
(compare:CCZ (and:QI (match_operand:QI 3 "register_operand") |
| 22929 |
(const_int 1)) |
| 22930 |
(const_int 0))) |
| 22931 |
(set (pc) (if_then_else (match_operator 4 "bt_comparison_operator" |
| 22932 |
[(reg:CCZ FLAGS_REG) |
| 22933 |
(const_int 0)]) |
| 22934 |
(label_ref (match_operand 5)) |
| 22935 |
(pc)))] |
| 22936 |
"REGNO (operands[2]) == REGNO (operands[3]) |
| 22937 |
&& peep2_reg_dead_p (3, operands[0]) |
| 22938 |
&& peep2_reg_dead_p (3, operands[2]) |
| 22939 |
&& peep2_regno_dead_p (4, FLAGS_REG)" |
| 22940 |
[(set (reg:CC FLAGS_REG) |
| 22941 |
(unspec:CC [(match_dup 1)] UNSPEC_PARITY)) |
| 22942 |
(set (pc) (if_then_else (match_op_dup 4 [(reg:CC FLAGS_REG) |
| 22943 |
(const_int 0)]) |
| 22944 |
(label_ref (match_dup 5)) |
| 22945 |
(pc)))] |
| 22946 |
{ |
| 22947 |
operands[4] = shallow_copy_rtx (operands[4]); |
| 22948 |
PUT_CODE (operands[4], GET_CODE (operands[4]) == EQ ? UNORDERED : ORDERED); |
| 22949 |
}) |
| 22950 |
|
| 22951 |
;; Eliminate HImode popcount&1 using parity flag |
| 22952 |
(define_peephole2 |
| 22953 |
[(match_scratch:HI 0 "Q") |
| 22954 |
(parallel [(set (match_operand:HI 1 "register_operand") |
| 22955 |
(popcount:HI |
| 22956 |
(match_operand:HI 2 "nonimmediate_operand"))) |
| 22957 |
(clobber (reg:CC FLAGS_REG))]) |
| 22958 |
(set (match_operand 3 "register_operand") |
| 22959 |
(zero_extend (match_dup 1))) |
| 22960 |
(set (reg:CCZ FLAGS_REG) |
| 22961 |
(compare:CCZ (and:QI (match_operand:QI 4 "register_operand") |
| 22962 |
(const_int 1)) |
| 22963 |
(const_int 0))) |
| 22964 |
(set (pc) (if_then_else (match_operator 5 "bt_comparison_operator" |
| 22965 |
[(reg:CCZ FLAGS_REG) |
| 22966 |
(const_int 0)]) |
| 22967 |
(label_ref (match_operand 6)) |
| 22968 |
(pc)))] |
| 22969 |
"REGNO (operands[3]) == REGNO (operands[4]) |
| 22970 |
&& peep2_reg_dead_p (3, operands[1]) |
| 22971 |
&& peep2_reg_dead_p (3, operands[3]) |
| 22972 |
&& peep2_regno_dead_p (4, FLAGS_REG)" |
| 22973 |
[(set (match_dup 0) (match_dup 2)) |
| 22974 |
(parallel [(set (reg:CC FLAGS_REG) |
| 22975 |
(unspec:CC [(match_dup 0)] UNSPEC_PARITY)) |
| 22976 |
(clobber (match_dup 0))]) |
| 22977 |
(set (pc) (if_then_else (match_op_dup 5 [(reg:CC FLAGS_REG) |
| 22978 |
(const_int 0)]) |
| 22979 |
(label_ref (match_dup 6)) |
| 22980 |
(pc)))] |
| 22981 |
{ |
| 22982 |
operands[5] = shallow_copy_rtx (operands[5]); |
| 22983 |
PUT_CODE (operands[5], GET_CODE (operands[5]) == EQ ? UNORDERED : ORDERED); |
| 22984 |
}) |
| 22985 |
|
| 22986 |
;; Eliminate HImode popcount&1 using parity flag (variant 2) |
| 22987 |
(define_peephole2 |
| 22988 |
[(match_scratch:HI 0 "Q") |
| 22989 |
(parallel [(set (match_operand:HI 1 "register_operand") |
| 22990 |
(popcount:HI |
| 22991 |
(match_operand:HI 2 "nonimmediate_operand"))) |
| 22992 |
(clobber (reg:CC FLAGS_REG))]) |
| 22993 |
(set (reg:CCZ FLAGS_REG) |
| 22994 |
(compare:CCZ (and:QI (match_operand:QI 3 "register_operand") |
| 22995 |
(const_int 1)) |
| 22996 |
(const_int 0))) |
| 22997 |
(set (pc) (if_then_else (match_operator 4 "bt_comparison_operator" |
| 22998 |
[(reg:CCZ FLAGS_REG) |
| 22999 |
(const_int 0)]) |
| 23000 |
(label_ref (match_operand 5)) |
| 23001 |
(pc)))] |
| 23002 |
"REGNO (operands[1]) == REGNO (operands[3]) |
| 23003 |
&& peep2_reg_dead_p (2, operands[1]) |
| 23004 |
&& peep2_reg_dead_p (2, operands[3]) |
| 23005 |
&& peep2_regno_dead_p (3, FLAGS_REG)" |
| 23006 |
[(set (match_dup 0) (match_dup 2)) |
| 23007 |
(parallel [(set (reg:CC FLAGS_REG) |
| 23008 |
(unspec:CC [(match_dup 0)] UNSPEC_PARITY)) |
| 23009 |
(clobber (match_dup 0))]) |
| 23010 |
(set (pc) (if_then_else (match_op_dup 4 [(reg:CC FLAGS_REG) |
| 23011 |
(const_int 0)]) |
| 23012 |
(label_ref (match_dup 5)) |
| 23013 |
(pc)))] |
| 23014 |
{ |
| 23015 |
operands[4] = shallow_copy_rtx (operands[4]); |
| 23016 |
PUT_CODE (operands[4], GET_CODE (operands[4]) == EQ ? UNORDERED : ORDERED); |
| 23017 |
}) |
| 23018 |
|
| 23019 |
|
| 23020 |
;; Thread-local storage patterns for ELF. |
| 23021 |
;; |
| 23022 |
;; Note that these code sequences must appear exactly as shown |
| 23023 |
;; in order to allow linker relaxation. |
| 23024 |
|
| 23025 |
(define_insn "*tls_global_dynamic_32_gnu" |
| 23026 |
[(set (match_operand:SI 0 "register_operand" "=a") |
| 23027 |
(unspec:SI |
| 23028 |
[(match_operand:SI 1 "register_operand" "Yb") |
| 23029 |
(match_operand 2 "tls_symbolic_operand") |
| 23030 |
(match_operand 3 "constant_call_address_operand" "Bz") |
| 23031 |
(reg:SI SP_REG)] |
| 23032 |
UNSPEC_TLS_GD)) |
| 23033 |
(clobber (match_scratch:SI 4 "=d")) |
| 23034 |
(clobber (match_scratch:SI 5 "=c")) |
| 23035 |
(clobber (reg:CC FLAGS_REG))] |
| 23036 |
"!TARGET_64BIT && TARGET_GNU_TLS" |
| 23037 |
{ |
| 23038 |
if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) |
| 23039 |
output_asm_insn |
| 23040 |
("lea{l}\t{%E2@tlsgd(,%1,1), %0|%0, %E2@tlsgd[%1*1]}", operands); |
| 23041 |
else |
| 23042 |
output_asm_insn |
| 23043 |
("lea{l}\t{%E2@tlsgd(%1), %0|%0, %E2@tlsgd[%1]}", operands); |
| 23044 |
if (TARGET_SUN_TLS) |
| 23045 |
#ifdef HAVE_AS_IX86_TLSGDPLT |
| 23046 |
return "call\t%a2@tlsgdplt"; |
| 23047 |
#else |
| 23048 |
return "call\t%p3@plt"; |
| 23049 |
#endif |
| 23050 |
if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) |
| 23051 |
return "call\t%P3"; |
| 23052 |
return "call\t{*%p3@GOT(%1)|[DWORD PTR %p3@GOT[%1]]}"; |
| 23053 |
} |
| 23054 |
[(set_attr "type" "multi") |
| 23055 |
(set_attr "length" "12")]) |
| 23056 |
|
| 23057 |
(define_expand "tls_global_dynamic_32" |
| 23058 |
[(parallel |
| 23059 |
[(set (match_operand:SI 0 "register_operand") |
| 23060 |
(unspec:SI [(match_operand:SI 2 "register_operand") |
| 23061 |
(match_operand 1 "tls_symbolic_operand") |
| 23062 |
(match_operand 3 "constant_call_address_operand") |
| 23063 |
(reg:SI SP_REG)] |
| 23064 |
UNSPEC_TLS_GD)) |
| 23065 |
(clobber (scratch:SI)) |
| 23066 |
(clobber (scratch:SI)) |
| 23067 |
(clobber (reg:CC FLAGS_REG))])] |
| 23068 |
"" |
| 23069 |
"ix86_tls_descriptor_calls_expanded_in_cfun = true;") |
| 23070 |
|
| 23071 |
(define_insn "*tls_global_dynamic_64_<mode>" |
| 23072 |
[(set (match_operand:P 0 "register_operand" "=a") |
| 23073 |
(call:P |
| 23074 |
(mem:QI (match_operand 2 "constant_call_address_operand" "Bz")) |
| 23075 |
(match_operand 3))) |
| 23076 |
(unspec:P [(match_operand 1 "tls_symbolic_operand") |
| 23077 |
(reg:P SP_REG)] |
| 23078 |
UNSPEC_TLS_GD) |
| 23079 |
(clobber (match_operand:P 4 "register_operand" "=D"))] |
| 23080 |
"TARGET_64BIT" |
| 23081 |
{ |
| 23082 |
if (!TARGET_X32) |
| 23083 |
/* The .loc directive has effect for 'the immediately following assembly |
| 23084 |
instruction'. So for a sequence: |
| 23085 |
.loc f l |
| 23086 |
.byte x |
| 23087 |
insn1 |
| 23088 |
the 'immediately following assembly instruction' is insn1. |
| 23089 |
We want to emit an insn prefix here, but if we use .byte (as shown in |
| 23090 |
'ELF Handling For Thread-Local Storage'), a preceding .loc will point |
| 23091 |
inside the insn sequence, rather than to the start. After relaxation |
| 23092 |
of the sequence by the linker, the .loc might point inside an insn. |
| 23093 |
Use data16 prefix instead, which doesn't have this problem. */ |
| 23094 |
fputs ("\tdata16", asm_out_file); |
| 23095 |
output_asm_insn |
| 23096 |
("lea{q}\t{%E1@tlsgd(%%rip), %q4|%q4, %E1@tlsgd[rip]}", operands); |
| 23097 |
if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) |
| 23098 |
fputs (ASM_SHORT "0x6666\n", asm_out_file); |
| 23099 |
else |
| 23100 |
fputs (ASM_BYTE "0x66\n", asm_out_file); |
| 23101 |
fputs ("\trex64\n", asm_out_file); |
| 23102 |
if (TARGET_SUN_TLS) |
| 23103 |
return "call\t%p2@plt"; |
| 23104 |
if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) |
| 23105 |
return "call\t%P2"; |
| 23106 |
return "call\t{*%p2@GOTPCREL(%%rip)|[QWORD PTR %p2@GOTPCREL[rip]]}"; |
| 23107 |
} |
| 23108 |
[(set_attr "type" "multi") |
| 23109 |
(set (attr "length") |
| 23110 |
(symbol_ref "TARGET_X32 ? 15 : 16"))]) |
| 23111 |
|
| 23112 |
(define_insn "*tls_global_dynamic_64_largepic" |
| 23113 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 23114 |
(call:DI |
| 23115 |
(mem:QI (plus:DI (match_operand:DI 2 "register_operand" "b") |
| 23116 |
(match_operand:DI 3 "immediate_operand" "i"))) |
| 23117 |
(match_operand 4))) |
| 23118 |
(unspec:DI [(match_operand 1 "tls_symbolic_operand") |
| 23119 |
(reg:DI SP_REG)] |
| 23120 |
UNSPEC_TLS_GD) |
| 23121 |
(clobber (match_operand:DI 5 "register_operand" "=D"))] |
| 23122 |
"TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF |
| 23123 |
&& GET_CODE (operands[3]) == CONST |
| 23124 |
&& GET_CODE (XEXP (operands[3], 0)) == UNSPEC |
| 23125 |
&& XINT (XEXP (operands[3], 0), 1) == UNSPEC_PLTOFF" |
| 23126 |
{ |
| 23127 |
output_asm_insn |
| 23128 |
("lea{q}\t{%E1@tlsgd(%%rip), %5|%5, %E1@tlsgd[rip]}", operands); |
| 23129 |
output_asm_insn ("movabs{q}\t{%3, %%rax|rax, %3}", operands); |
| 23130 |
output_asm_insn ("add{q}\t{%2, %%rax|rax, %2}", operands); |
| 23131 |
return "call\t{*%%rax|rax}"; |
| 23132 |
} |
| 23133 |
[(set_attr "type" "multi") |
| 23134 |
(set_attr "length" "22")]) |
| 23135 |
|
| 23136 |
(define_expand "@tls_global_dynamic_64_<mode>" |
| 23137 |
[(parallel |
| 23138 |
[(set (match_operand:P 0 "register_operand") |
| 23139 |
(call:P |
| 23140 |
(mem:QI (match_operand 2)) |
| 23141 |
(const_int 0))) |
| 23142 |
(unspec:P [(match_operand 1 "tls_symbolic_operand") |
| 23143 |
(reg:P SP_REG)] |
| 23144 |
UNSPEC_TLS_GD) |
| 23145 |
(clobber (match_operand:P 3 "register_operand"))])] |
| 23146 |
"TARGET_64BIT" |
| 23147 |
"ix86_tls_descriptor_calls_expanded_in_cfun = true;") |
| 23148 |
|
| 23149 |
(define_insn "*tls_local_dynamic_base_32_gnu" |
| 23150 |
[(set (match_operand:SI 0 "register_operand" "=a") |
| 23151 |
(unspec:SI |
| 23152 |
[(match_operand:SI 1 "register_operand" "Yb") |
| 23153 |
(match_operand 2 "constant_call_address_operand" "Bz") |
| 23154 |
(reg:SI SP_REG)] |
| 23155 |
UNSPEC_TLS_LD_BASE)) |
| 23156 |
(clobber (match_scratch:SI 3 "=d")) |
| 23157 |
(clobber (match_scratch:SI 4 "=c")) |
| 23158 |
(clobber (reg:CC FLAGS_REG))] |
| 23159 |
"!TARGET_64BIT && TARGET_GNU_TLS" |
| 23160 |
{ |
| 23161 |
output_asm_insn |
| 23162 |
("lea{l}\t{%&@tlsldm(%1), %0|%0, %&@tlsldm[%1]}", operands); |
| 23163 |
if (TARGET_SUN_TLS) |
| 23164 |
{ |
| 23165 |
if (HAVE_AS_IX86_TLSLDMPLT) |
| 23166 |
return "call\t%&@tlsldmplt"; |
| 23167 |
else |
| 23168 |
return "call\t%p2@plt"; |
| 23169 |
} |
| 23170 |
if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) |
| 23171 |
return "call\t%P2"; |
| 23172 |
return "call\t{*%p2@GOT(%1)|[DWORD PTR %p2@GOT[%1]]}"; |
| 23173 |
} |
| 23174 |
[(set_attr "type" "multi") |
| 23175 |
(set_attr "length" "11")]) |
| 23176 |
|
| 23177 |
(define_expand "tls_local_dynamic_base_32" |
| 23178 |
[(parallel |
| 23179 |
[(set (match_operand:SI 0 "register_operand") |
| 23180 |
(unspec:SI |
| 23181 |
[(match_operand:SI 1 "register_operand") |
| 23182 |
(match_operand 2 "constant_call_address_operand") |
| 23183 |
(reg:SI SP_REG)] |
| 23184 |
UNSPEC_TLS_LD_BASE)) |
| 23185 |
(clobber (scratch:SI)) |
| 23186 |
(clobber (scratch:SI)) |
| 23187 |
(clobber (reg:CC FLAGS_REG))])] |
| 23188 |
"" |
| 23189 |
"ix86_tls_descriptor_calls_expanded_in_cfun = true;") |
| 23190 |
|
| 23191 |
(define_insn "*tls_local_dynamic_base_64_<mode>" |
| 23192 |
[(set (match_operand:P 0 "register_operand" "=a") |
| 23193 |
(call:P |
| 23194 |
(mem:QI (match_operand 1 "constant_call_address_operand" "Bz")) |
| 23195 |
(match_operand 2))) |
| 23196 |
(unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE) |
| 23197 |
(clobber (match_operand:P 3 "register_operand" "=D"))] |
| 23198 |
"TARGET_64BIT" |
| 23199 |
{ |
| 23200 |
output_asm_insn |
| 23201 |
("lea{q}\t{%&@tlsld(%%rip), %q3|%q3, %&@tlsld[rip]}", operands); |
| 23202 |
if (TARGET_SUN_TLS) |
| 23203 |
return "call\t%p1@plt"; |
| 23204 |
if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT) |
| 23205 |
return "call\t%P1"; |
| 23206 |
return "call\t{*%p1@GOTPCREL(%%rip)|[QWORD PTR %p1@GOTPCREL[rip]]}"; |
| 23207 |
} |
| 23208 |
[(set_attr "type" "multi") |
| 23209 |
(set_attr "length" "12")]) |
| 23210 |
|
| 23211 |
(define_insn "*tls_local_dynamic_base_64_largepic" |
| 23212 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 23213 |
(call:DI |
| 23214 |
(mem:QI (plus:DI (match_operand:DI 1 "register_operand" "b") |
| 23215 |
(match_operand:DI 2 "immediate_operand" "i"))) |
| 23216 |
(match_operand 3))) |
| 23217 |
(unspec:DI [(reg:DI SP_REG)] UNSPEC_TLS_LD_BASE) |
| 23218 |
(clobber (match_operand:DI 4 "register_operand" "=D"))] |
| 23219 |
"TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF |
| 23220 |
&& GET_CODE (operands[2]) == CONST |
| 23221 |
&& GET_CODE (XEXP (operands[2], 0)) == UNSPEC |
| 23222 |
&& XINT (XEXP (operands[2], 0), 1) == UNSPEC_PLTOFF" |
| 23223 |
{ |
| 23224 |
output_asm_insn |
| 23225 |
("lea{q}\t{%&@tlsld(%%rip), %4|%4, %&@tlsld[rip]}", operands); |
| 23226 |
output_asm_insn ("movabs{q}\t{%2, %%rax|rax, %2}", operands); |
| 23227 |
output_asm_insn ("add{q}\t{%1, %%rax|rax, %1}", operands); |
| 23228 |
return "call\t{*%%rax|rax}"; |
| 23229 |
} |
| 23230 |
[(set_attr "type" "multi") |
| 23231 |
(set_attr "length" "22")]) |
| 23232 |
|
| 23233 |
(define_expand "@tls_local_dynamic_base_64_<mode>" |
| 23234 |
[(parallel |
| 23235 |
[(set (match_operand:P 0 "register_operand") |
| 23236 |
(call:P |
| 23237 |
(mem:QI (match_operand 1)) |
| 23238 |
(const_int 0))) |
| 23239 |
(unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE) |
| 23240 |
(clobber (match_operand:P 2 "register_operand"))])] |
| 23241 |
"TARGET_64BIT" |
| 23242 |
"ix86_tls_descriptor_calls_expanded_in_cfun = true;") |
| 23243 |
|
| 23244 |
;; Local dynamic of a single variable is a lose. Show combine how |
| 23245 |
;; to convert that back to global dynamic. |
| 23246 |
|
| 23247 |
(define_insn_and_split "*tls_local_dynamic_32_once" |
| 23248 |
[(set (match_operand:SI 0 "register_operand" "=a") |
| 23249 |
(plus:SI |
| 23250 |
(unspec:SI [(match_operand:SI 1 "register_operand" "b") |
| 23251 |
(match_operand 2 "constant_call_address_operand" "Bz") |
| 23252 |
(reg:SI SP_REG)] |
| 23253 |
UNSPEC_TLS_LD_BASE) |
| 23254 |
(const:SI (unspec:SI |
| 23255 |
[(match_operand 3 "tls_symbolic_operand")] |
| 23256 |
UNSPEC_DTPOFF)))) |
| 23257 |
(clobber (match_scratch:SI 4 "=d")) |
| 23258 |
(clobber (match_scratch:SI 5 "=c")) |
| 23259 |
(clobber (reg:CC FLAGS_REG))] |
| 23260 |
"" |
| 23261 |
"#" |
| 23262 |
"" |
| 23263 |
[(parallel |
| 23264 |
[(set (match_dup 0) |
| 23265 |
(unspec:SI [(match_dup 1) (match_dup 3) (match_dup 2) |
| 23266 |
(reg:SI SP_REG)] |
| 23267 |
UNSPEC_TLS_GD)) |
| 23268 |
(clobber (match_dup 4)) |
| 23269 |
(clobber (match_dup 5)) |
| 23270 |
(clobber (reg:CC FLAGS_REG))])]) |
| 23271 |
|
| 23272 |
;; Load and add the thread base pointer from %<tp_seg>:0. |
| 23273 |
(define_expand "get_thread_pointer<mode>" |
| 23274 |
[(set (match_operand:PTR 0 "register_operand") |
| 23275 |
(unspec:PTR [(const_int 0)] UNSPEC_TP))] |
| 23276 |
"" |
| 23277 |
{ |
| 23278 |
/* targetm is not visible in the scope of the condition. */ |
| 23279 |
if (!targetm.have_tls) |
| 23280 |
error ("%<__builtin_thread_pointer%> is not supported on this target"); |
| 23281 |
}) |
| 23282 |
|
| 23283 |
(define_insn_and_split "*load_tp_<mode>" |
| 23284 |
[(set (match_operand:PTR 0 "register_operand" "=r") |
| 23285 |
(unspec:PTR [(const_int 0)] UNSPEC_TP))] |
| 23286 |
"" |
| 23287 |
"#" |
| 23288 |
"" |
| 23289 |
[(set (match_dup 0) |
| 23290 |
(match_dup 1))] |
| 23291 |
{ |
| 23292 |
addr_space_t as = DEFAULT_TLS_SEG_REG; |
| 23293 |
|
| 23294 |
operands[1] = gen_const_mem (<MODE>mode, const0_rtx); |
| 23295 |
set_mem_addr_space (operands[1], as); |
| 23296 |
}) |
| 23297 |
|
| 23298 |
(define_insn_and_split "*load_tp_x32_zext" |
| 23299 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 23300 |
(zero_extend:DI |
| 23301 |
(unspec:SI [(const_int 0)] UNSPEC_TP)))] |
| 23302 |
"TARGET_X32" |
| 23303 |
"#" |
| 23304 |
"&& 1" |
| 23305 |
[(set (match_dup 0) |
| 23306 |
(zero_extend:DI (match_dup 1)))] |
| 23307 |
{ |
| 23308 |
addr_space_t as = DEFAULT_TLS_SEG_REG; |
| 23309 |
|
| 23310 |
operands[1] = gen_const_mem (SImode, const0_rtx); |
| 23311 |
set_mem_addr_space (operands[1], as); |
| 23312 |
}) |
| 23313 |
|
| 23314 |
(define_insn_and_split "*add_tp_<mode>" |
| 23315 |
[(set (match_operand:PTR 0 "register_operand" "=r") |
| 23316 |
(plus:PTR |
| 23317 |
(unspec:PTR [(const_int 0)] UNSPEC_TP) |
| 23318 |
(match_operand:PTR 1 "register_operand" "0"))) |
| 23319 |
(clobber (reg:CC FLAGS_REG))] |
| 23320 |
"" |
| 23321 |
"#" |
| 23322 |
"" |
| 23323 |
[(parallel |
| 23324 |
[(set (match_dup 0) |
| 23325 |
(plus:PTR (match_dup 1) (match_dup 2))) |
| 23326 |
(clobber (reg:CC FLAGS_REG))])] |
| 23327 |
{ |
| 23328 |
addr_space_t as = DEFAULT_TLS_SEG_REG; |
| 23329 |
|
| 23330 |
operands[2] = gen_const_mem (<MODE>mode, const0_rtx); |
| 23331 |
set_mem_addr_space (operands[2], as); |
| 23332 |
}) |
| 23333 |
|
| 23334 |
(define_insn_and_split "*add_tp_x32_zext" |
| 23335 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 23336 |
(zero_extend:DI |
| 23337 |
(plus:SI (unspec:SI [(const_int 0)] UNSPEC_TP) |
| 23338 |
(match_operand:SI 1 "register_operand" "0")))) |
| 23339 |
(clobber (reg:CC FLAGS_REG))] |
| 23340 |
"TARGET_X32" |
| 23341 |
"#" |
| 23342 |
"&& 1" |
| 23343 |
[(parallel |
| 23344 |
[(set (match_dup 0) |
| 23345 |
(zero_extend:DI |
| 23346 |
(plus:SI (match_dup 1) (match_dup 2)))) |
| 23347 |
(clobber (reg:CC FLAGS_REG))])] |
| 23348 |
{ |
| 23349 |
addr_space_t as = DEFAULT_TLS_SEG_REG; |
| 23350 |
|
| 23351 |
operands[2] = gen_const_mem (SImode, const0_rtx); |
| 23352 |
set_mem_addr_space (operands[2], as); |
| 23353 |
}) |
| 23354 |
|
| 23355 |
;; GNU2 TLS patterns can be split. |
| 23356 |
|
| 23357 |
(define_expand "tls_dynamic_gnu2_32" |
| 23358 |
[(set (match_dup 3) |
| 23359 |
(plus:SI (match_operand:SI 2 "register_operand") |
| 23360 |
(const:SI |
| 23361 |
(unspec:SI [(match_operand 1 "tls_symbolic_operand")] |
| 23362 |
UNSPEC_TLSDESC)))) |
| 23363 |
(parallel |
| 23364 |
[(set (match_operand:SI 0 "register_operand") |
| 23365 |
(unspec:SI [(match_dup 1) (match_dup 3) |
| 23366 |
(match_dup 2) (reg:SI SP_REG)] |
| 23367 |
UNSPEC_TLSDESC)) |
| 23368 |
(clobber (reg:CC FLAGS_REG))])] |
| 23369 |
"!TARGET_64BIT && TARGET_GNU2_TLS" |
| 23370 |
{ |
| 23371 |
operands[3] = can_create_pseudo_p () ? gen_reg_rtx (Pmode) : operands[0]; |
| 23372 |
ix86_tls_descriptor_calls_expanded_in_cfun = true; |
| 23373 |
}) |
| 23374 |
|
| 23375 |
(define_insn "*tls_dynamic_gnu2_lea_32" |
| 23376 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 23377 |
(plus:SI (match_operand:SI 1 "register_operand" "b") |
| 23378 |
(const:SI |
| 23379 |
(unspec:SI [(match_operand 2 "tls_symbolic_operand")] |
| 23380 |
UNSPEC_TLSDESC))))] |
| 23381 |
"!TARGET_64BIT && TARGET_GNU2_TLS" |
| 23382 |
"lea{l}\t{%E2@TLSDESC(%1), %0|%0, %E2@TLSDESC[%1]}" |
| 23383 |
[(set_attr "type" "lea") |
| 23384 |
(set_attr "mode" "SI") |
| 23385 |
(set_attr "length" "6") |
| 23386 |
(set_attr "length_address" "4")]) |
| 23387 |
|
| 23388 |
(define_insn "*tls_dynamic_gnu2_call_32" |
| 23389 |
[(set (match_operand:SI 0 "register_operand" "=a") |
| 23390 |
(unspec:SI [(match_operand 1 "tls_symbolic_operand") |
| 23391 |
(match_operand:SI 2 "register_operand" "0") |
| 23392 |
;; we have to make sure %ebx still points to the GOT |
| 23393 |
(match_operand:SI 3 "register_operand" "b") |
| 23394 |
(reg:SI SP_REG)] |
| 23395 |
UNSPEC_TLSDESC)) |
| 23396 |
(clobber (reg:CC FLAGS_REG))] |
| 23397 |
"!TARGET_64BIT && TARGET_GNU2_TLS" |
| 23398 |
"call\t{*%a1@TLSCALL(%2)|[DWORD PTR [%2+%a1@TLSCALL]]}" |
| 23399 |
[(set_attr "type" "call") |
| 23400 |
(set_attr "length" "2") |
| 23401 |
(set_attr "length_address" "0")]) |
| 23402 |
|
| 23403 |
(define_insn_and_split "*tls_dynamic_gnu2_combine_32" |
| 23404 |
[(set (match_operand:SI 0 "register_operand" "=&a") |
| 23405 |
(plus:SI |
| 23406 |
(unspec:SI [(match_operand 3 "tls_modbase_operand") |
| 23407 |
(match_operand:SI 4) |
| 23408 |
(match_operand:SI 2 "register_operand" "b") |
| 23409 |
(reg:SI SP_REG)] |
| 23410 |
UNSPEC_TLSDESC) |
| 23411 |
(const:SI (unspec:SI |
| 23412 |
[(match_operand 1 "tls_symbolic_operand")] |
| 23413 |
UNSPEC_DTPOFF)))) |
| 23414 |
(clobber (reg:CC FLAGS_REG))] |
| 23415 |
"!TARGET_64BIT && TARGET_GNU2_TLS" |
| 23416 |
"#" |
| 23417 |
"&& 1" |
| 23418 |
[(set (match_dup 0) (match_dup 5))] |
| 23419 |
{ |
| 23420 |
operands[5] = can_create_pseudo_p () ? gen_reg_rtx (Pmode) : operands[0]; |
| 23421 |
emit_insn (gen_tls_dynamic_gnu2_32 (operands[5], operands[1], operands[2])); |
| 23422 |
}) |
| 23423 |
|
| 23424 |
(define_expand "@tls_dynamic_gnu2_64_<mode>" |
| 23425 |
[(set (match_dup 2) |
| 23426 |
(unspec:PTR [(match_operand 1 "tls_symbolic_operand")] |
| 23427 |
UNSPEC_TLSDESC)) |
| 23428 |
(parallel |
| 23429 |
[(set (match_operand:PTR 0 "register_operand") |
| 23430 |
(unspec:PTR [(match_dup 1) (match_dup 2) (reg:PTR SP_REG)] |
| 23431 |
UNSPEC_TLSDESC)) |
| 23432 |
(clobber (reg:CC FLAGS_REG))])] |
| 23433 |
"TARGET_64BIT && TARGET_GNU2_TLS" |
| 23434 |
{ |
| 23435 |
operands[2] = can_create_pseudo_p () ? gen_reg_rtx (ptr_mode) : operands[0]; |
| 23436 |
ix86_tls_descriptor_calls_expanded_in_cfun = true; |
| 23437 |
}) |
| 23438 |
|
| 23439 |
(define_insn "*tls_dynamic_gnu2_lea_64_<mode>" |
| 23440 |
[(set (match_operand:PTR 0 "register_operand" "=r") |
| 23441 |
(unspec:PTR [(match_operand 1 "tls_symbolic_operand")] |
| 23442 |
UNSPEC_TLSDESC))] |
| 23443 |
"TARGET_64BIT && TARGET_GNU2_TLS" |
| 23444 |
"lea%z0\t{%E1@TLSDESC(%%rip), %0|%0, %E1@TLSDESC[rip]}" |
| 23445 |
[(set_attr "type" "lea") |
| 23446 |
(set_attr "mode" "<MODE>") |
| 23447 |
(set_attr "length" "7") |
| 23448 |
(set_attr "length_address" "4")]) |
| 23449 |
|
| 23450 |
(define_insn "*tls_dynamic_gnu2_call_64_<mode>" |
| 23451 |
[(set (match_operand:PTR 0 "register_operand" "=a") |
| 23452 |
(unspec:PTR [(match_operand 1 "tls_symbolic_operand") |
| 23453 |
(match_operand:PTR 2 "register_operand" "0") |
| 23454 |
(reg:PTR SP_REG)] |
| 23455 |
UNSPEC_TLSDESC)) |
| 23456 |
(clobber (reg:CC FLAGS_REG))] |
| 23457 |
"TARGET_64BIT && TARGET_GNU2_TLS" |
| 23458 |
"call\t{*%a1@TLSCALL(%2)|[QWORD PTR [%2+%a1@TLSCALL]]}" |
| 23459 |
[(set_attr "type" "call") |
| 23460 |
(set_attr "length" "2") |
| 23461 |
(set_attr "length_address" "0")]) |
| 23462 |
|
| 23463 |
(define_insn_and_split "*tls_dynamic_gnu2_combine_64_<mode>" |
| 23464 |
[(set (match_operand:PTR 0 "register_operand" "=&a") |
| 23465 |
(plus:PTR |
| 23466 |
(unspec:PTR [(match_operand 2 "tls_modbase_operand") |
| 23467 |
(match_operand:PTR 3) |
| 23468 |
(reg:PTR SP_REG)] |
| 23469 |
UNSPEC_TLSDESC) |
| 23470 |
(const:PTR (unspec:PTR |
| 23471 |
[(match_operand 1 "tls_symbolic_operand")] |
| 23472 |
UNSPEC_DTPOFF)))) |
| 23473 |
(clobber (reg:CC FLAGS_REG))] |
| 23474 |
"TARGET_64BIT && TARGET_GNU2_TLS" |
| 23475 |
"#" |
| 23476 |
"&& 1" |
| 23477 |
[(set (match_dup 0) (match_dup 4))] |
| 23478 |
{ |
| 23479 |
operands[4] = can_create_pseudo_p () ? gen_reg_rtx (ptr_mode) : operands[0]; |
| 23480 |
emit_insn (gen_tls_dynamic_gnu2_64 (ptr_mode, operands[4], operands[1])); |
| 23481 |
}) |
| 23482 |
|
| 23483 |
(define_split |
| 23484 |
[(match_operand 0 "tls_address_pattern")] |
| 23485 |
"TARGET_TLS_DIRECT_SEG_REFS" |
| 23486 |
[(match_dup 0)] |
| 23487 |
"operands[0] = ix86_rewrite_tls_address (operands[0]);") |
| 23488 |
|
| 23489 |
|
| 23490 |
;; These patterns match the binary 387 instructions for addM3, subM3, |
| 23491 |
;; mulM3 and divM3. There are three patterns for each of DFmode and |
| 23492 |
;; SFmode. The first is the normal insn, the second the same insn but |
| 23493 |
;; with one operand a conversion, and the third the same insn but with |
| 23494 |
;; the other operand a conversion. The conversion may be SFmode or |
| 23495 |
;; SImode if the target mode DFmode, but only SImode if the target mode |
| 23496 |
;; is SFmode. |
| 23497 |
|
| 23498 |
;; Gcc is slightly more smart about handling normal two address instructions |
| 23499 |
;; so use special patterns for add and mull. |
| 23500 |
|
| 23501 |
(define_insn "*fop_xf_comm_i387" |
| 23502 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 23503 |
(match_operator:XF 3 "binary_fp_operator" |
| 23504 |
[(match_operand:XF 1 "register_operand" "%0") |
| 23505 |
(match_operand:XF 2 "register_operand" "f")]))] |
| 23506 |
"TARGET_80387 |
| 23507 |
&& COMMUTATIVE_ARITH_P (operands[3])" |
| 23508 |
"* return output_387_binary_op (insn, operands);" |
| 23509 |
[(set (attr "type") |
| 23510 |
(if_then_else (match_operand:XF 3 "mult_operator") |
| 23511 |
(const_string "fmul") |
| 23512 |
(const_string "fop"))) |
| 23513 |
(set_attr "mode" "XF")]) |
| 23514 |
|
| 23515 |
(define_insn "*fop_<mode>_comm" |
| 23516 |
[(set (match_operand:MODEF 0 "register_operand" "=f,x,v") |
| 23517 |
(match_operator:MODEF 3 "binary_fp_operator" |
| 23518 |
[(match_operand:MODEF 1 "nonimmediate_operand" "%0,0,v") |
| 23519 |
(match_operand:MODEF 2 "nonimmediate_operand" "fm,xm,vm")]))] |
| 23520 |
"((SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 23521 |
|| (TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode))) |
| 23522 |
&& COMMUTATIVE_ARITH_P (operands[3]) |
| 23523 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 23524 |
"* return output_387_binary_op (insn, operands);" |
| 23525 |
[(set (attr "type") |
| 23526 |
(if_then_else (eq_attr "alternative" "1,2") |
| 23527 |
(if_then_else (match_operand:MODEF 3 "mult_operator") |
| 23528 |
(const_string "ssemul") |
| 23529 |
(const_string "sseadd")) |
| 23530 |
(if_then_else (match_operand:MODEF 3 "mult_operator") |
| 23531 |
(const_string "fmul") |
| 23532 |
(const_string "fop")))) |
| 23533 |
(set_attr "isa" "*,noavx,avx") |
| 23534 |
(set_attr "prefix" "orig,orig,vex") |
| 23535 |
(set_attr "mode" "<MODE>") |
| 23536 |
(set (attr "enabled") |
| 23537 |
(if_then_else |
| 23538 |
(match_test ("SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH")) |
| 23539 |
(if_then_else |
| 23540 |
(eq_attr "alternative" "0") |
| 23541 |
(symbol_ref "TARGET_MIX_SSE_I387 |
| 23542 |
&& X87_ENABLE_ARITH (<MODE>mode)") |
| 23543 |
(const_string "*")) |
| 23544 |
(if_then_else |
| 23545 |
(eq_attr "alternative" "0") |
| 23546 |
(symbol_ref "true") |
| 23547 |
(symbol_ref "false"))))]) |
| 23548 |
|
| 23549 |
(define_insn "*<insn>hf" |
| 23550 |
[(set (match_operand:HF 0 "register_operand" "=v") |
| 23551 |
(plusminusmultdiv:HF |
| 23552 |
(match_operand:HF 1 "nonimmediate_operand" "<comm>v") |
| 23553 |
(match_operand:HF 2 "nonimmediate_operand" "vm")))] |
| 23554 |
"TARGET_AVX512FP16 |
| 23555 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 23556 |
"v<insn>sh\t{%2, %1, %0|%0, %1, %2}" |
| 23557 |
[(set_attr "prefix" "evex") |
| 23558 |
(set_attr "mode" "HF")]) |
| 23559 |
|
| 23560 |
(define_insn "*rcpsf2_sse" |
| 23561 |
[(set (match_operand:SF 0 "register_operand" "=x,x,x,x") |
| 23562 |
(unspec:SF [(match_operand:SF 1 "nonimmediate_operand" "0,x,m,ja")] |
| 23563 |
UNSPEC_RCP))] |
| 23564 |
"TARGET_SSE && TARGET_SSE_MATH" |
| 23565 |
"@ |
| 23566 |
%vrcpss\t{%d1, %0|%0, %d1} |
| 23567 |
%vrcpss\t{%d1, %0|%0, %d1} |
| 23568 |
rcpss\t{%1, %d0|%d0, %1} |
| 23569 |
vrcpss\t{%1, %d0|%d0, %1}" |
| 23570 |
[(set_attr "isa" "*,*,noavx,avx") |
| 23571 |
(set_attr "addr" "*,*,*,gpr16") |
| 23572 |
(set_attr "type" "sse") |
| 23573 |
(set_attr "atom_sse_attr" "rcp") |
| 23574 |
(set_attr "btver2_sse_attr" "rcp") |
| 23575 |
(set_attr "prefix" "maybe_vex") |
| 23576 |
(set_attr "mode" "SF") |
| 23577 |
(set_attr "avx_partial_xmm_update" "false,false,true,true") |
| 23578 |
(set (attr "preferred_for_speed") |
| 23579 |
(cond [(match_test "TARGET_AVX") |
| 23580 |
(symbol_ref "true") |
| 23581 |
(eq_attr "alternative" "1,2,3") |
| 23582 |
(symbol_ref "!TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 23583 |
] |
| 23584 |
(symbol_ref "true")))]) |
| 23585 |
|
| 23586 |
(define_insn "rcphf2" |
| 23587 |
[(set (match_operand:HF 0 "register_operand" "=v,v") |
| 23588 |
(unspec:HF [(match_operand:HF 1 "nonimmediate_operand" "v,m")] |
| 23589 |
UNSPEC_RCP))] |
| 23590 |
"TARGET_AVX512FP16" |
| 23591 |
"@ |
| 23592 |
vrcpsh\t{%d1, %0|%0, %d1} |
| 23593 |
vrcpsh\t{%1, %d0|%d0, %1}" |
| 23594 |
[(set_attr "type" "sse") |
| 23595 |
(set_attr "prefix" "evex") |
| 23596 |
(set_attr "mode" "HF") |
| 23597 |
(set_attr "avx_partial_xmm_update" "false,true")]) |
| 23598 |
|
| 23599 |
(define_insn "*fop_xf_1_i387" |
| 23600 |
[(set (match_operand:XF 0 "register_operand" "=f,f") |
| 23601 |
(match_operator:XF 3 "binary_fp_operator" |
| 23602 |
[(match_operand:XF 1 "register_operand" "0,f") |
| 23603 |
(match_operand:XF 2 "register_operand" "f,0")]))] |
| 23604 |
"TARGET_80387 |
| 23605 |
&& !COMMUTATIVE_ARITH_P (operands[3])" |
| 23606 |
"* return output_387_binary_op (insn, operands);" |
| 23607 |
[(set (attr "type") |
| 23608 |
(if_then_else (match_operand:XF 3 "div_operator") |
| 23609 |
(const_string "fdiv") |
| 23610 |
(const_string "fop"))) |
| 23611 |
(set_attr "mode" "XF")]) |
| 23612 |
|
| 23613 |
(define_insn "*fop_<mode>_1" |
| 23614 |
[(set (match_operand:MODEF 0 "register_operand" "=f,f,x,v") |
| 23615 |
(match_operator:MODEF 3 "binary_fp_operator" |
| 23616 |
[(match_operand:MODEF 1 |
| 23617 |
"x87nonimm_ssenomem_operand" "0,fm,0,v") |
| 23618 |
(match_operand:MODEF 2 |
| 23619 |
"nonimmediate_operand" "fm,0,xm,vm")]))] |
| 23620 |
"((SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 23621 |
|| (TARGET_80387 && X87_ENABLE_ARITH (<MODE>mode))) |
| 23622 |
&& !COMMUTATIVE_ARITH_P (operands[3]) |
| 23623 |
&& !(MEM_P (operands[1]) && MEM_P (operands[2]))" |
| 23624 |
"* return output_387_binary_op (insn, operands);" |
| 23625 |
[(set (attr "type") |
| 23626 |
(if_then_else (eq_attr "alternative" "2,3") |
| 23627 |
(if_then_else (match_operand:MODEF 3 "div_operator") |
| 23628 |
(const_string "ssediv") |
| 23629 |
(const_string "sseadd")) |
| 23630 |
(if_then_else (match_operand:MODEF 3 "div_operator") |
| 23631 |
(const_string "fdiv") |
| 23632 |
(const_string "fop")))) |
| 23633 |
(set_attr "isa" "*,*,noavx,avx") |
| 23634 |
(set_attr "prefix" "orig,orig,orig,vex") |
| 23635 |
(set_attr "mode" "<MODE>") |
| 23636 |
(set (attr "enabled") |
| 23637 |
(if_then_else |
| 23638 |
(match_test ("SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH")) |
| 23639 |
(if_then_else |
| 23640 |
(eq_attr "alternative" "0,1") |
| 23641 |
(symbol_ref "TARGET_MIX_SSE_I387 |
| 23642 |
&& X87_ENABLE_ARITH (<MODE>mode)") |
| 23643 |
(const_string "*")) |
| 23644 |
(if_then_else |
| 23645 |
(eq_attr "alternative" "0,1") |
| 23646 |
(symbol_ref "true") |
| 23647 |
(symbol_ref "false"))))]) |
| 23648 |
|
| 23649 |
(define_insn "*fop_<X87MODEF:mode>_2_i387" |
| 23650 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f") |
| 23651 |
(match_operator:X87MODEF 3 "binary_fp_operator" |
| 23652 |
[(float:X87MODEF |
| 23653 |
(match_operand:SWI24 1 "nonimmediate_operand" "m")) |
| 23654 |
(match_operand:X87MODEF 2 "register_operand" "0")]))] |
| 23655 |
"TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, <SWI24:MODE>mode) |
| 23656 |
&& !(SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH) |
| 23657 |
&& (TARGET_USE_<SWI24:MODE>MODE_FIOP |
| 23658 |
|| optimize_function_for_size_p (cfun))" |
| 23659 |
"* return output_387_binary_op (insn, operands);" |
| 23660 |
[(set (attr "type") |
| 23661 |
(cond [(match_operand:X87MODEF 3 "mult_operator") |
| 23662 |
(const_string "fmul") |
| 23663 |
(match_operand:X87MODEF 3 "div_operator") |
| 23664 |
(const_string "fdiv") |
| 23665 |
] |
| 23666 |
(const_string "fop"))) |
| 23667 |
(set_attr "fp_int_src" "true") |
| 23668 |
(set_attr "mode" "<SWI24:MODE>")]) |
| 23669 |
|
| 23670 |
(define_insn "*fop_<X87MODEF:mode>_3_i387" |
| 23671 |
[(set (match_operand:X87MODEF 0 "register_operand" "=f") |
| 23672 |
(match_operator:X87MODEF 3 "binary_fp_operator" |
| 23673 |
[(match_operand:X87MODEF 1 "register_operand" "0") |
| 23674 |
(float:X87MODEF |
| 23675 |
(match_operand:SWI24 2 "nonimmediate_operand" "m"))]))] |
| 23676 |
"TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, <SWI24:MODE>mode) |
| 23677 |
&& !(SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH) |
| 23678 |
&& (TARGET_USE_<SWI24:MODE>MODE_FIOP |
| 23679 |
|| optimize_function_for_size_p (cfun))" |
| 23680 |
"* return output_387_binary_op (insn, operands);" |
| 23681 |
[(set (attr "type") |
| 23682 |
(cond [(match_operand:X87MODEF 3 "mult_operator") |
| 23683 |
(const_string "fmul") |
| 23684 |
(match_operand:X87MODEF 3 "div_operator") |
| 23685 |
(const_string "fdiv") |
| 23686 |
] |
| 23687 |
(const_string "fop"))) |
| 23688 |
(set_attr "fp_int_src" "true") |
| 23689 |
(set_attr "mode" "<SWI24:MODE>")]) |
| 23690 |
|
| 23691 |
(define_insn "*fop_xf_4_i387" |
| 23692 |
[(set (match_operand:XF 0 "register_operand" "=f,f") |
| 23693 |
(match_operator:XF 3 "binary_fp_operator" |
| 23694 |
[(float_extend:XF |
| 23695 |
(match_operand:MODEF 1 "nonimmediate_operand" "fm,0")) |
| 23696 |
(match_operand:XF 2 "register_operand" "0,f")]))] |
| 23697 |
"TARGET_80387" |
| 23698 |
"* return output_387_binary_op (insn, operands);" |
| 23699 |
[(set (attr "type") |
| 23700 |
(cond [(match_operand:XF 3 "mult_operator") |
| 23701 |
(const_string "fmul") |
| 23702 |
(match_operand:XF 3 "div_operator") |
| 23703 |
(const_string "fdiv") |
| 23704 |
] |
| 23705 |
(const_string "fop"))) |
| 23706 |
(set_attr "mode" "<MODE>")]) |
| 23707 |
|
| 23708 |
(define_insn "*fop_df_4_i387" |
| 23709 |
[(set (match_operand:DF 0 "register_operand" "=f,f") |
| 23710 |
(match_operator:DF 3 "binary_fp_operator" |
| 23711 |
[(float_extend:DF |
| 23712 |
(match_operand:SF 1 "nonimmediate_operand" "fm,0")) |
| 23713 |
(match_operand:DF 2 "register_operand" "0,f")]))] |
| 23714 |
"TARGET_80387 && X87_ENABLE_ARITH (DFmode) |
| 23715 |
&& !(SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)" |
| 23716 |
"* return output_387_binary_op (insn, operands);" |
| 23717 |
[(set (attr "type") |
| 23718 |
(cond [(match_operand:DF 3 "mult_operator") |
| 23719 |
(const_string "fmul") |
| 23720 |
(match_operand:DF 3 "div_operator") |
| 23721 |
(const_string "fdiv") |
| 23722 |
] |
| 23723 |
(const_string "fop"))) |
| 23724 |
(set_attr "mode" "SF")]) |
| 23725 |
|
| 23726 |
(define_insn "*fop_xf_5_i387" |
| 23727 |
[(set (match_operand:XF 0 "register_operand" "=f,f") |
| 23728 |
(match_operator:XF 3 "binary_fp_operator" |
| 23729 |
[(match_operand:XF 1 "register_operand" "0,f") |
| 23730 |
(float_extend:XF |
| 23731 |
(match_operand:MODEF 2 "nonimmediate_operand" "fm,0"))]))] |
| 23732 |
"TARGET_80387" |
| 23733 |
"* return output_387_binary_op (insn, operands);" |
| 23734 |
[(set (attr "type") |
| 23735 |
(cond [(match_operand:XF 3 "mult_operator") |
| 23736 |
(const_string "fmul") |
| 23737 |
(match_operand:XF 3 "div_operator") |
| 23738 |
(const_string "fdiv") |
| 23739 |
] |
| 23740 |
(const_string "fop"))) |
| 23741 |
(set_attr "mode" "<MODE>")]) |
| 23742 |
|
| 23743 |
(define_insn "*fop_df_5_i387" |
| 23744 |
[(set (match_operand:DF 0 "register_operand" "=f,f") |
| 23745 |
(match_operator:DF 3 "binary_fp_operator" |
| 23746 |
[(match_operand:DF 1 "register_operand" "0,f") |
| 23747 |
(float_extend:DF |
| 23748 |
(match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] |
| 23749 |
"TARGET_80387 && X87_ENABLE_ARITH (DFmode) |
| 23750 |
&& !(SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)" |
| 23751 |
"* return output_387_binary_op (insn, operands);" |
| 23752 |
[(set (attr "type") |
| 23753 |
(cond [(match_operand:DF 3 "mult_operator") |
| 23754 |
(const_string "fmul") |
| 23755 |
(match_operand:DF 3 "div_operator") |
| 23756 |
(const_string "fdiv") |
| 23757 |
] |
| 23758 |
(const_string "fop"))) |
| 23759 |
(set_attr "mode" "SF")]) |
| 23760 |
|
| 23761 |
(define_insn "*fop_xf_6_i387" |
| 23762 |
[(set (match_operand:XF 0 "register_operand" "=f,f") |
| 23763 |
(match_operator:XF 3 "binary_fp_operator" |
| 23764 |
[(float_extend:XF |
| 23765 |
(match_operand:MODEF 1 "register_operand" "0,f")) |
| 23766 |
(float_extend:XF |
| 23767 |
(match_operand:MODEF 2 "nonimmediate_operand" "fm,0"))]))] |
| 23768 |
"TARGET_80387" |
| 23769 |
"* return output_387_binary_op (insn, operands);" |
| 23770 |
[(set (attr "type") |
| 23771 |
(cond [(match_operand:XF 3 "mult_operator") |
| 23772 |
(const_string "fmul") |
| 23773 |
(match_operand:XF 3 "div_operator") |
| 23774 |
(const_string "fdiv") |
| 23775 |
] |
| 23776 |
(const_string "fop"))) |
| 23777 |
(set_attr "mode" "<MODE>")]) |
| 23778 |
|
| 23779 |
(define_insn "*fop_df_6_i387" |
| 23780 |
[(set (match_operand:DF 0 "register_operand" "=f,f") |
| 23781 |
(match_operator:DF 3 "binary_fp_operator" |
| 23782 |
[(float_extend:DF |
| 23783 |
(match_operand:SF 1 "register_operand" "0,f")) |
| 23784 |
(float_extend:DF |
| 23785 |
(match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] |
| 23786 |
"TARGET_80387 && X87_ENABLE_ARITH (DFmode) |
| 23787 |
&& !(SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)" |
| 23788 |
"* return output_387_binary_op (insn, operands);" |
| 23789 |
[(set (attr "type") |
| 23790 |
(cond [(match_operand:DF 3 "mult_operator") |
| 23791 |
(const_string "fmul") |
| 23792 |
(match_operand:DF 3 "div_operator") |
| 23793 |
(const_string "fdiv") |
| 23794 |
] |
| 23795 |
(const_string "fop"))) |
| 23796 |
(set_attr "mode" "SF")]) |
| 23797 |
|
| 23798 |
;; FPU special functions. |
| 23799 |
|
| 23800 |
;; This pattern implements a no-op XFmode truncation for |
| 23801 |
;; all fancy i386 XFmode math functions. |
| 23802 |
|
| 23803 |
(define_insn "truncxf<mode>2_i387_noop_unspec" |
| 23804 |
[(set (match_operand:MODEF 0 "nonimmediate_operand" "=mf") |
| 23805 |
(unspec:MODEF [(match_operand:XF 1 "register_operand" "f")] |
| 23806 |
UNSPEC_TRUNC_NOOP))] |
| 23807 |
"TARGET_USE_FANCY_MATH_387" |
| 23808 |
"* return output_387_reg_move (insn, operands);" |
| 23809 |
[(set_attr "type" "fmov") |
| 23810 |
(set_attr "mode" "<MODE>")]) |
| 23811 |
|
| 23812 |
(define_insn "sqrtxf2" |
| 23813 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 23814 |
(sqrt:XF (match_operand:XF 1 "register_operand" "0")))] |
| 23815 |
"TARGET_USE_FANCY_MATH_387" |
| 23816 |
"fsqrt" |
| 23817 |
[(set_attr "type" "fpspc") |
| 23818 |
(set_attr "mode" "XF") |
| 23819 |
(set_attr "athlon_decode" "direct") |
| 23820 |
(set_attr "c86_attr" "sqrt") |
| 23821 |
(set_attr "amdfam10_decode" "direct") |
| 23822 |
(set_attr "bdver1_decode" "direct")]) |
| 23823 |
|
| 23824 |
(define_insn "*rsqrtsf2_sse" |
| 23825 |
[(set (match_operand:SF 0 "register_operand" "=x,x,x,x") |
| 23826 |
(unspec:SF [(match_operand:SF 1 "nonimmediate_operand" "0,x,m,ja")] |
| 23827 |
UNSPEC_RSQRT))] |
| 23828 |
"TARGET_SSE" |
| 23829 |
"@ |
| 23830 |
%vrsqrtss\t{%d1, %0|%0, %d1} |
| 23831 |
%vrsqrtss\t{%d1, %0|%0, %d1} |
| 23832 |
rsqrtss\t{%1, %d0|%d0, %1} |
| 23833 |
vrsqrtss\t{%1, %d0|%d0, %1}" |
| 23834 |
[(set_attr "isa" "*,*,noavx,avx") |
| 23835 |
(set_attr "addr" "*,*,*,gpr16") |
| 23836 |
(set_attr "type" "sse") |
| 23837 |
(set_attr "atom_sse_attr" "rcp") |
| 23838 |
(set_attr "btver2_sse_attr" "rcp") |
| 23839 |
(set_attr "prefix" "maybe_vex") |
| 23840 |
(set_attr "mode" "SF") |
| 23841 |
(set_attr "avx_partial_xmm_update" "false,false,true,true") |
| 23842 |
(set (attr "preferred_for_speed") |
| 23843 |
(cond [(match_test "TARGET_AVX") |
| 23844 |
(symbol_ref "true") |
| 23845 |
(eq_attr "alternative" "1,2,3") |
| 23846 |
(symbol_ref "!TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 23847 |
] |
| 23848 |
(symbol_ref "true")))]) |
| 23849 |
|
| 23850 |
(define_expand "rsqrtsf2" |
| 23851 |
[(set (match_operand:SF 0 "register_operand") |
| 23852 |
(unspec:SF [(match_operand:SF 1 "nonimmediate_operand")] |
| 23853 |
UNSPEC_RSQRT))] |
| 23854 |
"TARGET_SSE && TARGET_SSE_MATH" |
| 23855 |
{ |
| 23856 |
ix86_emit_swsqrtsf (operands[0], operands[1], SFmode, 1); |
| 23857 |
DONE; |
| 23858 |
}) |
| 23859 |
|
| 23860 |
(define_insn "rsqrthf2" |
| 23861 |
[(set (match_operand:HF 0 "register_operand" "=v,v") |
| 23862 |
(unspec:HF [(match_operand:HF 1 "nonimmediate_operand" "v,m")] |
| 23863 |
UNSPEC_RSQRT))] |
| 23864 |
"TARGET_AVX512FP16" |
| 23865 |
"@ |
| 23866 |
vrsqrtsh\t{%d1, %0|%0, %d1} |
| 23867 |
vrsqrtsh\t{%1, %d0|%d0, %1}" |
| 23868 |
[(set_attr "type" "sse") |
| 23869 |
(set_attr "prefix" "evex") |
| 23870 |
(set_attr "avx_partial_xmm_update" "false,true") |
| 23871 |
(set_attr "mode" "HF")]) |
| 23872 |
|
| 23873 |
(define_insn "sqrthf2" |
| 23874 |
[(set (match_operand:HF 0 "register_operand" "=v,v") |
| 23875 |
(sqrt:HF |
| 23876 |
(match_operand:HF 1 "nonimmediate_operand" "v,m")))] |
| 23877 |
"TARGET_AVX512FP16" |
| 23878 |
"@ |
| 23879 |
vsqrtsh\t{%d1, %0|%0, %d1} |
| 23880 |
vsqrtsh\t{%1, %d0|%d0, %1}" |
| 23881 |
[(set_attr "type" "sse") |
| 23882 |
(set_attr "prefix" "evex") |
| 23883 |
(set_attr "avx_partial_xmm_update" "false,true") |
| 23884 |
(set_attr "mode" "HF")]) |
| 23885 |
|
| 23886 |
(define_insn "*sqrt<mode>2_sse" |
| 23887 |
[(set (match_operand:MODEF 0 "register_operand" "=v,v,v") |
| 23888 |
(sqrt:MODEF |
| 23889 |
(match_operand:MODEF 1 "nonimmediate_operand" "0,v,m")))] |
| 23890 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH" |
| 23891 |
"@ |
| 23892 |
%vsqrt<ssemodesuffix>\t{%d1, %0|%0, %d1} |
| 23893 |
%vsqrt<ssemodesuffix>\t{%d1, %0|%0, %d1} |
| 23894 |
%vsqrt<ssemodesuffix>\t{%1, %d0|%d0, %1}" |
| 23895 |
[(set_attr "type" "sse") |
| 23896 |
(set_attr "atom_sse_attr" "sqrt") |
| 23897 |
(set_attr "btver2_sse_attr" "sqrt") |
| 23898 |
(set_attr "prefix" "maybe_vex") |
| 23899 |
(set_attr "avx_partial_xmm_update" "false,false,true") |
| 23900 |
(set_attr "mode" "<MODE>") |
| 23901 |
(set (attr "preferred_for_speed") |
| 23902 |
(cond [(match_test "TARGET_AVX") |
| 23903 |
(symbol_ref "true") |
| 23904 |
(eq_attr "alternative" "1,2") |
| 23905 |
(symbol_ref "!TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 23906 |
] |
| 23907 |
(symbol_ref "true")))]) |
| 23908 |
|
| 23909 |
(define_expand "sqrt<mode>2" |
| 23910 |
[(set (match_operand:MODEF 0 "register_operand") |
| 23911 |
(sqrt:MODEF |
| 23912 |
(match_operand:MODEF 1 "nonimmediate_operand")))] |
| 23913 |
"(TARGET_USE_FANCY_MATH_387 && X87_ENABLE_ARITH (<MODE>mode)) |
| 23914 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 23915 |
{ |
| 23916 |
if (<MODE>mode == SFmode |
| 23917 |
&& TARGET_SSE && TARGET_SSE_MATH |
| 23918 |
&& TARGET_RECIP_SQRT |
| 23919 |
&& !optimize_function_for_size_p (cfun) |
| 23920 |
&& flag_finite_math_only && !flag_trapping_math |
| 23921 |
&& flag_unsafe_math_optimizations) |
| 23922 |
{ |
| 23923 |
ix86_emit_swsqrtsf (operands[0], operands[1], SFmode, 0); |
| 23924 |
DONE; |
| 23925 |
} |
| 23926 |
|
| 23927 |
if (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)) |
| 23928 |
{ |
| 23929 |
rtx op0 = gen_reg_rtx (XFmode); |
| 23930 |
rtx op1 = gen_reg_rtx (XFmode); |
| 23931 |
|
| 23932 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 23933 |
emit_insn (gen_sqrtxf2 (op0, op1)); |
| 23934 |
emit_insn (gen_truncxf<mode>2_i387_noop_unspec (operands[0], op0)); |
| 23935 |
DONE; |
| 23936 |
} |
| 23937 |
}) |
| 23938 |
|
| 23939 |
(define_expand "hypot<mode>3" |
| 23940 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 23941 |
(use (match_operand:MODEF 1 "general_operand")) |
| 23942 |
(use (match_operand:MODEF 2 "general_operand"))] |
| 23943 |
"TARGET_USE_FANCY_MATH_387 |
| 23944 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 23945 |
|| TARGET_MIX_SSE_I387) |
| 23946 |
&& flag_finite_math_only |
| 23947 |
&& flag_unsafe_math_optimizations" |
| 23948 |
{ |
| 23949 |
rtx op0 = gen_reg_rtx (XFmode); |
| 23950 |
rtx op1 = gen_reg_rtx (XFmode); |
| 23951 |
rtx op2 = gen_reg_rtx (XFmode); |
| 23952 |
|
| 23953 |
emit_insn (gen_extend<mode>xf2 (op2, operands[2])); |
| 23954 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 23955 |
|
| 23956 |
emit_insn (gen_mulxf3 (op1, op1, op1)); |
| 23957 |
emit_insn (gen_mulxf3 (op2, op2, op2)); |
| 23958 |
emit_insn (gen_addxf3 (op0, op2, op1)); |
| 23959 |
emit_insn (gen_sqrtxf2 (op0, op0)); |
| 23960 |
|
| 23961 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 23962 |
DONE; |
| 23963 |
}) |
| 23964 |
|
| 23965 |
(define_insn "x86_fnstsw_1" |
| 23966 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 23967 |
(unspec:HI [(reg:CCFP FPSR_REG)] UNSPEC_FNSTSW))] |
| 23968 |
"TARGET_80387" |
| 23969 |
"fnstsw\t%0" |
| 23970 |
[(set_attr "length" "2") |
| 23971 |
(set_attr "mode" "SI") |
| 23972 |
(set_attr "unit" "i387")]) |
| 23973 |
|
| 23974 |
(define_insn "fpremxf4_i387" |
| 23975 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 23976 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0") |
| 23977 |
(match_operand:XF 3 "register_operand" "1")] |
| 23978 |
UNSPEC_FPREM_F)) |
| 23979 |
(set (match_operand:XF 1 "register_operand" "=f") |
| 23980 |
(unspec:XF [(match_dup 2) (match_dup 3)] |
| 23981 |
UNSPEC_FPREM_U)) |
| 23982 |
(set (reg:CCFP FPSR_REG) |
| 23983 |
(unspec:CCFP [(match_dup 2) (match_dup 3)] |
| 23984 |
UNSPEC_C2_FLAG))] |
| 23985 |
"TARGET_USE_FANCY_MATH_387" |
| 23986 |
"fprem" |
| 23987 |
[(set_attr "type" "fpspc") |
| 23988 |
(set_attr "znver1_decode" "vector") |
| 23989 |
(set_attr "c86_decode" "vector") |
| 23990 |
(set_attr "mode" "XF")]) |
| 23991 |
|
| 23992 |
(define_expand "fmodxf3" |
| 23993 |
[(use (match_operand:XF 0 "register_operand")) |
| 23994 |
(use (match_operand:XF 1 "general_operand")) |
| 23995 |
(use (match_operand:XF 2 "general_operand"))] |
| 23996 |
"TARGET_USE_FANCY_MATH_387" |
| 23997 |
{ |
| 23998 |
rtx_code_label *label = gen_label_rtx (); |
| 23999 |
|
| 24000 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24001 |
rtx op2 = gen_reg_rtx (XFmode); |
| 24002 |
|
| 24003 |
emit_move_insn (op2, operands[2]); |
| 24004 |
emit_move_insn (op1, operands[1]); |
| 24005 |
|
| 24006 |
emit_label (label); |
| 24007 |
emit_insn (gen_fpremxf4_i387 (op1, op2, op1, op2)); |
| 24008 |
ix86_emit_fp_unordered_jump (label); |
| 24009 |
LABEL_NUSES (label) = 1; |
| 24010 |
|
| 24011 |
emit_move_insn (operands[0], op1); |
| 24012 |
DONE; |
| 24013 |
}) |
| 24014 |
|
| 24015 |
(define_expand "fmod<mode>3" |
| 24016 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24017 |
(use (match_operand:MODEF 1 "general_operand")) |
| 24018 |
(use (match_operand:MODEF 2 "general_operand"))] |
| 24019 |
"TARGET_USE_FANCY_MATH_387" |
| 24020 |
{ |
| 24021 |
rtx (*gen_truncxf) (rtx, rtx); |
| 24022 |
|
| 24023 |
rtx_code_label *label = gen_label_rtx (); |
| 24024 |
|
| 24025 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24026 |
rtx op2 = gen_reg_rtx (XFmode); |
| 24027 |
|
| 24028 |
emit_insn (gen_extend<mode>xf2 (op2, operands[2])); |
| 24029 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24030 |
|
| 24031 |
emit_label (label); |
| 24032 |
emit_insn (gen_fpremxf4_i387 (op1, op2, op1, op2)); |
| 24033 |
ix86_emit_fp_unordered_jump (label); |
| 24034 |
LABEL_NUSES (label) = 1; |
| 24035 |
|
| 24036 |
/* Truncate the result properly for strict SSE math. */ |
| 24037 |
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 24038 |
&& !TARGET_MIX_SSE_I387) |
| 24039 |
gen_truncxf = gen_truncxf<mode>2; |
| 24040 |
else |
| 24041 |
gen_truncxf = gen_truncxf<mode>2_i387_noop_unspec; |
| 24042 |
|
| 24043 |
emit_insn (gen_truncxf (operands[0], op1)); |
| 24044 |
DONE; |
| 24045 |
}) |
| 24046 |
|
| 24047 |
(define_insn "fprem1xf4_i387" |
| 24048 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24049 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0") |
| 24050 |
(match_operand:XF 3 "register_operand" "1")] |
| 24051 |
UNSPEC_FPREM1_F)) |
| 24052 |
(set (match_operand:XF 1 "register_operand" "=f") |
| 24053 |
(unspec:XF [(match_dup 2) (match_dup 3)] |
| 24054 |
UNSPEC_FPREM1_U)) |
| 24055 |
(set (reg:CCFP FPSR_REG) |
| 24056 |
(unspec:CCFP [(match_dup 2) (match_dup 3)] |
| 24057 |
UNSPEC_C2_FLAG))] |
| 24058 |
"TARGET_USE_FANCY_MATH_387" |
| 24059 |
"fprem1" |
| 24060 |
[(set_attr "type" "fpspc") |
| 24061 |
(set_attr "znver1_decode" "vector") |
| 24062 |
(set_attr "c86_decode" "vector") |
| 24063 |
(set_attr "mode" "XF")]) |
| 24064 |
|
| 24065 |
(define_expand "remainderxf3" |
| 24066 |
[(use (match_operand:XF 0 "register_operand")) |
| 24067 |
(use (match_operand:XF 1 "general_operand")) |
| 24068 |
(use (match_operand:XF 2 "general_operand"))] |
| 24069 |
"TARGET_USE_FANCY_MATH_387" |
| 24070 |
{ |
| 24071 |
rtx_code_label *label = gen_label_rtx (); |
| 24072 |
|
| 24073 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24074 |
rtx op2 = gen_reg_rtx (XFmode); |
| 24075 |
|
| 24076 |
emit_move_insn (op2, operands[2]); |
| 24077 |
emit_move_insn (op1, operands[1]); |
| 24078 |
|
| 24079 |
emit_label (label); |
| 24080 |
emit_insn (gen_fprem1xf4_i387 (op1, op2, op1, op2)); |
| 24081 |
ix86_emit_fp_unordered_jump (label); |
| 24082 |
LABEL_NUSES (label) = 1; |
| 24083 |
|
| 24084 |
emit_move_insn (operands[0], op1); |
| 24085 |
DONE; |
| 24086 |
}) |
| 24087 |
|
| 24088 |
(define_expand "remainder<mode>3" |
| 24089 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24090 |
(use (match_operand:MODEF 1 "general_operand")) |
| 24091 |
(use (match_operand:MODEF 2 "general_operand"))] |
| 24092 |
"TARGET_USE_FANCY_MATH_387" |
| 24093 |
{ |
| 24094 |
rtx (*gen_truncxf) (rtx, rtx); |
| 24095 |
|
| 24096 |
rtx_code_label *label = gen_label_rtx (); |
| 24097 |
|
| 24098 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24099 |
rtx op2 = gen_reg_rtx (XFmode); |
| 24100 |
|
| 24101 |
emit_insn (gen_extend<mode>xf2 (op2, operands[2])); |
| 24102 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24103 |
|
| 24104 |
emit_label (label); |
| 24105 |
|
| 24106 |
emit_insn (gen_fprem1xf4_i387 (op1, op2, op1, op2)); |
| 24107 |
ix86_emit_fp_unordered_jump (label); |
| 24108 |
LABEL_NUSES (label) = 1; |
| 24109 |
|
| 24110 |
/* Truncate the result properly for strict SSE math. */ |
| 24111 |
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 24112 |
&& !TARGET_MIX_SSE_I387) |
| 24113 |
gen_truncxf = gen_truncxf<mode>2; |
| 24114 |
else |
| 24115 |
gen_truncxf = gen_truncxf<mode>2_i387_noop_unspec; |
| 24116 |
|
| 24117 |
emit_insn (gen_truncxf (operands[0], op1)); |
| 24118 |
DONE; |
| 24119 |
}) |
| 24120 |
|
| 24121 |
(define_int_iterator SINCOS |
| 24122 |
[UNSPEC_SIN |
| 24123 |
UNSPEC_COS]) |
| 24124 |
|
| 24125 |
(define_int_attr sincos |
| 24126 |
[(UNSPEC_SIN "sin") |
| 24127 |
(UNSPEC_COS "cos")]) |
| 24128 |
|
| 24129 |
(define_insn "<sincos>xf2" |
| 24130 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24131 |
(unspec:XF [(match_operand:XF 1 "register_operand" "0")] |
| 24132 |
SINCOS))] |
| 24133 |
"TARGET_USE_FANCY_MATH_387 |
| 24134 |
&& flag_unsafe_math_optimizations" |
| 24135 |
"f<sincos>" |
| 24136 |
[(set_attr "type" "fpspc") |
| 24137 |
(set_attr "znver1_decode" "vector") |
| 24138 |
(set_attr "c86_decode" "vector") |
| 24139 |
(set_attr "mode" "XF")]) |
| 24140 |
|
| 24141 |
(define_expand "<sincos><mode>2" |
| 24142 |
[(set (match_operand:MODEF 0 "register_operand") |
| 24143 |
(unspec:MODEF [(match_operand:MODEF 1 "general_operand")] |
| 24144 |
SINCOS))] |
| 24145 |
"TARGET_USE_FANCY_MATH_387 |
| 24146 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24147 |
|| TARGET_MIX_SSE_I387) |
| 24148 |
&& flag_unsafe_math_optimizations" |
| 24149 |
{ |
| 24150 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24151 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24152 |
|
| 24153 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24154 |
emit_insn (gen_<sincos>xf2 (op0, op1)); |
| 24155 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24156 |
DONE; |
| 24157 |
}) |
| 24158 |
|
| 24159 |
(define_insn "sincosxf3" |
| 24160 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24161 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0")] |
| 24162 |
UNSPEC_SINCOS_COS)) |
| 24163 |
(set (match_operand:XF 1 "register_operand" "=f") |
| 24164 |
(unspec:XF [(match_dup 2)] UNSPEC_SINCOS_SIN))] |
| 24165 |
"TARGET_USE_FANCY_MATH_387 |
| 24166 |
&& flag_unsafe_math_optimizations" |
| 24167 |
"fsincos" |
| 24168 |
[(set_attr "type" "fpspc") |
| 24169 |
(set_attr "znver1_decode" "vector") |
| 24170 |
(set_attr "c86_decode" "vector") |
| 24171 |
(set_attr "mode" "XF")]) |
| 24172 |
|
| 24173 |
(define_expand "sincos<mode>3" |
| 24174 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24175 |
(use (match_operand:MODEF 1 "register_operand")) |
| 24176 |
(use (match_operand:MODEF 2 "general_operand"))] |
| 24177 |
"TARGET_USE_FANCY_MATH_387 |
| 24178 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24179 |
|| TARGET_MIX_SSE_I387) |
| 24180 |
&& flag_unsafe_math_optimizations" |
| 24181 |
{ |
| 24182 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24183 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24184 |
rtx op2 = gen_reg_rtx (XFmode); |
| 24185 |
|
| 24186 |
emit_insn (gen_extend<mode>xf2 (op2, operands[2])); |
| 24187 |
emit_insn (gen_sincosxf3 (op0, op1, op2)); |
| 24188 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24189 |
emit_insn (gen_truncxf<mode>2 (operands[1], op1)); |
| 24190 |
DONE; |
| 24191 |
}) |
| 24192 |
|
| 24193 |
(define_insn "fptanxf4_i387" |
| 24194 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 24195 |
(match_operand:SF 3 "const1_operand")) |
| 24196 |
(set (match_operand:XF 1 "register_operand" "=f") |
| 24197 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0")] |
| 24198 |
UNSPEC_TAN))] |
| 24199 |
"TARGET_USE_FANCY_MATH_387 |
| 24200 |
&& flag_unsafe_math_optimizations" |
| 24201 |
"fptan" |
| 24202 |
[(set_attr "type" "fpspc") |
| 24203 |
(set_attr "znver1_decode" "vector") |
| 24204 |
(set_attr "c86_decode" "vector") |
| 24205 |
(set_attr "mode" "XF")]) |
| 24206 |
|
| 24207 |
(define_expand "tanxf2" |
| 24208 |
[(use (match_operand:XF 0 "register_operand")) |
| 24209 |
(use (match_operand:XF 1 "register_operand"))] |
| 24210 |
"TARGET_USE_FANCY_MATH_387 |
| 24211 |
&& flag_unsafe_math_optimizations" |
| 24212 |
{ |
| 24213 |
rtx one = gen_reg_rtx (SFmode); |
| 24214 |
emit_insn (gen_fptanxf4_i387 (one, operands[0], operands[1], |
| 24215 |
CONST1_RTX (SFmode))); |
| 24216 |
DONE; |
| 24217 |
}) |
| 24218 |
|
| 24219 |
(define_expand "tan<mode>2" |
| 24220 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24221 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24222 |
"TARGET_USE_FANCY_MATH_387 |
| 24223 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24224 |
|| TARGET_MIX_SSE_I387) |
| 24225 |
&& flag_unsafe_math_optimizations" |
| 24226 |
{ |
| 24227 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24228 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24229 |
|
| 24230 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24231 |
emit_insn (gen_tanxf2 (op0, op1)); |
| 24232 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24233 |
DONE; |
| 24234 |
}) |
| 24235 |
|
| 24236 |
(define_insn "atan2xf3" |
| 24237 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24238 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0") |
| 24239 |
(match_operand:XF 1 "register_operand" "f")] |
| 24240 |
UNSPEC_FPATAN)) |
| 24241 |
(clobber (match_scratch:XF 3 "=1"))] |
| 24242 |
"TARGET_USE_FANCY_MATH_387 |
| 24243 |
&& flag_unsafe_math_optimizations" |
| 24244 |
"fpatan" |
| 24245 |
[(set_attr "type" "fpspc") |
| 24246 |
(set_attr "znver1_decode" "vector") |
| 24247 |
(set_attr "c86_decode" "vector") |
| 24248 |
(set_attr "mode" "XF")]) |
| 24249 |
|
| 24250 |
(define_expand "atan2<mode>3" |
| 24251 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24252 |
(use (match_operand:MODEF 1 "general_operand")) |
| 24253 |
(use (match_operand:MODEF 2 "general_operand"))] |
| 24254 |
"TARGET_USE_FANCY_MATH_387 |
| 24255 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24256 |
|| TARGET_MIX_SSE_I387) |
| 24257 |
&& flag_unsafe_math_optimizations" |
| 24258 |
{ |
| 24259 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24260 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24261 |
rtx op2 = gen_reg_rtx (XFmode); |
| 24262 |
|
| 24263 |
emit_insn (gen_extend<mode>xf2 (op2, operands[2])); |
| 24264 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24265 |
|
| 24266 |
emit_insn (gen_atan2xf3 (op0, op1, op2)); |
| 24267 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24268 |
DONE; |
| 24269 |
}) |
| 24270 |
|
| 24271 |
(define_expand "atanxf2" |
| 24272 |
[(parallel [(set (match_operand:XF 0 "register_operand") |
| 24273 |
(unspec:XF [(match_dup 2) |
| 24274 |
(match_operand:XF 1 "register_operand")] |
| 24275 |
UNSPEC_FPATAN)) |
| 24276 |
(clobber (scratch:XF))])] |
| 24277 |
"TARGET_USE_FANCY_MATH_387 |
| 24278 |
&& flag_unsafe_math_optimizations" |
| 24279 |
"operands[2] = force_reg (XFmode, CONST1_RTX (XFmode));") |
| 24280 |
|
| 24281 |
(define_expand "atan<mode>2" |
| 24282 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24283 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24284 |
"TARGET_USE_FANCY_MATH_387 |
| 24285 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24286 |
|| TARGET_MIX_SSE_I387) |
| 24287 |
&& flag_unsafe_math_optimizations" |
| 24288 |
{ |
| 24289 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24290 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24291 |
|
| 24292 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24293 |
emit_insn (gen_atanxf2 (op0, op1)); |
| 24294 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24295 |
DONE; |
| 24296 |
}) |
| 24297 |
|
| 24298 |
(define_expand "asinxf2" |
| 24299 |
[(set (match_dup 2) |
| 24300 |
(mult:XF (match_operand:XF 1 "register_operand") |
| 24301 |
(match_dup 1))) |
| 24302 |
(set (match_dup 4) (minus:XF (match_dup 3) (match_dup 2))) |
| 24303 |
(set (match_dup 5) (sqrt:XF (match_dup 4))) |
| 24304 |
(parallel [(set (match_operand:XF 0 "register_operand") |
| 24305 |
(unspec:XF [(match_dup 5) (match_dup 1)] |
| 24306 |
UNSPEC_FPATAN)) |
| 24307 |
(clobber (scratch:XF))])] |
| 24308 |
"TARGET_USE_FANCY_MATH_387 |
| 24309 |
&& flag_unsafe_math_optimizations" |
| 24310 |
{ |
| 24311 |
int i; |
| 24312 |
|
| 24313 |
for (i = 2; i < 6; i++) |
| 24314 |
operands[i] = gen_reg_rtx (XFmode); |
| 24315 |
|
| 24316 |
emit_move_insn (operands[3], CONST1_RTX (XFmode)); |
| 24317 |
}) |
| 24318 |
|
| 24319 |
(define_expand "asin<mode>2" |
| 24320 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24321 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24322 |
"TARGET_USE_FANCY_MATH_387 |
| 24323 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24324 |
|| TARGET_MIX_SSE_I387) |
| 24325 |
&& flag_unsafe_math_optimizations" |
| 24326 |
{ |
| 24327 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24328 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24329 |
|
| 24330 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24331 |
emit_insn (gen_asinxf2 (op0, op1)); |
| 24332 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24333 |
DONE; |
| 24334 |
}) |
| 24335 |
|
| 24336 |
(define_expand "acosxf2" |
| 24337 |
[(set (match_dup 2) |
| 24338 |
(mult:XF (match_operand:XF 1 "register_operand") |
| 24339 |
(match_dup 1))) |
| 24340 |
(set (match_dup 4) (minus:XF (match_dup 3) (match_dup 2))) |
| 24341 |
(set (match_dup 5) (sqrt:XF (match_dup 4))) |
| 24342 |
(parallel [(set (match_operand:XF 0 "register_operand") |
| 24343 |
(unspec:XF [(match_dup 1) (match_dup 5)] |
| 24344 |
UNSPEC_FPATAN)) |
| 24345 |
(clobber (scratch:XF))])] |
| 24346 |
"TARGET_USE_FANCY_MATH_387 |
| 24347 |
&& flag_unsafe_math_optimizations" |
| 24348 |
{ |
| 24349 |
int i; |
| 24350 |
|
| 24351 |
for (i = 2; i < 6; i++) |
| 24352 |
operands[i] = gen_reg_rtx (XFmode); |
| 24353 |
|
| 24354 |
emit_move_insn (operands[3], CONST1_RTX (XFmode)); |
| 24355 |
}) |
| 24356 |
|
| 24357 |
(define_expand "acos<mode>2" |
| 24358 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24359 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24360 |
"TARGET_USE_FANCY_MATH_387 |
| 24361 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24362 |
|| TARGET_MIX_SSE_I387) |
| 24363 |
&& flag_unsafe_math_optimizations" |
| 24364 |
{ |
| 24365 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24366 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24367 |
|
| 24368 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24369 |
emit_insn (gen_acosxf2 (op0, op1)); |
| 24370 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24371 |
DONE; |
| 24372 |
}) |
| 24373 |
|
| 24374 |
(define_expand "sinhxf2" |
| 24375 |
[(use (match_operand:XF 0 "register_operand")) |
| 24376 |
(use (match_operand:XF 1 "register_operand"))] |
| 24377 |
"TARGET_USE_FANCY_MATH_387 |
| 24378 |
&& flag_finite_math_only |
| 24379 |
&& flag_unsafe_math_optimizations" |
| 24380 |
{ |
| 24381 |
ix86_emit_i387_sinh (operands[0], operands[1]); |
| 24382 |
DONE; |
| 24383 |
}) |
| 24384 |
|
| 24385 |
(define_expand "sinh<mode>2" |
| 24386 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24387 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24388 |
"TARGET_USE_FANCY_MATH_387 |
| 24389 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24390 |
|| TARGET_MIX_SSE_I387) |
| 24391 |
&& flag_finite_math_only |
| 24392 |
&& flag_unsafe_math_optimizations" |
| 24393 |
{ |
| 24394 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24395 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24396 |
|
| 24397 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24398 |
emit_insn (gen_sinhxf2 (op0, op1)); |
| 24399 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24400 |
DONE; |
| 24401 |
}) |
| 24402 |
|
| 24403 |
(define_expand "coshxf2" |
| 24404 |
[(use (match_operand:XF 0 "register_operand")) |
| 24405 |
(use (match_operand:XF 1 "register_operand"))] |
| 24406 |
"TARGET_USE_FANCY_MATH_387 |
| 24407 |
&& flag_unsafe_math_optimizations" |
| 24408 |
{ |
| 24409 |
ix86_emit_i387_cosh (operands[0], operands[1]); |
| 24410 |
DONE; |
| 24411 |
}) |
| 24412 |
|
| 24413 |
(define_expand "cosh<mode>2" |
| 24414 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24415 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24416 |
"TARGET_USE_FANCY_MATH_387 |
| 24417 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24418 |
|| TARGET_MIX_SSE_I387) |
| 24419 |
&& flag_unsafe_math_optimizations" |
| 24420 |
{ |
| 24421 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24422 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24423 |
|
| 24424 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24425 |
emit_insn (gen_coshxf2 (op0, op1)); |
| 24426 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24427 |
DONE; |
| 24428 |
}) |
| 24429 |
|
| 24430 |
(define_expand "tanhxf2" |
| 24431 |
[(use (match_operand:XF 0 "register_operand")) |
| 24432 |
(use (match_operand:XF 1 "register_operand"))] |
| 24433 |
"TARGET_USE_FANCY_MATH_387 |
| 24434 |
&& flag_unsafe_math_optimizations" |
| 24435 |
{ |
| 24436 |
ix86_emit_i387_tanh (operands[0], operands[1]); |
| 24437 |
DONE; |
| 24438 |
}) |
| 24439 |
|
| 24440 |
(define_expand "tanh<mode>2" |
| 24441 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24442 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24443 |
"TARGET_USE_FANCY_MATH_387 |
| 24444 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24445 |
|| TARGET_MIX_SSE_I387) |
| 24446 |
&& flag_unsafe_math_optimizations" |
| 24447 |
{ |
| 24448 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24449 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24450 |
|
| 24451 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24452 |
emit_insn (gen_tanhxf2 (op0, op1)); |
| 24453 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24454 |
DONE; |
| 24455 |
}) |
| 24456 |
|
| 24457 |
(define_expand "asinhxf2" |
| 24458 |
[(use (match_operand:XF 0 "register_operand")) |
| 24459 |
(use (match_operand:XF 1 "register_operand"))] |
| 24460 |
"TARGET_USE_FANCY_MATH_387 |
| 24461 |
&& flag_finite_math_only |
| 24462 |
&& flag_unsafe_math_optimizations" |
| 24463 |
{ |
| 24464 |
ix86_emit_i387_asinh (operands[0], operands[1]); |
| 24465 |
DONE; |
| 24466 |
}) |
| 24467 |
|
| 24468 |
(define_expand "asinh<mode>2" |
| 24469 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24470 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24471 |
"TARGET_USE_FANCY_MATH_387 |
| 24472 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24473 |
|| TARGET_MIX_SSE_I387) |
| 24474 |
&& flag_finite_math_only |
| 24475 |
&& flag_unsafe_math_optimizations" |
| 24476 |
{ |
| 24477 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24478 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24479 |
|
| 24480 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24481 |
emit_insn (gen_asinhxf2 (op0, op1)); |
| 24482 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24483 |
DONE; |
| 24484 |
}) |
| 24485 |
|
| 24486 |
(define_expand "acoshxf2" |
| 24487 |
[(use (match_operand:XF 0 "register_operand")) |
| 24488 |
(use (match_operand:XF 1 "register_operand"))] |
| 24489 |
"TARGET_USE_FANCY_MATH_387 |
| 24490 |
&& flag_unsafe_math_optimizations" |
| 24491 |
{ |
| 24492 |
ix86_emit_i387_acosh (operands[0], operands[1]); |
| 24493 |
DONE; |
| 24494 |
}) |
| 24495 |
|
| 24496 |
(define_expand "acosh<mode>2" |
| 24497 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24498 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24499 |
"TARGET_USE_FANCY_MATH_387 |
| 24500 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24501 |
|| TARGET_MIX_SSE_I387) |
| 24502 |
&& flag_unsafe_math_optimizations" |
| 24503 |
{ |
| 24504 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24505 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24506 |
|
| 24507 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24508 |
emit_insn (gen_acoshxf2 (op0, op1)); |
| 24509 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24510 |
DONE; |
| 24511 |
}) |
| 24512 |
|
| 24513 |
(define_expand "atanhxf2" |
| 24514 |
[(use (match_operand:XF 0 "register_operand")) |
| 24515 |
(use (match_operand:XF 1 "register_operand"))] |
| 24516 |
"TARGET_USE_FANCY_MATH_387 |
| 24517 |
&& flag_unsafe_math_optimizations" |
| 24518 |
{ |
| 24519 |
ix86_emit_i387_atanh (operands[0], operands[1]); |
| 24520 |
DONE; |
| 24521 |
}) |
| 24522 |
|
| 24523 |
(define_expand "atanh<mode>2" |
| 24524 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24525 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24526 |
"TARGET_USE_FANCY_MATH_387 |
| 24527 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24528 |
|| TARGET_MIX_SSE_I387) |
| 24529 |
&& flag_unsafe_math_optimizations" |
| 24530 |
{ |
| 24531 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24532 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24533 |
|
| 24534 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24535 |
emit_insn (gen_atanhxf2 (op0, op1)); |
| 24536 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24537 |
DONE; |
| 24538 |
}) |
| 24539 |
|
| 24540 |
(define_insn "fyl2xxf3_i387" |
| 24541 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24542 |
(unspec:XF [(match_operand:XF 1 "register_operand" "0") |
| 24543 |
(match_operand:XF 2 "register_operand" "f")] |
| 24544 |
UNSPEC_FYL2X)) |
| 24545 |
(clobber (match_scratch:XF 3 "=2"))] |
| 24546 |
"TARGET_USE_FANCY_MATH_387 |
| 24547 |
&& flag_unsafe_math_optimizations" |
| 24548 |
"fyl2x" |
| 24549 |
[(set_attr "type" "fpspc") |
| 24550 |
(set_attr "znver1_decode" "vector") |
| 24551 |
(set_attr "c86_decode" "vector") |
| 24552 |
(set_attr "mode" "XF")]) |
| 24553 |
|
| 24554 |
(define_expand "logxf2" |
| 24555 |
[(parallel [(set (match_operand:XF 0 "register_operand") |
| 24556 |
(unspec:XF [(match_operand:XF 1 "register_operand") |
| 24557 |
(match_dup 2)] UNSPEC_FYL2X)) |
| 24558 |
(clobber (scratch:XF))])] |
| 24559 |
"TARGET_USE_FANCY_MATH_387 |
| 24560 |
&& flag_unsafe_math_optimizations" |
| 24561 |
{ |
| 24562 |
operands[2] |
| 24563 |
= force_reg (XFmode, standard_80387_constant_rtx (4)); /* fldln2 */ |
| 24564 |
}) |
| 24565 |
|
| 24566 |
(define_expand "log<mode>2" |
| 24567 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24568 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24569 |
"TARGET_USE_FANCY_MATH_387 |
| 24570 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24571 |
|| TARGET_MIX_SSE_I387) |
| 24572 |
&& flag_unsafe_math_optimizations" |
| 24573 |
{ |
| 24574 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24575 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24576 |
|
| 24577 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24578 |
emit_insn (gen_logxf2 (op0, op1)); |
| 24579 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24580 |
DONE; |
| 24581 |
}) |
| 24582 |
|
| 24583 |
(define_expand "log10xf2" |
| 24584 |
[(parallel [(set (match_operand:XF 0 "register_operand") |
| 24585 |
(unspec:XF [(match_operand:XF 1 "register_operand") |
| 24586 |
(match_dup 2)] UNSPEC_FYL2X)) |
| 24587 |
(clobber (scratch:XF))])] |
| 24588 |
"TARGET_USE_FANCY_MATH_387 |
| 24589 |
&& flag_unsafe_math_optimizations" |
| 24590 |
{ |
| 24591 |
operands[2] |
| 24592 |
= force_reg (XFmode, standard_80387_constant_rtx (3)); /* fldlg2 */ |
| 24593 |
}) |
| 24594 |
|
| 24595 |
(define_expand "log10<mode>2" |
| 24596 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24597 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24598 |
"TARGET_USE_FANCY_MATH_387 |
| 24599 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24600 |
|| TARGET_MIX_SSE_I387) |
| 24601 |
&& flag_unsafe_math_optimizations" |
| 24602 |
{ |
| 24603 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24604 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24605 |
|
| 24606 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24607 |
emit_insn (gen_log10xf2 (op0, op1)); |
| 24608 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24609 |
DONE; |
| 24610 |
}) |
| 24611 |
|
| 24612 |
(define_expand "log2xf2" |
| 24613 |
[(parallel [(set (match_operand:XF 0 "register_operand") |
| 24614 |
(unspec:XF [(match_operand:XF 1 "register_operand") |
| 24615 |
(match_dup 2)] UNSPEC_FYL2X)) |
| 24616 |
(clobber (scratch:XF))])] |
| 24617 |
"TARGET_USE_FANCY_MATH_387 |
| 24618 |
&& flag_unsafe_math_optimizations" |
| 24619 |
"operands[2] = force_reg (XFmode, CONST1_RTX (XFmode));") |
| 24620 |
|
| 24621 |
(define_expand "log2<mode>2" |
| 24622 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24623 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24624 |
"TARGET_USE_FANCY_MATH_387 |
| 24625 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24626 |
|| TARGET_MIX_SSE_I387) |
| 24627 |
&& flag_unsafe_math_optimizations" |
| 24628 |
{ |
| 24629 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24630 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24631 |
|
| 24632 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24633 |
emit_insn (gen_log2xf2 (op0, op1)); |
| 24634 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24635 |
DONE; |
| 24636 |
}) |
| 24637 |
|
| 24638 |
(define_insn "fyl2xp1xf3_i387" |
| 24639 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24640 |
(unspec:XF [(match_operand:XF 1 "register_operand" "0") |
| 24641 |
(match_operand:XF 2 "register_operand" "f")] |
| 24642 |
UNSPEC_FYL2XP1)) |
| 24643 |
(clobber (match_scratch:XF 3 "=2"))] |
| 24644 |
"TARGET_USE_FANCY_MATH_387 |
| 24645 |
&& flag_unsafe_math_optimizations" |
| 24646 |
"fyl2xp1" |
| 24647 |
[(set_attr "type" "fpspc") |
| 24648 |
(set_attr "znver1_decode" "vector") |
| 24649 |
(set_attr "c86_decode" "vector") |
| 24650 |
(set_attr "mode" "XF")]) |
| 24651 |
|
| 24652 |
(define_expand "log1pxf2" |
| 24653 |
[(use (match_operand:XF 0 "register_operand")) |
| 24654 |
(use (match_operand:XF 1 "register_operand"))] |
| 24655 |
"TARGET_USE_FANCY_MATH_387 |
| 24656 |
&& flag_unsafe_math_optimizations" |
| 24657 |
{ |
| 24658 |
ix86_emit_i387_log1p (operands[0], operands[1]); |
| 24659 |
DONE; |
| 24660 |
}) |
| 24661 |
|
| 24662 |
(define_expand "log1p<mode>2" |
| 24663 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24664 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24665 |
"TARGET_USE_FANCY_MATH_387 |
| 24666 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24667 |
|| TARGET_MIX_SSE_I387) |
| 24668 |
&& flag_unsafe_math_optimizations" |
| 24669 |
{ |
| 24670 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24671 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24672 |
|
| 24673 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24674 |
emit_insn (gen_log1pxf2 (op0, op1)); |
| 24675 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24676 |
DONE; |
| 24677 |
}) |
| 24678 |
|
| 24679 |
(define_insn "fxtractxf3_i387" |
| 24680 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24681 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0")] |
| 24682 |
UNSPEC_XTRACT_FRACT)) |
| 24683 |
(set (match_operand:XF 1 "register_operand" "=f") |
| 24684 |
(unspec:XF [(match_dup 2)] UNSPEC_XTRACT_EXP))] |
| 24685 |
"TARGET_USE_FANCY_MATH_387 |
| 24686 |
&& flag_unsafe_math_optimizations" |
| 24687 |
"fxtract" |
| 24688 |
[(set_attr "type" "fpspc") |
| 24689 |
(set_attr "znver1_decode" "vector") |
| 24690 |
(set_attr "c86_decode" "vector") |
| 24691 |
(set_attr "mode" "XF")]) |
| 24692 |
|
| 24693 |
(define_expand "logbxf2" |
| 24694 |
[(parallel [(set (match_dup 2) |
| 24695 |
(unspec:XF [(match_operand:XF 1 "register_operand")] |
| 24696 |
UNSPEC_XTRACT_FRACT)) |
| 24697 |
(set (match_operand:XF 0 "register_operand") |
| 24698 |
(unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])] |
| 24699 |
"TARGET_USE_FANCY_MATH_387 |
| 24700 |
&& flag_unsafe_math_optimizations" |
| 24701 |
"operands[2] = gen_reg_rtx (XFmode);") |
| 24702 |
|
| 24703 |
(define_expand "logb<mode>2" |
| 24704 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24705 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24706 |
"TARGET_USE_FANCY_MATH_387 |
| 24707 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24708 |
|| TARGET_MIX_SSE_I387) |
| 24709 |
&& flag_unsafe_math_optimizations" |
| 24710 |
{ |
| 24711 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24712 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24713 |
|
| 24714 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24715 |
emit_insn (gen_logbxf2 (op0, op1)); |
| 24716 |
emit_insn (gen_truncxf<mode>2 (operands[0], op1)); |
| 24717 |
DONE; |
| 24718 |
}) |
| 24719 |
|
| 24720 |
(define_expand "ilogbxf2" |
| 24721 |
[(use (match_operand:SI 0 "register_operand")) |
| 24722 |
(use (match_operand:XF 1 "register_operand"))] |
| 24723 |
"TARGET_USE_FANCY_MATH_387 |
| 24724 |
&& flag_unsafe_math_optimizations" |
| 24725 |
{ |
| 24726 |
rtx op0, op1; |
| 24727 |
|
| 24728 |
if (optimize_insn_for_size_p ()) |
| 24729 |
FAIL; |
| 24730 |
|
| 24731 |
op0 = gen_reg_rtx (XFmode); |
| 24732 |
op1 = gen_reg_rtx (XFmode); |
| 24733 |
|
| 24734 |
emit_insn (gen_fxtractxf3_i387 (op0, op1, operands[1])); |
| 24735 |
emit_insn (gen_fix_truncxfsi2 (operands[0], op1)); |
| 24736 |
DONE; |
| 24737 |
}) |
| 24738 |
|
| 24739 |
(define_expand "ilogb<mode>2" |
| 24740 |
[(use (match_operand:SI 0 "register_operand")) |
| 24741 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24742 |
"TARGET_USE_FANCY_MATH_387 |
| 24743 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24744 |
|| TARGET_MIX_SSE_I387) |
| 24745 |
&& flag_unsafe_math_optimizations" |
| 24746 |
{ |
| 24747 |
rtx op0, op1, op2; |
| 24748 |
|
| 24749 |
if (optimize_insn_for_size_p ()) |
| 24750 |
FAIL; |
| 24751 |
|
| 24752 |
op0 = gen_reg_rtx (XFmode); |
| 24753 |
op1 = gen_reg_rtx (XFmode); |
| 24754 |
op2 = gen_reg_rtx (XFmode); |
| 24755 |
|
| 24756 |
emit_insn (gen_extend<mode>xf2 (op2, operands[1])); |
| 24757 |
emit_insn (gen_fxtractxf3_i387 (op0, op1, op2)); |
| 24758 |
emit_insn (gen_fix_truncxfsi2 (operands[0], op1)); |
| 24759 |
DONE; |
| 24760 |
}) |
| 24761 |
|
| 24762 |
(define_insn "*f2xm1xf2_i387" |
| 24763 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24764 |
(unspec:XF [(match_operand:XF 1 "register_operand" "0")] |
| 24765 |
UNSPEC_F2XM1))] |
| 24766 |
"TARGET_USE_FANCY_MATH_387 |
| 24767 |
&& flag_unsafe_math_optimizations" |
| 24768 |
"f2xm1" |
| 24769 |
[(set_attr "type" "fpspc") |
| 24770 |
(set_attr "znver1_decode" "vector") |
| 24771 |
(set_attr "c86_decode" "vector") |
| 24772 |
(set_attr "mode" "XF")]) |
| 24773 |
|
| 24774 |
(define_insn "fscalexf4_i387" |
| 24775 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 24776 |
(unspec:XF [(match_operand:XF 2 "register_operand" "0") |
| 24777 |
(match_operand:XF 3 "register_operand" "1")] |
| 24778 |
UNSPEC_FSCALE_FRACT)) |
| 24779 |
(set (match_operand:XF 1 "register_operand" "=f") |
| 24780 |
(unspec:XF [(match_dup 2) (match_dup 3)] |
| 24781 |
UNSPEC_FSCALE_EXP))] |
| 24782 |
"TARGET_USE_FANCY_MATH_387 |
| 24783 |
&& flag_unsafe_math_optimizations" |
| 24784 |
"fscale" |
| 24785 |
[(set_attr "type" "fpspc") |
| 24786 |
(set_attr "znver1_decode" "vector") |
| 24787 |
(set_attr "c86_decode" "vector") |
| 24788 |
(set_attr "mode" "XF")]) |
| 24789 |
|
| 24790 |
(define_expand "expNcorexf3" |
| 24791 |
[(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand") |
| 24792 |
(match_operand:XF 2 "register_operand"))) |
| 24793 |
(set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT)) |
| 24794 |
(set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4))) |
| 24795 |
(set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1)) |
| 24796 |
(set (match_dup 8) (plus:XF (match_dup 6) (match_dup 7))) |
| 24797 |
(parallel [(set (match_operand:XF 0 "register_operand") |
| 24798 |
(unspec:XF [(match_dup 8) (match_dup 4)] |
| 24799 |
UNSPEC_FSCALE_FRACT)) |
| 24800 |
(set (match_dup 9) |
| 24801 |
(unspec:XF [(match_dup 8) (match_dup 4)] |
| 24802 |
UNSPEC_FSCALE_EXP))])] |
| 24803 |
"TARGET_USE_FANCY_MATH_387 |
| 24804 |
&& flag_unsafe_math_optimizations" |
| 24805 |
{ |
| 24806 |
int i; |
| 24807 |
|
| 24808 |
for (i = 3; i < 10; i++) |
| 24809 |
operands[i] = gen_reg_rtx (XFmode); |
| 24810 |
|
| 24811 |
emit_move_insn (operands[7], CONST1_RTX (XFmode)); |
| 24812 |
}) |
| 24813 |
|
| 24814 |
(define_expand "expxf2" |
| 24815 |
[(use (match_operand:XF 0 "register_operand")) |
| 24816 |
(use (match_operand:XF 1 "register_operand"))] |
| 24817 |
"TARGET_USE_FANCY_MATH_387 |
| 24818 |
&& flag_unsafe_math_optimizations" |
| 24819 |
{ |
| 24820 |
rtx op2 = force_reg (XFmode, standard_80387_constant_rtx (5)); /* fldl2e */ |
| 24821 |
|
| 24822 |
emit_insn (gen_expNcorexf3 (operands[0], operands[1], op2)); |
| 24823 |
DONE; |
| 24824 |
}) |
| 24825 |
|
| 24826 |
(define_expand "exp<mode>2" |
| 24827 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24828 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24829 |
"TARGET_USE_FANCY_MATH_387 |
| 24830 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24831 |
|| TARGET_MIX_SSE_I387) |
| 24832 |
&& flag_unsafe_math_optimizations" |
| 24833 |
{ |
| 24834 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24835 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24836 |
|
| 24837 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24838 |
emit_insn (gen_expxf2 (op0, op1)); |
| 24839 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24840 |
DONE; |
| 24841 |
}) |
| 24842 |
|
| 24843 |
(define_expand "exp10xf2" |
| 24844 |
[(use (match_operand:XF 0 "register_operand")) |
| 24845 |
(use (match_operand:XF 1 "register_operand"))] |
| 24846 |
"TARGET_USE_FANCY_MATH_387 |
| 24847 |
&& flag_unsafe_math_optimizations" |
| 24848 |
{ |
| 24849 |
rtx op2 = force_reg (XFmode, standard_80387_constant_rtx (6)); /* fldl2t */ |
| 24850 |
|
| 24851 |
emit_insn (gen_expNcorexf3 (operands[0], operands[1], op2)); |
| 24852 |
DONE; |
| 24853 |
}) |
| 24854 |
|
| 24855 |
(define_expand "exp10<mode>2" |
| 24856 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24857 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24858 |
"TARGET_USE_FANCY_MATH_387 |
| 24859 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24860 |
|| TARGET_MIX_SSE_I387) |
| 24861 |
&& flag_unsafe_math_optimizations" |
| 24862 |
{ |
| 24863 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24864 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24865 |
|
| 24866 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24867 |
emit_insn (gen_exp10xf2 (op0, op1)); |
| 24868 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24869 |
DONE; |
| 24870 |
}) |
| 24871 |
|
| 24872 |
(define_expand "exp2xf2" |
| 24873 |
[(use (match_operand:XF 0 "register_operand")) |
| 24874 |
(use (match_operand:XF 1 "register_operand"))] |
| 24875 |
"TARGET_USE_FANCY_MATH_387 |
| 24876 |
&& flag_unsafe_math_optimizations" |
| 24877 |
{ |
| 24878 |
rtx op2 = force_reg (XFmode, CONST1_RTX (XFmode)); |
| 24879 |
|
| 24880 |
emit_insn (gen_expNcorexf3 (operands[0], operands[1], op2)); |
| 24881 |
DONE; |
| 24882 |
}) |
| 24883 |
|
| 24884 |
(define_expand "exp2<mode>2" |
| 24885 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24886 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24887 |
"TARGET_USE_FANCY_MATH_387 |
| 24888 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24889 |
|| TARGET_MIX_SSE_I387) |
| 24890 |
&& flag_unsafe_math_optimizations" |
| 24891 |
{ |
| 24892 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24893 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24894 |
|
| 24895 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24896 |
emit_insn (gen_exp2xf2 (op0, op1)); |
| 24897 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24898 |
DONE; |
| 24899 |
}) |
| 24900 |
|
| 24901 |
(define_expand "expm1xf2" |
| 24902 |
[(set (match_dup 3) (mult:XF (match_operand:XF 1 "register_operand") |
| 24903 |
(match_dup 2))) |
| 24904 |
(set (match_dup 4) (unspec:XF [(match_dup 3)] UNSPEC_FRNDINT)) |
| 24905 |
(set (match_dup 5) (minus:XF (match_dup 3) (match_dup 4))) |
| 24906 |
(set (match_dup 6) (unspec:XF [(match_dup 5)] UNSPEC_F2XM1)) |
| 24907 |
(parallel [(set (match_dup 7) |
| 24908 |
(unspec:XF [(match_dup 6) (match_dup 4)] |
| 24909 |
UNSPEC_FSCALE_FRACT)) |
| 24910 |
(set (match_dup 8) |
| 24911 |
(unspec:XF [(match_dup 6) (match_dup 4)] |
| 24912 |
UNSPEC_FSCALE_EXP))]) |
| 24913 |
(parallel [(set (match_dup 10) |
| 24914 |
(unspec:XF [(match_dup 9) (match_dup 8)] |
| 24915 |
UNSPEC_FSCALE_FRACT)) |
| 24916 |
(set (match_dup 11) |
| 24917 |
(unspec:XF [(match_dup 9) (match_dup 8)] |
| 24918 |
UNSPEC_FSCALE_EXP))]) |
| 24919 |
(set (match_dup 12) (minus:XF (match_dup 10) (match_dup 9))) |
| 24920 |
(set (match_operand:XF 0 "register_operand") |
| 24921 |
(plus:XF (match_dup 12) (match_dup 7)))] |
| 24922 |
"TARGET_USE_FANCY_MATH_387 |
| 24923 |
&& flag_unsafe_math_optimizations" |
| 24924 |
{ |
| 24925 |
int i; |
| 24926 |
|
| 24927 |
for (i = 2; i < 13; i++) |
| 24928 |
operands[i] = gen_reg_rtx (XFmode); |
| 24929 |
|
| 24930 |
emit_move_insn (operands[2], standard_80387_constant_rtx (5)); /* fldl2e */ |
| 24931 |
emit_move_insn (operands[9], CONST1_RTX (XFmode)); |
| 24932 |
}) |
| 24933 |
|
| 24934 |
(define_expand "expm1<mode>2" |
| 24935 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24936 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 24937 |
"TARGET_USE_FANCY_MATH_387 |
| 24938 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24939 |
|| TARGET_MIX_SSE_I387) |
| 24940 |
&& flag_unsafe_math_optimizations" |
| 24941 |
{ |
| 24942 |
rtx op0 = gen_reg_rtx (XFmode); |
| 24943 |
rtx op1 = gen_reg_rtx (XFmode); |
| 24944 |
|
| 24945 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 24946 |
emit_insn (gen_expm1xf2 (op0, op1)); |
| 24947 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 24948 |
DONE; |
| 24949 |
}) |
| 24950 |
|
| 24951 |
(define_insn "avx512f_scalef<mode>2" |
| 24952 |
[(set (match_operand:MODEF 0 "register_operand" "=v") |
| 24953 |
(unspec:MODEF |
| 24954 |
[(match_operand:MODEF 1 "register_operand" "v") |
| 24955 |
(match_operand:MODEF 2 "nonimmediate_operand" "vm")] |
| 24956 |
UNSPEC_SCALEF))] |
| 24957 |
"TARGET_AVX512F" |
| 24958 |
"vscalef<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}" |
| 24959 |
[(set_attr "prefix" "evex") |
| 24960 |
(set_attr "mode" "<MODE>")]) |
| 24961 |
|
| 24962 |
(define_expand "ldexpxf3" |
| 24963 |
[(match_operand:XF 0 "register_operand") |
| 24964 |
(match_operand:XF 1 "register_operand") |
| 24965 |
(match_operand:SI 2 "register_operand")] |
| 24966 |
"TARGET_USE_FANCY_MATH_387 |
| 24967 |
&& flag_unsafe_math_optimizations" |
| 24968 |
{ |
| 24969 |
rtx tmp1 = gen_reg_rtx (XFmode); |
| 24970 |
rtx tmp2 = gen_reg_rtx (XFmode); |
| 24971 |
|
| 24972 |
emit_insn (gen_floatsixf2 (tmp1, operands[2])); |
| 24973 |
emit_insn (gen_fscalexf4_i387 (operands[0], tmp2, |
| 24974 |
operands[1], tmp1)); |
| 24975 |
DONE; |
| 24976 |
}) |
| 24977 |
|
| 24978 |
(define_expand "ldexp<mode>3" |
| 24979 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 24980 |
(use (match_operand:MODEF 1 "general_operand")) |
| 24981 |
(use (match_operand:SI 2 "register_operand"))] |
| 24982 |
"((TARGET_USE_FANCY_MATH_387 |
| 24983 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 24984 |
|| TARGET_MIX_SSE_I387)) |
| 24985 |
|| (TARGET_AVX512F && TARGET_SSE_MATH)) |
| 24986 |
&& flag_unsafe_math_optimizations" |
| 24987 |
{ |
| 24988 |
/* Prefer avx512f version. */ |
| 24989 |
if (TARGET_AVX512F && TARGET_SSE_MATH) |
| 24990 |
{ |
| 24991 |
rtx op2 = gen_reg_rtx (<MODE>mode); |
| 24992 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 24993 |
|
| 24994 |
emit_insn (gen_floatsi<mode>2 (op2, operands[2])); |
| 24995 |
emit_insn (gen_avx512f_scalef<mode>2 (operands[0], operands[1], op2)); |
| 24996 |
} |
| 24997 |
else |
| 24998 |
{ |
| 24999 |
rtx op0 = gen_reg_rtx (XFmode); |
| 25000 |
rtx op1 = gen_reg_rtx (XFmode); |
| 25001 |
|
| 25002 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 25003 |
emit_insn (gen_ldexpxf3 (op0, op1, operands[2])); |
| 25004 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 25005 |
} |
| 25006 |
DONE; |
| 25007 |
}) |
| 25008 |
|
| 25009 |
(define_expand "scalbxf3" |
| 25010 |
[(parallel [(set (match_operand:XF 0 " register_operand") |
| 25011 |
(unspec:XF [(match_operand:XF 1 "register_operand") |
| 25012 |
(match_operand:XF 2 "register_operand")] |
| 25013 |
UNSPEC_FSCALE_FRACT)) |
| 25014 |
(set (match_dup 3) |
| 25015 |
(unspec:XF [(match_dup 1) (match_dup 2)] |
| 25016 |
UNSPEC_FSCALE_EXP))])] |
| 25017 |
"TARGET_USE_FANCY_MATH_387 |
| 25018 |
&& flag_unsafe_math_optimizations" |
| 25019 |
"operands[3] = gen_reg_rtx (XFmode);") |
| 25020 |
|
| 25021 |
(define_expand "scalb<mode>3" |
| 25022 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 25023 |
(use (match_operand:MODEF 1 "general_operand")) |
| 25024 |
(use (match_operand:MODEF 2 "general_operand"))] |
| 25025 |
"TARGET_USE_FANCY_MATH_387 |
| 25026 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 25027 |
|| TARGET_MIX_SSE_I387) |
| 25028 |
&& flag_unsafe_math_optimizations" |
| 25029 |
{ |
| 25030 |
rtx op0 = gen_reg_rtx (XFmode); |
| 25031 |
rtx op1 = gen_reg_rtx (XFmode); |
| 25032 |
rtx op2 = gen_reg_rtx (XFmode); |
| 25033 |
|
| 25034 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 25035 |
emit_insn (gen_extend<mode>xf2 (op2, operands[2])); |
| 25036 |
emit_insn (gen_scalbxf3 (op0, op1, op2)); |
| 25037 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 25038 |
DONE; |
| 25039 |
}) |
| 25040 |
|
| 25041 |
(define_expand "significandxf2" |
| 25042 |
[(parallel [(set (match_operand:XF 0 "register_operand") |
| 25043 |
(unspec:XF [(match_operand:XF 1 "register_operand")] |
| 25044 |
UNSPEC_XTRACT_FRACT)) |
| 25045 |
(set (match_dup 2) |
| 25046 |
(unspec:XF [(match_dup 1)] UNSPEC_XTRACT_EXP))])] |
| 25047 |
"TARGET_USE_FANCY_MATH_387 |
| 25048 |
&& flag_unsafe_math_optimizations" |
| 25049 |
"operands[2] = gen_reg_rtx (XFmode);") |
| 25050 |
|
| 25051 |
(define_expand "significand<mode>2" |
| 25052 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 25053 |
(use (match_operand:MODEF 1 "general_operand"))] |
| 25054 |
"TARGET_USE_FANCY_MATH_387 |
| 25055 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 25056 |
|| TARGET_MIX_SSE_I387) |
| 25057 |
&& flag_unsafe_math_optimizations" |
| 25058 |
{ |
| 25059 |
rtx op0 = gen_reg_rtx (XFmode); |
| 25060 |
rtx op1 = gen_reg_rtx (XFmode); |
| 25061 |
|
| 25062 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 25063 |
emit_insn (gen_significandxf2 (op0, op1)); |
| 25064 |
emit_insn (gen_truncxf<mode>2 (operands[0], op0)); |
| 25065 |
DONE; |
| 25066 |
}) |
| 25067 |
|
| 25068 |
|
| 25069 |
(define_insn "sse4_1_round<mode>2" |
| 25070 |
[(set (match_operand:MODEFH 0 "register_operand" "=x,x,x,v,v") |
| 25071 |
(unspec:MODEFH |
| 25072 |
[(match_operand:MODEFH 1 "nonimmediate_operand" "0,x,jm,v,m") |
| 25073 |
(match_operand:SI 2 "const_0_to_15_operand")] |
| 25074 |
UNSPEC_ROUND))] |
| 25075 |
"TARGET_SSE4_1" |
| 25076 |
"@ |
| 25077 |
%vround<ssemodesuffix>\t{%2, %d1, %0|%0, %d1, %2} |
| 25078 |
%vround<ssemodesuffix>\t{%2, %d1, %0|%0, %d1, %2} |
| 25079 |
%vround<ssemodesuffix>\t{%2, %1, %d0|%d0, %1, %2} |
| 25080 |
vrndscale<ssemodesuffix>\t{%2, %d1, %0|%0, %d1, %2} |
| 25081 |
vrndscale<ssemodesuffix>\t{%2, %1, %d0|%d0, %1, %2}" |
| 25082 |
[(set_attr "type" "ssecvt") |
| 25083 |
(set_attr "prefix_extra" "1,1,1,*,*") |
| 25084 |
(set_attr "length_immediate" "1") |
| 25085 |
(set_attr "addr" "*,*,gpr16,*,*") |
| 25086 |
(set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,evex,evex") |
| 25087 |
(set_attr "isa" "noavx512f,noavx512f,noavx512f,avx512f,avx512f") |
| 25088 |
(set_attr "avx_partial_xmm_update" "false,false,true,false,true") |
| 25089 |
(set_attr "mode" "<MODE>") |
| 25090 |
(set (attr "preferred_for_speed") |
| 25091 |
(cond [(match_test "TARGET_AVX") |
| 25092 |
(symbol_ref "true") |
| 25093 |
(eq_attr "alternative" "1,2") |
| 25094 |
(symbol_ref "!TARGET_SSE_PARTIAL_REG_DEPENDENCY") |
| 25095 |
] |
| 25096 |
(symbol_ref "true")))]) |
| 25097 |
|
| 25098 |
(define_insn "rintxf2" |
| 25099 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 25100 |
(unspec:XF [(match_operand:XF 1 "register_operand" "0")] |
| 25101 |
UNSPEC_FRNDINT))] |
| 25102 |
"TARGET_USE_FANCY_MATH_387" |
| 25103 |
"frndint" |
| 25104 |
[(set_attr "type" "fpspc") |
| 25105 |
(set_attr "znver1_decode" "vector") |
| 25106 |
(set_attr "c86_decode" "vector") |
| 25107 |
(set_attr "mode" "XF")]) |
| 25108 |
|
| 25109 |
(define_expand "rinthf2" |
| 25110 |
[(match_operand:HF 0 "register_operand") |
| 25111 |
(match_operand:HF 1 "nonimmediate_operand")] |
| 25112 |
"TARGET_AVX512FP16" |
| 25113 |
{ |
| 25114 |
emit_insn (gen_sse4_1_roundhf2 (operands[0], |
| 25115 |
operands[1], |
| 25116 |
GEN_INT (ROUND_MXCSR))); |
| 25117 |
DONE; |
| 25118 |
}) |
| 25119 |
|
| 25120 |
(define_expand "rint<mode>2" |
| 25121 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 25122 |
(use (match_operand:MODEF 1 "nonimmediate_operand"))] |
| 25123 |
"TARGET_USE_FANCY_MATH_387 |
| 25124 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 25125 |
{ |
| 25126 |
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 25127 |
{ |
| 25128 |
if (TARGET_SSE4_1) |
| 25129 |
emit_insn (gen_sse4_1_round<mode>2 |
| 25130 |
(operands[0], operands[1], GEN_INT (ROUND_MXCSR))); |
| 25131 |
else |
| 25132 |
ix86_expand_rint (operands[0], operands[1]); |
| 25133 |
} |
| 25134 |
else |
| 25135 |
{ |
| 25136 |
rtx op0 = gen_reg_rtx (XFmode); |
| 25137 |
rtx op1 = gen_reg_rtx (XFmode); |
| 25138 |
|
| 25139 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 25140 |
emit_insn (gen_rintxf2 (op0, op1)); |
| 25141 |
emit_insn (gen_truncxf<mode>2_i387_noop_unspec (operands[0], op0)); |
| 25142 |
} |
| 25143 |
DONE; |
| 25144 |
}) |
| 25145 |
|
| 25146 |
(define_expand "nearbyintxf2" |
| 25147 |
[(set (match_operand:XF 0 "register_operand") |
| 25148 |
(unspec:XF [(match_operand:XF 1 "register_operand")] |
| 25149 |
UNSPEC_FRNDINT))] |
| 25150 |
"TARGET_USE_FANCY_MATH_387 |
| 25151 |
&& !flag_trapping_math") |
| 25152 |
|
| 25153 |
(define_expand "nearbyinthf2" |
| 25154 |
[(match_operand:HF 0 "register_operand") |
| 25155 |
(match_operand:HF 1 "nonimmediate_operand")] |
| 25156 |
"TARGET_AVX512FP16" |
| 25157 |
{ |
| 25158 |
emit_insn (gen_sse4_1_roundhf2 (operands[0], |
| 25159 |
operands[1], |
| 25160 |
GEN_INT (ROUND_MXCSR | ROUND_NO_EXC))); |
| 25161 |
DONE; |
| 25162 |
}) |
| 25163 |
|
| 25164 |
(define_expand "nearbyint<mode>2" |
| 25165 |
[(use (match_operand:MODEF 0 "register_operand")) |
| 25166 |
(use (match_operand:MODEF 1 "nonimmediate_operand"))] |
| 25167 |
"(TARGET_USE_FANCY_MATH_387 |
| 25168 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 25169 |
|| TARGET_MIX_SSE_I387) |
| 25170 |
&& !flag_trapping_math) |
| 25171 |
|| (TARGET_SSE4_1 && TARGET_SSE_MATH)" |
| 25172 |
{ |
| 25173 |
if (TARGET_SSE4_1 && TARGET_SSE_MATH) |
| 25174 |
emit_insn (gen_sse4_1_round<mode>2 |
| 25175 |
(operands[0], operands[1], GEN_INT (ROUND_MXCSR |
| 25176 |
| ROUND_NO_EXC))); |
| 25177 |
else |
| 25178 |
{ |
| 25179 |
rtx op0 = gen_reg_rtx (XFmode); |
| 25180 |
rtx op1 = gen_reg_rtx (XFmode); |
| 25181 |
|
| 25182 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 25183 |
emit_insn (gen_nearbyintxf2 (op0, op1)); |
| 25184 |
emit_insn (gen_truncxf<mode>2_i387_noop_unspec (operands[0], op0)); |
| 25185 |
} |
| 25186 |
DONE; |
| 25187 |
}) |
| 25188 |
|
| 25189 |
(define_expand "roundhf2" |
| 25190 |
[(match_operand:HF 0 "register_operand") |
| 25191 |
(match_operand:HF 1 "register_operand")] |
| 25192 |
"TARGET_AVX512FP16 && !flag_trapping_math && !flag_rounding_math" |
| 25193 |
{ |
| 25194 |
ix86_expand_round_sse4 (operands[0], operands[1]); |
| 25195 |
DONE; |
| 25196 |
}) |
| 25197 |
|
| 25198 |
(define_expand "round<mode>2" |
| 25199 |
[(match_operand:X87MODEF 0 "register_operand") |
| 25200 |
(match_operand:X87MODEF 1 "nonimmediate_operand")] |
| 25201 |
"(TARGET_USE_FANCY_MATH_387 |
| 25202 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 25203 |
|| TARGET_MIX_SSE_I387) |
| 25204 |
&& flag_unsafe_math_optimizations |
| 25205 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math)) |
| 25206 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 25207 |
&& !flag_trapping_math && !flag_rounding_math)" |
| 25208 |
{ |
| 25209 |
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 25210 |
&& !flag_trapping_math && !flag_rounding_math) |
| 25211 |
{ |
| 25212 |
if (TARGET_SSE4_1) |
| 25213 |
{ |
| 25214 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 25215 |
ix86_expand_round_sse4 (operands[0], operands[1]); |
| 25216 |
} |
| 25217 |
else if (TARGET_64BIT || (<MODE>mode != DFmode)) |
| 25218 |
ix86_expand_round (operands[0], operands[1]); |
| 25219 |
else |
| 25220 |
ix86_expand_rounddf_32 (operands[0], operands[1]); |
| 25221 |
} |
| 25222 |
else |
| 25223 |
{ |
| 25224 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 25225 |
ix86_emit_i387_round (operands[0], operands[1]); |
| 25226 |
} |
| 25227 |
DONE; |
| 25228 |
}) |
| 25229 |
|
| 25230 |
(define_insn "lrintxfdi2" |
| 25231 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=m") |
| 25232 |
(unspec:DI [(match_operand:XF 1 "register_operand" "f")] |
| 25233 |
UNSPEC_FIST)) |
| 25234 |
(clobber (match_scratch:XF 2 "=&f"))] |
| 25235 |
"TARGET_USE_FANCY_MATH_387" |
| 25236 |
"* return output_fix_trunc (insn, operands, false);" |
| 25237 |
[(set_attr "type" "fpspc") |
| 25238 |
(set_attr "mode" "DI")]) |
| 25239 |
|
| 25240 |
(define_insn "lrintxf<mode>2" |
| 25241 |
[(set (match_operand:SWI24 0 "nonimmediate_operand" "=m") |
| 25242 |
(unspec:SWI24 [(match_operand:XF 1 "register_operand" "f")] |
| 25243 |
UNSPEC_FIST))] |
| 25244 |
"TARGET_USE_FANCY_MATH_387" |
| 25245 |
"* return output_fix_trunc (insn, operands, false);" |
| 25246 |
[(set_attr "type" "fpspc") |
| 25247 |
(set_attr "mode" "<MODE>")]) |
| 25248 |
|
| 25249 |
(define_expand "lroundhf<mode>2" |
| 25250 |
[(set (match_operand:SWI248 0 "register_operand") |
| 25251 |
(unspec:SWI248 [(match_operand:HF 1 "nonimmediate_operand")] |
| 25252 |
UNSPEC_FIX_NOTRUNC))] |
| 25253 |
"TARGET_AVX512FP16 && !flag_trapping_math && !flag_rounding_math" |
| 25254 |
{ |
| 25255 |
ix86_expand_lround (operands[0], operands[1]); |
| 25256 |
DONE; |
| 25257 |
}) |
| 25258 |
|
| 25259 |
(define_expand "lrinthf<mode>2" |
| 25260 |
[(set (match_operand:SWI48 0 "register_operand") |
| 25261 |
(unspec:SWI48 [(match_operand:HF 1 "nonimmediate_operand")] |
| 25262 |
UNSPEC_FIX_NOTRUNC))] |
| 25263 |
"TARGET_AVX512FP16") |
| 25264 |
|
| 25265 |
(define_expand "lrint<MODEF:mode><SWI48:mode>2" |
| 25266 |
[(set (match_operand:SWI48 0 "register_operand") |
| 25267 |
(unspec:SWI48 [(match_operand:MODEF 1 "nonimmediate_operand")] |
| 25268 |
UNSPEC_FIX_NOTRUNC))] |
| 25269 |
"SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH") |
| 25270 |
|
| 25271 |
(define_expand "lround<X87MODEF:mode><SWI248x:mode>2" |
| 25272 |
[(match_operand:SWI248x 0 "nonimmediate_operand") |
| 25273 |
(match_operand:X87MODEF 1 "register_operand")] |
| 25274 |
"(TARGET_USE_FANCY_MATH_387 |
| 25275 |
&& (!(SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH) |
| 25276 |
|| TARGET_MIX_SSE_I387) |
| 25277 |
&& flag_unsafe_math_optimizations) |
| 25278 |
|| (SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH |
| 25279 |
&& <SWI248x:MODE>mode != HImode |
| 25280 |
&& ((<SWI248x:MODE>mode != DImode) || TARGET_64BIT) |
| 25281 |
&& !flag_trapping_math && !flag_rounding_math)" |
| 25282 |
{ |
| 25283 |
if (SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH |
| 25284 |
&& <SWI248x:MODE>mode != HImode |
| 25285 |
&& ((<SWI248x:MODE>mode != DImode) || TARGET_64BIT) |
| 25286 |
&& !flag_trapping_math && !flag_rounding_math) |
| 25287 |
ix86_expand_lround (operands[0], operands[1]); |
| 25288 |
else |
| 25289 |
ix86_emit_i387_round (operands[0], operands[1]); |
| 25290 |
DONE; |
| 25291 |
}) |
| 25292 |
|
| 25293 |
(define_int_iterator FRNDINT_ROUNDING |
| 25294 |
[UNSPEC_FRNDINT_ROUNDEVEN |
| 25295 |
UNSPEC_FRNDINT_FLOOR |
| 25296 |
UNSPEC_FRNDINT_CEIL |
| 25297 |
UNSPEC_FRNDINT_TRUNC]) |
| 25298 |
|
| 25299 |
(define_int_iterator FIST_ROUNDING |
| 25300 |
[UNSPEC_FIST_FLOOR |
| 25301 |
UNSPEC_FIST_CEIL]) |
| 25302 |
|
| 25303 |
;; Base name for define_insn |
| 25304 |
(define_int_attr rounding_insn |
| 25305 |
[(UNSPEC_FRNDINT_ROUNDEVEN "roundeven") |
| 25306 |
(UNSPEC_FRNDINT_FLOOR "floor") |
| 25307 |
(UNSPEC_FRNDINT_CEIL "ceil") |
| 25308 |
(UNSPEC_FRNDINT_TRUNC "btrunc") |
| 25309 |
(UNSPEC_FIST_FLOOR "floor") |
| 25310 |
(UNSPEC_FIST_CEIL "ceil")]) |
| 25311 |
|
| 25312 |
(define_int_attr rounding |
| 25313 |
[(UNSPEC_FRNDINT_ROUNDEVEN "roundeven") |
| 25314 |
(UNSPEC_FRNDINT_FLOOR "floor") |
| 25315 |
(UNSPEC_FRNDINT_CEIL "ceil") |
| 25316 |
(UNSPEC_FRNDINT_TRUNC "trunc") |
| 25317 |
(UNSPEC_FIST_FLOOR "floor") |
| 25318 |
(UNSPEC_FIST_CEIL "ceil")]) |
| 25319 |
|
| 25320 |
(define_int_attr ROUNDING |
| 25321 |
[(UNSPEC_FRNDINT_ROUNDEVEN "ROUNDEVEN") |
| 25322 |
(UNSPEC_FRNDINT_FLOOR "FLOOR") |
| 25323 |
(UNSPEC_FRNDINT_CEIL "CEIL") |
| 25324 |
(UNSPEC_FRNDINT_TRUNC "TRUNC") |
| 25325 |
(UNSPEC_FIST_FLOOR "FLOOR") |
| 25326 |
(UNSPEC_FIST_CEIL "CEIL")]) |
| 25327 |
|
| 25328 |
;; Rounding mode control word calculation could clobber FLAGS_REG. |
| 25329 |
(define_insn_and_split "frndintxf2_<rounding>" |
| 25330 |
[(set (match_operand:XF 0 "register_operand") |
| 25331 |
(unspec:XF [(match_operand:XF 1 "register_operand")] |
| 25332 |
FRNDINT_ROUNDING)) |
| 25333 |
(clobber (reg:CC FLAGS_REG))] |
| 25334 |
"TARGET_USE_FANCY_MATH_387 |
| 25335 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math) |
| 25336 |
&& ix86_pre_reload_split ()" |
| 25337 |
"#" |
| 25338 |
"&& 1" |
| 25339 |
[(const_int 0)] |
| 25340 |
{ |
| 25341 |
ix86_optimize_mode_switching[I387_<ROUNDING>] = 1; |
| 25342 |
|
| 25343 |
operands[2] = assign_386_stack_local (HImode, SLOT_CW_STORED); |
| 25344 |
operands[3] = assign_386_stack_local (HImode, SLOT_CW_<ROUNDING>); |
| 25345 |
|
| 25346 |
emit_insn (gen_frndintxf2_<rounding>_i387 (operands[0], operands[1], |
| 25347 |
operands[2], operands[3])); |
| 25348 |
DONE; |
| 25349 |
} |
| 25350 |
[(set_attr "type" "frndint") |
| 25351 |
(set_attr "i387_cw" "<rounding>") |
| 25352 |
(set_attr "mode" "XF")]) |
| 25353 |
|
| 25354 |
(define_insn "frndintxf2_<rounding>_i387" |
| 25355 |
[(set (match_operand:XF 0 "register_operand" "=f") |
| 25356 |
(unspec:XF [(match_operand:XF 1 "register_operand" "0")] |
| 25357 |
FRNDINT_ROUNDING)) |
| 25358 |
(use (match_operand:HI 2 "memory_operand" "m")) |
| 25359 |
(use (match_operand:HI 3 "memory_operand" "m"))] |
| 25360 |
"TARGET_USE_FANCY_MATH_387 |
| 25361 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math)" |
| 25362 |
"fldcw\t%3\n\tfrndint\n\tfldcw\t%2" |
| 25363 |
[(set_attr "type" "frndint") |
| 25364 |
(set_attr "i387_cw" "<rounding>") |
| 25365 |
(set_attr "mode" "XF")]) |
| 25366 |
|
| 25367 |
(define_expand "<rounding_insn>xf2" |
| 25368 |
[(parallel [(set (match_operand:XF 0 "register_operand") |
| 25369 |
(unspec:XF [(match_operand:XF 1 "register_operand")] |
| 25370 |
FRNDINT_ROUNDING)) |
| 25371 |
(clobber (reg:CC FLAGS_REG))])] |
| 25372 |
"TARGET_USE_FANCY_MATH_387 |
| 25373 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math)") |
| 25374 |
|
| 25375 |
(define_expand "<rounding_insn>hf2" |
| 25376 |
[(parallel [(set (match_operand:HF 0 "register_operand") |
| 25377 |
(unspec:HF [(match_operand:HF 1 "register_operand")] |
| 25378 |
FRNDINT_ROUNDING)) |
| 25379 |
(clobber (reg:CC FLAGS_REG))])] |
| 25380 |
"TARGET_AVX512FP16" |
| 25381 |
{ |
| 25382 |
emit_insn (gen_sse4_1_roundhf2 (operands[0], operands[1], |
| 25383 |
GEN_INT (ROUND_<ROUNDING> | ROUND_NO_EXC))); |
| 25384 |
DONE; |
| 25385 |
}) |
| 25386 |
|
| 25387 |
(define_expand "<rounding_insn><mode>2" |
| 25388 |
[(parallel [(set (match_operand:MODEF 0 "register_operand") |
| 25389 |
(unspec:MODEF [(match_operand:MODEF 1 "register_operand")] |
| 25390 |
FRNDINT_ROUNDING)) |
| 25391 |
(clobber (reg:CC FLAGS_REG))])] |
| 25392 |
"(TARGET_USE_FANCY_MATH_387 |
| 25393 |
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) |
| 25394 |
|| TARGET_MIX_SSE_I387) |
| 25395 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math)) |
| 25396 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 25397 |
&& (TARGET_SSE4_1 |
| 25398 |
|| (ROUND_<ROUNDING> != ROUND_ROUNDEVEN |
| 25399 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math))))" |
| 25400 |
{ |
| 25401 |
if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 25402 |
&& (TARGET_SSE4_1 |
| 25403 |
|| (ROUND_<ROUNDING> != ROUND_ROUNDEVEN |
| 25404 |
&& (flag_fp_int_builtin_inexact || !flag_trapping_math)))) |
| 25405 |
{ |
| 25406 |
if (TARGET_SSE4_1) |
| 25407 |
emit_insn (gen_sse4_1_round<mode>2 |
| 25408 |
(operands[0], operands[1], |
| 25409 |
GEN_INT (ROUND_<ROUNDING> | ROUND_NO_EXC))); |
| 25410 |
else if (TARGET_64BIT || (<MODE>mode != DFmode)) |
| 25411 |
{ |
| 25412 |
if (ROUND_<ROUNDING> == ROUND_FLOOR) |
| 25413 |
ix86_expand_floorceil (operands[0], operands[1], true); |
| 25414 |
else if (ROUND_<ROUNDING> == ROUND_CEIL) |
| 25415 |
ix86_expand_floorceil (operands[0], operands[1], false); |
| 25416 |
else if (ROUND_<ROUNDING> == ROUND_TRUNC) |
| 25417 |
ix86_expand_trunc (operands[0], operands[1]); |
| 25418 |
else |
| 25419 |
gcc_unreachable (); |
| 25420 |
} |
| 25421 |
else |
| 25422 |
{ |
| 25423 |
if (ROUND_<ROUNDING> == ROUND_FLOOR) |
| 25424 |
ix86_expand_floorceildf_32 (operands[0], operands[1], true); |
| 25425 |
else if (ROUND_<ROUNDING> == ROUND_CEIL) |
| 25426 |
ix86_expand_floorceildf_32 (operands[0], operands[1], false); |
| 25427 |
else if (ROUND_<ROUNDING> == ROUND_TRUNC) |
| 25428 |
ix86_expand_truncdf_32 (operands[0], operands[1]); |
| 25429 |
else |
| 25430 |
gcc_unreachable (); |
| 25431 |
} |
| 25432 |
} |
| 25433 |
else |
| 25434 |
{ |
| 25435 |
rtx op0 = gen_reg_rtx (XFmode); |
| 25436 |
rtx op1 = gen_reg_rtx (XFmode); |
| 25437 |
|
| 25438 |
emit_insn (gen_extend<mode>xf2 (op1, operands[1])); |
| 25439 |
emit_insn (gen_frndintxf2_<rounding> (op0, op1)); |
| 25440 |
emit_insn (gen_truncxf<mode>2_i387_noop_unspec (operands[0], op0)); |
| 25441 |
} |
| 25442 |
DONE; |
| 25443 |
}) |
| 25444 |
|
| 25445 |
;; Rounding mode control word calculation could clobber FLAGS_REG. |
| 25446 |
(define_insn_and_split "*fist<mode>2_<rounding>_1" |
| 25447 |
[(set (match_operand:SWI248x 0 "nonimmediate_operand") |
| 25448 |
(unspec:SWI248x [(match_operand:XF 1 "register_operand")] |
| 25449 |
FIST_ROUNDING)) |
| 25450 |
(clobber (reg:CC FLAGS_REG))] |
| 25451 |
"TARGET_USE_FANCY_MATH_387 |
| 25452 |
&& flag_unsafe_math_optimizations |
| 25453 |
&& ix86_pre_reload_split ()" |
| 25454 |
"#" |
| 25455 |
"&& 1" |
| 25456 |
[(const_int 0)] |
| 25457 |
{ |
| 25458 |
ix86_optimize_mode_switching[I387_<ROUNDING>] = 1; |
| 25459 |
|
| 25460 |
operands[2] = assign_386_stack_local (HImode, SLOT_CW_STORED); |
| 25461 |
operands[3] = assign_386_stack_local (HImode, SLOT_CW_<ROUNDING>); |
| 25462 |
|
| 25463 |
emit_insn (gen_fist<mode>2_<rounding> (operands[0], operands[1], |
| 25464 |
operands[2], operands[3])); |
| 25465 |
DONE; |
| 25466 |
} |
| 25467 |
[(set_attr "type" "fistp") |
| 25468 |
(set_attr "i387_cw" "<rounding>") |
| 25469 |
(set_attr "mode" "<MODE>")]) |
| 25470 |
|
| 25471 |
(define_insn "fistdi2_<rounding>" |
| 25472 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=m") |
| 25473 |
(unspec:DI [(match_operand:XF 1 "register_operand" "f")] |
| 25474 |
FIST_ROUNDING)) |
| 25475 |
(use (match_operand:HI 2 "memory_operand" "m")) |
| 25476 |
(use (match_operand:HI 3 "memory_operand" "m")) |
| 25477 |
(clobber (match_scratch:XF 4 "=&f"))] |
| 25478 |
"TARGET_USE_FANCY_MATH_387 |
| 25479 |
&& flag_unsafe_math_optimizations" |
| 25480 |
"* return output_fix_trunc (insn, operands, false);" |
| 25481 |
[(set_attr "type" "fistp") |
| 25482 |
(set_attr "i387_cw" "<rounding>") |
| 25483 |
(set_attr "mode" "DI")]) |
| 25484 |
|
| 25485 |
(define_insn "fist<mode>2_<rounding>" |
| 25486 |
[(set (match_operand:SWI24 0 "nonimmediate_operand" "=m") |
| 25487 |
(unspec:SWI24 [(match_operand:XF 1 "register_operand" "f")] |
| 25488 |
FIST_ROUNDING)) |
| 25489 |
(use (match_operand:HI 2 "memory_operand" "m")) |
| 25490 |
(use (match_operand:HI 3 "memory_operand" "m"))] |
| 25491 |
"TARGET_USE_FANCY_MATH_387 |
| 25492 |
&& flag_unsafe_math_optimizations" |
| 25493 |
"* return output_fix_trunc (insn, operands, false);" |
| 25494 |
[(set_attr "type" "fistp") |
| 25495 |
(set_attr "i387_cw" "<rounding>") |
| 25496 |
(set_attr "mode" "<MODE>")]) |
| 25497 |
|
| 25498 |
(define_expand "l<rounding_insn>xf<mode>2" |
| 25499 |
[(parallel [(set (match_operand:SWI248x 0 "nonimmediate_operand") |
| 25500 |
(unspec:SWI248x [(match_operand:XF 1 "register_operand")] |
| 25501 |
FIST_ROUNDING)) |
| 25502 |
(clobber (reg:CC FLAGS_REG))])] |
| 25503 |
"TARGET_USE_FANCY_MATH_387 |
| 25504 |
&& (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387) |
| 25505 |
&& flag_unsafe_math_optimizations") |
| 25506 |
|
| 25507 |
(define_expand "l<rounding_insn>hf<mode>2" |
| 25508 |
[(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 25509 |
(unspec:SWI48 [(match_operand:HF 1 "register_operand")] |
| 25510 |
FIST_ROUNDING))] |
| 25511 |
"TARGET_AVX512FP16" |
| 25512 |
{ |
| 25513 |
rtx tmp = gen_reg_rtx (HFmode); |
| 25514 |
emit_insn (gen_sse4_1_roundhf2 (tmp, operands[1], |
| 25515 |
GEN_INT (ROUND_<ROUNDING> | ROUND_NO_EXC))); |
| 25516 |
emit_insn (gen_fix_trunchf<mode>2 (operands[0], tmp)); |
| 25517 |
DONE; |
| 25518 |
}) |
| 25519 |
|
| 25520 |
(define_expand "l<rounding_insn><MODEF:mode><SWI48:mode>2" |
| 25521 |
[(parallel [(set (match_operand:SWI48 0 "nonimmediate_operand") |
| 25522 |
(unspec:SWI48 [(match_operand:MODEF 1 "register_operand")] |
| 25523 |
FIST_ROUNDING)) |
| 25524 |
(clobber (reg:CC FLAGS_REG))])] |
| 25525 |
"SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH |
| 25526 |
&& (TARGET_SSE4_1 || !flag_trapping_math)" |
| 25527 |
{ |
| 25528 |
if (TARGET_SSE4_1) |
| 25529 |
{ |
| 25530 |
rtx tmp = gen_reg_rtx (<MODEF:MODE>mode); |
| 25531 |
|
| 25532 |
emit_insn (gen_sse4_1_round<MODEF:mode>2 |
| 25533 |
(tmp, operands[1], GEN_INT (ROUND_<ROUNDING> |
| 25534 |
| ROUND_NO_EXC))); |
| 25535 |
emit_insn (gen_fix_trunc<MODEF:mode><SWI48:mode>2 |
| 25536 |
(operands[0], tmp)); |
| 25537 |
} |
| 25538 |
else if (ROUND_<ROUNDING> == ROUND_FLOOR) |
| 25539 |
ix86_expand_lfloorceil (operands[0], operands[1], true); |
| 25540 |
else if (ROUND_<ROUNDING> == ROUND_CEIL) |
| 25541 |
ix86_expand_lfloorceil (operands[0], operands[1], false); |
| 25542 |
else |
| 25543 |
gcc_unreachable (); |
| 25544 |
|
| 25545 |
DONE; |
| 25546 |
}) |
| 25547 |
|
| 25548 |
(define_insn "fxam<mode>2_i387" |
| 25549 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 25550 |
(unspec:HI |
| 25551 |
[(match_operand:X87MODEF 1 "register_operand" "f")] |
| 25552 |
UNSPEC_FXAM))] |
| 25553 |
"TARGET_USE_FANCY_MATH_387" |
| 25554 |
"fxam\n\tfnstsw\t%0" |
| 25555 |
[(set_attr "type" "multi") |
| 25556 |
(set_attr "length" "4") |
| 25557 |
(set_attr "unit" "i387") |
| 25558 |
(set_attr "mode" "<MODE>")]) |
| 25559 |
|
| 25560 |
(define_expand "signbittf2" |
| 25561 |
[(use (match_operand:SI 0 "register_operand")) |
| 25562 |
(use (match_operand:TF 1 "register_operand"))] |
| 25563 |
"TARGET_SSE" |
| 25564 |
{ |
| 25565 |
if (TARGET_SSE4_1) |
| 25566 |
{ |
| 25567 |
rtx mask = ix86_build_signbit_mask (TFmode, 0, 0); |
| 25568 |
rtx scratch = gen_reg_rtx (QImode); |
| 25569 |
|
| 25570 |
emit_insn (gen_ptesttf2 (operands[1], mask)); |
| 25571 |
ix86_expand_setcc (scratch, NE, |
| 25572 |
gen_rtx_REG (CCZmode, FLAGS_REG), const0_rtx); |
| 25573 |
|
| 25574 |
emit_insn (gen_zero_extendqisi2 (operands[0], scratch)); |
| 25575 |
} |
| 25576 |
else |
| 25577 |
{ |
| 25578 |
emit_insn (gen_sse_movmskps (operands[0], |
| 25579 |
gen_lowpart (V4SFmode, operands[1]))); |
| 25580 |
emit_insn (gen_andsi3 (operands[0], operands[0], GEN_INT (0x8))); |
| 25581 |
} |
| 25582 |
DONE; |
| 25583 |
}) |
| 25584 |
|
| 25585 |
(define_expand "signbitxf2" |
| 25586 |
[(use (match_operand:SI 0 "register_operand")) |
| 25587 |
(use (match_operand:XF 1 "register_operand"))] |
| 25588 |
"TARGET_USE_FANCY_MATH_387" |
| 25589 |
{ |
| 25590 |
rtx scratch = gen_reg_rtx (HImode); |
| 25591 |
|
| 25592 |
emit_insn (gen_fxamxf2_i387 (scratch, operands[1])); |
| 25593 |
emit_insn (gen_andsi3 (operands[0], |
| 25594 |
gen_lowpart (SImode, scratch), GEN_INT (0x200))); |
| 25595 |
DONE; |
| 25596 |
}) |
| 25597 |
|
| 25598 |
(define_insn "movmsk_df" |
| 25599 |
[(set (match_operand:SI 0 "register_operand" "=r,jr") |
| 25600 |
(unspec:SI |
| 25601 |
[(match_operand:DF 1 "register_operand" "x,x")] |
| 25602 |
UNSPEC_MOVMSK))] |
| 25603 |
"SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH" |
| 25604 |
"%vmovmskpd\t{%1, %0|%0, %1}" |
| 25605 |
[(set_attr "isa" "noavx,avx") |
| 25606 |
(set_attr "type" "ssemov") |
| 25607 |
(set_attr "prefix" "maybe_evex") |
| 25608 |
(set_attr "mode" "DF")]) |
| 25609 |
|
| 25610 |
;; Use movmskpd in SSE mode to avoid store forwarding stall |
| 25611 |
;; for 32bit targets and movq+shrq sequence for 64bit targets. |
| 25612 |
(define_expand "signbitdf2" |
| 25613 |
[(use (match_operand:SI 0 "register_operand")) |
| 25614 |
(use (match_operand:DF 1 "register_operand"))] |
| 25615 |
"TARGET_USE_FANCY_MATH_387 |
| 25616 |
|| (SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH)" |
| 25617 |
{ |
| 25618 |
if (SSE_FLOAT_MODE_P (DFmode) && TARGET_SSE_MATH) |
| 25619 |
{ |
| 25620 |
emit_insn (gen_movmsk_df (operands[0], operands[1])); |
| 25621 |
emit_insn (gen_andsi3 (operands[0], operands[0], const1_rtx)); |
| 25622 |
} |
| 25623 |
else |
| 25624 |
{ |
| 25625 |
rtx scratch = gen_reg_rtx (HImode); |
| 25626 |
|
| 25627 |
emit_insn (gen_fxamdf2_i387 (scratch, operands[1])); |
| 25628 |
emit_insn (gen_andsi3 (operands[0], |
| 25629 |
gen_lowpart (SImode, scratch), GEN_INT (0x200))); |
| 25630 |
} |
| 25631 |
DONE; |
| 25632 |
}) |
| 25633 |
|
| 25634 |
(define_expand "signbitsf2" |
| 25635 |
[(use (match_operand:SI 0 "register_operand")) |
| 25636 |
(use (match_operand:SF 1 "register_operand"))] |
| 25637 |
"TARGET_USE_FANCY_MATH_387 |
| 25638 |
&& !(SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)" |
| 25639 |
{ |
| 25640 |
rtx scratch = gen_reg_rtx (HImode); |
| 25641 |
|
| 25642 |
emit_insn (gen_fxamsf2_i387 (scratch, operands[1])); |
| 25643 |
emit_insn (gen_andsi3 (operands[0], |
| 25644 |
gen_lowpart (SImode, scratch), GEN_INT (0x200))); |
| 25645 |
DONE; |
| 25646 |
}) |
| 25647 |
|
| 25648 |
;; Block operation instructions |
| 25649 |
|
| 25650 |
(define_insn "cld" |
| 25651 |
[(unspec_volatile [(const_int 0)] UNSPECV_CLD)] |
| 25652 |
"" |
| 25653 |
"cld" |
| 25654 |
[(set_attr "length" "1") |
| 25655 |
(set_attr "length_immediate" "0") |
| 25656 |
(set_attr "modrm" "0")]) |
| 25657 |
|
| 25658 |
(define_expand "cpymem<mode>" |
| 25659 |
[(use (match_operand:BLK 0 "memory_operand")) |
| 25660 |
(use (match_operand:BLK 1 "memory_operand")) |
| 25661 |
(use (match_operand:SWI48 2 "nonmemory_operand")) |
| 25662 |
(use (match_operand:SWI48 3 "const_int_operand")) |
| 25663 |
(use (match_operand:SI 4 "const_int_operand")) |
| 25664 |
(use (match_operand:SI 5 "const_int_operand")) |
| 25665 |
(use (match_operand:SI 6 "")) |
| 25666 |
(use (match_operand:SI 7 "")) |
| 25667 |
(use (match_operand:SI 8 ""))] |
| 25668 |
"" |
| 25669 |
{ |
| 25670 |
if (ix86_expand_set_or_cpymem (operands[0], operands[1], |
| 25671 |
operands[2], NULL, operands[3], |
| 25672 |
operands[4], operands[5], |
| 25673 |
operands[6], operands[7], |
| 25674 |
operands[8], false)) |
| 25675 |
DONE; |
| 25676 |
else |
| 25677 |
FAIL; |
| 25678 |
}) |
| 25679 |
|
| 25680 |
;; Most CPUs don't like single string operations |
| 25681 |
;; Handle this case here to simplify previous expander. |
| 25682 |
|
| 25683 |
(define_expand "strmov" |
| 25684 |
[(set (match_dup 4) (match_operand 3 "memory_operand")) |
| 25685 |
(set (match_operand 1 "memory_operand") (match_dup 4)) |
| 25686 |
(parallel [(set (match_operand 0 "register_operand") (match_dup 5)) |
| 25687 |
(clobber (reg:CC FLAGS_REG))]) |
| 25688 |
(parallel [(set (match_operand 2 "register_operand") (match_dup 6)) |
| 25689 |
(clobber (reg:CC FLAGS_REG))])] |
| 25690 |
"" |
| 25691 |
{ |
| 25692 |
/* Can't use this for non-default address spaces. */ |
| 25693 |
if (!ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[3]))) |
| 25694 |
FAIL; |
| 25695 |
|
| 25696 |
int piece_size = GET_MODE_SIZE (GET_MODE (operands[1])); |
| 25697 |
|
| 25698 |
/* If .md ever supports :P for Pmode, these can be directly |
| 25699 |
in the pattern above. */ |
| 25700 |
operands[5] = plus_constant (Pmode, operands[0], piece_size); |
| 25701 |
operands[6] = plus_constant (Pmode, operands[2], piece_size); |
| 25702 |
|
| 25703 |
/* Can't use this if the user has appropriated esi or edi. */ |
| 25704 |
if ((TARGET_SINGLE_STRINGOP || optimize_insn_for_size_p ()) |
| 25705 |
&& !(fixed_regs[SI_REG] || fixed_regs[DI_REG])) |
| 25706 |
{ |
| 25707 |
emit_insn (gen_strmov_singleop (operands[0], operands[1], |
| 25708 |
operands[2], operands[3], |
| 25709 |
operands[5], operands[6])); |
| 25710 |
DONE; |
| 25711 |
} |
| 25712 |
|
| 25713 |
operands[4] = gen_reg_rtx (GET_MODE (operands[1])); |
| 25714 |
}) |
| 25715 |
|
| 25716 |
(define_expand "strmov_singleop" |
| 25717 |
[(parallel [(set (match_operand 1 "memory_operand") |
| 25718 |
(match_operand 3 "memory_operand")) |
| 25719 |
(set (match_operand 0 "register_operand") |
| 25720 |
(match_operand 4)) |
| 25721 |
(set (match_operand 2 "register_operand") |
| 25722 |
(match_operand 5))])] |
| 25723 |
"" |
| 25724 |
{ |
| 25725 |
if (TARGET_CLD) |
| 25726 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 25727 |
}) |
| 25728 |
|
| 25729 |
(define_insn "*strmovdi_rex_1" |
| 25730 |
[(set (mem:DI (match_operand:P 2 "register_operand" "0")) |
| 25731 |
(mem:DI (match_operand:P 3 "register_operand" "1"))) |
| 25732 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25733 |
(plus:P (match_dup 2) |
| 25734 |
(const_int 8))) |
| 25735 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25736 |
(plus:P (match_dup 3) |
| 25737 |
(const_int 8)))] |
| 25738 |
"TARGET_64BIT |
| 25739 |
&& !(fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25740 |
&& ix86_check_no_addr_space (insn)" |
| 25741 |
"%^movsq" |
| 25742 |
[(set_attr "type" "str") |
| 25743 |
(set_attr "memory" "both") |
| 25744 |
(set_attr "mode" "DI")]) |
| 25745 |
|
| 25746 |
(define_insn "*strmovsi_1" |
| 25747 |
[(set (mem:SI (match_operand:P 2 "register_operand" "0")) |
| 25748 |
(mem:SI (match_operand:P 3 "register_operand" "1"))) |
| 25749 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25750 |
(plus:P (match_dup 2) |
| 25751 |
(const_int 4))) |
| 25752 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25753 |
(plus:P (match_dup 3) |
| 25754 |
(const_int 4)))] |
| 25755 |
"!(fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25756 |
&& ix86_check_no_addr_space (insn)" |
| 25757 |
"%^movs{l|d}" |
| 25758 |
[(set_attr "type" "str") |
| 25759 |
(set_attr "memory" "both") |
| 25760 |
(set_attr "mode" "SI")]) |
| 25761 |
|
| 25762 |
(define_insn "*strmovhi_1" |
| 25763 |
[(set (mem:HI (match_operand:P 2 "register_operand" "0")) |
| 25764 |
(mem:HI (match_operand:P 3 "register_operand" "1"))) |
| 25765 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25766 |
(plus:P (match_dup 2) |
| 25767 |
(const_int 2))) |
| 25768 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25769 |
(plus:P (match_dup 3) |
| 25770 |
(const_int 2)))] |
| 25771 |
"!(fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25772 |
&& ix86_check_no_addr_space (insn)" |
| 25773 |
"%^movsw" |
| 25774 |
[(set_attr "type" "str") |
| 25775 |
(set_attr "memory" "both") |
| 25776 |
(set_attr "mode" "HI")]) |
| 25777 |
|
| 25778 |
(define_insn "*strmovqi_1" |
| 25779 |
[(set (mem:QI (match_operand:P 2 "register_operand" "0")) |
| 25780 |
(mem:QI (match_operand:P 3 "register_operand" "1"))) |
| 25781 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25782 |
(plus:P (match_dup 2) |
| 25783 |
(const_int 1))) |
| 25784 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25785 |
(plus:P (match_dup 3) |
| 25786 |
(const_int 1)))] |
| 25787 |
"!(fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25788 |
&& ix86_check_no_addr_space (insn)" |
| 25789 |
"%^movsb" |
| 25790 |
[(set_attr "type" "str") |
| 25791 |
(set_attr "memory" "both") |
| 25792 |
(set (attr "prefix_rex") |
| 25793 |
(if_then_else |
| 25794 |
(match_test "<P:MODE>mode == DImode") |
| 25795 |
(const_string "0") |
| 25796 |
(const_string "*"))) |
| 25797 |
(set_attr "mode" "QI")]) |
| 25798 |
|
| 25799 |
(define_expand "rep_mov" |
| 25800 |
[(parallel [(set (match_operand 4 "register_operand") (const_int 0)) |
| 25801 |
(set (match_operand 0 "register_operand") |
| 25802 |
(match_operand 5)) |
| 25803 |
(set (match_operand 2 "register_operand") |
| 25804 |
(match_operand 6)) |
| 25805 |
(set (match_operand 1 "memory_operand") |
| 25806 |
(match_operand 3 "memory_operand")) |
| 25807 |
(use (match_dup 4))])] |
| 25808 |
"" |
| 25809 |
{ |
| 25810 |
if (TARGET_CLD) |
| 25811 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 25812 |
}) |
| 25813 |
|
| 25814 |
(define_insn "*rep_movdi_rex64" |
| 25815 |
[(set (match_operand:P 2 "register_operand" "=c") (const_int 0)) |
| 25816 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25817 |
(plus:P (ashift:P (match_operand:P 5 "register_operand" "2") |
| 25818 |
(const_int 3)) |
| 25819 |
(match_operand:P 3 "register_operand" "0"))) |
| 25820 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25821 |
(plus:P (ashift:P (match_dup 5) (const_int 3)) |
| 25822 |
(match_operand:P 4 "register_operand" "1"))) |
| 25823 |
(set (mem:BLK (match_dup 3)) |
| 25824 |
(mem:BLK (match_dup 4))) |
| 25825 |
(use (match_dup 5))] |
| 25826 |
"TARGET_64BIT |
| 25827 |
&& !(fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25828 |
&& ix86_check_no_addr_space (insn)" |
| 25829 |
"%^rep{%;} movsq" |
| 25830 |
[(set_attr "type" "str") |
| 25831 |
(set_attr "prefix_rep" "1") |
| 25832 |
(set_attr "memory" "both") |
| 25833 |
(set_attr "mode" "DI")]) |
| 25834 |
|
| 25835 |
(define_insn "*rep_movsi" |
| 25836 |
[(set (match_operand:P 2 "register_operand" "=c") (const_int 0)) |
| 25837 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25838 |
(plus:P (ashift:P (match_operand:P 5 "register_operand" "2") |
| 25839 |
(const_int 2)) |
| 25840 |
(match_operand:P 3 "register_operand" "0"))) |
| 25841 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25842 |
(plus:P (ashift:P (match_dup 5) (const_int 2)) |
| 25843 |
(match_operand:P 4 "register_operand" "1"))) |
| 25844 |
(set (mem:BLK (match_dup 3)) |
| 25845 |
(mem:BLK (match_dup 4))) |
| 25846 |
(use (match_dup 5))] |
| 25847 |
"!(fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25848 |
&& ix86_check_no_addr_space (insn)" |
| 25849 |
"%^rep{%;} movs{l|d}" |
| 25850 |
[(set_attr "type" "str") |
| 25851 |
(set_attr "prefix_rep" "1") |
| 25852 |
(set_attr "memory" "both") |
| 25853 |
(set_attr "mode" "SI")]) |
| 25854 |
|
| 25855 |
(define_insn "*rep_movqi" |
| 25856 |
[(set (match_operand:P 2 "register_operand" "=c") (const_int 0)) |
| 25857 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25858 |
(plus:P (match_operand:P 3 "register_operand" "0") |
| 25859 |
(match_operand:P 5 "register_operand" "2"))) |
| 25860 |
(set (match_operand:P 1 "register_operand" "=S") |
| 25861 |
(plus:P (match_operand:P 4 "register_operand" "1") (match_dup 5))) |
| 25862 |
(set (mem:BLK (match_dup 3)) |
| 25863 |
(mem:BLK (match_dup 4))) |
| 25864 |
(use (match_dup 5))] |
| 25865 |
"!(fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 25866 |
&& ix86_check_no_addr_space (insn)" |
| 25867 |
"%^rep{%;} movsb" |
| 25868 |
[(set_attr "type" "str") |
| 25869 |
(set_attr "prefix_rep" "1") |
| 25870 |
(set_attr "memory" "both") |
| 25871 |
(set_attr "mode" "QI")]) |
| 25872 |
|
| 25873 |
(define_expand "setmem<mode>" |
| 25874 |
[(use (match_operand:BLK 0 "memory_operand")) |
| 25875 |
(use (match_operand:SWI48 1 "nonmemory_operand")) |
| 25876 |
(use (match_operand:QI 2 "nonmemory_operand")) |
| 25877 |
(use (match_operand 3 "const_int_operand")) |
| 25878 |
(use (match_operand:SI 4 "const_int_operand")) |
| 25879 |
(use (match_operand:SI 5 "const_int_operand")) |
| 25880 |
(use (match_operand:SI 6 "")) |
| 25881 |
(use (match_operand:SI 7 "")) |
| 25882 |
(use (match_operand:SI 8 ""))] |
| 25883 |
"" |
| 25884 |
{ |
| 25885 |
if (ix86_expand_set_or_cpymem (operands[0], NULL, |
| 25886 |
operands[1], operands[2], |
| 25887 |
operands[3], operands[4], |
| 25888 |
operands[5], operands[6], |
| 25889 |
operands[7], operands[8], true)) |
| 25890 |
DONE; |
| 25891 |
else |
| 25892 |
FAIL; |
| 25893 |
}) |
| 25894 |
|
| 25895 |
;; Most CPUs don't like single string operations |
| 25896 |
;; Handle this case here to simplify previous expander. |
| 25897 |
|
| 25898 |
(define_expand "strset" |
| 25899 |
[(set (match_operand 1 "memory_operand") |
| 25900 |
(match_operand 2 "register_operand")) |
| 25901 |
(parallel [(set (match_operand 0 "register_operand") |
| 25902 |
(match_dup 3)) |
| 25903 |
(clobber (reg:CC FLAGS_REG))])] |
| 25904 |
"" |
| 25905 |
{ |
| 25906 |
/* Can't use this for non-default address spaces. */ |
| 25907 |
if (!ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[1]))) |
| 25908 |
FAIL; |
| 25909 |
|
| 25910 |
if (GET_MODE (operands[1]) != GET_MODE (operands[2])) |
| 25911 |
operands[1] = adjust_address_nv (operands[1], GET_MODE (operands[2]), 0); |
| 25912 |
|
| 25913 |
/* If .md ever supports :P for Pmode, this can be directly |
| 25914 |
in the pattern above. */ |
| 25915 |
operands[3] = plus_constant (Pmode, operands[0], |
| 25916 |
GET_MODE_SIZE (GET_MODE (operands[2]))); |
| 25917 |
|
| 25918 |
/* Can't use this if the user has appropriated eax or edi. */ |
| 25919 |
if ((TARGET_SINGLE_STRINGOP || optimize_insn_for_size_p ()) |
| 25920 |
&& !(fixed_regs[AX_REG] || fixed_regs[DI_REG])) |
| 25921 |
{ |
| 25922 |
emit_insn (gen_strset_singleop (operands[0], operands[1], operands[2], |
| 25923 |
operands[3])); |
| 25924 |
DONE; |
| 25925 |
} |
| 25926 |
}) |
| 25927 |
|
| 25928 |
(define_expand "strset_singleop" |
| 25929 |
[(parallel [(set (match_operand 1 "memory_operand") |
| 25930 |
(match_operand 2 "register_operand")) |
| 25931 |
(set (match_operand 0 "register_operand") |
| 25932 |
(match_operand 3)) |
| 25933 |
(unspec [(const_int 0)] UNSPEC_STOS)])] |
| 25934 |
"" |
| 25935 |
{ |
| 25936 |
if (TARGET_CLD) |
| 25937 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 25938 |
}) |
| 25939 |
|
| 25940 |
(define_insn "*strsetdi_rex_1" |
| 25941 |
[(set (mem:DI (match_operand:P 1 "register_operand" "0")) |
| 25942 |
(match_operand:DI 2 "register_operand" "a")) |
| 25943 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25944 |
(plus:P (match_dup 1) |
| 25945 |
(const_int 8))) |
| 25946 |
(unspec [(const_int 0)] UNSPEC_STOS)] |
| 25947 |
"TARGET_64BIT |
| 25948 |
&& !(fixed_regs[AX_REG] || fixed_regs[DI_REG]) |
| 25949 |
&& ix86_check_no_addr_space (insn)" |
| 25950 |
"%^stosq" |
| 25951 |
[(set_attr "type" "str") |
| 25952 |
(set_attr "memory" "store") |
| 25953 |
(set_attr "mode" "DI")]) |
| 25954 |
|
| 25955 |
(define_insn "*strsetsi_1" |
| 25956 |
[(set (mem:SI (match_operand:P 1 "register_operand" "0")) |
| 25957 |
(match_operand:SI 2 "register_operand" "a")) |
| 25958 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25959 |
(plus:P (match_dup 1) |
| 25960 |
(const_int 4))) |
| 25961 |
(unspec [(const_int 0)] UNSPEC_STOS)] |
| 25962 |
"!(fixed_regs[AX_REG] || fixed_regs[DI_REG]) |
| 25963 |
&& ix86_check_no_addr_space (insn)" |
| 25964 |
"%^stos{l|d}" |
| 25965 |
[(set_attr "type" "str") |
| 25966 |
(set_attr "memory" "store") |
| 25967 |
(set_attr "mode" "SI")]) |
| 25968 |
|
| 25969 |
(define_insn "*strsethi_1" |
| 25970 |
[(set (mem:HI (match_operand:P 1 "register_operand" "0")) |
| 25971 |
(match_operand:HI 2 "register_operand" "a")) |
| 25972 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25973 |
(plus:P (match_dup 1) |
| 25974 |
(const_int 2))) |
| 25975 |
(unspec [(const_int 0)] UNSPEC_STOS)] |
| 25976 |
"!(fixed_regs[AX_REG] || fixed_regs[DI_REG]) |
| 25977 |
&& ix86_check_no_addr_space (insn)" |
| 25978 |
"%^stosw" |
| 25979 |
[(set_attr "type" "str") |
| 25980 |
(set_attr "memory" "store") |
| 25981 |
(set_attr "mode" "HI")]) |
| 25982 |
|
| 25983 |
(define_insn "*strsetqi_1" |
| 25984 |
[(set (mem:QI (match_operand:P 1 "register_operand" "0")) |
| 25985 |
(match_operand:QI 2 "register_operand" "a")) |
| 25986 |
(set (match_operand:P 0 "register_operand" "=D") |
| 25987 |
(plus:P (match_dup 1) |
| 25988 |
(const_int 1))) |
| 25989 |
(unspec [(const_int 0)] UNSPEC_STOS)] |
| 25990 |
"!(fixed_regs[AX_REG] || fixed_regs[DI_REG]) |
| 25991 |
&& ix86_check_no_addr_space (insn)" |
| 25992 |
"%^stosb" |
| 25993 |
[(set_attr "type" "str") |
| 25994 |
(set_attr "memory" "store") |
| 25995 |
(set (attr "prefix_rex") |
| 25996 |
(if_then_else |
| 25997 |
(match_test "<P:MODE>mode == DImode") |
| 25998 |
(const_string "0") |
| 25999 |
(const_string "*"))) |
| 26000 |
(set_attr "mode" "QI")]) |
| 26001 |
|
| 26002 |
(define_expand "rep_stos" |
| 26003 |
[(parallel [(set (match_operand 1 "register_operand") (const_int 0)) |
| 26004 |
(set (match_operand 0 "register_operand") |
| 26005 |
(match_operand 4)) |
| 26006 |
(set (match_operand 2 "memory_operand") (const_int 0)) |
| 26007 |
(use (match_operand 3 "register_operand")) |
| 26008 |
(use (match_dup 1))])] |
| 26009 |
"" |
| 26010 |
{ |
| 26011 |
if (TARGET_CLD) |
| 26012 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 26013 |
}) |
| 26014 |
|
| 26015 |
(define_insn "*rep_stosdi_rex64" |
| 26016 |
[(set (match_operand:P 1 "register_operand" "=c") (const_int 0)) |
| 26017 |
(set (match_operand:P 0 "register_operand" "=D") |
| 26018 |
(plus:P (ashift:P (match_operand:P 4 "register_operand" "1") |
| 26019 |
(const_int 3)) |
| 26020 |
(match_operand:P 3 "register_operand" "0"))) |
| 26021 |
(set (mem:BLK (match_dup 3)) |
| 26022 |
(const_int 0)) |
| 26023 |
(use (match_operand:DI 2 "register_operand" "a")) |
| 26024 |
(use (match_dup 4))] |
| 26025 |
"TARGET_64BIT |
| 26026 |
&& !(fixed_regs[AX_REG] || fixed_regs[CX_REG] || fixed_regs[DI_REG]) |
| 26027 |
&& ix86_check_no_addr_space (insn)" |
| 26028 |
"%^rep{%;} stosq" |
| 26029 |
[(set_attr "type" "str") |
| 26030 |
(set_attr "prefix_rep" "1") |
| 26031 |
(set_attr "memory" "store") |
| 26032 |
(set_attr "mode" "DI")]) |
| 26033 |
|
| 26034 |
(define_insn "*rep_stossi" |
| 26035 |
[(set (match_operand:P 1 "register_operand" "=c") (const_int 0)) |
| 26036 |
(set (match_operand:P 0 "register_operand" "=D") |
| 26037 |
(plus:P (ashift:P (match_operand:P 4 "register_operand" "1") |
| 26038 |
(const_int 2)) |
| 26039 |
(match_operand:P 3 "register_operand" "0"))) |
| 26040 |
(set (mem:BLK (match_dup 3)) |
| 26041 |
(const_int 0)) |
| 26042 |
(use (match_operand:SI 2 "register_operand" "a")) |
| 26043 |
(use (match_dup 4))] |
| 26044 |
"!(fixed_regs[AX_REG] || fixed_regs[CX_REG] || fixed_regs[DI_REG]) |
| 26045 |
&& ix86_check_no_addr_space (insn)" |
| 26046 |
"%^rep{%;} stos{l|d}" |
| 26047 |
[(set_attr "type" "str") |
| 26048 |
(set_attr "prefix_rep" "1") |
| 26049 |
(set_attr "memory" "store") |
| 26050 |
(set_attr "mode" "SI")]) |
| 26051 |
|
| 26052 |
(define_insn "*rep_stosqi" |
| 26053 |
[(set (match_operand:P 1 "register_operand" "=c") (const_int 0)) |
| 26054 |
(set (match_operand:P 0 "register_operand" "=D") |
| 26055 |
(plus:P (match_operand:P 3 "register_operand" "0") |
| 26056 |
(match_operand:P 4 "register_operand" "1"))) |
| 26057 |
(set (mem:BLK (match_dup 3)) |
| 26058 |
(const_int 0)) |
| 26059 |
(use (match_operand:QI 2 "register_operand" "a")) |
| 26060 |
(use (match_dup 4))] |
| 26061 |
"!(fixed_regs[AX_REG] || fixed_regs[CX_REG] || fixed_regs[DI_REG]) |
| 26062 |
&& ix86_check_no_addr_space (insn)" |
| 26063 |
"%^rep{%;} stosb" |
| 26064 |
[(set_attr "type" "str") |
| 26065 |
(set_attr "prefix_rep" "1") |
| 26066 |
(set_attr "memory" "store") |
| 26067 |
(set (attr "prefix_rex") |
| 26068 |
(if_then_else |
| 26069 |
(match_test "<P:MODE>mode == DImode") |
| 26070 |
(const_string "0") |
| 26071 |
(const_string "*"))) |
| 26072 |
(set_attr "mode" "QI")]) |
| 26073 |
|
| 26074 |
(define_expand "cmpmemsi" |
| 26075 |
[(set (match_operand:SI 0 "register_operand" "") |
| 26076 |
(compare:SI (match_operand:BLK 1 "memory_operand" "") |
| 26077 |
(match_operand:BLK 2 "memory_operand" "") ) ) |
| 26078 |
(use (match_operand 3 "general_operand")) |
| 26079 |
(use (match_operand 4 "immediate_operand"))] |
| 26080 |
"" |
| 26081 |
{ |
| 26082 |
if (ix86_expand_cmpstrn_or_cmpmem (operands[0], operands[1], |
| 26083 |
operands[2], operands[3], |
| 26084 |
operands[4], false)) |
| 26085 |
DONE; |
| 26086 |
else |
| 26087 |
FAIL; |
| 26088 |
}) |
| 26089 |
|
| 26090 |
(define_expand "cmpstrnsi" |
| 26091 |
[(set (match_operand:SI 0 "register_operand") |
| 26092 |
(compare:SI (match_operand:BLK 1 "general_operand") |
| 26093 |
(match_operand:BLK 2 "general_operand"))) |
| 26094 |
(use (match_operand 3 "general_operand")) |
| 26095 |
(use (match_operand 4 "immediate_operand"))] |
| 26096 |
"" |
| 26097 |
{ |
| 26098 |
if (ix86_expand_cmpstrn_or_cmpmem (operands[0], operands[1], |
| 26099 |
operands[2], operands[3], |
| 26100 |
operands[4], true)) |
| 26101 |
DONE; |
| 26102 |
else |
| 26103 |
FAIL; |
| 26104 |
}) |
| 26105 |
|
| 26106 |
;; Produce a tri-state integer (-1, 0, 1) from condition codes. |
| 26107 |
|
| 26108 |
(define_expand "cmpintqi" |
| 26109 |
[(set (match_dup 1) |
| 26110 |
(gtu:QI (reg:CC FLAGS_REG) (const_int 0))) |
| 26111 |
(set (match_dup 2) |
| 26112 |
(ltu:QI (reg:CC FLAGS_REG) (const_int 0))) |
| 26113 |
(parallel [(set (match_operand:QI 0 "register_operand") |
| 26114 |
(minus:QI (match_dup 1) |
| 26115 |
(match_dup 2))) |
| 26116 |
(clobber (reg:CC FLAGS_REG))])] |
| 26117 |
"" |
| 26118 |
{ |
| 26119 |
operands[1] = gen_reg_rtx (QImode); |
| 26120 |
operands[2] = gen_reg_rtx (QImode); |
| 26121 |
}) |
| 26122 |
|
| 26123 |
;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is |
| 26124 |
;; zero. Emit extra code to make sure that a zero-length compare is EQ. |
| 26125 |
|
| 26126 |
(define_expand "cmpstrnqi_nz_1" |
| 26127 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 26128 |
(compare:CC (match_operand 4 "memory_operand") |
| 26129 |
(match_operand 5 "memory_operand"))) |
| 26130 |
(use (match_operand 2 "register_operand")) |
| 26131 |
(use (match_operand:SI 3 "immediate_operand")) |
| 26132 |
(clobber (match_operand 0 "register_operand")) |
| 26133 |
(clobber (match_operand 1 "register_operand")) |
| 26134 |
(clobber (match_dup 2))])] |
| 26135 |
"" |
| 26136 |
{ |
| 26137 |
if (TARGET_CLD) |
| 26138 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 26139 |
}) |
| 26140 |
|
| 26141 |
(define_insn "*cmpstrnqi_nz_1" |
| 26142 |
[(set (reg:CC FLAGS_REG) |
| 26143 |
(compare:CC (mem:BLK (match_operand:P 4 "register_operand" "0")) |
| 26144 |
(mem:BLK (match_operand:P 5 "register_operand" "1")))) |
| 26145 |
(use (match_operand:P 6 "register_operand" "2")) |
| 26146 |
(use (match_operand:SI 3 "immediate_operand" "i")) |
| 26147 |
(clobber (match_operand:P 0 "register_operand" "=S")) |
| 26148 |
(clobber (match_operand:P 1 "register_operand" "=D")) |
| 26149 |
(clobber (match_operand:P 2 "register_operand" "=c"))] |
| 26150 |
"!(fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 26151 |
&& ix86_check_no_addr_space (insn)" |
| 26152 |
"%^repz{%;} cmpsb" |
| 26153 |
[(set_attr "type" "str") |
| 26154 |
(set_attr "mode" "QI") |
| 26155 |
(set (attr "prefix_rex") |
| 26156 |
(if_then_else |
| 26157 |
(match_test "<P:MODE>mode == DImode") |
| 26158 |
(const_string "0") |
| 26159 |
(const_string "*"))) |
| 26160 |
(set_attr "prefix_rep" "1")]) |
| 26161 |
|
| 26162 |
;; The same, but the count is not known to not be zero. |
| 26163 |
|
| 26164 |
(define_expand "cmpstrnqi_1" |
| 26165 |
[(parallel [(set (reg:CC FLAGS_REG) |
| 26166 |
(if_then_else:CC (ne (match_operand 2 "register_operand") |
| 26167 |
(const_int 0)) |
| 26168 |
(compare:CC (match_operand 4 "memory_operand") |
| 26169 |
(match_operand 5 "memory_operand")) |
| 26170 |
(reg:CC FLAGS_REG))) |
| 26171 |
(use (match_operand:SI 3 "immediate_operand")) |
| 26172 |
(clobber (match_operand 0 "register_operand")) |
| 26173 |
(clobber (match_operand 1 "register_operand")) |
| 26174 |
(clobber (match_dup 2))])] |
| 26175 |
"" |
| 26176 |
{ |
| 26177 |
if (TARGET_CLD) |
| 26178 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 26179 |
}) |
| 26180 |
|
| 26181 |
(define_insn "*cmpstrnqi_1" |
| 26182 |
[(set (reg:CC FLAGS_REG) |
| 26183 |
(if_then_else:CC (ne (match_operand:P 6 "register_operand" "2") |
| 26184 |
(const_int 0)) |
| 26185 |
(compare:CC (mem:BLK (match_operand:P 4 "register_operand" "0")) |
| 26186 |
(mem:BLK (match_operand:P 5 "register_operand" "1"))) |
| 26187 |
(reg:CC FLAGS_REG))) |
| 26188 |
(use (match_operand:SI 3 "immediate_operand" "i")) |
| 26189 |
(clobber (match_operand:P 0 "register_operand" "=S")) |
| 26190 |
(clobber (match_operand:P 1 "register_operand" "=D")) |
| 26191 |
(clobber (match_operand:P 2 "register_operand" "=c"))] |
| 26192 |
"!(fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG]) |
| 26193 |
&& ix86_check_no_addr_space (insn)" |
| 26194 |
"%^repz{%;} cmpsb" |
| 26195 |
[(set_attr "type" "str") |
| 26196 |
(set_attr "mode" "QI") |
| 26197 |
(set (attr "prefix_rex") |
| 26198 |
(if_then_else |
| 26199 |
(match_test "<P:MODE>mode == DImode") |
| 26200 |
(const_string "0") |
| 26201 |
(const_string "*"))) |
| 26202 |
(set_attr "prefix_rep" "1")]) |
| 26203 |
|
| 26204 |
(define_expand "strlen<mode>" |
| 26205 |
[(set (match_operand:P 0 "register_operand") |
| 26206 |
(unspec:P [(match_operand:BLK 1 "general_operand") |
| 26207 |
(match_operand:QI 2 "immediate_operand") |
| 26208 |
(match_operand 3 "immediate_operand")] |
| 26209 |
UNSPEC_SCAS))] |
| 26210 |
"" |
| 26211 |
{ |
| 26212 |
if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3])) |
| 26213 |
DONE; |
| 26214 |
else |
| 26215 |
FAIL; |
| 26216 |
}) |
| 26217 |
|
| 26218 |
(define_expand "strlenqi_1" |
| 26219 |
[(parallel [(set (match_operand 0 "register_operand") |
| 26220 |
(match_operand 2)) |
| 26221 |
(clobber (match_operand 1 "register_operand")) |
| 26222 |
(clobber (reg:CC FLAGS_REG))])] |
| 26223 |
"" |
| 26224 |
{ |
| 26225 |
if (TARGET_CLD) |
| 26226 |
ix86_optimize_mode_switching[X86_DIRFLAG] = 1; |
| 26227 |
}) |
| 26228 |
|
| 26229 |
(define_insn "*strlenqi_1" |
| 26230 |
[(set (match_operand:P 0 "register_operand" "=&c") |
| 26231 |
(unspec:P [(mem:BLK (match_operand:P 5 "register_operand" "1")) |
| 26232 |
(match_operand:QI 2 "register_operand" "a") |
| 26233 |
(match_operand:P 3 "immediate_operand" "i") |
| 26234 |
(match_operand:P 4 "register_operand" "0")] UNSPEC_SCAS)) |
| 26235 |
(clobber (match_operand:P 1 "register_operand" "=D")) |
| 26236 |
(clobber (reg:CC FLAGS_REG))] |
| 26237 |
"!(fixed_regs[AX_REG] || fixed_regs[CX_REG] || fixed_regs[DI_REG]) |
| 26238 |
&& ix86_check_no_addr_space (insn)" |
| 26239 |
"%^repnz{%;} scasb" |
| 26240 |
[(set_attr "type" "str") |
| 26241 |
(set_attr "mode" "QI") |
| 26242 |
(set (attr "prefix_rex") |
| 26243 |
(if_then_else |
| 26244 |
(match_test "<P:MODE>mode == DImode") |
| 26245 |
(const_string "0") |
| 26246 |
(const_string "*"))) |
| 26247 |
(set_attr "prefix_rep" "1")]) |
| 26248 |
|
| 26249 |
;; Peephole optimizations to clean up after cmpstrn*. This should be |
| 26250 |
;; handled in combine, but it is not currently up to the task. |
| 26251 |
;; When used for their truth value, the cmpstrn* expanders generate |
| 26252 |
;; code like this: |
| 26253 |
;; |
| 26254 |
;; repz cmpsb |
| 26255 |
;; seta %al |
| 26256 |
;; setb %dl |
| 26257 |
;; cmpb %al, %dl |
| 26258 |
;; jcc label |
| 26259 |
;; |
| 26260 |
;; The intermediate three instructions are unnecessary. |
| 26261 |
|
| 26262 |
;; This one handles cmpstrn*_nz_1... |
| 26263 |
(define_peephole2 |
| 26264 |
[(parallel[ |
| 26265 |
(set (reg:CC FLAGS_REG) |
| 26266 |
(compare:CC (mem:BLK (match_operand 4 "register_operand")) |
| 26267 |
(mem:BLK (match_operand 5 "register_operand")))) |
| 26268 |
(use (match_operand 6 "register_operand")) |
| 26269 |
(use (match_operand:SI 3 "immediate_operand")) |
| 26270 |
(clobber (match_operand 0 "register_operand")) |
| 26271 |
(clobber (match_operand 1 "register_operand")) |
| 26272 |
(clobber (match_operand 2 "register_operand"))]) |
| 26273 |
(set (match_operand:QI 7 "register_operand") |
| 26274 |
(gtu:QI (reg:CC FLAGS_REG) (const_int 0))) |
| 26275 |
(set (match_operand:QI 8 "register_operand") |
| 26276 |
(ltu:QI (reg:CC FLAGS_REG) (const_int 0))) |
| 26277 |
(set (reg FLAGS_REG) |
| 26278 |
(compare (match_dup 7) (match_dup 8))) |
| 26279 |
] |
| 26280 |
"peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])" |
| 26281 |
[(parallel[ |
| 26282 |
(set (reg:CC FLAGS_REG) |
| 26283 |
(compare:CC (mem:BLK (match_dup 4)) |
| 26284 |
(mem:BLK (match_dup 5)))) |
| 26285 |
(use (match_dup 6)) |
| 26286 |
(use (match_dup 3)) |
| 26287 |
(clobber (match_dup 0)) |
| 26288 |
(clobber (match_dup 1)) |
| 26289 |
(clobber (match_dup 2))])]) |
| 26290 |
|
| 26291 |
;; ...and this one handles cmpstrn*_1. |
| 26292 |
(define_peephole2 |
| 26293 |
[(parallel[ |
| 26294 |
(set (reg:CC FLAGS_REG) |
| 26295 |
(if_then_else:CC (ne (match_operand 6 "register_operand") |
| 26296 |
(const_int 0)) |
| 26297 |
(compare:CC (mem:BLK (match_operand 4 "register_operand")) |
| 26298 |
(mem:BLK (match_operand 5 "register_operand"))) |
| 26299 |
(reg:CC FLAGS_REG))) |
| 26300 |
(use (match_operand:SI 3 "immediate_operand")) |
| 26301 |
(clobber (match_operand 0 "register_operand")) |
| 26302 |
(clobber (match_operand 1 "register_operand")) |
| 26303 |
(clobber (match_operand 2 "register_operand"))]) |
| 26304 |
(set (match_operand:QI 7 "register_operand") |
| 26305 |
(gtu:QI (reg:CC FLAGS_REG) (const_int 0))) |
| 26306 |
(set (match_operand:QI 8 "register_operand") |
| 26307 |
(ltu:QI (reg:CC FLAGS_REG) (const_int 0))) |
| 26308 |
(set (reg FLAGS_REG) |
| 26309 |
(compare (match_dup 7) (match_dup 8))) |
| 26310 |
] |
| 26311 |
"peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])" |
| 26312 |
[(parallel[ |
| 26313 |
(set (reg:CC FLAGS_REG) |
| 26314 |
(if_then_else:CC (ne (match_dup 6) |
| 26315 |
(const_int 0)) |
| 26316 |
(compare:CC (mem:BLK (match_dup 4)) |
| 26317 |
(mem:BLK (match_dup 5))) |
| 26318 |
(reg:CC FLAGS_REG))) |
| 26319 |
(use (match_dup 3)) |
| 26320 |
(clobber (match_dup 0)) |
| 26321 |
(clobber (match_dup 1)) |
| 26322 |
(clobber (match_dup 2))])]) |
| 26323 |
|
| 26324 |
;; Conditional move instructions. |
| 26325 |
|
| 26326 |
(define_expand "mov<mode>cc" |
| 26327 |
[(set (match_operand:SWIM 0 "register_operand") |
| 26328 |
(if_then_else:SWIM (match_operand 1 "comparison_operator") |
| 26329 |
(match_operand:SWIM 2 "<general_operand>") |
| 26330 |
(match_operand:SWIM 3 "<general_operand>")))] |
| 26331 |
"" |
| 26332 |
"if (ix86_expand_int_movcc (operands)) DONE; else FAIL;") |
| 26333 |
|
| 26334 |
;; Data flow gets confused by our desire for `sbbl reg,reg', and clearing |
| 26335 |
;; the register first winds up with `sbbl $0,reg', which is also weird. |
| 26336 |
;; So just document what we're doing explicitly. |
| 26337 |
|
| 26338 |
(define_expand "x86_mov<mode>cc_0_m1" |
| 26339 |
[(parallel |
| 26340 |
[(set (match_operand:SWI48 0 "register_operand") |
| 26341 |
(if_then_else:SWI48 |
| 26342 |
(match_operator:SWI48 2 "ix86_carry_flag_operator" |
| 26343 |
[(match_operand 1 "flags_reg_operand") |
| 26344 |
(const_int 0)]) |
| 26345 |
(const_int -1) |
| 26346 |
(const_int 0))) |
| 26347 |
(clobber (reg:CC FLAGS_REG))])]) |
| 26348 |
|
| 26349 |
(define_insn "*x86_mov<mode>cc_0_m1" |
| 26350 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 26351 |
(if_then_else:SWI48 (match_operator 1 "ix86_carry_flag_operator" |
| 26352 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26353 |
(const_int -1) |
| 26354 |
(const_int 0))) |
| 26355 |
(clobber (reg:CC FLAGS_REG))] |
| 26356 |
"" |
| 26357 |
"sbb{<imodesuffix>}\t%0, %0" |
| 26358 |
[(set_attr "type" "alu1") |
| 26359 |
(set_attr "use_carry" "1") |
| 26360 |
(set_attr "pent_pair" "pu") |
| 26361 |
(set_attr "mode" "<MODE>") |
| 26362 |
(set_attr "length_immediate" "0")]) |
| 26363 |
|
| 26364 |
(define_insn "*x86_mov<mode>cc_0_m1_se" |
| 26365 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 26366 |
(sign_extract:SWI48 (match_operator 1 "ix86_carry_flag_operator" |
| 26367 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26368 |
(const_int 1) |
| 26369 |
(const_int 0))) |
| 26370 |
(clobber (reg:CC FLAGS_REG))] |
| 26371 |
"" |
| 26372 |
"sbb{<imodesuffix>}\t%0, %0" |
| 26373 |
[(set_attr "type" "alu1") |
| 26374 |
(set_attr "use_carry" "1") |
| 26375 |
(set_attr "pent_pair" "pu") |
| 26376 |
(set_attr "mode" "<MODE>") |
| 26377 |
(set_attr "length_immediate" "0")]) |
| 26378 |
|
| 26379 |
(define_insn "*x86_mov<mode>cc_0_m1_neg" |
| 26380 |
[(set (match_operand:SWI 0 "register_operand" "=<r>") |
| 26381 |
(neg:SWI (match_operator 1 "ix86_carry_flag_operator" |
| 26382 |
[(reg FLAGS_REG) (const_int 0)]))) |
| 26383 |
(clobber (reg:CC FLAGS_REG))] |
| 26384 |
"" |
| 26385 |
"sbb{<imodesuffix>}\t%0, %0" |
| 26386 |
[(set_attr "type" "alu1") |
| 26387 |
(set_attr "use_carry" "1") |
| 26388 |
(set_attr "pent_pair" "pu") |
| 26389 |
(set_attr "mode" "<MODE>") |
| 26390 |
(set_attr "length_immediate" "0")]) |
| 26391 |
|
| 26392 |
(define_expand "x86_mov<mode>cc_0_m1_neg" |
| 26393 |
[(parallel |
| 26394 |
[(set (match_operand:SWI 0 "register_operand") |
| 26395 |
(neg:SWI (ltu:SWI (reg:CCC FLAGS_REG) (const_int 0)))) |
| 26396 |
(clobber (reg:CC FLAGS_REG))])]) |
| 26397 |
|
| 26398 |
(define_split |
| 26399 |
[(set (match_operand:SWI48 0 "register_operand") |
| 26400 |
(neg:SWI48 |
| 26401 |
(leu:SWI48 |
| 26402 |
(match_operand 1 "int_nonimmediate_operand") |
| 26403 |
(match_operand 2 "const_int_operand"))))] |
| 26404 |
"x86_64_immediate_operand (operands[2], VOIDmode) |
| 26405 |
&& INTVAL (operands[2]) != -1 |
| 26406 |
&& INTVAL (operands[2]) != 2147483647" |
| 26407 |
[(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2))) |
| 26408 |
(set (match_dup 0) |
| 26409 |
(neg:SWI48 (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0))))] |
| 26410 |
"operands[2] = GEN_INT (INTVAL (operands[2]) + 1);") |
| 26411 |
|
| 26412 |
(define_split |
| 26413 |
[(set (match_operand:SWI 0 "register_operand") |
| 26414 |
(neg:SWI |
| 26415 |
(eq:SWI |
| 26416 |
(match_operand 1 "int_nonimmediate_operand") |
| 26417 |
(const_int 0))))] |
| 26418 |
"" |
| 26419 |
[(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (const_int 1))) |
| 26420 |
(set (match_dup 0) |
| 26421 |
(neg:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_int 0))))]) |
| 26422 |
|
| 26423 |
(define_split |
| 26424 |
[(set (match_operand:SWI 0 "register_operand") |
| 26425 |
(neg:SWI |
| 26426 |
(ne:SWI |
| 26427 |
(match_operand 1 "int_nonimmediate_operand") |
| 26428 |
(const_int 0))))] |
| 26429 |
"" |
| 26430 |
[(set (reg:CCC FLAGS_REG) |
| 26431 |
(unspec:CCC [(match_dup 1) (const_int 0)] UNSPEC_CC_NE)) |
| 26432 |
(set (match_dup 0) |
| 26433 |
(neg:SWI (ltu:SWI (reg:CCC FLAGS_REG) (const_int 0))))]) |
| 26434 |
|
| 26435 |
(define_insn "*mov<mode>cc_noc" |
| 26436 |
[(set (match_operand:SWI248 0 "register_operand" "=r,r,r,r") |
| 26437 |
(if_then_else:SWI248 (match_operator 1 "ix86_comparison_operator" |
| 26438 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26439 |
(match_operand:SWI248 2 "nonimmediate_operand" "rm,0,rm,r") |
| 26440 |
(match_operand:SWI248 3 "nonimmediate_operand" "0,rm,r,rm")))] |
| 26441 |
"TARGET_CMOVE && !(MEM_P (operands[2]) && MEM_P (operands[3]))" |
| 26442 |
"@ |
| 26443 |
cmov%O2%C1\t{%2, %0|%0, %2} |
| 26444 |
cmov%O2%c1\t{%3, %0|%0, %3} |
| 26445 |
cmov%O2%C1\t{%2, %3, %0|%0, %3, %2} |
| 26446 |
cmov%O2%c1\t{%3, %2, %0|%0, %2, %3}" |
| 26447 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 26448 |
(set_attr "type" "icmov") |
| 26449 |
(set_attr "mode" "<MODE>")]) |
| 26450 |
|
| 26451 |
(define_insn "*movsicc_noc_zext" |
| 26452 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r") |
| 26453 |
(if_then_else:DI (match_operator 1 "ix86_comparison_operator" |
| 26454 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26455 |
(zero_extend:DI |
| 26456 |
(match_operand:SI 2 "nonimmediate_operand" "rm,0,rm,r")) |
| 26457 |
(zero_extend:DI |
| 26458 |
(match_operand:SI 3 "nonimmediate_operand" "0,rm,r,rm"))))] |
| 26459 |
"TARGET_64BIT |
| 26460 |
&& TARGET_CMOVE && !(MEM_P (operands[2]) && MEM_P (operands[3]))" |
| 26461 |
"@ |
| 26462 |
cmov%O2%C1\t{%2, %k0|%k0, %2} |
| 26463 |
cmov%O2%c1\t{%3, %k0|%k0, %3} |
| 26464 |
cmov%O2%C1\t{%2, %3, %k0|%k0, %3, %2} |
| 26465 |
cmov%O2%c1\t{%3, %2, %k0|%k0, %2, %3}" |
| 26466 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 26467 |
(set_attr "type" "icmov") |
| 26468 |
(set_attr "mode" "SI")]) |
| 26469 |
|
| 26470 |
(define_insn "*movsicc_noc_zext_1" |
| 26471 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r") |
| 26472 |
(zero_extend:DI |
| 26473 |
(if_then_else:SI (match_operator 1 "ix86_comparison_operator" |
| 26474 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26475 |
(match_operand:SI 2 "nonimmediate_operand" "rm,0,rm,r") |
| 26476 |
(match_operand:SI 3 "nonimmediate_operand" "0,rm,r,rm"))))] |
| 26477 |
"TARGET_64BIT |
| 26478 |
&& TARGET_CMOVE && !(MEM_P (operands[2]) && MEM_P (operands[3]))" |
| 26479 |
"@ |
| 26480 |
cmov%O2%C1\t{%2, %k0|%k0, %2} |
| 26481 |
cmov%O2%c1\t{%3, %k0|%k0, %3} |
| 26482 |
cmov%O2%C1\t{%2, %3, %k0|%k0, %3, %2} |
| 26483 |
cmov%O2%c1\t{%3, %2, %k0|%k0, %2, %3}" |
| 26484 |
[(set_attr "isa" "*,*,apx_ndd,apx_ndd") |
| 26485 |
(set_attr "type" "icmov") |
| 26486 |
(set_attr "mode" "SI")]) |
| 26487 |
|
| 26488 |
|
| 26489 |
;; Don't do conditional moves with memory inputs. This splitter helps |
| 26490 |
;; register starved x86_32 by forcing inputs into registers before reload. |
| 26491 |
(define_split |
| 26492 |
[(set (match_operand:SWI248 0 "register_operand") |
| 26493 |
(if_then_else:SWI248 (match_operator 1 "ix86_comparison_operator" |
| 26494 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26495 |
(match_operand:SWI248 2 "nonimmediate_operand") |
| 26496 |
(match_operand:SWI248 3 "nonimmediate_operand")))] |
| 26497 |
"!TARGET_64BIT && TARGET_CMOVE |
| 26498 |
&& TARGET_AVOID_MEM_OPND_FOR_CMOVE |
| 26499 |
&& (MEM_P (operands[2]) || MEM_P (operands[3])) |
| 26500 |
&& can_create_pseudo_p () |
| 26501 |
&& optimize_insn_for_speed_p ()" |
| 26502 |
[(set (match_dup 0) |
| 26503 |
(if_then_else:SWI248 (match_dup 1) (match_dup 2) (match_dup 3)))] |
| 26504 |
{ |
| 26505 |
operands[2] = force_reg (<MODE>mode, operands[2]); |
| 26506 |
operands[3] = force_reg (<MODE>mode, operands[3]); |
| 26507 |
}) |
| 26508 |
|
| 26509 |
(define_insn "*movqicc_noc" |
| 26510 |
[(set (match_operand:QI 0 "register_operand" "=r,r,r") |
| 26511 |
(if_then_else:QI (match_operator 1 "ix86_comparison_operator" |
| 26512 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26513 |
(match_operand:QI 2 "register_operand" "r,0,r") |
| 26514 |
(match_operand:QI 3 "register_operand" "0,r,r")))] |
| 26515 |
"TARGET_CMOVE && !TARGET_PARTIAL_REG_STALL" |
| 26516 |
"#" |
| 26517 |
[(set_attr "isa" "*,*,apx_ndd") |
| 26518 |
(set_attr "type" "icmov") |
| 26519 |
(set_attr "mode" "QI")]) |
| 26520 |
|
| 26521 |
(define_split |
| 26522 |
[(set (match_operand:SWI12 0 "register_operand") |
| 26523 |
(if_then_else:SWI12 (match_operator 1 "ix86_comparison_operator" |
| 26524 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26525 |
(match_operand:SWI12 2 "register_operand") |
| 26526 |
(match_operand:SWI12 3 "register_operand")))] |
| 26527 |
"TARGET_CMOVE && !TARGET_PARTIAL_REG_STALL |
| 26528 |
&& reload_completed" |
| 26529 |
[(set (match_dup 0) |
| 26530 |
(if_then_else:SI (match_dup 1) (match_dup 2) (match_dup 3)))] |
| 26531 |
{ |
| 26532 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 26533 |
operands[2] = gen_lowpart (SImode, operands[2]); |
| 26534 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 26535 |
}) |
| 26536 |
|
| 26537 |
;; Don't do conditional moves with memory inputs |
| 26538 |
(define_peephole2 |
| 26539 |
[(match_scratch:SWI248 4 "r") |
| 26540 |
(set (match_operand:SWI248 0 "register_operand") |
| 26541 |
(if_then_else:SWI248 (match_operator 1 "ix86_comparison_operator" |
| 26542 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26543 |
(match_operand:SWI248 2 "nonimmediate_operand") |
| 26544 |
(match_operand:SWI248 3 "nonimmediate_operand")))] |
| 26545 |
"TARGET_CMOVE && TARGET_AVOID_MEM_OPND_FOR_CMOVE |
| 26546 |
&& (MEM_P (operands[2]) || MEM_P (operands[3])) |
| 26547 |
&& optimize_insn_for_speed_p ()" |
| 26548 |
[(set (match_dup 4) (match_dup 5)) |
| 26549 |
(set (match_dup 0) |
| 26550 |
(if_then_else:SWI248 (match_dup 1) (match_dup 2) (match_dup 3)))] |
| 26551 |
{ |
| 26552 |
if (MEM_P (operands[2])) |
| 26553 |
{ |
| 26554 |
operands[5] = operands[2]; |
| 26555 |
operands[2] = operands[4]; |
| 26556 |
} |
| 26557 |
else if (MEM_P (operands[3])) |
| 26558 |
{ |
| 26559 |
operands[5] = operands[3]; |
| 26560 |
operands[3] = operands[4]; |
| 26561 |
} |
| 26562 |
else |
| 26563 |
gcc_unreachable (); |
| 26564 |
}) |
| 26565 |
|
| 26566 |
(define_peephole2 |
| 26567 |
[(match_scratch:SI 4 "r") |
| 26568 |
(set (match_operand:DI 0 "register_operand") |
| 26569 |
(if_then_else:DI (match_operator 1 "ix86_comparison_operator" |
| 26570 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26571 |
(zero_extend:DI |
| 26572 |
(match_operand:SI 2 "nonimmediate_operand")) |
| 26573 |
(zero_extend:DI |
| 26574 |
(match_operand:SI 3 "nonimmediate_operand"))))] |
| 26575 |
"TARGET_64BIT |
| 26576 |
&& TARGET_CMOVE && TARGET_AVOID_MEM_OPND_FOR_CMOVE |
| 26577 |
&& (MEM_P (operands[2]) || MEM_P (operands[3])) |
| 26578 |
&& optimize_insn_for_speed_p ()" |
| 26579 |
[(set (match_dup 4) (match_dup 5)) |
| 26580 |
(set (match_dup 0) |
| 26581 |
(if_then_else:DI (match_dup 1) |
| 26582 |
(zero_extend:DI (match_dup 2)) |
| 26583 |
(zero_extend:DI (match_dup 3))))] |
| 26584 |
{ |
| 26585 |
if (MEM_P (operands[2])) |
| 26586 |
{ |
| 26587 |
operands[5] = operands[2]; |
| 26588 |
operands[2] = operands[4]; |
| 26589 |
} |
| 26590 |
else if (MEM_P (operands[3])) |
| 26591 |
{ |
| 26592 |
operands[5] = operands[3]; |
| 26593 |
operands[3] = operands[4]; |
| 26594 |
} |
| 26595 |
else |
| 26596 |
gcc_unreachable (); |
| 26597 |
}) |
| 26598 |
|
| 26599 |
;; Eliminate a reg-reg mov by inverting the condition of a cmov (#1). |
| 26600 |
;; mov r0,r1; dec r0; mov r2,r3; cmov r0,r2 -> dec r1; mov r0,r3; cmov r0, r1 |
| 26601 |
(define_peephole2 |
| 26602 |
[(set (match_operand:SWI248 0 "general_reg_operand") |
| 26603 |
(match_operand:SWI248 1 "general_reg_operand")) |
| 26604 |
(parallel [(set (reg FLAGS_REG) (match_operand 5)) |
| 26605 |
(set (match_dup 0) (match_operand:SWI248 6))]) |
| 26606 |
(set (match_operand:SWI248 2 "general_reg_operand") |
| 26607 |
(match_operand:SWI248 3 "general_gr_operand")) |
| 26608 |
(set (match_dup 0) |
| 26609 |
(if_then_else:SWI248 (match_operator 4 "ix86_comparison_operator" |
| 26610 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26611 |
(match_dup 0) |
| 26612 |
(match_dup 2)))] |
| 26613 |
"TARGET_CMOVE |
| 26614 |
&& REGNO (operands[2]) != REGNO (operands[0]) |
| 26615 |
&& REGNO (operands[2]) != REGNO (operands[1]) |
| 26616 |
&& peep2_reg_dead_p (1, operands[1]) |
| 26617 |
&& peep2_reg_dead_p (4, operands[2]) |
| 26618 |
&& !reg_overlap_mentioned_p (operands[0], operands[3])" |
| 26619 |
[(parallel [(set (match_dup 7) (match_dup 8)) |
| 26620 |
(set (match_dup 1) (match_dup 9))]) |
| 26621 |
(set (match_dup 0) (match_dup 3)) |
| 26622 |
(set (match_dup 0) (if_then_else:SWI248 (match_dup 4) |
| 26623 |
(match_dup 1) |
| 26624 |
(match_dup 0)))] |
| 26625 |
{ |
| 26626 |
operands[7] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (1)), 0, 0)); |
| 26627 |
operands[8] |
| 26628 |
= ix86_replace_reg_with_reg (operands[5], operands[0], operands[1]); |
| 26629 |
operands[9] |
| 26630 |
= ix86_replace_reg_with_reg (operands[6], operands[0], operands[1]); |
| 26631 |
}) |
| 26632 |
|
| 26633 |
;; Eliminate a reg-reg mov by inverting the condition of a cmov (#2). |
| 26634 |
;; mov r2,r3; mov r0,r1; dec r0; cmov r0,r2 -> dec r1; mov r0,r3; cmov r0, r1 |
| 26635 |
(define_peephole2 |
| 26636 |
[(set (match_operand:SWI248 2 "general_reg_operand") |
| 26637 |
(match_operand:SWI248 3 "general_gr_operand")) |
| 26638 |
(set (match_operand:SWI248 0 "general_reg_operand") |
| 26639 |
(match_operand:SWI248 1 "general_reg_operand")) |
| 26640 |
(parallel [(set (reg FLAGS_REG) (match_operand 5)) |
| 26641 |
(set (match_dup 0) (match_operand:SWI248 6))]) |
| 26642 |
(set (match_dup 0) |
| 26643 |
(if_then_else:SWI248 (match_operator 4 "ix86_comparison_operator" |
| 26644 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26645 |
(match_dup 0) |
| 26646 |
(match_dup 2)))] |
| 26647 |
"TARGET_CMOVE |
| 26648 |
&& REGNO (operands[2]) != REGNO (operands[0]) |
| 26649 |
&& REGNO (operands[2]) != REGNO (operands[1]) |
| 26650 |
&& peep2_reg_dead_p (2, operands[1]) |
| 26651 |
&& peep2_reg_dead_p (4, operands[2]) |
| 26652 |
&& !reg_overlap_mentioned_p (operands[0], operands[3]) |
| 26653 |
&& !reg_mentioned_p (operands[2], operands[6])" |
| 26654 |
[(parallel [(set (match_dup 7) (match_dup 8)) |
| 26655 |
(set (match_dup 1) (match_dup 9))]) |
| 26656 |
(set (match_dup 0) (match_dup 3)) |
| 26657 |
(set (match_dup 0) (if_then_else:SWI248 (match_dup 4) |
| 26658 |
(match_dup 1) |
| 26659 |
(match_dup 0)))] |
| 26660 |
{ |
| 26661 |
operands[7] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (2)), 0, 0)); |
| 26662 |
operands[8] |
| 26663 |
= ix86_replace_reg_with_reg (operands[5], operands[0], operands[1]); |
| 26664 |
operands[9] |
| 26665 |
= ix86_replace_reg_with_reg (operands[6], operands[0], operands[1]); |
| 26666 |
}) |
| 26667 |
|
| 26668 |
(define_insn "movhf_mask" |
| 26669 |
[(set (match_operand:HF 0 "nonimmediate_operand" "=v,m,v") |
| 26670 |
(unspec:HF |
| 26671 |
[(match_operand:HF 1 "nonimmediate_operand" "m,v,v") |
| 26672 |
(match_operand:HF 2 "nonimm_or_0_operand" "0C,0,0C") |
| 26673 |
(match_operand:QI 3 "register_operand" "Yk,Yk,Yk")] |
| 26674 |
UNSPEC_MOVCC_MASK))] |
| 26675 |
"TARGET_AVX512FP16" |
| 26676 |
"@ |
| 26677 |
vmovsh\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1} |
| 26678 |
vmovsh\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1} |
| 26679 |
vmovsh\t{%d1, %0%{%3%}%N2|%0%{%3%}%N2, %d1}" |
| 26680 |
[(set_attr "type" "ssemov") |
| 26681 |
(set_attr "prefix" "evex") |
| 26682 |
(set_attr "mode" "HF")]) |
| 26683 |
|
| 26684 |
(define_expand "movhfcc" |
| 26685 |
[(set (match_operand:HF 0 "register_operand") |
| 26686 |
(if_then_else:HF |
| 26687 |
(match_operand 1 "comparison_operator") |
| 26688 |
(match_operand:HF 2 "register_operand") |
| 26689 |
(match_operand:HF 3 "register_operand")))] |
| 26690 |
"TARGET_AVX512FP16" |
| 26691 |
"if (ix86_expand_fp_movcc (operands)) DONE; else FAIL;") |
| 26692 |
|
| 26693 |
(define_expand "mov<mode>cc" |
| 26694 |
[(set (match_operand:X87MODEF 0 "register_operand") |
| 26695 |
(if_then_else:X87MODEF |
| 26696 |
(match_operand 1 "comparison_operator") |
| 26697 |
(match_operand:X87MODEF 2 "register_operand") |
| 26698 |
(match_operand:X87MODEF 3 "register_operand")))] |
| 26699 |
"(TARGET_80387 && TARGET_CMOVE) |
| 26700 |
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)" |
| 26701 |
"if (ix86_expand_fp_movcc (operands)) DONE; else FAIL;") |
| 26702 |
|
| 26703 |
(define_insn "*movxfcc_1" |
| 26704 |
[(set (match_operand:XF 0 "register_operand" "=f,f") |
| 26705 |
(if_then_else:XF (match_operator 1 "fcmov_comparison_operator" |
| 26706 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26707 |
(match_operand:XF 2 "register_operand" "f,0") |
| 26708 |
(match_operand:XF 3 "register_operand" "0,f")))] |
| 26709 |
"TARGET_80387 && TARGET_CMOVE" |
| 26710 |
"@ |
| 26711 |
fcmov%F1\t{%2, %0|%0, %2} |
| 26712 |
fcmov%f1\t{%3, %0|%0, %3}" |
| 26713 |
[(set_attr "type" "fcmov") |
| 26714 |
(set_attr "mode" "XF")]) |
| 26715 |
|
| 26716 |
(define_insn "*movdfcc_1" |
| 26717 |
[(set (match_operand:DF 0 "register_operand" "=f,f,&r,&r,r ,r") |
| 26718 |
(if_then_else:DF (match_operator 1 "fcmov_comparison_operator" |
| 26719 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26720 |
(match_operand:DF 2 "nonimmediate_operand" |
| 26721 |
"f ,0,rm,0 ,rm,0") |
| 26722 |
(match_operand:DF 3 "nonimmediate_operand" |
| 26723 |
"0 ,f,0 ,rm,0, rm")))] |
| 26724 |
"TARGET_80387 && TARGET_CMOVE |
| 26725 |
&& !(MEM_P (operands[2]) && MEM_P (operands[3]))" |
| 26726 |
"@ |
| 26727 |
fcmov%F1\t{%2, %0|%0, %2} |
| 26728 |
fcmov%f1\t{%3, %0|%0, %3} |
| 26729 |
# |
| 26730 |
# |
| 26731 |
cmov%O2%C1\t{%2, %0|%0, %2} |
| 26732 |
cmov%O2%c1\t{%3, %0|%0, %3}" |
| 26733 |
[(set_attr "isa" "*,*,nox64,nox64,x64,x64") |
| 26734 |
(set_attr "type" "fcmov,fcmov,multi,multi,icmov,icmov") |
| 26735 |
(set_attr "mode" "DF,DF,DI,DI,DI,DI")]) |
| 26736 |
|
| 26737 |
(define_split |
| 26738 |
[(set (match_operand:DF 0 "general_reg_operand") |
| 26739 |
(if_then_else:DF (match_operator 1 "fcmov_comparison_operator" |
| 26740 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26741 |
(match_operand:DF 2 "nonimmediate_operand") |
| 26742 |
(match_operand:DF 3 "nonimmediate_operand")))] |
| 26743 |
"!TARGET_64BIT && reload_completed" |
| 26744 |
[(set (match_dup 2) |
| 26745 |
(if_then_else:SI (match_dup 1) (match_dup 4) (match_dup 5))) |
| 26746 |
(set (match_dup 3) |
| 26747 |
(if_then_else:SI (match_dup 1) (match_dup 6) (match_dup 7)))] |
| 26748 |
{ |
| 26749 |
split_double_mode (DImode, &operands[2], 2, &operands[4], &operands[6]); |
| 26750 |
split_double_mode (DImode, &operands[0], 1, &operands[2], &operands[3]); |
| 26751 |
}) |
| 26752 |
|
| 26753 |
(define_insn "*movsfcc_1_387" |
| 26754 |
[(set (match_operand:SF 0 "register_operand" "=f,f,r,r") |
| 26755 |
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator" |
| 26756 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26757 |
(match_operand:SF 2 "nonimmediate_operand" "f,0,rm,0") |
| 26758 |
(match_operand:SF 3 "nonimmediate_operand" "0,f,0,rm")))] |
| 26759 |
"TARGET_80387 && TARGET_CMOVE |
| 26760 |
&& !(MEM_P (operands[2]) && MEM_P (operands[3]))" |
| 26761 |
"@ |
| 26762 |
fcmov%F1\t{%2, %0|%0, %2} |
| 26763 |
fcmov%f1\t{%3, %0|%0, %3} |
| 26764 |
cmov%O2%C1\t{%2, %0|%0, %2} |
| 26765 |
cmov%O2%c1\t{%3, %0|%0, %3}" |
| 26766 |
[(set_attr "type" "fcmov,fcmov,icmov,icmov") |
| 26767 |
(set_attr "mode" "SF,SF,SI,SI")]) |
| 26768 |
|
| 26769 |
;; Don't do conditional moves with memory inputs. This splitter helps |
| 26770 |
;; register starved x86_32 by forcing inputs into registers before reload. |
| 26771 |
(define_split |
| 26772 |
[(set (match_operand:MODEF 0 "register_operand") |
| 26773 |
(if_then_else:MODEF (match_operator 1 "ix86_comparison_operator" |
| 26774 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26775 |
(match_operand:MODEF 2 "nonimmediate_operand") |
| 26776 |
(match_operand:MODEF 3 "nonimmediate_operand")))] |
| 26777 |
"!TARGET_64BIT && TARGET_80387 && TARGET_CMOVE |
| 26778 |
&& TARGET_AVOID_MEM_OPND_FOR_CMOVE |
| 26779 |
&& (MEM_P (operands[2]) || MEM_P (operands[3])) |
| 26780 |
&& can_create_pseudo_p () |
| 26781 |
&& optimize_insn_for_speed_p ()" |
| 26782 |
[(set (match_dup 0) |
| 26783 |
(if_then_else:MODEF (match_dup 1) (match_dup 2) (match_dup 3)))] |
| 26784 |
{ |
| 26785 |
operands[2] = force_reg (<MODE>mode, operands[2]); |
| 26786 |
operands[3] = force_reg (<MODE>mode, operands[3]); |
| 26787 |
}) |
| 26788 |
|
| 26789 |
;; Don't do conditional moves with memory inputs |
| 26790 |
(define_peephole2 |
| 26791 |
[(match_scratch:MODEF 4 "r") |
| 26792 |
(set (match_operand:MODEF 0 "general_reg_operand") |
| 26793 |
(if_then_else:MODEF (match_operator 1 "fcmov_comparison_operator" |
| 26794 |
[(reg FLAGS_REG) (const_int 0)]) |
| 26795 |
(match_operand:MODEF 2 "nonimmediate_operand") |
| 26796 |
(match_operand:MODEF 3 "nonimmediate_operand")))] |
| 26797 |
"(<MODE>mode != DFmode || TARGET_64BIT) |
| 26798 |
&& TARGET_80387 && TARGET_CMOVE |
| 26799 |
&& TARGET_AVOID_MEM_OPND_FOR_CMOVE |
| 26800 |
&& (MEM_P (operands[2]) || MEM_P (operands[3])) |
| 26801 |
&& optimize_insn_for_speed_p ()" |
| 26802 |
[(set (match_dup 4) (match_dup 5)) |
| 26803 |
(set (match_dup 0) |
| 26804 |
(if_then_else:MODEF (match_dup 1) (match_dup 2) (match_dup 3)))] |
| 26805 |
{ |
| 26806 |
if (MEM_P (operands[2])) |
| 26807 |
{ |
| 26808 |
operands[5] = operands[2]; |
| 26809 |
operands[2] = operands[4]; |
| 26810 |
} |
| 26811 |
else if (MEM_P (operands[3])) |
| 26812 |
{ |
| 26813 |
operands[5] = operands[3]; |
| 26814 |
operands[3] = operands[4]; |
| 26815 |
} |
| 26816 |
else |
| 26817 |
gcc_unreachable (); |
| 26818 |
}) |
| 26819 |
|
| 26820 |
;; All moves in XOP pcmov instructions are 128 bits and hence we restrict |
| 26821 |
;; the scalar versions to have only XMM registers as operands. |
| 26822 |
|
| 26823 |
;; XOP conditional move |
| 26824 |
(define_insn "*xop_pcmov_<mode>" |
| 26825 |
[(set (match_operand:MODEF 0 "register_operand" "=x") |
| 26826 |
(if_then_else:MODEF |
| 26827 |
(match_operand:MODEF 1 "register_operand" "x") |
| 26828 |
(match_operand:MODEF 2 "register_operand" "x") |
| 26829 |
(match_operand:MODEF 3 "register_operand" "x")))] |
| 26830 |
"TARGET_XOP" |
| 26831 |
"vpcmov\t{%1, %3, %2, %0|%0, %2, %3, %1}" |
| 26832 |
[(set_attr "type" "sse4arg") |
| 26833 |
(set_attr "mode" "TI")]) |
| 26834 |
|
| 26835 |
;; These versions of the min/max patterns are intentionally ignorant of |
| 26836 |
;; their behavior wrt -0.0 and NaN (via the commutative operand mark). |
| 26837 |
;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator |
| 26838 |
;; are undefined in this condition, we're certain this is correct. |
| 26839 |
|
| 26840 |
(define_insn "<code><mode>3" |
| 26841 |
[(set (match_operand:MODEF 0 "register_operand" "=x,v") |
| 26842 |
(smaxmin:MODEF |
| 26843 |
(match_operand:MODEF 1 "nonimmediate_operand" "%0,v") |
| 26844 |
(match_operand:MODEF 2 "nonimmediate_operand" "xm,vm")))] |
| 26845 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH" |
| 26846 |
"@ |
| 26847 |
<maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2} |
| 26848 |
v<maxmin_float><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}" |
| 26849 |
[(set_attr "isa" "noavx,avx") |
| 26850 |
(set_attr "prefix" "orig,vex") |
| 26851 |
(set_attr "c86_attr" "maxmin") |
| 26852 |
(set_attr "type" "sseadd") |
| 26853 |
(set_attr "mode" "<MODE>")]) |
| 26854 |
|
| 26855 |
(define_insn "<code>hf3" |
| 26856 |
[(set (match_operand:HF 0 "register_operand" "=v") |
| 26857 |
(smaxmin:HF |
| 26858 |
(match_operand:HF 1 "nonimmediate_operand" "%v") |
| 26859 |
(match_operand:HF 2 "nonimmediate_operand" "vm")))] |
| 26860 |
"TARGET_AVX512FP16" |
| 26861 |
"v<maxmin_float>sh\t{%2, %1, %0|%0, %1, %2}" |
| 26862 |
[(set_attr "prefix" "evex") |
| 26863 |
(set_attr "type" "sseadd") |
| 26864 |
(set_attr "mode" "HF")]) |
| 26865 |
|
| 26866 |
;; These versions of the min/max patterns implement exactly the operations |
| 26867 |
;; min = (op1 < op2 ? op1 : op2) |
| 26868 |
;; max = (!(op1 < op2) ? op1 : op2) |
| 26869 |
;; Their operands are not commutative, and thus they may be used in the |
| 26870 |
;; presence of -0.0 and NaN. |
| 26871 |
|
| 26872 |
(define_insn "*ieee_s<ieee_maxmin>hf3" |
| 26873 |
[(set (match_operand:HF 0 "register_operand" "=v") |
| 26874 |
(unspec:HF |
| 26875 |
[(match_operand:HF 1 "register_operand" "v") |
| 26876 |
(match_operand:HF 2 "nonimmediate_operand" "vm")] |
| 26877 |
IEEE_MAXMIN))] |
| 26878 |
"TARGET_AVX512FP16" |
| 26879 |
"v<ieee_maxmin>sh\t{%2, %1, %0|%0, %1, %2}" |
| 26880 |
[(set_attr "prefix" "evex") |
| 26881 |
(set_attr "type" "sseadd") |
| 26882 |
(set_attr "mode" "HF")]) |
| 26883 |
|
| 26884 |
(define_insn "*ieee_s<ieee_maxmin><mode>3" |
| 26885 |
[(set (match_operand:MODEF 0 "register_operand" "=x,v") |
| 26886 |
(unspec:MODEF |
| 26887 |
[(match_operand:MODEF 1 "register_operand" "0,v") |
| 26888 |
(match_operand:MODEF 2 "nonimmediate_operand" "xm,vm")] |
| 26889 |
IEEE_MAXMIN))] |
| 26890 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH" |
| 26891 |
"@ |
| 26892 |
<ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2} |
| 26893 |
v<ieee_maxmin><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}" |
| 26894 |
[(set_attr "isa" "noavx,avx") |
| 26895 |
(set_attr "prefix" "orig,maybe_evex") |
| 26896 |
(set_attr "c86_attr" "maxmin") |
| 26897 |
(set_attr "type" "sseadd") |
| 26898 |
(set_attr "mode" "<MODE>")]) |
| 26899 |
|
| 26900 |
;; Operands order in min/max instruction matters for signed zero and NANs. |
| 26901 |
(define_insn_and_split "*ieee_max<mode>3_1" |
| 26902 |
[(set (match_operand:MODEF 0 "register_operand") |
| 26903 |
(unspec:MODEF |
| 26904 |
[(match_operand:MODEF 1 "register_operand") |
| 26905 |
(match_operand:MODEF 2 "register_operand") |
| 26906 |
(lt:MODEF |
| 26907 |
(match_operand:MODEF 3 "register_operand") |
| 26908 |
(match_operand:MODEF 4 "register_operand"))] |
| 26909 |
UNSPEC_BLENDV))] |
| 26910 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 26911 |
&& (rtx_equal_p (operands[1], operands[3]) |
| 26912 |
&& rtx_equal_p (operands[2], operands[4])) |
| 26913 |
&& ix86_pre_reload_split ()" |
| 26914 |
"#" |
| 26915 |
"&& 1" |
| 26916 |
[(set (match_dup 0) |
| 26917 |
(unspec:MODEF |
| 26918 |
[(match_dup 2) |
| 26919 |
(match_dup 1)] |
| 26920 |
UNSPEC_IEEE_MAX))]) |
| 26921 |
|
| 26922 |
(define_insn_and_split "*ieee_min<mode>3_1" |
| 26923 |
[(set (match_operand:MODEF 0 "register_operand") |
| 26924 |
(unspec:MODEF |
| 26925 |
[(match_operand:MODEF 1 "register_operand") |
| 26926 |
(match_operand:MODEF 2 "register_operand") |
| 26927 |
(lt:MODEF |
| 26928 |
(match_operand:MODEF 3 "register_operand") |
| 26929 |
(match_operand:MODEF 4 "register_operand"))] |
| 26930 |
UNSPEC_BLENDV))] |
| 26931 |
"SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH |
| 26932 |
&& (rtx_equal_p (operands[1], operands[4]) |
| 26933 |
&& rtx_equal_p (operands[2], operands[3])) |
| 26934 |
&& ix86_pre_reload_split ()" |
| 26935 |
"#" |
| 26936 |
"&& 1" |
| 26937 |
[(set (match_dup 0) |
| 26938 |
(unspec:MODEF |
| 26939 |
[(match_dup 2) |
| 26940 |
(match_dup 1)] |
| 26941 |
UNSPEC_IEEE_MIN))]) |
| 26942 |
|
| 26943 |
;; Make two stack loads independent: |
| 26944 |
;; fld aa fld aa |
| 26945 |
;; fld %st(0) -> fld bb |
| 26946 |
;; fmul bb fmul %st(1), %st |
| 26947 |
;; |
| 26948 |
;; Actually we only match the last two instructions for simplicity. |
| 26949 |
|
| 26950 |
(define_peephole2 |
| 26951 |
[(set (match_operand 0 "fp_register_operand") |
| 26952 |
(match_operand 1 "fp_register_operand")) |
| 26953 |
(set (match_dup 0) |
| 26954 |
(match_operator 2 "binary_fp_operator" |
| 26955 |
[(match_dup 0) |
| 26956 |
(match_operand 3 "memory_operand")]))] |
| 26957 |
"REGNO (operands[0]) != REGNO (operands[1])" |
| 26958 |
[(set (match_dup 0) (match_dup 3)) |
| 26959 |
(set (match_dup 0) |
| 26960 |
(match_op_dup 2 |
| 26961 |
[(match_dup 5) (match_dup 4)]))] |
| 26962 |
{ |
| 26963 |
operands[4] = operands[0]; |
| 26964 |
operands[5] = operands[1]; |
| 26965 |
|
| 26966 |
/* The % modifier is not operational anymore in peephole2's, so we have to |
| 26967 |
swap the operands manually in the case of addition and multiplication. */ |
| 26968 |
if (COMMUTATIVE_ARITH_P (operands[2])) |
| 26969 |
std::swap (operands[4], operands[5]); |
| 26970 |
}) |
| 26971 |
|
| 26972 |
(define_peephole2 |
| 26973 |
[(set (match_operand 0 "fp_register_operand") |
| 26974 |
(match_operand 1 "fp_register_operand")) |
| 26975 |
(set (match_dup 0) |
| 26976 |
(match_operator 2 "binary_fp_operator" |
| 26977 |
[(match_operand 3 "memory_operand") |
| 26978 |
(match_dup 0)]))] |
| 26979 |
"REGNO (operands[0]) != REGNO (operands[1])" |
| 26980 |
[(set (match_dup 0) (match_dup 3)) |
| 26981 |
(set (match_dup 0) |
| 26982 |
(match_op_dup 2 |
| 26983 |
[(match_dup 4) (match_dup 5)]))] |
| 26984 |
{ |
| 26985 |
operands[4] = operands[0]; |
| 26986 |
operands[5] = operands[1]; |
| 26987 |
|
| 26988 |
/* The % modifier is not operational anymore in peephole2's, so we have to |
| 26989 |
swap the operands manually in the case of addition and multiplication. */ |
| 26990 |
if (COMMUTATIVE_ARITH_P (operands[2])) |
| 26991 |
std::swap (operands[4], operands[5]); |
| 26992 |
}) |
| 26993 |
|
| 26994 |
;; Conditional addition patterns |
| 26995 |
(define_expand "add<mode>cc" |
| 26996 |
[(match_operand:SWI 0 "register_operand") |
| 26997 |
(match_operand 1 "ordered_comparison_operator") |
| 26998 |
(match_operand:SWI 2 "register_operand") |
| 26999 |
(match_operand:SWI 3 "const_int_operand")] |
| 27000 |
"" |
| 27001 |
"if (ix86_expand_int_addcc (operands)) DONE; else FAIL;") |
| 27002 |
|
| 27003 |
;; min/max patterns |
| 27004 |
|
| 27005 |
(define_code_attr maxmin_rel |
| 27006 |
[(smax "GE") (smin "LE") (umax "GEU") (umin "LEU")]) |
| 27007 |
|
| 27008 |
(define_expand "<code><mode>3" |
| 27009 |
[(parallel |
| 27010 |
[(set (match_operand:SDWIM 0 "register_operand") |
| 27011 |
(maxmin:SDWIM |
| 27012 |
(match_operand:SDWIM 1 "register_operand") |
| 27013 |
(match_operand:SDWIM 2 "general_operand"))) |
| 27014 |
(clobber (reg:CC FLAGS_REG))])] |
| 27015 |
"TARGET_CMOVE |
| 27016 |
&& (<MODE>mode != QImode || !TARGET_PARTIAL_REG_STALL)") |
| 27017 |
|
| 27018 |
(define_insn_and_split "*<code><dwi>3_doubleword" |
| 27019 |
[(set (match_operand:<DWI> 0 "register_operand") |
| 27020 |
(maxmin:<DWI> |
| 27021 |
(match_operand:<DWI> 1 "register_operand") |
| 27022 |
(match_operand:<DWI> 2 "general_operand"))) |
| 27023 |
(clobber (reg:CC FLAGS_REG))] |
| 27024 |
"TARGET_CMOVE |
| 27025 |
&& ix86_pre_reload_split ()" |
| 27026 |
"#" |
| 27027 |
"&& 1" |
| 27028 |
[(set (match_dup 0) |
| 27029 |
(if_then_else:DWIH (match_dup 6) |
| 27030 |
(match_dup 1) |
| 27031 |
(match_dup 2))) |
| 27032 |
(set (match_dup 3) |
| 27033 |
(if_then_else:DWIH (match_dup 6) |
| 27034 |
(match_dup 4) |
| 27035 |
(match_dup 5)))] |
| 27036 |
{ |
| 27037 |
operands[2] = force_reg (<DWI>mode, operands[2]); |
| 27038 |
|
| 27039 |
split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]); |
| 27040 |
|
| 27041 |
rtx cmplo[2] = { operands[1], operands[2] }; |
| 27042 |
rtx cmphi[2] = { operands[4], operands[5] }; |
| 27043 |
|
| 27044 |
enum rtx_code code = <maxmin_rel>; |
| 27045 |
|
| 27046 |
switch (code) |
| 27047 |
{ |
| 27048 |
case LE: case LEU: |
| 27049 |
std::swap (cmplo[0], cmplo[1]); |
| 27050 |
std::swap (cmphi[0], cmphi[1]); |
| 27051 |
code = swap_condition (code); |
| 27052 |
/* FALLTHRU */ |
| 27053 |
|
| 27054 |
case GE: case GEU: |
| 27055 |
{ |
| 27056 |
bool uns = (code == GEU); |
| 27057 |
rtx (*sbb_insn) (machine_mode, rtx, rtx, rtx) |
| 27058 |
= uns ? gen_sub3_carry_ccc : gen_sub3_carry_ccgz; |
| 27059 |
|
| 27060 |
emit_insn (gen_cmp_1 (<MODE>mode, cmplo[0], cmplo[1])); |
| 27061 |
|
| 27062 |
rtx tmp = gen_rtx_SCRATCH (<MODE>mode); |
| 27063 |
emit_insn (sbb_insn (<MODE>mode, tmp, cmphi[0], cmphi[1])); |
| 27064 |
|
| 27065 |
rtx flags = gen_rtx_REG (uns ? CCCmode : CCGZmode, FLAGS_REG); |
| 27066 |
operands[6] = gen_rtx_fmt_ee (code, VOIDmode, flags, const0_rtx); |
| 27067 |
|
| 27068 |
break; |
| 27069 |
} |
| 27070 |
|
| 27071 |
default: |
| 27072 |
gcc_unreachable (); |
| 27073 |
} |
| 27074 |
}) |
| 27075 |
|
| 27076 |
(define_insn_and_split "*<code><mode>3_1" |
| 27077 |
[(set (match_operand:SWI 0 "register_operand") |
| 27078 |
(maxmin:SWI |
| 27079 |
(match_operand:SWI 1 "register_operand") |
| 27080 |
(match_operand:SWI 2 "general_operand"))) |
| 27081 |
(clobber (reg:CC FLAGS_REG))] |
| 27082 |
"TARGET_CMOVE |
| 27083 |
&& (<MODE>mode != QImode || !TARGET_PARTIAL_REG_STALL) |
| 27084 |
&& ix86_pre_reload_split ()" |
| 27085 |
"#" |
| 27086 |
"&& 1" |
| 27087 |
[(set (match_dup 0) |
| 27088 |
(if_then_else:SWI (match_dup 3) |
| 27089 |
(match_dup 1) |
| 27090 |
(match_dup 2)))] |
| 27091 |
{ |
| 27092 |
machine_mode mode = <MODE>mode; |
| 27093 |
rtx cmp_op = operands[2]; |
| 27094 |
|
| 27095 |
operands[2] = force_reg (mode, cmp_op); |
| 27096 |
|
| 27097 |
enum rtx_code code = <maxmin_rel>; |
| 27098 |
|
| 27099 |
if (cmp_op == const1_rtx) |
| 27100 |
{ |
| 27101 |
/* Convert smax (x, 1) into (x > 0 ? x : 1). |
| 27102 |
Convert umax (x, 1) into (x != 0 ? x : 1). |
| 27103 |
Convert ?min (x, 1) into (x <= 0 ? x : 1). */ |
| 27104 |
cmp_op = const0_rtx; |
| 27105 |
if (code == GE) |
| 27106 |
code = GT; |
| 27107 |
else if (code == GEU) |
| 27108 |
code = NE; |
| 27109 |
} |
| 27110 |
/* Convert smin (x, -1) into (x < 0 ? x : -1). */ |
| 27111 |
else if (cmp_op == constm1_rtx && code == LE) |
| 27112 |
{ |
| 27113 |
cmp_op = const0_rtx; |
| 27114 |
code = LT; |
| 27115 |
} |
| 27116 |
/* Convert smax (x, -1) into (x >= 0 ? x : -1). */ |
| 27117 |
else if (cmp_op == constm1_rtx && code == GE) |
| 27118 |
cmp_op = const0_rtx; |
| 27119 |
else if (cmp_op != const0_rtx) |
| 27120 |
cmp_op = operands[2]; |
| 27121 |
|
| 27122 |
machine_mode cmpmode = SELECT_CC_MODE (code, operands[1], cmp_op); |
| 27123 |
rtx flags = gen_rtx_REG (cmpmode, FLAGS_REG); |
| 27124 |
|
| 27125 |
rtx tmp = gen_rtx_COMPARE (cmpmode, operands[1], cmp_op); |
| 27126 |
emit_insn (gen_rtx_SET (flags, tmp)); |
| 27127 |
|
| 27128 |
operands[3] = gen_rtx_fmt_ee (code, VOIDmode, flags, const0_rtx); |
| 27129 |
}) |
| 27130 |
|
| 27131 |
;; Avoid clearing a register between a flags setting comparison and its use, |
| 27132 |
;; i.e. prefer "xorl %eax,%eax; test/cmp" over "test/cmp; movl $0, %eax". |
| 27133 |
(define_peephole2 |
| 27134 |
[(set (reg FLAGS_REG) (match_operand 0)) |
| 27135 |
(set (match_operand:SWI 1 "general_reg_operand") (const_int 0))] |
| 27136 |
"peep2_regno_dead_p (0, FLAGS_REG) |
| 27137 |
&& !reg_overlap_mentioned_p (operands[1], operands[0])" |
| 27138 |
[(set (match_dup 2) (match_dup 0))] |
| 27139 |
{ |
| 27140 |
operands[2] = gen_rtx_REG (GET_MODE (operands[0]), FLAGS_REG); |
| 27141 |
ix86_expand_clear (operands[1]); |
| 27142 |
}) |
| 27143 |
|
| 27144 |
;; When optimizing for size, zeroing memory should use a register. |
| 27145 |
(define_peephole2 |
| 27146 |
[(match_scratch:SWI48 0 "r") |
| 27147 |
(set (match_operand:SWI48 1 "memory_operand") (const_int 0)) |
| 27148 |
(set (match_operand:SWI48 2 "memory_operand") (const_int 0)) |
| 27149 |
(set (match_operand:SWI48 3 "memory_operand") (const_int 0)) |
| 27150 |
(set (match_operand:SWI48 4 "memory_operand") (const_int 0))] |
| 27151 |
"optimize_insn_for_size_p () && peep2_regno_dead_p (0, FLAGS_REG)" |
| 27152 |
[(const_int 0)] |
| 27153 |
{ |
| 27154 |
ix86_expand_clear (operands[0]); |
| 27155 |
emit_move_insn (operands[1], operands[0]); |
| 27156 |
emit_move_insn (operands[2], operands[0]); |
| 27157 |
emit_move_insn (operands[3], operands[0]); |
| 27158 |
ix86_last_zero_store_uid |
| 27159 |
= INSN_UID (emit_move_insn (operands[4], operands[0])); |
| 27160 |
DONE; |
| 27161 |
}) |
| 27162 |
|
| 27163 |
(define_peephole2 |
| 27164 |
[(match_scratch:SWI48 0 "r") |
| 27165 |
(set (match_operand:SWI48 1 "memory_operand") (const_int 0)) |
| 27166 |
(set (match_operand:SWI48 2 "memory_operand") (const_int 0))] |
| 27167 |
"optimize_insn_for_size_p () && peep2_regno_dead_p (0, FLAGS_REG)" |
| 27168 |
[(const_int 0)] |
| 27169 |
{ |
| 27170 |
ix86_expand_clear (operands[0]); |
| 27171 |
emit_move_insn (operands[1], operands[0]); |
| 27172 |
ix86_last_zero_store_uid |
| 27173 |
= INSN_UID (emit_move_insn (operands[2], operands[0])); |
| 27174 |
DONE; |
| 27175 |
}) |
| 27176 |
|
| 27177 |
(define_peephole2 |
| 27178 |
[(match_scratch:SWI48 0 "r") |
| 27179 |
(set (match_operand:SWI48 1 "memory_operand") (const_int 0))] |
| 27180 |
"optimize_insn_for_size_p () && peep2_regno_dead_p (0, FLAGS_REG)" |
| 27181 |
[(const_int 0)] |
| 27182 |
{ |
| 27183 |
ix86_expand_clear (operands[0]); |
| 27184 |
ix86_last_zero_store_uid |
| 27185 |
= INSN_UID (emit_move_insn (operands[1], operands[0])); |
| 27186 |
DONE; |
| 27187 |
}) |
| 27188 |
|
| 27189 |
(define_peephole2 |
| 27190 |
[(set (match_operand:SWI48 5 "memory_operand") |
| 27191 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 27192 |
(set (match_operand:SWI48 1 "memory_operand") (const_int 0)) |
| 27193 |
(set (match_operand:SWI48 2 "memory_operand") (const_int 0)) |
| 27194 |
(set (match_operand:SWI48 3 "memory_operand") (const_int 0)) |
| 27195 |
(set (match_operand:SWI48 4 "memory_operand") (const_int 0))] |
| 27196 |
"optimize_insn_for_size_p () |
| 27197 |
&& INSN_UID (peep2_next_insn (0)) == ix86_last_zero_store_uid" |
| 27198 |
[(const_int 0)] |
| 27199 |
{ |
| 27200 |
emit_move_insn (operands[5], operands[0]); |
| 27201 |
emit_move_insn (operands[1], operands[0]); |
| 27202 |
emit_move_insn (operands[2], operands[0]); |
| 27203 |
emit_move_insn (operands[3], operands[0]); |
| 27204 |
ix86_last_zero_store_uid |
| 27205 |
= INSN_UID (emit_move_insn (operands[4], operands[0])); |
| 27206 |
DONE; |
| 27207 |
}) |
| 27208 |
|
| 27209 |
(define_peephole2 |
| 27210 |
[(set (match_operand:SWI48 3 "memory_operand") |
| 27211 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 27212 |
(set (match_operand:SWI48 1 "memory_operand") (const_int 0)) |
| 27213 |
(set (match_operand:SWI48 2 "memory_operand") (const_int 0))] |
| 27214 |
"optimize_insn_for_size_p () |
| 27215 |
&& INSN_UID (peep2_next_insn (0)) == ix86_last_zero_store_uid" |
| 27216 |
[(const_int 0)] |
| 27217 |
{ |
| 27218 |
emit_move_insn (operands[3], operands[0]); |
| 27219 |
emit_move_insn (operands[1], operands[0]); |
| 27220 |
ix86_last_zero_store_uid |
| 27221 |
= INSN_UID (emit_move_insn (operands[2], operands[0])); |
| 27222 |
DONE; |
| 27223 |
}) |
| 27224 |
|
| 27225 |
(define_peephole2 |
| 27226 |
[(set (match_operand:SWI48 2 "memory_operand") |
| 27227 |
(match_operand:SWI48 0 "general_reg_operand")) |
| 27228 |
(set (match_operand:SWI48 1 "memory_operand") (const_int 0))] |
| 27229 |
"optimize_insn_for_size_p () |
| 27230 |
&& INSN_UID (peep2_next_insn (0)) == ix86_last_zero_store_uid" |
| 27231 |
[(const_int 0)] |
| 27232 |
{ |
| 27233 |
emit_move_insn (operands[2], operands[0]); |
| 27234 |
ix86_last_zero_store_uid |
| 27235 |
= INSN_UID (emit_move_insn (operands[1], operands[0])); |
| 27236 |
DONE; |
| 27237 |
}) |
| 27238 |
|
| 27239 |
;; Reload dislikes loading constants directly into class_likely_spilled |
| 27240 |
;; hard registers. Try to tidy things up here. |
| 27241 |
(define_peephole2 |
| 27242 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 27243 |
(match_operand:SWI 1 "x86_64_general_operand")) |
| 27244 |
(set (match_operand:SWI 2 "general_reg_operand") |
| 27245 |
(match_dup 0))] |
| 27246 |
"peep2_reg_dead_p (2, operands[0])" |
| 27247 |
[(set (match_dup 2) (match_dup 1))]) |
| 27248 |
|
| 27249 |
;; Misc patterns (?) |
| 27250 |
|
| 27251 |
;; This pattern exists to put a dependency on all ebp-based memory accesses. |
| 27252 |
;; Otherwise there will be nothing to keep |
| 27253 |
;; |
| 27254 |
;; [(set (reg ebp) (reg esp))] |
| 27255 |
;; [(set (reg esp) (plus (reg esp) (const_int -160000))) |
| 27256 |
;; (clobber (eflags)] |
| 27257 |
;; [(set (mem (plus (reg ebp) (const_int -160000))) (const_int 0))] |
| 27258 |
;; |
| 27259 |
;; in proper program order. |
| 27260 |
|
| 27261 |
(define_insn "@pro_epilogue_adjust_stack_add_<mode>" |
| 27262 |
[(set (match_operand:P 0 "register_operand" "=r,r") |
| 27263 |
(plus:P (match_operand:P 1 "register_operand" "0,r") |
| 27264 |
(match_operand:P 2 "<nonmemory_operand>" "r<i>,l<i>"))) |
| 27265 |
(clobber (reg:CC FLAGS_REG)) |
| 27266 |
(clobber (mem:BLK (scratch)))] |
| 27267 |
"" |
| 27268 |
{ |
| 27269 |
switch (get_attr_type (insn)) |
| 27270 |
{ |
| 27271 |
case TYPE_IMOV: |
| 27272 |
return "mov{<imodesuffix>}\t{%1, %0|%0, %1}"; |
| 27273 |
|
| 27274 |
case TYPE_ALU: |
| 27275 |
gcc_assert (rtx_equal_p (operands[0], operands[1])); |
| 27276 |
if (x86_maybe_negate_const_int (&operands[2], <MODE>mode)) |
| 27277 |
return "sub{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 27278 |
|
| 27279 |
return "add{<imodesuffix>}\t{%2, %0|%0, %2}"; |
| 27280 |
|
| 27281 |
default: |
| 27282 |
operands[2] = SET_SRC (XVECEXP (PATTERN (insn), 0, 0)); |
| 27283 |
return "lea{<imodesuffix>}\t{%E2, %0|%0, %E2}"; |
| 27284 |
} |
| 27285 |
} |
| 27286 |
[(set (attr "type") |
| 27287 |
(cond [(and (eq_attr "alternative" "0") |
| 27288 |
(not (match_test "TARGET_OPT_AGU"))) |
| 27289 |
(const_string "alu") |
| 27290 |
(match_operand:<MODE> 2 "const0_operand") |
| 27291 |
(const_string "imov") |
| 27292 |
] |
| 27293 |
(const_string "lea"))) |
| 27294 |
(set (attr "length_immediate") |
| 27295 |
(cond [(eq_attr "type" "imov") |
| 27296 |
(const_string "0") |
| 27297 |
(and (eq_attr "type" "alu") |
| 27298 |
(match_operand 2 "const128_operand")) |
| 27299 |
(const_string "1") |
| 27300 |
] |
| 27301 |
(const_string "*"))) |
| 27302 |
(set_attr "mode" "<MODE>")]) |
| 27303 |
|
| 27304 |
(define_insn "@pro_epilogue_adjust_stack_sub_<mode>" |
| 27305 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 27306 |
(minus:P (match_operand:P 1 "register_operand" "0") |
| 27307 |
(match_operand:P 2 "register_operand" "r"))) |
| 27308 |
(clobber (reg:CC FLAGS_REG)) |
| 27309 |
(clobber (mem:BLK (scratch)))] |
| 27310 |
"" |
| 27311 |
"sub{<imodesuffix>}\t{%2, %0|%0, %2}" |
| 27312 |
[(set_attr "type" "alu") |
| 27313 |
(set_attr "mode" "<MODE>")]) |
| 27314 |
|
| 27315 |
(define_insn "@allocate_stack_worker_probe_<mode>" |
| 27316 |
[(set (match_operand:P 0 "register_operand" "=a") |
| 27317 |
(unspec_volatile:P [(match_operand:P 1 "register_operand" "0")] |
| 27318 |
UNSPECV_STACK_PROBE)) |
| 27319 |
(clobber (reg:CC FLAGS_REG))] |
| 27320 |
"ix86_target_stack_probe ()" |
| 27321 |
"call\t___chkstk_ms" |
| 27322 |
[(set_attr "type" "multi") |
| 27323 |
(set_attr "length" "5")]) |
| 27324 |
|
| 27325 |
(define_expand "allocate_stack" |
| 27326 |
[(match_operand 0 "register_operand") |
| 27327 |
(match_operand 1 "general_operand")] |
| 27328 |
"ix86_target_stack_probe ()" |
| 27329 |
{ |
| 27330 |
rtx x; |
| 27331 |
|
| 27332 |
#ifndef CHECK_STACK_LIMIT |
| 27333 |
#define CHECK_STACK_LIMIT 0 |
| 27334 |
#endif |
| 27335 |
|
| 27336 |
if (CHECK_STACK_LIMIT && CONST_INT_P (operands[1]) |
| 27337 |
&& INTVAL (operands[1]) < CHECK_STACK_LIMIT) |
| 27338 |
x = operands[1]; |
| 27339 |
else |
| 27340 |
{ |
| 27341 |
x = copy_to_mode_reg (Pmode, operands[1]); |
| 27342 |
|
| 27343 |
emit_insn (gen_allocate_stack_worker_probe (Pmode, x, x)); |
| 27344 |
} |
| 27345 |
|
| 27346 |
x = expand_simple_binop (Pmode, MINUS, stack_pointer_rtx, x, |
| 27347 |
stack_pointer_rtx, 0, OPTAB_DIRECT); |
| 27348 |
|
| 27349 |
if (x != stack_pointer_rtx) |
| 27350 |
emit_move_insn (stack_pointer_rtx, x); |
| 27351 |
|
| 27352 |
emit_move_insn (operands[0], virtual_stack_dynamic_rtx); |
| 27353 |
DONE; |
| 27354 |
}) |
| 27355 |
|
| 27356 |
(define_expand "probe_stack" |
| 27357 |
[(match_operand 0 "memory_operand")] |
| 27358 |
"" |
| 27359 |
{ |
| 27360 |
emit_insn (gen_probe_stack_1 |
| 27361 |
(word_mode, operands[0], const0_rtx)); |
| 27362 |
DONE; |
| 27363 |
}) |
| 27364 |
|
| 27365 |
;; Use OR for stack probes, this is shorter. |
| 27366 |
(define_insn "@probe_stack_1_<mode>" |
| 27367 |
[(set (match_operand:W 0 "memory_operand" "=m") |
| 27368 |
(unspec:W [(match_operand:W 1 "const0_operand")] |
| 27369 |
UNSPEC_PROBE_STACK)) |
| 27370 |
(clobber (reg:CC FLAGS_REG))] |
| 27371 |
"" |
| 27372 |
"or{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 27373 |
[(set_attr "type" "alu1") |
| 27374 |
(set_attr "mode" "<MODE>") |
| 27375 |
(set_attr "length_immediate" "1")]) |
| 27376 |
|
| 27377 |
(define_insn "@adjust_stack_and_probe_<mode>" |
| 27378 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 27379 |
(unspec_volatile:P [(match_operand:P 1 "register_operand" "0")] |
| 27380 |
UNSPECV_PROBE_STACK_RANGE)) |
| 27381 |
(set (reg:P SP_REG) |
| 27382 |
(minus:P (reg:P SP_REG) (match_operand:P 2 "const_int_operand"))) |
| 27383 |
(clobber (reg:CC FLAGS_REG)) |
| 27384 |
(clobber (mem:BLK (scratch)))] |
| 27385 |
"" |
| 27386 |
"* return output_adjust_stack_and_probe (operands[0]);" |
| 27387 |
[(set_attr "type" "multi")]) |
| 27388 |
|
| 27389 |
(define_insn "@probe_stack_range_<mode>" |
| 27390 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 27391 |
(unspec_volatile:P [(match_operand:P 1 "register_operand" "0") |
| 27392 |
(match_operand:P 2 "const_int_operand")] |
| 27393 |
UNSPECV_PROBE_STACK_RANGE)) |
| 27394 |
(clobber (reg:CC FLAGS_REG))] |
| 27395 |
"" |
| 27396 |
"* return output_probe_stack_range (operands[0], operands[2]);" |
| 27397 |
[(set_attr "type" "multi")]) |
| 27398 |
|
| 27399 |
(define_expand "builtin_setjmp_receiver" |
| 27400 |
[(label_ref (match_operand 0))] |
| 27401 |
"!TARGET_64BIT && flag_pic" |
| 27402 |
{ |
| 27403 |
#if TARGET_MACHO |
| 27404 |
if (TARGET_MACHO) |
| 27405 |
{ |
| 27406 |
rtx xops[3]; |
| 27407 |
rtx_code_label *label_rtx = gen_label_rtx (); |
| 27408 |
emit_insn (gen_set_got_labelled (pic_offset_table_rtx, label_rtx)); |
| 27409 |
xops[0] = xops[1] = pic_offset_table_rtx; |
| 27410 |
xops[2] = machopic_gen_offset (gen_rtx_LABEL_REF (SImode, label_rtx)); |
| 27411 |
ix86_expand_binary_operator (MINUS, SImode, xops); |
| 27412 |
} |
| 27413 |
else |
| 27414 |
#endif |
| 27415 |
emit_insn (gen_set_got (pic_offset_table_rtx)); |
| 27416 |
DONE; |
| 27417 |
}) |
| 27418 |
|
| 27419 |
(define_expand "save_stack_nonlocal" |
| 27420 |
[(set (match_operand 0 "memory_operand") |
| 27421 |
(match_operand 1 "register_operand"))] |
| 27422 |
"" |
| 27423 |
{ |
| 27424 |
rtx stack_slot; |
| 27425 |
|
| 27426 |
if (flag_cf_protection & CF_RETURN) |
| 27427 |
{ |
| 27428 |
/* Copy shadow stack pointer to the first slot |
| 27429 |
and stack pointer to the second slot. */ |
| 27430 |
rtx ssp_slot = adjust_address (operands[0], word_mode, 0); |
| 27431 |
stack_slot = adjust_address (operands[0], Pmode, UNITS_PER_WORD); |
| 27432 |
|
| 27433 |
rtx reg_ssp = force_reg (word_mode, const0_rtx); |
| 27434 |
emit_insn (gen_rdssp (word_mode, reg_ssp, reg_ssp)); |
| 27435 |
emit_move_insn (ssp_slot, reg_ssp); |
| 27436 |
} |
| 27437 |
else |
| 27438 |
stack_slot = adjust_address (operands[0], Pmode, 0); |
| 27439 |
emit_move_insn (stack_slot, operands[1]); |
| 27440 |
DONE; |
| 27441 |
}) |
| 27442 |
|
| 27443 |
(define_expand "restore_stack_nonlocal" |
| 27444 |
[(set (match_operand 0 "register_operand" "") |
| 27445 |
(match_operand 1 "memory_operand" ""))] |
| 27446 |
"" |
| 27447 |
{ |
| 27448 |
rtx stack_slot; |
| 27449 |
|
| 27450 |
if (flag_cf_protection & CF_RETURN) |
| 27451 |
{ |
| 27452 |
/* Restore shadow stack pointer from the first slot |
| 27453 |
and stack pointer from the second slot. */ |
| 27454 |
rtx ssp_slot = adjust_address (operands[1], word_mode, 0); |
| 27455 |
stack_slot = adjust_address (operands[1], Pmode, UNITS_PER_WORD); |
| 27456 |
|
| 27457 |
/* Get the current shadow stack pointer. The code below will check if |
| 27458 |
SHSTK feature is enabled. If it is not enabled the RDSSP instruction |
| 27459 |
is a NOP. */ |
| 27460 |
rtx reg_ssp = force_reg (word_mode, const0_rtx); |
| 27461 |
emit_insn (gen_rdssp (word_mode, reg_ssp, reg_ssp)); |
| 27462 |
|
| 27463 |
/* Compare through subtraction the saved and the current ssp |
| 27464 |
to decide if ssp has to be adjusted. */ |
| 27465 |
reg_ssp = expand_simple_binop (word_mode, MINUS, |
| 27466 |
reg_ssp, ssp_slot, |
| 27467 |
reg_ssp, 1, OPTAB_DIRECT); |
| 27468 |
|
| 27469 |
/* Compare and jump over adjustment code. */ |
| 27470 |
rtx noadj_label = gen_label_rtx (); |
| 27471 |
emit_cmp_and_jump_insns (reg_ssp, const0_rtx, EQ, NULL_RTX, |
| 27472 |
word_mode, 1, noadj_label); |
| 27473 |
|
| 27474 |
/* Compute the number of frames to adjust. */ |
| 27475 |
rtx reg_adj = gen_lowpart (ptr_mode, reg_ssp); |
| 27476 |
rtx reg_adj_neg = expand_simple_unop (ptr_mode, NEG, reg_adj, |
| 27477 |
NULL_RTX, 1); |
| 27478 |
|
| 27479 |
reg_adj = expand_simple_binop (ptr_mode, LSHIFTRT, reg_adj_neg, |
| 27480 |
GEN_INT (exact_log2 (UNITS_PER_WORD)), |
| 27481 |
reg_adj, 1, OPTAB_DIRECT); |
| 27482 |
|
| 27483 |
/* Check if number of frames <= 255 so no loop is needed. */ |
| 27484 |
rtx inc_label = gen_label_rtx (); |
| 27485 |
emit_cmp_and_jump_insns (reg_adj, GEN_INT (255), LEU, NULL_RTX, |
| 27486 |
ptr_mode, 1, inc_label); |
| 27487 |
|
| 27488 |
/* Adjust the ssp in a loop. */ |
| 27489 |
rtx loop_label = gen_label_rtx (); |
| 27490 |
emit_label (loop_label); |
| 27491 |
LABEL_NUSES (loop_label) = 1; |
| 27492 |
|
| 27493 |
rtx reg_255 = force_reg (word_mode, GEN_INT (255)); |
| 27494 |
emit_insn (gen_incssp (word_mode, reg_255)); |
| 27495 |
|
| 27496 |
reg_adj = expand_simple_binop (ptr_mode, MINUS, |
| 27497 |
reg_adj, GEN_INT (255), |
| 27498 |
reg_adj, 1, OPTAB_DIRECT); |
| 27499 |
|
| 27500 |
/* Compare and jump to the loop label. */ |
| 27501 |
emit_cmp_and_jump_insns (reg_adj, GEN_INT (255), GTU, NULL_RTX, |
| 27502 |
ptr_mode, 1, loop_label); |
| 27503 |
|
| 27504 |
emit_label (inc_label); |
| 27505 |
LABEL_NUSES (inc_label) = 1; |
| 27506 |
|
| 27507 |
emit_insn (gen_incssp (word_mode, reg_ssp)); |
| 27508 |
|
| 27509 |
emit_label (noadj_label); |
| 27510 |
LABEL_NUSES (noadj_label) = 1; |
| 27511 |
} |
| 27512 |
else |
| 27513 |
stack_slot = adjust_address (operands[1], Pmode, 0); |
| 27514 |
emit_move_insn (operands[0], stack_slot); |
| 27515 |
DONE; |
| 27516 |
}) |
| 27517 |
|
| 27518 |
(define_expand "stack_protect_set" |
| 27519 |
[(match_operand 0 "memory_operand") |
| 27520 |
(match_operand 1 "memory_operand")] |
| 27521 |
"" |
| 27522 |
{ |
| 27523 |
rtx scratch = gen_reg_rtx (word_mode); |
| 27524 |
|
| 27525 |
emit_insn (gen_stack_protect_set_1 |
| 27526 |
(ptr_mode, word_mode, operands[0], operands[1], scratch)); |
| 27527 |
DONE; |
| 27528 |
}) |
| 27529 |
|
| 27530 |
(define_insn "@stack_protect_set_1_<PTR:mode>_<W:mode>" |
| 27531 |
[(set (match_operand:PTR 0 "memory_operand" "=m") |
| 27532 |
(unspec:PTR [(match_operand:PTR 1 "memory_operand" "m")] |
| 27533 |
UNSPEC_SP_SET)) |
| 27534 |
(set (match_operand:W 2 "register_operand" "=&r") (const_int 0)) |
| 27535 |
(clobber (reg:CC FLAGS_REG))] |
| 27536 |
"" |
| 27537 |
{ |
| 27538 |
output_asm_insn ("mov{<PTR:imodesuffix>}\t{%1, %<PTR:k>2|%<PTR:k>2, %1}", |
| 27539 |
operands); |
| 27540 |
output_asm_insn ("mov{<PTR:imodesuffix>}\t{%<PTR:k>2, %0|%0, %<PTR:k>2}", |
| 27541 |
operands); |
| 27542 |
if (!TARGET_USE_MOV0 || optimize_insn_for_size_p ()) |
| 27543 |
return "xor{l}\t%k2, %k2"; |
| 27544 |
else |
| 27545 |
return "mov{l}\t{$0, %k2|%k2, 0}"; |
| 27546 |
} |
| 27547 |
[(set_attr "type" "multi")]) |
| 27548 |
|
| 27549 |
;; Patterns and peephole2s to optimize stack_protect_set_1_<mode> |
| 27550 |
;; immediately followed by *mov{s,d}i_internal, where we can avoid |
| 27551 |
;; the xor{l} above. We don't split this, so that scheduling or |
| 27552 |
;; anything else doesn't separate the *stack_protect_set* pattern from |
| 27553 |
;; the set of the register that overwrites the register with a new value. |
| 27554 |
|
| 27555 |
(define_peephole2 |
| 27556 |
[(parallel [(set (match_operand:PTR 0 "memory_operand") |
| 27557 |
(unspec:PTR [(match_operand:PTR 1 "memory_operand")] |
| 27558 |
UNSPEC_SP_SET)) |
| 27559 |
(set (match_operand 2 "general_reg_operand") (const_int 0)) |
| 27560 |
(clobber (reg:CC FLAGS_REG))]) |
| 27561 |
(set (match_operand 3 "general_reg_operand") |
| 27562 |
(match_operand 4 "const0_operand"))] |
| 27563 |
"GET_MODE (operands[2]) == word_mode |
| 27564 |
&& GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD |
| 27565 |
&& peep2_reg_dead_p (0, operands[3]) |
| 27566 |
&& peep2_reg_dead_p (1, operands[2])" |
| 27567 |
[(parallel [(set (match_dup 0) |
| 27568 |
(unspec:PTR [(match_dup 1)] UNSPEC_SP_SET)) |
| 27569 |
(set (match_dup 3) (const_int 0)) |
| 27570 |
(clobber (reg:CC FLAGS_REG))])] |
| 27571 |
"operands[3] = gen_lowpart (word_mode, operands[3]);") |
| 27572 |
|
| 27573 |
(define_insn "*stack_protect_set_2_<mode>_si" |
| 27574 |
[(set (match_operand:PTR 0 "memory_operand" "=m") |
| 27575 |
(unspec:PTR [(match_operand:PTR 3 "memory_operand" "m")] |
| 27576 |
UNSPEC_SP_SET)) |
| 27577 |
(set (match_operand:SI 1 "register_operand" "=&r") |
| 27578 |
(match_operand:SI 2 "general_operand" "g"))] |
| 27579 |
"reload_completed" |
| 27580 |
{ |
| 27581 |
output_asm_insn ("mov{<imodesuffix>}\t{%3, %<k>1|%<k>1, %3}", operands); |
| 27582 |
output_asm_insn ("mov{<imodesuffix>}\t{%<k>1, %0|%0, %<k>1}", operands); |
| 27583 |
if (pic_32bit_operand (operands[2], SImode) |
| 27584 |
|| ix86_use_lea_for_mov (insn, operands + 1)) |
| 27585 |
return "lea{l}\t{%E2, %1|%1, %E2}"; |
| 27586 |
else |
| 27587 |
return "mov{l}\t{%2, %1|%1, %2}"; |
| 27588 |
} |
| 27589 |
[(set_attr "type" "multi") |
| 27590 |
(set_attr "length" "24")]) |
| 27591 |
|
| 27592 |
(define_insn "*stack_protect_set_2_<mode>_di" |
| 27593 |
[(set (match_operand:PTR 0 "memory_operand" "=m,m,m") |
| 27594 |
(unspec:PTR [(match_operand:PTR 3 "memory_operand" "m,m,m")] |
| 27595 |
UNSPEC_SP_SET)) |
| 27596 |
(set (match_operand:DI 1 "register_operand" "=&r,&r,&r") |
| 27597 |
(match_operand:DI 2 "general_operand" "Z,rem,i"))] |
| 27598 |
"TARGET_64BIT && reload_completed" |
| 27599 |
{ |
| 27600 |
output_asm_insn ("mov{<imodesuffix>}\t{%3, %<k>1|%<k>1, %3}", operands); |
| 27601 |
output_asm_insn ("mov{<imodesuffix>}\t{%<k>1, %0|%0, %<k>1}", operands); |
| 27602 |
if (pic_32bit_operand (operands[2], DImode)) |
| 27603 |
return "lea{q}\t{%E2, %1|%1, %E2}"; |
| 27604 |
else if (which_alternative == 0) |
| 27605 |
return "mov{l}\t{%k2, %k1|%k1, %k2}"; |
| 27606 |
else if (which_alternative == 2) |
| 27607 |
return "movabs{q}\t{%2, %1|%1, %2}"; |
| 27608 |
else if (ix86_use_lea_for_mov (insn, operands + 1)) |
| 27609 |
return "lea{q}\t{%E2, %1|%1, %E2}"; |
| 27610 |
else |
| 27611 |
return "mov{q}\t{%2, %1|%1, %2}"; |
| 27612 |
} |
| 27613 |
[(set_attr "type" "multi") |
| 27614 |
(set_attr "length" "24")]) |
| 27615 |
|
| 27616 |
(define_peephole2 |
| 27617 |
[(parallel [(set (match_operand:PTR 0 "memory_operand") |
| 27618 |
(unspec:PTR [(match_operand:PTR 1 "memory_operand")] |
| 27619 |
UNSPEC_SP_SET)) |
| 27620 |
(set (match_operand 2 "general_reg_operand") (const_int 0)) |
| 27621 |
(clobber (reg:CC FLAGS_REG))]) |
| 27622 |
(set (match_operand:SWI48 3 "general_reg_operand") |
| 27623 |
(match_operand:SWI48 4 "general_gr_operand"))] |
| 27624 |
"GET_MODE (operands[2]) == word_mode |
| 27625 |
&& peep2_reg_dead_p (0, operands[3]) |
| 27626 |
&& peep2_reg_dead_p (1, operands[2])" |
| 27627 |
[(parallel [(set (match_dup 0) |
| 27628 |
(unspec:PTR [(match_dup 1)] UNSPEC_SP_SET)) |
| 27629 |
(set (match_dup 3) (match_dup 4))])]) |
| 27630 |
|
| 27631 |
(define_peephole2 |
| 27632 |
[(set (match_operand:SWI48 3 "general_reg_operand") |
| 27633 |
(match_operand:SWI48 4 "general_gr_operand")) |
| 27634 |
(parallel [(set (match_operand:PTR 0 "memory_operand") |
| 27635 |
(unspec:PTR [(match_operand:PTR 1 "memory_operand")] |
| 27636 |
UNSPEC_SP_SET)) |
| 27637 |
(set (match_operand 2 "general_reg_operand") (const_int 0)) |
| 27638 |
(clobber (reg:CC FLAGS_REG))])] |
| 27639 |
"GET_MODE (operands[2]) == word_mode |
| 27640 |
&& peep2_reg_dead_p (0, operands[3]) |
| 27641 |
&& peep2_reg_dead_p (2, operands[2]) |
| 27642 |
&& !reg_mentioned_p (operands[3], operands[0]) |
| 27643 |
&& !reg_mentioned_p (operands[3], operands[1])" |
| 27644 |
[(parallel [(set (match_dup 0) |
| 27645 |
(unspec:PTR [(match_dup 1)] UNSPEC_SP_SET)) |
| 27646 |
(set (match_dup 3) (match_dup 4))])]) |
| 27647 |
|
| 27648 |
(define_insn "*stack_protect_set_3_<PTR:mode>_<SWI48:mode>" |
| 27649 |
[(set (match_operand:PTR 0 "memory_operand" "=m") |
| 27650 |
(unspec:PTR [(match_operand:PTR 3 "memory_operand" "m")] |
| 27651 |
UNSPEC_SP_SET)) |
| 27652 |
(set (match_operand:SWI48 1 "register_operand" "=&r") |
| 27653 |
(match_operand:SWI48 2 "address_no_seg_operand" "Ts"))] |
| 27654 |
"" |
| 27655 |
{ |
| 27656 |
output_asm_insn ("mov{<PTR:imodesuffix>}\t{%3, %<PTR:k>1|%<PTR:k>1, %3}", |
| 27657 |
operands); |
| 27658 |
output_asm_insn ("mov{<PTR:imodesuffix>}\t{%<PTR:k>1, %0|%0, %<PTR:k>1}", |
| 27659 |
operands); |
| 27660 |
if (SImode_address_operand (operands[2], VOIDmode)) |
| 27661 |
{ |
| 27662 |
gcc_assert (TARGET_64BIT); |
| 27663 |
return "lea{l}\t{%E2, %k1|%k1, %E2}"; |
| 27664 |
} |
| 27665 |
else |
| 27666 |
return "lea{<SWI48:imodesuffix>}\t{%E2, %1|%1, %E2}"; |
| 27667 |
} |
| 27668 |
[(set_attr "type" "multi") |
| 27669 |
(set_attr "length" "24")]) |
| 27670 |
|
| 27671 |
(define_peephole2 |
| 27672 |
[(parallel [(set (match_operand:PTR 0 "memory_operand") |
| 27673 |
(unspec:PTR [(match_operand:PTR 1 "memory_operand")] |
| 27674 |
UNSPEC_SP_SET)) |
| 27675 |
(set (match_operand 2 "general_reg_operand") (const_int 0)) |
| 27676 |
(clobber (reg:CC FLAGS_REG))]) |
| 27677 |
(set (match_operand:SWI48 3 "general_reg_operand") |
| 27678 |
(match_operand:SWI48 4 "address_no_seg_operand"))] |
| 27679 |
"GET_MODE (operands[2]) == word_mode |
| 27680 |
&& peep2_reg_dead_p (0, operands[3]) |
| 27681 |
&& peep2_reg_dead_p (1, operands[2])" |
| 27682 |
[(parallel [(set (match_dup 0) |
| 27683 |
(unspec:PTR [(match_dup 1)] UNSPEC_SP_SET)) |
| 27684 |
(set (match_dup 3) (match_dup 4))])]) |
| 27685 |
|
| 27686 |
(define_insn "*stack_protect_set_4z_<mode>_di" |
| 27687 |
[(set (match_operand:PTR 0 "memory_operand" "=m") |
| 27688 |
(unspec:PTR [(match_operand:PTR 3 "memory_operand" "m")] |
| 27689 |
UNSPEC_SP_SET)) |
| 27690 |
(set (match_operand:DI 1 "register_operand" "=&r") |
| 27691 |
(zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm")))] |
| 27692 |
"TARGET_64BIT && reload_completed" |
| 27693 |
{ |
| 27694 |
output_asm_insn ("mov{<imodesuffix>}\t{%3, %<k>1|%<k>1, %3}", operands); |
| 27695 |
output_asm_insn ("mov{<imodesuffix>}\t{%<k>1, %0|%0, %<k>1}", operands); |
| 27696 |
if (ix86_use_lea_for_mov (insn, operands + 1)) |
| 27697 |
return "lea{l}\t{%E2, %k1|%k1, %E2}"; |
| 27698 |
else |
| 27699 |
return "mov{l}\t{%2, %k1|%k1, %2}"; |
| 27700 |
} |
| 27701 |
[(set_attr "type" "multi") |
| 27702 |
(set_attr "length" "24")]) |
| 27703 |
|
| 27704 |
(define_insn "*stack_protect_set_4s_<mode>_di" |
| 27705 |
[(set (match_operand:PTR 0 "memory_operand" "=m") |
| 27706 |
(unspec:PTR [(match_operand:PTR 3 "memory_operand" "m")] |
| 27707 |
UNSPEC_SP_SET)) |
| 27708 |
(set (match_operand:DI 1 "register_operand" "=&r") |
| 27709 |
(sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm")))] |
| 27710 |
"TARGET_64BIT && reload_completed" |
| 27711 |
{ |
| 27712 |
output_asm_insn ("mov{<imodesuffix>}\t{%3, %<k>1|%<k>1, %3}", operands); |
| 27713 |
output_asm_insn ("mov{<imodesuffix>}\t{%<k>1, %0|%0, %<k>1}", operands); |
| 27714 |
return "movs{lq|xd}\t{%2, %1|%1, %2}"; |
| 27715 |
} |
| 27716 |
[(set_attr "type" "multi") |
| 27717 |
(set_attr "length" "24")]) |
| 27718 |
|
| 27719 |
(define_peephole2 |
| 27720 |
[(parallel [(set (match_operand:PTR 0 "memory_operand") |
| 27721 |
(unspec:PTR [(match_operand:PTR 1 "memory_operand")] |
| 27722 |
UNSPEC_SP_SET)) |
| 27723 |
(set (match_operand 2 "general_reg_operand") (const_int 0)) |
| 27724 |
(clobber (reg:CC FLAGS_REG))]) |
| 27725 |
(set (match_operand:DI 3 "general_reg_operand") |
| 27726 |
(any_extend:DI |
| 27727 |
(match_operand:SI 4 "nonimmediate_gr_operand")))] |
| 27728 |
"TARGET_64BIT |
| 27729 |
&& GET_MODE (operands[2]) == word_mode |
| 27730 |
&& peep2_reg_dead_p (0, operands[3]) |
| 27731 |
&& peep2_reg_dead_p (1, operands[2])" |
| 27732 |
[(parallel [(set (match_dup 0) |
| 27733 |
(unspec:PTR [(match_dup 1)] UNSPEC_SP_SET)) |
| 27734 |
(set (match_dup 3) |
| 27735 |
(any_extend:DI (match_dup 4)))])]) |
| 27736 |
|
| 27737 |
(define_expand "stack_protect_test" |
| 27738 |
[(match_operand 0 "memory_operand") |
| 27739 |
(match_operand 1 "memory_operand") |
| 27740 |
(match_operand 2)] |
| 27741 |
"" |
| 27742 |
{ |
| 27743 |
rtx flags = gen_rtx_REG (CCZmode, FLAGS_REG); |
| 27744 |
|
| 27745 |
emit_insn (gen_stack_protect_test_1 |
| 27746 |
(ptr_mode, flags, operands[0], operands[1])); |
| 27747 |
|
| 27748 |
emit_jump_insn (gen_cbranchcc4 (gen_rtx_EQ (VOIDmode, flags, const0_rtx), |
| 27749 |
flags, const0_rtx, operands[2])); |
| 27750 |
DONE; |
| 27751 |
}) |
| 27752 |
|
| 27753 |
(define_insn "@stack_protect_test_1_<mode>" |
| 27754 |
[(set (match_operand:CCZ 0 "flags_reg_operand") |
| 27755 |
(unspec:CCZ [(match_operand:PTR 1 "memory_operand" "m") |
| 27756 |
(match_operand:PTR 2 "memory_operand" "m")] |
| 27757 |
UNSPEC_SP_TEST)) |
| 27758 |
(clobber (match_scratch:PTR 3 "=&r"))] |
| 27759 |
"" |
| 27760 |
{ |
| 27761 |
output_asm_insn ("mov{<imodesuffix>}\t{%1, %3|%3, %1}", operands); |
| 27762 |
return "sub{<imodesuffix>}\t{%2, %3|%3, %2}"; |
| 27763 |
} |
| 27764 |
[(set_attr "type" "multi")]) |
| 27765 |
|
| 27766 |
;; Avoid redundant prefixes by splitting HImode arithmetic to SImode. |
| 27767 |
;; Do not split instructions with mask registers. |
| 27768 |
(define_split |
| 27769 |
[(set (match_operand 0 "general_reg_operand") |
| 27770 |
(match_operator 3 "promotable_binary_operator" |
| 27771 |
[(match_operand 1 "general_reg_operand") |
| 27772 |
(match_operand 2 "aligned_operand")])) |
| 27773 |
(clobber (reg:CC FLAGS_REG))] |
| 27774 |
"! TARGET_PARTIAL_REG_STALL && reload_completed |
| 27775 |
&& ((GET_MODE (operands[0]) == HImode |
| 27776 |
&& ((optimize_function_for_speed_p (cfun) && !TARGET_FAST_PREFIX) |
| 27777 |
/* ??? next two lines just !satisfies_constraint_K (...) */ |
| 27778 |
|| !CONST_INT_P (operands[2]) |
| 27779 |
|| satisfies_constraint_K (operands[2]))) |
| 27780 |
|| (GET_MODE (operands[0]) == QImode |
| 27781 |
&& (TARGET_PROMOTE_QImode || optimize_function_for_size_p (cfun))))" |
| 27782 |
[(parallel [(set (match_dup 0) |
| 27783 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)])) |
| 27784 |
(clobber (reg:CC FLAGS_REG))])] |
| 27785 |
{ |
| 27786 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 27787 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 27788 |
if (GET_CODE (operands[3]) != ASHIFT) |
| 27789 |
operands[2] = gen_lowpart (SImode, operands[2]); |
| 27790 |
operands[3] = shallow_copy_rtx (operands[3]); |
| 27791 |
PUT_MODE (operands[3], SImode); |
| 27792 |
}) |
| 27793 |
|
| 27794 |
; Promote the QImode tests, as i386 has encoding of the AND |
| 27795 |
; instruction with 32-bit sign-extended immediate and thus the |
| 27796 |
; instruction size is unchanged, except in the %eax case for |
| 27797 |
; which it is increased by one byte, hence the ! optimize_size. |
| 27798 |
(define_split |
| 27799 |
[(set (match_operand 0 "flags_reg_operand") |
| 27800 |
(match_operator 2 "compare_operator" |
| 27801 |
[(and (match_operand 3 "aligned_operand") |
| 27802 |
(match_operand 4 "const_int_operand")) |
| 27803 |
(const_int 0)])) |
| 27804 |
(set (match_operand 1 "register_operand") |
| 27805 |
(and (match_dup 3) (match_dup 4)))] |
| 27806 |
"! TARGET_PARTIAL_REG_STALL && reload_completed |
| 27807 |
&& optimize_insn_for_speed_p () |
| 27808 |
&& ((GET_MODE (operands[1]) == HImode && ! TARGET_FAST_PREFIX) |
| 27809 |
|| (GET_MODE (operands[1]) == QImode && TARGET_PROMOTE_QImode)) |
| 27810 |
/* Ensure that the operand will remain sign-extended immediate. */ |
| 27811 |
&& ix86_match_ccmode (insn, INTVAL (operands[4]) >= 0 ? CCNOmode : CCZmode)" |
| 27812 |
[(parallel [(set (match_dup 0) |
| 27813 |
(match_op_dup 2 [(and:SI (match_dup 3) (match_dup 4)) |
| 27814 |
(const_int 0)])) |
| 27815 |
(set (match_dup 1) |
| 27816 |
(and:SI (match_dup 3) (match_dup 4)))])] |
| 27817 |
{ |
| 27818 |
operands[4] |
| 27819 |
= gen_int_mode (INTVAL (operands[4]) |
| 27820 |
& GET_MODE_MASK (GET_MODE (operands[1])), SImode); |
| 27821 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 27822 |
operands[3] = gen_lowpart (SImode, operands[3]); |
| 27823 |
}) |
| 27824 |
|
| 27825 |
; Don't promote the QImode tests, as i386 doesn't have encoding of |
| 27826 |
; the TEST instruction with 32-bit sign-extended immediate and thus |
| 27827 |
; the instruction size would at least double, which is not what we |
| 27828 |
; want even with ! optimize_size. |
| 27829 |
(define_split |
| 27830 |
[(set (match_operand 0 "flags_reg_operand") |
| 27831 |
(match_operator 1 "compare_operator" |
| 27832 |
[(and (match_operand:HI 2 "aligned_operand") |
| 27833 |
(match_operand:HI 3 "const_int_operand")) |
| 27834 |
(const_int 0)]))] |
| 27835 |
"! TARGET_PARTIAL_REG_STALL && reload_completed |
| 27836 |
&& ! TARGET_FAST_PREFIX |
| 27837 |
&& optimize_insn_for_speed_p () |
| 27838 |
/* Ensure that the operand will remain sign-extended immediate. */ |
| 27839 |
&& ix86_match_ccmode (insn, INTVAL (operands[3]) >= 0 ? CCNOmode : CCZmode)" |
| 27840 |
[(set (match_dup 0) |
| 27841 |
(match_op_dup 1 [(and:SI (match_dup 2) (match_dup 3)) |
| 27842 |
(const_int 0)]))] |
| 27843 |
{ |
| 27844 |
operands[3] |
| 27845 |
= gen_int_mode (INTVAL (operands[3]) |
| 27846 |
& GET_MODE_MASK (GET_MODE (operands[2])), SImode); |
| 27847 |
operands[2] = gen_lowpart (SImode, operands[2]); |
| 27848 |
}) |
| 27849 |
|
| 27850 |
(define_split |
| 27851 |
[(set (match_operand 0 "register_operand") |
| 27852 |
(neg (match_operand 1 "register_operand"))) |
| 27853 |
(clobber (reg:CC FLAGS_REG))] |
| 27854 |
"! TARGET_PARTIAL_REG_STALL && reload_completed |
| 27855 |
&& (GET_MODE (operands[0]) == HImode |
| 27856 |
|| (GET_MODE (operands[0]) == QImode && TARGET_PROMOTE_QImode))" |
| 27857 |
[(parallel [(set (match_dup 0) |
| 27858 |
(neg:SI (match_dup 1))) |
| 27859 |
(clobber (reg:CC FLAGS_REG))])] |
| 27860 |
{ |
| 27861 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 27862 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 27863 |
}) |
| 27864 |
|
| 27865 |
;; Do not split instructions with mask regs. |
| 27866 |
(define_split |
| 27867 |
[(set (match_operand 0 "general_reg_operand") |
| 27868 |
(not (match_operand 1 "general_reg_operand")))] |
| 27869 |
"! TARGET_PARTIAL_REG_STALL && reload_completed |
| 27870 |
&& (GET_MODE (operands[0]) == HImode |
| 27871 |
|| (GET_MODE (operands[0]) == QImode && TARGET_PROMOTE_QImode))" |
| 27872 |
[(set (match_dup 0) |
| 27873 |
(not:SI (match_dup 1)))] |
| 27874 |
{ |
| 27875 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 27876 |
operands[1] = gen_lowpart (SImode, operands[1]); |
| 27877 |
}) |
| 27878 |
|
| 27879 |
(define_split |
| 27880 |
[(set (match_operand 0 "general_reg_operand") |
| 27881 |
(neg (match_operator 1 "ix86_carry_flag_operator" |
| 27882 |
[(reg FLAGS_REG) (const_int 0)]))) |
| 27883 |
(clobber (reg:CC FLAGS_REG))] |
| 27884 |
"! TARGET_PARTIAL_REG_STALL && reload_completed |
| 27885 |
&& (GET_MODE (operands[0]) == HImode |
| 27886 |
|| (GET_MODE (operands[0]) == QImode && TARGET_PROMOTE_QImode))" |
| 27887 |
[(parallel [(set (match_dup 0) |
| 27888 |
(neg:SI (match_dup 1))) |
| 27889 |
(clobber (reg:CC FLAGS_REG))])] |
| 27890 |
{ |
| 27891 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 27892 |
operands[1] = shallow_copy_rtx (operands[1]); |
| 27893 |
PUT_MODE (operands[1], SImode); |
| 27894 |
}) |
| 27895 |
|
| 27896 |
;; RTL Peephole optimizations, run before sched2. These primarily look to |
| 27897 |
;; transform a complex memory operation into two memory to register operations. |
| 27898 |
|
| 27899 |
;; Don't push memory operands |
| 27900 |
(define_peephole2 |
| 27901 |
[(set (match_operand:SWI 0 "push_operand") |
| 27902 |
(match_operand:SWI 1 "memory_operand")) |
| 27903 |
(match_scratch:SWI 2 "<r>")] |
| 27904 |
"!(TARGET_PUSH_MEMORY || optimize_insn_for_size_p ()) |
| 27905 |
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))" |
| 27906 |
[(set (match_dup 2) (match_dup 1)) |
| 27907 |
(set (match_dup 0) (match_dup 2))]) |
| 27908 |
|
| 27909 |
;; We need to handle SFmode only, because DFmode and XFmode are split to |
| 27910 |
;; SImode pushes. |
| 27911 |
(define_peephole2 |
| 27912 |
[(set (match_operand:SF 0 "push_operand") |
| 27913 |
(match_operand:SF 1 "memory_operand")) |
| 27914 |
(match_scratch:SF 2 "r")] |
| 27915 |
"!(TARGET_PUSH_MEMORY || optimize_insn_for_size_p ()) |
| 27916 |
&& !RTX_FRAME_RELATED_P (peep2_next_insn (0))" |
| 27917 |
[(set (match_dup 2) (match_dup 1)) |
| 27918 |
(set (match_dup 0) (match_dup 2))]) |
| 27919 |
|
| 27920 |
;; Don't move an immediate directly to memory when the instruction |
| 27921 |
;; gets too big, or if LCP stalls are a problem for 16-bit moves. |
| 27922 |
(define_peephole2 |
| 27923 |
[(match_scratch:SWI124 1 "<r>") |
| 27924 |
(set (match_operand:SWI124 0 "memory_operand") |
| 27925 |
(const_int 0))] |
| 27926 |
"optimize_insn_for_speed_p () |
| 27927 |
&& ((<MODE>mode == HImode |
| 27928 |
&& TARGET_LCP_STALL) |
| 27929 |
|| (!TARGET_USE_MOV0 |
| 27930 |
&& TARGET_SPLIT_LONG_MOVES |
| 27931 |
&& get_attr_length (insn) >= ix86_cur_cost ()->large_insn)) |
| 27932 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 27933 |
[(parallel [(set (match_dup 2) (const_int 0)) |
| 27934 |
(clobber (reg:CC FLAGS_REG))]) |
| 27935 |
(set (match_dup 0) (match_dup 1))] |
| 27936 |
"operands[2] = gen_lowpart (SImode, operands[1]);") |
| 27937 |
|
| 27938 |
(define_peephole2 |
| 27939 |
[(match_scratch:SWI124 2 "<r>") |
| 27940 |
(set (match_operand:SWI124 0 "memory_operand") |
| 27941 |
(match_operand:SWI124 1 "immediate_operand"))] |
| 27942 |
"optimize_insn_for_speed_p () |
| 27943 |
&& ((<MODE>mode == HImode |
| 27944 |
&& TARGET_LCP_STALL) |
| 27945 |
|| (TARGET_SPLIT_LONG_MOVES |
| 27946 |
&& get_attr_length (insn) >= ix86_cur_cost ()->large_insn))" |
| 27947 |
[(set (match_dup 2) (match_dup 1)) |
| 27948 |
(set (match_dup 0) (match_dup 2))]) |
| 27949 |
|
| 27950 |
;; Don't compare memory with zero, load and use a test instead. |
| 27951 |
(define_peephole2 |
| 27952 |
[(set (match_operand 0 "flags_reg_operand") |
| 27953 |
(match_operator 1 "compare_operator" |
| 27954 |
[(match_operand:SI 2 "memory_operand") |
| 27955 |
(const_int 0)])) |
| 27956 |
(match_scratch:SI 3 "r")] |
| 27957 |
"optimize_insn_for_speed_p () && ix86_match_ccmode (insn, CCNOmode)" |
| 27958 |
[(set (match_dup 3) (match_dup 2)) |
| 27959 |
(set (match_dup 0) (match_op_dup 1 [(match_dup 3) (const_int 0)]))]) |
| 27960 |
|
| 27961 |
;; NOT is not pairable on Pentium, while XOR is, but one byte longer. |
| 27962 |
;; Don't split NOTs with a displacement operand, because resulting XOR |
| 27963 |
;; will not be pairable anyway. |
| 27964 |
;; |
| 27965 |
;; On AMD K6, NOT is vector decoded with memory operand that cannot be |
| 27966 |
;; represented using a modRM byte. The XOR replacement is long decoded, |
| 27967 |
;; so this split helps here as well. |
| 27968 |
;; |
| 27969 |
;; Note: Can't do this as a regular split because we can't get proper |
| 27970 |
;; lifetime information then. |
| 27971 |
|
| 27972 |
(define_peephole2 |
| 27973 |
[(set (match_operand:SWI124 0 "nonimmediate_gr_operand") |
| 27974 |
(not:SWI124 (match_operand:SWI124 1 "nonimmediate_gr_operand")))] |
| 27975 |
"optimize_insn_for_speed_p () |
| 27976 |
&& ((TARGET_NOT_UNPAIRABLE |
| 27977 |
&& (!MEM_P (operands[0]) |
| 27978 |
|| !memory_displacement_operand (operands[0], <MODE>mode))) |
| 27979 |
|| (TARGET_NOT_VECTORMODE |
| 27980 |
&& long_memory_operand (operands[0], <MODE>mode))) |
| 27981 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 27982 |
[(parallel [(set (match_dup 0) |
| 27983 |
(xor:SWI124 (match_dup 1) (const_int -1))) |
| 27984 |
(clobber (reg:CC FLAGS_REG))])]) |
| 27985 |
|
| 27986 |
;; Non pairable "test imm, reg" instructions can be translated to |
| 27987 |
;; "and imm, reg" if reg dies. The "and" form is also shorter (one |
| 27988 |
;; byte opcode instead of two, have a short form for byte operands), |
| 27989 |
;; so do it for other CPUs as well. Given that the value was dead, |
| 27990 |
;; this should not create any new dependencies. Pass on the sub-word |
| 27991 |
;; versions if we're concerned about partial register stalls. |
| 27992 |
|
| 27993 |
(define_peephole2 |
| 27994 |
[(set (match_operand 0 "flags_reg_operand") |
| 27995 |
(match_operator 1 "compare_operator" |
| 27996 |
[(and:SI (match_operand:SI 2 "register_operand") |
| 27997 |
(match_operand:SI 3 "immediate_operand")) |
| 27998 |
(const_int 0)]))] |
| 27999 |
"ix86_match_ccmode (insn, CCNOmode) |
| 28000 |
&& (REGNO (operands[2]) != AX_REG |
| 28001 |
|| satisfies_constraint_K (operands[3])) |
| 28002 |
&& peep2_reg_dead_p (1, operands[2])" |
| 28003 |
[(parallel |
| 28004 |
[(set (match_dup 0) |
| 28005 |
(match_op_dup 1 [(and:SI (match_dup 2) (match_dup 3)) |
| 28006 |
(const_int 0)])) |
| 28007 |
(set (match_dup 2) |
| 28008 |
(and:SI (match_dup 2) (match_dup 3)))])]) |
| 28009 |
|
| 28010 |
;; We don't need to handle HImode case, because it will be promoted to SImode |
| 28011 |
;; on ! TARGET_PARTIAL_REG_STALL |
| 28012 |
|
| 28013 |
(define_peephole2 |
| 28014 |
[(set (match_operand 0 "flags_reg_operand") |
| 28015 |
(match_operator 1 "compare_operator" |
| 28016 |
[(and:QI (match_operand:QI 2 "register_operand") |
| 28017 |
(match_operand:QI 3 "immediate_operand")) |
| 28018 |
(const_int 0)]))] |
| 28019 |
"! TARGET_PARTIAL_REG_STALL |
| 28020 |
&& ix86_match_ccmode (insn, CCNOmode) |
| 28021 |
&& REGNO (operands[2]) != AX_REG |
| 28022 |
&& peep2_reg_dead_p (1, operands[2])" |
| 28023 |
[(parallel |
| 28024 |
[(set (match_dup 0) |
| 28025 |
(match_op_dup 1 [(and:QI (match_dup 2) (match_dup 3)) |
| 28026 |
(const_int 0)])) |
| 28027 |
(set (match_dup 2) |
| 28028 |
(and:QI (match_dup 2) (match_dup 3)))])]) |
| 28029 |
|
| 28030 |
(define_peephole2 |
| 28031 |
[(set (match_operand 0 "flags_reg_operand") |
| 28032 |
(match_operator 1 "compare_operator" |
| 28033 |
[(and:QI |
| 28034 |
(subreg:QI |
| 28035 |
(match_operator:SWI248 4 "extract_operator" |
| 28036 |
[(match_operand 2 "int248_register_operand") |
| 28037 |
(const_int 8) |
| 28038 |
(const_int 8)]) 0) |
| 28039 |
(match_operand 3 "const_int_operand")) |
| 28040 |
(const_int 0)]))] |
| 28041 |
"! TARGET_PARTIAL_REG_STALL |
| 28042 |
&& ix86_match_ccmode (insn, CCNOmode) |
| 28043 |
&& REGNO (operands[2]) != AX_REG |
| 28044 |
&& peep2_reg_dead_p (1, operands[2])" |
| 28045 |
[(parallel |
| 28046 |
[(set (match_dup 0) |
| 28047 |
(match_op_dup 1 |
| 28048 |
[(and:QI |
| 28049 |
(subreg:QI |
| 28050 |
(match_op_dup 4 [(match_dup 2) |
| 28051 |
(const_int 8) |
| 28052 |
(const_int 8)]) 0) |
| 28053 |
(match_dup 3)) |
| 28054 |
(const_int 0)])) |
| 28055 |
(set (zero_extract:SWI248 (match_dup 2) |
| 28056 |
(const_int 8) |
| 28057 |
(const_int 8)) |
| 28058 |
(subreg:SWI248 |
| 28059 |
(and:QI |
| 28060 |
(subreg:QI |
| 28061 |
(match_op_dup 4 [(match_dup 2) |
| 28062 |
(const_int 8) |
| 28063 |
(const_int 8)]) 0) |
| 28064 |
(match_dup 3)) 0))])]) |
| 28065 |
|
| 28066 |
;; Don't do logical operations with memory inputs. |
| 28067 |
(define_peephole2 |
| 28068 |
[(match_scratch:SWI 2 "<r>") |
| 28069 |
(parallel [(set (match_operand:SWI 0 "register_operand") |
| 28070 |
(match_operator:SWI 3 "arith_or_logical_operator" |
| 28071 |
[(match_dup 0) |
| 28072 |
(match_operand:SWI 1 "memory_operand")])) |
| 28073 |
(clobber (reg:CC FLAGS_REG))])] |
| 28074 |
"!(TARGET_READ_MODIFY || optimize_insn_for_size_p ())" |
| 28075 |
[(set (match_dup 2) (match_dup 1)) |
| 28076 |
(parallel [(set (match_dup 0) |
| 28077 |
(match_op_dup 3 [(match_dup 0) (match_dup 2)])) |
| 28078 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28079 |
|
| 28080 |
(define_peephole2 |
| 28081 |
[(match_scratch:SWI 2 "<r>") |
| 28082 |
(parallel [(set (match_operand:SWI 0 "register_operand") |
| 28083 |
(match_operator:SWI 3 "arith_or_logical_operator" |
| 28084 |
[(match_operand:SWI 1 "memory_operand") |
| 28085 |
(match_dup 0)])) |
| 28086 |
(clobber (reg:CC FLAGS_REG))])] |
| 28087 |
"!(TARGET_READ_MODIFY || optimize_insn_for_size_p ())" |
| 28088 |
[(set (match_dup 2) (match_dup 1)) |
| 28089 |
(parallel [(set (match_dup 0) |
| 28090 |
(match_op_dup 3 [(match_dup 2) (match_dup 0)])) |
| 28091 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28092 |
|
| 28093 |
;; Prefer Load+RegOp to Mov+MemOp. Watch out for cases when |
| 28094 |
;; the memory address refers to the destination of the load! |
| 28095 |
|
| 28096 |
(define_peephole2 |
| 28097 |
[(set (match_operand:SWI 0 "general_reg_operand") |
| 28098 |
(match_operand:SWI 1 "general_reg_operand")) |
| 28099 |
(parallel [(set (match_dup 0) |
| 28100 |
(match_operator:SWI 3 "commutative_operator" |
| 28101 |
[(match_dup 0) |
| 28102 |
(match_operand:SWI 2 "memory_operand")])) |
| 28103 |
(clobber (reg:CC FLAGS_REG))])] |
| 28104 |
"REGNO (operands[0]) != REGNO (operands[1]) |
| 28105 |
&& (<MODE>mode != QImode |
| 28106 |
|| any_QIreg_operand (operands[1], QImode))" |
| 28107 |
[(set (match_dup 0) (match_dup 4)) |
| 28108 |
(parallel [(set (match_dup 0) |
| 28109 |
(match_op_dup 3 [(match_dup 0) (match_dup 1)])) |
| 28110 |
(clobber (reg:CC FLAGS_REG))])] |
| 28111 |
{ |
| 28112 |
operands[4] |
| 28113 |
= ix86_replace_reg_with_reg (operands[2], operands[0], operands[1]); |
| 28114 |
}) |
| 28115 |
|
| 28116 |
(define_peephole2 |
| 28117 |
[(set (match_operand 0 "mmx_reg_operand") |
| 28118 |
(match_operand 1 "mmx_reg_operand")) |
| 28119 |
(set (match_dup 0) |
| 28120 |
(match_operator 3 "commutative_operator" |
| 28121 |
[(match_dup 0) |
| 28122 |
(match_operand 2 "memory_operand")]))] |
| 28123 |
"REGNO (operands[0]) != REGNO (operands[1])" |
| 28124 |
[(set (match_dup 0) (match_dup 2)) |
| 28125 |
(set (match_dup 0) |
| 28126 |
(match_op_dup 3 [(match_dup 0) (match_dup 1)]))]) |
| 28127 |
|
| 28128 |
(define_peephole2 |
| 28129 |
[(set (match_operand 0 "sse_reg_operand") |
| 28130 |
(match_operand 1 "sse_reg_operand")) |
| 28131 |
(set (match_dup 0) |
| 28132 |
(match_operator 3 "commutative_operator" |
| 28133 |
[(match_dup 0) |
| 28134 |
(match_operand 2 "memory_operand")]))] |
| 28135 |
"REGNO (operands[0]) != REGNO (operands[1]) |
| 28136 |
/* Punt if operands[1] is %[xy]mm16+ and AVX512BW is not enabled, |
| 28137 |
as EVEX encoded vpadd[bw], vpmullw, vpmin[su][bw] and vpmax[su][bw] |
| 28138 |
instructions require AVX512BW and AVX512VL, but with the original |
| 28139 |
instructions it might require just AVX512VL. |
| 28140 |
AVX512VL is implied from TARGET_HARD_REGNO_MODE_OK. */ |
| 28141 |
&& (!EXT_REX_SSE_REGNO_P (REGNO (operands[1])) |
| 28142 |
|| TARGET_AVX512BW |
| 28143 |
|| GET_MODE_SIZE (GET_MODE_INNER (GET_MODE (operands[0]))) > 2 |
| 28144 |
|| logic_operator (operands[3], VOIDmode))" |
| 28145 |
[(set (match_dup 0) (match_dup 2)) |
| 28146 |
(set (match_dup 0) |
| 28147 |
(match_op_dup 3 [(match_dup 0) (match_dup 1)]))]) |
| 28148 |
|
| 28149 |
; Don't do logical operations with memory outputs |
| 28150 |
; |
| 28151 |
; These two don't make sense for PPro/PII -- we're expanding a 4-uop |
| 28152 |
; instruction into two 1-uop insns plus a 2-uop insn. That last has |
| 28153 |
; the same decoder scheduling characteristics as the original. |
| 28154 |
|
| 28155 |
(define_peephole2 |
| 28156 |
[(match_scratch:SWI 2 "<r>") |
| 28157 |
(parallel [(set (match_operand:SWI 0 "memory_operand") |
| 28158 |
(match_operator:SWI 3 "arith_or_logical_operator" |
| 28159 |
[(match_dup 0) |
| 28160 |
(match_operand:SWI 1 "<nonmemory_operand>")])) |
| 28161 |
(clobber (reg:CC FLAGS_REG))])] |
| 28162 |
"!(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ())" |
| 28163 |
[(set (match_dup 2) (match_dup 0)) |
| 28164 |
(parallel [(set (match_dup 2) |
| 28165 |
(match_op_dup 3 [(match_dup 2) (match_dup 1)])) |
| 28166 |
(clobber (reg:CC FLAGS_REG))]) |
| 28167 |
(set (match_dup 0) (match_dup 2))]) |
| 28168 |
|
| 28169 |
(define_peephole2 |
| 28170 |
[(match_scratch:SWI 2 "<r>") |
| 28171 |
(parallel [(set (match_operand:SWI 0 "memory_operand") |
| 28172 |
(match_operator:SWI 3 "arith_or_logical_operator" |
| 28173 |
[(match_operand:SWI 1 "<nonmemory_operand>") |
| 28174 |
(match_dup 0)])) |
| 28175 |
(clobber (reg:CC FLAGS_REG))])] |
| 28176 |
"!(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ())" |
| 28177 |
[(set (match_dup 2) (match_dup 0)) |
| 28178 |
(parallel [(set (match_dup 2) |
| 28179 |
(match_op_dup 3 [(match_dup 1) (match_dup 2)])) |
| 28180 |
(clobber (reg:CC FLAGS_REG))]) |
| 28181 |
(set (match_dup 0) (match_dup 2))]) |
| 28182 |
|
| 28183 |
;; Attempt to use arith or logical operations with memory outputs with |
| 28184 |
;; setting of flags. |
| 28185 |
(define_peephole2 |
| 28186 |
[(set (match_operand:SWI 0 "register_operand") |
| 28187 |
(match_operand:SWI 1 "memory_operand")) |
| 28188 |
(parallel [(set (match_dup 0) |
| 28189 |
(match_operator:SWI 3 "plusminuslogic_operator" |
| 28190 |
[(match_dup 0) |
| 28191 |
(match_operand:SWI 2 "<nonmemory_operand>")])) |
| 28192 |
(clobber (reg:CC FLAGS_REG))]) |
| 28193 |
(set (match_dup 1) (match_dup 0)) |
| 28194 |
(set (reg FLAGS_REG) (compare (match_dup 0) (const_int 0)))] |
| 28195 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28196 |
&& peep2_reg_dead_p (4, operands[0]) |
| 28197 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28198 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28199 |
&& (<MODE>mode != QImode |
| 28200 |
|| immediate_operand (operands[2], QImode) |
| 28201 |
|| any_QIreg_operand (operands[2], QImode)) |
| 28202 |
&& ix86_match_ccmode (peep2_next_insn (3), |
| 28203 |
(GET_CODE (operands[3]) == PLUS |
| 28204 |
|| GET_CODE (operands[3]) == MINUS) |
| 28205 |
? CCGOCmode : CCNOmode)" |
| 28206 |
[(parallel [(set (match_dup 4) (match_dup 6)) |
| 28207 |
(set (match_dup 1) (match_dup 5))])] |
| 28208 |
{ |
| 28209 |
operands[4] = SET_DEST (PATTERN (peep2_next_insn (3))); |
| 28210 |
operands[5] |
| 28211 |
= gen_rtx_fmt_ee (GET_CODE (operands[3]), GET_MODE (operands[3]), |
| 28212 |
copy_rtx (operands[1]), |
| 28213 |
operands[2]); |
| 28214 |
operands[6] |
| 28215 |
= gen_rtx_COMPARE (GET_MODE (operands[4]), |
| 28216 |
copy_rtx (operands[5]), |
| 28217 |
const0_rtx); |
| 28218 |
}) |
| 28219 |
|
| 28220 |
;; Likewise for cmpelim optimized pattern. |
| 28221 |
(define_peephole2 |
| 28222 |
[(set (match_operand:SWI 0 "register_operand") |
| 28223 |
(match_operand:SWI 1 "memory_operand")) |
| 28224 |
(parallel [(set (reg FLAGS_REG) |
| 28225 |
(compare (match_operator:SWI 3 "plusminuslogic_operator" |
| 28226 |
[(match_dup 0) |
| 28227 |
(match_operand:SWI 2 "<nonmemory_operand>")]) |
| 28228 |
(const_int 0))) |
| 28229 |
(set (match_dup 0) (match_dup 3))]) |
| 28230 |
(set (match_dup 1) (match_dup 0))] |
| 28231 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28232 |
&& peep2_reg_dead_p (3, operands[0]) |
| 28233 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28234 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28235 |
&& ix86_match_ccmode (peep2_next_insn (1), |
| 28236 |
(GET_CODE (operands[3]) == PLUS |
| 28237 |
|| GET_CODE (operands[3]) == MINUS) |
| 28238 |
? CCGOCmode : CCNOmode)" |
| 28239 |
[(parallel [(set (match_dup 4) (match_dup 6)) |
| 28240 |
(set (match_dup 1) (match_dup 5))])] |
| 28241 |
{ |
| 28242 |
operands[4] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (1)), 0, 0)); |
| 28243 |
operands[5] |
| 28244 |
= gen_rtx_fmt_ee (GET_CODE (operands[3]), GET_MODE (operands[3]), |
| 28245 |
copy_rtx (operands[1]), operands[2]); |
| 28246 |
operands[6] |
| 28247 |
= gen_rtx_COMPARE (GET_MODE (operands[4]), copy_rtx (operands[5]), |
| 28248 |
const0_rtx); |
| 28249 |
}) |
| 28250 |
|
| 28251 |
;; Likewise for instances where we have a lea pattern. |
| 28252 |
(define_peephole2 |
| 28253 |
[(set (match_operand:SWI 0 "register_operand") |
| 28254 |
(match_operand:SWI 1 "memory_operand")) |
| 28255 |
(set (match_operand:<LEAMODE> 3 "register_operand") |
| 28256 |
(plus:<LEAMODE> (match_operand:<LEAMODE> 4 "register_operand") |
| 28257 |
(match_operand:<LEAMODE> 2 "<nonmemory_operand>"))) |
| 28258 |
(set (match_dup 1) (match_operand:SWI 5 "register_operand")) |
| 28259 |
(set (reg FLAGS_REG) (compare (match_dup 5) (const_int 0)))] |
| 28260 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28261 |
&& REGNO (operands[4]) == REGNO (operands[0]) |
| 28262 |
&& REGNO (operands[5]) == REGNO (operands[3]) |
| 28263 |
&& peep2_reg_dead_p (4, operands[3]) |
| 28264 |
&& ((REGNO (operands[0]) == REGNO (operands[3])) |
| 28265 |
|| peep2_reg_dead_p (2, operands[0])) |
| 28266 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28267 |
&& !reg_overlap_mentioned_p (operands[3], operands[1]) |
| 28268 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28269 |
&& (<MODE>mode != QImode |
| 28270 |
|| immediate_operand (operands[2], QImode) |
| 28271 |
|| any_QIreg_operand (operands[2], QImode)) |
| 28272 |
&& ix86_match_ccmode (peep2_next_insn (3), CCGOCmode)" |
| 28273 |
[(parallel [(set (match_dup 6) (match_dup 8)) |
| 28274 |
(set (match_dup 1) (match_dup 7))])] |
| 28275 |
{ |
| 28276 |
operands[6] = SET_DEST (PATTERN (peep2_next_insn (3))); |
| 28277 |
operands[7] |
| 28278 |
= gen_rtx_PLUS (<MODE>mode, |
| 28279 |
copy_rtx (operands[1]), |
| 28280 |
gen_lowpart (<MODE>mode, operands[2])); |
| 28281 |
operands[8] |
| 28282 |
= gen_rtx_COMPARE (GET_MODE (operands[6]), |
| 28283 |
copy_rtx (operands[7]), |
| 28284 |
const0_rtx); |
| 28285 |
}) |
| 28286 |
|
| 28287 |
(define_peephole2 |
| 28288 |
[(parallel [(set (match_operand:SWI 0 "register_operand") |
| 28289 |
(match_operator:SWI 2 "plusminuslogic_operator" |
| 28290 |
[(match_dup 0) |
| 28291 |
(match_operand:SWI 1 "memory_operand")])) |
| 28292 |
(clobber (reg:CC FLAGS_REG))]) |
| 28293 |
(set (match_dup 1) (match_dup 0)) |
| 28294 |
(set (reg FLAGS_REG) (compare (match_dup 0) (const_int 0)))] |
| 28295 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28296 |
&& COMMUTATIVE_ARITH_P (operands[2]) |
| 28297 |
&& peep2_reg_dead_p (3, operands[0]) |
| 28298 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28299 |
&& ix86_match_ccmode (peep2_next_insn (2), |
| 28300 |
GET_CODE (operands[2]) == PLUS |
| 28301 |
? CCGOCmode : CCNOmode)" |
| 28302 |
[(parallel [(set (match_dup 3) (match_dup 5)) |
| 28303 |
(set (match_dup 1) (match_dup 4))])] |
| 28304 |
{ |
| 28305 |
operands[3] = SET_DEST (PATTERN (peep2_next_insn (2))); |
| 28306 |
operands[4] |
| 28307 |
= gen_rtx_fmt_ee (GET_CODE (operands[2]), GET_MODE (operands[2]), |
| 28308 |
copy_rtx (operands[1]), |
| 28309 |
operands[0]); |
| 28310 |
operands[5] |
| 28311 |
= gen_rtx_COMPARE (GET_MODE (operands[3]), |
| 28312 |
copy_rtx (operands[4]), |
| 28313 |
const0_rtx); |
| 28314 |
}) |
| 28315 |
|
| 28316 |
;; Likewise for cmpelim optimized pattern. |
| 28317 |
(define_peephole2 |
| 28318 |
[(parallel [(set (reg FLAGS_REG) |
| 28319 |
(compare (match_operator:SWI 2 "plusminuslogic_operator" |
| 28320 |
[(match_operand:SWI 0 "register_operand") |
| 28321 |
(match_operand:SWI 1 "memory_operand")]) |
| 28322 |
(const_int 0))) |
| 28323 |
(set (match_dup 0) (match_dup 2))]) |
| 28324 |
(set (match_dup 1) (match_dup 0))] |
| 28325 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28326 |
&& COMMUTATIVE_ARITH_P (operands[2]) |
| 28327 |
&& peep2_reg_dead_p (2, operands[0]) |
| 28328 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28329 |
&& ix86_match_ccmode (peep2_next_insn (0), |
| 28330 |
GET_CODE (operands[2]) == PLUS |
| 28331 |
? CCGOCmode : CCNOmode)" |
| 28332 |
[(parallel [(set (match_dup 3) (match_dup 5)) |
| 28333 |
(set (match_dup 1) (match_dup 4))])] |
| 28334 |
{ |
| 28335 |
operands[3] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (0)), 0, 0)); |
| 28336 |
operands[4] |
| 28337 |
= gen_rtx_fmt_ee (GET_CODE (operands[2]), GET_MODE (operands[2]), |
| 28338 |
copy_rtx (operands[1]), operands[0]); |
| 28339 |
operands[5] |
| 28340 |
= gen_rtx_COMPARE (GET_MODE (operands[3]), copy_rtx (operands[4]), |
| 28341 |
const0_rtx); |
| 28342 |
}) |
| 28343 |
|
| 28344 |
(define_peephole2 |
| 28345 |
[(set (match_operand:SWI12 0 "register_operand") |
| 28346 |
(match_operand:SWI12 1 "memory_operand")) |
| 28347 |
(parallel [(set (match_operand:SI 4 "register_operand") |
| 28348 |
(match_operator:SI 3 "plusminuslogic_operator" |
| 28349 |
[(match_dup 4) |
| 28350 |
(match_operand:SI 2 "nonmemory_operand")])) |
| 28351 |
(clobber (reg:CC FLAGS_REG))]) |
| 28352 |
(set (match_dup 1) (match_dup 0)) |
| 28353 |
(set (reg FLAGS_REG) (compare (match_dup 0) (const_int 0)))] |
| 28354 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28355 |
&& REGNO (operands[0]) == REGNO (operands[4]) |
| 28356 |
&& peep2_reg_dead_p (4, operands[0]) |
| 28357 |
&& (<MODE>mode != QImode |
| 28358 |
|| immediate_operand (operands[2], SImode) |
| 28359 |
|| any_QIreg_operand (operands[2], SImode)) |
| 28360 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28361 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28362 |
&& ix86_match_ccmode (peep2_next_insn (3), |
| 28363 |
(GET_CODE (operands[3]) == PLUS |
| 28364 |
|| GET_CODE (operands[3]) == MINUS) |
| 28365 |
? CCGOCmode : CCNOmode)" |
| 28366 |
[(parallel [(set (match_dup 5) (match_dup 7)) |
| 28367 |
(set (match_dup 1) (match_dup 6))])] |
| 28368 |
{ |
| 28369 |
operands[5] = SET_DEST (PATTERN (peep2_next_insn (3))); |
| 28370 |
operands[6] |
| 28371 |
= gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode, |
| 28372 |
copy_rtx (operands[1]), |
| 28373 |
gen_lowpart (<MODE>mode, operands[2])); |
| 28374 |
operands[7] |
| 28375 |
= gen_rtx_COMPARE (GET_MODE (operands[5]), |
| 28376 |
copy_rtx (operands[6]), |
| 28377 |
const0_rtx); |
| 28378 |
}) |
| 28379 |
|
| 28380 |
;; peephole2 comes before regcprop, so deal also with a case that |
| 28381 |
;; would be cleaned up by regcprop. |
| 28382 |
(define_peephole2 |
| 28383 |
[(set (match_operand:SWI 0 "register_operand") |
| 28384 |
(match_operand:SWI 1 "memory_operand")) |
| 28385 |
(parallel [(set (match_dup 0) |
| 28386 |
(match_operator:SWI 3 "plusminuslogic_operator" |
| 28387 |
[(match_dup 0) |
| 28388 |
(match_operand:SWI 2 "<nonmemory_operand>")])) |
| 28389 |
(clobber (reg:CC FLAGS_REG))]) |
| 28390 |
(set (match_operand:SWI 4 "register_operand") (match_dup 0)) |
| 28391 |
(set (match_dup 1) (match_dup 4)) |
| 28392 |
(set (reg FLAGS_REG) (compare (match_dup 4) (const_int 0)))] |
| 28393 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28394 |
&& peep2_reg_dead_p (3, operands[0]) |
| 28395 |
&& peep2_reg_dead_p (5, operands[4]) |
| 28396 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28397 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28398 |
&& !reg_overlap_mentioned_p (operands[4], operands[1]) |
| 28399 |
&& (<MODE>mode != QImode |
| 28400 |
|| immediate_operand (operands[2], QImode) |
| 28401 |
|| any_QIreg_operand (operands[2], QImode)) |
| 28402 |
&& ix86_match_ccmode (peep2_next_insn (4), |
| 28403 |
(GET_CODE (operands[3]) == PLUS |
| 28404 |
|| GET_CODE (operands[3]) == MINUS) |
| 28405 |
? CCGOCmode : CCNOmode)" |
| 28406 |
[(parallel [(set (match_dup 5) (match_dup 7)) |
| 28407 |
(set (match_dup 1) (match_dup 6))])] |
| 28408 |
{ |
| 28409 |
operands[5] = SET_DEST (PATTERN (peep2_next_insn (4))); |
| 28410 |
operands[6] |
| 28411 |
= gen_rtx_fmt_ee (GET_CODE (operands[3]), GET_MODE (operands[3]), |
| 28412 |
copy_rtx (operands[1]), |
| 28413 |
operands[2]); |
| 28414 |
operands[7] |
| 28415 |
= gen_rtx_COMPARE (GET_MODE (operands[5]), |
| 28416 |
copy_rtx (operands[6]), |
| 28417 |
const0_rtx); |
| 28418 |
}) |
| 28419 |
|
| 28420 |
(define_peephole2 |
| 28421 |
[(set (match_operand:SWI12 0 "register_operand") |
| 28422 |
(match_operand:SWI12 1 "memory_operand")) |
| 28423 |
(parallel [(set (match_operand:SI 4 "register_operand") |
| 28424 |
(match_operator:SI 3 "plusminuslogic_operator" |
| 28425 |
[(match_dup 4) |
| 28426 |
(match_operand:SI 2 "nonmemory_operand")])) |
| 28427 |
(clobber (reg:CC FLAGS_REG))]) |
| 28428 |
(set (match_operand:SWI12 5 "register_operand") (match_dup 0)) |
| 28429 |
(set (match_dup 1) (match_dup 5)) |
| 28430 |
(set (reg FLAGS_REG) (compare (match_dup 5) (const_int 0)))] |
| 28431 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28432 |
&& REGNO (operands[0]) == REGNO (operands[4]) |
| 28433 |
&& peep2_reg_dead_p (3, operands[0]) |
| 28434 |
&& peep2_reg_dead_p (5, operands[5]) |
| 28435 |
&& (<MODE>mode != QImode |
| 28436 |
|| immediate_operand (operands[2], SImode) |
| 28437 |
|| any_QIreg_operand (operands[2], SImode)) |
| 28438 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28439 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28440 |
&& !reg_overlap_mentioned_p (operands[5], operands[1]) |
| 28441 |
&& ix86_match_ccmode (peep2_next_insn (4), |
| 28442 |
(GET_CODE (operands[3]) == PLUS |
| 28443 |
|| GET_CODE (operands[3]) == MINUS) |
| 28444 |
? CCGOCmode : CCNOmode)" |
| 28445 |
[(parallel [(set (match_dup 6) (match_dup 8)) |
| 28446 |
(set (match_dup 1) (match_dup 7))])] |
| 28447 |
{ |
| 28448 |
operands[6] = SET_DEST (PATTERN (peep2_next_insn (4))); |
| 28449 |
operands[7] |
| 28450 |
= gen_rtx_fmt_ee (GET_CODE (operands[3]), <MODE>mode, |
| 28451 |
copy_rtx (operands[1]), |
| 28452 |
gen_lowpart (<MODE>mode, operands[2])); |
| 28453 |
operands[8] |
| 28454 |
= gen_rtx_COMPARE (GET_MODE (operands[6]), |
| 28455 |
copy_rtx (operands[7]), |
| 28456 |
const0_rtx); |
| 28457 |
}) |
| 28458 |
|
| 28459 |
;; Likewise for cmpelim optimized pattern. |
| 28460 |
(define_peephole2 |
| 28461 |
[(set (match_operand:SWI 0 "register_operand") |
| 28462 |
(match_operand:SWI 1 "memory_operand")) |
| 28463 |
(parallel [(set (reg FLAGS_REG) |
| 28464 |
(compare (match_operator:SWI 3 "plusminuslogic_operator" |
| 28465 |
[(match_dup 0) |
| 28466 |
(match_operand:SWI 2 "<nonmemory_operand>")]) |
| 28467 |
(const_int 0))) |
| 28468 |
(set (match_dup 0) (match_dup 3))]) |
| 28469 |
(set (match_operand:SWI 4 "register_operand") (match_dup 0)) |
| 28470 |
(set (match_dup 1) (match_dup 4))] |
| 28471 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28472 |
&& peep2_reg_dead_p (3, operands[0]) |
| 28473 |
&& peep2_reg_dead_p (4, operands[4]) |
| 28474 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28475 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28476 |
&& !reg_overlap_mentioned_p (operands[4], operands[1]) |
| 28477 |
&& ix86_match_ccmode (peep2_next_insn (1), |
| 28478 |
(GET_CODE (operands[3]) == PLUS |
| 28479 |
|| GET_CODE (operands[3]) == MINUS) |
| 28480 |
? CCGOCmode : CCNOmode)" |
| 28481 |
[(parallel [(set (match_dup 5) (match_dup 7)) |
| 28482 |
(set (match_dup 1) (match_dup 6))])] |
| 28483 |
{ |
| 28484 |
operands[5] = SET_DEST (XVECEXP (PATTERN (peep2_next_insn (1)), 0, 0)); |
| 28485 |
operands[6] |
| 28486 |
= gen_rtx_fmt_ee (GET_CODE (operands[3]), GET_MODE (operands[3]), |
| 28487 |
copy_rtx (operands[1]), operands[2]); |
| 28488 |
operands[7] |
| 28489 |
= gen_rtx_COMPARE (GET_MODE (operands[5]), copy_rtx (operands[6]), |
| 28490 |
const0_rtx); |
| 28491 |
}) |
| 28492 |
|
| 28493 |
;; Special cases for xor, where (x ^= y) != 0 is (misoptimized) |
| 28494 |
;; into x = z; x ^= y; x != z |
| 28495 |
(define_peephole2 |
| 28496 |
[(set (match_operand:SWI 0 "register_operand") |
| 28497 |
(match_operand:SWI 1 "memory_operand")) |
| 28498 |
(set (match_operand:SWI 3 "register_operand") (match_dup 0)) |
| 28499 |
(parallel [(set (match_operand:SWI 4 "register_operand") |
| 28500 |
(xor:SWI (match_dup 4) |
| 28501 |
(match_operand:SWI 2 "<nonmemory_operand>"))) |
| 28502 |
(clobber (reg:CC FLAGS_REG))]) |
| 28503 |
(set (match_dup 1) (match_dup 4)) |
| 28504 |
(set (reg:CCZ FLAGS_REG) |
| 28505 |
(compare:CCZ (match_operand:SWI 5 "register_operand") |
| 28506 |
(match_operand:SWI 6 "<nonmemory_operand>")))] |
| 28507 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28508 |
&& (REGNO (operands[4]) == REGNO (operands[0]) |
| 28509 |
|| REGNO (operands[4]) == REGNO (operands[3])) |
| 28510 |
&& (rtx_equal_p (operands[REGNO (operands[4]) == REGNO (operands[0]) |
| 28511 |
? 3 : 0], operands[5]) |
| 28512 |
? rtx_equal_p (operands[2], operands[6]) |
| 28513 |
: rtx_equal_p (operands[2], operands[5]) |
| 28514 |
&& rtx_equal_p (operands[REGNO (operands[4]) == REGNO (operands[0]) |
| 28515 |
? 3 : 0], operands[6])) |
| 28516 |
&& peep2_reg_dead_p (4, operands[4]) |
| 28517 |
&& peep2_reg_dead_p (5, operands[REGNO (operands[4]) == REGNO (operands[0]) |
| 28518 |
? 3 : 0]) |
| 28519 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28520 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28521 |
&& !reg_overlap_mentioned_p (operands[3], operands[0]) |
| 28522 |
&& !reg_overlap_mentioned_p (operands[3], operands[1]) |
| 28523 |
&& !reg_overlap_mentioned_p (operands[3], operands[2]) |
| 28524 |
&& (<MODE>mode != QImode |
| 28525 |
|| immediate_operand (operands[2], QImode) |
| 28526 |
|| any_QIreg_operand (operands[2], QImode))" |
| 28527 |
[(parallel [(set (match_dup 7) (match_dup 9)) |
| 28528 |
(set (match_dup 1) (match_dup 8))])] |
| 28529 |
{ |
| 28530 |
operands[7] = SET_DEST (PATTERN (peep2_next_insn (4))); |
| 28531 |
operands[8] = gen_rtx_XOR (<MODE>mode, copy_rtx (operands[1]), |
| 28532 |
operands[2]); |
| 28533 |
operands[9] |
| 28534 |
= gen_rtx_COMPARE (GET_MODE (operands[7]), |
| 28535 |
copy_rtx (operands[8]), |
| 28536 |
const0_rtx); |
| 28537 |
}) |
| 28538 |
|
| 28539 |
(define_peephole2 |
| 28540 |
[(set (match_operand:SWI12 0 "register_operand") |
| 28541 |
(match_operand:SWI12 1 "memory_operand")) |
| 28542 |
(set (match_operand:SWI12 3 "register_operand") (match_dup 0)) |
| 28543 |
(parallel [(set (match_operand:SI 4 "register_operand") |
| 28544 |
(xor:SI (match_dup 4) |
| 28545 |
(match_operand:SI 2 "<nonmemory_operand>"))) |
| 28546 |
(clobber (reg:CC FLAGS_REG))]) |
| 28547 |
(set (match_dup 1) (match_operand:SWI12 5 "register_operand")) |
| 28548 |
(set (reg:CCZ FLAGS_REG) |
| 28549 |
(compare:CCZ (match_operand:SWI12 6 "register_operand") |
| 28550 |
(match_operand:SWI12 7 "<nonmemory_operand>")))] |
| 28551 |
"(TARGET_READ_MODIFY_WRITE || optimize_insn_for_size_p ()) |
| 28552 |
&& (REGNO (operands[5]) == REGNO (operands[0]) |
| 28553 |
|| REGNO (operands[5]) == REGNO (operands[3])) |
| 28554 |
&& REGNO (operands[5]) == REGNO (operands[4]) |
| 28555 |
&& (rtx_equal_p (operands[REGNO (operands[5]) == REGNO (operands[0]) |
| 28556 |
? 3 : 0], operands[6]) |
| 28557 |
? (REG_P (operands[2]) |
| 28558 |
? REG_P (operands[7]) && REGNO (operands[2]) == REGNO (operands[7]) |
| 28559 |
: rtx_equal_p (operands[2], operands[7])) |
| 28560 |
: (rtx_equal_p (operands[REGNO (operands[5]) == REGNO (operands[0]) |
| 28561 |
? 3 : 0], operands[7]) |
| 28562 |
&& REG_P (operands[2]) |
| 28563 |
&& REGNO (operands[2]) == REGNO (operands[6]))) |
| 28564 |
&& peep2_reg_dead_p (4, operands[5]) |
| 28565 |
&& peep2_reg_dead_p (5, operands[REGNO (operands[5]) == REGNO (operands[0]) |
| 28566 |
? 3 : 0]) |
| 28567 |
&& !reg_overlap_mentioned_p (operands[0], operands[1]) |
| 28568 |
&& !reg_overlap_mentioned_p (operands[0], operands[2]) |
| 28569 |
&& !reg_overlap_mentioned_p (operands[3], operands[0]) |
| 28570 |
&& !reg_overlap_mentioned_p (operands[3], operands[1]) |
| 28571 |
&& !reg_overlap_mentioned_p (operands[3], operands[2]) |
| 28572 |
&& (<MODE>mode != QImode |
| 28573 |
|| immediate_operand (operands[2], SImode) |
| 28574 |
|| any_QIreg_operand (operands[2], SImode))" |
| 28575 |
[(parallel [(set (match_dup 8) (match_dup 10)) |
| 28576 |
(set (match_dup 1) (match_dup 9))])] |
| 28577 |
{ |
| 28578 |
operands[8] = SET_DEST (PATTERN (peep2_next_insn (4))); |
| 28579 |
operands[9] = gen_rtx_XOR (<MODE>mode, copy_rtx (operands[1]), |
| 28580 |
gen_lowpart (<MODE>mode, operands[2])); |
| 28581 |
operands[10] |
| 28582 |
= gen_rtx_COMPARE (GET_MODE (operands[8]), |
| 28583 |
copy_rtx (operands[9]), |
| 28584 |
const0_rtx); |
| 28585 |
}) |
| 28586 |
|
| 28587 |
;; Attempt to optimize away memory stores of values the memory already |
| 28588 |
;; has. See PR79593. |
| 28589 |
(define_peephole2 |
| 28590 |
[(set (match_operand 0 "register_operand") |
| 28591 |
(match_operand 1 "memory_operand")) |
| 28592 |
(set (match_operand 2 "memory_operand") (match_dup 0))] |
| 28593 |
"!MEM_VOLATILE_P (operands[1]) |
| 28594 |
&& !MEM_VOLATILE_P (operands[2]) |
| 28595 |
&& rtx_equal_p (operands[1], operands[2]) |
| 28596 |
&& !reg_overlap_mentioned_p (operands[0], operands[2])" |
| 28597 |
[(set (match_dup 0) (match_dup 1))]) |
| 28598 |
|
| 28599 |
;; Attempt to always use XOR for zeroing registers (including FP modes). |
| 28600 |
(define_peephole2 |
| 28601 |
[(set (match_operand 0 "general_reg_operand") |
| 28602 |
(match_operand 1 "const0_operand"))] |
| 28603 |
"GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD |
| 28604 |
&& (! TARGET_USE_MOV0 || optimize_insn_for_size_p ()) |
| 28605 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28606 |
[(parallel [(set (match_dup 0) (const_int 0)) |
| 28607 |
(clobber (reg:CC FLAGS_REG))])] |
| 28608 |
"operands[0] = gen_lowpart (word_mode, operands[0]);") |
| 28609 |
|
| 28610 |
(define_peephole2 |
| 28611 |
[(set (strict_low_part (match_operand:SWI12 0 "general_reg_operand")) |
| 28612 |
(const_int 0))] |
| 28613 |
"(! TARGET_USE_MOV0 || optimize_insn_for_size_p ()) |
| 28614 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28615 |
[(parallel [(set (strict_low_part (match_dup 0)) (const_int 0)) |
| 28616 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28617 |
|
| 28618 |
;; For HI, SI and DI modes, or $-1,reg is smaller than mov $-1,reg. |
| 28619 |
(define_peephole2 |
| 28620 |
[(set (match_operand:SWI248 0 "general_reg_operand") |
| 28621 |
(const_int -1))] |
| 28622 |
"(TARGET_MOVE_M1_VIA_OR || optimize_insn_for_size_p ()) |
| 28623 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28624 |
[(parallel [(set (match_dup 0) (const_int -1)) |
| 28625 |
(clobber (reg:CC FLAGS_REG))])] |
| 28626 |
{ |
| 28627 |
if (<MODE_SIZE> < GET_MODE_SIZE (SImode)) |
| 28628 |
operands[0] = gen_lowpart (SImode, operands[0]); |
| 28629 |
}) |
| 28630 |
|
| 28631 |
;; Attempt to convert simple lea to add/shift. |
| 28632 |
;; These can be created by move expanders. |
| 28633 |
;; Disable PLUS peepholes on TARGET_OPT_AGU, since all |
| 28634 |
;; relevant lea instructions were already split. |
| 28635 |
|
| 28636 |
(define_peephole2 |
| 28637 |
[(set (match_operand:SWI48 0 "register_operand") |
| 28638 |
(plus:SWI48 (match_dup 0) |
| 28639 |
(match_operand:SWI48 1 "<nonmemory_operand>")))] |
| 28640 |
"!TARGET_OPT_AGU |
| 28641 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28642 |
[(parallel [(set (match_dup 0) (plus:SWI48 (match_dup 0) (match_dup 1))) |
| 28643 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28644 |
|
| 28645 |
(define_peephole2 |
| 28646 |
[(set (match_operand:SWI48 0 "register_operand") |
| 28647 |
(plus:SWI48 (match_operand:SWI48 1 "<nonmemory_operand>") |
| 28648 |
(match_dup 0)))] |
| 28649 |
"!TARGET_OPT_AGU |
| 28650 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28651 |
[(parallel [(set (match_dup 0) (plus:SWI48 (match_dup 0) (match_dup 1))) |
| 28652 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28653 |
|
| 28654 |
(define_peephole2 |
| 28655 |
[(set (match_operand:DI 0 "register_operand") |
| 28656 |
(zero_extend:DI |
| 28657 |
(plus:SI (match_operand:SI 1 "register_operand") |
| 28658 |
(match_operand:SI 2 "nonmemory_operand"))))] |
| 28659 |
"TARGET_64BIT && !TARGET_OPT_AGU |
| 28660 |
&& REGNO (operands[0]) == REGNO (operands[1]) |
| 28661 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28662 |
[(parallel [(set (match_dup 0) |
| 28663 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2)))) |
| 28664 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28665 |
|
| 28666 |
(define_peephole2 |
| 28667 |
[(set (match_operand:DI 0 "register_operand") |
| 28668 |
(zero_extend:DI |
| 28669 |
(plus:SI (match_operand:SI 1 "nonmemory_operand") |
| 28670 |
(match_operand:SI 2 "register_operand"))))] |
| 28671 |
"TARGET_64BIT && !TARGET_OPT_AGU |
| 28672 |
&& REGNO (operands[0]) == REGNO (operands[2]) |
| 28673 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28674 |
[(parallel [(set (match_dup 0) |
| 28675 |
(zero_extend:DI (plus:SI (match_dup 2) (match_dup 1)))) |
| 28676 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28677 |
|
| 28678 |
(define_peephole2 |
| 28679 |
[(set (match_operand:SWI48 0 "register_operand") |
| 28680 |
(mult:SWI48 (match_dup 0) |
| 28681 |
(match_operand:SWI48 1 "const_int_operand")))] |
| 28682 |
"pow2p_hwi (INTVAL (operands[1])) |
| 28683 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28684 |
[(parallel [(set (match_dup 0) (ashift:SWI48 (match_dup 0) (match_dup 1))) |
| 28685 |
(clobber (reg:CC FLAGS_REG))])] |
| 28686 |
"operands[1] = GEN_INT (exact_log2 (INTVAL (operands[1])));") |
| 28687 |
|
| 28688 |
(define_peephole2 |
| 28689 |
[(set (match_operand:DI 0 "register_operand") |
| 28690 |
(zero_extend:DI |
| 28691 |
(mult:SI (match_operand:SI 1 "register_operand") |
| 28692 |
(match_operand:SI 2 "const_int_operand"))))] |
| 28693 |
"TARGET_64BIT |
| 28694 |
&& pow2p_hwi (INTVAL (operands[2])) |
| 28695 |
&& REGNO (operands[0]) == REGNO (operands[1]) |
| 28696 |
&& peep2_regno_dead_p (0, FLAGS_REG)" |
| 28697 |
[(parallel [(set (match_dup 0) |
| 28698 |
(zero_extend:DI (ashift:SI (match_dup 1) (match_dup 2)))) |
| 28699 |
(clobber (reg:CC FLAGS_REG))])] |
| 28700 |
"operands[2] = GEN_INT (exact_log2 (INTVAL (operands[2])));") |
| 28701 |
|
| 28702 |
;; The ESP adjustments can be done by the push and pop instructions. Resulting |
| 28703 |
;; code is shorter, since push is only 1 byte, while add imm, %esp is 3 bytes. |
| 28704 |
;; On many CPUs it is also faster, since special hardware to avoid esp |
| 28705 |
;; dependencies is present. |
| 28706 |
|
| 28707 |
;; While some of these conversions may be done using splitters, we use |
| 28708 |
;; peepholes in order to allow combine_stack_adjustments pass to see |
| 28709 |
;; nonobfuscated RTL. |
| 28710 |
|
| 28711 |
;; Convert prologue esp subtractions to push. |
| 28712 |
;; We need register to push. In order to keep verify_flow_info happy we have |
| 28713 |
;; two choices |
| 28714 |
;; - use scratch and clobber it in order to avoid dependencies |
| 28715 |
;; - use already live register |
| 28716 |
;; We can't use the second way right now, since there is no reliable way how to |
| 28717 |
;; verify that given register is live. First choice will also most likely in |
| 28718 |
;; fewer dependencies. On the place of esp adjustments it is very likely that |
| 28719 |
;; call clobbered registers are dead. We may want to use base pointer as an |
| 28720 |
;; alternative when no register is available later. |
| 28721 |
|
| 28722 |
(define_peephole2 |
| 28723 |
[(match_scratch:W 1 "r") |
| 28724 |
(parallel [(set (reg:P SP_REG) |
| 28725 |
(plus:P (reg:P SP_REG) |
| 28726 |
(match_operand:P 0 "const_int_operand"))) |
| 28727 |
(clobber (reg:CC FLAGS_REG)) |
| 28728 |
(clobber (mem:BLK (scratch)))])] |
| 28729 |
"(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) |
| 28730 |
&& INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode) |
| 28731 |
&& !ix86_red_zone_used" |
| 28732 |
[(clobber (match_dup 1)) |
| 28733 |
(parallel [(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) |
| 28734 |
(clobber (mem:BLK (scratch)))])]) |
| 28735 |
|
| 28736 |
(define_peephole2 |
| 28737 |
[(match_scratch:W 1 "r") |
| 28738 |
(parallel [(set (reg:P SP_REG) |
| 28739 |
(plus:P (reg:P SP_REG) |
| 28740 |
(match_operand:P 0 "const_int_operand"))) |
| 28741 |
(clobber (reg:CC FLAGS_REG)) |
| 28742 |
(clobber (mem:BLK (scratch)))])] |
| 28743 |
"(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) |
| 28744 |
&& INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode) |
| 28745 |
&& !ix86_red_zone_used" |
| 28746 |
[(clobber (match_dup 1)) |
| 28747 |
(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) |
| 28748 |
(parallel [(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) |
| 28749 |
(clobber (mem:BLK (scratch)))])]) |
| 28750 |
|
| 28751 |
;; Convert esp subtractions to push. |
| 28752 |
(define_peephole2 |
| 28753 |
[(match_scratch:W 1 "r") |
| 28754 |
(parallel [(set (reg:P SP_REG) |
| 28755 |
(plus:P (reg:P SP_REG) |
| 28756 |
(match_operand:P 0 "const_int_operand"))) |
| 28757 |
(clobber (reg:CC FLAGS_REG))])] |
| 28758 |
"(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) |
| 28759 |
&& INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode) |
| 28760 |
&& !ix86_red_zone_used" |
| 28761 |
[(clobber (match_dup 1)) |
| 28762 |
(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1))]) |
| 28763 |
|
| 28764 |
(define_peephole2 |
| 28765 |
[(match_scratch:W 1 "r") |
| 28766 |
(parallel [(set (reg:P SP_REG) |
| 28767 |
(plus:P (reg:P SP_REG) |
| 28768 |
(match_operand:P 0 "const_int_operand"))) |
| 28769 |
(clobber (reg:CC FLAGS_REG))])] |
| 28770 |
"(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) |
| 28771 |
&& INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode) |
| 28772 |
&& !ix86_red_zone_used" |
| 28773 |
[(clobber (match_dup 1)) |
| 28774 |
(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) |
| 28775 |
(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1))]) |
| 28776 |
|
| 28777 |
;; Convert epilogue deallocator to pop. |
| 28778 |
(define_peephole2 |
| 28779 |
[(match_scratch:W 1 "r") |
| 28780 |
(parallel [(set (reg:P SP_REG) |
| 28781 |
(plus:P (reg:P SP_REG) |
| 28782 |
(match_operand:P 0 "const_int_operand"))) |
| 28783 |
(clobber (reg:CC FLAGS_REG)) |
| 28784 |
(clobber (mem:BLK (scratch)))])] |
| 28785 |
"(TARGET_SINGLE_POP || optimize_insn_for_size_p ()) |
| 28786 |
&& INTVAL (operands[0]) == GET_MODE_SIZE (word_mode)" |
| 28787 |
[(parallel [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) |
| 28788 |
(clobber (mem:BLK (scratch)))])]) |
| 28789 |
|
| 28790 |
;; Two pops case is tricky, since pop causes dependency |
| 28791 |
;; on destination register. We use two registers if available. |
| 28792 |
(define_peephole2 |
| 28793 |
[(match_scratch:W 1 "r") |
| 28794 |
(match_scratch:W 2 "r") |
| 28795 |
(parallel [(set (reg:P SP_REG) |
| 28796 |
(plus:P (reg:P SP_REG) |
| 28797 |
(match_operand:P 0 "const_int_operand"))) |
| 28798 |
(clobber (reg:CC FLAGS_REG)) |
| 28799 |
(clobber (mem:BLK (scratch)))])] |
| 28800 |
"(TARGET_DOUBLE_POP || optimize_insn_for_size_p ()) |
| 28801 |
&& INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" |
| 28802 |
[(parallel [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) |
| 28803 |
(clobber (mem:BLK (scratch)))]) |
| 28804 |
(set (match_dup 2) (mem:W (post_inc:P (reg:P SP_REG))))]) |
| 28805 |
|
| 28806 |
(define_peephole2 |
| 28807 |
[(match_scratch:W 1 "r") |
| 28808 |
(parallel [(set (reg:P SP_REG) |
| 28809 |
(plus:P (reg:P SP_REG) |
| 28810 |
(match_operand:P 0 "const_int_operand"))) |
| 28811 |
(clobber (reg:CC FLAGS_REG)) |
| 28812 |
(clobber (mem:BLK (scratch)))])] |
| 28813 |
"optimize_insn_for_size_p () |
| 28814 |
&& INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" |
| 28815 |
[(parallel [(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) |
| 28816 |
(clobber (mem:BLK (scratch)))]) |
| 28817 |
(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG))))]) |
| 28818 |
|
| 28819 |
;; Convert esp additions to pop. |
| 28820 |
(define_peephole2 |
| 28821 |
[(match_scratch:W 1 "r") |
| 28822 |
(parallel [(set (reg:P SP_REG) |
| 28823 |
(plus:P (reg:P SP_REG) |
| 28824 |
(match_operand:P 0 "const_int_operand"))) |
| 28825 |
(clobber (reg:CC FLAGS_REG))])] |
| 28826 |
"INTVAL (operands[0]) == GET_MODE_SIZE (word_mode)" |
| 28827 |
[(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG))))]) |
| 28828 |
|
| 28829 |
;; Two pops case is tricky, since pop causes dependency |
| 28830 |
;; on destination register. We use two registers if available. |
| 28831 |
(define_peephole2 |
| 28832 |
[(match_scratch:W 1 "r") |
| 28833 |
(match_scratch:W 2 "r") |
| 28834 |
(parallel [(set (reg:P SP_REG) |
| 28835 |
(plus:P (reg:P SP_REG) |
| 28836 |
(match_operand:P 0 "const_int_operand"))) |
| 28837 |
(clobber (reg:CC FLAGS_REG))])] |
| 28838 |
"INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" |
| 28839 |
[(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) |
| 28840 |
(set (match_dup 2) (mem:W (post_inc:P (reg:P SP_REG))))]) |
| 28841 |
|
| 28842 |
(define_peephole2 |
| 28843 |
[(match_scratch:W 1 "r") |
| 28844 |
(parallel [(set (reg:P SP_REG) |
| 28845 |
(plus:P (reg:P SP_REG) |
| 28846 |
(match_operand:P 0 "const_int_operand"))) |
| 28847 |
(clobber (reg:CC FLAGS_REG))])] |
| 28848 |
"optimize_insn_for_size_p () |
| 28849 |
&& INTVAL (operands[0]) == 2*GET_MODE_SIZE (word_mode)" |
| 28850 |
[(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG)))) |
| 28851 |
(set (match_dup 1) (mem:W (post_inc:P (reg:P SP_REG))))]) |
| 28852 |
|
| 28853 |
;; Convert compares with 1 to shorter inc/dec operations when CF is not |
| 28854 |
;; required and register dies. Similarly for 128 to -128. |
| 28855 |
(define_peephole2 |
| 28856 |
[(set (match_operand 0 "flags_reg_operand") |
| 28857 |
(match_operator 1 "compare_operator" |
| 28858 |
[(match_operand 2 "register_operand") |
| 28859 |
(match_operand 3 "const_int_operand")]))] |
| 28860 |
"(((!TARGET_FUSE_CMP_AND_BRANCH || optimize_insn_for_size_p ()) |
| 28861 |
&& incdec_operand (operands[3], GET_MODE (operands[3]))) |
| 28862 |
|| (!TARGET_FUSE_CMP_AND_BRANCH |
| 28863 |
&& INTVAL (operands[3]) == 128)) |
| 28864 |
&& ix86_match_ccmode (insn, CCGCmode) |
| 28865 |
&& peep2_reg_dead_p (1, operands[2])" |
| 28866 |
[(parallel [(set (match_dup 0) |
| 28867 |
(match_op_dup 1 [(match_dup 2) (match_dup 3)])) |
| 28868 |
(clobber (match_dup 2))])]) |
| 28869 |
|
| 28870 |
;; Convert imul by three, five and nine into lea |
| 28871 |
(define_peephole2 |
| 28872 |
[(parallel |
| 28873 |
[(set (match_operand:SWI48 0 "register_operand") |
| 28874 |
(mult:SWI48 (match_operand:SWI48 1 "index_reg_operand") |
| 28875 |
(match_operand:SWI48 2 "const359_operand"))) |
| 28876 |
(clobber (reg:CC FLAGS_REG))])] |
| 28877 |
"!TARGET_PARTIAL_REG_STALL |
| 28878 |
|| <MODE>mode == SImode |
| 28879 |
|| optimize_function_for_size_p (cfun)" |
| 28880 |
[(set (match_dup 0) |
| 28881 |
(plus:SWI48 (mult:SWI48 (match_dup 1) (match_dup 2)) |
| 28882 |
(match_dup 1)))] |
| 28883 |
"operands[2] = GEN_INT (INTVAL (operands[2]) - 1);") |
| 28884 |
|
| 28885 |
(define_peephole2 |
| 28886 |
[(parallel |
| 28887 |
[(set (match_operand:SWI48 0 "index_reg_operand") |
| 28888 |
(mult:SWI48 (match_operand:SWI48 1 "nonimmediate_operand") |
| 28889 |
(match_operand:SWI48 2 "const359_operand"))) |
| 28890 |
(clobber (reg:CC FLAGS_REG))])] |
| 28891 |
"optimize_insn_for_speed_p () |
| 28892 |
&& (!TARGET_PARTIAL_REG_STALL || <MODE>mode == SImode)" |
| 28893 |
[(set (match_dup 0) (match_dup 1)) |
| 28894 |
(set (match_dup 0) |
| 28895 |
(plus:SWI48 (mult:SWI48 (match_dup 0) (match_dup 2)) |
| 28896 |
(match_dup 0)))] |
| 28897 |
"operands[2] = GEN_INT (INTVAL (operands[2]) - 1);") |
| 28898 |
|
| 28899 |
;; imul $32bit_imm, mem, reg is vector decoded, while |
| 28900 |
;; imul $32bit_imm, reg, reg is direct decoded. |
| 28901 |
(define_peephole2 |
| 28902 |
[(match_scratch:SWI48 3 "r") |
| 28903 |
(parallel [(set (match_operand:SWI48 0 "register_operand") |
| 28904 |
(mult:SWI48 (match_operand:SWI48 1 "memory_operand") |
| 28905 |
(match_operand:SWI48 2 "immediate_operand"))) |
| 28906 |
(clobber (reg:CC FLAGS_REG))])] |
| 28907 |
"TARGET_SLOW_IMUL_IMM32_MEM && optimize_insn_for_speed_p () |
| 28908 |
&& !satisfies_constraint_K (operands[2])" |
| 28909 |
[(set (match_dup 3) (match_dup 1)) |
| 28910 |
(parallel [(set (match_dup 0) (mult:SWI48 (match_dup 3) (match_dup 2))) |
| 28911 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28912 |
|
| 28913 |
(define_peephole2 |
| 28914 |
[(match_scratch:SI 3 "r") |
| 28915 |
(parallel [(set (match_operand:DI 0 "register_operand") |
| 28916 |
(zero_extend:DI |
| 28917 |
(mult:SI (match_operand:SI 1 "memory_operand") |
| 28918 |
(match_operand:SI 2 "immediate_operand")))) |
| 28919 |
(clobber (reg:CC FLAGS_REG))])] |
| 28920 |
"TARGET_64BIT |
| 28921 |
&& TARGET_SLOW_IMUL_IMM32_MEM && optimize_insn_for_speed_p () |
| 28922 |
&& !satisfies_constraint_K (operands[2])" |
| 28923 |
[(set (match_dup 3) (match_dup 1)) |
| 28924 |
(parallel [(set (match_dup 0) |
| 28925 |
(zero_extend:DI (mult:SI (match_dup 3) (match_dup 2)))) |
| 28926 |
(clobber (reg:CC FLAGS_REG))])]) |
| 28927 |
|
| 28928 |
;; imul $8/16bit_imm, regmem, reg is vector decoded. |
| 28929 |
;; Convert it into imul reg, reg |
| 28930 |
;; It would be better to force assembler to encode instruction using long |
| 28931 |
;; immediate, but there is apparently no way to do so. |
| 28932 |
(define_peephole2 |
| 28933 |
[(parallel [(set (match_operand:SWI248 0 "register_operand") |
| 28934 |
(mult:SWI248 |
| 28935 |
(match_operand:SWI248 1 "nonimmediate_operand") |
| 28936 |
(match_operand:SWI248 2 "const_int_operand"))) |
| 28937 |
(clobber (reg:CC FLAGS_REG))]) |
| 28938 |
(match_scratch:SWI248 3 "r")] |
| 28939 |
"TARGET_SLOW_IMUL_IMM8 && optimize_insn_for_speed_p () |
| 28940 |
&& satisfies_constraint_K (operands[2])" |
| 28941 |
[(set (match_dup 3) (match_dup 2)) |
| 28942 |
(parallel [(set (match_dup 0) (mult:SWI248 (match_dup 0) (match_dup 3))) |
| 28943 |
(clobber (reg:CC FLAGS_REG))])] |
| 28944 |
{ |
| 28945 |
if (!rtx_equal_p (operands[0], operands[1])) |
| 28946 |
emit_move_insn (operands[0], operands[1]); |
| 28947 |
}) |
| 28948 |
|
| 28949 |
;; After splitting up read-modify operations, array accesses with memory |
| 28950 |
;; operands might end up in form: |
| 28951 |
;; sall $2, %eax |
| 28952 |
;; movl 4(%esp), %edx |
| 28953 |
;; addl %edx, %eax |
| 28954 |
;; instead of pre-splitting: |
| 28955 |
;; sall $2, %eax |
| 28956 |
;; addl 4(%esp), %eax |
| 28957 |
;; Turn it into: |
| 28958 |
;; movl 4(%esp), %edx |
| 28959 |
;; leal (%edx,%eax,4), %eax |
| 28960 |
|
| 28961 |
(define_peephole2 |
| 28962 |
[(match_scratch:W 5 "r") |
| 28963 |
(parallel [(set (match_operand 0 "register_operand") |
| 28964 |
(ashift (match_operand 1 "register_operand") |
| 28965 |
(match_operand 2 "const_int_operand"))) |
| 28966 |
(clobber (reg:CC FLAGS_REG))]) |
| 28967 |
(parallel [(set (match_operand 3 "register_operand") |
| 28968 |
(plus (match_dup 0) |
| 28969 |
(match_operand 4 "x86_64_general_operand"))) |
| 28970 |
(clobber (reg:CC FLAGS_REG))])] |
| 28971 |
"IN_RANGE (INTVAL (operands[2]), 1, 3) |
| 28972 |
/* Validate MODE for lea. */ |
| 28973 |
&& ((!TARGET_PARTIAL_REG_STALL |
| 28974 |
&& (GET_MODE (operands[0]) == QImode |
| 28975 |
|| GET_MODE (operands[0]) == HImode)) |
| 28976 |
|| GET_MODE (operands[0]) == SImode |
| 28977 |
|| (TARGET_64BIT && GET_MODE (operands[0]) == DImode)) |
| 28978 |
&& (rtx_equal_p (operands[0], operands[3]) |
| 28979 |
|| peep2_reg_dead_p (2, operands[0])) |
| 28980 |
/* We reorder load and the shift. */ |
| 28981 |
&& !reg_overlap_mentioned_p (operands[0], operands[4])" |
| 28982 |
[(set (match_dup 5) (match_dup 4)) |
| 28983 |
(set (match_dup 0) (match_dup 1))] |
| 28984 |
{ |
| 28985 |
machine_mode op1mode = GET_MODE (operands[1]); |
| 28986 |
machine_mode mode = op1mode == DImode ? DImode : SImode; |
| 28987 |
int scale = 1 << INTVAL (operands[2]); |
| 28988 |
rtx index = gen_lowpart (word_mode, operands[1]); |
| 28989 |
rtx base = gen_lowpart (word_mode, operands[5]); |
| 28990 |
rtx dest = gen_lowpart (mode, operands[3]); |
| 28991 |
|
| 28992 |
operands[1] = gen_rtx_PLUS (word_mode, base, |
| 28993 |
gen_rtx_MULT (word_mode, index, GEN_INT (scale))); |
| 28994 |
if (mode != word_mode) |
| 28995 |
operands[1] = gen_rtx_SUBREG (mode, operands[1], 0); |
| 28996 |
|
| 28997 |
operands[5] = base; |
| 28998 |
if (op1mode != word_mode) |
| 28999 |
operands[5] = gen_lowpart (op1mode, operands[5]); |
| 29000 |
|
| 29001 |
operands[0] = dest; |
| 29002 |
}) |
| 29003 |
|
| 29004 |
;; We used to use "int $5", in honor of #BR which maps to interrupt vector 5. |
| 29005 |
;; That, however, is usually mapped by the OS to SIGSEGV, which is often |
| 29006 |
;; caught for use by garbage collectors and the like. Using an insn that |
| 29007 |
;; maps to SIGILL makes it more likely the program will rightfully die. |
| 29008 |
;; Keeping with tradition, "6" is in honor of #UD. |
| 29009 |
(define_insn "trap" |
| 29010 |
[(trap_if (const_int 1) (const_int 6))] |
| 29011 |
"" |
| 29012 |
{ |
| 29013 |
#ifdef HAVE_AS_IX86_UD2 |
| 29014 |
return "ud2"; |
| 29015 |
#else |
| 29016 |
return ASM_SHORT "0x0b0f"; |
| 29017 |
#endif |
| 29018 |
} |
| 29019 |
[(set_attr "length" "2")]) |
| 29020 |
|
| 29021 |
(define_insn "ud2" |
| 29022 |
[(unspec_volatile [(const_int 0)] UNSPECV_UD2)] |
| 29023 |
"" |
| 29024 |
{ |
| 29025 |
#ifdef HAVE_AS_IX86_UD2 |
| 29026 |
return "ud2"; |
| 29027 |
#else |
| 29028 |
return ASM_SHORT "0x0b0f"; |
| 29029 |
#endif |
| 29030 |
} |
| 29031 |
[(set_attr "length" "2")]) |
| 29032 |
|
| 29033 |
(define_expand "prefetch" |
| 29034 |
[(prefetch (match_operand 0 "address_operand") |
| 29035 |
(match_operand:SI 1 "const_int_operand") |
| 29036 |
(match_operand:SI 2 "const_int_operand"))] |
| 29037 |
"TARGET_3DNOW || TARGET_PREFETCH_SSE || TARGET_PRFCHW || TARGET_MOVRS" |
| 29038 |
{ |
| 29039 |
int write = INTVAL (operands[1]); |
| 29040 |
int locality = INTVAL (operands[2]); |
| 29041 |
|
| 29042 |
gcc_assert (IN_RANGE (locality, 0, 3)); |
| 29043 |
gcc_assert (IN_RANGE (write, 0, 2)); |
| 29044 |
|
| 29045 |
/* Use 3dNOW prefetch in case we are asking for write prefetch not |
| 29046 |
supported by SSE counterpart (non-SSE2 athlon machines) or the |
| 29047 |
SSE prefetch is not available (K6 machines). Otherwise use SSE |
| 29048 |
prefetch as it allows specifying of locality. */ |
| 29049 |
|
| 29050 |
if (write == 1) |
| 29051 |
{ |
| 29052 |
if (TARGET_PRFCHW) |
| 29053 |
operands[2] = GEN_INT (3); |
| 29054 |
else if (TARGET_3DNOW && !TARGET_SSE2) |
| 29055 |
operands[2] = GEN_INT (3); |
| 29056 |
else if (TARGET_PREFETCH_SSE) |
| 29057 |
operands[1] = const0_rtx; |
| 29058 |
else if (TARGET_3DNOW) |
| 29059 |
operands[2] = GEN_INT (3); |
| 29060 |
else |
| 29061 |
{ |
| 29062 |
gcc_assert (TARGET_MOVRS); |
| 29063 |
FAIL; |
| 29064 |
} |
| 29065 |
} |
| 29066 |
else |
| 29067 |
{ |
| 29068 |
if (!TARGET_MOVRS || locality != 1) |
| 29069 |
{ |
| 29070 |
operands[1] = const0_rtx; |
| 29071 |
write = 0; |
| 29072 |
} |
| 29073 |
if (TARGET_PREFETCH_SSE || write == 2) |
| 29074 |
; |
| 29075 |
else if (TARGET_3DNOW) |
| 29076 |
operands[2] = GEN_INT (3); |
| 29077 |
else |
| 29078 |
{ |
| 29079 |
gcc_assert (TARGET_MOVRS); |
| 29080 |
FAIL; |
| 29081 |
} |
| 29082 |
} |
| 29083 |
}) |
| 29084 |
|
| 29085 |
(define_insn "*prefetch_sse" |
| 29086 |
[(prefetch (match_operand 0 "address_operand" "p") |
| 29087 |
(const_int 0) |
| 29088 |
(match_operand:SI 1 "const_int_operand"))] |
| 29089 |
"TARGET_PREFETCH_SSE" |
| 29090 |
{ |
| 29091 |
static const char * const patterns[4] = { |
| 29092 |
"prefetchnta\t%a0", "prefetcht2\t%a0", "prefetcht1\t%a0", "prefetcht0\t%a0" |
| 29093 |
}; |
| 29094 |
|
| 29095 |
int locality = INTVAL (operands[1]); |
| 29096 |
gcc_assert (IN_RANGE (locality, 0, 3)); |
| 29097 |
|
| 29098 |
return patterns[locality]; |
| 29099 |
} |
| 29100 |
[(set_attr "type" "sse") |
| 29101 |
(set_attr "atom_sse_attr" "prefetch") |
| 29102 |
(set (attr "length_address") |
| 29103 |
(symbol_ref "memory_address_length (operands[0], false)")) |
| 29104 |
(set_attr "memory" "none")]) |
| 29105 |
|
| 29106 |
(define_insn "*prefetch_3dnow" |
| 29107 |
[(prefetch (match_operand 0 "address_operand" "p") |
| 29108 |
(match_operand:SI 1 "const_int_operand") |
| 29109 |
(const_int 3))] |
| 29110 |
"TARGET_3DNOW || TARGET_PRFCHW" |
| 29111 |
{ |
| 29112 |
if (operands[1] == const0_rtx) |
| 29113 |
return "prefetch\t%a0"; |
| 29114 |
else |
| 29115 |
return "prefetchw\t%a0"; |
| 29116 |
} |
| 29117 |
[(set_attr "type" "mmx") |
| 29118 |
(set (attr "length_address") |
| 29119 |
(symbol_ref "memory_address_length (operands[0], false)")) |
| 29120 |
(set_attr "memory" "none")]) |
| 29121 |
|
| 29122 |
(define_insn "prefetchi" |
| 29123 |
[(unspec_volatile [(match_operand 0 "local_func_symbolic_operand" "p") |
| 29124 |
(match_operand:SI 1 "const_int_operand")] |
| 29125 |
UNSPECV_PREFETCHI)] |
| 29126 |
"TARGET_PREFETCHI && TARGET_64BIT" |
| 29127 |
{ |
| 29128 |
static const char * const patterns[2] = { |
| 29129 |
"prefetchit1\t%a0", "prefetchit0\t%a0" |
| 29130 |
}; |
| 29131 |
|
| 29132 |
int locality = INTVAL (operands[1]); |
| 29133 |
gcc_assert (IN_RANGE (locality, 2, 3)); |
| 29134 |
|
| 29135 |
return patterns[locality - 2]; |
| 29136 |
} |
| 29137 |
[(set_attr "type" "sse") |
| 29138 |
(set (attr "length_address") |
| 29139 |
(symbol_ref "memory_address_length (operands[0], false)")) |
| 29140 |
(set_attr "memory" "none")]) |
| 29141 |
|
| 29142 |
(define_insn "*prefetch_rst2" |
| 29143 |
[(prefetch (match_operand 0 "address_operand" "p") |
| 29144 |
(const_int 2) |
| 29145 |
(const_int 1))] |
| 29146 |
"TARGET_MOVRS" |
| 29147 |
"prefetchrst2\t%a0" |
| 29148 |
[(set_attr "type" "sse") |
| 29149 |
(set_attr "atom_sse_attr" "prefetch") |
| 29150 |
(set (attr "length_address") |
| 29151 |
(symbol_ref "memory_address_length (operands[0], false)")) |
| 29152 |
(set_attr "memory" "none")]) |
| 29153 |
|
| 29154 |
(define_insn "sse4_2_crc32<mode>" |
| 29155 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 29156 |
(unspec:SI |
| 29157 |
[(match_operand:SI 1 "register_operand" "0") |
| 29158 |
(match_operand:SWI124 2 "nonimmediate_operand" "<r>m")] |
| 29159 |
UNSPEC_CRC32))] |
| 29160 |
"TARGET_CRC32" |
| 29161 |
"crc32{<imodesuffix>}\t{%2, %0|%0, %2}" |
| 29162 |
[(set_attr "type" "sselog1") |
| 29163 |
(set_attr "prefix_rep" "1") |
| 29164 |
(set_attr "prefix_extra" "1") |
| 29165 |
(set (attr "prefix_data16") |
| 29166 |
(if_then_else (match_operand:HI 2) |
| 29167 |
(const_string "1") |
| 29168 |
(const_string "*"))) |
| 29169 |
(set (attr "prefix_rex") |
| 29170 |
(if_then_else (match_operand:QI 2 "ext_QIreg_operand") |
| 29171 |
(const_string "1") |
| 29172 |
(const_string "*"))) |
| 29173 |
(set_attr "mode" "SI")]) |
| 29174 |
|
| 29175 |
(define_insn "sse4_2_crc32di" |
| 29176 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 29177 |
(zero_extend:DI |
| 29178 |
(unspec:SI |
| 29179 |
[(match_operand:SI 1 "register_operand" "0") |
| 29180 |
(match_operand:DI 2 "nonimmediate_operand" "rm")] |
| 29181 |
UNSPEC_CRC32)))] |
| 29182 |
"TARGET_64BIT && TARGET_CRC32" |
| 29183 |
"crc32{q}\t{%2, %0|%0, %2}" |
| 29184 |
[(set_attr "type" "sselog1") |
| 29185 |
(set_attr "prefix_rep" "1") |
| 29186 |
(set_attr "prefix_extra" "1") |
| 29187 |
(set_attr "mode" "DI")]) |
| 29188 |
|
| 29189 |
(define_insn "rdpmc" |
| 29190 |
[(set (match_operand:DI 0 "register_operand" "=A") |
| 29191 |
(unspec_volatile:DI [(match_operand:SI 1 "register_operand" "c")] |
| 29192 |
UNSPECV_RDPMC))] |
| 29193 |
"!TARGET_64BIT" |
| 29194 |
"rdpmc" |
| 29195 |
[(set_attr "type" "other") |
| 29196 |
(set_attr "length" "2")]) |
| 29197 |
|
| 29198 |
(define_insn "rdpmc_rex64" |
| 29199 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 29200 |
(unspec_volatile:DI [(match_operand:SI 2 "register_operand" "c")] |
| 29201 |
UNSPECV_RDPMC)) |
| 29202 |
(set (match_operand:DI 1 "register_operand" "=d") |
| 29203 |
(unspec_volatile:DI [(match_dup 2)] UNSPECV_RDPMC))] |
| 29204 |
"TARGET_64BIT" |
| 29205 |
"rdpmc" |
| 29206 |
[(set_attr "type" "other") |
| 29207 |
(set_attr "length" "2")]) |
| 29208 |
|
| 29209 |
(define_insn "rdtsc" |
| 29210 |
[(set (match_operand:DI 0 "register_operand" "=A") |
| 29211 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC))] |
| 29212 |
"!TARGET_64BIT" |
| 29213 |
"rdtsc" |
| 29214 |
[(set_attr "type" "other") |
| 29215 |
(set_attr "length" "2")]) |
| 29216 |
|
| 29217 |
(define_insn "rdtsc_rex64" |
| 29218 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 29219 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC)) |
| 29220 |
(set (match_operand:DI 1 "register_operand" "=d") |
| 29221 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC))] |
| 29222 |
"TARGET_64BIT" |
| 29223 |
"rdtsc" |
| 29224 |
[(set_attr "type" "other") |
| 29225 |
(set_attr "length" "2")]) |
| 29226 |
|
| 29227 |
(define_insn "rdtscp" |
| 29228 |
[(set (match_operand:DI 0 "register_operand" "=A") |
| 29229 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSCP)) |
| 29230 |
(set (match_operand:SI 1 "register_operand" "=c") |
| 29231 |
(unspec_volatile:SI [(const_int 0)] UNSPECV_RDTSCP))] |
| 29232 |
"!TARGET_64BIT" |
| 29233 |
"rdtscp" |
| 29234 |
[(set_attr "type" "other") |
| 29235 |
(set_attr "length" "3")]) |
| 29236 |
|
| 29237 |
(define_insn "rdtscp_rex64" |
| 29238 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 29239 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSCP)) |
| 29240 |
(set (match_operand:DI 1 "register_operand" "=d") |
| 29241 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSCP)) |
| 29242 |
(set (match_operand:SI 2 "register_operand" "=c") |
| 29243 |
(unspec_volatile:SI [(const_int 0)] UNSPECV_RDTSCP))] |
| 29244 |
"TARGET_64BIT" |
| 29245 |
"rdtscp" |
| 29246 |
[(set_attr "type" "other") |
| 29247 |
(set_attr "length" "3")]) |
| 29248 |
|
| 29249 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 29250 |
;; |
| 29251 |
;; FXSR, XSAVE and XSAVEOPT instructions |
| 29252 |
;; |
| 29253 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 29254 |
|
| 29255 |
(define_insn "fxsave" |
| 29256 |
[(set (match_operand:BLK 0 "memory_operand" "=m") |
| 29257 |
(unspec_volatile:BLK [(const_int 0)] UNSPECV_FXSAVE))] |
| 29258 |
"TARGET_FXSR" |
| 29259 |
"fxsave\t%0" |
| 29260 |
[(set_attr "type" "other") |
| 29261 |
(set_attr "memory" "store") |
| 29262 |
(set (attr "length") |
| 29263 |
(symbol_ref "ix86_attr_length_address_default (insn) + 3"))]) |
| 29264 |
|
| 29265 |
(define_insn "fxsave64" |
| 29266 |
[(set (match_operand:BLK 0 "memory_operand" "=jm") |
| 29267 |
(unspec_volatile:BLK [(const_int 0)] UNSPECV_FXSAVE64))] |
| 29268 |
"TARGET_64BIT && TARGET_FXSR" |
| 29269 |
"fxsave64\t%0" |
| 29270 |
[(set_attr "type" "other") |
| 29271 |
(set_attr "addr" "gpr16") |
| 29272 |
(set_attr "memory" "store") |
| 29273 |
(set (attr "length") |
| 29274 |
(symbol_ref "ix86_attr_length_address_default (insn) + 4"))]) |
| 29275 |
|
| 29276 |
(define_insn "fxrstor" |
| 29277 |
[(unspec_volatile [(match_operand:BLK 0 "memory_operand" "m")] |
| 29278 |
UNSPECV_FXRSTOR)] |
| 29279 |
"TARGET_FXSR" |
| 29280 |
"fxrstor\t%0" |
| 29281 |
[(set_attr "type" "other") |
| 29282 |
(set_attr "memory" "load") |
| 29283 |
(set (attr "length") |
| 29284 |
(symbol_ref "ix86_attr_length_address_default (insn) + 3"))]) |
| 29285 |
|
| 29286 |
(define_insn "fxrstor64" |
| 29287 |
[(unspec_volatile [(match_operand:BLK 0 "memory_operand" "jm")] |
| 29288 |
UNSPECV_FXRSTOR64)] |
| 29289 |
"TARGET_64BIT && TARGET_FXSR" |
| 29290 |
"fxrstor64\t%0" |
| 29291 |
[(set_attr "type" "other") |
| 29292 |
(set_attr "addr" "gpr16") |
| 29293 |
(set_attr "memory" "load") |
| 29294 |
(set (attr "length") |
| 29295 |
(symbol_ref "ix86_attr_length_address_default (insn) + 4"))]) |
| 29296 |
|
| 29297 |
(define_int_iterator ANY_XSAVE |
| 29298 |
[UNSPECV_XSAVE |
| 29299 |
(UNSPECV_XSAVEOPT "TARGET_XSAVEOPT") |
| 29300 |
(UNSPECV_XSAVEC "TARGET_XSAVEC") |
| 29301 |
(UNSPECV_XSAVES "TARGET_XSAVES")]) |
| 29302 |
|
| 29303 |
(define_int_iterator ANY_XSAVE64 |
| 29304 |
[UNSPECV_XSAVE64 |
| 29305 |
(UNSPECV_XSAVEOPT64 "TARGET_XSAVEOPT") |
| 29306 |
(UNSPECV_XSAVEC64 "TARGET_XSAVEC") |
| 29307 |
(UNSPECV_XSAVES64 "TARGET_XSAVES")]) |
| 29308 |
|
| 29309 |
(define_int_attr xsave |
| 29310 |
[(UNSPECV_XSAVE "xsave") |
| 29311 |
(UNSPECV_XSAVE64 "xsave64") |
| 29312 |
(UNSPECV_XSAVEOPT "xsaveopt") |
| 29313 |
(UNSPECV_XSAVEOPT64 "xsaveopt64") |
| 29314 |
(UNSPECV_XSAVEC "xsavec") |
| 29315 |
(UNSPECV_XSAVEC64 "xsavec64") |
| 29316 |
(UNSPECV_XSAVES "xsaves") |
| 29317 |
(UNSPECV_XSAVES64 "xsaves64")]) |
| 29318 |
|
| 29319 |
(define_int_iterator ANY_XRSTOR |
| 29320 |
[UNSPECV_XRSTOR |
| 29321 |
(UNSPECV_XRSTORS "TARGET_XSAVES")]) |
| 29322 |
|
| 29323 |
(define_int_iterator ANY_XRSTOR64 |
| 29324 |
[UNSPECV_XRSTOR64 |
| 29325 |
(UNSPECV_XRSTORS64 "TARGET_XSAVES")]) |
| 29326 |
|
| 29327 |
(define_int_attr xrstor |
| 29328 |
[(UNSPECV_XRSTOR "xrstor") |
| 29329 |
(UNSPECV_XRSTOR64 "xrstor") |
| 29330 |
(UNSPECV_XRSTORS "xrstors") |
| 29331 |
(UNSPECV_XRSTORS64 "xrstors")]) |
| 29332 |
|
| 29333 |
(define_insn "<xsave>" |
| 29334 |
[(set (match_operand:BLK 0 "memory_operand" "=m") |
| 29335 |
(unspec_volatile:BLK |
| 29336 |
[(match_operand:DI 1 "register_operand" "A")] |
| 29337 |
ANY_XSAVE))] |
| 29338 |
"!TARGET_64BIT && TARGET_XSAVE" |
| 29339 |
"<xsave>\t%0" |
| 29340 |
[(set_attr "type" "other") |
| 29341 |
(set_attr "memory" "store") |
| 29342 |
(set (attr "length") |
| 29343 |
(symbol_ref "ix86_attr_length_address_default (insn) + 3"))]) |
| 29344 |
|
| 29345 |
(define_insn "<xsave>_rex64" |
| 29346 |
[(set (match_operand:BLK 0 "memory_operand" "=jm") |
| 29347 |
(unspec_volatile:BLK |
| 29348 |
[(match_operand:SI 1 "register_operand" "a") |
| 29349 |
(match_operand:SI 2 "register_operand" "d")] |
| 29350 |
ANY_XSAVE))] |
| 29351 |
"TARGET_64BIT && TARGET_XSAVE" |
| 29352 |
"<xsave>\t%0" |
| 29353 |
[(set_attr "type" "other") |
| 29354 |
(set_attr "memory" "store") |
| 29355 |
(set_attr "addr" "gpr16") |
| 29356 |
(set (attr "length") |
| 29357 |
(symbol_ref "ix86_attr_length_address_default (insn) + 3"))]) |
| 29358 |
|
| 29359 |
(define_insn "<xsave>" |
| 29360 |
[(set (match_operand:BLK 0 "memory_operand" "=jm") |
| 29361 |
(unspec_volatile:BLK |
| 29362 |
[(match_operand:SI 1 "register_operand" "a") |
| 29363 |
(match_operand:SI 2 "register_operand" "d")] |
| 29364 |
ANY_XSAVE64))] |
| 29365 |
"TARGET_64BIT && TARGET_XSAVE" |
| 29366 |
"<xsave>\t%0" |
| 29367 |
[(set_attr "type" "other") |
| 29368 |
(set_attr "memory" "store") |
| 29369 |
(set_attr "addr" "gpr16") |
| 29370 |
(set (attr "length") |
| 29371 |
(symbol_ref "ix86_attr_length_address_default (insn) + 4"))]) |
| 29372 |
|
| 29373 |
(define_insn "<xrstor>" |
| 29374 |
[(unspec_volatile:BLK |
| 29375 |
[(match_operand:BLK 0 "memory_operand" "m") |
| 29376 |
(match_operand:DI 1 "register_operand" "A")] |
| 29377 |
ANY_XRSTOR)] |
| 29378 |
"!TARGET_64BIT && TARGET_XSAVE" |
| 29379 |
"<xrstor>\t%0" |
| 29380 |
[(set_attr "type" "other") |
| 29381 |
(set_attr "memory" "load") |
| 29382 |
(set (attr "length") |
| 29383 |
(symbol_ref "ix86_attr_length_address_default (insn) + 3"))]) |
| 29384 |
|
| 29385 |
(define_insn "<xrstor>_rex64" |
| 29386 |
[(unspec_volatile:BLK |
| 29387 |
[(match_operand:BLK 0 "memory_operand" "jm") |
| 29388 |
(match_operand:SI 1 "register_operand" "a") |
| 29389 |
(match_operand:SI 2 "register_operand" "d")] |
| 29390 |
ANY_XRSTOR)] |
| 29391 |
"TARGET_64BIT && TARGET_XSAVE" |
| 29392 |
"<xrstor>\t%0" |
| 29393 |
[(set_attr "type" "other") |
| 29394 |
(set_attr "memory" "load") |
| 29395 |
(set_attr "addr" "gpr16") |
| 29396 |
(set (attr "length") |
| 29397 |
(symbol_ref "ix86_attr_length_address_default (insn) + 3"))]) |
| 29398 |
|
| 29399 |
(define_insn "<xrstor>64" |
| 29400 |
[(unspec_volatile:BLK |
| 29401 |
[(match_operand:BLK 0 "memory_operand" "jm") |
| 29402 |
(match_operand:SI 1 "register_operand" "a") |
| 29403 |
(match_operand:SI 2 "register_operand" "d")] |
| 29404 |
ANY_XRSTOR64)] |
| 29405 |
"TARGET_64BIT && TARGET_XSAVE" |
| 29406 |
"<xrstor>64\t%0" |
| 29407 |
[(set_attr "type" "other") |
| 29408 |
(set_attr "memory" "load") |
| 29409 |
(set_attr "addr" "gpr16") |
| 29410 |
(set (attr "length") |
| 29411 |
(symbol_ref "ix86_attr_length_address_default (insn) + 4"))]) |
| 29412 |
|
| 29413 |
(define_insn "xsetbv" |
| 29414 |
[(unspec_volatile:SI |
| 29415 |
[(match_operand:SI 0 "register_operand" "c") |
| 29416 |
(match_operand:DI 1 "register_operand" "A")] |
| 29417 |
UNSPECV_XSETBV)] |
| 29418 |
"!TARGET_64BIT && TARGET_XSAVE" |
| 29419 |
"xsetbv" |
| 29420 |
[(set_attr "type" "other")]) |
| 29421 |
|
| 29422 |
(define_insn "xsetbv_rex64" |
| 29423 |
[(unspec_volatile:SI |
| 29424 |
[(match_operand:SI 0 "register_operand" "c") |
| 29425 |
(match_operand:SI 1 "register_operand" "a") |
| 29426 |
(match_operand:SI 2 "register_operand" "d")] |
| 29427 |
UNSPECV_XSETBV)] |
| 29428 |
"TARGET_64BIT && TARGET_XSAVE" |
| 29429 |
"xsetbv" |
| 29430 |
[(set_attr "type" "other")]) |
| 29431 |
|
| 29432 |
(define_insn "xgetbv" |
| 29433 |
[(set (match_operand:DI 0 "register_operand" "=A") |
| 29434 |
(unspec_volatile:DI [(match_operand:SI 1 "register_operand" "c")] |
| 29435 |
UNSPECV_XGETBV))] |
| 29436 |
"!TARGET_64BIT && TARGET_XSAVE" |
| 29437 |
"xgetbv" |
| 29438 |
[(set_attr "type" "other")]) |
| 29439 |
|
| 29440 |
(define_insn "xgetbv_rex64" |
| 29441 |
[(set (match_operand:DI 0 "register_operand" "=a") |
| 29442 |
(unspec_volatile:DI [(match_operand:SI 2 "register_operand" "c")] |
| 29443 |
UNSPECV_XGETBV)) |
| 29444 |
(set (match_operand:DI 1 "register_operand" "=d") |
| 29445 |
(unspec_volatile:DI [(match_dup 2)] UNSPECV_XGETBV))] |
| 29446 |
"TARGET_64BIT && TARGET_XSAVE" |
| 29447 |
"xgetbv" |
| 29448 |
[(set_attr "type" "other")]) |
| 29449 |
|
| 29450 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 29451 |
;; |
| 29452 |
;; Floating-point instructions for atomic compound assignments |
| 29453 |
;; |
| 29454 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 29455 |
|
| 29456 |
; Clobber all floating-point registers on environment save and restore |
| 29457 |
; to ensure that the TOS value saved at fnstenv is valid after fldenv. |
| 29458 |
(define_insn "fnstenv" |
| 29459 |
[(set (match_operand:BLK 0 "memory_operand" "=m") |
| 29460 |
(unspec_volatile:BLK [(const_int 0)] UNSPECV_FNSTENV)) |
| 29461 |
(clobber (reg:XF ST0_REG)) |
| 29462 |
(clobber (reg:XF ST1_REG)) |
| 29463 |
(clobber (reg:XF ST2_REG)) |
| 29464 |
(clobber (reg:XF ST3_REG)) |
| 29465 |
(clobber (reg:XF ST4_REG)) |
| 29466 |
(clobber (reg:XF ST5_REG)) |
| 29467 |
(clobber (reg:XF ST6_REG)) |
| 29468 |
(clobber (reg:XF ST7_REG))] |
| 29469 |
"TARGET_80387" |
| 29470 |
"fnstenv\t%0" |
| 29471 |
[(set_attr "type" "other") |
| 29472 |
(set_attr "memory" "store") |
| 29473 |
(set (attr "length") |
| 29474 |
(symbol_ref "ix86_attr_length_address_default (insn) + 2"))]) |
| 29475 |
|
| 29476 |
(define_insn "fldenv" |
| 29477 |
[(unspec_volatile [(match_operand:BLK 0 "memory_operand" "m")] |
| 29478 |
UNSPECV_FLDENV) |
| 29479 |
(clobber (reg:XF ST0_REG)) |
| 29480 |
(clobber (reg:XF ST1_REG)) |
| 29481 |
(clobber (reg:XF ST2_REG)) |
| 29482 |
(clobber (reg:XF ST3_REG)) |
| 29483 |
(clobber (reg:XF ST4_REG)) |
| 29484 |
(clobber (reg:XF ST5_REG)) |
| 29485 |
(clobber (reg:XF ST6_REG)) |
| 29486 |
(clobber (reg:XF ST7_REG))] |
| 29487 |
"TARGET_80387" |
| 29488 |
"fldenv\t%0" |
| 29489 |
[(set_attr "type" "other") |
| 29490 |
(set_attr "memory" "load") |
| 29491 |
(set (attr "length") |
| 29492 |
(symbol_ref "ix86_attr_length_address_default (insn) + 2"))]) |
| 29493 |
|
| 29494 |
(define_insn "fnstsw" |
| 29495 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=a,m") |
| 29496 |
(unspec_volatile:HI [(const_int 0)] UNSPECV_FNSTSW))] |
| 29497 |
"TARGET_80387" |
| 29498 |
"fnstsw\t%0" |
| 29499 |
[(set_attr "type" "other,other") |
| 29500 |
(set_attr "memory" "none,store") |
| 29501 |
(set (attr "length") |
| 29502 |
(symbol_ref "ix86_attr_length_address_default (insn) + 2"))]) |
| 29503 |
|
| 29504 |
(define_insn "fnclex" |
| 29505 |
[(unspec_volatile [(const_int 0)] UNSPECV_FNCLEX)] |
| 29506 |
"TARGET_80387" |
| 29507 |
"fnclex" |
| 29508 |
[(set_attr "type" "other") |
| 29509 |
(set_attr "memory" "none") |
| 29510 |
(set_attr "length" "2")]) |
| 29511 |
|
| 29512 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 29513 |
;; |
| 29514 |
;; LWP instructions |
| 29515 |
;; |
| 29516 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 29517 |
|
| 29518 |
(define_insn "@lwp_llwpcb<mode>" |
| 29519 |
[(unspec_volatile [(match_operand:P 0 "register_operand" "r")] |
| 29520 |
UNSPECV_LLWP_INTRINSIC)] |
| 29521 |
"TARGET_LWP" |
| 29522 |
"llwpcb\t%0" |
| 29523 |
[(set_attr "type" "lwp") |
| 29524 |
(set_attr "mode" "<MODE>") |
| 29525 |
(set_attr "length" "5")]) |
| 29526 |
|
| 29527 |
(define_insn "@lwp_slwpcb<mode>" |
| 29528 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 29529 |
(unspec_volatile:P [(const_int 0)] UNSPECV_SLWP_INTRINSIC))] |
| 29530 |
"TARGET_LWP" |
| 29531 |
"slwpcb\t%0" |
| 29532 |
[(set_attr "type" "lwp") |
| 29533 |
(set_attr "mode" "<MODE>") |
| 29534 |
(set_attr "length" "5")]) |
| 29535 |
|
| 29536 |
(define_insn "@lwp_lwpval<mode>" |
| 29537 |
[(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r") |
| 29538 |
(match_operand:SI 1 "nonimmediate_operand" "rm") |
| 29539 |
(match_operand:SI 2 "const_int_operand")] |
| 29540 |
UNSPECV_LWPVAL_INTRINSIC)] |
| 29541 |
"TARGET_LWP" |
| 29542 |
"lwpval\t{%2, %1, %0|%0, %1, %2}" |
| 29543 |
[(set_attr "type" "lwp") |
| 29544 |
(set_attr "mode" "<MODE>") |
| 29545 |
(set (attr "length") |
| 29546 |
(symbol_ref "ix86_attr_length_address_default (insn) + 9"))]) |
| 29547 |
|
| 29548 |
(define_insn "@lwp_lwpins<mode>" |
| 29549 |
[(set (reg:CCC FLAGS_REG) |
| 29550 |
(unspec_volatile:CCC [(match_operand:SWI48 0 "register_operand" "r") |
| 29551 |
(match_operand:SI 1 "nonimmediate_operand" "rm") |
| 29552 |
(match_operand:SI 2 "const_int_operand")] |
| 29553 |
UNSPECV_LWPINS_INTRINSIC))] |
| 29554 |
"TARGET_LWP" |
| 29555 |
"lwpins\t{%2, %1, %0|%0, %1, %2}" |
| 29556 |
[(set_attr "type" "lwp") |
| 29557 |
(set_attr "mode" "<MODE>") |
| 29558 |
(set (attr "length") |
| 29559 |
(symbol_ref "ix86_attr_length_address_default (insn) + 9"))]) |
| 29560 |
|
| 29561 |
(define_int_iterator RDFSGSBASE |
| 29562 |
[UNSPECV_RDFSBASE |
| 29563 |
UNSPECV_RDGSBASE]) |
| 29564 |
|
| 29565 |
(define_int_iterator WRFSGSBASE |
| 29566 |
[UNSPECV_WRFSBASE |
| 29567 |
UNSPECV_WRGSBASE]) |
| 29568 |
|
| 29569 |
(define_int_attr fsgs |
| 29570 |
[(UNSPECV_RDFSBASE "fs") |
| 29571 |
(UNSPECV_RDGSBASE "gs") |
| 29572 |
(UNSPECV_WRFSBASE "fs") |
| 29573 |
(UNSPECV_WRGSBASE "gs")]) |
| 29574 |
|
| 29575 |
(define_insn "rd<fsgs>base<mode>" |
| 29576 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 29577 |
(unspec_volatile:SWI48 [(const_int 0)] RDFSGSBASE))] |
| 29578 |
"TARGET_64BIT && TARGET_FSGSBASE" |
| 29579 |
"rd<fsgs>base\t%0" |
| 29580 |
[(set_attr "type" "other") |
| 29581 |
(set_attr "prefix_0f" "1") |
| 29582 |
(set_attr "prefix_rep" "1")]) |
| 29583 |
|
| 29584 |
(define_insn "wr<fsgs>base<mode>" |
| 29585 |
[(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r")] |
| 29586 |
WRFSGSBASE)] |
| 29587 |
"TARGET_64BIT && TARGET_FSGSBASE" |
| 29588 |
"wr<fsgs>base\t%0" |
| 29589 |
[(set_attr "type" "other") |
| 29590 |
(set_attr "prefix_0f" "1") |
| 29591 |
(set_attr "prefix_rep" "1")]) |
| 29592 |
|
| 29593 |
(define_insn "ptwrite<mode>" |
| 29594 |
[(unspec_volatile [(match_operand:SWI48 0 "nonimmediate_operand" "rm")] |
| 29595 |
UNSPECV_PTWRITE)] |
| 29596 |
"TARGET_PTWRITE" |
| 29597 |
"ptwrite{<imodesuffix>|}\t%0" |
| 29598 |
[(set_attr "type" "other") |
| 29599 |
(set_attr "prefix_0f" "1") |
| 29600 |
(set_attr "prefix_rep" "1")]) |
| 29601 |
|
| 29602 |
(define_insn "@rdrand<mode>" |
| 29603 |
[(set (match_operand:SWI248 0 "register_operand" "=r") |
| 29604 |
(unspec_volatile:SWI248 [(const_int 0)] UNSPECV_RDRAND)) |
| 29605 |
(set (reg:CCC FLAGS_REG) |
| 29606 |
(unspec_volatile:CCC [(const_int 0)] UNSPECV_RDRAND))] |
| 29607 |
"TARGET_RDRND" |
| 29608 |
"rdrand\t%0" |
| 29609 |
[(set_attr "type" "other") |
| 29610 |
(set_attr "prefix_0f" "1")]) |
| 29611 |
|
| 29612 |
(define_insn "@rdseed<mode>" |
| 29613 |
[(set (match_operand:SWI248 0 "register_operand" "=r") |
| 29614 |
(unspec_volatile:SWI248 [(const_int 0)] UNSPECV_RDSEED)) |
| 29615 |
(set (reg:CCC FLAGS_REG) |
| 29616 |
(unspec_volatile:CCC [(const_int 0)] UNSPECV_RDSEED))] |
| 29617 |
"TARGET_RDSEED" |
| 29618 |
"rdseed\t%0" |
| 29619 |
[(set_attr "type" "other") |
| 29620 |
(set_attr "prefix_0f" "1")]) |
| 29621 |
|
| 29622 |
(define_expand "pause" |
| 29623 |
[(set (match_dup 0) |
| 29624 |
(unspec:BLK [(match_dup 0)] UNSPEC_PAUSE))] |
| 29625 |
"" |
| 29626 |
{ |
| 29627 |
operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); |
| 29628 |
MEM_VOLATILE_P (operands[0]) = 1; |
| 29629 |
}) |
| 29630 |
|
| 29631 |
;; Use "rep; nop", instead of "pause", to support older assemblers. |
| 29632 |
;; They have the same encoding. |
| 29633 |
(define_insn "*pause" |
| 29634 |
[(set (match_operand:BLK 0) |
| 29635 |
(unspec:BLK [(match_dup 0)] UNSPEC_PAUSE))] |
| 29636 |
"" |
| 29637 |
"rep%; nop" |
| 29638 |
[(set_attr "length" "2") |
| 29639 |
(set_attr "memory" "unknown")]) |
| 29640 |
|
| 29641 |
;; CET instructions |
| 29642 |
(define_insn "@rdssp<mode>" |
| 29643 |
[(set (match_operand:SWI48 0 "register_operand" "=r") |
| 29644 |
(unspec_volatile:SWI48 [(match_operand:SWI48 1 "register_operand" "0")] |
| 29645 |
UNSPECV_NOP_RDSSP))] |
| 29646 |
"TARGET_SHSTK || (flag_cf_protection & CF_RETURN)" |
| 29647 |
"rdssp<mskmodesuffix>\t%0" |
| 29648 |
[(set_attr "length" "6") |
| 29649 |
(set_attr "type" "other")]) |
| 29650 |
|
| 29651 |
(define_insn "@incssp<mode>" |
| 29652 |
[(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r")] |
| 29653 |
UNSPECV_INCSSP)] |
| 29654 |
"TARGET_SHSTK || (flag_cf_protection & CF_RETURN)" |
| 29655 |
"incssp<mskmodesuffix>\t%0" |
| 29656 |
[(set_attr "length" "4") |
| 29657 |
(set_attr "type" "other")]) |
| 29658 |
|
| 29659 |
(define_insn "saveprevssp" |
| 29660 |
[(unspec_volatile [(const_int 0)] UNSPECV_SAVEPREVSSP)] |
| 29661 |
"TARGET_SHSTK" |
| 29662 |
"saveprevssp" |
| 29663 |
[(set_attr "length" "5") |
| 29664 |
(set_attr "type" "other")]) |
| 29665 |
|
| 29666 |
(define_insn "rstorssp" |
| 29667 |
[(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] |
| 29668 |
UNSPECV_RSTORSSP)] |
| 29669 |
"TARGET_SHSTK" |
| 29670 |
"rstorssp\t%0" |
| 29671 |
[(set_attr "length" "5") |
| 29672 |
(set_attr "type" "other")]) |
| 29673 |
|
| 29674 |
(define_insn "@wrss<mode>" |
| 29675 |
[(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r") |
| 29676 |
(match_operand:SWI48 1 "memory_operand" "m")] |
| 29677 |
UNSPECV_WRSS)] |
| 29678 |
"TARGET_SHSTK" |
| 29679 |
"wrss<mskmodesuffix>\t{%0, %1|%1, %0}" |
| 29680 |
[(set_attr "length" "3") |
| 29681 |
(set_attr "type" "other")]) |
| 29682 |
|
| 29683 |
(define_insn "@wruss<mode>" |
| 29684 |
[(unspec_volatile [(match_operand:SWI48 0 "register_operand" "r") |
| 29685 |
(match_operand:SWI48 1 "memory_operand" "m")] |
| 29686 |
UNSPECV_WRUSS)] |
| 29687 |
"TARGET_SHSTK" |
| 29688 |
"wruss<mskmodesuffix>\t{%0, %1|%1, %0}" |
| 29689 |
[(set_attr "length" "4") |
| 29690 |
(set_attr "type" "other")]) |
| 29691 |
|
| 29692 |
(define_insn "setssbsy" |
| 29693 |
[(unspec_volatile [(const_int 0)] UNSPECV_SETSSBSY)] |
| 29694 |
"TARGET_SHSTK" |
| 29695 |
"setssbsy" |
| 29696 |
[(set_attr "length" "4") |
| 29697 |
(set_attr "type" "other")]) |
| 29698 |
|
| 29699 |
(define_insn "clrssbsy" |
| 29700 |
[(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] |
| 29701 |
UNSPECV_CLRSSBSY)] |
| 29702 |
"TARGET_SHSTK" |
| 29703 |
"clrssbsy\t%0" |
| 29704 |
[(set_attr "length" "4") |
| 29705 |
(set_attr "type" "other")]) |
| 29706 |
|
| 29707 |
(define_insn "nop_endbr" |
| 29708 |
[(unspec_volatile [(const_int 0)] UNSPECV_NOP_ENDBR)] |
| 29709 |
"(flag_cf_protection & CF_BRANCH)" |
| 29710 |
{ |
| 29711 |
return TARGET_64BIT ? "endbr64" : "endbr32"; |
| 29712 |
} |
| 29713 |
[(set_attr "length" "4") |
| 29714 |
(set_attr "length_immediate" "0") |
| 29715 |
(set_attr "modrm" "0")]) |
| 29716 |
|
| 29717 |
;; For RTM support |
| 29718 |
(define_expand "xbegin" |
| 29719 |
[(set (match_operand:SI 0 "register_operand") |
| 29720 |
(unspec_volatile:SI [(const_int 0)] UNSPECV_XBEGIN))] |
| 29721 |
"TARGET_RTM" |
| 29722 |
{ |
| 29723 |
rtx_code_label *label = gen_label_rtx (); |
| 29724 |
|
| 29725 |
/* xbegin is emitted as jump_insn, so reload won't be able |
| 29726 |
to reload its operand. Force the value into AX hard register. */ |
| 29727 |
rtx ax_reg = gen_rtx_REG (SImode, AX_REG); |
| 29728 |
emit_move_insn (ax_reg, constm1_rtx); |
| 29729 |
|
| 29730 |
emit_jump_insn (gen_xbegin_1 (ax_reg, label)); |
| 29731 |
|
| 29732 |
emit_label (label); |
| 29733 |
LABEL_NUSES (label) = 1; |
| 29734 |
|
| 29735 |
emit_move_insn (operands[0], ax_reg); |
| 29736 |
|
| 29737 |
DONE; |
| 29738 |
}) |
| 29739 |
|
| 29740 |
(define_insn "xbegin_1" |
| 29741 |
[(set (pc) |
| 29742 |
(if_then_else (ne (unspec [(const_int 0)] UNSPEC_XBEGIN_ABORT) |
| 29743 |
(const_int 0)) |
| 29744 |
(label_ref (match_operand 1)) |
| 29745 |
(pc))) |
| 29746 |
(set (match_operand:SI 0 "register_operand" "+a") |
| 29747 |
(unspec_volatile:SI [(match_dup 0)] UNSPECV_XBEGIN))] |
| 29748 |
"TARGET_RTM" |
| 29749 |
"xbegin\t%l1" |
| 29750 |
[(set_attr "type" "other") |
| 29751 |
(set_attr "length" "6")]) |
| 29752 |
|
| 29753 |
(define_insn "xend" |
| 29754 |
[(unspec_volatile [(const_int 0)] UNSPECV_XEND)] |
| 29755 |
"TARGET_RTM" |
| 29756 |
"xend" |
| 29757 |
[(set_attr "type" "other") |
| 29758 |
(set_attr "length" "3")]) |
| 29759 |
|
| 29760 |
(define_insn "xabort" |
| 29761 |
[(unspec_volatile [(match_operand:SI 0 "const_0_to_255_operand")] |
| 29762 |
UNSPECV_XABORT)] |
| 29763 |
"TARGET_RTM" |
| 29764 |
"xabort\t%0" |
| 29765 |
[(set_attr "type" "other") |
| 29766 |
(set_attr "length" "3")]) |
| 29767 |
|
| 29768 |
(define_expand "xtest" |
| 29769 |
[(set (match_operand:QI 0 "register_operand") |
| 29770 |
(unspec_volatile:QI [(const_int 0)] UNSPECV_XTEST))] |
| 29771 |
"TARGET_RTM" |
| 29772 |
{ |
| 29773 |
emit_insn (gen_xtest_1 ()); |
| 29774 |
|
| 29775 |
ix86_expand_setcc (operands[0], NE, |
| 29776 |
gen_rtx_REG (CCZmode, FLAGS_REG), const0_rtx); |
| 29777 |
DONE; |
| 29778 |
}) |
| 29779 |
|
| 29780 |
(define_insn "xtest_1" |
| 29781 |
[(set (reg:CCZ FLAGS_REG) |
| 29782 |
(unspec_volatile:CCZ [(const_int 0)] UNSPECV_XTEST))] |
| 29783 |
"TARGET_RTM" |
| 29784 |
"xtest" |
| 29785 |
[(set_attr "type" "other") |
| 29786 |
(set_attr "length" "3")]) |
| 29787 |
|
| 29788 |
(define_insn "clwb" |
| 29789 |
[(unspec_volatile [(match_operand 0 "address_operand" "p")] |
| 29790 |
UNSPECV_CLWB)] |
| 29791 |
"TARGET_CLWB" |
| 29792 |
"clwb\t%a0" |
| 29793 |
[(set_attr "type" "sse") |
| 29794 |
(set_attr "atom_sse_attr" "fence") |
| 29795 |
(set_attr "memory" "unknown")]) |
| 29796 |
|
| 29797 |
(define_insn "clflushopt" |
| 29798 |
[(unspec_volatile [(match_operand 0 "address_operand" "p")] |
| 29799 |
UNSPECV_CLFLUSHOPT)] |
| 29800 |
"TARGET_CLFLUSHOPT" |
| 29801 |
"clflushopt\t%a0" |
| 29802 |
[(set_attr "type" "sse") |
| 29803 |
(set_attr "atom_sse_attr" "fence") |
| 29804 |
(set_attr "memory" "unknown")]) |
| 29805 |
|
| 29806 |
;; MONITORX and MWAITX |
| 29807 |
(define_insn "mwaitx" |
| 29808 |
[(unspec_volatile [(match_operand:SI 0 "register_operand" "c") |
| 29809 |
(match_operand:SI 1 "register_operand" "a") |
| 29810 |
(match_operand:SI 2 "register_operand" "b")] |
| 29811 |
UNSPECV_MWAITX)] |
| 29812 |
"TARGET_MWAITX" |
| 29813 |
;; 64bit version is "mwaitx %rax,%rcx,%rbx". But only lower 32bits are used. |
| 29814 |
;; Since 32bit register operands are implicitly zero extended to 64bit, |
| 29815 |
;; we only need to set up 32bit registers. |
| 29816 |
"mwaitx" |
| 29817 |
[(set_attr "length" "3")]) |
| 29818 |
|
| 29819 |
(define_insn "@monitorx_<mode>" |
| 29820 |
[(unspec_volatile [(match_operand:P 0 "register_operand" "a") |
| 29821 |
(match_operand:SI 1 "register_operand" "c") |
| 29822 |
(match_operand:SI 2 "register_operand" "d")] |
| 29823 |
UNSPECV_MONITORX)] |
| 29824 |
"TARGET_MWAITX" |
| 29825 |
;; 64bit version is "monitorx %rax,%rcx,%rdx". But only lower 32bits in |
| 29826 |
;; RCX and RDX are used. Since 32bit register operands are implicitly |
| 29827 |
;; zero extended to 64bit, we only need to set up 32bit registers. |
| 29828 |
"%^monitorx" |
| 29829 |
[(set (attr "length") |
| 29830 |
(symbol_ref ("(Pmode != word_mode) + 3")))]) |
| 29831 |
|
| 29832 |
;; CLZERO |
| 29833 |
(define_insn "@clzero_<mode>" |
| 29834 |
[(unspec_volatile [(match_operand: P 0 "register_operand" "a")] |
| 29835 |
UNSPECV_CLZERO)] |
| 29836 |
"TARGET_CLZERO" |
| 29837 |
"clzero" |
| 29838 |
[(set_attr "length" "3") |
| 29839 |
(set_attr "memory" "unknown")]) |
| 29840 |
|
| 29841 |
;; RDPKRU and WRPKRU |
| 29842 |
|
| 29843 |
(define_expand "rdpkru" |
| 29844 |
[(parallel |
| 29845 |
[(set (match_operand:SI 0 "register_operand") |
| 29846 |
(unspec_volatile:SI [(match_dup 1)] UNSPECV_PKU)) |
| 29847 |
(set (match_dup 2) (const_int 0))])] |
| 29848 |
"TARGET_PKU" |
| 29849 |
{ |
| 29850 |
operands[1] = force_reg (SImode, const0_rtx); |
| 29851 |
operands[2] = gen_reg_rtx (SImode); |
| 29852 |
}) |
| 29853 |
|
| 29854 |
(define_insn "*rdpkru" |
| 29855 |
[(set (match_operand:SI 0 "register_operand" "=a") |
| 29856 |
(unspec_volatile:SI [(match_operand:SI 2 "register_operand" "c")] |
| 29857 |
UNSPECV_PKU)) |
| 29858 |
(set (match_operand:SI 1 "register_operand" "=d") |
| 29859 |
(const_int 0))] |
| 29860 |
"TARGET_PKU" |
| 29861 |
"rdpkru" |
| 29862 |
[(set_attr "type" "other")]) |
| 29863 |
|
| 29864 |
(define_expand "wrpkru" |
| 29865 |
[(unspec_volatile:SI |
| 29866 |
[(match_operand:SI 0 "register_operand") |
| 29867 |
(match_dup 1) (match_dup 2)] UNSPECV_PKU)] |
| 29868 |
"TARGET_PKU" |
| 29869 |
{ |
| 29870 |
operands[1] = force_reg (SImode, const0_rtx); |
| 29871 |
operands[2] = force_reg (SImode, const0_rtx); |
| 29872 |
}) |
| 29873 |
|
| 29874 |
(define_insn "*wrpkru" |
| 29875 |
[(unspec_volatile:SI |
| 29876 |
[(match_operand:SI 0 "register_operand" "a") |
| 29877 |
(match_operand:SI 1 "register_operand" "d") |
| 29878 |
(match_operand:SI 2 "register_operand" "c")] UNSPECV_PKU)] |
| 29879 |
"TARGET_PKU" |
| 29880 |
"wrpkru" |
| 29881 |
[(set_attr "type" "other")]) |
| 29882 |
|
| 29883 |
(define_insn "rdpid" |
| 29884 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 29885 |
(unspec_volatile:SI [(const_int 0)] UNSPECV_RDPID))] |
| 29886 |
"!TARGET_64BIT && TARGET_RDPID" |
| 29887 |
"rdpid\t%0" |
| 29888 |
[(set_attr "type" "other")]) |
| 29889 |
|
| 29890 |
(define_insn "rdpid_rex64" |
| 29891 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 29892 |
(unspec_volatile:DI [(const_int 0)] UNSPECV_RDPID))] |
| 29893 |
"TARGET_64BIT && TARGET_RDPID" |
| 29894 |
"rdpid\t%0" |
| 29895 |
[(set_attr "type" "other")]) |
| 29896 |
|
| 29897 |
;; Intirinsics for > i486 |
| 29898 |
|
| 29899 |
(define_insn "wbinvd" |
| 29900 |
[(unspec_volatile [(const_int 0)] UNSPECV_WBINVD)] |
| 29901 |
"" |
| 29902 |
"wbinvd" |
| 29903 |
[(set_attr "type" "other")]) |
| 29904 |
|
| 29905 |
(define_insn "wbnoinvd" |
| 29906 |
[(unspec_volatile [(const_int 0)] UNSPECV_WBNOINVD)] |
| 29907 |
"TARGET_WBNOINVD" |
| 29908 |
"wbnoinvd" |
| 29909 |
[(set_attr "type" "other")]) |
| 29910 |
|
| 29911 |
;; MOVDIRI and MOVDIR64B |
| 29912 |
|
| 29913 |
(define_insn "movdiri<mode>" |
| 29914 |
[(set (match_operand:SWI48 0 "memory_operand" "=m") |
| 29915 |
(unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")] |
| 29916 |
UNSPEC_MOVDIRI))] |
| 29917 |
"TARGET_MOVDIRI" |
| 29918 |
"movdiri\t{%1, %0|%0, %1}" |
| 29919 |
[(set_attr "type" "other")]) |
| 29920 |
|
| 29921 |
(define_insn "@movdir64b_<mode>" |
| 29922 |
[(set (mem:XI (match_operand:P 0 "register_operand" "r")) |
| 29923 |
(unspec:XI [(match_operand:XI 1 "memory_operand" "m")] |
| 29924 |
UNSPEC_MOVDIR64B))] |
| 29925 |
"TARGET_MOVDIR64B" |
| 29926 |
"movdir64b\t{%1, %0|%0, %1}" |
| 29927 |
[(set_attr "type" "other")]) |
| 29928 |
|
| 29929 |
;; TSXLDTRK |
| 29930 |
(define_int_iterator TSXLDTRK [UNSPECV_XSUSLDTRK UNSPECV_XRESLDTRK]) |
| 29931 |
(define_int_attr tsxldtrk [(UNSPECV_XSUSLDTRK "xsusldtrk") |
| 29932 |
(UNSPECV_XRESLDTRK "xresldtrk")]) |
| 29933 |
(define_insn "<tsxldtrk>" |
| 29934 |
[(unspec_volatile [(const_int 0)] TSXLDTRK)] |
| 29935 |
"TARGET_TSXLDTRK" |
| 29936 |
"<tsxldtrk>" |
| 29937 |
[(set_attr "type" "other") |
| 29938 |
(set_attr "length" "4")]) |
| 29939 |
|
| 29940 |
;; ENQCMD and ENQCMDS |
| 29941 |
|
| 29942 |
(define_int_iterator ENQCMD [UNSPECV_ENQCMD UNSPECV_ENQCMDS]) |
| 29943 |
(define_int_attr enqcmd_sfx [(UNSPECV_ENQCMD "") (UNSPECV_ENQCMDS "s")]) |
| 29944 |
|
| 29945 |
(define_insn "@enqcmd<enqcmd_sfx>_<mode>" |
| 29946 |
[(set (reg:CCZ FLAGS_REG) |
| 29947 |
(unspec_volatile:CCZ [(match_operand:P 0 "register_operand" "r") |
| 29948 |
(match_operand:XI 1 "memory_operand" "m")] |
| 29949 |
ENQCMD))] |
| 29950 |
"TARGET_ENQCMD" |
| 29951 |
"enqcmd<enqcmd_sfx>\t{%1, %0|%0, %1}" |
| 29952 |
[(set_attr "type" "other")]) |
| 29953 |
|
| 29954 |
;; UINTR |
| 29955 |
(define_int_iterator UINTR [UNSPECV_CLUI UNSPECV_STUI]) |
| 29956 |
(define_int_attr uintr [(UNSPECV_CLUI "clui") (UNSPECV_STUI "stui")]) |
| 29957 |
|
| 29958 |
(define_insn "<uintr>" |
| 29959 |
[(unspec_volatile [(const_int 0)] UINTR)] |
| 29960 |
"TARGET_UINTR && TARGET_64BIT" |
| 29961 |
"<uintr>" |
| 29962 |
[(set_attr "type" "other") |
| 29963 |
(set_attr "length" "4")]) |
| 29964 |
|
| 29965 |
(define_insn "testui" |
| 29966 |
[(set (reg:CCC FLAGS_REG) |
| 29967 |
(unspec_volatile:CCC [(const_int 0)] UNSPECV_TESTUI))] |
| 29968 |
"TARGET_UINTR && TARGET_64BIT" |
| 29969 |
"testui" |
| 29970 |
[(set_attr "type" "other") |
| 29971 |
(set_attr "length" "4")]) |
| 29972 |
|
| 29973 |
(define_insn "senduipi" |
| 29974 |
[(unspec_volatile |
| 29975 |
[(match_operand:DI 0 "register_operand" "r")] |
| 29976 |
UNSPECV_SENDUIPI)] |
| 29977 |
"TARGET_UINTR && TARGET_64BIT" |
| 29978 |
"senduipi\t%0" |
| 29979 |
[(set_attr "type" "other") |
| 29980 |
(set_attr "length" "4")]) |
| 29981 |
|
| 29982 |
;; WAITPKG |
| 29983 |
|
| 29984 |
(define_insn "umwait" |
| 29985 |
[(set (reg:CCC FLAGS_REG) |
| 29986 |
(unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") |
| 29987 |
(match_operand:DI 1 "register_operand" "A")] |
| 29988 |
UNSPECV_UMWAIT))] |
| 29989 |
"!TARGET_64BIT && TARGET_WAITPKG" |
| 29990 |
"umwait\t%0" |
| 29991 |
[(set_attr "length" "3")]) |
| 29992 |
|
| 29993 |
(define_insn "umwait_rex64" |
| 29994 |
[(set (reg:CCC FLAGS_REG) |
| 29995 |
(unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") |
| 29996 |
(match_operand:SI 1 "register_operand" "a") |
| 29997 |
(match_operand:SI 2 "register_operand" "d")] |
| 29998 |
UNSPECV_UMWAIT))] |
| 29999 |
"TARGET_64BIT && TARGET_WAITPKG" |
| 30000 |
"umwait\t%0" |
| 30001 |
[(set_attr "length" "3")]) |
| 30002 |
|
| 30003 |
(define_insn "@umonitor_<mode>" |
| 30004 |
[(unspec_volatile [(match_operand:P 0 "register_operand" "r")] |
| 30005 |
UNSPECV_UMONITOR)] |
| 30006 |
"TARGET_WAITPKG" |
| 30007 |
"umonitor\t%0" |
| 30008 |
[(set (attr "length") |
| 30009 |
(symbol_ref ("(Pmode != word_mode) + 3")))]) |
| 30010 |
|
| 30011 |
(define_insn "tpause" |
| 30012 |
[(set (reg:CCC FLAGS_REG) |
| 30013 |
(unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") |
| 30014 |
(match_operand:DI 1 "register_operand" "A")] |
| 30015 |
UNSPECV_TPAUSE))] |
| 30016 |
"!TARGET_64BIT && TARGET_WAITPKG" |
| 30017 |
"tpause\t%0" |
| 30018 |
[(set_attr "length" "3")]) |
| 30019 |
|
| 30020 |
(define_insn "tpause_rex64" |
| 30021 |
[(set (reg:CCC FLAGS_REG) |
| 30022 |
(unspec_volatile:CCC [(match_operand:SI 0 "register_operand" "r") |
| 30023 |
(match_operand:SI 1 "register_operand" "a") |
| 30024 |
(match_operand:SI 2 "register_operand" "d")] |
| 30025 |
UNSPECV_TPAUSE))] |
| 30026 |
"TARGET_64BIT && TARGET_WAITPKG" |
| 30027 |
"tpause\t%0" |
| 30028 |
[(set_attr "length" "3")]) |
| 30029 |
|
| 30030 |
(define_insn "cldemote" |
| 30031 |
[(unspec_volatile[(match_operand 0 "address_operand" "p")] |
| 30032 |
UNSPECV_CLDEMOTE)] |
| 30033 |
"TARGET_CLDEMOTE" |
| 30034 |
"cldemote\t%a0" |
| 30035 |
[(set_attr "type" "other") |
| 30036 |
(set_attr "memory" "unknown")]) |
| 30037 |
|
| 30038 |
(define_insn "speculation_barrier" |
| 30039 |
[(unspec_volatile [(const_int 0)] UNSPECV_SPECULATION_BARRIER)] |
| 30040 |
"" |
| 30041 |
"lfence" |
| 30042 |
[(set_attr "type" "other") |
| 30043 |
(set_attr "length" "3")]) |
| 30044 |
|
| 30045 |
(define_insn "serialize" |
| 30046 |
[(unspec_volatile [(const_int 0)] UNSPECV_SERIALIZE)] |
| 30047 |
"TARGET_SERIALIZE" |
| 30048 |
"serialize" |
| 30049 |
[(set_attr "type" "other") |
| 30050 |
(set_attr "length" "3")]) |
| 30051 |
|
| 30052 |
(define_insn "patchable_area" |
| 30053 |
[(unspec_volatile [(match_operand 0 "const_int_operand") |
| 30054 |
(match_operand 1 "const_int_operand")] |
| 30055 |
UNSPECV_PATCHABLE_AREA)] |
| 30056 |
"" |
| 30057 |
{ |
| 30058 |
ix86_output_patchable_area (INTVAL (operands[0]), |
| 30059 |
INTVAL (operands[1]) != 0); |
| 30060 |
return ""; |
| 30061 |
} |
| 30062 |
[(set (attr "length") (symbol_ref "INTVAL (operands[0])")) |
| 30063 |
(set_attr "length_immediate" "0") |
| 30064 |
(set_attr "modrm" "0")]) |
| 30065 |
|
| 30066 |
(define_insn "hreset" |
| 30067 |
[(unspec_volatile [(match_operand:SI 0 "register_operand" "a")] |
| 30068 |
UNSPECV_HRESET)] |
| 30069 |
"TARGET_HRESET" |
| 30070 |
"hreset\t{$0|0}" |
| 30071 |
[(set_attr "type" "other") |
| 30072 |
(set_attr "length" "4")]) |
| 30073 |
|
| 30074 |
;; Spaceship optimization |
| 30075 |
(define_expand "spaceship<mode>4" |
| 30076 |
[(match_operand:SI 0 "register_operand") |
| 30077 |
(match_operand:MODEF 1 "cmp_fp_expander_operand") |
| 30078 |
(match_operand:MODEF 2 "cmp_fp_expander_operand") |
| 30079 |
(match_operand:SI 3 "const_int_operand")] |
| 30080 |
"(TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)) |
| 30081 |
&& (TARGET_CMOVE || (TARGET_SAHF && TARGET_USE_SAHF))" |
| 30082 |
{ |
| 30083 |
ix86_expand_fp_spaceship (operands[0], operands[1], operands[2], |
| 30084 |
operands[3]); |
| 30085 |
DONE; |
| 30086 |
}) |
| 30087 |
|
| 30088 |
(define_expand "spaceshipxf4" |
| 30089 |
[(match_operand:SI 0 "register_operand") |
| 30090 |
(match_operand:XF 1 "nonmemory_operand") |
| 30091 |
(match_operand:XF 2 "nonmemory_operand") |
| 30092 |
(match_operand:SI 3 "const_int_operand")] |
| 30093 |
"TARGET_80387 && (TARGET_CMOVE || (TARGET_SAHF && TARGET_USE_SAHF))" |
| 30094 |
{ |
| 30095 |
ix86_expand_fp_spaceship (operands[0], operands[1], operands[2], |
| 30096 |
operands[3]); |
| 30097 |
DONE; |
| 30098 |
}) |
| 30099 |
|
| 30100 |
(define_expand "spaceship<mode>4" |
| 30101 |
[(match_operand:SI 0 "register_operand") |
| 30102 |
(match_operand:SWI 1 "nonimmediate_operand") |
| 30103 |
(match_operand:SWI 2 "<general_operand>") |
| 30104 |
(match_operand:SI 3 "const_int_operand")] |
| 30105 |
"" |
| 30106 |
{ |
| 30107 |
ix86_expand_int_spaceship (operands[0], operands[1], operands[2], |
| 30108 |
operands[3]); |
| 30109 |
DONE; |
| 30110 |
}) |
| 30111 |
|
| 30112 |
;; Defined because the generic expand_builtin_issignaling for XFmode |
| 30113 |
;; only tests for sNaNs, but i387 treats also pseudo numbers as always |
| 30114 |
;; signaling. |
| 30115 |
(define_expand "issignalingxf2" |
| 30116 |
[(match_operand:SI 0 "register_operand") |
| 30117 |
(match_operand:XF 1 "general_operand")] |
| 30118 |
"" |
| 30119 |
{ |
| 30120 |
rtx temp = operands[1]; |
| 30121 |
if (!MEM_P (temp)) |
| 30122 |
{ |
| 30123 |
rtx mem = assign_stack_temp (XFmode, GET_MODE_SIZE (XFmode)); |
| 30124 |
emit_move_insn (mem, temp); |
| 30125 |
temp = mem; |
| 30126 |
} |
| 30127 |
rtx ex = adjust_address (temp, HImode, 8); |
| 30128 |
rtx hi = adjust_address (temp, SImode, 4); |
| 30129 |
rtx lo = adjust_address (temp, SImode, 0); |
| 30130 |
rtx val = GEN_INT (HOST_WIDE_INT_M1U << 30); |
| 30131 |
rtx mask = GEN_INT (0x7fff); |
| 30132 |
rtx bit = GEN_INT (HOST_WIDE_INT_1U << 30); |
| 30133 |
/* Expand to: |
| 30134 |
((ex & mask) && (int) hi >= 0) |
| 30135 |
|| ((ex & mask) == mask && ((hi ^ bit) | ((lo | -lo) >> 31)) > val). */ |
| 30136 |
rtx nlo = expand_unop (SImode, neg_optab, lo, NULL_RTX, 0); |
| 30137 |
lo = expand_binop (SImode, ior_optab, lo, nlo, |
| 30138 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30139 |
lo = expand_shift (RSHIFT_EXPR, SImode, lo, 31, NULL_RTX, 1); |
| 30140 |
temp = expand_binop (SImode, xor_optab, hi, bit, |
| 30141 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30142 |
temp = expand_binop (SImode, ior_optab, temp, lo, |
| 30143 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30144 |
temp = emit_store_flag_force (gen_reg_rtx (SImode), GTU, temp, val, |
| 30145 |
SImode, 1, 1); |
| 30146 |
ex = expand_binop (HImode, and_optab, ex, mask, |
| 30147 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30148 |
rtx temp2 = emit_store_flag_force (gen_reg_rtx (SImode), NE, |
| 30149 |
ex, const0_rtx, SImode, 1, 1); |
| 30150 |
ex = emit_store_flag_force (gen_reg_rtx (SImode), EQ, |
| 30151 |
ex, mask, HImode, 1, 1); |
| 30152 |
temp = expand_binop (SImode, and_optab, temp, ex, |
| 30153 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30154 |
rtx temp3 = emit_store_flag_force (gen_reg_rtx (SImode), GE, |
| 30155 |
hi, const0_rtx, SImode, 0, 1); |
| 30156 |
temp2 = expand_binop (SImode, and_optab, temp2, temp3, |
| 30157 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30158 |
temp = expand_binop (SImode, ior_optab, temp, temp2, |
| 30159 |
NULL_RTX, 1, OPTAB_LIB_WIDEN); |
| 30160 |
emit_move_insn (operands[0], temp); |
| 30161 |
DONE; |
| 30162 |
}) |
| 30163 |
|
| 30164 |
(define_insn "urdmsr" |
| 30165 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 30166 |
(unspec_volatile:DI |
| 30167 |
[(match_operand:DI 1 "x86_64_szext_nonmemory_operand" "reZ")] |
| 30168 |
UNSPECV_URDMSR))] |
| 30169 |
"TARGET_USER_MSR && TARGET_64BIT" |
| 30170 |
"urdmsr\t{%1, %0|%0, %1}" |
| 30171 |
[(set_attr "prefix" "vex") |
| 30172 |
(set_attr "type" "other")]) |
| 30173 |
|
| 30174 |
(define_insn "uwrmsr" |
| 30175 |
[(unspec_volatile |
| 30176 |
[(match_operand:DI 0 "x86_64_szext_nonmemory_operand" "reZ") |
| 30177 |
(match_operand:DI 1 "register_operand" "r")] |
| 30178 |
UNSPECV_UWRMSR)] |
| 30179 |
"TARGET_USER_MSR && TARGET_64BIT" |
| 30180 |
"uwrmsr\t{%1, %0|%0, %1}" |
| 30181 |
[(set_attr "prefix" "vex") |
| 30182 |
(set_attr "type" "other")]) |
| 30183 |
|
| 30184 |
(define_insn "ldtilecfg" |
| 30185 |
[(unspec_volatile [(match_operand:BLK 0 "memory_operand" "m")] |
| 30186 |
UNSPECV_LDTILECFG)] |
| 30187 |
"TARGET_AMX_TILE" |
| 30188 |
"ldtilecfg\t%0" |
| 30189 |
[(set_attr "type" "other") |
| 30190 |
(set_attr "prefix" "maybe_evex") |
| 30191 |
(set_attr "memory" "load")]) |
| 30192 |
|
| 30193 |
(define_insn "sttilecfg" |
| 30194 |
[(set (match_operand:BLK 0 "memory_operand" "=m") |
| 30195 |
(unspec_volatile:BLK [(const_int 0)] UNSPECV_STTILECFG))] |
| 30196 |
"TARGET_AMX_TILE" |
| 30197 |
"sttilecfg\t%0" |
| 30198 |
[(set_attr "type" "other") |
| 30199 |
(set_attr "prefix" "maybe_evex") |
| 30200 |
(set_attr "memory" "store")]) |
| 30201 |
|
| 30202 |
(define_insn "movrs<mode>" |
| 30203 |
[(set (match_operand:SWI1248x 0 "register_operand" "=r") |
| 30204 |
(unspec_volatile:SWI1248x |
| 30205 |
[(match_operand:SWI1248x 1 "memory_operand" "m")] |
| 30206 |
UNSPECV_MOVRS))] |
| 30207 |
"TARGET_MOVRS && TARGET_64BIT" |
| 30208 |
"movrs{<imodesuffix>}\t{%1, %0|%0, %1}" |
| 30209 |
[(set_attr "prefix" "orig") |
| 30210 |
(set_attr "type" "other") |
| 30211 |
(set_attr "mode" "<MODE>")]) |
| 30212 |
|
| 30213 |
(include "mmx.md") |
| 30214 |
(include "sse.md") |
| 30215 |
(include "sync.md") |