| 1 |
;; Machine description for SPARC. |
| 2 |
;; Copyright (C) 1987-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Michael Tiemann ([email protected]) |
| 4 |
;; 64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans, |
| 5 |
;; at Cygnus Support. |
| 6 |
|
| 7 |
;; This file is part of GCC. |
| 8 |
|
| 9 |
;; GCC is free software; you can redistribute it and/or modify |
| 10 |
;; it under the terms of the GNU General Public License as published by |
| 11 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 12 |
;; any later version. |
| 13 |
|
| 14 |
;; GCC is distributed in the hope that it will be useful, |
| 15 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
;; GNU General Public License for more details. |
| 18 |
|
| 19 |
;; You should have received a copy of the GNU General Public License |
| 20 |
;; along with GCC; see the file COPYING3. If not see |
| 21 |
;; <http://www.gnu.org/licenses/>. |
| 22 |
|
| 23 |
(define_c_enum "unspec" [ |
| 24 |
UNSPEC_MOVE_PIC |
| 25 |
UNSPEC_UPDATE_RETURN |
| 26 |
UNSPEC_LOAD_PCREL_SYM |
| 27 |
UNSPEC_FRAME_BLOCKAGE |
| 28 |
UNSPEC_MOVE_PIC_LABEL |
| 29 |
UNSPEC_SETH44 |
| 30 |
UNSPEC_SETM44 |
| 31 |
UNSPEC_SETHH |
| 32 |
UNSPEC_SETLM |
| 33 |
UNSPEC_EMB_HISUM |
| 34 |
UNSPEC_EMB_TEXTUHI |
| 35 |
UNSPEC_EMB_TEXTHI |
| 36 |
UNSPEC_EMB_TEXTULO |
| 37 |
UNSPEC_EMB_SETHM |
| 38 |
UNSPEC_MOVE_GOTDATA |
| 39 |
|
| 40 |
UNSPEC_MEMBAR |
| 41 |
UNSPEC_ATOMIC |
| 42 |
|
| 43 |
UNSPEC_TLSGD |
| 44 |
UNSPEC_TLSLDM |
| 45 |
UNSPEC_TLSLDO |
| 46 |
UNSPEC_TLSIE |
| 47 |
UNSPEC_TLSLE |
| 48 |
UNSPEC_TLSLD_BASE |
| 49 |
|
| 50 |
UNSPEC_FPACK16 |
| 51 |
UNSPEC_FPACK32 |
| 52 |
UNSPEC_FPACKFIX |
| 53 |
UNSPEC_FEXPAND |
| 54 |
UNSPEC_MUL16AU |
| 55 |
UNSPEC_MUL16AL |
| 56 |
UNSPEC_MUL8UL |
| 57 |
UNSPEC_MULDUL |
| 58 |
UNSPEC_ALIGNDATA |
| 59 |
UNSPEC_PDIST |
| 60 |
UNSPEC_EDGE8 |
| 61 |
UNSPEC_EDGE8L |
| 62 |
UNSPEC_EDGE16 |
| 63 |
UNSPEC_EDGE16L |
| 64 |
UNSPEC_EDGE32 |
| 65 |
UNSPEC_EDGE32L |
| 66 |
UNSPEC_ARRAY8 |
| 67 |
UNSPEC_ARRAY16 |
| 68 |
UNSPEC_ARRAY32 |
| 69 |
|
| 70 |
UNSPEC_SP_SET |
| 71 |
UNSPEC_SP_TEST |
| 72 |
|
| 73 |
UNSPEC_EDGE8N |
| 74 |
UNSPEC_EDGE8LN |
| 75 |
UNSPEC_EDGE16N |
| 76 |
UNSPEC_EDGE16LN |
| 77 |
UNSPEC_EDGE32N |
| 78 |
UNSPEC_EDGE32LN |
| 79 |
UNSPEC_BSHUFFLE |
| 80 |
UNSPEC_CMASK8 |
| 81 |
UNSPEC_CMASK16 |
| 82 |
UNSPEC_CMASK32 |
| 83 |
UNSPEC_FCHKSM16 |
| 84 |
UNSPEC_PDISTN |
| 85 |
UNSPEC_FHADD |
| 86 |
UNSPEC_FHSUB |
| 87 |
UNSPEC_XMUL |
| 88 |
UNSPEC_MUL8 |
| 89 |
UNSPEC_MUL8SU |
| 90 |
UNSPEC_MULDSU |
| 91 |
|
| 92 |
UNSPEC_ADDV |
| 93 |
UNSPEC_SUBV |
| 94 |
UNSPEC_NEGV |
| 95 |
|
| 96 |
UNSPEC_DICTUNPACK |
| 97 |
UNSPEC_FPCMPSHL |
| 98 |
UNSPEC_FPCMPUSHL |
| 99 |
UNSPEC_FPCMPDESHL |
| 100 |
UNSPEC_FPCMPURSHL |
| 101 |
]) |
| 102 |
|
| 103 |
(define_c_enum "unspecv" [ |
| 104 |
UNSPECV_BLOCKAGE |
| 105 |
|
| 106 |
UNSPECV_SPECULATION_BARRIER |
| 107 |
|
| 108 |
UNSPECV_PROBE_STACK_RANGE |
| 109 |
|
| 110 |
UNSPECV_FLUSHW |
| 111 |
UNSPECV_SAVEW |
| 112 |
|
| 113 |
UNSPECV_FLUSH |
| 114 |
|
| 115 |
UNSPECV_LDSTUB |
| 116 |
UNSPECV_SWAP |
| 117 |
UNSPECV_CAS |
| 118 |
|
| 119 |
UNSPECV_LDFSR |
| 120 |
UNSPECV_STFSR |
| 121 |
]) |
| 122 |
|
| 123 |
(define_constants |
| 124 |
[(G0_REG 0) |
| 125 |
(G1_REG 1) |
| 126 |
(G2_REG 2) |
| 127 |
(G3_REG 3) |
| 128 |
(G4_REG 4) |
| 129 |
(G5_REG 5) |
| 130 |
(G6_REG 6) |
| 131 |
(G7_REG 7) |
| 132 |
(O0_REG 8) |
| 133 |
(O1_REG 9) |
| 134 |
(O2_REG 10) |
| 135 |
(O3_REG 11) |
| 136 |
(O4_REG 12) |
| 137 |
(O5_REG 13) |
| 138 |
(O6_REG 14) |
| 139 |
(O7_REG 15) |
| 140 |
(L0_REG 16) |
| 141 |
(L1_REG 17) |
| 142 |
(L2_REG 18) |
| 143 |
(L3_REG 19) |
| 144 |
(L4_REG 20) |
| 145 |
(L5_REG 21) |
| 146 |
(L6_REG 22) |
| 147 |
(L7_REG 23) |
| 148 |
(I0_REG 24) |
| 149 |
(I1_REG 25) |
| 150 |
(I2_REG 26) |
| 151 |
(I3_REG 27) |
| 152 |
(I4_REG 28) |
| 153 |
(I5_REG 29) |
| 154 |
(I6_REG 30) |
| 155 |
(I7_REG 31) |
| 156 |
(F0_REG 32) |
| 157 |
(F1_REG 33) |
| 158 |
(F2_REG 34) |
| 159 |
(F3_REG 35) |
| 160 |
(F4_REG 36) |
| 161 |
(F5_REG 37) |
| 162 |
(F6_REG 38) |
| 163 |
(F7_REG 39) |
| 164 |
(F8_REG 40) |
| 165 |
(F9_REG 41) |
| 166 |
(F10_REG 42) |
| 167 |
(F11_REG 43) |
| 168 |
(F12_REG 44) |
| 169 |
(F13_REG 45) |
| 170 |
(F14_REG 46) |
| 171 |
(F15_REG 47) |
| 172 |
(F16_REG 48) |
| 173 |
(F17_REG 49) |
| 174 |
(F18_REG 50) |
| 175 |
(F19_REG 51) |
| 176 |
(F20_REG 52) |
| 177 |
(F21_REG 53) |
| 178 |
(F22_REG 54) |
| 179 |
(F23_REG 55) |
| 180 |
(F24_REG 56) |
| 181 |
(F25_REG 57) |
| 182 |
(F26_REG 58) |
| 183 |
(F27_REG 59) |
| 184 |
(F28_REG 60) |
| 185 |
(F29_REG 61) |
| 186 |
(F30_REG 62) |
| 187 |
(F31_REG 63) |
| 188 |
(F32_REG 64) |
| 189 |
(F34_REG 66) |
| 190 |
(F36_REG 68) |
| 191 |
(F38_REG 70) |
| 192 |
(F40_REG 72) |
| 193 |
(F42_REG 74) |
| 194 |
(F44_REG 76) |
| 195 |
(F46_REG 78) |
| 196 |
(F48_REG 80) |
| 197 |
(F50_REG 82) |
| 198 |
(F52_REG 84) |
| 199 |
(F54_REG 86) |
| 200 |
(F56_REG 88) |
| 201 |
(F58_REG 90) |
| 202 |
(F60_REG 92) |
| 203 |
(F62_REG 94) |
| 204 |
(FCC0_REG 96) |
| 205 |
(FCC1_REG 97) |
| 206 |
(FCC2_REG 98) |
| 207 |
(FCC3_REG 99) |
| 208 |
(CC_REG 100) |
| 209 |
(SFP_REG 101) |
| 210 |
(GSR_REG 102) |
| 211 |
]) |
| 212 |
|
| 213 |
(define_mode_iterator I [QI HI SI DI]) |
| 214 |
(define_mode_iterator P [(SI "TARGET_ARCH32") (DI "TARGET_ARCH64")]) |
| 215 |
(define_mode_iterator W [SI (DI "TARGET_ARCH64")]) |
| 216 |
(define_mode_iterator F [SF DF TF]) |
| 217 |
|
| 218 |
;; The upper 32 fp regs on the v9 can't hold SFmode values. To deal with this |
| 219 |
;; a second register class, EXTRA_FP_REGS, exists for the v9 chip. The name |
| 220 |
;; is a bit of a misnomer as it covers all 64 fp regs. The corresponding |
| 221 |
;; constraint letter is 'e'. To avoid any confusion, 'e' is used instead of |
| 222 |
;; 'f' for all DF/TFmode values, including those that are specific to the v8. |
| 223 |
|
| 224 |
;; Attribute for cpu type. |
| 225 |
;; These must match the values of enum sparc_processor_type in sparc-opts.h. |
| 226 |
(define_attr "cpu" |
| 227 |
"v7, |
| 228 |
cypress, |
| 229 |
v8, |
| 230 |
supersparc, |
| 231 |
hypersparc, |
| 232 |
leon, |
| 233 |
leon3, |
| 234 |
leon5, |
| 235 |
leon3v7, |
| 236 |
sparclite, |
| 237 |
f930, |
| 238 |
f934, |
| 239 |
sparclite86x, |
| 240 |
sparclet, |
| 241 |
tsc701, |
| 242 |
v9, |
| 243 |
ultrasparc, |
| 244 |
ultrasparc3, |
| 245 |
niagara, |
| 246 |
niagara2, |
| 247 |
niagara3, |
| 248 |
niagara4, |
| 249 |
niagara7, |
| 250 |
m8" |
| 251 |
(const (symbol_ref "sparc_cpu_attr"))) |
| 252 |
|
| 253 |
;; Attribute for the instruction set. |
| 254 |
;; At present we only need to distinguish v9/!v9, but for clarity we |
| 255 |
;; test TARGET_V8 too. |
| 256 |
(define_attr "isa" "v7,v8,v9,sparclet" |
| 257 |
(const |
| 258 |
(cond [(symbol_ref "TARGET_V9") (const_string "v9") |
| 259 |
(symbol_ref "TARGET_V8") (const_string "v8") |
| 260 |
(symbol_ref "TARGET_SPARCLET") (const_string "sparclet")] |
| 261 |
(const_string "v7")))) |
| 262 |
|
| 263 |
(define_attr "cpu_feature" "none,fpu,fpunotv9,v9,vis,vis3,vis4,vis4b" |
| 264 |
(const_string "none")) |
| 265 |
|
| 266 |
(define_attr "enabled" "" |
| 267 |
(cond [(eq_attr "cpu_feature" "none") (const_int 1) |
| 268 |
(eq_attr "cpu_feature" "fpu") (symbol_ref "TARGET_FPU") |
| 269 |
(eq_attr "cpu_feature" "fpunotv9") (symbol_ref "TARGET_FPU && !TARGET_V9") |
| 270 |
(eq_attr "cpu_feature" "v9") (symbol_ref "TARGET_V9") |
| 271 |
(eq_attr "cpu_feature" "vis") (symbol_ref "TARGET_VIS") |
| 272 |
(eq_attr "cpu_feature" "vis3") (symbol_ref "TARGET_VIS3") |
| 273 |
(eq_attr "cpu_feature" "vis4") (symbol_ref "TARGET_VIS4") |
| 274 |
(eq_attr "cpu_feature" "vis4b") (symbol_ref "TARGET_VIS4B")] |
| 275 |
(const_int 0))) |
| 276 |
|
| 277 |
;; The SPARC instructions used by the backend are organized into a |
| 278 |
;; hierarchy using the insn attributes "type" and "subtype". |
| 279 |
;; |
| 280 |
;; The mnemonics used in the list below are the architectural names |
| 281 |
;; used in the Oracle SPARC Architecture specs. A / character |
| 282 |
;; separates the type from the subtype where appropriate. For |
| 283 |
;; brevity, text enclosed in {} denotes alternatives, while text |
| 284 |
;; enclosed in [] is optional. |
| 285 |
;; |
| 286 |
;; Please keep this list updated. It is of great help for keeping the |
| 287 |
;; correctness and coherence of the DFA schedulers. |
| 288 |
;; |
| 289 |
;; ialu: <empty> |
| 290 |
;; ialuX: ADD[X]C SUB[X]C |
| 291 |
;; shift: SLL[X] SRL[X] SRA[X] |
| 292 |
;; cmove: MOV{A,N,NE,E,G,LE,GE,L,GU,LEU,CC,CS,POS,NEG,VC,VS} |
| 293 |
;; MOVF{A,N,U,G,UG,L,UL,LG,NE,E,UE,GE,UGE,LE,ULE,O} |
| 294 |
;; MOVR{Z,LEZ,LZ,NZ,GZ,GEZ} |
| 295 |
;; compare: ADDcc ADDCcc ANDcc ORcc SUBcc SUBCcc XORcc XNORcc |
| 296 |
;; imul: MULX SMUL[cc] UMUL UMULXHI XMULX XMULXHI |
| 297 |
;; idiv: UDIVX SDIVX |
| 298 |
;; flush: FLUSH |
| 299 |
;; load/regular: LD{UB,UH,UW} LDFSR |
| 300 |
;; load/prefetch: PREFETCH |
| 301 |
;; fpload: LDF LDDF LDQF |
| 302 |
;; sload: LD{SB,SH,SW} |
| 303 |
;; store: ST{B,H,W,X} STFSR |
| 304 |
;; fpstore: STF STDF STQF |
| 305 |
;; cbcond: CWB{NE,E,G,LE,GE,L,GU,LEU,CC,CS,POS,NEG,VC,VS} |
| 306 |
;; CXB{NE,E,G,LE,GE,L,GU,LEU,CC,CS,POS,NEG,VC,VS} |
| 307 |
;; uncond_branch: BA BPA JMPL |
| 308 |
;; branch: B{NE,E,G,LE,GE,L,GU,LEU,CC,CS,POS,NEG,VC,VS} |
| 309 |
;; BP{NE,E,G,LE,GE,L,GU,LEU,CC,CS,POS,NEG,VC,VS} |
| 310 |
;; FB{U,G,UG,L,UL,LG,NE,BE,UE,GE,UGE,LE,ULE,O} |
| 311 |
;; call: CALL |
| 312 |
;; return: RESTORE RETURN |
| 313 |
;; fpmove: FABS{s,d,q} FMOV{s,d,q} FNEG{s,d,q} |
| 314 |
;; fpcmove: FMOV{S,D,Q}{icc,xcc,fcc} |
| 315 |
;; fpcrmove: FMOVR{s,d,q}{Z,LEZ,LZ,NZ,GZ,GEZ} |
| 316 |
;; fp: FADD{s,d,q} FSUB{s,d,q} FHSUB{s,d} FNHADD{s,d} FNADD{s,d} |
| 317 |
;; FiTO{s,d,q} FsTO{i,x,d,q} FdTO{i,x,s,q} FxTO{d,s,q} FqTO{i,x,s,d} |
| 318 |
;; fpcmp: FCMP{s,d,q} FCMPE{s,d,q} |
| 319 |
;; fpmul: FMADD{s,d} FMSUB{s,d} FMUL{s,d,q} FNMADD{s,d} |
| 320 |
;; FNMSUB{s,d} FNMUL{s,d} FNsMULd FsMULd |
| 321 |
;; FdMULq |
| 322 |
;; array: ARRAY{8,16,32} |
| 323 |
;; bmask: BMASK |
| 324 |
;; edge: EDGE{8,16,32}[L]cc |
| 325 |
;; edgen: EDGE{8,16,32}[L]n |
| 326 |
;; fpdivs: FDIV{s,q} |
| 327 |
;; fpsqrts: FSQRT{s,q} |
| 328 |
;; fpdivd: FDIVd |
| 329 |
;; fpsqrtd: FSQRTd |
| 330 |
;; lzd: LZCNT |
| 331 |
;; fga/addsub64: FP{ADD,SUB}64 |
| 332 |
;; fga/fpu: FCHKSM16 FEXPANd FMEAN16 FPMERGE |
| 333 |
;; FS{LL,RA,RL}{16,32} |
| 334 |
;; fga/maxmin: FP{MAX,MIN}[U]{8,16,32} |
| 335 |
;; fga/cmask: CMASK{8,16,32} |
| 336 |
;; fga/other: BSHUFFLE FALIGNDATAg FP{ADD,SUB}[S]{8,16,32} |
| 337 |
;; FP{ADD,SUB}US{8,16} DICTUNPACK |
| 338 |
;; gsr/reg: RDGSR WRGSR |
| 339 |
;; gsr/alignaddr: ALIGNADDRESS[_LITTLE] |
| 340 |
;; vismv/double: FSRC2d |
| 341 |
;; vismv/single: MOVwTOs FSRC2s |
| 342 |
;; vismv/movstouw: MOVsTOuw |
| 343 |
;; vismv/movxtod: MOVxTOd |
| 344 |
;; vismv/movdtox: MOVdTOx |
| 345 |
;; visl/single: F{AND,NAND,NOR,OR,NOT1}s |
| 346 |
;; F{AND,OR}NOT{1,2}s |
| 347 |
;; FONEs F{ZERO,XNOR,XOR}s FNOT2s |
| 348 |
;; visl/double: FONEd FZEROd FNOT1d F{OR,AND,XOR}d F{NOR,NAND,XNOR}d |
| 349 |
;; F{OR,AND}NOT1d F{OR,AND}NOT2d |
| 350 |
;; viscmp: FPCMP{LE,GT,NE,EQ}{8,16,32} FPCMPU{LE,GT,NE,EQ}{8,16,32} |
| 351 |
;; FPCMP{LE,GT,EQ,NE}{8,16,32}SHL FPCMPU{LE,GT,EQ,NE}{8,16,32}SHL |
| 352 |
;; FPCMPDE{8,16,32}SHL FPCMPUR{8,16,32}SHL |
| 353 |
;; fgm_pack: FPACKFIX FPACK{8,16,32} |
| 354 |
;; fgm_mul: FMUL8SUx16 FMUL8ULx16 FMUL8x16 FMUL8x16AL |
| 355 |
;; FMUL8x16AU FMULD8SUx16 FMULD8ULx16 |
| 356 |
;; pdist: PDIST |
| 357 |
;; pdistn: PDISTN |
| 358 |
|
| 359 |
(define_attr "type" |
| 360 |
"ialu,compare,shift, |
| 361 |
load,sload,store, |
| 362 |
uncond_branch,branch,call,sibcall,call_no_delay_slot,return, |
| 363 |
cbcond,uncond_cbcond, |
| 364 |
imul,idiv, |
| 365 |
fpload,fpstore, |
| 366 |
fp,fpmove, |
| 367 |
fpcmove,fpcrmove, |
| 368 |
fpcmp, |
| 369 |
fpmul,fpdivs,fpdivd, |
| 370 |
fpsqrts,fpsqrtd, |
| 371 |
fga,visl,vismv,viscmp, |
| 372 |
fgm_pack,fgm_mul,pdist,pdistn,edge,edgen,gsr,array,bmask, |
| 373 |
cmove, |
| 374 |
ialuX, |
| 375 |
multi,savew,flushw,iflush,trap,lzd" |
| 376 |
(const_string "ialu")) |
| 377 |
|
| 378 |
(define_attr "subtype" |
| 379 |
"single,double,movstouw,movxtod,movdtox, |
| 380 |
addsub64,cmask,fpu,maxmin,other, |
| 381 |
reg,alignaddr, |
| 382 |
prefetch,regular" |
| 383 |
(const_string "single")) |
| 384 |
|
| 385 |
;; True if branch/call has empty delay slot and will emit a nop in it |
| 386 |
(define_attr "empty_delay_slot" "false,true" |
| 387 |
(symbol_ref "(empty_delay_slot (insn) |
| 388 |
? EMPTY_DELAY_SLOT_TRUE : EMPTY_DELAY_SLOT_FALSE)")) |
| 389 |
|
| 390 |
;; True if we are making use of compare-and-branch instructions. |
| 391 |
;; True if we should emit a nop after a cbcond instruction |
| 392 |
(define_attr "emit_cbcond_nop" "false,true" |
| 393 |
(symbol_ref "(emit_cbcond_nop (insn) |
| 394 |
? EMIT_CBCOND_NOP_TRUE : EMIT_CBCOND_NOP_FALSE)")) |
| 395 |
|
| 396 |
(define_attr "branch_type" "none,icc,fcc,reg" |
| 397 |
(const_string "none")) |
| 398 |
|
| 399 |
(define_attr "pic" "false,true" |
| 400 |
(symbol_ref "(flag_pic != 0 |
| 401 |
? PIC_TRUE : PIC_FALSE)")) |
| 402 |
|
| 403 |
(define_attr "calls_alloca" "false,true" |
| 404 |
(symbol_ref "(cfun->calls_alloca != 0 |
| 405 |
? CALLS_ALLOCA_TRUE : CALLS_ALLOCA_FALSE)")) |
| 406 |
|
| 407 |
(define_attr "calls_eh_return" "false,true" |
| 408 |
(symbol_ref "(crtl->calls_eh_return != 0 |
| 409 |
? CALLS_EH_RETURN_TRUE : CALLS_EH_RETURN_FALSE)")) |
| 410 |
|
| 411 |
(define_attr "leaf_function" "false,true" |
| 412 |
(symbol_ref "(crtl->uses_only_leaf_regs != 0 |
| 413 |
? LEAF_FUNCTION_TRUE : LEAF_FUNCTION_FALSE)")) |
| 414 |
|
| 415 |
(define_attr "delayed_branch" "false,true" |
| 416 |
(symbol_ref "(flag_delayed_branch != 0 |
| 417 |
? DELAYED_BRANCH_TRUE : DELAYED_BRANCH_FALSE)")) |
| 418 |
|
| 419 |
(define_attr "flat" "false,true" |
| 420 |
(symbol_ref "(TARGET_FLAT != 0 |
| 421 |
? FLAT_TRUE : FLAT_FALSE)")) |
| 422 |
|
| 423 |
(define_attr "fix_ut699" "false,true" |
| 424 |
(symbol_ref "(sparc_fix_ut699 != 0 |
| 425 |
? FIX_UT699_TRUE : FIX_UT699_FALSE)")) |
| 426 |
|
| 427 |
(define_attr "fix_b2bst" "false,true" |
| 428 |
(symbol_ref "(sparc_fix_b2bst != 0 |
| 429 |
? FIX_B2BST_TRUE : FIX_B2BST_FALSE)")) |
| 430 |
|
| 431 |
(define_attr "fix_lost_divsqrt" "false,true" |
| 432 |
(symbol_ref "(sparc_fix_lost_divsqrt != 0 |
| 433 |
? FIX_LOST_DIVSQRT_TRUE : FIX_LOST_DIVSQRT_FALSE)")) |
| 434 |
|
| 435 |
(define_attr "fix_gr712rc" "false,true" |
| 436 |
(symbol_ref "(sparc_fix_gr712rc != 0 |
| 437 |
? FIX_GR712RC_TRUE : FIX_GR712RC_FALSE)")) |
| 438 |
|
| 439 |
;; Length (in # of insns). |
| 440 |
;; Beware that setting a length greater or equal to 3 for conditional branches |
| 441 |
;; has a side-effect (see output_cbranch and output_v9branch). |
| 442 |
(define_attr "length" "" |
| 443 |
(cond [(eq_attr "type" "uncond_branch,call") |
| 444 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 445 |
(const_int 2) |
| 446 |
(const_int 1)) |
| 447 |
(eq_attr "type" "sibcall") |
| 448 |
(if_then_else (ior (eq_attr "leaf_function" "true") |
| 449 |
(eq_attr "flat" "true")) |
| 450 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 451 |
(const_int 3) |
| 452 |
(const_int 2)) |
| 453 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 454 |
(const_int 2) |
| 455 |
(const_int 1))) |
| 456 |
(eq_attr "branch_type" "icc") |
| 457 |
(if_then_else (match_operand 0 "v9_comparison_operator" "") |
| 458 |
(if_then_else (lt (pc) (match_dup 1)) |
| 459 |
(if_then_else (lt (minus (match_dup 1) (pc)) (const_int 260000)) |
| 460 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 461 |
(const_int 2) |
| 462 |
(const_int 1)) |
| 463 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 464 |
(const_int 4) |
| 465 |
(const_int 3))) |
| 466 |
(if_then_else (lt (minus (pc) (match_dup 1)) (const_int 260000)) |
| 467 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 468 |
(const_int 2) |
| 469 |
(const_int 1)) |
| 470 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 471 |
(const_int 4) |
| 472 |
(const_int 3)))) |
| 473 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 474 |
(const_int 2) |
| 475 |
(const_int 1))) |
| 476 |
(eq_attr "branch_type" "fcc") |
| 477 |
(if_then_else (match_operand 0 "fcc0_register_operand" "") |
| 478 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 479 |
(if_then_else (not (match_test "TARGET_V9")) |
| 480 |
(const_int 3) |
| 481 |
(const_int 2)) |
| 482 |
(if_then_else (not (match_test "TARGET_V9")) |
| 483 |
(const_int 2) |
| 484 |
(const_int 1))) |
| 485 |
(if_then_else (lt (pc) (match_dup 2)) |
| 486 |
(if_then_else (lt (minus (match_dup 2) (pc)) (const_int 260000)) |
| 487 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 488 |
(const_int 2) |
| 489 |
(const_int 1)) |
| 490 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 491 |
(const_int 4) |
| 492 |
(const_int 3))) |
| 493 |
(if_then_else (lt (minus (pc) (match_dup 2)) (const_int 260000)) |
| 494 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 495 |
(const_int 2) |
| 496 |
(const_int 1)) |
| 497 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 498 |
(const_int 4) |
| 499 |
(const_int 3))))) |
| 500 |
(eq_attr "branch_type" "reg") |
| 501 |
(if_then_else (lt (pc) (match_dup 2)) |
| 502 |
(if_then_else (lt (minus (match_dup 2) (pc)) (const_int 32000)) |
| 503 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 504 |
(const_int 2) |
| 505 |
(const_int 1)) |
| 506 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 507 |
(const_int 4) |
| 508 |
(const_int 3))) |
| 509 |
(if_then_else (lt (minus (pc) (match_dup 2)) (const_int 32000)) |
| 510 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 511 |
(const_int 2) |
| 512 |
(const_int 1)) |
| 513 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 514 |
(const_int 4) |
| 515 |
(const_int 3)))) |
| 516 |
(eq_attr "type" "cbcond") |
| 517 |
(if_then_else (lt (pc) (match_dup 3)) |
| 518 |
(if_then_else (lt (minus (match_dup 3) (pc)) (const_int 500)) |
| 519 |
(if_then_else (eq_attr "emit_cbcond_nop" "true") |
| 520 |
(const_int 2) |
| 521 |
(const_int 1)) |
| 522 |
(const_int 4)) |
| 523 |
(if_then_else (lt (minus (pc) (match_dup 3)) (const_int 500)) |
| 524 |
(if_then_else (eq_attr "emit_cbcond_nop" "true") |
| 525 |
(const_int 2) |
| 526 |
(const_int 1)) |
| 527 |
(const_int 4))) |
| 528 |
(eq_attr "type" "uncond_cbcond") |
| 529 |
(if_then_else (lt (pc) (match_dup 0)) |
| 530 |
(if_then_else (lt (minus (match_dup 0) (pc)) (const_int 500)) |
| 531 |
(if_then_else (eq_attr "emit_cbcond_nop" "true") |
| 532 |
(const_int 2) |
| 533 |
(const_int 1)) |
| 534 |
(const_int 1)) |
| 535 |
(if_then_else (lt (minus (pc) (match_dup 0)) (const_int 500)) |
| 536 |
(if_then_else (eq_attr "emit_cbcond_nop" "true") |
| 537 |
(const_int 2) |
| 538 |
(const_int 1)) |
| 539 |
(const_int 1))) |
| 540 |
] (const_int 1))) |
| 541 |
|
| 542 |
;; FP precision. |
| 543 |
(define_attr "fptype" "single,double" |
| 544 |
(const_string "single")) |
| 545 |
|
| 546 |
;; FP precision specific to the UT699. |
| 547 |
(define_attr "fptype_ut699" "none,single" |
| 548 |
(const_string "none")) |
| 549 |
|
| 550 |
;; UltraSPARC-III integer load type. |
| 551 |
(define_attr "us3load_type" "2cycle,3cycle" |
| 552 |
(const_string "2cycle")) |
| 553 |
|
| 554 |
(define_asm_attributes |
| 555 |
[(set_attr "length" "2") |
| 556 |
(set_attr "type" "multi")]) |
| 557 |
|
| 558 |
;; Attributes for branch scheduling |
| 559 |
(define_attr "tls_delay_slot" "false,true" |
| 560 |
(symbol_ref "((TARGET_GNU_TLS && HAVE_GNU_LD) != 0 |
| 561 |
? TLS_DELAY_SLOT_TRUE : TLS_DELAY_SLOT_FALSE)")) |
| 562 |
|
| 563 |
(define_attr "in_sibcall_delay" "false,true" |
| 564 |
(symbol_ref "(eligible_for_sibcall_delay (insn) |
| 565 |
? IN_SIBCALL_DELAY_TRUE : IN_SIBCALL_DELAY_FALSE)")) |
| 566 |
|
| 567 |
(define_attr "in_return_delay" "false,true" |
| 568 |
(symbol_ref "(eligible_for_return_delay (insn) |
| 569 |
? IN_RETURN_DELAY_TRUE : IN_RETURN_DELAY_FALSE)")) |
| 570 |
|
| 571 |
;; ??? !v9: Should implement the notion of predelay slots for floating-point |
| 572 |
;; branches. This would allow us to remove the nop always inserted before |
| 573 |
;; a floating point branch. |
| 574 |
|
| 575 |
;; ??? It is OK for fill_simple_delay_slots to put load/store instructions |
| 576 |
;; in a delay slot, but it is not OK for fill_eager_delay_slots to do so. |
| 577 |
;; This is because doing so will add several pipeline stalls to the path |
| 578 |
;; that the load/store did not come from. Unfortunately, there is no way |
| 579 |
;; to prevent fill_eager_delay_slots from using load/store without completely |
| 580 |
;; disabling them. For the SPEC benchmark set, this is a serious lose, |
| 581 |
;; because it prevents us from moving back the final store of inner loops. |
| 582 |
|
| 583 |
(define_attr "in_branch_delay" "false,true" |
| 584 |
(cond [(eq_attr "type" "uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi") |
| 585 |
(const_string "false") |
| 586 |
(and (eq_attr "fix_lost_divsqrt" "true") |
| 587 |
(eq_attr "type" "fpdivs,fpsqrts,fpdivd,fpsqrtd")) |
| 588 |
(const_string "false") |
| 589 |
(and (eq_attr "fix_b2bst" "true") (eq_attr "type" "store,fpstore")) |
| 590 |
(const_string "false") |
| 591 |
(and (eq_attr "fix_ut699" "true") (eq_attr "type" "load,sload")) |
| 592 |
(const_string "false") |
| 593 |
(and (eq_attr "fix_ut699" "true") |
| 594 |
(and (eq_attr "type" "fpload,fp,fpmove,fpmul,fpdivs,fpsqrts") |
| 595 |
(ior (eq_attr "fptype" "single") |
| 596 |
(eq_attr "fptype_ut699" "single")))) |
| 597 |
(const_string "false") |
| 598 |
(eq_attr "length" "1") |
| 599 |
(const_string "true") |
| 600 |
] (const_string "false"))) |
| 601 |
|
| 602 |
(define_attr "in_integer_branch_annul_delay" "false,true" |
| 603 |
(cond [(and (eq_attr "fix_gr712rc" "true") |
| 604 |
(eq_attr "type" "fp,fpcmp,fpmove,fpcmove,fpmul, |
| 605 |
fpdivs,fpsqrts,fpdivd,fpsqrtd")) |
| 606 |
(const_string "false") |
| 607 |
(eq_attr "in_branch_delay" "true") |
| 608 |
(const_string "true") |
| 609 |
] (const_string "false"))) |
| 610 |
|
| 611 |
(define_delay (eq_attr "type" "sibcall") |
| 612 |
[(eq_attr "in_sibcall_delay" "true") (nil) (nil)]) |
| 613 |
|
| 614 |
(define_delay (eq_attr "type" "return") |
| 615 |
[(eq_attr "in_return_delay" "true") (nil) (nil)]) |
| 616 |
|
| 617 |
(define_delay (ior (eq_attr "type" "call") (eq_attr "type" "uncond_branch")) |
| 618 |
[(eq_attr "in_branch_delay" "true") (nil) (nil)]) |
| 619 |
|
| 620 |
(define_delay (and (eq_attr "type" "branch") (not (eq_attr "branch_type" "icc"))) |
| 621 |
[(eq_attr "in_branch_delay" "true") |
| 622 |
(nil) |
| 623 |
(eq_attr "in_branch_delay" "true")]) |
| 624 |
|
| 625 |
(define_delay (and (eq_attr "type" "branch") (eq_attr "branch_type" "icc")) |
| 626 |
[(eq_attr "in_branch_delay" "true") |
| 627 |
(nil) |
| 628 |
(eq_attr "in_integer_branch_annul_delay" "true")]) |
| 629 |
|
| 630 |
;; Include SPARC DFA schedulers |
| 631 |
|
| 632 |
(include "cypress.md") |
| 633 |
(include "supersparc.md") |
| 634 |
(include "hypersparc.md") |
| 635 |
(include "leon.md") |
| 636 |
(include "leon5.md") |
| 637 |
(include "sparclet.md") |
| 638 |
(include "ultra1_2.md") |
| 639 |
(include "ultra3.md") |
| 640 |
(include "niagara.md") |
| 641 |
(include "niagara2.md") |
| 642 |
(include "niagara4.md") |
| 643 |
(include "niagara7.md") |
| 644 |
(include "m8.md") |
| 645 |
|
| 646 |
|
| 647 |
;; Operand and operator predicates and constraints |
| 648 |
|
| 649 |
(include "predicates.md") |
| 650 |
(include "constraints.md") |
| 651 |
|
| 652 |
|
| 653 |
;; Compare instructions. |
| 654 |
|
| 655 |
;; These are just the DEFINE_INSNs to match the patterns and the |
| 656 |
;; DEFINE_SPLITs for some of the scc insns that actually require |
| 657 |
;; more than one machine instruction. DEFINE_EXPANDs are further down. |
| 658 |
|
| 659 |
(define_insn "*cmpsi_insn" |
| 660 |
[(set (reg:CC CC_REG) |
| 661 |
(compare:CC (match_operand:SI 0 "register_operand" "r") |
| 662 |
(match_operand:SI 1 "arith_operand" "rI")))] |
| 663 |
"" |
| 664 |
"cmp\t%0, %1" |
| 665 |
[(set_attr "type" "compare")]) |
| 666 |
|
| 667 |
(define_insn "*cmpdi_sp64" |
| 668 |
[(set (reg:CCX CC_REG) |
| 669 |
(compare:CCX (match_operand:DI 0 "register_operand" "r") |
| 670 |
(match_operand:DI 1 "arith_operand" "rI")))] |
| 671 |
"TARGET_ARCH64" |
| 672 |
"cmp\t%0, %1" |
| 673 |
[(set_attr "type" "compare")]) |
| 674 |
|
| 675 |
(define_insn "*cmpsi_sne" |
| 676 |
[(set (reg:CCC CC_REG) |
| 677 |
(compare:CCC (not:SI (match_operand:SI 0 "arith_operand" "rI")) |
| 678 |
(const_int -1)))] |
| 679 |
"" |
| 680 |
"cmp\t%%g0, %0" |
| 681 |
[(set_attr "type" "compare")]) |
| 682 |
|
| 683 |
(define_insn "*cmpdi_sne" |
| 684 |
[(set (reg:CCXC CC_REG) |
| 685 |
(compare:CCXC (not:DI (match_operand:DI 0 "arith_operand" "rI")) |
| 686 |
(const_int -1)))] |
| 687 |
"TARGET_ARCH64" |
| 688 |
"cmp\t%%g0, %0" |
| 689 |
[(set_attr "type" "compare")]) |
| 690 |
|
| 691 |
(define_insn "*cmpsf_fpe" |
| 692 |
[(set (match_operand:CCFPE 0 "fcc_register_operand" "=c") |
| 693 |
(compare:CCFPE (match_operand:SF 1 "register_operand" "f") |
| 694 |
(match_operand:SF 2 "register_operand" "f")))] |
| 695 |
"TARGET_FPU" |
| 696 |
{ |
| 697 |
if (TARGET_V9) |
| 698 |
return "fcmpes\t%0, %1, %2"; |
| 699 |
return "fcmpes\t%1, %2"; |
| 700 |
} |
| 701 |
[(set_attr "type" "fpcmp")]) |
| 702 |
|
| 703 |
(define_insn "*cmpdf_fpe" |
| 704 |
[(set (match_operand:CCFPE 0 "fcc_register_operand" "=c") |
| 705 |
(compare:CCFPE (match_operand:DF 1 "register_operand" "e") |
| 706 |
(match_operand:DF 2 "register_operand" "e")))] |
| 707 |
"TARGET_FPU" |
| 708 |
{ |
| 709 |
if (TARGET_V9) |
| 710 |
return "fcmped\t%0, %1, %2"; |
| 711 |
return "fcmped\t%1, %2"; |
| 712 |
} |
| 713 |
[(set_attr "type" "fpcmp") |
| 714 |
(set_attr "fptype" "double")]) |
| 715 |
|
| 716 |
(define_insn "*cmptf_fpe" |
| 717 |
[(set (match_operand:CCFPE 0 "fcc_register_operand" "=c") |
| 718 |
(compare:CCFPE (match_operand:TF 1 "register_operand" "e") |
| 719 |
(match_operand:TF 2 "register_operand" "e")))] |
| 720 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 721 |
{ |
| 722 |
if (TARGET_V9) |
| 723 |
return "fcmpeq\t%0, %1, %2"; |
| 724 |
return "fcmpeq\t%1, %2"; |
| 725 |
} |
| 726 |
[(set_attr "type" "fpcmp")]) |
| 727 |
|
| 728 |
(define_insn "*cmpsf_fp" |
| 729 |
[(set (match_operand:CCFP 0 "fcc_register_operand" "=c") |
| 730 |
(compare:CCFP (match_operand:SF 1 "register_operand" "f") |
| 731 |
(match_operand:SF 2 "register_operand" "f")))] |
| 732 |
"TARGET_FPU" |
| 733 |
{ |
| 734 |
if (TARGET_V9) |
| 735 |
return "fcmps\t%0, %1, %2"; |
| 736 |
return "fcmps\t%1, %2"; |
| 737 |
} |
| 738 |
[(set_attr "type" "fpcmp")]) |
| 739 |
|
| 740 |
(define_insn "*cmpdf_fp" |
| 741 |
[(set (match_operand:CCFP 0 "fcc_register_operand" "=c") |
| 742 |
(compare:CCFP (match_operand:DF 1 "register_operand" "e") |
| 743 |
(match_operand:DF 2 "register_operand" "e")))] |
| 744 |
"TARGET_FPU" |
| 745 |
{ |
| 746 |
if (TARGET_V9) |
| 747 |
return "fcmpd\t%0, %1, %2"; |
| 748 |
return "fcmpd\t%1, %2"; |
| 749 |
} |
| 750 |
[(set_attr "type" "fpcmp") |
| 751 |
(set_attr "fptype" "double")]) |
| 752 |
|
| 753 |
(define_insn "*cmptf_fp" |
| 754 |
[(set (match_operand:CCFP 0 "fcc_register_operand" "=c") |
| 755 |
(compare:CCFP (match_operand:TF 1 "register_operand" "e") |
| 756 |
(match_operand:TF 2 "register_operand" "e")))] |
| 757 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 758 |
{ |
| 759 |
if (TARGET_V9) |
| 760 |
return "fcmpq\t%0, %1, %2"; |
| 761 |
return "fcmpq\t%1, %2"; |
| 762 |
} |
| 763 |
[(set_attr "type" "fpcmp")]) |
| 764 |
|
| 765 |
;; Next come the scc insns. |
| 766 |
|
| 767 |
;; Note that the boolean result (operand 0) takes on DImode |
| 768 |
;; (not SImode) when TARGET_ARCH64. |
| 769 |
|
| 770 |
(define_expand "cstoresi4" |
| 771 |
[(use (match_operator 1 "comparison_operator" |
| 772 |
[(match_operand:SI 2 "compare_operand" "") |
| 773 |
(match_operand:SI 3 "arith_operand" "")])) |
| 774 |
(clobber (match_operand:SI 0 "cstore_result_operand"))] |
| 775 |
"" |
| 776 |
{ |
| 777 |
if (GET_CODE (operands[2]) == ZERO_EXTRACT && operands[3] != const0_rtx) |
| 778 |
operands[2] = force_reg (SImode, operands[2]); |
| 779 |
if (emit_scc_insn (operands)) DONE; else FAIL; |
| 780 |
}) |
| 781 |
|
| 782 |
(define_expand "cstoredi4" |
| 783 |
[(use (match_operator 1 "comparison_operator" |
| 784 |
[(match_operand:DI 2 "compare_operand" "") |
| 785 |
(match_operand:DI 3 "arith_operand" "")])) |
| 786 |
(clobber (match_operand:SI 0 "cstore_result_operand"))] |
| 787 |
"TARGET_ARCH64" |
| 788 |
{ |
| 789 |
if (GET_CODE (operands[2]) == ZERO_EXTRACT && operands[3] != const0_rtx) |
| 790 |
operands[2] = force_reg (DImode, operands[2]); |
| 791 |
if (emit_scc_insn (operands)) DONE; else FAIL; |
| 792 |
}) |
| 793 |
|
| 794 |
(define_expand "cstore<F:mode>4" |
| 795 |
[(use (match_operator 1 "comparison_operator" |
| 796 |
[(match_operand:F 2 "register_operand" "") |
| 797 |
(match_operand:F 3 "register_operand" "")])) |
| 798 |
(clobber (match_operand:SI 0 "cstore_result_operand"))] |
| 799 |
"TARGET_FPU" |
| 800 |
{ |
| 801 |
if (emit_scc_insn (operands)) DONE; else FAIL; |
| 802 |
}) |
| 803 |
|
| 804 |
;; The SNE and SEQ patterns are special because they can be done |
| 805 |
;; without any branching and do not involve a COMPARE. |
| 806 |
|
| 807 |
(define_insn_and_split "*snesi<W:mode>_zero" |
| 808 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 809 |
(ne:W (match_operand:SI 1 "register_operand" "r") |
| 810 |
(const_int 0))) |
| 811 |
(clobber (reg:CC CC_REG))] |
| 812 |
"" |
| 813 |
"#" |
| 814 |
"" |
| 815 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 816 |
(set (match_dup 0) (ltu:W (reg:CCC CC_REG) (const_int 0)))] |
| 817 |
"" |
| 818 |
[(set_attr "length" "2")]) |
| 819 |
|
| 820 |
(define_insn_and_split "*neg_snesi<W:mode>_zero" |
| 821 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 822 |
(neg:W (ne:W (match_operand:SI 1 "register_operand" "r") |
| 823 |
(const_int 0)))) |
| 824 |
(clobber (reg:CC CC_REG))] |
| 825 |
"" |
| 826 |
"#" |
| 827 |
"" |
| 828 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 829 |
(set (match_dup 0) (neg:W (ltu:W (reg:CCC CC_REG) (const_int 0))))] |
| 830 |
"" |
| 831 |
[(set_attr "length" "2")]) |
| 832 |
|
| 833 |
(define_insn_and_split "*snedi<W:mode>_zero" |
| 834 |
[(set (match_operand:W 0 "register_operand" "=&r") |
| 835 |
(ne:W (match_operand:DI 1 "register_operand" "r") |
| 836 |
(const_int 0)))] |
| 837 |
"TARGET_ARCH64 && !TARGET_VIS3" |
| 838 |
"#" |
| 839 |
"&& !reg_overlap_mentioned_p (operands[1], operands[0])" |
| 840 |
[(set (match_dup 0) (const_int 0)) |
| 841 |
(set (match_dup 0) (if_then_else:W (ne:DI (match_dup 1) (const_int 0)) |
| 842 |
(const_int 1) |
| 843 |
(match_dup 0)))] |
| 844 |
"" |
| 845 |
[(set_attr "length" "2")]) |
| 846 |
|
| 847 |
(define_insn_and_split "*snedi<W:mode>_zero_vis3" |
| 848 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 849 |
(ne:W (match_operand:DI 1 "register_operand" "r") |
| 850 |
(const_int 0))) |
| 851 |
(clobber (reg:CCX CC_REG))] |
| 852 |
"TARGET_ARCH64 && TARGET_VIS3" |
| 853 |
"#" |
| 854 |
"&& 1" |
| 855 |
[(set (reg:CCXC CC_REG) (compare:CCXC (not:DI (match_dup 1)) (const_int -1))) |
| 856 |
(set (match_dup 0) (ltu:W (reg:CCXC CC_REG) (const_int 0)))] |
| 857 |
"" |
| 858 |
[(set_attr "length" "2")]) |
| 859 |
|
| 860 |
(define_insn_and_split "*neg_snedi<W:mode>_zero" |
| 861 |
[(set (match_operand:W 0 "register_operand" "=&r") |
| 862 |
(neg:W (ne:W (match_operand:DI 1 "register_operand" "r") |
| 863 |
(const_int 0))))] |
| 864 |
"TARGET_ARCH64 && !TARGET_SUBXC" |
| 865 |
"#" |
| 866 |
"&& !reg_overlap_mentioned_p (operands[1], operands[0])" |
| 867 |
[(set (match_dup 0) (const_int 0)) |
| 868 |
(set (match_dup 0) (if_then_else:W (ne:DI (match_dup 1) (const_int 0)) |
| 869 |
(const_int -1) |
| 870 |
(match_dup 0)))] |
| 871 |
"" |
| 872 |
[(set_attr "length" "2")]) |
| 873 |
|
| 874 |
(define_insn_and_split "*neg_snedi<W:mode>_zero_subxc" |
| 875 |
[(set (match_operand:W 0 "register_operand" "=&r") |
| 876 |
(neg:W (ne:W (match_operand:DI 1 "register_operand" "r") |
| 877 |
(const_int 0)))) |
| 878 |
(clobber (reg:CCX CC_REG))] |
| 879 |
"TARGET_ARCH64 && TARGET_SUBXC" |
| 880 |
"#" |
| 881 |
"&& 1" |
| 882 |
[(set (reg:CCXC CC_REG) (compare:CCXC (not:DI (match_dup 1)) (const_int -1))) |
| 883 |
(set (match_dup 0) (neg:W (ltu:W (reg:CCXC CC_REG) (const_int 0))))] |
| 884 |
"" |
| 885 |
[(set_attr "length" "2")]) |
| 886 |
|
| 887 |
(define_insn_and_split "*seqsi<W:mode>_zero" |
| 888 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 889 |
(eq:W (match_operand:SI 1 "register_operand" "r") |
| 890 |
(const_int 0))) |
| 891 |
(clobber (reg:CC CC_REG))] |
| 892 |
"" |
| 893 |
"#" |
| 894 |
"" |
| 895 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 896 |
(set (match_dup 0) (geu:W (reg:CCC CC_REG) (const_int 0)))] |
| 897 |
"" |
| 898 |
[(set_attr "length" "2")]) |
| 899 |
|
| 900 |
(define_insn_and_split "*neg_seqsi<W:mode>_zero" |
| 901 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 902 |
(neg:W (eq:W (match_operand:SI 1 "register_operand" "r") |
| 903 |
(const_int 0)))) |
| 904 |
(clobber (reg:CC CC_REG))] |
| 905 |
"" |
| 906 |
"#" |
| 907 |
"" |
| 908 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 909 |
(set (match_dup 0) (neg:W (geu:W (reg:CCC CC_REG) (const_int 0))))] |
| 910 |
"" |
| 911 |
[(set_attr "length" "2")]) |
| 912 |
|
| 913 |
(define_insn_and_split "*seqdi<W:mode>_zero" |
| 914 |
[(set (match_operand:W 0 "register_operand" "=&r") |
| 915 |
(eq:W (match_operand:DI 1 "register_operand" "r") |
| 916 |
(const_int 0)))] |
| 917 |
"TARGET_ARCH64" |
| 918 |
"#" |
| 919 |
"&& !reg_overlap_mentioned_p (operands[1], operands[0])" |
| 920 |
[(set (match_dup 0) (const_int 0)) |
| 921 |
(set (match_dup 0) (if_then_else:W (eq:DI (match_dup 1) (const_int 0)) |
| 922 |
(const_int 1) |
| 923 |
(match_dup 0)))] |
| 924 |
"" |
| 925 |
[(set_attr "length" "2")]) |
| 926 |
|
| 927 |
(define_insn_and_split "*neg_seqdi<W:mode>_zero" |
| 928 |
[(set (match_operand:W 0 "register_operand" "=&r") |
| 929 |
(neg:W (eq:W (match_operand:DI 1 "register_operand" "r") |
| 930 |
(const_int 0))))] |
| 931 |
"TARGET_ARCH64" |
| 932 |
"#" |
| 933 |
"&& !reg_overlap_mentioned_p (operands[1], operands[0])" |
| 934 |
[(set (match_dup 0) (const_int 0)) |
| 935 |
(set (match_dup 0) (if_then_else:W (eq:DI (match_dup 1) (const_int 0)) |
| 936 |
(const_int -1) |
| 937 |
(match_dup 0)))] |
| 938 |
"" |
| 939 |
[(set_attr "length" "2")]) |
| 940 |
|
| 941 |
;; We can also do (x + (i == 0)) and related, so put them in. |
| 942 |
|
| 943 |
(define_insn_and_split "*plus_snesi<W:mode>_zero" |
| 944 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 945 |
(plus:W (ne:W (match_operand:SI 1 "register_operand" "r") |
| 946 |
(const_int 0)) |
| 947 |
(match_operand:W 2 "register_operand" "r"))) |
| 948 |
(clobber (reg:CC CC_REG))] |
| 949 |
"" |
| 950 |
"#" |
| 951 |
"" |
| 952 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 953 |
(set (match_dup 0) (plus:W (ltu:W (reg:CCC CC_REG) (const_int 0)) |
| 954 |
(match_dup 2)))] |
| 955 |
"" |
| 956 |
[(set_attr "length" "2")]) |
| 957 |
|
| 958 |
(define_insn_and_split "*plus_plus_snesi<W:mode>_zero" |
| 959 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 960 |
(plus:W (plus:W (ne:W (match_operand:SI 1 "register_operand" "r") |
| 961 |
(const_int 0)) |
| 962 |
(match_operand:W 2 "register_operand" "r")) |
| 963 |
(match_operand:W 3 "register_operand" "r"))) |
| 964 |
(clobber (reg:CC CC_REG))] |
| 965 |
"" |
| 966 |
"#" |
| 967 |
"" |
| 968 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 969 |
(set (match_dup 0) (plus:W (plus:W (ltu:W (reg:CCC CC_REG) (const_int 0)) |
| 970 |
(match_dup 2)) |
| 971 |
(match_dup 3)))] |
| 972 |
"" |
| 973 |
[(set_attr "length" "2")]) |
| 974 |
|
| 975 |
(define_insn_and_split "*plus_snedi<W:mode>_zero" |
| 976 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 977 |
(plus:W (ne:W (match_operand:DI 1 "register_operand" "r") |
| 978 |
(const_int 0)) |
| 979 |
(match_operand:W 2 "register_operand" "r"))) |
| 980 |
(clobber (reg:CCX CC_REG))] |
| 981 |
"TARGET_ARCH64 && TARGET_VIS3" |
| 982 |
"#" |
| 983 |
"&& 1" |
| 984 |
[(set (reg:CCXC CC_REG) (compare:CCXC (not:DI (match_dup 1)) (const_int -1))) |
| 985 |
(set (match_dup 0) (plus:W (ltu:W (reg:CCXC CC_REG) (const_int 0)) |
| 986 |
(match_dup 2)))] |
| 987 |
"" |
| 988 |
[(set_attr "length" "2")]) |
| 989 |
|
| 990 |
(define_insn_and_split "*plus_plus_snedi<W:mode>_zero" |
| 991 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 992 |
(plus:W (plus:W (ne:W (match_operand:DI 1 "register_operand" "r") |
| 993 |
(const_int 0)) |
| 994 |
(match_operand:W 2 "register_operand" "r")) |
| 995 |
(match_operand:W 3 "register_operand" "r"))) |
| 996 |
(clobber (reg:CCX CC_REG))] |
| 997 |
"TARGET_ARCH64 && TARGET_VIS3" |
| 998 |
"#" |
| 999 |
"&& 1" |
| 1000 |
[(set (reg:CCXC CC_REG) (compare:CCXC (not:DI (match_dup 1)) (const_int -1))) |
| 1001 |
(set (match_dup 0) (plus:W (plus:W (ltu:W (reg:CCXC CC_REG) (const_int 0)) |
| 1002 |
(match_dup 2)) |
| 1003 |
(match_dup 3)))] |
| 1004 |
"" |
| 1005 |
[(set_attr "length" "2")]) |
| 1006 |
|
| 1007 |
(define_insn_and_split "*minus_snesi<W:mode>_zero" |
| 1008 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1009 |
(minus:W (match_operand:W 2 "register_operand" "r") |
| 1010 |
(ne:W (match_operand:SI 1 "register_operand" "r") |
| 1011 |
(const_int 0)))) |
| 1012 |
(clobber (reg:CC CC_REG))] |
| 1013 |
"" |
| 1014 |
"#" |
| 1015 |
"" |
| 1016 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 1017 |
(set (match_dup 0) (minus:W (match_dup 2) |
| 1018 |
(ltu:W (reg:CCC CC_REG) (const_int 0))))] |
| 1019 |
"" |
| 1020 |
[(set_attr "length" "2")]) |
| 1021 |
|
| 1022 |
(define_insn_and_split "*minus_minus_snesi<W:mode>_zero" |
| 1023 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1024 |
(minus:W (minus:W (match_operand:W 2 "register_operand" "r") |
| 1025 |
(ne:W (match_operand:SI 1 "register_operand" "r") |
| 1026 |
(const_int 0))) |
| 1027 |
(match_operand:W 3 "register_operand" "r"))) |
| 1028 |
(clobber (reg:CC CC_REG))] |
| 1029 |
"" |
| 1030 |
"#" |
| 1031 |
"" |
| 1032 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 1033 |
(set (match_dup 0) (minus:W (minus:W (match_dup 2) |
| 1034 |
(ltu:W (reg:CCC CC_REG) (const_int 0))) |
| 1035 |
(match_dup 3)))] |
| 1036 |
"" |
| 1037 |
[(set_attr "length" "2")]) |
| 1038 |
|
| 1039 |
(define_insn_and_split "*minus_snedi<W:mode>_zero" |
| 1040 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1041 |
(minus:W (match_operand:W 2 "register_operand" "r") |
| 1042 |
(ne:W (match_operand:DI 1 "register_operand" "r") |
| 1043 |
(const_int 0)))) |
| 1044 |
(clobber (reg:CCX CC_REG))] |
| 1045 |
"TARGET_ARCH64 && TARGET_SUBXC" |
| 1046 |
"#" |
| 1047 |
"&& 1" |
| 1048 |
[(set (reg:CCXC CC_REG) (compare:CCXC (not:DI (match_dup 1)) (const_int -1))) |
| 1049 |
(set (match_dup 0) (minus:W (match_dup 2) |
| 1050 |
(ltu:W (reg:CCXC CC_REG) (const_int 0))))] |
| 1051 |
"" |
| 1052 |
[(set_attr "length" "2")]) |
| 1053 |
|
| 1054 |
(define_insn_and_split "*minus_minus_snedi<W:mode>_zero" |
| 1055 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1056 |
(minus:W (minus:W (match_operand:W 2 "register_operand" "r") |
| 1057 |
(ne:W (match_operand:DI 1 "register_operand" "r") |
| 1058 |
(const_int 0))) |
| 1059 |
(match_operand:W 3 "register_operand" "r"))) |
| 1060 |
(clobber (reg:CCX CC_REG))] |
| 1061 |
"TARGET_ARCH64 && TARGET_SUBXC" |
| 1062 |
"#" |
| 1063 |
"&& 1" |
| 1064 |
[(set (reg:CCXC CC_REG) (compare:CCXC (not:DI (match_dup 1)) (const_int -1))) |
| 1065 |
(set (match_dup 0) (minus:W (minus:W (match_dup 2) |
| 1066 |
(ltu:W (reg:CCXC CC_REG) (const_int 0))) |
| 1067 |
(match_dup 3)))] |
| 1068 |
"" |
| 1069 |
[(set_attr "length" "2")]) |
| 1070 |
|
| 1071 |
(define_insn_and_split "*plus_seqsi<W:mode>_zero" |
| 1072 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1073 |
(plus:W (eq:W (match_operand:SI 1 "register_operand" "r") |
| 1074 |
(const_int 0)) |
| 1075 |
(match_operand:W 2 "register_operand" "r"))) |
| 1076 |
(clobber (reg:CC CC_REG))] |
| 1077 |
"" |
| 1078 |
"#" |
| 1079 |
"" |
| 1080 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 1081 |
(set (match_dup 0) (plus:W (geu:W (reg:CCC CC_REG) (const_int 0)) |
| 1082 |
(match_dup 2)))] |
| 1083 |
"" |
| 1084 |
[(set_attr "length" "2")]) |
| 1085 |
|
| 1086 |
(define_insn_and_split "*minus_seqsi<W:mode>_zero" |
| 1087 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1088 |
(minus:W (match_operand:W 2 "register_operand" "r") |
| 1089 |
(eq:W (match_operand:SI 1 "register_operand" "r") |
| 1090 |
(const_int 0)))) |
| 1091 |
(clobber (reg:CC CC_REG))] |
| 1092 |
"" |
| 1093 |
"#" |
| 1094 |
"" |
| 1095 |
[(set (reg:CCC CC_REG) (compare:CCC (not:SI (match_dup 1)) (const_int -1))) |
| 1096 |
(set (match_dup 0) (minus:W (match_dup 2) |
| 1097 |
(geu:W (reg:CCC CC_REG) (const_int 0))))] |
| 1098 |
"" |
| 1099 |
[(set_attr "length" "2")]) |
| 1100 |
|
| 1101 |
;; We can also do GEU and LTU directly, but these operate after a compare. |
| 1102 |
|
| 1103 |
(define_insn "*sltu<W:mode>_insn" |
| 1104 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1105 |
(ltu:W (match_operand 1 "icc_register_operand" "X") (const_int 0)))] |
| 1106 |
"GET_MODE (operands[1]) == CCmode || GET_MODE (operands[1]) == CCCmode" |
| 1107 |
"addx\t%%g0, 0, %0" |
| 1108 |
[(set_attr "type" "ialuX")]) |
| 1109 |
|
| 1110 |
(define_insn "*plus_sltu<W:mode>" |
| 1111 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1112 |
(plus:W (ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1113 |
(const_int 0)) |
| 1114 |
(match_operand:W 1 "arith_operand" "rI")))] |
| 1115 |
"GET_MODE (operands[2]) == CCmode || GET_MODE (operands[2]) == CCCmode" |
| 1116 |
"addx\t%%g0, %1, %0" |
| 1117 |
[(set_attr "type" "ialuX")]) |
| 1118 |
|
| 1119 |
(define_insn "*plus_plus_sltu<W:mode>" |
| 1120 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1121 |
(plus:W (plus:W (ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1122 |
(const_int 0)) |
| 1123 |
(match_operand:W 1 "register_operand" "%r")) |
| 1124 |
(match_operand:W 2 "arith_operand" "rI")))] |
| 1125 |
"GET_MODE (operands[3]) == CCmode || GET_MODE (operands[3]) == CCCmode" |
| 1126 |
"addx\t%1, %2, %0" |
| 1127 |
[(set_attr "type" "ialuX")]) |
| 1128 |
|
| 1129 |
(define_insn "*neg_sgeu<W:mode>" |
| 1130 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1131 |
(neg:W (geu:W (match_operand 1 "icc_register_operand" "X") |
| 1132 |
(const_int 0))))] |
| 1133 |
"GET_MODE (operands[1]) == CCmode || GET_MODE (operands[1]) == CCCmode" |
| 1134 |
"addx\t%%g0, -1, %0" |
| 1135 |
[(set_attr "type" "ialuX")]) |
| 1136 |
|
| 1137 |
(define_insn "*neg_sgeusidi" |
| 1138 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1139 |
(sign_extend:DI (neg:SI (geu:SI (match_operand 1 "icc_register_operand" "X") |
| 1140 |
(const_int 0)))))] |
| 1141 |
"TARGET_ARCH64 |
| 1142 |
&& (GET_MODE (operands[1]) == CCmode || GET_MODE (operands[1]) == CCCmode)" |
| 1143 |
"addx\t%%g0, -1, %0" |
| 1144 |
[(set_attr "type" "ialuX")]) |
| 1145 |
|
| 1146 |
(define_insn "*minus_sgeu<W:mode>" |
| 1147 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1148 |
(minus:W (match_operand:W 1 "register_operand" "r") |
| 1149 |
(geu:W (match_operand 2 "icc_register_operand" "X") |
| 1150 |
(const_int 0))))] |
| 1151 |
"GET_MODE (operands[2]) == CCmode || GET_MODE (operands[2]) == CCCmode" |
| 1152 |
"addx\t%1, -1, %0" |
| 1153 |
[(set_attr "type" "ialuX")]) |
| 1154 |
|
| 1155 |
(define_insn "*addx<W:mode>" |
| 1156 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1157 |
(plus:W (plus:W (match_operand:W 1 "register_operand" "%r") |
| 1158 |
(match_operand:W 2 "arith_operand" "rI")) |
| 1159 |
(ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1160 |
(const_int 0))))] |
| 1161 |
"GET_MODE (operands[3]) == CCmode || GET_MODE (operands[3]) == CCCmode" |
| 1162 |
"addx\t%1, %2, %0" |
| 1163 |
[(set_attr "type" "ialuX")]) |
| 1164 |
|
| 1165 |
(define_insn "*sltu<W:mode>_insn_vis3" |
| 1166 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1167 |
(ltu:W (match_operand 1 "icc_register_operand" "X") (const_int 0)))] |
| 1168 |
"TARGET_ARCH64 && TARGET_VIS3 |
| 1169 |
&& (GET_MODE (operands[1]) == CCXmode || GET_MODE (operands[1]) == CCXCmode)" |
| 1170 |
"addxc\t%%g0, %%g0, %0" |
| 1171 |
[(set_attr "type" "ialuX")]) |
| 1172 |
|
| 1173 |
(define_insn "*plus_sltu<W:mode>_vis3" |
| 1174 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1175 |
(plus:W (ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1176 |
(const_int 0)) |
| 1177 |
(match_operand:W 1 "register_operand" "r")))] |
| 1178 |
"TARGET_ARCH64 && TARGET_VIS3 |
| 1179 |
&& (GET_MODE (operands[2]) == CCXmode || GET_MODE (operands[2]) == CCXCmode)" |
| 1180 |
"addxc\t%%g0, %1, %0" |
| 1181 |
[(set_attr "type" "ialuX")]) |
| 1182 |
|
| 1183 |
(define_insn "*plus_plus_sltu<W:mode>_vis3" |
| 1184 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1185 |
(plus:W (plus:W (ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1186 |
(const_int 0)) |
| 1187 |
(match_operand:W 1 "register_operand" "%r")) |
| 1188 |
(match_operand:W 2 "register_operand" "r")))] |
| 1189 |
"TARGET_ARCH64 && TARGET_VIS3 |
| 1190 |
&& (GET_MODE (operands[3]) == CCXmode || GET_MODE (operands[3]) == CCXCmode)" |
| 1191 |
"addxc\t%1, %2, %0" |
| 1192 |
[(set_attr "type" "ialuX")]) |
| 1193 |
|
| 1194 |
(define_insn "*addxc<W:mode>" |
| 1195 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1196 |
(plus:W (plus:W (match_operand:W 1 "register_operand" "%r") |
| 1197 |
(match_operand:W 2 "register_operand" "r")) |
| 1198 |
(ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1199 |
(const_int 0))))] |
| 1200 |
"TARGET_ARCH64 && TARGET_VIS3 |
| 1201 |
&& (GET_MODE (operands[3]) == CCXmode || GET_MODE (operands[3]) == CCXCmode)" |
| 1202 |
"addxc\t%1, %2, %0" |
| 1203 |
[(set_attr "type" "ialuX")]) |
| 1204 |
|
| 1205 |
(define_insn "*neg_sltu<W:mode>" |
| 1206 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1207 |
(neg:W (ltu:W (match_operand 1 "icc_register_operand" "X") |
| 1208 |
(const_int 0))))] |
| 1209 |
"GET_MODE (operands[1]) == CCmode || GET_MODE (operands[1]) == CCCmode" |
| 1210 |
"subx\t%%g0, 0, %0" |
| 1211 |
[(set_attr "type" "ialuX")]) |
| 1212 |
|
| 1213 |
(define_insn "*neg_sltusidi" |
| 1214 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1215 |
(sign_extend:DI (neg:SI (ltu:SI (match_operand 1 "icc_register_operand" "X") |
| 1216 |
(const_int 0)))))] |
| 1217 |
"TARGET_ARCH64 |
| 1218 |
&& (GET_MODE (operands[1]) == CCmode || GET_MODE (operands[1]) == CCCmode)" |
| 1219 |
"subx\t%%g0, 0, %0" |
| 1220 |
[(set_attr "type" "ialuX")]) |
| 1221 |
|
| 1222 |
(define_insn "*minus_neg_sltu<W:mode>" |
| 1223 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1224 |
(minus:W (neg:W (ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1225 |
(const_int 0))) |
| 1226 |
(match_operand:W 1 "arith_operand" "rI")))] |
| 1227 |
"GET_MODE (operands[2]) == CCmode || GET_MODE (operands[2]) == CCCmode" |
| 1228 |
"subx\t%%g0, %1, %0" |
| 1229 |
[(set_attr "type" "ialuX")]) |
| 1230 |
|
| 1231 |
(define_insn "*neg_plus_sltu<W:mode>" |
| 1232 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1233 |
(neg:W (plus:W (ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1234 |
(const_int 0)) |
| 1235 |
(match_operand:W 1 "arith_operand" "rI"))))] |
| 1236 |
"GET_MODE (operands[2]) == CCmode || GET_MODE (operands[2]) == CCCmode" |
| 1237 |
"subx\t%%g0, %1, %0" |
| 1238 |
[(set_attr "type" "ialuX")]) |
| 1239 |
|
| 1240 |
(define_insn "*minus_sltu<W:mode>" |
| 1241 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1242 |
(minus:W (match_operand:W 1 "register_operand" "r") |
| 1243 |
(ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1244 |
(const_int 0))))] |
| 1245 |
"GET_MODE (operands[2]) == CCmode || GET_MODE (operands[2]) == CCCmode" |
| 1246 |
"subx\t%1, 0, %0" |
| 1247 |
[(set_attr "type" "ialuX")]) |
| 1248 |
|
| 1249 |
(define_insn "*minus_minus_sltu<W:mode>" |
| 1250 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1251 |
(minus:W (minus:W (match_operand:W 1 "register_or_zero_operand" "rJ") |
| 1252 |
(ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1253 |
(const_int 0))) |
| 1254 |
(match_operand:W 2 "arith_operand" "rI")))] |
| 1255 |
"GET_MODE (operands[3]) == CCmode || GET_MODE (operands[3]) == CCCmode" |
| 1256 |
"subx\t%r1, %2, %0" |
| 1257 |
[(set_attr "type" "ialuX")]) |
| 1258 |
|
| 1259 |
(define_insn "*sgeu<W:mode>_insn" |
| 1260 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1261 |
(geu:W (match_operand 1 "icc_register_operand" "X") (const_int 0)))] |
| 1262 |
"GET_MODE (operands[1]) == CCmode || GET_MODE (operands[1]) == CCCmode" |
| 1263 |
"subx\t%%g0, -1, %0" |
| 1264 |
[(set_attr "type" "ialuX")]) |
| 1265 |
|
| 1266 |
(define_insn "*plus_sgeu<W:mode>" |
| 1267 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1268 |
(plus:W (geu:W (match_operand 2 "icc_register_operand" "X") |
| 1269 |
(const_int 0)) |
| 1270 |
(match_operand:W 1 "register_operand" "r")))] |
| 1271 |
"GET_MODE (operands[2]) == CCmode || GET_MODE (operands[2]) == CCCmode" |
| 1272 |
"subx\t%1, -1, %0" |
| 1273 |
[(set_attr "type" "ialuX")]) |
| 1274 |
|
| 1275 |
(define_insn "*subx<W:mode>" |
| 1276 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1277 |
(minus:W (minus:W (match_operand:W 1 "register_or_zero_operand" "rJ") |
| 1278 |
(match_operand:W 2 "arith_operand" "rI")) |
| 1279 |
(ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1280 |
(const_int 0))))] |
| 1281 |
"GET_MODE (operands[3]) == CCmode || GET_MODE (operands[3]) == CCCmode" |
| 1282 |
"subx\t%r1, %2, %0" |
| 1283 |
[(set_attr "type" "ialuX")]) |
| 1284 |
|
| 1285 |
(define_insn "*neg_sltu<W:mode>_subxc" |
| 1286 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1287 |
(neg:W (ltu:W (match_operand 1 "icc_register_operand" "X") |
| 1288 |
(const_int 0))))] |
| 1289 |
"TARGET_ARCH64 && TARGET_SUBXC |
| 1290 |
&& (GET_MODE (operands[1]) == CCXmode || GET_MODE (operands[1]) == CCXCmode)" |
| 1291 |
"subxc\t%%g0, %%g0, %0" |
| 1292 |
[(set_attr "type" "ialuX")]) |
| 1293 |
|
| 1294 |
(define_insn "*minus_neg_sltu<W:mode>_subxc" |
| 1295 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1296 |
(minus:W (neg:W (ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1297 |
(const_int 0))) |
| 1298 |
(match_operand:W 1 "register_operand" "r")))] |
| 1299 |
"TARGET_ARCH64 && TARGET_SUBXC |
| 1300 |
&& (GET_MODE (operands[2]) == CCXmode || GET_MODE (operands[2]) == CCXCmode)" |
| 1301 |
"subxc\t%%g0, %1, %0" |
| 1302 |
[(set_attr "type" "ialuX")]) |
| 1303 |
|
| 1304 |
(define_insn "*neg_plus_sltu<W:mode>_subxc" |
| 1305 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1306 |
(neg:W (plus:W (ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1307 |
(const_int 0)) |
| 1308 |
(match_operand:W 1 "register_operand" "r"))))] |
| 1309 |
"TARGET_ARCH64 && TARGET_SUBXC |
| 1310 |
&& (GET_MODE (operands[2]) == CCXmode || GET_MODE (operands[2]) == CCXCmode)" |
| 1311 |
"subxc\t%%g0, %1, %0" |
| 1312 |
[(set_attr "type" "ialuX")]) |
| 1313 |
|
| 1314 |
(define_insn "*minus_sltu<W:mode>_subxc" |
| 1315 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1316 |
(minus:W (match_operand:W 1 "register_operand" "r") |
| 1317 |
(ltu:W (match_operand 2 "icc_register_operand" "X") |
| 1318 |
(const_int 0))))] |
| 1319 |
"TARGET_ARCH64 && TARGET_SUBXC |
| 1320 |
&& (GET_MODE (operands[2]) == CCXmode || GET_MODE (operands[2]) == CCXCmode)" |
| 1321 |
"subxc\t%1, %%g0, %0" |
| 1322 |
[(set_attr "type" "ialuX")]) |
| 1323 |
|
| 1324 |
(define_insn "*minus_minus_sltu<W:mode>_subxc" |
| 1325 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1326 |
(minus:W (minus:W (match_operand:W 1 "register_or_zero_operand" "rJ") |
| 1327 |
(ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1328 |
(const_int 0))) |
| 1329 |
(match_operand:W 2 "register_operand" "r")))] |
| 1330 |
"TARGET_ARCH64 && TARGET_SUBXC |
| 1331 |
&& (GET_MODE (operands[3]) == CCXmode || GET_MODE (operands[3]) == CCXCmode)" |
| 1332 |
"subxc\t%r1, %2, %0" |
| 1333 |
[(set_attr "type" "ialuX")]) |
| 1334 |
|
| 1335 |
(define_insn "*subxc<W:mode>" |
| 1336 |
[(set (match_operand:W 0 "register_operand" "=r") |
| 1337 |
(minus:W (minus:W (match_operand:W 1 "register_or_zero_operand" "rJ") |
| 1338 |
(match_operand:W 2 "register_operand" "r")) |
| 1339 |
(ltu:W (match_operand 3 "icc_register_operand" "X") |
| 1340 |
(const_int 0))))] |
| 1341 |
"TARGET_ARCH64 && TARGET_SUBXC |
| 1342 |
&& (GET_MODE (operands[3]) == CCXmode || GET_MODE (operands[3]) == CCXCmode)" |
| 1343 |
"subxc\t%r1, %2, %0" |
| 1344 |
[(set_attr "type" "ialuX")]) |
| 1345 |
|
| 1346 |
(define_split |
| 1347 |
[(set (match_operand:W 0 "register_operand" "") |
| 1348 |
(match_operator:W 1 "icc_comparison_operator" |
| 1349 |
[(match_operand 2 "icc_register_operand" "") (const_int 0)]))] |
| 1350 |
"TARGET_V9 |
| 1351 |
/* 64-bit LTU is better implemented using addxc with VIS3. */ |
| 1352 |
&& !(GET_CODE (operands[1]) == LTU |
| 1353 |
&& (GET_MODE (operands[2]) == CCXmode |
| 1354 |
|| GET_MODE (operands[2]) == CCXCmode) |
| 1355 |
&& TARGET_VIS3) |
| 1356 |
/* 32-bit LTU/GEU are better implemented using addx/subx. */ |
| 1357 |
&& !((GET_CODE (operands[1]) == LTU || GET_CODE (operands[1]) == GEU) |
| 1358 |
&& (GET_MODE (operands[2]) == CCmode |
| 1359 |
|| GET_MODE (operands[2]) == CCCmode))" |
| 1360 |
[(set (match_dup 0) (const_int 0)) |
| 1361 |
(set (match_dup 0) |
| 1362 |
(if_then_else:SI (match_op_dup:W 1 [(match_dup 2) (const_int 0)]) |
| 1363 |
(const_int 1) |
| 1364 |
(match_dup 0)))] |
| 1365 |
"") |
| 1366 |
|
| 1367 |
;; These control RTL generation for conditional jump insns |
| 1368 |
|
| 1369 |
(define_expand "cbranchcc4" |
| 1370 |
[(set (pc) |
| 1371 |
(if_then_else (match_operator 0 "comparison_operator" |
| 1372 |
[(match_operand 1 "compare_operand" "") |
| 1373 |
(match_operand 2 "const_zero_operand" "")]) |
| 1374 |
(label_ref (match_operand 3 "" "")) |
| 1375 |
(pc)))] |
| 1376 |
"" |
| 1377 |
"") |
| 1378 |
|
| 1379 |
(define_expand "cbranchsi4" |
| 1380 |
[(use (match_operator 0 "comparison_operator" |
| 1381 |
[(match_operand:SI 1 "compare_operand" "") |
| 1382 |
(match_operand:SI 2 "arith_operand" "")])) |
| 1383 |
(use (match_operand 3 ""))] |
| 1384 |
"" |
| 1385 |
{ |
| 1386 |
if (GET_CODE (operands[1]) == ZERO_EXTRACT && operands[2] != const0_rtx) |
| 1387 |
operands[1] = force_reg (SImode, operands[1]); |
| 1388 |
emit_conditional_branch_insn (operands); |
| 1389 |
DONE; |
| 1390 |
}) |
| 1391 |
|
| 1392 |
(define_expand "cbranchdi4" |
| 1393 |
[(use (match_operator 0 "comparison_operator" |
| 1394 |
[(match_operand:DI 1 "compare_operand" "") |
| 1395 |
(match_operand:DI 2 "arith_operand" "")])) |
| 1396 |
(use (match_operand 3 ""))] |
| 1397 |
"TARGET_ARCH64" |
| 1398 |
{ |
| 1399 |
if (GET_CODE (operands[1]) == ZERO_EXTRACT && operands[2] != const0_rtx) |
| 1400 |
operands[1] = force_reg (DImode, operands[1]); |
| 1401 |
emit_conditional_branch_insn (operands); |
| 1402 |
DONE; |
| 1403 |
}) |
| 1404 |
|
| 1405 |
(define_expand "cbranch<F:mode>4" |
| 1406 |
[(use (match_operator 0 "comparison_operator" |
| 1407 |
[(match_operand:F 1 "register_operand" "") |
| 1408 |
(match_operand:F 2 "register_operand" "")])) |
| 1409 |
(use (match_operand 3 ""))] |
| 1410 |
"TARGET_FPU" |
| 1411 |
{ |
| 1412 |
emit_conditional_branch_insn (operands); |
| 1413 |
DONE; |
| 1414 |
}) |
| 1415 |
|
| 1416 |
|
| 1417 |
;; Now match both normal and inverted jump. |
| 1418 |
|
| 1419 |
;; XXX fpcmp nop braindamage |
| 1420 |
(define_insn "*normal_branch" |
| 1421 |
[(set (pc) |
| 1422 |
(if_then_else (match_operator 0 "icc_comparison_operator" |
| 1423 |
[(reg CC_REG) (const_int 0)]) |
| 1424 |
(label_ref (match_operand 1 "" "")) |
| 1425 |
(pc)))] |
| 1426 |
"" |
| 1427 |
{ |
| 1428 |
return output_cbranch (operands[0], operands[1], 1, 0, |
| 1429 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1430 |
insn); |
| 1431 |
} |
| 1432 |
[(set_attr "type" "branch") |
| 1433 |
(set_attr "branch_type" "icc")]) |
| 1434 |
|
| 1435 |
;; XXX fpcmp nop braindamage |
| 1436 |
(define_insn "*inverted_branch" |
| 1437 |
[(set (pc) |
| 1438 |
(if_then_else (match_operator 0 "icc_comparison_operator" |
| 1439 |
[(reg CC_REG) (const_int 0)]) |
| 1440 |
(pc) |
| 1441 |
(label_ref (match_operand 1 "" ""))))] |
| 1442 |
"" |
| 1443 |
{ |
| 1444 |
return output_cbranch (operands[0], operands[1], 1, 1, |
| 1445 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1446 |
insn); |
| 1447 |
} |
| 1448 |
[(set_attr "type" "branch") |
| 1449 |
(set_attr "branch_type" "icc")]) |
| 1450 |
|
| 1451 |
;; XXX fpcmp nop braindamage |
| 1452 |
(define_insn "*normal_fp_branch" |
| 1453 |
[(set (pc) |
| 1454 |
(if_then_else (match_operator 1 "comparison_operator" |
| 1455 |
[(match_operand:CCFP 0 "fcc_register_operand" "c") |
| 1456 |
(const_int 0)]) |
| 1457 |
(label_ref (match_operand 2 "" "")) |
| 1458 |
(pc)))] |
| 1459 |
"" |
| 1460 |
{ |
| 1461 |
return output_cbranch (operands[1], operands[2], 2, 0, |
| 1462 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1463 |
insn); |
| 1464 |
} |
| 1465 |
[(set_attr "type" "branch") |
| 1466 |
(set_attr "branch_type" "fcc")]) |
| 1467 |
|
| 1468 |
;; XXX fpcmp nop braindamage |
| 1469 |
(define_insn "*inverted_fp_branch" |
| 1470 |
[(set (pc) |
| 1471 |
(if_then_else (match_operator 1 "comparison_operator" |
| 1472 |
[(match_operand:CCFP 0 "fcc_register_operand" "c") |
| 1473 |
(const_int 0)]) |
| 1474 |
(pc) |
| 1475 |
(label_ref (match_operand 2 "" ""))))] |
| 1476 |
"" |
| 1477 |
{ |
| 1478 |
return output_cbranch (operands[1], operands[2], 2, 1, |
| 1479 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1480 |
insn); |
| 1481 |
} |
| 1482 |
[(set_attr "type" "branch") |
| 1483 |
(set_attr "branch_type" "fcc")]) |
| 1484 |
|
| 1485 |
;; XXX fpcmp nop braindamage |
| 1486 |
(define_insn "*normal_fpe_branch" |
| 1487 |
[(set (pc) |
| 1488 |
(if_then_else (match_operator 1 "comparison_operator" |
| 1489 |
[(match_operand:CCFPE 0 "fcc_register_operand" "c") |
| 1490 |
(const_int 0)]) |
| 1491 |
(label_ref (match_operand 2 "" "")) |
| 1492 |
(pc)))] |
| 1493 |
"" |
| 1494 |
{ |
| 1495 |
return output_cbranch (operands[1], operands[2], 2, 0, |
| 1496 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1497 |
insn); |
| 1498 |
} |
| 1499 |
[(set_attr "type" "branch") |
| 1500 |
(set_attr "branch_type" "fcc")]) |
| 1501 |
|
| 1502 |
;; XXX fpcmp nop braindamage |
| 1503 |
(define_insn "*inverted_fpe_branch" |
| 1504 |
[(set (pc) |
| 1505 |
(if_then_else (match_operator 1 "comparison_operator" |
| 1506 |
[(match_operand:CCFPE 0 "fcc_register_operand" "c") |
| 1507 |
(const_int 0)]) |
| 1508 |
(pc) |
| 1509 |
(label_ref (match_operand 2 "" ""))))] |
| 1510 |
"" |
| 1511 |
{ |
| 1512 |
return output_cbranch (operands[1], operands[2], 2, 1, |
| 1513 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1514 |
insn); |
| 1515 |
} |
| 1516 |
[(set_attr "type" "branch") |
| 1517 |
(set_attr "branch_type" "fcc")]) |
| 1518 |
|
| 1519 |
;; SPARC V9-specific jump insns. None of these are guaranteed to be |
| 1520 |
;; in the architecture. |
| 1521 |
|
| 1522 |
(define_insn "*cbcond_sp32" |
| 1523 |
[(set (pc) |
| 1524 |
(if_then_else (match_operator 0 "comparison_operator" |
| 1525 |
[(match_operand:SI 1 "register_operand" "r") |
| 1526 |
(match_operand:SI 2 "arith5_operand" "rA")]) |
| 1527 |
(label_ref (match_operand 3 "" "")) |
| 1528 |
(pc)))] |
| 1529 |
"TARGET_CBCOND" |
| 1530 |
{ |
| 1531 |
return output_cbcond (operands[0], operands[3], insn); |
| 1532 |
} |
| 1533 |
[(set_attr "type" "cbcond")]) |
| 1534 |
|
| 1535 |
(define_insn "*cbcond_sp64" |
| 1536 |
[(set (pc) |
| 1537 |
(if_then_else (match_operator 0 "comparison_operator" |
| 1538 |
[(match_operand:DI 1 "register_operand" "r") |
| 1539 |
(match_operand:DI 2 "arith5_operand" "rA")]) |
| 1540 |
(label_ref (match_operand 3 "" "")) |
| 1541 |
(pc)))] |
| 1542 |
"TARGET_ARCH64 && TARGET_CBCOND" |
| 1543 |
{ |
| 1544 |
return output_cbcond (operands[0], operands[3], insn); |
| 1545 |
} |
| 1546 |
[(set_attr "type" "cbcond")]) |
| 1547 |
|
| 1548 |
;; There are no 32-bit brreg insns. |
| 1549 |
|
| 1550 |
(define_insn "*normal_int_branch_sp64" |
| 1551 |
[(set (pc) |
| 1552 |
(if_then_else (match_operator 0 "v9_register_comparison_operator" |
| 1553 |
[(match_operand:DI 1 "register_operand" "r") |
| 1554 |
(const_int 0)]) |
| 1555 |
(label_ref (match_operand 2 "" "")) |
| 1556 |
(pc)))] |
| 1557 |
"TARGET_ARCH64" |
| 1558 |
{ |
| 1559 |
return output_v9branch (operands[0], operands[2], 1, 2, 0, |
| 1560 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1561 |
insn); |
| 1562 |
} |
| 1563 |
[(set_attr "type" "branch") |
| 1564 |
(set_attr "branch_type" "reg")]) |
| 1565 |
|
| 1566 |
(define_insn "*inverted_int_branch_sp64" |
| 1567 |
[(set (pc) |
| 1568 |
(if_then_else (match_operator 0 "v9_register_comparison_operator" |
| 1569 |
[(match_operand:DI 1 "register_operand" "r") |
| 1570 |
(const_int 0)]) |
| 1571 |
(pc) |
| 1572 |
(label_ref (match_operand 2 "" ""))))] |
| 1573 |
"TARGET_ARCH64" |
| 1574 |
{ |
| 1575 |
return output_v9branch (operands[0], operands[2], 1, 2, 1, |
| 1576 |
final_sequence && INSN_ANNULLED_BRANCH_P (insn), |
| 1577 |
insn); |
| 1578 |
} |
| 1579 |
[(set_attr "type" "branch") |
| 1580 |
(set_attr "branch_type" "reg")]) |
| 1581 |
|
| 1582 |
|
| 1583 |
;; Load in operand 0 the (absolute) address of operand 1, which is a symbolic |
| 1584 |
;; value subject to a PC-relative relocation. Operand 2 is a helper function |
| 1585 |
;; that adds the PC value at the call point to register #(operand 3). |
| 1586 |
;; |
| 1587 |
;; Even on V9 we use this call sequence with a stub, instead of "rd %pc, ..." |
| 1588 |
;; because the RDPC instruction is extremely expensive and incurs a complete |
| 1589 |
;; instruction pipeline flush. |
| 1590 |
|
| 1591 |
(define_insn "@load_pcrel_sym<P:mode>" |
| 1592 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 1593 |
(unspec:P [(match_operand:P 1 "symbolic_operand" "") |
| 1594 |
(match_operand:P 2 "call_address_operand" "") |
| 1595 |
(match_operand:P 3 "const_int_operand" "")] |
| 1596 |
UNSPEC_LOAD_PCREL_SYM)) |
| 1597 |
(clobber (reg:P O7_REG))] |
| 1598 |
"REGNO (operands[0]) == INTVAL (operands[3])" |
| 1599 |
{ |
| 1600 |
return output_load_pcrel_sym (operands); |
| 1601 |
} |
| 1602 |
[(set (attr "type") (const_string "multi")) |
| 1603 |
(set (attr "length") |
| 1604 |
(if_then_else (eq_attr "delayed_branch" "true") |
| 1605 |
(const_int 3) |
| 1606 |
(const_int 4)))]) |
| 1607 |
|
| 1608 |
|
| 1609 |
;; Integer move instructions |
| 1610 |
|
| 1611 |
(define_expand "movqi" |
| 1612 |
[(set (match_operand:QI 0 "nonimmediate_operand" "") |
| 1613 |
(match_operand:QI 1 "general_operand" ""))] |
| 1614 |
"" |
| 1615 |
{ |
| 1616 |
if (sparc_expand_move (QImode, operands)) |
| 1617 |
DONE; |
| 1618 |
}) |
| 1619 |
|
| 1620 |
(define_insn "*movqi_insn" |
| 1621 |
[(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m") |
| 1622 |
(match_operand:QI 1 "input_operand" "rI,m,rJ"))] |
| 1623 |
"(register_operand (operands[0], QImode) |
| 1624 |
|| register_or_zero_operand (operands[1], QImode))" |
| 1625 |
"@ |
| 1626 |
mov\t%1, %0 |
| 1627 |
ldub\t%1, %0 |
| 1628 |
stb\t%r1, %0" |
| 1629 |
[(set_attr "type" "*,load,store") |
| 1630 |
(set_attr "subtype" "*,regular,*") |
| 1631 |
(set_attr "us3load_type" "*,3cycle,*")]) |
| 1632 |
|
| 1633 |
(define_expand "movhi" |
| 1634 |
[(set (match_operand:HI 0 "nonimmediate_operand" "") |
| 1635 |
(match_operand:HI 1 "general_operand" ""))] |
| 1636 |
"" |
| 1637 |
{ |
| 1638 |
if (sparc_expand_move (HImode, operands)) |
| 1639 |
DONE; |
| 1640 |
}) |
| 1641 |
|
| 1642 |
(define_insn "*movhi_insn" |
| 1643 |
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m") |
| 1644 |
(match_operand:HI 1 "input_operand" "rI,K,m,rJ"))] |
| 1645 |
"(register_operand (operands[0], HImode) |
| 1646 |
|| register_or_zero_operand (operands[1], HImode))" |
| 1647 |
"@ |
| 1648 |
mov\t%1, %0 |
| 1649 |
sethi\t%%hi(%a1), %0 |
| 1650 |
lduh\t%1, %0 |
| 1651 |
sth\t%r1, %0" |
| 1652 |
[(set_attr "type" "*,*,load,store") |
| 1653 |
(set_attr "subtype" "*,*,regular,*") |
| 1654 |
(set_attr "us3load_type" "*,*,3cycle,*")]) |
| 1655 |
|
| 1656 |
;; We always work with constants here. |
| 1657 |
(define_insn "*movhi_lo_sum" |
| 1658 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1659 |
(ior:HI (match_operand:HI 1 "register_operand" "%r") |
| 1660 |
(match_operand:HI 2 "small_int_operand" "I")))] |
| 1661 |
"" |
| 1662 |
"or\t%1, %2, %0") |
| 1663 |
|
| 1664 |
(define_expand "movsi" |
| 1665 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 1666 |
(match_operand:SI 1 "general_operand" ""))] |
| 1667 |
"" |
| 1668 |
{ |
| 1669 |
if (sparc_expand_move (SImode, operands)) |
| 1670 |
DONE; |
| 1671 |
}) |
| 1672 |
|
| 1673 |
(define_insn "*movsi_insn" |
| 1674 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r, m, r,*f,?*f,?*f, m,d,d") |
| 1675 |
(match_operand:SI 1 "input_operand" "rI,K,m,rJ,*f, r, f, m,?*f,J,P"))] |
| 1676 |
"register_operand (operands[0], SImode) |
| 1677 |
|| register_or_zero_or_all_ones_operand (operands[1], SImode)" |
| 1678 |
"@ |
| 1679 |
mov\t%1, %0 |
| 1680 |
sethi\t%%hi(%a1), %0 |
| 1681 |
ld\t%1, %0 |
| 1682 |
st\t%r1, %0 |
| 1683 |
movstouw\t%1, %0 |
| 1684 |
movwtos\t%1, %0 |
| 1685 |
fmovs\t%1, %0 |
| 1686 |
ld\t%1, %0 |
| 1687 |
st\t%1, %0 |
| 1688 |
fzeros\t%0 |
| 1689 |
fones\t%0" |
| 1690 |
[(set_attr "type" "*,*,load,store,vismv,vismv,fpmove,fpload,fpstore,visl,visl") |
| 1691 |
(set_attr "subtype" "*,*,regular,*,movstouw,single,*,*,*,single,single") |
| 1692 |
(set_attr "cpu_feature" "*,*,*,*,vis3,vis3,*,*,*,vis,vis")]) |
| 1693 |
|
| 1694 |
(define_insn "*movsi_lo_sum" |
| 1695 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1696 |
(lo_sum:SI (match_operand:SI 1 "register_operand" "r") |
| 1697 |
(match_operand:SI 2 "immediate_operand" "in")))] |
| 1698 |
"!flag_pic" |
| 1699 |
"or\t%1, %%lo(%a2), %0") |
| 1700 |
|
| 1701 |
(define_insn "*movsi_high" |
| 1702 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1703 |
(high:SI (match_operand:SI 1 "immediate_operand" "in")))] |
| 1704 |
"!flag_pic" |
| 1705 |
"sethi\t%%hi(%a1), %0") |
| 1706 |
|
| 1707 |
;; The next two patterns must wrap the SYMBOL_REF in an UNSPEC |
| 1708 |
;; so that CSE won't optimize the address computation away. |
| 1709 |
(define_insn "movsi_lo_sum_pic" |
| 1710 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1711 |
(lo_sum:SI (match_operand:SI 1 "register_operand" "r") |
| 1712 |
(unspec:SI [(match_operand:SI 2 "immediate_operand" "in")] |
| 1713 |
UNSPEC_MOVE_PIC)))] |
| 1714 |
"flag_pic" |
| 1715 |
{ |
| 1716 |
#ifdef HAVE_AS_SPARC_GOTDATA_OP |
| 1717 |
return "xor\t%1, %%gdop_lox10(%a2), %0"; |
| 1718 |
#else |
| 1719 |
return "or\t%1, %%lo(%a2), %0"; |
| 1720 |
#endif |
| 1721 |
}) |
| 1722 |
|
| 1723 |
(define_insn "movsi_high_pic" |
| 1724 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1725 |
(high:SI (unspec:SI [(match_operand 1 "" "")] UNSPEC_MOVE_PIC)))] |
| 1726 |
"flag_pic && check_pic (1)" |
| 1727 |
{ |
| 1728 |
#ifdef HAVE_AS_SPARC_GOTDATA_OP |
| 1729 |
return "sethi\t%%gdop_hix22(%a1), %0"; |
| 1730 |
#else |
| 1731 |
return "sethi\t%%hi(%a1), %0"; |
| 1732 |
#endif |
| 1733 |
}) |
| 1734 |
|
| 1735 |
(define_insn "movsi_pic_gotdata_op" |
| 1736 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1737 |
(unspec:SI [(match_operand:SI 1 "register_operand" "r") |
| 1738 |
(match_operand:SI 2 "register_operand" "r") |
| 1739 |
(match_operand 3 "symbolic_operand" "")] |
| 1740 |
UNSPEC_MOVE_GOTDATA))] |
| 1741 |
"flag_pic && check_pic (1)" |
| 1742 |
{ |
| 1743 |
#ifdef HAVE_AS_SPARC_GOTDATA_OP |
| 1744 |
return "ld\t[%1 + %2], %0, %%gdop(%a3)"; |
| 1745 |
#else |
| 1746 |
return "ld\t[%1 + %2], %0"; |
| 1747 |
#endif |
| 1748 |
} |
| 1749 |
[(set_attr "type" "load") |
| 1750 |
(set_attr "subtype" "regular")]) |
| 1751 |
|
| 1752 |
(define_expand "movsi_pic_label_ref" |
| 1753 |
[(set (match_dup 3) (high:SI |
| 1754 |
(unspec:SI [(match_operand:SI 1 "symbolic_operand" "") |
| 1755 |
(match_dup 2)] UNSPEC_MOVE_PIC_LABEL))) |
| 1756 |
(set (match_dup 4) (lo_sum:SI (match_dup 3) |
| 1757 |
(unspec:SI [(match_dup 1) (match_dup 2)] UNSPEC_MOVE_PIC_LABEL))) |
| 1758 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 1759 |
(minus:SI (match_dup 5) (match_dup 4)))] |
| 1760 |
"flag_pic" |
| 1761 |
{ |
| 1762 |
crtl->uses_pic_offset_table = 1; |
| 1763 |
operands[2] = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_"); |
| 1764 |
if (!can_create_pseudo_p ()) |
| 1765 |
{ |
| 1766 |
operands[3] = operands[0]; |
| 1767 |
operands[4] = operands[0]; |
| 1768 |
} |
| 1769 |
else |
| 1770 |
{ |
| 1771 |
operands[3] = gen_reg_rtx (SImode); |
| 1772 |
operands[4] = gen_reg_rtx (SImode); |
| 1773 |
} |
| 1774 |
operands[5] = pic_offset_table_rtx; |
| 1775 |
}) |
| 1776 |
|
| 1777 |
(define_insn "*movsi_high_pic_label_ref" |
| 1778 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1779 |
(high:SI |
| 1780 |
(unspec:SI [(match_operand:SI 1 "symbolic_operand" "") |
| 1781 |
(match_operand:SI 2 "" "")] UNSPEC_MOVE_PIC_LABEL)))] |
| 1782 |
"flag_pic" |
| 1783 |
"sethi\t%%hi(%a2-(%a1-.)), %0") |
| 1784 |
|
| 1785 |
(define_insn "*movsi_lo_sum_pic_label_ref" |
| 1786 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1787 |
(lo_sum:SI (match_operand:SI 1 "register_operand" "r") |
| 1788 |
(unspec:SI [(match_operand:SI 2 "symbolic_operand" "") |
| 1789 |
(match_operand:SI 3 "" "")] UNSPEC_MOVE_PIC_LABEL)))] |
| 1790 |
"flag_pic" |
| 1791 |
"or\t%1, %%lo(%a3-(%a2-.)), %0") |
| 1792 |
|
| 1793 |
;; Set up the PIC register for VxWorks. |
| 1794 |
|
| 1795 |
(define_expand "vxworks_load_got" |
| 1796 |
[(set (match_dup 0) |
| 1797 |
(high:SI (match_dup 1))) |
| 1798 |
(set (match_dup 0) |
| 1799 |
(mem:SI (lo_sum:SI (match_dup 0) (match_dup 1)))) |
| 1800 |
(set (match_dup 0) |
| 1801 |
(mem:SI (lo_sum:SI (match_dup 0) (match_dup 2))))] |
| 1802 |
"TARGET_VXWORKS_RTP" |
| 1803 |
{ |
| 1804 |
operands[0] = pic_offset_table_rtx; |
| 1805 |
operands[1] = gen_rtx_SYMBOL_REF (SImode, VXWORKS_GOTT_BASE); |
| 1806 |
operands[2] = gen_rtx_SYMBOL_REF (SImode, VXWORKS_GOTT_INDEX); |
| 1807 |
}) |
| 1808 |
|
| 1809 |
(define_expand "movdi" |
| 1810 |
[(set (match_operand:DI 0 "nonimmediate_operand" "") |
| 1811 |
(match_operand:DI 1 "general_operand" ""))] |
| 1812 |
"" |
| 1813 |
{ |
| 1814 |
if (sparc_expand_move (DImode, operands)) |
| 1815 |
DONE; |
| 1816 |
}) |
| 1817 |
|
| 1818 |
;; Be careful, fmovd does not exist when !v9. |
| 1819 |
;; We match MEM moves directly when we have correct even |
| 1820 |
;; numbered registers, but fall into splits otherwise. |
| 1821 |
;; The constraint ordering here is really important to |
| 1822 |
;; avoid insane problems in reload, especially for patterns |
| 1823 |
;; of the form: |
| 1824 |
;; |
| 1825 |
;; (set (mem:DI (plus:SI (reg:SI 30 %fp) |
| 1826 |
;; (const_int -5016))) |
| 1827 |
;; (reg:DI 2 %g2)) |
| 1828 |
;; |
| 1829 |
|
| 1830 |
(define_insn "*movdi_insn_sp32" |
| 1831 |
[(set (match_operand:DI 0 "nonimmediate_operand" |
| 1832 |
"=T,o,r,o,r,r,?*f, T,?*f, o,?*e,?*e, r,?*f,?*e, T,*b,*b") |
| 1833 |
(match_operand:DI 1 "input_operand" |
| 1834 |
" J,J,o,r,i,r, T,?*f, o,?*f, *e, *e,?*f, r, T,?*e, J, P"))] |
| 1835 |
"TARGET_ARCH32 |
| 1836 |
&& (register_operand (operands[0], DImode) |
| 1837 |
|| register_or_zero_operand (operands[1], DImode))" |
| 1838 |
"@ |
| 1839 |
stx\t%r1, %0 |
| 1840 |
# |
| 1841 |
ldd\t%1, %0 |
| 1842 |
std\t%1, %0 |
| 1843 |
# |
| 1844 |
# |
| 1845 |
ldd\t%1, %0 |
| 1846 |
std\t%1, %0 |
| 1847 |
# |
| 1848 |
# |
| 1849 |
fmovd\t%1, %0 |
| 1850 |
# |
| 1851 |
# |
| 1852 |
# |
| 1853 |
ldd\t%1, %0 |
| 1854 |
std\t%1, %0 |
| 1855 |
fzero\t%0 |
| 1856 |
fone\t%0" |
| 1857 |
[(set_attr "type" "store,*,load,store,*,*,fpload,fpstore,*,*,fpmove,*,*,*,fpload,fpstore,visl,visl") |
| 1858 |
(set_attr "subtype" "*,*,regular,*,*,*,*,*,*,*,*,*,*,*,*,*,double,double") |
| 1859 |
(set_attr "length" "*,2,*,*,2,2,*,*,2,2,*,2,2,2,*,*,*,*") |
| 1860 |
(set_attr "fptype" "*,*,*,*,*,*,*,*,*,*,double,*,*,*,*,*,double,double") |
| 1861 |
(set_attr "cpu_feature" "v9,*,*,*,*,*,fpu,fpu,fpu,fpu,v9,fpunotv9,vis3,vis3,fpu,fpu,vis,vis")]) |
| 1862 |
|
| 1863 |
(define_insn "*movdi_insn_sp64" |
| 1864 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r, m, r,*e,?*e,?*e, m,b,b") |
| 1865 |
(match_operand:DI 1 "input_operand" "rI,N,m,rJ,*e, r, *e, m,?*e,J,P"))] |
| 1866 |
"TARGET_ARCH64 |
| 1867 |
&& (register_operand (operands[0], DImode) |
| 1868 |
|| register_or_zero_or_all_ones_operand (operands[1], DImode))" |
| 1869 |
"@ |
| 1870 |
mov\t%1, %0 |
| 1871 |
sethi\t%%hi(%a1), %0 |
| 1872 |
ldx\t%1, %0 |
| 1873 |
stx\t%r1, %0 |
| 1874 |
movdtox\t%1, %0 |
| 1875 |
movxtod\t%1, %0 |
| 1876 |
fmovd\t%1, %0 |
| 1877 |
ldd\t%1, %0 |
| 1878 |
std\t%1, %0 |
| 1879 |
fzero\t%0 |
| 1880 |
fone\t%0" |
| 1881 |
[(set_attr "type" "*,*,load,store,vismv,vismv,fpmove,fpload,fpstore,visl,visl") |
| 1882 |
(set_attr "subtype" "*,*,regular,*,movdtox,movxtod,*,*,*,double,double") |
| 1883 |
(set_attr "fptype" "*,*,*,*,*,*,double,*,*,double,double") |
| 1884 |
(set_attr "cpu_feature" "*,*,*,*,vis3,vis3,*,*,*,vis,vis")]) |
| 1885 |
|
| 1886 |
(define_expand "movdi_pic_label_ref" |
| 1887 |
[(set (match_dup 3) (high:DI |
| 1888 |
(unspec:DI [(match_operand:DI 1 "symbolic_operand" "") |
| 1889 |
(match_dup 2)] UNSPEC_MOVE_PIC_LABEL))) |
| 1890 |
(set (match_dup 4) (lo_sum:DI (match_dup 3) |
| 1891 |
(unspec:DI [(match_dup 1) (match_dup 2)] UNSPEC_MOVE_PIC_LABEL))) |
| 1892 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 1893 |
(minus:DI (match_dup 5) (match_dup 4)))] |
| 1894 |
"TARGET_ARCH64 && flag_pic" |
| 1895 |
{ |
| 1896 |
crtl->uses_pic_offset_table = 1; |
| 1897 |
operands[2] = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_"); |
| 1898 |
if (!can_create_pseudo_p ()) |
| 1899 |
{ |
| 1900 |
operands[3] = operands[0]; |
| 1901 |
operands[4] = operands[0]; |
| 1902 |
} |
| 1903 |
else |
| 1904 |
{ |
| 1905 |
operands[3] = gen_reg_rtx (DImode); |
| 1906 |
operands[4] = gen_reg_rtx (DImode); |
| 1907 |
} |
| 1908 |
operands[5] = pic_offset_table_rtx; |
| 1909 |
}) |
| 1910 |
|
| 1911 |
(define_insn "*movdi_high_pic_label_ref" |
| 1912 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1913 |
(high:DI |
| 1914 |
(unspec:DI [(match_operand:DI 1 "symbolic_operand" "") |
| 1915 |
(match_operand:DI 2 "" "")] UNSPEC_MOVE_PIC_LABEL)))] |
| 1916 |
"TARGET_ARCH64 && flag_pic" |
| 1917 |
"sethi\t%%hi(%a2-(%a1-.)), %0") |
| 1918 |
|
| 1919 |
(define_insn "*movdi_lo_sum_pic_label_ref" |
| 1920 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1921 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 1922 |
(unspec:DI [(match_operand:DI 2 "symbolic_operand" "") |
| 1923 |
(match_operand:DI 3 "" "")] UNSPEC_MOVE_PIC_LABEL)))] |
| 1924 |
"TARGET_ARCH64 && flag_pic" |
| 1925 |
"or\t%1, %%lo(%a3-(%a2-.)), %0") |
| 1926 |
|
| 1927 |
;; SPARC-v9 code model support insns. See sparc_emit_set_symbolic_const64 |
| 1928 |
;; in sparc.cc to see what is going on here... PIC stuff comes first. |
| 1929 |
|
| 1930 |
(define_insn "movdi_lo_sum_pic" |
| 1931 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1932 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 1933 |
(unspec:DI [(match_operand:DI 2 "immediate_operand" "in")] |
| 1934 |
UNSPEC_MOVE_PIC)))] |
| 1935 |
"TARGET_ARCH64 && flag_pic" |
| 1936 |
{ |
| 1937 |
#ifdef HAVE_AS_SPARC_GOTDATA_OP |
| 1938 |
return "xor\t%1, %%gdop_lox10(%a2), %0"; |
| 1939 |
#else |
| 1940 |
return "or\t%1, %%lo(%a2), %0"; |
| 1941 |
#endif |
| 1942 |
}) |
| 1943 |
|
| 1944 |
(define_insn "movdi_high_pic" |
| 1945 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1946 |
(high:DI (unspec:DI [(match_operand 1 "" "")] UNSPEC_MOVE_PIC)))] |
| 1947 |
"TARGET_ARCH64 && flag_pic && check_pic (1)" |
| 1948 |
{ |
| 1949 |
#ifdef HAVE_AS_SPARC_GOTDATA_OP |
| 1950 |
return "sethi\t%%gdop_hix22(%a1), %0"; |
| 1951 |
#else |
| 1952 |
return "sethi\t%%hi(%a1), %0"; |
| 1953 |
#endif |
| 1954 |
}) |
| 1955 |
|
| 1956 |
(define_insn "movdi_pic_gotdata_op" |
| 1957 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1958 |
(unspec:DI [(match_operand:DI 1 "register_operand" "r") |
| 1959 |
(match_operand:DI 2 "register_operand" "r") |
| 1960 |
(match_operand 3 "symbolic_operand" "")] |
| 1961 |
UNSPEC_MOVE_GOTDATA))] |
| 1962 |
"TARGET_ARCH64 && flag_pic && check_pic (1)" |
| 1963 |
{ |
| 1964 |
#ifdef HAVE_AS_SPARC_GOTDATA_OP |
| 1965 |
return "ldx\t[%1 + %2], %0, %%gdop(%a3)"; |
| 1966 |
#else |
| 1967 |
return "ldx\t[%1 + %2], %0"; |
| 1968 |
#endif |
| 1969 |
} |
| 1970 |
[(set_attr "type" "load") |
| 1971 |
(set_attr "subtype" "regular")]) |
| 1972 |
|
| 1973 |
(define_insn "*sethi_di_medlow_embmedany_pic" |
| 1974 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1975 |
(high:DI (match_operand:DI 1 "medium_pic_operand" "")))] |
| 1976 |
"(TARGET_CM_MEDLOW || TARGET_CM_EMBMEDANY) && flag_pic && check_pic (1)" |
| 1977 |
"sethi\t%%hi(%a1), %0") |
| 1978 |
|
| 1979 |
(define_insn "*sethi_di_medlow" |
| 1980 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1981 |
(high:DI (match_operand:DI 1 "symbolic_operand" "")))] |
| 1982 |
"TARGET_CM_MEDLOW && !flag_pic" |
| 1983 |
"sethi\t%%hi(%a1), %0") |
| 1984 |
|
| 1985 |
(define_insn "*losum_di_medlow" |
| 1986 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1987 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 1988 |
(match_operand:DI 2 "symbolic_operand" "")))] |
| 1989 |
"TARGET_CM_MEDLOW && !flag_pic" |
| 1990 |
"or\t%1, %%lo(%a2), %0") |
| 1991 |
|
| 1992 |
(define_insn "seth44" |
| 1993 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 1994 |
(high:DI (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] |
| 1995 |
UNSPEC_SETH44)))] |
| 1996 |
"TARGET_CM_MEDMID && !flag_pic" |
| 1997 |
"sethi\t%%h44(%a1), %0") |
| 1998 |
|
| 1999 |
(define_insn "setm44" |
| 2000 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2001 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2002 |
(unspec:DI [(match_operand:DI 2 "symbolic_operand" "")] |
| 2003 |
UNSPEC_SETM44)))] |
| 2004 |
"TARGET_CM_MEDMID && !flag_pic" |
| 2005 |
"or\t%1, %%m44(%a2), %0") |
| 2006 |
|
| 2007 |
(define_insn "setl44" |
| 2008 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2009 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2010 |
(match_operand:DI 2 "symbolic_operand" "")))] |
| 2011 |
"TARGET_CM_MEDMID && !flag_pic" |
| 2012 |
"or\t%1, %%l44(%a2), %0") |
| 2013 |
|
| 2014 |
(define_insn "sethh" |
| 2015 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2016 |
(high:DI (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] |
| 2017 |
UNSPEC_SETHH)))] |
| 2018 |
"TARGET_CM_MEDANY && !flag_pic" |
| 2019 |
"sethi\t%%hh(%a1), %0") |
| 2020 |
|
| 2021 |
(define_insn "setlm" |
| 2022 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2023 |
(high:DI (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] |
| 2024 |
UNSPEC_SETLM)))] |
| 2025 |
"TARGET_CM_MEDANY && !flag_pic" |
| 2026 |
"sethi\t%%lm(%a1), %0") |
| 2027 |
|
| 2028 |
(define_insn "sethm" |
| 2029 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2030 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2031 |
(unspec:DI [(match_operand:DI 2 "symbolic_operand" "")] |
| 2032 |
UNSPEC_EMB_SETHM)))] |
| 2033 |
"TARGET_CM_MEDANY && !flag_pic" |
| 2034 |
"or\t%1, %%hm(%a2), %0") |
| 2035 |
|
| 2036 |
(define_insn "setlo" |
| 2037 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2038 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2039 |
(match_operand:DI 2 "symbolic_operand" "")))] |
| 2040 |
"TARGET_CM_MEDANY && !flag_pic" |
| 2041 |
"or\t%1, %%lo(%a2), %0") |
| 2042 |
|
| 2043 |
(define_insn "embmedany_sethi" |
| 2044 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2045 |
(high:DI (unspec:DI [(match_operand:DI 1 "data_segment_operand" "")] |
| 2046 |
UNSPEC_EMB_HISUM)))] |
| 2047 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2048 |
"sethi\t%%hi(%a1), %0") |
| 2049 |
|
| 2050 |
(define_insn "embmedany_losum" |
| 2051 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2052 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2053 |
(match_operand:DI 2 "data_segment_operand" "")))] |
| 2054 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2055 |
"add\t%1, %%lo(%a2), %0") |
| 2056 |
|
| 2057 |
(define_insn "embmedany_brsum" |
| 2058 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2059 |
(unspec:DI [(match_operand:DI 1 "register_operand" "r")] |
| 2060 |
UNSPEC_EMB_HISUM))] |
| 2061 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2062 |
"add\t%1, %_, %0") |
| 2063 |
|
| 2064 |
(define_insn "embmedany_textuhi" |
| 2065 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2066 |
(high:DI (unspec:DI [(match_operand:DI 1 "text_segment_operand" "")] |
| 2067 |
UNSPEC_EMB_TEXTUHI)))] |
| 2068 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2069 |
"sethi\t%%uhi(%a1), %0") |
| 2070 |
|
| 2071 |
(define_insn "embmedany_texthi" |
| 2072 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2073 |
(high:DI (unspec:DI [(match_operand:DI 1 "text_segment_operand" "")] |
| 2074 |
UNSPEC_EMB_TEXTHI)))] |
| 2075 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2076 |
"sethi\t%%hi(%a1), %0") |
| 2077 |
|
| 2078 |
(define_insn "embmedany_textulo" |
| 2079 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2080 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2081 |
(unspec:DI [(match_operand:DI 2 "text_segment_operand" "")] |
| 2082 |
UNSPEC_EMB_TEXTULO)))] |
| 2083 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2084 |
"or\t%1, %%ulo(%a2), %0") |
| 2085 |
|
| 2086 |
(define_insn "embmedany_textlo" |
| 2087 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 2088 |
(lo_sum:DI (match_operand:DI 1 "register_operand" "r") |
| 2089 |
(match_operand:DI 2 "text_segment_operand" "")))] |
| 2090 |
"TARGET_CM_EMBMEDANY && !flag_pic" |
| 2091 |
"or\t%1, %%lo(%a2), %0") |
| 2092 |
|
| 2093 |
;; Now some patterns to help reload out a bit. |
| 2094 |
(define_expand "reload_indi" |
| 2095 |
[(parallel [(match_operand:DI 0 "register_operand" "=r") |
| 2096 |
(match_operand:DI 1 "immediate_operand" "") |
| 2097 |
(match_operand:TI 2 "register_operand" "=&r")])] |
| 2098 |
"(TARGET_CM_MEDANY || TARGET_CM_EMBMEDANY) && !flag_pic" |
| 2099 |
{ |
| 2100 |
sparc_emit_set_symbolic_const64 (operands[0], operands[1], operands[2]); |
| 2101 |
DONE; |
| 2102 |
}) |
| 2103 |
|
| 2104 |
(define_expand "reload_outdi" |
| 2105 |
[(parallel [(match_operand:DI 0 "register_operand" "=r") |
| 2106 |
(match_operand:DI 1 "immediate_operand" "") |
| 2107 |
(match_operand:TI 2 "register_operand" "=&r")])] |
| 2108 |
"(TARGET_CM_MEDANY || TARGET_CM_EMBMEDANY) && !flag_pic" |
| 2109 |
{ |
| 2110 |
sparc_emit_set_symbolic_const64 (operands[0], operands[1], operands[2]); |
| 2111 |
DONE; |
| 2112 |
}) |
| 2113 |
|
| 2114 |
;; Split up putting CONSTs and REGs into DI regs when !arch64 |
| 2115 |
(define_split |
| 2116 |
[(set (match_operand:DI 0 "register_operand" "") |
| 2117 |
(match_operand:DI 1 "const_int_operand" ""))] |
| 2118 |
"reload_completed |
| 2119 |
&& TARGET_ARCH32 |
| 2120 |
&& ((GET_CODE (operands[0]) == REG |
| 2121 |
&& SPARC_INT_REG_P (REGNO (operands[0]))) |
| 2122 |
|| (GET_CODE (operands[0]) == SUBREG |
| 2123 |
&& GET_CODE (SUBREG_REG (operands[0])) == REG |
| 2124 |
&& SPARC_INT_REG_P (REGNO (SUBREG_REG (operands[0])))))" |
| 2125 |
[(clobber (const_int 0))] |
| 2126 |
{ |
| 2127 |
HOST_WIDE_INT low = trunc_int_for_mode (INTVAL (operands[1]), SImode); |
| 2128 |
HOST_WIDE_INT high = trunc_int_for_mode (INTVAL (operands[1]) >> 32, SImode); |
| 2129 |
rtx high_part = gen_highpart (SImode, operands[0]); |
| 2130 |
rtx low_part = gen_lowpart (SImode, operands[0]); |
| 2131 |
|
| 2132 |
emit_move_insn_1 (high_part, GEN_INT (high)); |
| 2133 |
|
| 2134 |
/* Slick... but this loses if the constant can be done in one insn. */ |
| 2135 |
if (low == high && !SPARC_SETHI32_P (high) && !SPARC_SIMM13_P (high)) |
| 2136 |
emit_move_insn_1 (low_part, high_part); |
| 2137 |
else |
| 2138 |
emit_move_insn_1 (low_part, GEN_INT (low)); |
| 2139 |
|
| 2140 |
DONE; |
| 2141 |
}) |
| 2142 |
|
| 2143 |
(define_split |
| 2144 |
[(set (match_operand:DI 0 "register_operand" "") |
| 2145 |
(match_operand:DI 1 "register_operand" ""))] |
| 2146 |
"reload_completed |
| 2147 |
&& (!TARGET_V9 |
| 2148 |
|| (TARGET_ARCH32 |
| 2149 |
&& sparc_split_reg_reg_legitimate (operands[0], operands[1])))" |
| 2150 |
[(clobber (const_int 0))] |
| 2151 |
{ |
| 2152 |
sparc_split_reg_reg (operands[0], operands[1], SImode); |
| 2153 |
DONE; |
| 2154 |
}) |
| 2155 |
|
| 2156 |
;; Now handle the cases of memory moves from/to non-even |
| 2157 |
;; DI mode register pairs. |
| 2158 |
(define_split |
| 2159 |
[(set (match_operand:DI 0 "register_operand" "") |
| 2160 |
(match_operand:DI 1 "memory_operand" ""))] |
| 2161 |
"reload_completed |
| 2162 |
&& TARGET_ARCH32 |
| 2163 |
&& sparc_split_reg_mem_legitimate (operands[0], operands[1])" |
| 2164 |
[(clobber (const_int 0))] |
| 2165 |
{ |
| 2166 |
sparc_split_reg_mem (operands[0], operands[1], SImode); |
| 2167 |
DONE; |
| 2168 |
}) |
| 2169 |
|
| 2170 |
(define_split |
| 2171 |
[(set (match_operand:DI 0 "memory_operand" "") |
| 2172 |
(match_operand:DI 1 "register_operand" ""))] |
| 2173 |
"reload_completed |
| 2174 |
&& TARGET_ARCH32 |
| 2175 |
&& sparc_split_reg_mem_legitimate (operands[1], operands[0])" |
| 2176 |
[(clobber (const_int 0))] |
| 2177 |
{ |
| 2178 |
sparc_split_mem_reg (operands[0], operands[1], SImode); |
| 2179 |
DONE; |
| 2180 |
}) |
| 2181 |
|
| 2182 |
(define_split |
| 2183 |
[(set (match_operand:DI 0 "memory_operand" "") |
| 2184 |
(match_operand:DI 1 "const_zero_operand" ""))] |
| 2185 |
"reload_completed |
| 2186 |
&& (!TARGET_V9 |
| 2187 |
|| (TARGET_ARCH32 |
| 2188 |
&& !mem_min_alignment (operands[0], 8))) |
| 2189 |
&& offsettable_memref_p (operands[0])" |
| 2190 |
[(clobber (const_int 0))] |
| 2191 |
{ |
| 2192 |
emit_move_insn_1 (adjust_address (operands[0], SImode, 0), const0_rtx); |
| 2193 |
emit_move_insn_1 (adjust_address (operands[0], SImode, 4), const0_rtx); |
| 2194 |
DONE; |
| 2195 |
}) |
| 2196 |
|
| 2197 |
(define_expand "movti" |
| 2198 |
[(set (match_operand:TI 0 "nonimmediate_operand" "") |
| 2199 |
(match_operand:TI 1 "general_operand" ""))] |
| 2200 |
"TARGET_ARCH64" |
| 2201 |
{ |
| 2202 |
if (sparc_expand_move (TImode, operands)) |
| 2203 |
DONE; |
| 2204 |
}) |
| 2205 |
|
| 2206 |
;; We need to prevent reload from splitting TImode moves, because it |
| 2207 |
;; might decide to overwrite a pointer with the value it points to. |
| 2208 |
;; In that case we have to do the loads in the appropriate order so |
| 2209 |
;; that the pointer is not destroyed too early. |
| 2210 |
|
| 2211 |
(define_insn "*movti_insn_sp64" |
| 2212 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=r , o,?*e,?o,b") |
| 2213 |
(match_operand:TI 1 "input_operand" "roJ,rJ, eo, e,J"))] |
| 2214 |
"TARGET_ARCH64 |
| 2215 |
&& !TARGET_HARD_QUAD |
| 2216 |
&& (register_operand (operands[0], TImode) |
| 2217 |
|| register_or_zero_operand (operands[1], TImode))" |
| 2218 |
"#" |
| 2219 |
[(set_attr "length" "2,2,2,2,2") |
| 2220 |
(set_attr "cpu_feature" "*,*,fpu,fpu,vis")]) |
| 2221 |
|
| 2222 |
(define_insn "*movti_insn_sp64_hq" |
| 2223 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=r , o,?*e,?*e,?m,b") |
| 2224 |
(match_operand:TI 1 "input_operand" "roJ,rJ, e, m, e,J"))] |
| 2225 |
"TARGET_ARCH64 |
| 2226 |
&& TARGET_HARD_QUAD |
| 2227 |
&& (register_operand (operands[0], TImode) |
| 2228 |
|| register_or_zero_operand (operands[1], TImode))" |
| 2229 |
"@ |
| 2230 |
# |
| 2231 |
# |
| 2232 |
fmovq\t%1, %0 |
| 2233 |
ldq\t%1, %0 |
| 2234 |
stq\t%1, %0 |
| 2235 |
#" |
| 2236 |
[(set_attr "type" "*,*,fpmove,fpload,fpstore,*") |
| 2237 |
(set_attr "length" "2,2,*,*,*,2")]) |
| 2238 |
|
| 2239 |
;; Now all the splits to handle multi-insn TI mode moves. |
| 2240 |
(define_split |
| 2241 |
[(set (match_operand:TI 0 "register_operand" "") |
| 2242 |
(match_operand:TI 1 "register_operand" ""))] |
| 2243 |
"reload_completed |
| 2244 |
&& ((TARGET_FPU |
| 2245 |
&& !TARGET_HARD_QUAD) |
| 2246 |
|| (!fp_register_operand (operands[0], TImode) |
| 2247 |
&& !fp_register_operand (operands[1], TImode)))" |
| 2248 |
[(clobber (const_int 0))] |
| 2249 |
{ |
| 2250 |
rtx set_dest = operands[0]; |
| 2251 |
rtx set_src = operands[1]; |
| 2252 |
rtx dest1, dest2; |
| 2253 |
rtx src1, src2; |
| 2254 |
|
| 2255 |
dest1 = gen_highpart (DImode, set_dest); |
| 2256 |
dest2 = gen_lowpart (DImode, set_dest); |
| 2257 |
src1 = gen_highpart (DImode, set_src); |
| 2258 |
src2 = gen_lowpart (DImode, set_src); |
| 2259 |
|
| 2260 |
/* Now emit using the real source and destination we found, swapping |
| 2261 |
the order if we detect overlap. */ |
| 2262 |
if (reg_overlap_mentioned_p (dest1, src2)) |
| 2263 |
{ |
| 2264 |
emit_insn (gen_movdi (dest2, src2)); |
| 2265 |
emit_insn (gen_movdi (dest1, src1)); |
| 2266 |
} |
| 2267 |
else |
| 2268 |
{ |
| 2269 |
emit_insn (gen_movdi (dest1, src1)); |
| 2270 |
emit_insn (gen_movdi (dest2, src2)); |
| 2271 |
} |
| 2272 |
DONE; |
| 2273 |
}) |
| 2274 |
|
| 2275 |
(define_split |
| 2276 |
[(set (match_operand:TI 0 "nonimmediate_operand" "") |
| 2277 |
(match_operand:TI 1 "const_zero_operand" ""))] |
| 2278 |
"reload_completed" |
| 2279 |
[(clobber (const_int 0))] |
| 2280 |
{ |
| 2281 |
rtx set_dest = operands[0]; |
| 2282 |
rtx dest1, dest2; |
| 2283 |
|
| 2284 |
switch (GET_CODE (set_dest)) |
| 2285 |
{ |
| 2286 |
case REG: |
| 2287 |
dest1 = gen_highpart (DImode, set_dest); |
| 2288 |
dest2 = gen_lowpart (DImode, set_dest); |
| 2289 |
break; |
| 2290 |
case MEM: |
| 2291 |
dest1 = adjust_address (set_dest, DImode, 0); |
| 2292 |
dest2 = adjust_address (set_dest, DImode, 8); |
| 2293 |
break; |
| 2294 |
default: |
| 2295 |
gcc_unreachable (); |
| 2296 |
} |
| 2297 |
|
| 2298 |
emit_insn (gen_movdi (dest1, const0_rtx)); |
| 2299 |
emit_insn (gen_movdi (dest2, const0_rtx)); |
| 2300 |
DONE; |
| 2301 |
}) |
| 2302 |
|
| 2303 |
(define_split |
| 2304 |
[(set (match_operand:TI 0 "register_operand" "") |
| 2305 |
(match_operand:TI 1 "memory_operand" ""))] |
| 2306 |
"reload_completed |
| 2307 |
&& offsettable_memref_p (operands[1]) |
| 2308 |
&& (!TARGET_HARD_QUAD |
| 2309 |
|| !fp_register_operand (operands[0], TImode))" |
| 2310 |
[(clobber (const_int 0))] |
| 2311 |
{ |
| 2312 |
rtx word0 = adjust_address (operands[1], DImode, 0); |
| 2313 |
rtx word1 = adjust_address (operands[1], DImode, 8); |
| 2314 |
rtx set_dest, dest1, dest2; |
| 2315 |
|
| 2316 |
set_dest = operands[0]; |
| 2317 |
|
| 2318 |
dest1 = gen_highpart (DImode, set_dest); |
| 2319 |
dest2 = gen_lowpart (DImode, set_dest); |
| 2320 |
|
| 2321 |
/* Now output, ordering such that we don't clobber any registers |
| 2322 |
mentioned in the address. */ |
| 2323 |
if (reg_overlap_mentioned_p (dest1, word1)) |
| 2324 |
|
| 2325 |
{ |
| 2326 |
emit_insn (gen_movdi (dest2, word1)); |
| 2327 |
emit_insn (gen_movdi (dest1, word0)); |
| 2328 |
} |
| 2329 |
else |
| 2330 |
{ |
| 2331 |
emit_insn (gen_movdi (dest1, word0)); |
| 2332 |
emit_insn (gen_movdi (dest2, word1)); |
| 2333 |
} |
| 2334 |
DONE; |
| 2335 |
}) |
| 2336 |
|
| 2337 |
(define_split |
| 2338 |
[(set (match_operand:TI 0 "memory_operand" "") |
| 2339 |
(match_operand:TI 1 "register_operand" ""))] |
| 2340 |
"reload_completed |
| 2341 |
&& offsettable_memref_p (operands[0]) |
| 2342 |
&& (!TARGET_HARD_QUAD |
| 2343 |
|| !fp_register_operand (operands[1], TImode))" |
| 2344 |
[(clobber (const_int 0))] |
| 2345 |
{ |
| 2346 |
rtx set_src = operands[1]; |
| 2347 |
|
| 2348 |
emit_insn (gen_movdi (adjust_address (operands[0], DImode, 0), |
| 2349 |
gen_highpart (DImode, set_src))); |
| 2350 |
emit_insn (gen_movdi (adjust_address (operands[0], DImode, 8), |
| 2351 |
gen_lowpart (DImode, set_src))); |
| 2352 |
DONE; |
| 2353 |
}) |
| 2354 |
|
| 2355 |
|
| 2356 |
;; Floating point move instructions |
| 2357 |
|
| 2358 |
(define_expand "movsf" |
| 2359 |
[(set (match_operand:SF 0 "nonimmediate_operand" "") |
| 2360 |
(match_operand:SF 1 "general_operand" ""))] |
| 2361 |
"" |
| 2362 |
{ |
| 2363 |
if (sparc_expand_move (SFmode, operands)) |
| 2364 |
DONE; |
| 2365 |
}) |
| 2366 |
|
| 2367 |
(define_insn "*movsf_insn" |
| 2368 |
[(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,f, *r,*r,*r,*r, f,f,*r,m, m") |
| 2369 |
(match_operand:SF 1 "input_operand" "G,C,f,*rR, Q, S, f,*r,m, m,f,*rG"))] |
| 2370 |
"(register_operand (operands[0], SFmode) |
| 2371 |
|| register_or_zero_or_all_ones_operand (operands[1], SFmode))" |
| 2372 |
{ |
| 2373 |
if (GET_CODE (operands[1]) == CONST_DOUBLE |
| 2374 |
&& (which_alternative == 3 |
| 2375 |
|| which_alternative == 4 |
| 2376 |
|| which_alternative == 5)) |
| 2377 |
{ |
| 2378 |
long i; |
| 2379 |
|
| 2380 |
REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (operands[1]), i); |
| 2381 |
operands[1] = GEN_INT (i); |
| 2382 |
} |
| 2383 |
|
| 2384 |
switch (which_alternative) |
| 2385 |
{ |
| 2386 |
case 0: |
| 2387 |
return "fzeros\t%0"; |
| 2388 |
case 1: |
| 2389 |
return "fones\t%0"; |
| 2390 |
case 2: |
| 2391 |
return "fmovs\t%1, %0"; |
| 2392 |
case 3: |
| 2393 |
return "mov\t%1, %0"; |
| 2394 |
case 4: |
| 2395 |
return "sethi\t%%hi(%a1), %0"; |
| 2396 |
case 5: |
| 2397 |
return "#"; |
| 2398 |
case 6: |
| 2399 |
return "movstouw\t%1, %0"; |
| 2400 |
case 7: |
| 2401 |
return "movwtos\t%1, %0"; |
| 2402 |
case 8: |
| 2403 |
case 9: |
| 2404 |
return "ld\t%1, %0"; |
| 2405 |
case 10: |
| 2406 |
case 11: |
| 2407 |
return "st\t%r1, %0"; |
| 2408 |
default: |
| 2409 |
gcc_unreachable (); |
| 2410 |
} |
| 2411 |
} |
| 2412 |
[(set_attr "type" "visl,visl,fpmove,*,*,*,vismv,vismv,fpload,load,fpstore,store") |
| 2413 |
(set_attr "subtype" "single,single,*,*,*,*,movstouw,single,*,regular,*,*") |
| 2414 |
(set_attr "cpu_feature" "vis,vis,fpu,*,*,*,vis3,vis3,fpu,*,fpu,*")]) |
| 2415 |
|
| 2416 |
;; The following 3 patterns build SFmode constants in integer registers. |
| 2417 |
|
| 2418 |
(define_insn "*movsf_lo_sum" |
| 2419 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2420 |
(lo_sum:SF (match_operand:SF 1 "register_operand" "r") |
| 2421 |
(match_operand:SF 2 "fp_const_high_losum_operand" "S")))] |
| 2422 |
"" |
| 2423 |
{ |
| 2424 |
long i; |
| 2425 |
|
| 2426 |
REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (operands[2]), i); |
| 2427 |
operands[2] = GEN_INT (i); |
| 2428 |
return "or\t%1, %%lo(%a2), %0"; |
| 2429 |
}) |
| 2430 |
|
| 2431 |
(define_insn "*movsf_high" |
| 2432 |
[(set (match_operand:SF 0 "register_operand" "=r") |
| 2433 |
(high:SF (match_operand:SF 1 "fp_const_high_losum_operand" "S")))] |
| 2434 |
"" |
| 2435 |
{ |
| 2436 |
long i; |
| 2437 |
|
| 2438 |
REAL_VALUE_TO_TARGET_SINGLE (*CONST_DOUBLE_REAL_VALUE (operands[1]), i); |
| 2439 |
operands[1] = GEN_INT (i); |
| 2440 |
return "sethi\t%%hi(%1), %0"; |
| 2441 |
}) |
| 2442 |
|
| 2443 |
(define_split |
| 2444 |
[(set (match_operand:SF 0 "register_operand" "") |
| 2445 |
(match_operand:SF 1 "fp_const_high_losum_operand" ""))] |
| 2446 |
"REG_P (operands[0]) && SPARC_INT_REG_P (REGNO (operands[0]))" |
| 2447 |
[(set (match_dup 0) (high:SF (match_dup 1))) |
| 2448 |
(set (match_dup 0) (lo_sum:SF (match_dup 0) (match_dup 1)))]) |
| 2449 |
|
| 2450 |
(define_expand "movdf" |
| 2451 |
[(set (match_operand:DF 0 "nonimmediate_operand" "") |
| 2452 |
(match_operand:DF 1 "general_operand" ""))] |
| 2453 |
"" |
| 2454 |
{ |
| 2455 |
if (sparc_expand_move (DFmode, operands)) |
| 2456 |
DONE; |
| 2457 |
}) |
| 2458 |
|
| 2459 |
(define_insn "*movdf_insn_sp32" |
| 2460 |
[(set (match_operand:DF 0 "nonimmediate_operand" |
| 2461 |
"=T,o,b,b,e,e,*r, f, e,T, f,o, *r,*r, o") |
| 2462 |
(match_operand:DF 1 "input_operand" |
| 2463 |
" G,G,G,C,e,e, f,*r,T#F,e,o#F,f,*rF, o,*r"))] |
| 2464 |
"TARGET_ARCH32 |
| 2465 |
&& (register_operand (operands[0], DFmode) |
| 2466 |
|| register_or_zero_or_all_ones_operand (operands[1], DFmode))" |
| 2467 |
"@ |
| 2468 |
stx\t%r1, %0 |
| 2469 |
# |
| 2470 |
fzero\t%0 |
| 2471 |
fone\t%0 |
| 2472 |
fmovd\t%1, %0 |
| 2473 |
# |
| 2474 |
# |
| 2475 |
# |
| 2476 |
ldd\t%1, %0 |
| 2477 |
std\t%1, %0 |
| 2478 |
# |
| 2479 |
# |
| 2480 |
# |
| 2481 |
ldd\t%1, %0 |
| 2482 |
std\t%1, %0" |
| 2483 |
[(set_attr "type" "store,*,visl,visl,fpmove,*,*,*,fpload,fpstore,*,*,*,load,store") |
| 2484 |
(set_attr "subtype" "*,*,double,double,*,*,*,*,*,*,*,*,*,regular,*") |
| 2485 |
(set_attr "length" "*,2,*,*,*,2,2,2,*,*,2,2,2,*,*") |
| 2486 |
(set_attr "fptype" "*,*,double,double,double,*,*,*,*,*,*,*,*,*,*") |
| 2487 |
(set_attr "cpu_feature" "v9,*,vis,vis,v9,fpunotv9,vis3,vis3,fpu,fpu,fpu,fpu,*,*,*")]) |
| 2488 |
|
| 2489 |
(define_insn "*movdf_insn_sp64" |
| 2490 |
[(set (match_operand:DF 0 "nonimmediate_operand" "=b,b,e,*r, e, e,m, *r,*r, m,*r") |
| 2491 |
(match_operand:DF 1 "input_operand" "G,C,e, e,*r,m#F,e,*rG, m,*rG, F"))] |
| 2492 |
"TARGET_ARCH64 |
| 2493 |
&& (register_operand (operands[0], DFmode) |
| 2494 |
|| register_or_zero_or_all_ones_operand (operands[1], DFmode))" |
| 2495 |
"@ |
| 2496 |
fzero\t%0 |
| 2497 |
fone\t%0 |
| 2498 |
fmovd\t%1, %0 |
| 2499 |
movdtox\t%1, %0 |
| 2500 |
movxtod\t%1, %0 |
| 2501 |
ldd\t%1, %0 |
| 2502 |
std\t%1, %0 |
| 2503 |
mov\t%r1, %0 |
| 2504 |
ldx\t%1, %0 |
| 2505 |
stx\t%r1, %0 |
| 2506 |
#" |
| 2507 |
[(set_attr "type" "visl,visl,fpmove,vismv,vismv,load,store,*,load,store,*") |
| 2508 |
(set_attr "subtype" "double,double,*,movdtox,movxtod,regular,*,*,regular,*,*") |
| 2509 |
(set_attr "length" "*,*,*,*,*,*,*,*,*,*,2") |
| 2510 |
(set_attr "fptype" "double,double,double,double,double,*,*,*,*,*,*") |
| 2511 |
(set_attr "cpu_feature" "vis,vis,fpu,vis3,vis3,fpu,fpu,*,*,*,*")]) |
| 2512 |
|
| 2513 |
;; This pattern builds DFmode constants in integer registers. |
| 2514 |
(define_split |
| 2515 |
[(set (match_operand:DF 0 "register_operand" "") |
| 2516 |
(match_operand:DF 1 "const_double_operand" ""))] |
| 2517 |
"reload_completed |
| 2518 |
&& REG_P (operands[0]) |
| 2519 |
&& SPARC_INT_REG_P (REGNO (operands[0])) |
| 2520 |
&& !const_zero_operand (operands[1], GET_MODE (operands[0]))" |
| 2521 |
[(clobber (const_int 0))] |
| 2522 |
{ |
| 2523 |
operands[0] = gen_raw_REG (DImode, REGNO (operands[0])); |
| 2524 |
|
| 2525 |
if (TARGET_ARCH64) |
| 2526 |
{ |
| 2527 |
rtx tem = simplify_subreg (DImode, operands[1], DFmode, 0); |
| 2528 |
emit_insn (gen_movdi (operands[0], tem)); |
| 2529 |
} |
| 2530 |
else |
| 2531 |
{ |
| 2532 |
rtx hi = simplify_subreg (SImode, operands[1], DFmode, 0); |
| 2533 |
rtx lo = simplify_subreg (SImode, operands[1], DFmode, 4); |
| 2534 |
rtx high_part = gen_highpart (SImode, operands[0]); |
| 2535 |
rtx low_part = gen_lowpart (SImode, operands[0]); |
| 2536 |
|
| 2537 |
gcc_assert (GET_CODE (hi) == CONST_INT); |
| 2538 |
gcc_assert (GET_CODE (lo) == CONST_INT); |
| 2539 |
|
| 2540 |
emit_move_insn_1 (high_part, hi); |
| 2541 |
|
| 2542 |
/* Slick... but this loses if the constant can be done in one insn. */ |
| 2543 |
if (lo == hi |
| 2544 |
&& !SPARC_SETHI32_P (INTVAL (hi)) |
| 2545 |
&& !SPARC_SIMM13_P (INTVAL (hi))) |
| 2546 |
emit_move_insn_1 (low_part, high_part); |
| 2547 |
else |
| 2548 |
emit_move_insn_1 (low_part, lo); |
| 2549 |
} |
| 2550 |
DONE; |
| 2551 |
}) |
| 2552 |
|
| 2553 |
;; Ok, now the splits to handle all the multi insn and |
| 2554 |
;; mis-aligned memory address cases. |
| 2555 |
;; In these splits please take note that we must be |
| 2556 |
;; careful when V9 but not ARCH64 because the integer |
| 2557 |
;; register DFmode cases must be handled. |
| 2558 |
(define_split |
| 2559 |
[(set (match_operand:DF 0 "register_operand" "") |
| 2560 |
(match_operand:DF 1 "const_zero_operand" ""))] |
| 2561 |
"reload_completed |
| 2562 |
&& TARGET_ARCH32 |
| 2563 |
&& ((GET_CODE (operands[0]) == REG |
| 2564 |
&& SPARC_INT_REG_P (REGNO (operands[0]))) |
| 2565 |
|| (GET_CODE (operands[0]) == SUBREG |
| 2566 |
&& GET_CODE (SUBREG_REG (operands[0])) == REG |
| 2567 |
&& SPARC_INT_REG_P (REGNO (SUBREG_REG (operands[0])))))" |
| 2568 |
[(clobber (const_int 0))] |
| 2569 |
{ |
| 2570 |
emit_move_insn_1 (gen_highpart (SFmode, operands[0]), CONST0_RTX (SFmode)); |
| 2571 |
emit_move_insn_1 (gen_lowpart (SFmode, operands[0]), CONST0_RTX (SFmode)); |
| 2572 |
DONE; |
| 2573 |
}) |
| 2574 |
|
| 2575 |
(define_split |
| 2576 |
[(set (match_operand:DF 0 "register_operand" "") |
| 2577 |
(match_operand:DF 1 "register_operand" ""))] |
| 2578 |
"reload_completed |
| 2579 |
&& (!TARGET_V9 |
| 2580 |
|| (TARGET_ARCH32 |
| 2581 |
&& sparc_split_reg_reg_legitimate (operands[0], operands[1])))" |
| 2582 |
[(clobber (const_int 0))] |
| 2583 |
{ |
| 2584 |
sparc_split_reg_reg (operands[0], operands[1], SFmode); |
| 2585 |
DONE; |
| 2586 |
}) |
| 2587 |
|
| 2588 |
(define_split |
| 2589 |
[(set (match_operand:DF 0 "register_operand" "") |
| 2590 |
(match_operand:DF 1 "memory_operand" ""))] |
| 2591 |
"reload_completed |
| 2592 |
&& TARGET_ARCH32 |
| 2593 |
&& sparc_split_reg_mem_legitimate (operands[0], operands[1])" |
| 2594 |
[(clobber (const_int 0))] |
| 2595 |
{ |
| 2596 |
sparc_split_reg_mem (operands[0], operands[1], SFmode); |
| 2597 |
DONE; |
| 2598 |
}) |
| 2599 |
|
| 2600 |
(define_split |
| 2601 |
[(set (match_operand:DF 0 "memory_operand" "") |
| 2602 |
(match_operand:DF 1 "register_operand" ""))] |
| 2603 |
"reload_completed |
| 2604 |
&& TARGET_ARCH32 |
| 2605 |
&& sparc_split_reg_mem_legitimate (operands[1], operands[0])" |
| 2606 |
[(clobber (const_int 0))] |
| 2607 |
{ |
| 2608 |
sparc_split_mem_reg (operands[0], operands[1], SFmode); |
| 2609 |
DONE; |
| 2610 |
}) |
| 2611 |
|
| 2612 |
(define_split |
| 2613 |
[(set (match_operand:DF 0 "memory_operand" "") |
| 2614 |
(match_operand:DF 1 "const_zero_operand" ""))] |
| 2615 |
"reload_completed |
| 2616 |
&& (!TARGET_V9 |
| 2617 |
|| (TARGET_ARCH32 |
| 2618 |
&& !mem_min_alignment (operands[0], 8))) |
| 2619 |
&& offsettable_memref_p (operands[0])" |
| 2620 |
[(clobber (const_int 0))] |
| 2621 |
{ |
| 2622 |
emit_move_insn_1 (adjust_address (operands[0], SFmode, 0), CONST0_RTX (SFmode)); |
| 2623 |
emit_move_insn_1 (adjust_address (operands[0], SFmode, 4), CONST0_RTX (SFmode)); |
| 2624 |
DONE; |
| 2625 |
}) |
| 2626 |
|
| 2627 |
(define_expand "movtf" |
| 2628 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 2629 |
(match_operand:TF 1 "general_operand" ""))] |
| 2630 |
"" |
| 2631 |
{ |
| 2632 |
if (sparc_expand_move (TFmode, operands)) |
| 2633 |
DONE; |
| 2634 |
}) |
| 2635 |
|
| 2636 |
(define_insn "*movtf_insn_sp32" |
| 2637 |
[(set (match_operand:TF 0 "nonimmediate_operand" "=b, e,o, o, r") |
| 2638 |
(match_operand:TF 1 "input_operand" " G,oe,e,rG,roG"))] |
| 2639 |
"TARGET_ARCH32 |
| 2640 |
&& (register_operand (operands[0], TFmode) |
| 2641 |
|| register_or_zero_operand (operands[1], TFmode))" |
| 2642 |
"#" |
| 2643 |
[(set_attr "length" "4,4,4,4,4") |
| 2644 |
(set_attr "cpu_feature" "fpu,fpu,fpu,*,*")]) |
| 2645 |
|
| 2646 |
(define_insn "*movtf_insn_sp64" |
| 2647 |
[(set (match_operand:TF 0 "nonimmediate_operand" "=b, e,o, o, r") |
| 2648 |
(match_operand:TF 1 "input_operand" "G,oe,e,rG,roG"))] |
| 2649 |
"TARGET_ARCH64 |
| 2650 |
&& !TARGET_HARD_QUAD |
| 2651 |
&& (register_operand (operands[0], TFmode) |
| 2652 |
|| register_or_zero_operand (operands[1], TFmode))" |
| 2653 |
"#" |
| 2654 |
[(set_attr "length" "2,2,2,2,2") |
| 2655 |
(set_attr "cpu_feature" "fpu,fpu,fpu,*,*")]) |
| 2656 |
|
| 2657 |
(define_insn "*movtf_insn_sp64_hq" |
| 2658 |
[(set (match_operand:TF 0 "nonimmediate_operand" "=b,e,e,m, o, r") |
| 2659 |
(match_operand:TF 1 "input_operand" "G,e,m,e,rG,roG"))] |
| 2660 |
"TARGET_ARCH64 |
| 2661 |
&& TARGET_HARD_QUAD |
| 2662 |
&& (register_operand (operands[0], TFmode) |
| 2663 |
|| register_or_zero_operand (operands[1], TFmode))" |
| 2664 |
"@ |
| 2665 |
# |
| 2666 |
fmovq\t%1, %0 |
| 2667 |
ldq\t%1, %0 |
| 2668 |
stq\t%1, %0 |
| 2669 |
# |
| 2670 |
#" |
| 2671 |
[(set_attr "type" "*,fpmove,fpload,fpstore,*,*") |
| 2672 |
(set_attr "length" "2,*,*,*,2,2")]) |
| 2673 |
|
| 2674 |
;; Now all the splits to handle multi-insn TF mode moves. |
| 2675 |
(define_split |
| 2676 |
[(set (match_operand:TF 0 "register_operand" "") |
| 2677 |
(match_operand:TF 1 "register_operand" ""))] |
| 2678 |
"reload_completed |
| 2679 |
&& (TARGET_ARCH32 |
| 2680 |
|| (TARGET_FPU |
| 2681 |
&& !TARGET_HARD_QUAD) |
| 2682 |
|| (!fp_register_operand (operands[0], TFmode) |
| 2683 |
&& !fp_register_operand (operands[1], TFmode)))" |
| 2684 |
[(clobber (const_int 0))] |
| 2685 |
{ |
| 2686 |
rtx set_dest = operands[0]; |
| 2687 |
rtx set_src = operands[1]; |
| 2688 |
rtx dest1, dest2; |
| 2689 |
rtx src1, src2; |
| 2690 |
|
| 2691 |
dest1 = gen_df_reg (set_dest, 0); |
| 2692 |
dest2 = gen_df_reg (set_dest, 1); |
| 2693 |
src1 = gen_df_reg (set_src, 0); |
| 2694 |
src2 = gen_df_reg (set_src, 1); |
| 2695 |
|
| 2696 |
/* Now emit using the real source and destination we found, swapping |
| 2697 |
the order if we detect overlap. */ |
| 2698 |
if (reg_overlap_mentioned_p (dest1, src2)) |
| 2699 |
{ |
| 2700 |
emit_insn (gen_movdf (dest2, src2)); |
| 2701 |
emit_insn (gen_movdf (dest1, src1)); |
| 2702 |
} |
| 2703 |
else |
| 2704 |
{ |
| 2705 |
emit_insn (gen_movdf (dest1, src1)); |
| 2706 |
emit_insn (gen_movdf (dest2, src2)); |
| 2707 |
} |
| 2708 |
DONE; |
| 2709 |
}) |
| 2710 |
|
| 2711 |
(define_split |
| 2712 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 2713 |
(match_operand:TF 1 "const_zero_operand" ""))] |
| 2714 |
"reload_completed" |
| 2715 |
[(clobber (const_int 0))] |
| 2716 |
{ |
| 2717 |
rtx set_dest = operands[0]; |
| 2718 |
rtx dest1, dest2; |
| 2719 |
|
| 2720 |
switch (GET_CODE (set_dest)) |
| 2721 |
{ |
| 2722 |
case REG: |
| 2723 |
dest1 = gen_df_reg (set_dest, 0); |
| 2724 |
dest2 = gen_df_reg (set_dest, 1); |
| 2725 |
break; |
| 2726 |
case MEM: |
| 2727 |
dest1 = adjust_address (set_dest, DFmode, 0); |
| 2728 |
dest2 = adjust_address (set_dest, DFmode, 8); |
| 2729 |
break; |
| 2730 |
default: |
| 2731 |
gcc_unreachable (); |
| 2732 |
} |
| 2733 |
|
| 2734 |
emit_insn (gen_movdf (dest1, CONST0_RTX (DFmode))); |
| 2735 |
emit_insn (gen_movdf (dest2, CONST0_RTX (DFmode))); |
| 2736 |
DONE; |
| 2737 |
}) |
| 2738 |
|
| 2739 |
(define_split |
| 2740 |
[(set (match_operand:TF 0 "register_operand" "") |
| 2741 |
(match_operand:TF 1 "memory_operand" ""))] |
| 2742 |
"(reload_completed |
| 2743 |
&& offsettable_memref_p (operands[1]) |
| 2744 |
&& (TARGET_ARCH32 |
| 2745 |
|| !TARGET_HARD_QUAD |
| 2746 |
|| !fp_register_operand (operands[0], TFmode)))" |
| 2747 |
[(clobber (const_int 0))] |
| 2748 |
{ |
| 2749 |
rtx word0 = adjust_address (operands[1], DFmode, 0); |
| 2750 |
rtx word1 = adjust_address (operands[1], DFmode, 8); |
| 2751 |
rtx set_dest, dest1, dest2; |
| 2752 |
|
| 2753 |
set_dest = operands[0]; |
| 2754 |
|
| 2755 |
dest1 = gen_df_reg (set_dest, 0); |
| 2756 |
dest2 = gen_df_reg (set_dest, 1); |
| 2757 |
|
| 2758 |
/* Now output, ordering such that we don't clobber any registers |
| 2759 |
mentioned in the address. */ |
| 2760 |
if (reg_overlap_mentioned_p (dest1, word1)) |
| 2761 |
|
| 2762 |
{ |
| 2763 |
emit_insn (gen_movdf (dest2, word1)); |
| 2764 |
emit_insn (gen_movdf (dest1, word0)); |
| 2765 |
} |
| 2766 |
else |
| 2767 |
{ |
| 2768 |
emit_insn (gen_movdf (dest1, word0)); |
| 2769 |
emit_insn (gen_movdf (dest2, word1)); |
| 2770 |
} |
| 2771 |
DONE; |
| 2772 |
}) |
| 2773 |
|
| 2774 |
(define_split |
| 2775 |
[(set (match_operand:TF 0 "memory_operand" "") |
| 2776 |
(match_operand:TF 1 "register_operand" ""))] |
| 2777 |
"(reload_completed |
| 2778 |
&& offsettable_memref_p (operands[0]) |
| 2779 |
&& (TARGET_ARCH32 |
| 2780 |
|| !TARGET_HARD_QUAD |
| 2781 |
|| !fp_register_operand (operands[1], TFmode)))" |
| 2782 |
[(clobber (const_int 0))] |
| 2783 |
{ |
| 2784 |
rtx set_src = operands[1]; |
| 2785 |
|
| 2786 |
emit_insn (gen_movdf (adjust_address (operands[0], DFmode, 0), |
| 2787 |
gen_df_reg (set_src, 0))); |
| 2788 |
emit_insn (gen_movdf (adjust_address (operands[0], DFmode, 8), |
| 2789 |
gen_df_reg (set_src, 1))); |
| 2790 |
DONE; |
| 2791 |
}) |
| 2792 |
|
| 2793 |
|
| 2794 |
;; SPARC-V9 conditional move instructions |
| 2795 |
|
| 2796 |
;; We can handle larger constants here for some flavors, but for now we keep |
| 2797 |
;; it simple and only allow those constants supported by all flavors. |
| 2798 |
;; Note that emit_conditional_move canonicalizes operands 2,3 so that operand |
| 2799 |
;; 3 contains the constant if one is present, but we handle either for |
| 2800 |
;; generality (sparc.cc puts a constant in operand 2). |
| 2801 |
;; |
| 2802 |
;; Our instruction patterns, on the other hand, canonicalize such that |
| 2803 |
;; operand 3 must be the set destination. |
| 2804 |
|
| 2805 |
(define_expand "mov<I:mode>cc" |
| 2806 |
[(set (match_operand:I 0 "register_operand" "") |
| 2807 |
(if_then_else:I (match_operand 1 "comparison_operator" "") |
| 2808 |
(match_operand:I 2 "arith10_operand" "") |
| 2809 |
(match_operand:I 3 "arith10_operand" "")))] |
| 2810 |
"TARGET_V9 && !(<I:MODE>mode == DImode && TARGET_ARCH32)" |
| 2811 |
{ |
| 2812 |
if (!sparc_expand_conditional_move (<I:MODE>mode, operands)) |
| 2813 |
FAIL; |
| 2814 |
DONE; |
| 2815 |
}) |
| 2816 |
|
| 2817 |
(define_expand "mov<F:mode>cc" |
| 2818 |
[(set (match_operand:F 0 "register_operand" "") |
| 2819 |
(if_then_else:F (match_operand 1 "comparison_operator" "") |
| 2820 |
(match_operand:F 2 "register_operand" "") |
| 2821 |
(match_operand:F 3 "register_operand" "")))] |
| 2822 |
"TARGET_V9 && TARGET_FPU" |
| 2823 |
{ |
| 2824 |
if (!sparc_expand_conditional_move (<F:MODE>mode, operands)) |
| 2825 |
FAIL; |
| 2826 |
DONE; |
| 2827 |
}) |
| 2828 |
|
| 2829 |
(define_insn "*mov<I:mode>_cc_v9" |
| 2830 |
[(set (match_operand:I 0 "register_operand" "=r") |
| 2831 |
(if_then_else:I (match_operator 1 "icc_or_fcc_comparison_operator" |
| 2832 |
[(match_operand 2 "icc_or_fcc_register_operand" "X") |
| 2833 |
(const_int 0)]) |
| 2834 |
(match_operand:I 3 "arith11_operand" "rL") |
| 2835 |
(match_operand:I 4 "register_operand" "0")))] |
| 2836 |
"TARGET_V9 && !(<I:MODE>mode == DImode && TARGET_ARCH32)" |
| 2837 |
"mov%C1\t%x2, %3, %0" |
| 2838 |
[(set_attr "type" "cmove")]) |
| 2839 |
|
| 2840 |
(define_insn "*mov<I:mode>_cc_reg_sp64" |
| 2841 |
[(set (match_operand:I 0 "register_operand" "=r") |
| 2842 |
(if_then_else:I (match_operator 1 "v9_register_comparison_operator" |
| 2843 |
[(match_operand:DI 2 "register_operand" "r") |
| 2844 |
(const_int 0)]) |
| 2845 |
(match_operand:I 3 "arith10_operand" "rM") |
| 2846 |
(match_operand:I 4 "register_operand" "0")))] |
| 2847 |
"TARGET_ARCH64" |
| 2848 |
"movr%D1\t%2, %r3, %0" |
| 2849 |
[(set_attr "type" "cmove")]) |
| 2850 |
|
| 2851 |
(define_insn "*movsf_cc_v9" |
| 2852 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 2853 |
(if_then_else:SF (match_operator 1 "icc_or_fcc_comparison_operator" |
| 2854 |
[(match_operand 2 "icc_or_fcc_register_operand" "X") |
| 2855 |
(const_int 0)]) |
| 2856 |
(match_operand:SF 3 "register_operand" "f") |
| 2857 |
(match_operand:SF 4 "register_operand" "0")))] |
| 2858 |
"TARGET_V9 && TARGET_FPU" |
| 2859 |
"fmovs%C1\t%x2, %3, %0" |
| 2860 |
[(set_attr "type" "fpcmove")]) |
| 2861 |
|
| 2862 |
(define_insn "*movsf_cc_reg_sp64" |
| 2863 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 2864 |
(if_then_else:SF (match_operator 1 "v9_register_comparison_operator" |
| 2865 |
[(match_operand:DI 2 "register_operand" "r") |
| 2866 |
(const_int 0)]) |
| 2867 |
(match_operand:SF 3 "register_operand" "f") |
| 2868 |
(match_operand:SF 4 "register_operand" "0")))] |
| 2869 |
"TARGET_ARCH64 && TARGET_FPU" |
| 2870 |
"fmovrs%D1\t%2, %3, %0" |
| 2871 |
[(set_attr "type" "fpcrmove")]) |
| 2872 |
|
| 2873 |
;; Named because invoked by movtf_cc_v9 |
| 2874 |
(define_insn "movdf_cc_v9" |
| 2875 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 2876 |
(if_then_else:DF (match_operator 1 "icc_or_fcc_comparison_operator" |
| 2877 |
[(match_operand 2 "icc_or_fcc_register_operand" "X") |
| 2878 |
(const_int 0)]) |
| 2879 |
(match_operand:DF 3 "register_operand" "e") |
| 2880 |
(match_operand:DF 4 "register_operand" "0")))] |
| 2881 |
"TARGET_V9 && TARGET_FPU" |
| 2882 |
"fmovd%C1\t%x2, %3, %0" |
| 2883 |
[(set_attr "type" "fpcmove") |
| 2884 |
(set_attr "fptype" "double")]) |
| 2885 |
|
| 2886 |
;; Named because invoked by movtf_cc_reg_sp64 |
| 2887 |
(define_insn "movdf_cc_reg_sp64" |
| 2888 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 2889 |
(if_then_else:DF (match_operator 1 "v9_register_comparison_operator" |
| 2890 |
[(match_operand:DI 2 "register_operand" "r") |
| 2891 |
(const_int 0)]) |
| 2892 |
(match_operand:DF 3 "register_operand" "e") |
| 2893 |
(match_operand:DF 4 "register_operand" "0")))] |
| 2894 |
"TARGET_ARCH64 && TARGET_FPU" |
| 2895 |
"fmovrd%D1\t%2, %3, %0" |
| 2896 |
[(set_attr "type" "fpcrmove") |
| 2897 |
(set_attr "fptype" "double")]) |
| 2898 |
|
| 2899 |
(define_insn "*movtf_cc_hq_v9" |
| 2900 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 2901 |
(if_then_else:TF (match_operator 1 "icc_or_fcc_comparison_operator" |
| 2902 |
[(match_operand 2 "icc_or_fcc_register_operand" "X") |
| 2903 |
(const_int 0)]) |
| 2904 |
(match_operand:TF 3 "register_operand" "e") |
| 2905 |
(match_operand:TF 4 "register_operand" "0")))] |
| 2906 |
"TARGET_V9 && TARGET_FPU && TARGET_HARD_QUAD" |
| 2907 |
"fmovq%C1\t%x2, %3, %0" |
| 2908 |
[(set_attr "type" "fpcmove")]) |
| 2909 |
|
| 2910 |
(define_insn "*movtf_cc_reg_hq_sp64" |
| 2911 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 2912 |
(if_then_else:TF (match_operator 1 "v9_register_comparison_operator" |
| 2913 |
[(match_operand:DI 2 "register_operand" "r") |
| 2914 |
(const_int 0)]) |
| 2915 |
(match_operand:TF 3 "register_operand" "e") |
| 2916 |
(match_operand:TF 4 "register_operand" "0")))] |
| 2917 |
"TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD" |
| 2918 |
"fmovrq%D1\t%2, %3, %0" |
| 2919 |
[(set_attr "type" "fpcrmove")]) |
| 2920 |
|
| 2921 |
(define_insn_and_split "*movtf_cc_v9" |
| 2922 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 2923 |
(if_then_else:TF (match_operator 1 "icc_or_fcc_comparison_operator" |
| 2924 |
[(match_operand 2 "icc_or_fcc_register_operand" "X") |
| 2925 |
(const_int 0)]) |
| 2926 |
(match_operand:TF 3 "register_operand" "e") |
| 2927 |
(match_operand:TF 4 "register_operand" "0")))] |
| 2928 |
"TARGET_V9 && TARGET_FPU && !TARGET_HARD_QUAD" |
| 2929 |
"#" |
| 2930 |
"&& reload_completed" |
| 2931 |
[(clobber (const_int 0))] |
| 2932 |
{ |
| 2933 |
rtx set_dest = operands[0]; |
| 2934 |
rtx set_srca = operands[3]; |
| 2935 |
rtx dest1, dest2; |
| 2936 |
rtx srca1, srca2; |
| 2937 |
|
| 2938 |
dest1 = gen_df_reg (set_dest, 0); |
| 2939 |
dest2 = gen_df_reg (set_dest, 1); |
| 2940 |
srca1 = gen_df_reg (set_srca, 0); |
| 2941 |
srca2 = gen_df_reg (set_srca, 1); |
| 2942 |
|
| 2943 |
if (reg_overlap_mentioned_p (dest1, srca2)) |
| 2944 |
{ |
| 2945 |
emit_insn (gen_movdf_cc_v9 (dest2, operands[1], operands[2], |
| 2946 |
srca2, dest2)); |
| 2947 |
emit_insn (gen_movdf_cc_v9 (dest1, operands[1], operands[2], |
| 2948 |
srca1, dest1)); |
| 2949 |
} |
| 2950 |
else |
| 2951 |
{ |
| 2952 |
emit_insn (gen_movdf_cc_v9 (dest1, operands[1], operands[2], |
| 2953 |
srca1, dest1)); |
| 2954 |
emit_insn (gen_movdf_cc_v9 (dest2, operands[1], operands[2], |
| 2955 |
srca2, dest2)); |
| 2956 |
} |
| 2957 |
DONE; |
| 2958 |
} |
| 2959 |
[(set_attr "length" "2")]) |
| 2960 |
|
| 2961 |
(define_insn_and_split "*movtf_cc_reg_sp64" |
| 2962 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 2963 |
(if_then_else:TF (match_operator 1 "v9_register_comparison_operator" |
| 2964 |
[(match_operand:DI 2 "register_operand" "r") |
| 2965 |
(const_int 0)]) |
| 2966 |
(match_operand:TF 3 "register_operand" "e") |
| 2967 |
(match_operand:TF 4 "register_operand" "0")))] |
| 2968 |
"TARGET_ARCH64 && TARGET_FPU && !TARGET_HARD_QUAD" |
| 2969 |
"#" |
| 2970 |
"&& reload_completed" |
| 2971 |
[(clobber (const_int 0))] |
| 2972 |
{ |
| 2973 |
rtx set_dest = operands[0]; |
| 2974 |
rtx set_srca = operands[3]; |
| 2975 |
rtx dest1, dest2; |
| 2976 |
rtx srca1, srca2; |
| 2977 |
|
| 2978 |
dest1 = gen_df_reg (set_dest, 0); |
| 2979 |
dest2 = gen_df_reg (set_dest, 1); |
| 2980 |
srca1 = gen_df_reg (set_srca, 0); |
| 2981 |
srca2 = gen_df_reg (set_srca, 1); |
| 2982 |
|
| 2983 |
if (reg_overlap_mentioned_p (dest1, srca2)) |
| 2984 |
{ |
| 2985 |
emit_insn (gen_movdf_cc_reg_sp64 (dest2, operands[1], operands[2], |
| 2986 |
srca2, dest2)); |
| 2987 |
emit_insn (gen_movdf_cc_reg_sp64 (dest1, operands[1], operands[2], |
| 2988 |
srca1, dest1)); |
| 2989 |
} |
| 2990 |
else |
| 2991 |
{ |
| 2992 |
emit_insn (gen_movdf_cc_reg_sp64 (dest1, operands[1], operands[2], |
| 2993 |
srca1, dest1)); |
| 2994 |
emit_insn (gen_movdf_cc_reg_sp64 (dest2, operands[1], operands[2], |
| 2995 |
srca2, dest2)); |
| 2996 |
} |
| 2997 |
DONE; |
| 2998 |
} |
| 2999 |
[(set_attr "length" "2")]) |
| 3000 |
|
| 3001 |
|
| 3002 |
;; Zero-extension instructions |
| 3003 |
|
| 3004 |
;; These patterns originally accepted general_operands, however, slightly |
| 3005 |
;; better code is generated by only accepting register_operands, and then |
| 3006 |
;; letting combine generate the ldu[hb] insns. |
| 3007 |
|
| 3008 |
(define_expand "zero_extendhisi2" |
| 3009 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3010 |
(zero_extend:SI (match_operand:HI 1 "register_operand" "")))] |
| 3011 |
"" |
| 3012 |
{ |
| 3013 |
rtx temp = gen_reg_rtx (SImode); |
| 3014 |
rtx shift_16 = GEN_INT (16); |
| 3015 |
int op1_subbyte = 0; |
| 3016 |
|
| 3017 |
if (GET_CODE (operand1) == SUBREG) |
| 3018 |
{ |
| 3019 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3020 |
op1_subbyte /= GET_MODE_SIZE (SImode); |
| 3021 |
op1_subbyte *= GET_MODE_SIZE (SImode); |
| 3022 |
operand1 = XEXP (operand1, 0); |
| 3023 |
} |
| 3024 |
|
| 3025 |
emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, op1_subbyte), |
| 3026 |
shift_16)); |
| 3027 |
emit_insn (gen_lshrsi3 (operand0, temp, shift_16)); |
| 3028 |
DONE; |
| 3029 |
}) |
| 3030 |
|
| 3031 |
(define_insn "*zero_extendhisi2_insn" |
| 3032 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 3033 |
(zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))] |
| 3034 |
"" |
| 3035 |
"lduh\t%1, %0" |
| 3036 |
[(set_attr "type" "load") |
| 3037 |
(set_attr "subtype" "regular") |
| 3038 |
(set_attr "us3load_type" "3cycle")]) |
| 3039 |
|
| 3040 |
(define_expand "zero_extendqihi2" |
| 3041 |
[(set (match_operand:HI 0 "register_operand" "") |
| 3042 |
(zero_extend:HI (match_operand:QI 1 "register_operand" "")))] |
| 3043 |
"" |
| 3044 |
"") |
| 3045 |
|
| 3046 |
(define_insn "*zero_extendqihi2_insn" |
| 3047 |
[(set (match_operand:HI 0 "register_operand" "=r,r") |
| 3048 |
(zero_extend:HI (match_operand:QI 1 "input_operand" "r,m")))] |
| 3049 |
"GET_CODE (operands[1]) != CONST_INT" |
| 3050 |
"@ |
| 3051 |
and\t%1, 0xff, %0 |
| 3052 |
ldub\t%1, %0" |
| 3053 |
[(set_attr "type" "*,load") |
| 3054 |
(set_attr "subtype" "*,regular") |
| 3055 |
(set_attr "us3load_type" "*,3cycle")]) |
| 3056 |
|
| 3057 |
(define_expand "zero_extendqisi2" |
| 3058 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3059 |
(zero_extend:SI (match_operand:QI 1 "register_operand" "")))] |
| 3060 |
"" |
| 3061 |
"") |
| 3062 |
|
| 3063 |
(define_insn "*zero_extendqisi2_insn" |
| 3064 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 3065 |
(zero_extend:SI (match_operand:QI 1 "input_operand" "r,m")))] |
| 3066 |
"GET_CODE (operands[1]) != CONST_INT" |
| 3067 |
"@ |
| 3068 |
and\t%1, 0xff, %0 |
| 3069 |
ldub\t%1, %0" |
| 3070 |
[(set_attr "type" "*,load") |
| 3071 |
(set_attr "subtype" "*,regular") |
| 3072 |
(set_attr "us3load_type" "*,3cycle")]) |
| 3073 |
|
| 3074 |
(define_expand "zero_extendqidi2" |
| 3075 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3076 |
(zero_extend:DI (match_operand:QI 1 "register_operand" "")))] |
| 3077 |
"TARGET_ARCH64" |
| 3078 |
"") |
| 3079 |
|
| 3080 |
(define_insn "*zero_extendqidi2_insn" |
| 3081 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 3082 |
(zero_extend:DI (match_operand:QI 1 "input_operand" "r,m")))] |
| 3083 |
"TARGET_ARCH64 && GET_CODE (operands[1]) != CONST_INT" |
| 3084 |
"@ |
| 3085 |
and\t%1, 0xff, %0 |
| 3086 |
ldub\t%1, %0" |
| 3087 |
[(set_attr "type" "*,load") |
| 3088 |
(set_attr "subtype" "*,regular") |
| 3089 |
(set_attr "us3load_type" "*,3cycle")]) |
| 3090 |
|
| 3091 |
(define_expand "zero_extendhidi2" |
| 3092 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3093 |
(zero_extend:DI (match_operand:HI 1 "register_operand" "")))] |
| 3094 |
"TARGET_ARCH64" |
| 3095 |
{ |
| 3096 |
rtx temp = gen_reg_rtx (DImode); |
| 3097 |
rtx shift_48 = GEN_INT (48); |
| 3098 |
int op1_subbyte = 0; |
| 3099 |
|
| 3100 |
if (GET_CODE (operand1) == SUBREG) |
| 3101 |
{ |
| 3102 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3103 |
op1_subbyte /= GET_MODE_SIZE (DImode); |
| 3104 |
op1_subbyte *= GET_MODE_SIZE (DImode); |
| 3105 |
operand1 = XEXP (operand1, 0); |
| 3106 |
} |
| 3107 |
|
| 3108 |
emit_insn (gen_ashldi3 (temp, gen_rtx_SUBREG (DImode, operand1, op1_subbyte), |
| 3109 |
shift_48)); |
| 3110 |
emit_insn (gen_lshrdi3 (operand0, temp, shift_48)); |
| 3111 |
DONE; |
| 3112 |
}) |
| 3113 |
|
| 3114 |
(define_insn "*zero_extendhidi2_insn" |
| 3115 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 3116 |
(zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))] |
| 3117 |
"TARGET_ARCH64" |
| 3118 |
"lduh\t%1, %0" |
| 3119 |
[(set_attr "type" "load") |
| 3120 |
(set_attr "subtype" "regular") |
| 3121 |
(set_attr "us3load_type" "3cycle")]) |
| 3122 |
|
| 3123 |
;; ??? Write truncdisi pattern using sra? |
| 3124 |
|
| 3125 |
(define_expand "zero_extendsidi2" |
| 3126 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3127 |
(zero_extend:DI (match_operand:SI 1 "register_operand" "")))] |
| 3128 |
"" |
| 3129 |
"") |
| 3130 |
|
| 3131 |
(define_insn "*zero_extendsidi2_insn_sp64" |
| 3132 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 3133 |
(zero_extend:DI (match_operand:SI 1 "input_operand" "r,m,*f")))] |
| 3134 |
"TARGET_ARCH64 |
| 3135 |
&& GET_CODE (operands[1]) != CONST_INT" |
| 3136 |
"@ |
| 3137 |
srl\t%1, 0, %0 |
| 3138 |
lduw\t%1, %0 |
| 3139 |
movstouw\t%1, %0" |
| 3140 |
[(set_attr "type" "shift,load,vismv") |
| 3141 |
(set_attr "subtype" "*,regular,movstouw") |
| 3142 |
(set_attr "cpu_feature" "*,*,vis3")]) |
| 3143 |
|
| 3144 |
(define_insn_and_split "*zero_extendsidi2_insn_sp32" |
| 3145 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 3146 |
(zero_extend:DI (match_operand:SI 1 "register_operand" "r")))] |
| 3147 |
"TARGET_ARCH32" |
| 3148 |
"#" |
| 3149 |
"&& reload_completed" |
| 3150 |
[(set (match_dup 2) (match_dup 1)) |
| 3151 |
(set (match_dup 3) (const_int 0))] |
| 3152 |
"operands[2] = gen_lowpart (SImode, operands[0]); |
| 3153 |
operands[3] = gen_highpart (SImode, operands[0]);" |
| 3154 |
[(set_attr "length" "2")]) |
| 3155 |
|
| 3156 |
;; Simplify comparisons of extended values. |
| 3157 |
|
| 3158 |
(define_insn "*cmp_zero_extendqisi2" |
| 3159 |
[(set (reg:CC CC_REG) |
| 3160 |
(compare:CC (zero_extend:SI (match_operand:QI 0 "register_operand" "r")) |
| 3161 |
(const_int 0)))] |
| 3162 |
"" |
| 3163 |
"andcc\t%0, 0xff, %%g0" |
| 3164 |
[(set_attr "type" "compare")]) |
| 3165 |
|
| 3166 |
(define_insn "*cmp_zero_qi" |
| 3167 |
[(set (reg:CC CC_REG) |
| 3168 |
(compare:CC (match_operand:QI 0 "register_operand" "r") |
| 3169 |
(const_int 0)))] |
| 3170 |
"" |
| 3171 |
"andcc\t%0, 0xff, %%g0" |
| 3172 |
[(set_attr "type" "compare")]) |
| 3173 |
|
| 3174 |
(define_insn "*cmp_zero_extendqisi2_set" |
| 3175 |
[(set (reg:CC CC_REG) |
| 3176 |
(compare:CC (zero_extend:SI (match_operand:QI 1 "register_operand" "r")) |
| 3177 |
(const_int 0))) |
| 3178 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 3179 |
(zero_extend:SI (match_dup 1)))] |
| 3180 |
"" |
| 3181 |
"andcc\t%1, 0xff, %0" |
| 3182 |
[(set_attr "type" "compare")]) |
| 3183 |
|
| 3184 |
(define_insn "*cmp_zero_extendqisi2_andcc_set" |
| 3185 |
[(set (reg:CC CC_REG) |
| 3186 |
(compare:CC (and:SI (match_operand:SI 1 "register_operand" "r") |
| 3187 |
(const_int 255)) |
| 3188 |
(const_int 0))) |
| 3189 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 3190 |
(zero_extend:SI (subreg:QI (match_dup 1) 0)))] |
| 3191 |
"" |
| 3192 |
"andcc\t%1, 0xff, %0" |
| 3193 |
[(set_attr "type" "compare")]) |
| 3194 |
|
| 3195 |
(define_insn "*cmp_zero_extendqidi2" |
| 3196 |
[(set (reg:CCX CC_REG) |
| 3197 |
(compare:CCX (zero_extend:DI (match_operand:QI 0 "register_operand" "r")) |
| 3198 |
(const_int 0)))] |
| 3199 |
"TARGET_ARCH64" |
| 3200 |
"andcc\t%0, 0xff, %%g0" |
| 3201 |
[(set_attr "type" "compare")]) |
| 3202 |
|
| 3203 |
(define_insn "*cmp_zero_qi_sp64" |
| 3204 |
[(set (reg:CCX CC_REG) |
| 3205 |
(compare:CCX (match_operand:QI 0 "register_operand" "r") |
| 3206 |
(const_int 0)))] |
| 3207 |
"TARGET_ARCH64" |
| 3208 |
"andcc\t%0, 0xff, %%g0" |
| 3209 |
[(set_attr "type" "compare")]) |
| 3210 |
|
| 3211 |
(define_insn "*cmp_zero_extendqidi2_set" |
| 3212 |
[(set (reg:CCX CC_REG) |
| 3213 |
(compare:CCX (zero_extend:DI (match_operand:QI 1 "register_operand" "r")) |
| 3214 |
(const_int 0))) |
| 3215 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 3216 |
(zero_extend:DI (match_dup 1)))] |
| 3217 |
"TARGET_ARCH64" |
| 3218 |
"andcc\t%1, 0xff, %0" |
| 3219 |
[(set_attr "type" "compare")]) |
| 3220 |
|
| 3221 |
(define_insn "*cmp_zero_extendqidi2_andcc_set" |
| 3222 |
[(set (reg:CCX CC_REG) |
| 3223 |
(compare:CCX (and:DI (match_operand:DI 1 "register_operand" "r") |
| 3224 |
(const_int 255)) |
| 3225 |
(const_int 0))) |
| 3226 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 3227 |
(zero_extend:DI (subreg:QI (match_dup 1) 0)))] |
| 3228 |
"TARGET_ARCH64" |
| 3229 |
"andcc\t%1, 0xff, %0" |
| 3230 |
[(set_attr "type" "compare")]) |
| 3231 |
|
| 3232 |
;; Similarly, handle {SI,DI}->QI mode truncation followed by a compare. |
| 3233 |
|
| 3234 |
(define_insn "*cmp_siqi_trunc" |
| 3235 |
[(set (reg:CC CC_REG) |
| 3236 |
(compare:CC (subreg:QI (match_operand:SI 0 "register_operand" "r") 3) |
| 3237 |
(const_int 0)))] |
| 3238 |
"" |
| 3239 |
"andcc\t%0, 0xff, %%g0" |
| 3240 |
[(set_attr "type" "compare")]) |
| 3241 |
|
| 3242 |
(define_insn "*cmp_siqi_trunc_set" |
| 3243 |
[(set (reg:CC CC_REG) |
| 3244 |
(compare:CC (subreg:QI (match_operand:SI 1 "register_operand" "r") 3) |
| 3245 |
(const_int 0))) |
| 3246 |
(set (match_operand:QI 0 "register_operand" "=r") |
| 3247 |
(subreg:QI (match_dup 1) 3))] |
| 3248 |
"" |
| 3249 |
"andcc\t%1, 0xff, %0" |
| 3250 |
[(set_attr "type" "compare")]) |
| 3251 |
|
| 3252 |
(define_insn "*cmp_diqi_trunc" |
| 3253 |
[(set (reg:CC CC_REG) |
| 3254 |
(compare:CC (subreg:QI (match_operand:DI 0 "register_operand" "r") 7) |
| 3255 |
(const_int 0)))] |
| 3256 |
"TARGET_ARCH64" |
| 3257 |
"andcc\t%0, 0xff, %%g0" |
| 3258 |
[(set_attr "type" "compare")]) |
| 3259 |
|
| 3260 |
(define_insn "*cmp_diqi_trunc_set" |
| 3261 |
[(set (reg:CC CC_REG) |
| 3262 |
(compare:CC (subreg:QI (match_operand:DI 1 "register_operand" "r") 7) |
| 3263 |
(const_int 0))) |
| 3264 |
(set (match_operand:QI 0 "register_operand" "=r") |
| 3265 |
(subreg:QI (match_dup 1) 7))] |
| 3266 |
"TARGET_ARCH64" |
| 3267 |
"andcc\t%1, 0xff, %0" |
| 3268 |
[(set_attr "type" "compare")]) |
| 3269 |
|
| 3270 |
|
| 3271 |
;; Sign-extension instructions |
| 3272 |
|
| 3273 |
;; These patterns originally accepted general_operands, however, slightly |
| 3274 |
;; better code is generated by only accepting register_operands, and then |
| 3275 |
;; letting combine generate the lds[hb] insns. |
| 3276 |
|
| 3277 |
(define_expand "extendhisi2" |
| 3278 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3279 |
(sign_extend:SI (match_operand:HI 1 "register_operand" "")))] |
| 3280 |
"" |
| 3281 |
{ |
| 3282 |
rtx temp = gen_reg_rtx (SImode); |
| 3283 |
rtx shift_16 = GEN_INT (16); |
| 3284 |
int op1_subbyte = 0; |
| 3285 |
|
| 3286 |
if (GET_CODE (operand1) == SUBREG) |
| 3287 |
{ |
| 3288 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3289 |
op1_subbyte /= GET_MODE_SIZE (SImode); |
| 3290 |
op1_subbyte *= GET_MODE_SIZE (SImode); |
| 3291 |
operand1 = XEXP (operand1, 0); |
| 3292 |
} |
| 3293 |
|
| 3294 |
emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, op1_subbyte), |
| 3295 |
shift_16)); |
| 3296 |
emit_insn (gen_ashrsi3 (operand0, temp, shift_16)); |
| 3297 |
DONE; |
| 3298 |
}) |
| 3299 |
|
| 3300 |
(define_insn "*sign_extendhisi2_insn" |
| 3301 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 3302 |
(sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))] |
| 3303 |
"" |
| 3304 |
"ldsh\t%1, %0" |
| 3305 |
[(set_attr "type" "sload") |
| 3306 |
(set_attr "us3load_type" "3cycle")]) |
| 3307 |
|
| 3308 |
(define_expand "extendqihi2" |
| 3309 |
[(set (match_operand:HI 0 "register_operand" "") |
| 3310 |
(sign_extend:HI (match_operand:QI 1 "register_operand" "")))] |
| 3311 |
"" |
| 3312 |
{ |
| 3313 |
rtx temp = gen_reg_rtx (SImode); |
| 3314 |
rtx shift_24 = GEN_INT (24); |
| 3315 |
int op1_subbyte = 0; |
| 3316 |
int op0_subbyte = 0; |
| 3317 |
|
| 3318 |
if (GET_CODE (operand1) == SUBREG) |
| 3319 |
{ |
| 3320 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3321 |
op1_subbyte /= GET_MODE_SIZE (SImode); |
| 3322 |
op1_subbyte *= GET_MODE_SIZE (SImode); |
| 3323 |
operand1 = XEXP (operand1, 0); |
| 3324 |
} |
| 3325 |
if (GET_CODE (operand0) == SUBREG) |
| 3326 |
{ |
| 3327 |
op0_subbyte = SUBREG_BYTE (operand0); |
| 3328 |
op0_subbyte /= GET_MODE_SIZE (SImode); |
| 3329 |
op0_subbyte *= GET_MODE_SIZE (SImode); |
| 3330 |
operand0 = XEXP (operand0, 0); |
| 3331 |
} |
| 3332 |
emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, op1_subbyte), |
| 3333 |
shift_24)); |
| 3334 |
if (GET_MODE (operand0) != SImode) |
| 3335 |
operand0 = gen_rtx_SUBREG (SImode, operand0, op0_subbyte); |
| 3336 |
emit_insn (gen_ashrsi3 (operand0, temp, shift_24)); |
| 3337 |
DONE; |
| 3338 |
}) |
| 3339 |
|
| 3340 |
(define_insn "*sign_extendqihi2_insn" |
| 3341 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 3342 |
(sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))] |
| 3343 |
"" |
| 3344 |
"ldsb\t%1, %0" |
| 3345 |
[(set_attr "type" "sload") |
| 3346 |
(set_attr "us3load_type" "3cycle")]) |
| 3347 |
|
| 3348 |
(define_expand "extendqisi2" |
| 3349 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3350 |
(sign_extend:SI (match_operand:QI 1 "register_operand" "")))] |
| 3351 |
"" |
| 3352 |
{ |
| 3353 |
rtx temp = gen_reg_rtx (SImode); |
| 3354 |
rtx shift_24 = GEN_INT (24); |
| 3355 |
int op1_subbyte = 0; |
| 3356 |
|
| 3357 |
if (GET_CODE (operand1) == SUBREG) |
| 3358 |
{ |
| 3359 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3360 |
op1_subbyte /= GET_MODE_SIZE (SImode); |
| 3361 |
op1_subbyte *= GET_MODE_SIZE (SImode); |
| 3362 |
operand1 = XEXP (operand1, 0); |
| 3363 |
} |
| 3364 |
|
| 3365 |
emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, op1_subbyte), |
| 3366 |
shift_24)); |
| 3367 |
emit_insn (gen_ashrsi3 (operand0, temp, shift_24)); |
| 3368 |
DONE; |
| 3369 |
}) |
| 3370 |
|
| 3371 |
(define_insn "*sign_extendqisi2_insn" |
| 3372 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 3373 |
(sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))] |
| 3374 |
"" |
| 3375 |
"ldsb\t%1, %0" |
| 3376 |
[(set_attr "type" "sload") |
| 3377 |
(set_attr "us3load_type" "3cycle")]) |
| 3378 |
|
| 3379 |
(define_expand "extendqidi2" |
| 3380 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3381 |
(sign_extend:DI (match_operand:QI 1 "register_operand" "")))] |
| 3382 |
"TARGET_ARCH64" |
| 3383 |
{ |
| 3384 |
rtx temp = gen_reg_rtx (DImode); |
| 3385 |
rtx shift_56 = GEN_INT (56); |
| 3386 |
int op1_subbyte = 0; |
| 3387 |
|
| 3388 |
if (GET_CODE (operand1) == SUBREG) |
| 3389 |
{ |
| 3390 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3391 |
op1_subbyte /= GET_MODE_SIZE (DImode); |
| 3392 |
op1_subbyte *= GET_MODE_SIZE (DImode); |
| 3393 |
operand1 = XEXP (operand1, 0); |
| 3394 |
} |
| 3395 |
|
| 3396 |
emit_insn (gen_ashldi3 (temp, gen_rtx_SUBREG (DImode, operand1, op1_subbyte), |
| 3397 |
shift_56)); |
| 3398 |
emit_insn (gen_ashrdi3 (operand0, temp, shift_56)); |
| 3399 |
DONE; |
| 3400 |
}) |
| 3401 |
|
| 3402 |
(define_insn "*sign_extendqidi2_insn" |
| 3403 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 3404 |
(sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))] |
| 3405 |
"TARGET_ARCH64" |
| 3406 |
"ldsb\t%1, %0" |
| 3407 |
[(set_attr "type" "sload") |
| 3408 |
(set_attr "us3load_type" "3cycle")]) |
| 3409 |
|
| 3410 |
(define_expand "extendhidi2" |
| 3411 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3412 |
(sign_extend:DI (match_operand:HI 1 "register_operand" "")))] |
| 3413 |
"TARGET_ARCH64" |
| 3414 |
{ |
| 3415 |
rtx temp = gen_reg_rtx (DImode); |
| 3416 |
rtx shift_48 = GEN_INT (48); |
| 3417 |
int op1_subbyte = 0; |
| 3418 |
|
| 3419 |
if (GET_CODE (operand1) == SUBREG) |
| 3420 |
{ |
| 3421 |
op1_subbyte = SUBREG_BYTE (operand1); |
| 3422 |
op1_subbyte /= GET_MODE_SIZE (DImode); |
| 3423 |
op1_subbyte *= GET_MODE_SIZE (DImode); |
| 3424 |
operand1 = XEXP (operand1, 0); |
| 3425 |
} |
| 3426 |
|
| 3427 |
emit_insn (gen_ashldi3 (temp, gen_rtx_SUBREG (DImode, operand1, op1_subbyte), |
| 3428 |
shift_48)); |
| 3429 |
emit_insn (gen_ashrdi3 (operand0, temp, shift_48)); |
| 3430 |
DONE; |
| 3431 |
}) |
| 3432 |
|
| 3433 |
(define_insn "*sign_extendhidi2_insn" |
| 3434 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 3435 |
(sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))] |
| 3436 |
"TARGET_ARCH64" |
| 3437 |
"ldsh\t%1, %0" |
| 3438 |
[(set_attr "type" "sload") |
| 3439 |
(set_attr "us3load_type" "3cycle")]) |
| 3440 |
|
| 3441 |
(define_expand "extendsidi2" |
| 3442 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3443 |
(sign_extend:DI (match_operand:SI 1 "register_operand" "")))] |
| 3444 |
"TARGET_ARCH64" |
| 3445 |
"") |
| 3446 |
|
| 3447 |
(define_insn "*sign_extendsidi2_insn" |
| 3448 |
[(set (match_operand:DI 0 "register_operand" "=r,r,r") |
| 3449 |
(sign_extend:DI (match_operand:SI 1 "input_operand" "r,m,*f")))] |
| 3450 |
"TARGET_ARCH64" |
| 3451 |
"@ |
| 3452 |
sra\t%1, 0, %0 |
| 3453 |
ldsw\t%1, %0 |
| 3454 |
movstosw\t%1, %0" |
| 3455 |
[(set_attr "type" "shift,sload,vismv") |
| 3456 |
(set_attr "us3load_type" "*,3cycle,*") |
| 3457 |
(set_attr "cpu_feature" "*,*,vis3")]) |
| 3458 |
|
| 3459 |
|
| 3460 |
;; Special pattern for optimizing bit-field compares. This is needed |
| 3461 |
;; because combine uses this as a canonical form. |
| 3462 |
|
| 3463 |
(define_insn "*cmp_zero_extract" |
| 3464 |
[(set (reg:CC CC_REG) |
| 3465 |
(compare:CC |
| 3466 |
(zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
| 3467 |
(match_operand:SI 1 "small_int_operand" "I") |
| 3468 |
(match_operand:SI 2 "small_int_operand" "I")) |
| 3469 |
(const_int 0)))] |
| 3470 |
"INTVAL (operands[2]) > 19" |
| 3471 |
{ |
| 3472 |
int len = INTVAL (operands[1]); |
| 3473 |
int pos = 32 - INTVAL (operands[2]) - len; |
| 3474 |
HOST_WIDE_INT mask = ((1 << len) - 1) << pos; |
| 3475 |
operands[1] = GEN_INT (mask); |
| 3476 |
return "andcc\t%0, %1, %%g0"; |
| 3477 |
} |
| 3478 |
[(set_attr "type" "compare")]) |
| 3479 |
|
| 3480 |
(define_insn "*cmp_zero_extract_sp64" |
| 3481 |
[(set (reg:CCX CC_REG) |
| 3482 |
(compare:CCX |
| 3483 |
(zero_extract:DI (match_operand:DI 0 "register_operand" "r") |
| 3484 |
(match_operand:SI 1 "small_int_operand" "I") |
| 3485 |
(match_operand:SI 2 "small_int_operand" "I")) |
| 3486 |
(const_int 0)))] |
| 3487 |
"TARGET_ARCH64 && INTVAL (operands[2]) > 51" |
| 3488 |
{ |
| 3489 |
int len = INTVAL (operands[1]); |
| 3490 |
int pos = 64 - INTVAL (operands[2]) - len; |
| 3491 |
HOST_WIDE_INT mask = (((unsigned HOST_WIDE_INT) 1 << len) - 1) << pos; |
| 3492 |
operands[1] = GEN_INT (mask); |
| 3493 |
return "andcc\t%0, %1, %%g0"; |
| 3494 |
} |
| 3495 |
[(set_attr "type" "compare")]) |
| 3496 |
|
| 3497 |
|
| 3498 |
;; Conversions between float, double and long double. |
| 3499 |
|
| 3500 |
(define_insn "extendsfdf2" |
| 3501 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 3502 |
(float_extend:DF (match_operand:SF 1 "register_operand" "f")))] |
| 3503 |
"TARGET_FPU" |
| 3504 |
"fstod\t%1, %0" |
| 3505 |
[(set_attr "type" "fp") |
| 3506 |
(set_attr "fptype" "double")]) |
| 3507 |
|
| 3508 |
(define_expand "extendsftf2" |
| 3509 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 3510 |
(float_extend:TF (match_operand:SF 1 "register_operand" "")))] |
| 3511 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3512 |
"emit_tfmode_cvt (FLOAT_EXTEND, operands); DONE;") |
| 3513 |
|
| 3514 |
(define_insn "*extendsftf2_hq" |
| 3515 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 3516 |
(float_extend:TF (match_operand:SF 1 "register_operand" "f")))] |
| 3517 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 3518 |
"fstoq\t%1, %0" |
| 3519 |
[(set_attr "type" "fp")]) |
| 3520 |
|
| 3521 |
(define_expand "extenddftf2" |
| 3522 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 3523 |
(float_extend:TF (match_operand:DF 1 "register_operand" "")))] |
| 3524 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3525 |
"emit_tfmode_cvt (FLOAT_EXTEND, operands); DONE;") |
| 3526 |
|
| 3527 |
(define_insn "*extenddftf2_hq" |
| 3528 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 3529 |
(float_extend:TF (match_operand:DF 1 "register_operand" "e")))] |
| 3530 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 3531 |
"fdtoq\t%1, %0" |
| 3532 |
[(set_attr "type" "fp")]) |
| 3533 |
|
| 3534 |
(define_insn "truncdfsf2" |
| 3535 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 3536 |
(float_truncate:SF (match_operand:DF 1 "register_operand" "e")))] |
| 3537 |
"TARGET_FPU" |
| 3538 |
"fdtos\t%1, %0" |
| 3539 |
[(set_attr "type" "fp") |
| 3540 |
(set_attr "fptype" "double") |
| 3541 |
(set_attr "fptype_ut699" "single")]) |
| 3542 |
|
| 3543 |
(define_expand "trunctfsf2" |
| 3544 |
[(set (match_operand:SF 0 "register_operand" "") |
| 3545 |
(float_truncate:SF (match_operand:TF 1 "general_operand" "")))] |
| 3546 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3547 |
"emit_tfmode_cvt (FLOAT_TRUNCATE, operands); DONE;") |
| 3548 |
|
| 3549 |
(define_insn "*trunctfsf2_hq" |
| 3550 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 3551 |
(float_truncate:SF (match_operand:TF 1 "register_operand" "e")))] |
| 3552 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 3553 |
"fqtos\t%1, %0" |
| 3554 |
[(set_attr "type" "fp")]) |
| 3555 |
|
| 3556 |
(define_expand "trunctfdf2" |
| 3557 |
[(set (match_operand:DF 0 "register_operand" "") |
| 3558 |
(float_truncate:DF (match_operand:TF 1 "general_operand" "")))] |
| 3559 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3560 |
"emit_tfmode_cvt (FLOAT_TRUNCATE, operands); DONE;") |
| 3561 |
|
| 3562 |
(define_insn "*trunctfdf2_hq" |
| 3563 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 3564 |
(float_truncate:DF (match_operand:TF 1 "register_operand" "e")))] |
| 3565 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 3566 |
"fqtod\t%1, %0" |
| 3567 |
[(set_attr "type" "fp")]) |
| 3568 |
|
| 3569 |
|
| 3570 |
;; Conversion between fixed point and floating point. |
| 3571 |
|
| 3572 |
(define_insn "floatsisf2" |
| 3573 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 3574 |
(float:SF (match_operand:SI 1 "register_operand" "f")))] |
| 3575 |
"TARGET_FPU" |
| 3576 |
"fitos\t%1, %0" |
| 3577 |
[(set_attr "type" "fp") |
| 3578 |
(set_attr "fptype" "single")]) |
| 3579 |
|
| 3580 |
(define_insn "floatsidf2" |
| 3581 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 3582 |
(float:DF (match_operand:SI 1 "register_operand" "f")))] |
| 3583 |
"TARGET_FPU" |
| 3584 |
"fitod\t%1, %0" |
| 3585 |
[(set_attr "type" "fp") |
| 3586 |
(set_attr "fptype" "double")]) |
| 3587 |
|
| 3588 |
(define_expand "floatsitf2" |
| 3589 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 3590 |
(float:TF (match_operand:SI 1 "register_operand" "")))] |
| 3591 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3592 |
"emit_tfmode_cvt (FLOAT, operands); DONE;") |
| 3593 |
|
| 3594 |
(define_insn "*floatsitf2_hq" |
| 3595 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 3596 |
(float:TF (match_operand:SI 1 "register_operand" "f")))] |
| 3597 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 3598 |
"fitoq\t%1, %0" |
| 3599 |
[(set_attr "type" "fp")]) |
| 3600 |
|
| 3601 |
(define_expand "floatunssitf2" |
| 3602 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 3603 |
(unsigned_float:TF (match_operand:SI 1 "register_operand" "")))] |
| 3604 |
"TARGET_FPU && TARGET_ARCH64 && !TARGET_HARD_QUAD" |
| 3605 |
"emit_tfmode_cvt (UNSIGNED_FLOAT, operands); DONE;") |
| 3606 |
|
| 3607 |
;; Now the same for 64 bit sources. |
| 3608 |
|
| 3609 |
(define_insn "floatdisf2" |
| 3610 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 3611 |
(float:SF (match_operand:DI 1 "register_operand" "e")))] |
| 3612 |
"TARGET_V9 && TARGET_FPU" |
| 3613 |
"fxtos\t%1, %0" |
| 3614 |
[(set_attr "type" "fp") |
| 3615 |
(set_attr "fptype" "double")]) |
| 3616 |
|
| 3617 |
(define_expand "floatunsdisf2" |
| 3618 |
[(use (match_operand:SF 0 "register_operand" "")) |
| 3619 |
(use (match_operand:DI 1 "general_operand" ""))] |
| 3620 |
"TARGET_ARCH64 && TARGET_FPU" |
| 3621 |
"sparc_emit_floatunsdi (operands, SFmode); DONE;") |
| 3622 |
|
| 3623 |
(define_insn "floatdidf2" |
| 3624 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 3625 |
(float:DF (match_operand:DI 1 "register_operand" "e")))] |
| 3626 |
"TARGET_V9 && TARGET_FPU" |
| 3627 |
"fxtod\t%1, %0" |
| 3628 |
[(set_attr "type" "fp") |
| 3629 |
(set_attr "fptype" "double")]) |
| 3630 |
|
| 3631 |
(define_expand "floatunsdidf2" |
| 3632 |
[(use (match_operand:DF 0 "register_operand" "")) |
| 3633 |
(use (match_operand:DI 1 "general_operand" ""))] |
| 3634 |
"TARGET_ARCH64 && TARGET_FPU" |
| 3635 |
"sparc_emit_floatunsdi (operands, DFmode); DONE;") |
| 3636 |
|
| 3637 |
(define_expand "floatditf2" |
| 3638 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 3639 |
(float:TF (match_operand:DI 1 "register_operand" "")))] |
| 3640 |
"TARGET_FPU && TARGET_V9 && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3641 |
"emit_tfmode_cvt (FLOAT, operands); DONE;") |
| 3642 |
|
| 3643 |
(define_insn "*floatditf2_hq" |
| 3644 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 3645 |
(float:TF (match_operand:DI 1 "register_operand" "e")))] |
| 3646 |
"TARGET_V9 && TARGET_FPU && TARGET_HARD_QUAD" |
| 3647 |
"fxtoq\t%1, %0" |
| 3648 |
[(set_attr "type" "fp")]) |
| 3649 |
|
| 3650 |
(define_expand "floatunsditf2" |
| 3651 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 3652 |
(unsigned_float:TF (match_operand:DI 1 "register_operand" "")))] |
| 3653 |
"TARGET_FPU && TARGET_ARCH64 && !TARGET_HARD_QUAD" |
| 3654 |
"emit_tfmode_cvt (UNSIGNED_FLOAT, operands); DONE;") |
| 3655 |
|
| 3656 |
;; Convert a float to an actual integer. |
| 3657 |
;; Truncation is performed as part of the conversion. |
| 3658 |
|
| 3659 |
(define_insn "fix_truncsfsi2" |
| 3660 |
[(set (match_operand:SI 0 "register_operand" "=f") |
| 3661 |
(fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))] |
| 3662 |
"TARGET_FPU" |
| 3663 |
"fstoi\t%1, %0" |
| 3664 |
[(set_attr "type" "fp") |
| 3665 |
(set_attr "fptype" "single")]) |
| 3666 |
|
| 3667 |
(define_insn "fix_truncdfsi2" |
| 3668 |
[(set (match_operand:SI 0 "register_operand" "=f") |
| 3669 |
(fix:SI (fix:DF (match_operand:DF 1 "register_operand" "e"))))] |
| 3670 |
"TARGET_FPU" |
| 3671 |
"fdtoi\t%1, %0" |
| 3672 |
[(set_attr "type" "fp") |
| 3673 |
(set_attr "fptype" "double") |
| 3674 |
(set_attr "fptype_ut699" "single")]) |
| 3675 |
|
| 3676 |
(define_expand "fix_trunctfsi2" |
| 3677 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3678 |
(fix:SI (match_operand:TF 1 "general_operand" "")))] |
| 3679 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3680 |
"emit_tfmode_cvt (FIX, operands); DONE;") |
| 3681 |
|
| 3682 |
(define_insn "*fix_trunctfsi2_hq" |
| 3683 |
[(set (match_operand:SI 0 "register_operand" "=f") |
| 3684 |
(fix:SI (match_operand:TF 1 "register_operand" "e")))] |
| 3685 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 3686 |
"fqtoi\t%1, %0" |
| 3687 |
[(set_attr "type" "fp")]) |
| 3688 |
|
| 3689 |
(define_expand "fixuns_trunctfsi2" |
| 3690 |
[(set (match_operand:SI 0 "register_operand" "") |
| 3691 |
(unsigned_fix:SI (match_operand:TF 1 "general_operand" "")))] |
| 3692 |
"TARGET_FPU && TARGET_ARCH64 && !TARGET_HARD_QUAD" |
| 3693 |
"emit_tfmode_cvt (UNSIGNED_FIX, operands); DONE;") |
| 3694 |
|
| 3695 |
;; Now the same, for V9 targets |
| 3696 |
|
| 3697 |
(define_insn "fix_truncsfdi2" |
| 3698 |
[(set (match_operand:DI 0 "register_operand" "=e") |
| 3699 |
(fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))] |
| 3700 |
"TARGET_V9 && TARGET_FPU" |
| 3701 |
"fstox\t%1, %0" |
| 3702 |
[(set_attr "type" "fp") |
| 3703 |
(set_attr "fptype" "double")]) |
| 3704 |
|
| 3705 |
(define_expand "fixuns_truncsfdi2" |
| 3706 |
[(use (match_operand:DI 0 "register_operand" "")) |
| 3707 |
(use (match_operand:SF 1 "general_operand" ""))] |
| 3708 |
"TARGET_ARCH64 && TARGET_FPU" |
| 3709 |
"sparc_emit_fixunsdi (operands, SFmode); DONE;") |
| 3710 |
|
| 3711 |
(define_insn "fix_truncdfdi2" |
| 3712 |
[(set (match_operand:DI 0 "register_operand" "=e") |
| 3713 |
(fix:DI (fix:DF (match_operand:DF 1 "register_operand" "e"))))] |
| 3714 |
"TARGET_V9 && TARGET_FPU" |
| 3715 |
"fdtox\t%1, %0" |
| 3716 |
[(set_attr "type" "fp") |
| 3717 |
(set_attr "fptype" "double")]) |
| 3718 |
|
| 3719 |
(define_expand "fixuns_truncdfdi2" |
| 3720 |
[(use (match_operand:DI 0 "register_operand" "")) |
| 3721 |
(use (match_operand:DF 1 "general_operand" ""))] |
| 3722 |
"TARGET_ARCH64 && TARGET_FPU" |
| 3723 |
"sparc_emit_fixunsdi (operands, DFmode); DONE;") |
| 3724 |
|
| 3725 |
(define_expand "fix_trunctfdi2" |
| 3726 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3727 |
(fix:DI (match_operand:TF 1 "general_operand" "")))] |
| 3728 |
"TARGET_V9 && TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 3729 |
"emit_tfmode_cvt (FIX, operands); DONE;") |
| 3730 |
|
| 3731 |
(define_insn "*fix_trunctfdi2_hq" |
| 3732 |
[(set (match_operand:DI 0 "register_operand" "=e") |
| 3733 |
(fix:DI (match_operand:TF 1 "register_operand" "e")))] |
| 3734 |
"TARGET_V9 && TARGET_FPU && TARGET_HARD_QUAD" |
| 3735 |
"fqtox\t%1, %0" |
| 3736 |
[(set_attr "type" "fp")]) |
| 3737 |
|
| 3738 |
(define_expand "fixuns_trunctfdi2" |
| 3739 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3740 |
(unsigned_fix:DI (match_operand:TF 1 "general_operand" "")))] |
| 3741 |
"TARGET_FPU && TARGET_ARCH64 && !TARGET_HARD_QUAD" |
| 3742 |
"emit_tfmode_cvt (UNSIGNED_FIX, operands); DONE;") |
| 3743 |
|
| 3744 |
|
| 3745 |
;; Integer addition/subtraction instructions. |
| 3746 |
|
| 3747 |
(define_expand "adddi3" |
| 3748 |
[(set (match_operand:DI 0 "register_operand" "") |
| 3749 |
(plus:DI (match_operand:DI 1 "register_operand" "") |
| 3750 |
(match_operand:DI 2 "arith_double_add_operand" "")))] |
| 3751 |
"" |
| 3752 |
{ |
| 3753 |
if (TARGET_ARCH32) |
| 3754 |
{ |
| 3755 |
emit_insn (gen_adddi3_sp32 (operands[0], operands[1], operands[2])); |
| 3756 |
DONE; |
| 3757 |
} |
| 3758 |
}) |
| 3759 |
|
| 3760 |
;; Turning an add/sub instruction into the other changes the Carry flag |
| 3761 |
;; so the 4096 trick cannot be used for operations in CCXCmode. |
| 3762 |
|
| 3763 |
(define_expand "uaddvdi4" |
| 3764 |
[(parallel [(set (reg:CCXC CC_REG) |
| 3765 |
(compare:CCXC (plus:DI (match_operand:DI 1 "register_operand") |
| 3766 |
(match_operand:DI 2 "arith_double_operand")) |
| 3767 |
(match_dup 1))) |
| 3768 |
(set (match_operand:DI 0 "register_operand") |
| 3769 |
(plus:DI (match_dup 1) (match_dup 2)))]) |
| 3770 |
(set (pc) (if_then_else (ltu (reg:CCXC CC_REG) (const_int 0)) |
| 3771 |
(label_ref (match_operand 3)) |
| 3772 |
(pc)))] |
| 3773 |
"" |
| 3774 |
{ |
| 3775 |
if (TARGET_ARCH32) |
| 3776 |
{ |
| 3777 |
emit_insn (gen_uaddvdi4_sp32 (operands[0], operands[1], operands[2])); |
| 3778 |
rtx x = gen_rtx_LTU (VOIDmode, gen_rtx_REG (CCCmode, SPARC_ICC_REG), |
| 3779 |
const0_rtx); |
| 3780 |
emit_jump_insn (gen_cbranchcc4 (x, XEXP (x, 0), XEXP (x, 1), operands[3])); |
| 3781 |
DONE; |
| 3782 |
} |
| 3783 |
}) |
| 3784 |
|
| 3785 |
;; Turning an add/sub instruction into the other does not change the Overflow |
| 3786 |
;; flag so the 4096 trick can be used for operations in CCXVmode. |
| 3787 |
|
| 3788 |
(define_expand "addvdi4" |
| 3789 |
[(parallel [(set (reg:CCXV CC_REG) |
| 3790 |
(compare:CCXV (plus:DI (match_operand:DI 1 "register_operand") |
| 3791 |
(match_operand:DI 2 "arith_double_add_operand")) |
| 3792 |
(unspec:DI [(match_dup 1) (match_dup 2)] |
| 3793 |
UNSPEC_ADDV))) |
| 3794 |
(set (match_operand:DI 0 "register_operand") |
| 3795 |
(plus:DI (match_dup 1) (match_dup 2)))]) |
| 3796 |
(set (pc) (if_then_else (ne (reg:CCXV CC_REG) (const_int 0)) |
| 3797 |
(label_ref (match_operand 3)) |
| 3798 |
(pc)))] |
| 3799 |
"" |
| 3800 |
{ |
| 3801 |
if (TARGET_ARCH32) |
| 3802 |
{ |
| 3803 |
emit_insn (gen_addvdi4_sp32 (operands[0], operands[1], operands[2])); |
| 3804 |
rtx x = gen_rtx_NE (VOIDmode, gen_rtx_REG (CCVmode, SPARC_ICC_REG), |
| 3805 |
const0_rtx); |
| 3806 |
emit_jump_insn (gen_cbranchcc4 (x, XEXP (x, 0), XEXP (x, 1), operands[3])); |
| 3807 |
DONE; |
| 3808 |
} |
| 3809 |
}) |
| 3810 |
|
| 3811 |
(define_insn_and_split "adddi3_sp32" |
| 3812 |
[(set (match_operand:DI 0 "register_operand" "=&r") |
| 3813 |
(plus:DI (match_operand:DI 1 "register_operand" "%r") |
| 3814 |
(match_operand:DI 2 "arith_double_operand" "rHI"))) |
| 3815 |
(clobber (reg:CC CC_REG))] |
| 3816 |
"TARGET_ARCH32" |
| 3817 |
"#" |
| 3818 |
"&& reload_completed" |
| 3819 |
[(parallel [(set (reg:CCC CC_REG) |
| 3820 |
(compare:CCC (plus:SI (match_dup 4) (match_dup 5)) |
| 3821 |
(match_dup 4))) |
| 3822 |
(set (match_dup 3) |
| 3823 |
(plus:SI (match_dup 4) (match_dup 5)))]) |
| 3824 |
(set (match_dup 6) |
| 3825 |
(plus:SI (plus:SI (match_dup 7) (match_dup 8)) |
| 3826 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))))] |
| 3827 |
{ |
| 3828 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 3829 |
operands[4] = gen_lowpart (SImode, operands[1]); |
| 3830 |
operands[5] = gen_lowpart (SImode, operands[2]); |
| 3831 |
operands[6] = gen_highpart (SImode, operands[0]); |
| 3832 |
operands[7] = gen_highpart_mode (SImode, DImode, operands[1]); |
| 3833 |
operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); |
| 3834 |
} |
| 3835 |
[(set_attr "length" "2")]) |
| 3836 |
|
| 3837 |
(define_insn_and_split "uaddvdi4_sp32" |
| 3838 |
[(set (reg:CCC CC_REG) |
| 3839 |
(compare:CCC (plus:DI (match_operand:DI 1 "register_operand" "%r") |
| 3840 |
(match_operand:DI 2 "arith_double_operand" "rHI")) |
| 3841 |
(match_dup 1))) |
| 3842 |
(set (match_operand:DI 0 "register_operand" "=&r") |
| 3843 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 3844 |
"TARGET_ARCH32" |
| 3845 |
"#" |
| 3846 |
"&& reload_completed" |
| 3847 |
[(parallel [(set (reg:CCC CC_REG) |
| 3848 |
(compare:CCC (plus:SI (match_dup 4) (match_dup 5)) |
| 3849 |
(match_dup 4))) |
| 3850 |
(set (match_dup 3) |
| 3851 |
(plus:SI (match_dup 4) (match_dup 5)))]) |
| 3852 |
(parallel [(set (reg:CCC CC_REG) |
| 3853 |
(compare:CCC (zero_extend:DI |
| 3854 |
(plus:SI (plus:SI (match_dup 7) (match_dup 8)) |
| 3855 |
(ltu:SI (reg:CCC CC_REG) |
| 3856 |
(const_int 0)))) |
| 3857 |
(plus:DI (plus:DI (zero_extend:DI (match_dup 7)) |
| 3858 |
(zero_extend:DI (match_dup 8))) |
| 3859 |
(ltu:DI (reg:CCC CC_REG) |
| 3860 |
(const_int 0))))) |
| 3861 |
(set (match_dup 6) |
| 3862 |
(plus:SI (plus:SI (match_dup 7) (match_dup 8)) |
| 3863 |
(ltu:SI (reg:CCC CC_REG) |
| 3864 |
(const_int 0))))])] |
| 3865 |
{ |
| 3866 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 3867 |
operands[4] = gen_lowpart (SImode, operands[1]); |
| 3868 |
operands[5] = gen_lowpart (SImode, operands[2]); |
| 3869 |
operands[6] = gen_highpart (SImode, operands[0]); |
| 3870 |
operands[7] = gen_highpart_mode (SImode, DImode, operands[1]); |
| 3871 |
operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); |
| 3872 |
} |
| 3873 |
[(set_attr "length" "2")]) |
| 3874 |
|
| 3875 |
(define_insn_and_split "addvdi4_sp32" |
| 3876 |
[(set (reg:CCV CC_REG) |
| 3877 |
(compare:CCV (plus:DI (match_operand:DI 1 "register_operand" "%r") |
| 3878 |
(match_operand:DI 2 "arith_double_operand" "rHI")) |
| 3879 |
(unspec:DI [(match_dup 1) (match_dup 2)] UNSPEC_ADDV))) |
| 3880 |
(set (match_operand:DI 0 "register_operand" "=&r") |
| 3881 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 3882 |
"TARGET_ARCH32" |
| 3883 |
"#" |
| 3884 |
"&& reload_completed" |
| 3885 |
[(parallel [(set (reg:CCC CC_REG) |
| 3886 |
(compare:CCC (plus:SI (match_dup 4) (match_dup 5)) |
| 3887 |
(match_dup 4))) |
| 3888 |
(set (match_dup 3) |
| 3889 |
(plus:SI (match_dup 4) (match_dup 5)))]) |
| 3890 |
(parallel [(set (reg:CCV CC_REG) |
| 3891 |
(compare:CCV (plus:SI (plus:SI (match_dup 7) (match_dup 8)) |
| 3892 |
(ltu:SI (reg:CCC CC_REG) |
| 3893 |
(const_int 0))) |
| 3894 |
(unspec:SI [(plus:SI (match_dup 7) (match_dup 8)) |
| 3895 |
(ltu:SI (reg:CCC CC_REG) |
| 3896 |
(const_int 0))] |
| 3897 |
UNSPEC_ADDV))) |
| 3898 |
(set (match_dup 6) |
| 3899 |
(plus:SI (plus:SI (match_dup 7) (match_dup 8)) |
| 3900 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))))])] |
| 3901 |
{ |
| 3902 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 3903 |
operands[4] = gen_lowpart (SImode, operands[1]); |
| 3904 |
operands[5] = gen_lowpart (SImode, operands[2]); |
| 3905 |
operands[6] = gen_highpart (SImode, operands[0]); |
| 3906 |
operands[7] = gen_highpart_mode (SImode, DImode, operands[1]); |
| 3907 |
operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); |
| 3908 |
} |
| 3909 |
[(set_attr "length" "2")]) |
| 3910 |
|
| 3911 |
(define_insn_and_split "*addx_extend_sp32" |
| 3912 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 3913 |
(zero_extend:DI (plus:SI (plus:SI |
| 3914 |
(match_operand:SI 1 "register_operand" "%r") |
| 3915 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 3916 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))))] |
| 3917 |
"TARGET_ARCH32" |
| 3918 |
"#" |
| 3919 |
"&& reload_completed" |
| 3920 |
[(set (match_dup 3) (plus:SI (plus:SI (match_dup 1) (match_dup 2)) |
| 3921 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))) |
| 3922 |
(set (match_dup 4) (const_int 0))] |
| 3923 |
"operands[3] = gen_lowpart (SImode, operands[0]); |
| 3924 |
operands[4] = gen_highpart (SImode, operands[0]);" |
| 3925 |
[(set_attr "length" "2")]) |
| 3926 |
|
| 3927 |
(define_insn_and_split "*adddi3_extend_sp32" |
| 3928 |
[(set (match_operand:DI 0 "register_operand" "=&r") |
| 3929 |
(plus:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 3930 |
(match_operand:DI 2 "register_operand" "r"))) |
| 3931 |
(clobber (reg:CC CC_REG))] |
| 3932 |
"TARGET_ARCH32" |
| 3933 |
"#" |
| 3934 |
"&& reload_completed" |
| 3935 |
[(parallel [(set (reg:CCC CC_REG) |
| 3936 |
(compare:CCC (plus:SI (match_dup 3) (match_dup 1)) |
| 3937 |
(match_dup 3))) |
| 3938 |
(set (match_dup 5) (plus:SI (match_dup 3) (match_dup 1)))]) |
| 3939 |
(set (match_dup 6) |
| 3940 |
(plus:SI (plus:SI (match_dup 4) (const_int 0)) |
| 3941 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))))] |
| 3942 |
"operands[3] = gen_lowpart (SImode, operands[2]); |
| 3943 |
operands[4] = gen_highpart (SImode, operands[2]); |
| 3944 |
operands[5] = gen_lowpart (SImode, operands[0]); |
| 3945 |
operands[6] = gen_highpart (SImode, operands[0]);" |
| 3946 |
[(set_attr "length" "2")]) |
| 3947 |
|
| 3948 |
(define_insn "*adddi3_sp64" |
| 3949 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 3950 |
(plus:DI (match_operand:DI 1 "register_operand" "%r,r") |
| 3951 |
(match_operand:DI 2 "arith_add_operand" "rI,O")))] |
| 3952 |
"TARGET_ARCH64" |
| 3953 |
"@ |
| 3954 |
add\t%1, %2, %0 |
| 3955 |
sub\t%1, -%2, %0") |
| 3956 |
|
| 3957 |
(define_insn "addsi3" |
| 3958 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 3959 |
(plus:SI (match_operand:SI 1 "register_operand" "%r,r") |
| 3960 |
(match_operand:SI 2 "arith_add_operand" "rI,O")))] |
| 3961 |
"" |
| 3962 |
"@ |
| 3963 |
add\t%1, %2, %0 |
| 3964 |
sub\t%1, -%2, %0") |
| 3965 |
|
| 3966 |
;; Turning an add/sub instruction into the other changes the Carry flag |
| 3967 |
;; so the 4096 trick cannot be used for operations in CCCmode. |
| 3968 |
|
| 3969 |
(define_expand "uaddvsi4" |
| 3970 |
[(parallel [(set (reg:CCC CC_REG) |
| 3971 |
(compare:CCC (plus:SI (match_operand:SI 1 "register_operand") |
| 3972 |
(match_operand:SI 2 "arith_operand")) |
| 3973 |
(match_dup 1))) |
| 3974 |
(set (match_operand:SI 0 "register_operand") |
| 3975 |
(plus:SI (match_dup 1) (match_dup 2)))]) |
| 3976 |
(set (pc) (if_then_else (ltu (reg:CCC CC_REG) (const_int 0)) |
| 3977 |
(label_ref (match_operand 3)) |
| 3978 |
(pc)))] |
| 3979 |
"") |
| 3980 |
|
| 3981 |
;; Turning an add/sub instruction into the other does not change the Overflow |
| 3982 |
;; flag so the 4096 trick can be used for operations in CCVmode. |
| 3983 |
|
| 3984 |
(define_expand "addvsi4" |
| 3985 |
[(parallel [(set (reg:CCV CC_REG) |
| 3986 |
(compare:CCV (plus:SI (match_operand:SI 1 "register_operand") |
| 3987 |
(match_operand:SI 2 "arith_add_operand")) |
| 3988 |
(unspec:SI [(match_dup 1) (match_dup 2)] |
| 3989 |
UNSPEC_ADDV))) |
| 3990 |
(set (match_operand:SI 0 "register_operand") |
| 3991 |
(plus:SI (match_dup 1) (match_dup 2)))]) |
| 3992 |
(set (pc) (if_then_else (ne (reg:CCV CC_REG) (const_int 0)) |
| 3993 |
(label_ref (match_operand 3)) |
| 3994 |
(pc)))] |
| 3995 |
"") |
| 3996 |
|
| 3997 |
(define_insn "*cmp_ccnz_plus" |
| 3998 |
[(set (reg:CCNZ CC_REG) |
| 3999 |
(compare:CCNZ (plus:SI (match_operand:SI 0 "register_operand" "%r") |
| 4000 |
(match_operand:SI 1 "arith_operand" "rI")) |
| 4001 |
(const_int 0)))] |
| 4002 |
"" |
| 4003 |
"addcc\t%0, %1, %%g0" |
| 4004 |
[(set_attr "type" "compare")]) |
| 4005 |
|
| 4006 |
(define_insn "*cmp_ccxnz_plus" |
| 4007 |
[(set (reg:CCXNZ CC_REG) |
| 4008 |
(compare:CCXNZ (plus:DI (match_operand:DI 0 "register_operand" "%r") |
| 4009 |
(match_operand:DI 1 "arith_operand" "rI")) |
| 4010 |
(const_int 0)))] |
| 4011 |
"TARGET_ARCH64" |
| 4012 |
"addcc\t%0, %1, %%g0" |
| 4013 |
[(set_attr "type" "compare")]) |
| 4014 |
|
| 4015 |
(define_insn "*cmp_ccnz_plus_set" |
| 4016 |
[(set (reg:CCNZ CC_REG) |
| 4017 |
(compare:CCNZ (plus:SI (match_operand:SI 1 "register_operand" "%r") |
| 4018 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4019 |
(const_int 0))) |
| 4020 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4021 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 4022 |
"" |
| 4023 |
"addcc\t%1, %2, %0" |
| 4024 |
[(set_attr "type" "compare")]) |
| 4025 |
|
| 4026 |
(define_insn "*cmp_ccxnz_plus_set" |
| 4027 |
[(set (reg:CCXNZ CC_REG) |
| 4028 |
(compare:CCXNZ (plus:DI (match_operand:DI 1 "register_operand" "%r") |
| 4029 |
(match_operand:DI 2 "arith_operand" "rI")) |
| 4030 |
(const_int 0))) |
| 4031 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 4032 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 4033 |
"TARGET_ARCH64" |
| 4034 |
"addcc\t%1, %2, %0" |
| 4035 |
[(set_attr "type" "compare")]) |
| 4036 |
|
| 4037 |
(define_insn "*cmp_ccc_plus" |
| 4038 |
[(set (reg:CCC CC_REG) |
| 4039 |
(compare:CCC (plus:SI (match_operand:SI 0 "register_operand" "%r") |
| 4040 |
(match_operand:SI 1 "arith_operand" "rI")) |
| 4041 |
(match_dup 0)))] |
| 4042 |
"" |
| 4043 |
"addcc\t%0, %1, %%g0" |
| 4044 |
[(set_attr "type" "compare")]) |
| 4045 |
|
| 4046 |
(define_insn "*cmp_ccxc_plus" |
| 4047 |
[(set (reg:CCXC CC_REG) |
| 4048 |
(compare:CCXC (plus:DI (match_operand:DI 0 "register_operand" "%r") |
| 4049 |
(match_operand:DI 1 "arith_operand" "rI")) |
| 4050 |
(match_dup 0)))] |
| 4051 |
"TARGET_ARCH64" |
| 4052 |
"addcc\t%0, %1, %%g0" |
| 4053 |
[(set_attr "type" "compare")]) |
| 4054 |
|
| 4055 |
(define_insn "*cmp_ccc_plus_set" |
| 4056 |
[(set (reg:CCC CC_REG) |
| 4057 |
(compare:CCC (plus:SI (match_operand:SI 1 "register_operand" "%r") |
| 4058 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4059 |
(match_dup 1))) |
| 4060 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4061 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 4062 |
"" |
| 4063 |
"addcc\t%1, %2, %0" |
| 4064 |
[(set_attr "type" "compare")]) |
| 4065 |
|
| 4066 |
(define_insn "*cmp_ccxc_plus_set" |
| 4067 |
[(set (reg:CCXC CC_REG) |
| 4068 |
(compare:CCXC (plus:DI (match_operand:DI 1 "register_operand" "%r") |
| 4069 |
(match_operand:DI 2 "arith_operand" "rI")) |
| 4070 |
(match_dup 1))) |
| 4071 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 4072 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 4073 |
"TARGET_ARCH64" |
| 4074 |
"addcc\t%1, %2, %0" |
| 4075 |
[(set_attr "type" "compare")]) |
| 4076 |
|
| 4077 |
(define_insn "*cmp_ccc_plus_sltu_set" |
| 4078 |
[(set (reg:CCC CC_REG) |
| 4079 |
(compare:CCC (zero_extend:DI |
| 4080 |
(plus:SI |
| 4081 |
(plus:SI (match_operand:SI 1 "register_operand" "%r") |
| 4082 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4083 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))) |
| 4084 |
(plus:DI (plus:DI (zero_extend:DI (match_dup 1)) |
| 4085 |
(zero_extend:DI (match_dup 2))) |
| 4086 |
(ltu:DI (reg:CCC CC_REG) (const_int 0))))) |
| 4087 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4088 |
(plus:SI (plus:SI (match_dup 1) (match_dup 2)) |
| 4089 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))))] |
| 4090 |
"" |
| 4091 |
"addxcc\t%1, %2, %0" |
| 4092 |
[(set_attr "type" "compare")]) |
| 4093 |
|
| 4094 |
(define_insn "*cmp_ccv_plus" |
| 4095 |
[(set (reg:CCV CC_REG) |
| 4096 |
(compare:CCV (plus:SI (match_operand:SI 0 "register_operand" "%r,r") |
| 4097 |
(match_operand:SI 1 "arith_add_operand" "rI,O")) |
| 4098 |
(unspec:SI [(match_dup 0) (match_dup 1)] UNSPEC_ADDV)))] |
| 4099 |
"" |
| 4100 |
"@ |
| 4101 |
addcc\t%0, %1, %%g0 |
| 4102 |
subcc\t%0, -%1, %%g0" |
| 4103 |
[(set_attr "type" "compare")]) |
| 4104 |
|
| 4105 |
(define_insn "*cmp_ccxv_plus" |
| 4106 |
[(set (reg:CCXV CC_REG) |
| 4107 |
(compare:CCXV (plus:DI (match_operand:DI 0 "register_operand" "%r,r") |
| 4108 |
(match_operand:DI 1 "arith_add_operand" "rI,O")) |
| 4109 |
(unspec:DI [(match_dup 0) (match_dup 1)] UNSPEC_ADDV)))] |
| 4110 |
"TARGET_ARCH64" |
| 4111 |
"@ |
| 4112 |
addcc\t%0, %1, %%g0 |
| 4113 |
subcc\t%0, -%1, %%g0" |
| 4114 |
[(set_attr "type" "compare")]) |
| 4115 |
|
| 4116 |
(define_insn "*cmp_ccv_plus_set" |
| 4117 |
[(set (reg:CCV CC_REG) |
| 4118 |
(compare:CCV (plus:SI (match_operand:SI 1 "register_operand" "%r,r") |
| 4119 |
(match_operand:SI 2 "arith_add_operand" "rI,O")) |
| 4120 |
(unspec:SI [(match_dup 1) (match_dup 2)] UNSPEC_ADDV))) |
| 4121 |
(set (match_operand:SI 0 "register_operand" "=r,r") |
| 4122 |
(plus:SI (match_dup 1) (match_dup 2)))] |
| 4123 |
"" |
| 4124 |
"@ |
| 4125 |
addcc\t%1, %2, %0 |
| 4126 |
subcc\t%1, -%2, %0" |
| 4127 |
[(set_attr "type" "compare")]) |
| 4128 |
|
| 4129 |
(define_insn "*cmp_ccxv_plus_set" |
| 4130 |
[(set (reg:CCXV CC_REG) |
| 4131 |
(compare:CCXV (plus:DI (match_operand:DI 1 "register_operand" "%r,r") |
| 4132 |
(match_operand:DI 2 "arith_add_operand" "rI,O")) |
| 4133 |
(unspec:DI [(match_dup 1) (match_dup 2)] UNSPEC_ADDV))) |
| 4134 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 4135 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 4136 |
"TARGET_ARCH64" |
| 4137 |
"@ |
| 4138 |
addcc\t%1, %2, %0 |
| 4139 |
subcc\t%1, -%2, %0" |
| 4140 |
[(set_attr "type" "compare")]) |
| 4141 |
|
| 4142 |
(define_insn "*cmp_ccv_plus_sltu_set" |
| 4143 |
[(set (reg:CCV CC_REG) |
| 4144 |
(compare:CCV (plus:SI (plus:SI (match_operand:SI 1 "register_operand" "%r") |
| 4145 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4146 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))) |
| 4147 |
(unspec:SI [(plus:SI (match_dup 1) (match_dup 2)) |
| 4148 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))] |
| 4149 |
UNSPEC_ADDV))) |
| 4150 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4151 |
(plus:SI (plus:SI (match_dup 1) (match_dup 2)) |
| 4152 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))))] |
| 4153 |
"" |
| 4154 |
"addxcc\t%1, %2, %0" |
| 4155 |
[(set_attr "type" "compare")]) |
| 4156 |
|
| 4157 |
|
| 4158 |
(define_expand "subdi3" |
| 4159 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4160 |
(minus:DI (match_operand:DI 1 "register_operand" "") |
| 4161 |
(match_operand:DI 2 "arith_double_add_operand" "")))] |
| 4162 |
"" |
| 4163 |
{ |
| 4164 |
if (TARGET_ARCH32) |
| 4165 |
{ |
| 4166 |
emit_insn (gen_subdi3_sp32 (operands[0], operands[1], operands[2])); |
| 4167 |
DONE; |
| 4168 |
} |
| 4169 |
}) |
| 4170 |
|
| 4171 |
;; Turning an add/sub instruction into the other changes the Carry flag |
| 4172 |
;; so the 4096 trick cannot be used for operations in CCXmode. |
| 4173 |
|
| 4174 |
(define_expand "usubvdi4" |
| 4175 |
[(parallel [(set (reg:CCX CC_REG) |
| 4176 |
(compare:CCX (match_operand:DI 1 "register_or_zero_operand") |
| 4177 |
(match_operand:DI 2 "arith_double_operand"))) |
| 4178 |
(set (match_operand:DI 0 "register_operand") |
| 4179 |
(minus:DI (match_dup 1) (match_dup 2)))]) |
| 4180 |
(set (pc) (if_then_else (ltu (reg:CCX CC_REG) (const_int 0)) |
| 4181 |
(label_ref (match_operand 3)) |
| 4182 |
(pc)))] |
| 4183 |
"" |
| 4184 |
{ |
| 4185 |
if (operands[1] == const0_rtx) |
| 4186 |
{ |
| 4187 |
emit_insn (gen_unegvdi3 (operands[0], operands[2], operands[3])); |
| 4188 |
DONE; |
| 4189 |
} |
| 4190 |
|
| 4191 |
if (TARGET_ARCH32) |
| 4192 |
{ |
| 4193 |
emit_insn (gen_usubvdi4_sp32 (operands[0], operands[1], operands[2])); |
| 4194 |
rtx x = gen_rtx_LTU (VOIDmode, gen_rtx_REG (CCCmode, SPARC_ICC_REG), |
| 4195 |
const0_rtx); |
| 4196 |
emit_jump_insn (gen_cbranchcc4 (x, XEXP (x, 0), XEXP (x, 1), operands[3])); |
| 4197 |
DONE; |
| 4198 |
} |
| 4199 |
}) |
| 4200 |
|
| 4201 |
;; Turning an add/sub instruction into the other does not change the Overflow |
| 4202 |
;; flag so the 4096 trick can be used for operations in CCXVmode. |
| 4203 |
|
| 4204 |
(define_expand "subvdi4" |
| 4205 |
[(parallel [(set (reg:CCXV CC_REG) |
| 4206 |
(compare:CCXV (minus:DI (match_operand:DI 1 "register_operand") |
| 4207 |
(match_operand:DI 2 "arith_double_add_operand")) |
| 4208 |
(unspec:DI [(match_dup 1) (match_dup 2)] |
| 4209 |
UNSPEC_SUBV))) |
| 4210 |
(set (match_operand:DI 0 "register_operand") |
| 4211 |
(minus:DI (match_dup 1) (match_dup 2)))]) |
| 4212 |
(set (pc) (if_then_else (ne (reg:CCXV CC_REG) (const_int 0)) |
| 4213 |
(label_ref (match_operand 3)) |
| 4214 |
(pc)))] |
| 4215 |
"" |
| 4216 |
{ |
| 4217 |
if (TARGET_ARCH32) |
| 4218 |
{ |
| 4219 |
emit_insn (gen_subvdi4_sp32 (operands[0], operands[1], operands[2])); |
| 4220 |
rtx x = gen_rtx_NE (VOIDmode, gen_rtx_REG (CCVmode, SPARC_ICC_REG), |
| 4221 |
const0_rtx); |
| 4222 |
emit_jump_insn (gen_cbranchcc4 (x, XEXP (x, 0), XEXP (x, 1), operands[3])); |
| 4223 |
DONE; |
| 4224 |
} |
| 4225 |
}) |
| 4226 |
|
| 4227 |
(define_insn_and_split "subdi3_sp32" |
| 4228 |
[(set (match_operand:DI 0 "register_operand" "=&r") |
| 4229 |
(minus:DI (match_operand:DI 1 "register_operand" "r") |
| 4230 |
(match_operand:DI 2 "arith_double_operand" "rHI"))) |
| 4231 |
(clobber (reg:CC CC_REG))] |
| 4232 |
"TARGET_ARCH32" |
| 4233 |
"#" |
| 4234 |
"&& reload_completed" |
| 4235 |
[(parallel [(set (reg:CC CC_REG) |
| 4236 |
(compare:CC (match_dup 4) (match_dup 5))) |
| 4237 |
(set (match_dup 3) |
| 4238 |
(minus:SI (match_dup 4) (match_dup 5)))]) |
| 4239 |
(set (match_dup 6) |
| 4240 |
(minus:SI (minus:SI (match_dup 7) (match_dup 8)) |
| 4241 |
(ltu:SI (reg:CC CC_REG) (const_int 0))))] |
| 4242 |
{ |
| 4243 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4244 |
operands[4] = gen_lowpart (SImode, operands[1]); |
| 4245 |
operands[5] = gen_lowpart (SImode, operands[2]); |
| 4246 |
operands[6] = gen_highpart (SImode, operands[0]); |
| 4247 |
operands[7] = gen_highpart (SImode, operands[1]); |
| 4248 |
operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); |
| 4249 |
} |
| 4250 |
[(set_attr "length" "2")]) |
| 4251 |
|
| 4252 |
(define_insn_and_split "usubvdi4_sp32" |
| 4253 |
[(set (reg:CCC CC_REG) |
| 4254 |
(compare:CCC (match_operand:DI 1 "register_operand" "r") |
| 4255 |
(match_operand:DI 2 "arith_double_operand" "rHI"))) |
| 4256 |
(set (match_operand:DI 0 "register_operand" "=&r") |
| 4257 |
(minus:DI (match_dup 1) (match_dup 2)))] |
| 4258 |
"TARGET_ARCH32" |
| 4259 |
"#" |
| 4260 |
"&& reload_completed" |
| 4261 |
[(parallel [(set (reg:CC CC_REG) |
| 4262 |
(compare:CC (match_dup 4) (match_dup 5))) |
| 4263 |
(set (match_dup 3) |
| 4264 |
(minus:SI (match_dup 4) (match_dup 5)))]) |
| 4265 |
(parallel [(set (reg:CCC CC_REG) |
| 4266 |
(compare:CCC (zero_extend:DI |
| 4267 |
(minus:SI (minus:SI (match_dup 7) |
| 4268 |
(ltu:SI (reg:CC CC_REG) |
| 4269 |
(const_int 0))) |
| 4270 |
(match_dup 8))) |
| 4271 |
(minus:DI |
| 4272 |
(minus:DI (zero_extend:DI (match_dup 7)) |
| 4273 |
(ltu:DI (reg:CC CC_REG) |
| 4274 |
(const_int 0))) |
| 4275 |
(zero_extend:DI (match_dup 8))))) |
| 4276 |
(set (match_dup 6) |
| 4277 |
(minus:SI (minus:SI (match_dup 7) |
| 4278 |
(ltu:SI (reg:CC CC_REG) |
| 4279 |
(const_int 0))) |
| 4280 |
(match_dup 8)))])] |
| 4281 |
{ |
| 4282 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4283 |
operands[4] = gen_lowpart (SImode, operands[1]); |
| 4284 |
operands[5] = gen_lowpart (SImode, operands[2]); |
| 4285 |
operands[6] = gen_highpart (SImode, operands[0]); |
| 4286 |
operands[7] = gen_highpart_mode (SImode, DImode, operands[1]); |
| 4287 |
operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); |
| 4288 |
} |
| 4289 |
[(set_attr "length" "2")]) |
| 4290 |
|
| 4291 |
(define_insn_and_split "subvdi4_sp32" |
| 4292 |
[(set (reg:CCV CC_REG) |
| 4293 |
(compare:CCV (minus:DI (match_operand:DI 1 "register_operand" "%r") |
| 4294 |
(match_operand:DI 2 "arith_double_operand" "rHI")) |
| 4295 |
(unspec:DI [(match_dup 1) (match_dup 2)] UNSPEC_SUBV))) |
| 4296 |
(set (match_operand:DI 0 "register_operand" "=&r") |
| 4297 |
(minus:DI (match_dup 1) (match_dup 2)))] |
| 4298 |
"TARGET_ARCH32" |
| 4299 |
"#" |
| 4300 |
"&& reload_completed" |
| 4301 |
[(parallel [(set (reg:CC CC_REG) |
| 4302 |
(compare:CC (match_dup 4) (match_dup 5))) |
| 4303 |
(set (match_dup 3) |
| 4304 |
(minus:SI (match_dup 4) (match_dup 5)))]) |
| 4305 |
(parallel [(set (reg:CCV CC_REG) |
| 4306 |
(compare:CCV (minus:SI (minus:SI (match_dup 7) (match_dup 8)) |
| 4307 |
(ltu:SI (reg:CC CC_REG) |
| 4308 |
(const_int 0))) |
| 4309 |
(unspec:SI [(minus:SI (match_dup 7) (match_dup 8)) |
| 4310 |
(ltu:SI (reg:CC CC_REG) |
| 4311 |
(const_int 0))] |
| 4312 |
UNSPEC_SUBV))) |
| 4313 |
(set (match_dup 6) |
| 4314 |
(minus:SI (minus:SI (match_dup 7) (match_dup 8)) |
| 4315 |
(ltu:SI (reg:CC CC_REG) (const_int 0))))])] |
| 4316 |
{ |
| 4317 |
operands[3] = gen_lowpart (SImode, operands[0]); |
| 4318 |
operands[4] = gen_lowpart (SImode, operands[1]); |
| 4319 |
operands[5] = gen_lowpart (SImode, operands[2]); |
| 4320 |
operands[6] = gen_highpart (SImode, operands[0]); |
| 4321 |
operands[7] = gen_highpart_mode (SImode, DImode, operands[1]); |
| 4322 |
operands[8] = gen_highpart_mode (SImode, DImode, operands[2]); |
| 4323 |
} |
| 4324 |
[(set_attr "length" "2")]) |
| 4325 |
|
| 4326 |
(define_insn_and_split "*subx_extend_sp32" |
| 4327 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4328 |
(zero_extend:DI (minus:SI (minus:SI |
| 4329 |
(match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 4330 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4331 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))))] |
| 4332 |
"TARGET_ARCH32" |
| 4333 |
"#" |
| 4334 |
"&& reload_completed" |
| 4335 |
[(set (match_dup 3) (minus:SI (minus:SI (match_dup 1) (match_dup 2)) |
| 4336 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))) |
| 4337 |
(set (match_dup 4) (const_int 0))] |
| 4338 |
"operands[3] = gen_lowpart (SImode, operands[0]); |
| 4339 |
operands[4] = gen_highpart (SImode, operands[0]);" |
| 4340 |
[(set_attr "length" "2")]) |
| 4341 |
|
| 4342 |
(define_insn_and_split "*subdi3_extend_sp32" |
| 4343 |
[(set (match_operand:DI 0 "register_operand" "=&r") |
| 4344 |
(minus:DI (match_operand:DI 1 "register_operand" "r") |
| 4345 |
(zero_extend:DI (match_operand:SI 2 "register_operand" "r")))) |
| 4346 |
(clobber (reg:CC CC_REG))] |
| 4347 |
"TARGET_ARCH32" |
| 4348 |
"#" |
| 4349 |
"&& reload_completed" |
| 4350 |
[(parallel [(set (reg:CC CC_REG) |
| 4351 |
(compare:CC (match_dup 3) (match_dup 2))) |
| 4352 |
(set (match_dup 5) (minus:SI (match_dup 3) (match_dup 2)))]) |
| 4353 |
(set (match_dup 6) |
| 4354 |
(minus:SI (minus:SI (match_dup 4) (const_int 0)) |
| 4355 |
(ltu:SI (reg:CC CC_REG) (const_int 0))))] |
| 4356 |
"operands[3] = gen_lowpart (SImode, operands[1]); |
| 4357 |
operands[4] = gen_highpart (SImode, operands[1]); |
| 4358 |
operands[5] = gen_lowpart (SImode, operands[0]); |
| 4359 |
operands[6] = gen_highpart (SImode, operands[0]);" |
| 4360 |
[(set_attr "length" "2")]) |
| 4361 |
|
| 4362 |
(define_insn "*subdi3_sp64" |
| 4363 |
[(set (match_operand:DI 0 "register_operand" "=r,r") |
| 4364 |
(minus:DI (match_operand:DI 1 "register_operand" "r,r") |
| 4365 |
(match_operand:DI 2 "arith_add_operand" "rI,O")))] |
| 4366 |
"TARGET_ARCH64" |
| 4367 |
"@ |
| 4368 |
sub\t%1, %2, %0 |
| 4369 |
add\t%1, -%2, %0") |
| 4370 |
|
| 4371 |
(define_insn "subsi3" |
| 4372 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 4373 |
(minus:SI (match_operand:SI 1 "register_operand" "r,r") |
| 4374 |
(match_operand:SI 2 "arith_add_operand" "rI,O")))] |
| 4375 |
"" |
| 4376 |
"@ |
| 4377 |
sub\t%1, %2, %0 |
| 4378 |
add\t%1, -%2, %0") |
| 4379 |
|
| 4380 |
;; Turning an add/sub instruction into the other changes the Carry flag |
| 4381 |
;; so the 4096 trick cannot be used for operations in CCmode. |
| 4382 |
|
| 4383 |
(define_expand "usubvsi4" |
| 4384 |
[(parallel [(set (reg:CC CC_REG) |
| 4385 |
(compare:CC (match_operand:SI 1 "register_or_zero_operand") |
| 4386 |
(match_operand:SI 2 "arith_operand"))) |
| 4387 |
(set (match_operand:SI 0 "register_operand") |
| 4388 |
(minus:SI (match_dup 1) (match_dup 2)))]) |
| 4389 |
(set (pc) (if_then_else (ltu (reg:CC CC_REG) (const_int 0)) |
| 4390 |
(label_ref (match_operand 3)) |
| 4391 |
(pc)))] |
| 4392 |
"" |
| 4393 |
{ |
| 4394 |
if (operands[1] == const0_rtx) |
| 4395 |
{ |
| 4396 |
emit_insn (gen_unegvsi3 (operands[0], operands[2], operands[3])); |
| 4397 |
DONE; |
| 4398 |
} |
| 4399 |
}) |
| 4400 |
|
| 4401 |
;; Turning an add/sub instruction into the other does not change the Overflow |
| 4402 |
;; flag so the 4096 trick can be used for operations in CCVmode. |
| 4403 |
|
| 4404 |
(define_expand "subvsi4" |
| 4405 |
[(parallel [(set (reg:CCV CC_REG) |
| 4406 |
(compare:CCV (minus:SI (match_operand:SI 1 "register_operand") |
| 4407 |
(match_operand:SI 2 "arith_add_operand")) |
| 4408 |
(unspec:SI [(match_dup 1) (match_dup 2)] |
| 4409 |
UNSPEC_SUBV))) |
| 4410 |
(set (match_operand:SI 0 "register_operand") |
| 4411 |
(minus:SI (match_dup 1) (match_dup 2)))]) |
| 4412 |
(set (pc) (if_then_else (ne (reg:CCV CC_REG) (const_int 0)) |
| 4413 |
(label_ref (match_operand 3)) |
| 4414 |
(pc)))] |
| 4415 |
"") |
| 4416 |
|
| 4417 |
(define_insn "*cmp_ccnz_minus" |
| 4418 |
[(set (reg:CCNZ CC_REG) |
| 4419 |
(compare:CCNZ (minus:SI (match_operand:SI 0 "register_or_zero_operand" "rJ") |
| 4420 |
(match_operand:SI 1 "arith_operand" "rI")) |
| 4421 |
(const_int 0)))] |
| 4422 |
"" |
| 4423 |
"subcc\t%r0, %1, %%g0" |
| 4424 |
[(set_attr "type" "compare")]) |
| 4425 |
|
| 4426 |
(define_insn "*cmp_ccxnz_minus" |
| 4427 |
[(set (reg:CCXNZ CC_REG) |
| 4428 |
(compare:CCXNZ (minus:DI (match_operand:DI 0 "register_or_zero_operand" "rJ") |
| 4429 |
(match_operand:DI 1 "arith_operand" "rI")) |
| 4430 |
(const_int 0)))] |
| 4431 |
"TARGET_ARCH64" |
| 4432 |
"subcc\t%r0, %1, %%g0" |
| 4433 |
[(set_attr "type" "compare")]) |
| 4434 |
|
| 4435 |
(define_insn "*cmp_ccnz_minus_set" |
| 4436 |
[(set (reg:CCNZ CC_REG) |
| 4437 |
(compare:CCNZ (minus:SI (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 4438 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4439 |
(const_int 0))) |
| 4440 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4441 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 4442 |
"" |
| 4443 |
"subcc\t%r1, %2, %0" |
| 4444 |
[(set_attr "type" "compare")]) |
| 4445 |
|
| 4446 |
(define_insn "*cmp_ccxnz_minus_set" |
| 4447 |
[(set (reg:CCXNZ CC_REG) |
| 4448 |
(compare:CCXNZ (minus:DI (match_operand:DI 1 "register_or_zero_operand" "rJ") |
| 4449 |
(match_operand:DI 2 "arith_operand" "rI")) |
| 4450 |
(const_int 0))) |
| 4451 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 4452 |
(minus:DI (match_dup 1) (match_dup 2)))] |
| 4453 |
"TARGET_ARCH64" |
| 4454 |
"subcc\t%r1, %2, %0" |
| 4455 |
[(set_attr "type" "compare")]) |
| 4456 |
|
| 4457 |
(define_insn "*cmpsi_set" |
| 4458 |
[(set (reg:CC CC_REG) |
| 4459 |
(compare:CC (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 4460 |
(match_operand:SI 2 "arith_operand" "rI"))) |
| 4461 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4462 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 4463 |
"" |
| 4464 |
"subcc\t%r1, %2, %0" |
| 4465 |
[(set_attr "type" "compare")]) |
| 4466 |
|
| 4467 |
(define_insn "*cmpdi_set" |
| 4468 |
[(set (reg:CCX CC_REG) |
| 4469 |
(compare:CCX (match_operand:DI 1 "register_or_zero_operand" "rJ") |
| 4470 |
(match_operand:DI 2 "arith_operand" "rI"))) |
| 4471 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 4472 |
(minus:DI (match_dup 1) (match_dup 2)))] |
| 4473 |
"TARGET_ARCH64" |
| 4474 |
"subcc\t%r1, %2, %0" |
| 4475 |
[(set_attr "type" "compare")]) |
| 4476 |
|
| 4477 |
(define_insn "*cmp_ccc_minus_sltu_set" |
| 4478 |
[(set (reg:CCC CC_REG) |
| 4479 |
(compare:CCC (zero_extend:DI |
| 4480 |
(minus:SI |
| 4481 |
(minus:SI |
| 4482 |
(match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 4483 |
(ltu:SI (reg:CC CC_REG) (const_int 0))) |
| 4484 |
(match_operand:SI 2 "arith_operand" "rI"))) |
| 4485 |
(minus:DI |
| 4486 |
(minus:DI |
| 4487 |
(zero_extend:DI (match_dup 1)) |
| 4488 |
(ltu:DI (reg:CC CC_REG) (const_int 0))) |
| 4489 |
(zero_extend:DI (match_dup 2))))) |
| 4490 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4491 |
(minus:SI (minus:SI (match_dup 1) |
| 4492 |
(ltu:SI (reg:CC CC_REG) (const_int 0))) |
| 4493 |
(match_dup 2)))] |
| 4494 |
"" |
| 4495 |
"subxcc\t%r1, %2, %0" |
| 4496 |
[(set_attr "type" "compare")]) |
| 4497 |
|
| 4498 |
(define_insn "*cmp_ccv_minus" |
| 4499 |
[(set (reg:CCV CC_REG) |
| 4500 |
(compare:CCV (minus:SI (match_operand:SI 0 "register_or_zero_operand" "rJ,rJ") |
| 4501 |
(match_operand:SI 1 "arith_add_operand" "rI,O")) |
| 4502 |
(unspec:SI [(match_dup 0) (match_dup 1)] UNSPEC_SUBV)))] |
| 4503 |
"" |
| 4504 |
"@ |
| 4505 |
subcc\t%r0, %1, %%g0 |
| 4506 |
addcc\t%r0, -%1, %%g0" |
| 4507 |
[(set_attr "type" "compare")]) |
| 4508 |
|
| 4509 |
(define_insn "*cmp_ccxv_minus" |
| 4510 |
[(set (reg:CCXV CC_REG) |
| 4511 |
(compare:CCXV (minus:DI (match_operand:DI 0 "register_or_zero_operand" "rJ,rJ") |
| 4512 |
(match_operand:DI 1 "arith_add_operand" "rI,O")) |
| 4513 |
(unspec:DI [(match_dup 0) (match_dup 1)] UNSPEC_SUBV)))] |
| 4514 |
"TARGET_ARCH64" |
| 4515 |
"@ |
| 4516 |
subcc\t%r0, %1, %%g0 |
| 4517 |
addcc\t%r0, -%1, %%g0" |
| 4518 |
[(set_attr "type" "compare")]) |
| 4519 |
|
| 4520 |
(define_insn "*cmp_ccv_minus_set" |
| 4521 |
[(set (reg:CCV CC_REG) |
| 4522 |
(compare:CCV (minus:SI (match_operand:SI 1 "register_or_zero_operand" "rJ,rJ") |
| 4523 |
(match_operand:SI 2 "arith_add_operand" "rI,O")) |
| 4524 |
(unspec:SI [(match_dup 1) (match_dup 2)] UNSPEC_SUBV))) |
| 4525 |
(set (match_operand:SI 0 "register_operand" "=r,r") |
| 4526 |
(minus:SI (match_dup 1) (match_dup 2)))] |
| 4527 |
"" |
| 4528 |
"@ |
| 4529 |
subcc\t%r1, %2, %0 |
| 4530 |
addcc\t%r1, -%2, %0" |
| 4531 |
[(set_attr "type" "compare")]) |
| 4532 |
|
| 4533 |
(define_insn "*cmp_ccxv_minus_set" |
| 4534 |
[(set (reg:CCXV CC_REG) |
| 4535 |
(compare:CCXV (minus:DI (match_operand:DI 1 "register_or_zero_operand" "rJ,rJ") |
| 4536 |
(match_operand:DI 2 "arith_add_operand" "rI,O")) |
| 4537 |
(unspec:DI [(match_dup 1) (match_dup 2)] UNSPEC_SUBV))) |
| 4538 |
(set (match_operand:DI 0 "register_operand" "=r,r") |
| 4539 |
(minus:DI (match_dup 1) (match_dup 2)))] |
| 4540 |
"TARGET_ARCH64" |
| 4541 |
"@ |
| 4542 |
subcc\t%r1, %2, %0 |
| 4543 |
addcc\t%r1, -%2, %0" |
| 4544 |
[(set_attr "type" "compare")]) |
| 4545 |
|
| 4546 |
(define_insn "*cmp_ccv_minus_sltu_set" |
| 4547 |
[(set (reg:CCV CC_REG) |
| 4548 |
(compare:CCV |
| 4549 |
(minus:SI (minus:SI (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 4550 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4551 |
(ltu:SI (reg:CC CC_REG) (const_int 0))) |
| 4552 |
(unspec:SI [(minus:SI (match_dup 1) (match_dup 2)) |
| 4553 |
(ltu:SI (reg:CC CC_REG) (const_int 0))] |
| 4554 |
UNSPEC_SUBV))) |
| 4555 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4556 |
(minus:SI (minus:SI (match_dup 1) (match_dup 2)) |
| 4557 |
(ltu:SI (reg:CC CC_REG) (const_int 0))))] |
| 4558 |
"" |
| 4559 |
"subxcc\t%1, %2, %0" |
| 4560 |
[(set_attr "type" "compare")]) |
| 4561 |
|
| 4562 |
|
| 4563 |
;; Integer multiply/divide instructions. |
| 4564 |
|
| 4565 |
;; The 32-bit multiply/divide instructions are deprecated on v9, but at |
| 4566 |
;; least in UltraSPARC I, II and IIi it is a win tick-wise. |
| 4567 |
|
| 4568 |
(define_expand "mulsi3" |
| 4569 |
[(set (match_operand:SI 0 "register_operand" "") |
| 4570 |
(mult:SI (match_operand:SI 1 "arith_operand" "") |
| 4571 |
(match_operand:SI 2 "arith_operand" "")))] |
| 4572 |
"TARGET_HARD_MUL || TARGET_ARCH64" |
| 4573 |
"") |
| 4574 |
|
| 4575 |
(define_insn "*mulsi3_sp32" |
| 4576 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 4577 |
(mult:SI (match_operand:SI 1 "arith_operand" "%r") |
| 4578 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 4579 |
"TARGET_HARD_MUL" |
| 4580 |
"smul\t%1, %2, %0" |
| 4581 |
[(set_attr "type" "imul")]) |
| 4582 |
|
| 4583 |
(define_insn "*mulsi3_sp64" |
| 4584 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 4585 |
(mult:SI (match_operand:SI 1 "arith_operand" "%r") |
| 4586 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 4587 |
"TARGET_ARCH64" |
| 4588 |
"mulx\t%1, %2, %0" |
| 4589 |
[(set_attr "type" "imul")]) |
| 4590 |
|
| 4591 |
(define_expand "muldi3" |
| 4592 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4593 |
(mult:DI (match_operand:DI 1 "arith_operand" "") |
| 4594 |
(match_operand:DI 2 "arith_operand" "")))] |
| 4595 |
"TARGET_ARCH64 || TARGET_V8PLUS" |
| 4596 |
{ |
| 4597 |
if (TARGET_V8PLUS) |
| 4598 |
{ |
| 4599 |
emit_insn (gen_muldi3_v8plus (operands[0], operands[1], operands[2])); |
| 4600 |
DONE; |
| 4601 |
} |
| 4602 |
}) |
| 4603 |
|
| 4604 |
(define_insn "*muldi3_sp64" |
| 4605 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4606 |
(mult:DI (match_operand:DI 1 "arith_operand" "%r") |
| 4607 |
(match_operand:DI 2 "arith_operand" "rI")))] |
| 4608 |
"TARGET_ARCH64" |
| 4609 |
"mulx\t%1, %2, %0" |
| 4610 |
[(set_attr "type" "imul")]) |
| 4611 |
|
| 4612 |
;; V8plus wide multiply. |
| 4613 |
(define_insn "muldi3_v8plus" |
| 4614 |
[(set (match_operand:DI 0 "register_operand" "=r,h") |
| 4615 |
(mult:DI (match_operand:DI 1 "arith_operand" "%r,0") |
| 4616 |
(match_operand:DI 2 "arith_operand" "rI,rI"))) |
| 4617 |
(clobber (match_scratch:SI 3 "=&h,X")) |
| 4618 |
(clobber (match_scratch:SI 4 "=&h,X"))] |
| 4619 |
"TARGET_V8PLUS" |
| 4620 |
{ |
| 4621 |
return output_v8plus_mult (insn, operands, \"mulx\"); |
| 4622 |
} |
| 4623 |
[(set_attr "type" "multi") |
| 4624 |
(set_attr "length" "9,8")]) |
| 4625 |
|
| 4626 |
(define_insn "*cmp_mul_set" |
| 4627 |
[(set (reg:CC CC_REG) |
| 4628 |
(compare:CC (mult:SI (match_operand:SI 1 "arith_operand" "%r") |
| 4629 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 4630 |
(const_int 0))) |
| 4631 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 4632 |
(mult:SI (match_dup 1) (match_dup 2)))] |
| 4633 |
"TARGET_V8 || TARGET_SPARCLITE || TARGET_DEPRECATED_V8_INSNS" |
| 4634 |
"smulcc\t%1, %2, %0" |
| 4635 |
[(set_attr "type" "imul")]) |
| 4636 |
|
| 4637 |
(define_expand "mulsidi3" |
| 4638 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4639 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "")) |
| 4640 |
(sign_extend:DI (match_operand:SI 2 "arith_operand" ""))))] |
| 4641 |
"TARGET_HARD_MUL" |
| 4642 |
{ |
| 4643 |
if (CONSTANT_P (operands[2])) |
| 4644 |
{ |
| 4645 |
if (TARGET_V8PLUS) |
| 4646 |
emit_insn (gen_const_mulsidi3_v8plus (operands[0], operands[1], |
| 4647 |
operands[2])); |
| 4648 |
else if (TARGET_ARCH32) |
| 4649 |
emit_insn (gen_const_mulsidi3_sp32 (operands[0], operands[1], |
| 4650 |
operands[2])); |
| 4651 |
else |
| 4652 |
emit_insn (gen_const_mulsidi3_sp64 (operands[0], operands[1], |
| 4653 |
operands[2])); |
| 4654 |
DONE; |
| 4655 |
} |
| 4656 |
if (TARGET_V8PLUS) |
| 4657 |
{ |
| 4658 |
emit_insn (gen_mulsidi3_v8plus (operands[0], operands[1], operands[2])); |
| 4659 |
DONE; |
| 4660 |
} |
| 4661 |
}) |
| 4662 |
|
| 4663 |
;; V9 puts the 64-bit product in a 64-bit register. Only out or global |
| 4664 |
;; registers can hold 64-bit values in the V8plus environment. |
| 4665 |
(define_insn "mulsidi3_v8plus" |
| 4666 |
[(set (match_operand:DI 0 "register_operand" "=h,r") |
| 4667 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4668 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "r,r")))) |
| 4669 |
(clobber (match_scratch:SI 3 "=X,&h"))] |
| 4670 |
"TARGET_V8PLUS" |
| 4671 |
"@ |
| 4672 |
smul\t%1, %2, %L0\n\tsrlx\t%L0, 32, %H0 |
| 4673 |
smul\t%1, %2, %3\n\tsrlx\t%3, 32, %H0\n\tmov\t%3, %L0" |
| 4674 |
[(set_attr "type" "multi") |
| 4675 |
(set_attr "length" "2,3")]) |
| 4676 |
|
| 4677 |
(define_insn "const_mulsidi3_v8plus" |
| 4678 |
[(set (match_operand:DI 0 "register_operand" "=h,r") |
| 4679 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4680 |
(match_operand:DI 2 "small_int_operand" "I,I"))) |
| 4681 |
(clobber (match_scratch:SI 3 "=X,&h"))] |
| 4682 |
"TARGET_V8PLUS" |
| 4683 |
"@ |
| 4684 |
smul\t%1, %2, %L0\n\tsrlx\t%L0, 32, %H0 |
| 4685 |
smul\t%1, %2, %3\n\tsrlx\t%3, 32, %H0\n\tmov\t%3, %L0" |
| 4686 |
[(set_attr "type" "multi") |
| 4687 |
(set_attr "length" "2,3")]) |
| 4688 |
|
| 4689 |
(define_insn "*mulsidi3_sp32" |
| 4690 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4691 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4692 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))] |
| 4693 |
"TARGET_HARD_MUL32" |
| 4694 |
{ |
| 4695 |
return TARGET_SPARCLET |
| 4696 |
? "smuld\t%1, %2, %L0" |
| 4697 |
: "smul\t%1, %2, %L0\n\trd\t%%y, %H0"; |
| 4698 |
} |
| 4699 |
[(set (attr "type") |
| 4700 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4701 |
(const_string "imul") (const_string "multi"))) |
| 4702 |
(set (attr "length") |
| 4703 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4704 |
(const_int 1) (const_int 2)))]) |
| 4705 |
|
| 4706 |
(define_insn "*mulsidi3_sp64" |
| 4707 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4708 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4709 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))] |
| 4710 |
"TARGET_DEPRECATED_V8_INSNS && TARGET_ARCH64" |
| 4711 |
"smul\t%1, %2, %0" |
| 4712 |
[(set_attr "type" "imul")]) |
| 4713 |
|
| 4714 |
;; Extra pattern, because sign_extend of a constant isn't valid. |
| 4715 |
|
| 4716 |
(define_insn "const_mulsidi3_sp32" |
| 4717 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4718 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4719 |
(match_operand:DI 2 "small_int_operand" "I")))] |
| 4720 |
"TARGET_HARD_MUL32" |
| 4721 |
{ |
| 4722 |
return TARGET_SPARCLET |
| 4723 |
? "smuld\t%1, %2, %L0" |
| 4724 |
: "smul\t%1, %2, %L0\n\trd\t%%y, %H0"; |
| 4725 |
} |
| 4726 |
[(set (attr "type") |
| 4727 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4728 |
(const_string "imul") (const_string "multi"))) |
| 4729 |
(set (attr "length") |
| 4730 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4731 |
(const_int 1) (const_int 2)))]) |
| 4732 |
|
| 4733 |
(define_insn "const_mulsidi3_sp64" |
| 4734 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4735 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4736 |
(match_operand:DI 2 "small_int_operand" "I")))] |
| 4737 |
"TARGET_DEPRECATED_V8_INSNS && TARGET_ARCH64" |
| 4738 |
"smul\t%1, %2, %0" |
| 4739 |
[(set_attr "type" "imul")]) |
| 4740 |
|
| 4741 |
(define_expand "smulsi3_highpart" |
| 4742 |
[(set (match_operand:SI 0 "register_operand" "") |
| 4743 |
(truncate:SI |
| 4744 |
(lshiftrt:DI |
| 4745 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "")) |
| 4746 |
(sign_extend:DI (match_operand:SI 2 "arith_operand" ""))) |
| 4747 |
(const_int 32))))] |
| 4748 |
"TARGET_HARD_MUL && TARGET_ARCH32" |
| 4749 |
{ |
| 4750 |
if (CONSTANT_P (operands[2])) |
| 4751 |
{ |
| 4752 |
if (TARGET_V8PLUS) |
| 4753 |
{ |
| 4754 |
emit_insn (gen_const_smulsi3_highpart_v8plus (operands[0], |
| 4755 |
operands[1], |
| 4756 |
operands[2], |
| 4757 |
GEN_INT (32))); |
| 4758 |
DONE; |
| 4759 |
} |
| 4760 |
emit_insn (gen_const_smulsi3_highpart (operands[0], operands[1], operands[2])); |
| 4761 |
DONE; |
| 4762 |
} |
| 4763 |
if (TARGET_V8PLUS) |
| 4764 |
{ |
| 4765 |
emit_insn (gen_smulsi3_highpart_v8plus (operands[0], operands[1], |
| 4766 |
operands[2], GEN_INT (32))); |
| 4767 |
DONE; |
| 4768 |
} |
| 4769 |
}) |
| 4770 |
|
| 4771 |
(define_insn "smulsi3_highpart_v8plus" |
| 4772 |
[(set (match_operand:SI 0 "register_operand" "=h,r") |
| 4773 |
(truncate:SI |
| 4774 |
(lshiftrt:DI |
| 4775 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4776 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "r,r"))) |
| 4777 |
(match_operand:SI 3 "small_int_operand" "I,I")))) |
| 4778 |
(clobber (match_scratch:SI 4 "=X,&h"))] |
| 4779 |
"TARGET_V8PLUS" |
| 4780 |
"@ |
| 4781 |
smul\t%1, %2, %0\;srlx\t%0, %3, %0 |
| 4782 |
smul\t%1, %2, %4\;srlx\t%4, %3, %0" |
| 4783 |
[(set_attr "type" "multi") |
| 4784 |
(set_attr "length" "2")]) |
| 4785 |
|
| 4786 |
;; The combiner changes TRUNCATE in the previous pattern to SUBREG. |
| 4787 |
(define_insn "" |
| 4788 |
[(set (match_operand:SI 0 "register_operand" "=h,r") |
| 4789 |
(subreg:SI |
| 4790 |
(lshiftrt:DI |
| 4791 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4792 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "r,r"))) |
| 4793 |
(match_operand:SI 3 "small_int_operand" "I,I")) 4)) |
| 4794 |
(clobber (match_scratch:SI 4 "=X,&h"))] |
| 4795 |
"TARGET_V8PLUS" |
| 4796 |
"@ |
| 4797 |
smul\t%1, %2, %0\n\tsrlx\t%0, %3, %0 |
| 4798 |
smul\t%1, %2, %4\n\tsrlx\t%4, %3, %0" |
| 4799 |
[(set_attr "type" "multi") |
| 4800 |
(set_attr "length" "2")]) |
| 4801 |
|
| 4802 |
(define_insn "const_smulsi3_highpart_v8plus" |
| 4803 |
[(set (match_operand:SI 0 "register_operand" "=h,r") |
| 4804 |
(truncate:SI |
| 4805 |
(lshiftrt:DI |
| 4806 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4807 |
(match_operand:DI 2 "small_int_operand" "I,I")) |
| 4808 |
(match_operand:SI 3 "small_int_operand" "I,I")))) |
| 4809 |
(clobber (match_scratch:SI 4 "=X,&h"))] |
| 4810 |
"TARGET_V8PLUS" |
| 4811 |
"@ |
| 4812 |
smul\t%1, %2, %0\n\tsrlx\t%0, %3, %0 |
| 4813 |
smul\t%1, %2, %4\n\tsrlx\t%4, %3, %0" |
| 4814 |
[(set_attr "type" "multi") |
| 4815 |
(set_attr "length" "2")]) |
| 4816 |
|
| 4817 |
(define_insn "*smulsi3_highpart_sp32" |
| 4818 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 4819 |
(truncate:SI |
| 4820 |
(lshiftrt:DI |
| 4821 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4822 |
(sign_extend:DI (match_operand:SI 2 "register_operand" "r"))) |
| 4823 |
(const_int 32))))] |
| 4824 |
"TARGET_HARD_MUL32" |
| 4825 |
"smul\t%1, %2, %%g0\n\trd\t%%y, %0" |
| 4826 |
[(set_attr "type" "multi") |
| 4827 |
(set_attr "length" "2")]) |
| 4828 |
|
| 4829 |
(define_insn "const_smulsi3_highpart" |
| 4830 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 4831 |
(truncate:SI |
| 4832 |
(lshiftrt:DI |
| 4833 |
(mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4834 |
(match_operand:DI 2 "small_int_operand" "i")) |
| 4835 |
(const_int 32))))] |
| 4836 |
"TARGET_HARD_MUL32" |
| 4837 |
"smul\t%1, %2, %%g0\n\trd\t%%y, %0" |
| 4838 |
[(set_attr "type" "multi") |
| 4839 |
(set_attr "length" "2")]) |
| 4840 |
|
| 4841 |
(define_expand "umulsidi3" |
| 4842 |
[(set (match_operand:DI 0 "register_operand" "") |
| 4843 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "")) |
| 4844 |
(zero_extend:DI (match_operand:SI 2 "uns_arith_operand" ""))))] |
| 4845 |
"TARGET_HARD_MUL" |
| 4846 |
{ |
| 4847 |
if (CONSTANT_P (operands[2])) |
| 4848 |
{ |
| 4849 |
if (TARGET_V8PLUS) |
| 4850 |
emit_insn (gen_const_umulsidi3_v8plus (operands[0], operands[1], |
| 4851 |
operands[2])); |
| 4852 |
else if (TARGET_ARCH32) |
| 4853 |
emit_insn (gen_const_umulsidi3_sp32 (operands[0], operands[1], |
| 4854 |
operands[2])); |
| 4855 |
else |
| 4856 |
emit_insn (gen_const_umulsidi3_sp64 (operands[0], operands[1], |
| 4857 |
operands[2])); |
| 4858 |
DONE; |
| 4859 |
} |
| 4860 |
if (TARGET_V8PLUS) |
| 4861 |
{ |
| 4862 |
emit_insn (gen_umulsidi3_v8plus (operands[0], operands[1], operands[2])); |
| 4863 |
DONE; |
| 4864 |
} |
| 4865 |
}) |
| 4866 |
|
| 4867 |
(define_insn "umulsidi3_v8plus" |
| 4868 |
[(set (match_operand:DI 0 "register_operand" "=h,r") |
| 4869 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4870 |
(zero_extend:DI (match_operand:SI 2 "register_operand" "r,r")))) |
| 4871 |
(clobber (match_scratch:SI 3 "=X,&h"))] |
| 4872 |
"TARGET_V8PLUS" |
| 4873 |
"@ |
| 4874 |
umul\t%1, %2, %L0\n\tsrlx\t%L0, 32, %H0 |
| 4875 |
umul\t%1, %2, %3\n\tsrlx\t%3, 32, %H0\n\tmov\t%3, %L0" |
| 4876 |
[(set_attr "type" "multi") |
| 4877 |
(set_attr "length" "2,3")]) |
| 4878 |
|
| 4879 |
(define_insn "*umulsidi3_sp32" |
| 4880 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4881 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4882 |
(zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))] |
| 4883 |
"TARGET_HARD_MUL32" |
| 4884 |
{ |
| 4885 |
return TARGET_SPARCLET |
| 4886 |
? "umuld\t%1, %2, %L0" |
| 4887 |
: "umul\t%1, %2, %L0\n\trd\t%%y, %H0"; |
| 4888 |
} |
| 4889 |
[(set (attr "type") |
| 4890 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4891 |
(const_string "imul") (const_string "multi"))) |
| 4892 |
(set (attr "length") |
| 4893 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4894 |
(const_int 1) (const_int 2)))]) |
| 4895 |
|
| 4896 |
(define_insn "*umulsidi3_sp64" |
| 4897 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4898 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4899 |
(zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))] |
| 4900 |
"TARGET_DEPRECATED_V8_INSNS && TARGET_ARCH64" |
| 4901 |
"umul\t%1, %2, %0" |
| 4902 |
[(set_attr "type" "imul")]) |
| 4903 |
|
| 4904 |
;; Extra pattern, because sign_extend of a constant isn't valid. |
| 4905 |
|
| 4906 |
(define_insn "const_umulsidi3_sp32" |
| 4907 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4908 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4909 |
(match_operand:DI 2 "uns_small_int_operand" "")))] |
| 4910 |
"TARGET_HARD_MUL32" |
| 4911 |
{ |
| 4912 |
return TARGET_SPARCLET |
| 4913 |
? "umuld\t%1, %s2, %L0" |
| 4914 |
: "umul\t%1, %s2, %L0\n\trd\t%%y, %H0"; |
| 4915 |
} |
| 4916 |
[(set (attr "type") |
| 4917 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4918 |
(const_string "imul") (const_string "multi"))) |
| 4919 |
(set (attr "length") |
| 4920 |
(if_then_else (eq_attr "isa" "sparclet") |
| 4921 |
(const_int 1) (const_int 2)))]) |
| 4922 |
|
| 4923 |
(define_insn "const_umulsidi3_sp64" |
| 4924 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4925 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 4926 |
(match_operand:DI 2 "uns_small_int_operand" "")))] |
| 4927 |
"TARGET_DEPRECATED_V8_INSNS && TARGET_ARCH64" |
| 4928 |
"umul\t%1, %s2, %0" |
| 4929 |
[(set_attr "type" "imul")]) |
| 4930 |
|
| 4931 |
(define_insn "const_umulsidi3_v8plus" |
| 4932 |
[(set (match_operand:DI 0 "register_operand" "=h,r") |
| 4933 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4934 |
(match_operand:DI 2 "uns_small_int_operand" ""))) |
| 4935 |
(clobber (match_scratch:SI 3 "=X,h"))] |
| 4936 |
"TARGET_V8PLUS" |
| 4937 |
"@ |
| 4938 |
umul\t%1, %s2, %L0\n\tsrlx\t%L0, 32, %H0 |
| 4939 |
umul\t%1, %s2, %3\n\tsrlx\t%3, 32, %H0\n\tmov\t%3, %L0" |
| 4940 |
[(set_attr "type" "multi") |
| 4941 |
(set_attr "length" "2,3")]) |
| 4942 |
|
| 4943 |
(define_expand "umulsi3_highpart" |
| 4944 |
[(set (match_operand:SI 0 "register_operand" "") |
| 4945 |
(truncate:SI |
| 4946 |
(lshiftrt:DI |
| 4947 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "")) |
| 4948 |
(zero_extend:DI (match_operand:SI 2 "uns_arith_operand" ""))) |
| 4949 |
(const_int 32))))] |
| 4950 |
"TARGET_HARD_MUL && TARGET_ARCH32" |
| 4951 |
{ |
| 4952 |
if (CONSTANT_P (operands[2])) |
| 4953 |
{ |
| 4954 |
if (TARGET_V8PLUS) |
| 4955 |
{ |
| 4956 |
emit_insn (gen_const_umulsi3_highpart_v8plus (operands[0], |
| 4957 |
operands[1], |
| 4958 |
operands[2], |
| 4959 |
GEN_INT (32))); |
| 4960 |
DONE; |
| 4961 |
} |
| 4962 |
emit_insn (gen_const_umulsi3_highpart (operands[0], operands[1], operands[2])); |
| 4963 |
DONE; |
| 4964 |
} |
| 4965 |
if (TARGET_V8PLUS) |
| 4966 |
{ |
| 4967 |
emit_insn (gen_umulsi3_highpart_v8plus (operands[0], operands[1], |
| 4968 |
operands[2], GEN_INT (32))); |
| 4969 |
DONE; |
| 4970 |
} |
| 4971 |
}) |
| 4972 |
|
| 4973 |
(define_insn "umulsi3_highpart_v8plus" |
| 4974 |
[(set (match_operand:SI 0 "register_operand" "=h,r") |
| 4975 |
(truncate:SI |
| 4976 |
(lshiftrt:DI |
| 4977 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4978 |
(zero_extend:DI (match_operand:SI 2 "register_operand" "r,r"))) |
| 4979 |
(match_operand:SI 3 "small_int_operand" "I,I")))) |
| 4980 |
(clobber (match_scratch:SI 4 "=X,h"))] |
| 4981 |
"TARGET_V8PLUS" |
| 4982 |
"@ |
| 4983 |
umul\t%1, %2, %0\n\tsrlx\t%0, %3, %0 |
| 4984 |
umul\t%1, %2, %4\n\tsrlx\t%4, %3, %0" |
| 4985 |
[(set_attr "type" "multi") |
| 4986 |
(set_attr "length" "2")]) |
| 4987 |
|
| 4988 |
(define_insn "const_umulsi3_highpart_v8plus" |
| 4989 |
[(set (match_operand:SI 0 "register_operand" "=h,r") |
| 4990 |
(truncate:SI |
| 4991 |
(lshiftrt:DI |
| 4992 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) |
| 4993 |
(match_operand:DI 2 "uns_small_int_operand" "")) |
| 4994 |
(match_operand:SI 3 "small_int_operand" "I,I")))) |
| 4995 |
(clobber (match_scratch:SI 4 "=X,h"))] |
| 4996 |
"TARGET_V8PLUS" |
| 4997 |
"@ |
| 4998 |
umul\t%1, %s2, %0\n\tsrlx\t%0, %3, %0 |
| 4999 |
umul\t%1, %s2, %4\n\tsrlx\t%4, %3, %0" |
| 5000 |
[(set_attr "type" "multi") |
| 5001 |
(set_attr "length" "2")]) |
| 5002 |
|
| 5003 |
(define_insn "*umulsi3_highpart_sp32" |
| 5004 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5005 |
(truncate:SI |
| 5006 |
(lshiftrt:DI |
| 5007 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 5008 |
(zero_extend:DI (match_operand:SI 2 "register_operand" "r"))) |
| 5009 |
(const_int 32))))] |
| 5010 |
"TARGET_HARD_MUL32" |
| 5011 |
"umul\t%1, %2, %%g0\n\trd\t%%y, %0" |
| 5012 |
[(set_attr "type" "multi") |
| 5013 |
(set_attr "length" "2")]) |
| 5014 |
|
| 5015 |
(define_insn "const_umulsi3_highpart" |
| 5016 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5017 |
(truncate:SI |
| 5018 |
(lshiftrt:DI |
| 5019 |
(mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) |
| 5020 |
(match_operand:DI 2 "uns_small_int_operand" "")) |
| 5021 |
(const_int 32))))] |
| 5022 |
"TARGET_HARD_MUL32" |
| 5023 |
"umul\t%1, %s2, %%g0\n\trd\t%%y, %0" |
| 5024 |
[(set_attr "type" "multi") |
| 5025 |
(set_attr "length" "2")]) |
| 5026 |
|
| 5027 |
|
| 5028 |
(define_expand "umulxhi_vis" |
| 5029 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5030 |
(truncate:DI |
| 5031 |
(lshiftrt:TI |
| 5032 |
(mult:TI (zero_extend:TI (match_operand:DI 1 "arith_operand" "")) |
| 5033 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" ""))) |
| 5034 |
(const_int 64))))] |
| 5035 |
"TARGET_VIS3" |
| 5036 |
{ |
| 5037 |
if (TARGET_ARCH32) |
| 5038 |
{ |
| 5039 |
emit_insn (gen_umulxhi_v8plus (operands[0], operands[1], operands[2])); |
| 5040 |
DONE; |
| 5041 |
} |
| 5042 |
}) |
| 5043 |
|
| 5044 |
(define_insn "*umulxhi_sp64" |
| 5045 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5046 |
(truncate:DI |
| 5047 |
(lshiftrt:TI |
| 5048 |
(mult:TI (zero_extend:TI (match_operand:DI 1 "arith_operand" "%r")) |
| 5049 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" "rI"))) |
| 5050 |
(const_int 64))))] |
| 5051 |
"TARGET_VIS3 && TARGET_ARCH64" |
| 5052 |
"umulxhi\t%1, %2, %0" |
| 5053 |
[(set_attr "type" "imul")]) |
| 5054 |
|
| 5055 |
(define_insn "umulxhi_v8plus" |
| 5056 |
[(set (match_operand:DI 0 "register_operand" "=r,h") |
| 5057 |
(truncate:DI |
| 5058 |
(lshiftrt:TI |
| 5059 |
(mult:TI (zero_extend:TI (match_operand:DI 1 "arith_operand" "%r,0")) |
| 5060 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" "rI,rI"))) |
| 5061 |
(const_int 64)))) |
| 5062 |
(clobber (match_scratch:SI 3 "=&h,X")) |
| 5063 |
(clobber (match_scratch:SI 4 "=&h,X"))] |
| 5064 |
"TARGET_VIS3 && TARGET_ARCH32" |
| 5065 |
{ |
| 5066 |
return output_v8plus_mult (insn, operands, \"umulxhi\"); |
| 5067 |
} |
| 5068 |
[(set_attr "type" "imul") |
| 5069 |
(set_attr "length" "9,8")]) |
| 5070 |
|
| 5071 |
(define_expand "xmulx_vis" |
| 5072 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5073 |
(truncate:DI |
| 5074 |
(unspec:TI [(zero_extend:TI (match_operand:DI 1 "arith_operand" "")) |
| 5075 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" ""))] |
| 5076 |
UNSPEC_XMUL)))] |
| 5077 |
"TARGET_VIS3" |
| 5078 |
{ |
| 5079 |
if (TARGET_ARCH32) |
| 5080 |
{ |
| 5081 |
emit_insn (gen_xmulx_v8plus (operands[0], operands[1], operands[2])); |
| 5082 |
DONE; |
| 5083 |
} |
| 5084 |
}) |
| 5085 |
|
| 5086 |
(define_insn "*xmulx_sp64" |
| 5087 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5088 |
(truncate:DI |
| 5089 |
(unspec:TI [(zero_extend:TI (match_operand:DI 1 "arith_operand" "%r")) |
| 5090 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" "rI"))] |
| 5091 |
UNSPEC_XMUL)))] |
| 5092 |
"TARGET_VIS3 && TARGET_ARCH64" |
| 5093 |
"xmulx\t%1, %2, %0" |
| 5094 |
[(set_attr "type" "imul")]) |
| 5095 |
|
| 5096 |
(define_insn "xmulx_v8plus" |
| 5097 |
[(set (match_operand:DI 0 "register_operand" "=r,h") |
| 5098 |
(truncate:DI |
| 5099 |
(unspec:TI [(zero_extend:TI (match_operand:DI 1 "arith_operand" "%r,0")) |
| 5100 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" "rI,rI"))] |
| 5101 |
UNSPEC_XMUL))) |
| 5102 |
(clobber (match_scratch:SI 3 "=&h,X")) |
| 5103 |
(clobber (match_scratch:SI 4 "=&h,X"))] |
| 5104 |
"TARGET_VIS3 && TARGET_ARCH32" |
| 5105 |
{ |
| 5106 |
return output_v8plus_mult (insn, operands, \"xmulx\"); |
| 5107 |
} |
| 5108 |
[(set_attr "type" "imul") |
| 5109 |
(set_attr "length" "9,8")]) |
| 5110 |
|
| 5111 |
(define_expand "xmulxhi_vis" |
| 5112 |
[(set (match_operand:DI 0 "register_operand" "") |
| 5113 |
(truncate:DI |
| 5114 |
(lshiftrt:TI |
| 5115 |
(unspec:TI [(zero_extend:TI (match_operand:DI 1 "arith_operand" "")) |
| 5116 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" ""))] |
| 5117 |
UNSPEC_XMUL) |
| 5118 |
(const_int 64))))] |
| 5119 |
"TARGET_VIS3" |
| 5120 |
{ |
| 5121 |
if (TARGET_ARCH32) |
| 5122 |
{ |
| 5123 |
emit_insn (gen_xmulxhi_v8plus (operands[0], operands[1], operands[2])); |
| 5124 |
DONE; |
| 5125 |
} |
| 5126 |
}) |
| 5127 |
|
| 5128 |
(define_insn "*xmulxhi_sp64" |
| 5129 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5130 |
(truncate:DI |
| 5131 |
(lshiftrt:TI |
| 5132 |
(unspec:TI [(zero_extend:TI (match_operand:DI 1 "arith_operand" "%r")) |
| 5133 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" "rI"))] |
| 5134 |
UNSPEC_XMUL) |
| 5135 |
(const_int 64))))] |
| 5136 |
"TARGET_VIS3 && TARGET_ARCH64" |
| 5137 |
"xmulxhi\t%1, %2, %0" |
| 5138 |
[(set_attr "type" "imul")]) |
| 5139 |
|
| 5140 |
(define_insn "xmulxhi_v8plus" |
| 5141 |
[(set (match_operand:DI 0 "register_operand" "=r,h") |
| 5142 |
(truncate:DI |
| 5143 |
(lshiftrt:TI |
| 5144 |
(unspec:TI [(zero_extend:TI (match_operand:DI 1 "arith_operand" "%r,0")) |
| 5145 |
(zero_extend:TI (match_operand:DI 2 "arith_operand" "rI,rI"))] |
| 5146 |
UNSPEC_XMUL) |
| 5147 |
(const_int 64)))) |
| 5148 |
(clobber (match_scratch:SI 3 "=&h,X")) |
| 5149 |
(clobber (match_scratch:SI 4 "=&h,X"))] |
| 5150 |
"TARGET_VIS3 && TARGET_ARCH32" |
| 5151 |
{ |
| 5152 |
return output_v8plus_mult (insn, operands, \"xmulxhi\"); |
| 5153 |
} |
| 5154 |
[(set_attr "type" "imul") |
| 5155 |
(set_attr "length" "9,8")]) |
| 5156 |
|
| 5157 |
(define_expand "divsi3" |
| 5158 |
[(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 5159 |
(div:SI (match_operand:SI 1 "register_operand" "") |
| 5160 |
(match_operand:SI 2 "input_operand" ""))) |
| 5161 |
(clobber (match_scratch:SI 3 ""))])] |
| 5162 |
"TARGET_V8 || TARGET_DEPRECATED_V8_INSNS" |
| 5163 |
{ |
| 5164 |
if (TARGET_ARCH64) |
| 5165 |
{ |
| 5166 |
operands[3] = gen_reg_rtx(SImode); |
| 5167 |
emit_insn (gen_ashrsi3 (operands[3], operands[1], GEN_INT (31))); |
| 5168 |
emit_insn (gen_divsi3_sp64 (operands[0], operands[1], operands[2], |
| 5169 |
operands[3])); |
| 5170 |
DONE; |
| 5171 |
} |
| 5172 |
}) |
| 5173 |
|
| 5174 |
;; The V8 architecture specifies that there must be at least 3 instructions |
| 5175 |
;; between a write to the Y register and a use of it for correct results. |
| 5176 |
;; We try to fill one of them with a simple constant or a memory load. |
| 5177 |
|
| 5178 |
(define_insn "divsi3_sp32" |
| 5179 |
[(set (match_operand:SI 0 "register_operand" "=r,r,r") |
| 5180 |
(div:SI (match_operand:SI 1 "register_operand" "r,r,r") |
| 5181 |
(match_operand:SI 2 "input_operand" "rI,K,m"))) |
| 5182 |
(clobber (match_scratch:SI 3 "=&r,&r,&r"))] |
| 5183 |
"(TARGET_V8 || TARGET_DEPRECATED_V8_INSNS) && TARGET_ARCH32" |
| 5184 |
{ |
| 5185 |
output_asm_insn ("sra\t%1, 31, %3", operands); |
| 5186 |
output_asm_insn ("wr\t%3, 0, %%y", operands); |
| 5187 |
|
| 5188 |
switch (which_alternative) |
| 5189 |
{ |
| 5190 |
case 0: |
| 5191 |
if (TARGET_V9) |
| 5192 |
return "sdiv\t%1, %2, %0"; |
| 5193 |
else |
| 5194 |
return "nop\n\tnop\n\tnop\n\tsdiv\t%1, %2, %0"; |
| 5195 |
case 1: |
| 5196 |
if (TARGET_V9) |
| 5197 |
return "sethi\t%%hi(%a2), %3\n\tsdiv\t%1, %3, %0"; |
| 5198 |
else |
| 5199 |
return "sethi\t%%hi(%a2), %3\n\tnop\n\tnop\n\tsdiv\t%1, %3, %0"; |
| 5200 |
case 2: |
| 5201 |
if (TARGET_V9) |
| 5202 |
return "ld\t%2, %3\n\tsdiv\t%1, %3, %0"; |
| 5203 |
else |
| 5204 |
return "ld\t%2, %3\n\tnop\n\tnop\n\tsdiv\t%1, %3, %0"; |
| 5205 |
default: |
| 5206 |
gcc_unreachable (); |
| 5207 |
} |
| 5208 |
} |
| 5209 |
[(set_attr "type" "multi") |
| 5210 |
(set (attr "length") |
| 5211 |
(if_then_else (eq_attr "isa" "v9") |
| 5212 |
(const_int 4) (const_int 6)))]) |
| 5213 |
|
| 5214 |
(define_insn "divsi3_sp64" |
| 5215 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5216 |
(div:SI (match_operand:SI 1 "register_operand" "r") |
| 5217 |
(match_operand:SI 2 "input_operand" "rI"))) |
| 5218 |
(use (match_operand:SI 3 "register_operand" "r"))] |
| 5219 |
"TARGET_DEPRECATED_V8_INSNS && TARGET_ARCH64" |
| 5220 |
"wr\t%%g0, %3, %%y\n\tsdiv\t%1, %2, %0" |
| 5221 |
[(set_attr "type" "multi") |
| 5222 |
(set_attr "length" "2")]) |
| 5223 |
|
| 5224 |
(define_insn "divdi3" |
| 5225 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5226 |
(div:DI (match_operand:DI 1 "register_operand" "r") |
| 5227 |
(match_operand:DI 2 "arith_operand" "rI")))] |
| 5228 |
"TARGET_ARCH64" |
| 5229 |
"sdivx\t%1, %2, %0" |
| 5230 |
[(set_attr "type" "idiv")]) |
| 5231 |
|
| 5232 |
(define_insn "*cmp_sdiv_cc_set" |
| 5233 |
[(set (reg:CC CC_REG) |
| 5234 |
(compare:CC (div:SI (match_operand:SI 1 "register_operand" "r") |
| 5235 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 5236 |
(const_int 0))) |
| 5237 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5238 |
(div:SI (match_dup 1) (match_dup 2))) |
| 5239 |
(clobber (match_scratch:SI 3 "=&r"))] |
| 5240 |
"TARGET_V8 || TARGET_DEPRECATED_V8_INSNS" |
| 5241 |
{ |
| 5242 |
output_asm_insn ("sra\t%1, 31, %3", operands); |
| 5243 |
output_asm_insn ("wr\t%3, 0, %%y", operands); |
| 5244 |
|
| 5245 |
if (TARGET_V9) |
| 5246 |
return "sdivcc\t%1, %2, %0"; |
| 5247 |
else |
| 5248 |
return "nop\n\tnop\n\tnop\n\tsdivcc\t%1, %2, %0"; |
| 5249 |
} |
| 5250 |
[(set_attr "type" "multi") |
| 5251 |
(set (attr "length") |
| 5252 |
(if_then_else (eq_attr "isa" "v9") |
| 5253 |
(const_int 3) (const_int 6)))]) |
| 5254 |
|
| 5255 |
(define_expand "udivsi3" |
| 5256 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5257 |
(udiv:SI (match_operand:SI 1 "nonimmediate_operand" "") |
| 5258 |
(match_operand:SI 2 "input_operand" "")))] |
| 5259 |
"TARGET_V8 || TARGET_DEPRECATED_V8_INSNS" |
| 5260 |
"") |
| 5261 |
|
| 5262 |
;; The V8 architecture specifies that there must be at least 3 instructions |
| 5263 |
;; between a write to the Y register and a use of it for correct results. |
| 5264 |
;; We try to fill one of them with a simple constant or a memory load. |
| 5265 |
|
| 5266 |
(define_insn "udivsi3_sp32" |
| 5267 |
[(set (match_operand:SI 0 "register_operand" "=r,&r,&r,&r") |
| 5268 |
(udiv:SI (match_operand:SI 1 "nonimmediate_operand" "r,r,r,m") |
| 5269 |
(match_operand:SI 2 "input_operand" "rI,K,m,r")))] |
| 5270 |
"(TARGET_V8 || TARGET_DEPRECATED_V8_INSNS) && TARGET_ARCH32" |
| 5271 |
{ |
| 5272 |
output_asm_insn ("wr\t%%g0, 0, %%y", operands); |
| 5273 |
|
| 5274 |
switch (which_alternative) |
| 5275 |
{ |
| 5276 |
case 0: |
| 5277 |
if (TARGET_V9) |
| 5278 |
return "udiv\t%1, %2, %0"; |
| 5279 |
else |
| 5280 |
return "nop\n\tnop\n\tnop\n\tudiv\t%1, %2, %0"; |
| 5281 |
case 1: |
| 5282 |
if (TARGET_V9) |
| 5283 |
return "sethi\t%%hi(%a2), %0\n\tudiv\t%1, %0, %0"; |
| 5284 |
else |
| 5285 |
return "sethi\t%%hi(%a2), %0\n\tnop\n\tnop\n\tudiv\t%1, %0, %0"; |
| 5286 |
case 2: |
| 5287 |
if (TARGET_V9) |
| 5288 |
return "ld\t%2, %0\n\tudiv\t%1, %0, %0"; |
| 5289 |
else |
| 5290 |
return "ld\t%2, %0\n\tnop\n\tnop\n\tudiv\t%1, %0, %0"; |
| 5291 |
case 3: |
| 5292 |
if (TARGET_V9) |
| 5293 |
return "ld\t%1, %0\n\tudiv\t%0, %2, %0"; |
| 5294 |
else |
| 5295 |
return "ld\t%1, %0\n\tnop\n\tnop\n\tudiv\t%0, %2, %0"; |
| 5296 |
default: |
| 5297 |
gcc_unreachable (); |
| 5298 |
} |
| 5299 |
} |
| 5300 |
[(set_attr "type" "multi") |
| 5301 |
(set (attr "length") |
| 5302 |
(if_then_else (eq_attr "isa" "v9") |
| 5303 |
(const_int 3) (const_int 5)))]) |
| 5304 |
|
| 5305 |
(define_insn "udivsi3_sp64" |
| 5306 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5307 |
(udiv:SI (match_operand:SI 1 "nonimmediate_operand" "r") |
| 5308 |
(match_operand:SI 2 "input_operand" "rI")))] |
| 5309 |
"TARGET_DEPRECATED_V8_INSNS && TARGET_ARCH64" |
| 5310 |
"wr\t%%g0, 0, %%y\n\tudiv\t%1, %2, %0" |
| 5311 |
[(set_attr "type" "multi") |
| 5312 |
(set_attr "length" "2")]) |
| 5313 |
|
| 5314 |
(define_insn "udivdi3" |
| 5315 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5316 |
(udiv:DI (match_operand:DI 1 "register_operand" "r") |
| 5317 |
(match_operand:DI 2 "arith_operand" "rI")))] |
| 5318 |
"TARGET_ARCH64" |
| 5319 |
"udivx\t%1, %2, %0" |
| 5320 |
[(set_attr "type" "idiv")]) |
| 5321 |
|
| 5322 |
(define_insn "*cmp_udiv_cc_set" |
| 5323 |
[(set (reg:CC CC_REG) |
| 5324 |
(compare:CC (udiv:SI (match_operand:SI 1 "register_operand" "r") |
| 5325 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 5326 |
(const_int 0))) |
| 5327 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5328 |
(udiv:SI (match_dup 1) (match_dup 2)))] |
| 5329 |
"TARGET_V8 || TARGET_DEPRECATED_V8_INSNS" |
| 5330 |
{ |
| 5331 |
output_asm_insn ("wr\t%%g0, 0, %%y", operands); |
| 5332 |
|
| 5333 |
if (TARGET_V9) |
| 5334 |
return "udivcc\t%1, %2, %0"; |
| 5335 |
else |
| 5336 |
return "nop\n\tnop\n\tnop\n\tudivcc\t%1, %2, %0"; |
| 5337 |
} |
| 5338 |
[(set_attr "type" "multi") |
| 5339 |
(set (attr "length") |
| 5340 |
(if_then_else (eq_attr "isa" "v9") |
| 5341 |
(const_int 2) (const_int 5)))]) |
| 5342 |
|
| 5343 |
|
| 5344 |
;; SPARClet multiply/accumulate insns |
| 5345 |
|
| 5346 |
(define_insn "*smacsi" |
| 5347 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5348 |
(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "%r") |
| 5349 |
(match_operand:SI 2 "arith_operand" "rI")) |
| 5350 |
(match_operand:SI 3 "register_operand" "0")))] |
| 5351 |
"TARGET_SPARCLET" |
| 5352 |
"smac\t%1, %2, %0" |
| 5353 |
[(set_attr "type" "imul")]) |
| 5354 |
|
| 5355 |
(define_insn "*smacdi" |
| 5356 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5357 |
(plus:DI (mult:DI (sign_extend:DI |
| 5358 |
(match_operand:SI 1 "register_operand" "%r")) |
| 5359 |
(sign_extend:DI |
| 5360 |
(match_operand:SI 2 "register_operand" "r"))) |
| 5361 |
(match_operand:DI 3 "register_operand" "0")))] |
| 5362 |
"TARGET_SPARCLET" |
| 5363 |
"smacd\t%1, %2, %L0" |
| 5364 |
[(set_attr "type" "imul")]) |
| 5365 |
|
| 5366 |
(define_insn "*umacdi" |
| 5367 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5368 |
(plus:DI (mult:DI (zero_extend:DI |
| 5369 |
(match_operand:SI 1 "register_operand" "%r")) |
| 5370 |
(zero_extend:DI |
| 5371 |
(match_operand:SI 2 "register_operand" "r"))) |
| 5372 |
(match_operand:DI 3 "register_operand" "0")))] |
| 5373 |
"TARGET_SPARCLET" |
| 5374 |
"umacd\t%1, %2, %L0" |
| 5375 |
[(set_attr "type" "imul")]) |
| 5376 |
|
| 5377 |
|
| 5378 |
;; Boolean instructions. |
| 5379 |
|
| 5380 |
(define_insn "anddi3" |
| 5381 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5382 |
(and:DI (match_operand:DI 1 "arith_operand" "%r") |
| 5383 |
(match_operand:DI 2 "arith_operand" "rI")))] |
| 5384 |
"TARGET_ARCH64" |
| 5385 |
"and\t%1, %2, %0") |
| 5386 |
|
| 5387 |
(define_insn "andsi3" |
| 5388 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5389 |
(and:SI (match_operand:SI 1 "arith_operand" "%r") |
| 5390 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 5391 |
"" |
| 5392 |
"and\t%1, %2, %0") |
| 5393 |
|
| 5394 |
(define_split |
| 5395 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5396 |
(and:SI (match_operand:SI 1 "register_operand" "") |
| 5397 |
(match_operand:SI 2 "const_compl_high_operand" ""))) |
| 5398 |
(clobber (match_operand:SI 3 "register_operand" ""))] |
| 5399 |
"" |
| 5400 |
[(set (match_dup 3) (match_dup 4)) |
| 5401 |
(set (match_dup 0) (and:SI (not:SI (match_dup 3)) (match_dup 1)))] |
| 5402 |
{ |
| 5403 |
operands[4] = GEN_INT (~INTVAL (operands[2])); |
| 5404 |
}) |
| 5405 |
|
| 5406 |
(define_insn "*and_not_di_sp64" |
| 5407 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5408 |
(and:DI (not:DI (match_operand:DI 1 "register_operand" "%r")) |
| 5409 |
(match_operand:DI 2 "register_operand" "r")))] |
| 5410 |
"TARGET_ARCH64" |
| 5411 |
"andn\t%2, %1, %0") |
| 5412 |
|
| 5413 |
(define_insn "*and_not_si" |
| 5414 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5415 |
(and:SI (not:SI (match_operand:SI 1 "register_operand" "%r")) |
| 5416 |
(match_operand:SI 2 "register_operand" "r")))] |
| 5417 |
"" |
| 5418 |
"andn\t%2, %1, %0") |
| 5419 |
|
| 5420 |
(define_insn "iordi3" |
| 5421 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5422 |
(ior:DI (match_operand:DI 1 "arith_operand" "%r") |
| 5423 |
(match_operand:DI 2 "arith_operand" "rI")))] |
| 5424 |
"TARGET_ARCH64" |
| 5425 |
"or\t%1, %2, %0") |
| 5426 |
|
| 5427 |
(define_insn "iorsi3" |
| 5428 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5429 |
(ior:SI (match_operand:SI 1 "arith_operand" "%r") |
| 5430 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 5431 |
"" |
| 5432 |
"or\t%1, %2, %0") |
| 5433 |
|
| 5434 |
(define_split |
| 5435 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5436 |
(ior:SI (match_operand:SI 1 "register_operand" "") |
| 5437 |
(match_operand:SI 2 "const_compl_high_operand" ""))) |
| 5438 |
(clobber (match_operand:SI 3 "register_operand" ""))] |
| 5439 |
"" |
| 5440 |
[(set (match_dup 3) (match_dup 4)) |
| 5441 |
(set (match_dup 0) (ior:SI (not:SI (match_dup 3)) (match_dup 1)))] |
| 5442 |
{ |
| 5443 |
operands[4] = gen_int_mode (~INTVAL (operands[2]), SImode); |
| 5444 |
}) |
| 5445 |
|
| 5446 |
(define_insn "*or_not_di_sp64" |
| 5447 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5448 |
(ior:DI (not:DI (match_operand:DI 1 "register_operand" "r")) |
| 5449 |
(match_operand:DI 2 "register_operand" "r")))] |
| 5450 |
"TARGET_ARCH64" |
| 5451 |
"orn\t%2, %1, %0") |
| 5452 |
|
| 5453 |
(define_insn "*or_not_si" |
| 5454 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5455 |
(ior:SI (not:SI (match_operand:SI 1 "register_operand" "r")) |
| 5456 |
(match_operand:SI 2 "register_operand" "r")))] |
| 5457 |
"" |
| 5458 |
"orn\t%2, %1, %0") |
| 5459 |
|
| 5460 |
(define_insn "xordi3" |
| 5461 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5462 |
(xor:DI (match_operand:DI 1 "arith_operand" "%rJ") |
| 5463 |
(match_operand:DI 2 "arith_operand" "rI")))] |
| 5464 |
"TARGET_ARCH64" |
| 5465 |
"xor\t%r1, %2, %0") |
| 5466 |
|
| 5467 |
(define_insn "xorsi3" |
| 5468 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5469 |
(xor:SI (match_operand:SI 1 "arith_operand" "%rJ") |
| 5470 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 5471 |
"" |
| 5472 |
"xor\t%r1, %2, %0") |
| 5473 |
|
| 5474 |
(define_split |
| 5475 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5476 |
(xor:SI (match_operand:SI 1 "register_operand" "") |
| 5477 |
(match_operand:SI 2 "const_compl_high_operand" ""))) |
| 5478 |
(clobber (match_operand:SI 3 "register_operand" ""))] |
| 5479 |
"" |
| 5480 |
[(set (match_dup 3) (match_dup 4)) |
| 5481 |
(set (match_dup 0) (not:SI (xor:SI (match_dup 3) (match_dup 1))))] |
| 5482 |
{ |
| 5483 |
operands[4] = gen_int_mode (~INTVAL (operands[2]), SImode); |
| 5484 |
}) |
| 5485 |
|
| 5486 |
(define_split |
| 5487 |
[(set (match_operand:SI 0 "register_operand" "") |
| 5488 |
(not:SI (xor:SI (match_operand:SI 1 "register_operand" "") |
| 5489 |
(match_operand:SI 2 "const_compl_high_operand" "")))) |
| 5490 |
(clobber (match_operand:SI 3 "register_operand" ""))] |
| 5491 |
"" |
| 5492 |
[(set (match_dup 3) (match_dup 4)) |
| 5493 |
(set (match_dup 0) (xor:SI (match_dup 3) (match_dup 1)))] |
| 5494 |
{ |
| 5495 |
operands[4] = gen_int_mode (~INTVAL (operands[2]), SImode); |
| 5496 |
}) |
| 5497 |
|
| 5498 |
(define_insn "*xor_not_di_sp64" |
| 5499 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5500 |
(not:DI (xor:DI (match_operand:DI 1 "register_or_zero_operand" "rJ") |
| 5501 |
(match_operand:DI 2 "arith_operand" "rI"))))] |
| 5502 |
"TARGET_ARCH64" |
| 5503 |
"xnor\t%r1, %2, %0") |
| 5504 |
|
| 5505 |
(define_insn "*xor_not_si" |
| 5506 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5507 |
(not:SI (xor:SI (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 5508 |
(match_operand:SI 2 "arith_operand" "rI"))))] |
| 5509 |
"" |
| 5510 |
"xnor\t%r1, %2, %0") |
| 5511 |
|
| 5512 |
;; These correspond to the above in the case where we also (or only) |
| 5513 |
;; want to set the condition code. |
| 5514 |
|
| 5515 |
(define_insn "*cmp_cc_arith_op" |
| 5516 |
[(set (reg:CC CC_REG) |
| 5517 |
(compare:CC (match_operator:SI 2 "cc_arith_operator" |
| 5518 |
[(match_operand:SI 0 "arith_operand" "%r") |
| 5519 |
(match_operand:SI 1 "arith_operand" "rI")]) |
| 5520 |
(const_int 0)))] |
| 5521 |
"" |
| 5522 |
"%A2cc\t%0, %1, %%g0" |
| 5523 |
[(set_attr "type" "compare")]) |
| 5524 |
|
| 5525 |
(define_insn "*cmp_ccx_arith_op" |
| 5526 |
[(set (reg:CCX CC_REG) |
| 5527 |
(compare:CCX (match_operator:DI 2 "cc_arith_operator" |
| 5528 |
[(match_operand:DI 0 "arith_operand" "%r") |
| 5529 |
(match_operand:DI 1 "arith_operand" "rI")]) |
| 5530 |
(const_int 0)))] |
| 5531 |
"TARGET_ARCH64" |
| 5532 |
"%A2cc\t%0, %1, %%g0" |
| 5533 |
[(set_attr "type" "compare")]) |
| 5534 |
|
| 5535 |
(define_insn "*cmp_cc_arith_op_set" |
| 5536 |
[(set (reg:CC CC_REG) |
| 5537 |
(compare:CC (match_operator:SI 3 "cc_arith_operator" |
| 5538 |
[(match_operand:SI 1 "arith_operand" "%r") |
| 5539 |
(match_operand:SI 2 "arith_operand" "rI")]) |
| 5540 |
(const_int 0))) |
| 5541 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5542 |
(match_operator:SI 4 "cc_arith_operator" |
| 5543 |
[(match_dup 1) (match_dup 2)]))] |
| 5544 |
"GET_CODE (operands[3]) == GET_CODE (operands[4])" |
| 5545 |
"%A3cc\t%1, %2, %0" |
| 5546 |
[(set_attr "type" "compare")]) |
| 5547 |
|
| 5548 |
(define_insn "*cmp_ccx_arith_op_set" |
| 5549 |
[(set (reg:CCX CC_REG) |
| 5550 |
(compare:CCX (match_operator:DI 3 "cc_arith_operator" |
| 5551 |
[(match_operand:DI 1 "arith_operand" "%r") |
| 5552 |
(match_operand:DI 2 "arith_operand" "rI")]) |
| 5553 |
(const_int 0))) |
| 5554 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5555 |
(match_operator:DI 4 "cc_arith_operator" |
| 5556 |
[(match_dup 1) (match_dup 2)]))] |
| 5557 |
"TARGET_ARCH64 && GET_CODE (operands[3]) == GET_CODE (operands[4])" |
| 5558 |
"%A3cc\t%1, %2, %0" |
| 5559 |
[(set_attr "type" "compare")]) |
| 5560 |
|
| 5561 |
(define_insn "*cmp_cc_xor_not" |
| 5562 |
[(set (reg:CC CC_REG) |
| 5563 |
(compare:CC |
| 5564 |
(not:SI (xor:SI (match_operand:SI 0 "register_or_zero_operand" "%rJ") |
| 5565 |
(match_operand:SI 1 "arith_operand" "rI"))) |
| 5566 |
(const_int 0)))] |
| 5567 |
"" |
| 5568 |
"xnorcc\t%r0, %1, %%g0" |
| 5569 |
[(set_attr "type" "compare")]) |
| 5570 |
|
| 5571 |
(define_insn "*cmp_ccx_xor_not" |
| 5572 |
[(set (reg:CCX CC_REG) |
| 5573 |
(compare:CCX |
| 5574 |
(not:DI (xor:DI (match_operand:DI 0 "register_or_zero_operand" "%rJ") |
| 5575 |
(match_operand:DI 1 "arith_operand" "rI"))) |
| 5576 |
(const_int 0)))] |
| 5577 |
"TARGET_ARCH64" |
| 5578 |
"xnorcc\t%r0, %1, %%g0" |
| 5579 |
[(set_attr "type" "compare")]) |
| 5580 |
|
| 5581 |
(define_insn "*cmp_cc_xor_not_set" |
| 5582 |
[(set (reg:CC CC_REG) |
| 5583 |
(compare:CC |
| 5584 |
(not:SI (xor:SI (match_operand:SI 1 "register_or_zero_operand" "%rJ") |
| 5585 |
(match_operand:SI 2 "arith_operand" "rI"))) |
| 5586 |
(const_int 0))) |
| 5587 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5588 |
(not:SI (xor:SI (match_dup 1) (match_dup 2))))] |
| 5589 |
"" |
| 5590 |
"xnorcc\t%r1, %2, %0" |
| 5591 |
[(set_attr "type" "compare")]) |
| 5592 |
|
| 5593 |
(define_insn "*cmp_ccx_xor_not_set" |
| 5594 |
[(set (reg:CCX CC_REG) |
| 5595 |
(compare:CCX |
| 5596 |
(not:DI (xor:DI (match_operand:DI 1 "register_or_zero_operand" "%rJ") |
| 5597 |
(match_operand:DI 2 "arith_operand" "rI"))) |
| 5598 |
(const_int 0))) |
| 5599 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5600 |
(not:DI (xor:DI (match_dup 1) (match_dup 2))))] |
| 5601 |
"TARGET_ARCH64" |
| 5602 |
"xnorcc\t%r1, %2, %0" |
| 5603 |
[(set_attr "type" "compare")]) |
| 5604 |
|
| 5605 |
(define_insn "*cmp_cc_arith_op_not" |
| 5606 |
[(set (reg:CC CC_REG) |
| 5607 |
(compare:CC (match_operator:SI 2 "cc_arith_not_operator" |
| 5608 |
[(not:SI (match_operand:SI 0 "arith_operand" "rI")) |
| 5609 |
(match_operand:SI 1 "register_or_zero_operand" "rJ")]) |
| 5610 |
(const_int 0)))] |
| 5611 |
"" |
| 5612 |
"%B2cc\t%r1, %0, %%g0" |
| 5613 |
[(set_attr "type" "compare")]) |
| 5614 |
|
| 5615 |
(define_insn "*cmp_ccx_arith_op_not" |
| 5616 |
[(set (reg:CCX CC_REG) |
| 5617 |
(compare:CCX (match_operator:DI 2 "cc_arith_not_operator" |
| 5618 |
[(not:DI (match_operand:DI 0 "arith_operand" "rI")) |
| 5619 |
(match_operand:DI 1 "register_or_zero_operand" "rJ")]) |
| 5620 |
(const_int 0)))] |
| 5621 |
"TARGET_ARCH64" |
| 5622 |
"%B2cc\t%r1, %0, %%g0" |
| 5623 |
[(set_attr "type" "compare")]) |
| 5624 |
|
| 5625 |
(define_insn "*cmp_cc_arith_op_not_set" |
| 5626 |
[(set (reg:CC CC_REG) |
| 5627 |
(compare:CC (match_operator:SI 3 "cc_arith_not_operator" |
| 5628 |
[(not:SI (match_operand:SI 1 "arith_operand" "rI")) |
| 5629 |
(match_operand:SI 2 "register_or_zero_operand" "rJ")]) |
| 5630 |
(const_int 0))) |
| 5631 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5632 |
(match_operator:SI 4 "cc_arith_not_operator" |
| 5633 |
[(not:SI (match_dup 1)) (match_dup 2)]))] |
| 5634 |
"GET_CODE (operands[3]) == GET_CODE (operands[4])" |
| 5635 |
"%B3cc\t%r2, %1, %0" |
| 5636 |
[(set_attr "type" "compare")]) |
| 5637 |
|
| 5638 |
(define_insn "*cmp_ccx_arith_op_not_set" |
| 5639 |
[(set (reg:CCX CC_REG) |
| 5640 |
(compare:CCX (match_operator:DI 3 "cc_arith_not_operator" |
| 5641 |
[(not:DI (match_operand:DI 1 "arith_operand" "rI")) |
| 5642 |
(match_operand:DI 2 "register_or_zero_operand" "rJ")]) |
| 5643 |
(const_int 0))) |
| 5644 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5645 |
(match_operator:DI 4 "cc_arith_not_operator" |
| 5646 |
[(not:DI (match_dup 1)) (match_dup 2)]))] |
| 5647 |
"TARGET_ARCH64 && GET_CODE (operands[3]) == GET_CODE (operands[4])" |
| 5648 |
"%B3cc\t%r2, %1, %0" |
| 5649 |
[(set_attr "type" "compare")]) |
| 5650 |
|
| 5651 |
;; We cannot use the "neg" pseudo insn because the Sun assembler |
| 5652 |
;; does not know how to make it work for constants. |
| 5653 |
|
| 5654 |
(define_expand "negdi2" |
| 5655 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5656 |
(neg:DI (match_operand:DI 1 "register_operand" "r")))] |
| 5657 |
"" |
| 5658 |
{ |
| 5659 |
if (TARGET_ARCH32) |
| 5660 |
{ |
| 5661 |
emit_insn (gen_negdi2_sp32 (operands[0], operands[1])); |
| 5662 |
DONE; |
| 5663 |
} |
| 5664 |
}) |
| 5665 |
|
| 5666 |
(define_expand "unegvdi3" |
| 5667 |
[(parallel [(set (reg:CCXC CC_REG) |
| 5668 |
(compare:CCXC (not:DI (match_operand:DI 1 "register_operand" "")) |
| 5669 |
(const_int -1))) |
| 5670 |
(set (match_operand:DI 0 "register_operand" "") |
| 5671 |
(neg:DI (match_dup 1)))]) |
| 5672 |
(set (pc) |
| 5673 |
(if_then_else (ltu (reg:CCXC CC_REG) (const_int 0)) |
| 5674 |
(label_ref (match_operand 2 "")) |
| 5675 |
(pc)))] |
| 5676 |
"" |
| 5677 |
{ |
| 5678 |
if (TARGET_ARCH32) |
| 5679 |
{ |
| 5680 |
emit_insn (gen_unegvdi3_sp32 (operands[0], operands[1])); |
| 5681 |
rtx x = gen_rtx_LTU (VOIDmode, gen_rtx_REG (CCCmode, SPARC_ICC_REG), |
| 5682 |
const0_rtx); |
| 5683 |
emit_jump_insn (gen_cbranchcc4 (x, XEXP (x, 0), XEXP (x, 1), operands[2])); |
| 5684 |
DONE; |
| 5685 |
} |
| 5686 |
}) |
| 5687 |
|
| 5688 |
(define_expand "negvdi3" |
| 5689 |
[(parallel [(set (reg:CCXV CC_REG) |
| 5690 |
(compare:CCXV (neg:DI (match_operand:DI 1 "register_operand" "")) |
| 5691 |
(unspec:DI [(match_dup 1)] UNSPEC_NEGV))) |
| 5692 |
(set (match_operand:DI 0 "register_operand" "") |
| 5693 |
(neg:DI (match_dup 1)))]) |
| 5694 |
(set (pc) |
| 5695 |
(if_then_else (ne (reg:CCXV CC_REG) (const_int 0)) |
| 5696 |
(label_ref (match_operand 2 "")) |
| 5697 |
(pc)))] |
| 5698 |
"" |
| 5699 |
{ |
| 5700 |
if (TARGET_ARCH32) |
| 5701 |
{ |
| 5702 |
emit_insn (gen_negvdi3_sp32 (operands[0], operands[1])); |
| 5703 |
rtx x = gen_rtx_NE (VOIDmode, gen_rtx_REG (CCVmode, SPARC_ICC_REG), |
| 5704 |
const0_rtx); |
| 5705 |
emit_jump_insn (gen_cbranchcc4 (x, XEXP (x, 0), XEXP (x, 1), operands[2])); |
| 5706 |
DONE; |
| 5707 |
} |
| 5708 |
}) |
| 5709 |
|
| 5710 |
(define_insn_and_split "negdi2_sp32" |
| 5711 |
[(set (match_operand:DI 0 "register_operand" "=&r") |
| 5712 |
(neg:DI (match_operand:DI 1 "register_operand" "r"))) |
| 5713 |
(clobber (reg:CC CC_REG))] |
| 5714 |
"TARGET_ARCH32" |
| 5715 |
"#" |
| 5716 |
"&& reload_completed" |
| 5717 |
[(parallel [(set (reg:CCC CC_REG) |
| 5718 |
(compare:CCC (not:SI (match_dup 5)) (const_int -1))) |
| 5719 |
(set (match_dup 4) (neg:SI (match_dup 5)))]) |
| 5720 |
(set (match_dup 2) (minus:SI (minus:SI (const_int 0) (match_dup 3)) |
| 5721 |
(ltu:SI (reg:CCC CC_REG) (const_int 0))))] |
| 5722 |
"operands[2] = gen_highpart (SImode, operands[0]); |
| 5723 |
operands[3] = gen_highpart (SImode, operands[1]); |
| 5724 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 5725 |
operands[5] = gen_lowpart (SImode, operands[1]);" |
| 5726 |
[(set_attr "length" "2")]) |
| 5727 |
|
| 5728 |
(define_insn_and_split "unegvdi3_sp32" |
| 5729 |
[(set (reg:CCC CC_REG) |
| 5730 |
(compare:CCC (not:DI (match_operand:DI 1 "register_operand" "r")) |
| 5731 |
(const_int -1))) |
| 5732 |
(set (match_operand:DI 0 "register_operand" "=&r") |
| 5733 |
(neg:DI (match_dup 1)))] |
| 5734 |
"TARGET_ARCH32" |
| 5735 |
"#" |
| 5736 |
"&& reload_completed" |
| 5737 |
[(parallel [(set (reg:CCC CC_REG) |
| 5738 |
(compare:CCC (not:SI (match_dup 5)) (const_int -1))) |
| 5739 |
(set (match_dup 4) (neg:SI (match_dup 5)))]) |
| 5740 |
(parallel [(set (reg:CCC CC_REG) |
| 5741 |
(compare:CCC (zero_extend:DI |
| 5742 |
(neg:SI (plus:SI (match_dup 3) |
| 5743 |
(ltu:SI (reg:CCC CC_REG) |
| 5744 |
(const_int 0))))) |
| 5745 |
(neg:DI (plus:DI (zero_extend:DI (match_dup 3)) |
| 5746 |
(ltu:DI (reg:CCC CC_REG) |
| 5747 |
(const_int 0)))))) |
| 5748 |
(set (match_dup 2) (neg:SI (plus:SI (match_dup 3) |
| 5749 |
(ltu:SI (reg:CCC CC_REG) |
| 5750 |
(const_int 0)))))])] |
| 5751 |
"operands[2] = gen_highpart (SImode, operands[0]); |
| 5752 |
operands[3] = gen_highpart (SImode, operands[1]); |
| 5753 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 5754 |
operands[5] = gen_lowpart (SImode, operands[1]);" |
| 5755 |
[(set_attr "length" "2")]) |
| 5756 |
|
| 5757 |
(define_insn_and_split "negvdi3_sp32" |
| 5758 |
[(set (reg:CCV CC_REG) |
| 5759 |
(compare:CCV (neg:DI (match_operand:DI 1 "register_operand" "r")) |
| 5760 |
(unspec:DI [(match_dup 1)] UNSPEC_NEGV))) |
| 5761 |
(set (match_operand:DI 0 "register_operand" "=&r") |
| 5762 |
(neg:DI (match_dup 1)))] |
| 5763 |
"TARGET_ARCH32" |
| 5764 |
"#" |
| 5765 |
"&& reload_completed" |
| 5766 |
[(parallel [(set (reg:CCC CC_REG) |
| 5767 |
(compare:CCC (not:SI (match_dup 5)) (const_int -1))) |
| 5768 |
(set (match_dup 4) (neg:SI (match_dup 5)))]) |
| 5769 |
(parallel [(set (reg:CCV CC_REG) |
| 5770 |
(compare:CCV (neg:SI (plus:SI (match_dup 3) |
| 5771 |
(ltu:SI (reg:CCC CC_REG) |
| 5772 |
(const_int 0)))) |
| 5773 |
(unspec:SI [(plus:SI (match_dup 3) |
| 5774 |
(ltu:SI (reg:CCC CC_REG) |
| 5775 |
(const_int 0)))] |
| 5776 |
UNSPEC_NEGV))) |
| 5777 |
(set (match_dup 2) (neg:SI (plus:SI (match_dup 3) |
| 5778 |
(ltu:SI (reg:CCC CC_REG) |
| 5779 |
(const_int 0)))))])] |
| 5780 |
"operands[2] = gen_highpart (SImode, operands[0]); |
| 5781 |
operands[3] = gen_highpart (SImode, operands[1]); |
| 5782 |
operands[4] = gen_lowpart (SImode, operands[0]); |
| 5783 |
operands[5] = gen_lowpart (SImode, operands[1]);" |
| 5784 |
[(set_attr "length" "2")]) |
| 5785 |
|
| 5786 |
(define_insn "*negdi2_sp64" |
| 5787 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5788 |
(neg:DI (match_operand:DI 1 "register_operand" "r")))] |
| 5789 |
"TARGET_ARCH64" |
| 5790 |
"sub\t%%g0, %1, %0") |
| 5791 |
|
| 5792 |
(define_insn "negsi2" |
| 5793 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5794 |
(neg:SI (match_operand:SI 1 "register_operand" "r")))] |
| 5795 |
"" |
| 5796 |
"sub\t%%g0, %1, %0") |
| 5797 |
|
| 5798 |
(define_expand "unegvsi3" |
| 5799 |
[(parallel [(set (reg:CCC CC_REG) |
| 5800 |
(compare:CCC (not:SI (match_operand:SI 1 "register_operand" "")) |
| 5801 |
(const_int -1))) |
| 5802 |
(set (match_operand:SI 0 "register_operand" "") |
| 5803 |
(neg:SI (match_dup 1)))]) |
| 5804 |
(set (pc) |
| 5805 |
(if_then_else (ltu (reg:CCC CC_REG) (const_int 0)) |
| 5806 |
(label_ref (match_operand 2 "")) |
| 5807 |
(pc)))] |
| 5808 |
"") |
| 5809 |
|
| 5810 |
(define_expand "negvsi3" |
| 5811 |
[(parallel [(set (reg:CCV CC_REG) |
| 5812 |
(compare:CCV (neg:SI (match_operand:SI 1 "register_operand" "")) |
| 5813 |
(unspec:SI [(match_dup 1)] UNSPEC_NEGV))) |
| 5814 |
(set (match_operand:SI 0 "register_operand" "") |
| 5815 |
(neg:SI (match_dup 1)))]) |
| 5816 |
(set (pc) |
| 5817 |
(if_then_else (ne (reg:CCV CC_REG) (const_int 0)) |
| 5818 |
(label_ref (match_operand 2 "")) |
| 5819 |
(pc)))] |
| 5820 |
"") |
| 5821 |
|
| 5822 |
(define_insn "*cmp_ccnz_neg" |
| 5823 |
[(set (reg:CCNZ CC_REG) |
| 5824 |
(compare:CCNZ (neg:SI (match_operand:SI 0 "register_operand" "r")) |
| 5825 |
(const_int 0)))] |
| 5826 |
"" |
| 5827 |
"subcc\t%%g0, %0, %%g0" |
| 5828 |
[(set_attr "type" "compare")]) |
| 5829 |
|
| 5830 |
(define_insn "*cmp_ccxnz_neg" |
| 5831 |
[(set (reg:CCXNZ CC_REG) |
| 5832 |
(compare:CCXNZ (neg:DI (match_operand:DI 0 "register_operand" "r")) |
| 5833 |
(const_int 0)))] |
| 5834 |
"TARGET_ARCH64" |
| 5835 |
"subcc\t%%g0, %0, %%g0" |
| 5836 |
[(set_attr "type" "compare")]) |
| 5837 |
|
| 5838 |
(define_insn "*cmp_ccnz_neg_set" |
| 5839 |
[(set (reg:CCNZ CC_REG) |
| 5840 |
(compare:CCNZ (neg:SI (match_operand:SI 1 "register_operand" "r")) |
| 5841 |
(const_int 0))) |
| 5842 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5843 |
(neg:SI (match_dup 1)))] |
| 5844 |
"" |
| 5845 |
"subcc\t%%g0, %1, %0" |
| 5846 |
[(set_attr "type" "compare")]) |
| 5847 |
|
| 5848 |
(define_insn "*cmp_ccxnz_neg_set" |
| 5849 |
[(set (reg:CCXNZ CC_REG) |
| 5850 |
(compare:CCXNZ (neg:DI (match_operand:DI 1 "register_operand" "r")) |
| 5851 |
(const_int 0))) |
| 5852 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5853 |
(neg:DI (match_dup 1)))] |
| 5854 |
"TARGET_ARCH64" |
| 5855 |
"subcc\t%%g0, %1, %0" |
| 5856 |
[(set_attr "type" "compare")]) |
| 5857 |
|
| 5858 |
(define_insn "*cmp_ccc_neg_set" |
| 5859 |
[(set (reg:CCC CC_REG) |
| 5860 |
(compare:CCC (not:SI (match_operand:SI 1 "register_operand" "r")) |
| 5861 |
(const_int -1))) |
| 5862 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5863 |
(neg:SI (match_dup 1)))] |
| 5864 |
"" |
| 5865 |
"subcc\t%%g0, %1, %0" |
| 5866 |
[(set_attr "type" "compare")]) |
| 5867 |
|
| 5868 |
(define_insn "*cmp_ccxc_neg_set" |
| 5869 |
[(set (reg:CCXC CC_REG) |
| 5870 |
(compare:CCXC (not:DI (match_operand:DI 1 "register_operand" "r")) |
| 5871 |
(const_int -1))) |
| 5872 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5873 |
(neg:DI (match_dup 1)))] |
| 5874 |
"TARGET_ARCH64" |
| 5875 |
"subcc\t%%g0, %1, %0" |
| 5876 |
[(set_attr "type" "compare")]) |
| 5877 |
|
| 5878 |
(define_insn "*cmp_ccc_neg_sltu_set" |
| 5879 |
[(set (reg:CCC CC_REG) |
| 5880 |
(compare:CCC (zero_extend:DI |
| 5881 |
(neg:SI (plus:SI (match_operand:SI 1 "register_operand" "r") |
| 5882 |
(ltu:SI (reg:CCC CC_REG) |
| 5883 |
(const_int 0))))) |
| 5884 |
(neg:DI (plus:DI (zero_extend:DI (match_dup 1)) |
| 5885 |
(ltu:DI (reg:CCC CC_REG) |
| 5886 |
(const_int 0)))))) |
| 5887 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5888 |
(neg:SI (plus:SI (match_dup 1) |
| 5889 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))))] |
| 5890 |
"" |
| 5891 |
"subxcc\t%%g0, %1, %0" |
| 5892 |
[(set_attr "type" "compare")]) |
| 5893 |
|
| 5894 |
(define_insn "*cmp_ccv_neg" |
| 5895 |
[(set (reg:CCV CC_REG) |
| 5896 |
(compare:CCV (neg:SI (match_operand:SI 0 "register_operand" "r")) |
| 5897 |
(unspec:SI [(match_dup 0)] UNSPEC_NEGV)))] |
| 5898 |
"" |
| 5899 |
"subcc\t%%g0, %0, %%g0" |
| 5900 |
[(set_attr "type" "compare")]) |
| 5901 |
|
| 5902 |
(define_insn "*cmp_ccxv_neg" |
| 5903 |
[(set (reg:CCXV CC_REG) |
| 5904 |
(compare:CCXV (neg:DI (match_operand:DI 0 "register_operand" "r")) |
| 5905 |
(unspec:DI [(match_dup 0)] UNSPEC_NEGV)))] |
| 5906 |
"TARGET_ARCH64" |
| 5907 |
"subcc\t%%g0, %0, %%g0" |
| 5908 |
[(set_attr "type" "compare")]) |
| 5909 |
|
| 5910 |
(define_insn "*cmp_ccv_neg_set" |
| 5911 |
[(set (reg:CCV CC_REG) |
| 5912 |
(compare:CCV (neg:SI (match_operand:SI 1 "register_operand" "r")) |
| 5913 |
(unspec:SI [(match_dup 1)] UNSPEC_NEGV))) |
| 5914 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5915 |
(neg:SI (match_dup 1)))] |
| 5916 |
"" |
| 5917 |
"subcc\t%%g0, %1, %0" |
| 5918 |
[(set_attr "type" "compare")]) |
| 5919 |
|
| 5920 |
(define_insn "*cmp_ccxv_neg_set" |
| 5921 |
[(set (reg:CCXV CC_REG) |
| 5922 |
(compare:CCXV (neg:DI (match_operand:DI 1 "register_operand" "r")) |
| 5923 |
(unspec:DI [(match_dup 1)] UNSPEC_NEGV))) |
| 5924 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5925 |
(neg:DI (match_dup 1)))] |
| 5926 |
"TARGET_ARCH64" |
| 5927 |
"subcc\t%%g0, %1, %0" |
| 5928 |
[(set_attr "type" "compare")]) |
| 5929 |
|
| 5930 |
(define_insn "*cmp_ccv_neg_sltu_set" |
| 5931 |
[(set (reg:CCV CC_REG) |
| 5932 |
(compare:CCV (neg:SI (plus:SI (match_operand:SI 1 "register_operand" "r") |
| 5933 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))) |
| 5934 |
(unspec:SI [(plus:SI (match_dup 1) |
| 5935 |
(ltu:SI (reg:CCC CC_REG) |
| 5936 |
(const_int 0)))] |
| 5937 |
UNSPEC_NEGV))) |
| 5938 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5939 |
(neg:SI (plus:SI (match_dup 1) |
| 5940 |
(ltu:SI (reg:CCC CC_REG) (const_int 0)))))] |
| 5941 |
"" |
| 5942 |
"subxcc\t%%g0, %1, %0" |
| 5943 |
[(set_attr "type" "compare")]) |
| 5944 |
|
| 5945 |
|
| 5946 |
(define_insn "one_cmpldi2" |
| 5947 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 5948 |
(not:DI (match_operand:DI 1 "arith_operand" "rI")))] |
| 5949 |
"TARGET_ARCH64" |
| 5950 |
"xnor\t%%g0, %1, %0") |
| 5951 |
|
| 5952 |
(define_insn "one_cmplsi2" |
| 5953 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5954 |
(not:SI (match_operand:SI 1 "arith_operand" "rI")))] |
| 5955 |
"" |
| 5956 |
"xnor\t%%g0, %1, %0") |
| 5957 |
|
| 5958 |
(define_insn "*cmp_cc_not" |
| 5959 |
[(set (reg:CC CC_REG) |
| 5960 |
(compare:CC (not:SI (match_operand:SI 0 "arith_operand" "rI")) |
| 5961 |
(const_int 0)))] |
| 5962 |
"" |
| 5963 |
"xnorcc\t%%g0, %0, %%g0" |
| 5964 |
[(set_attr "type" "compare")]) |
| 5965 |
|
| 5966 |
(define_insn "*cmp_ccx_not" |
| 5967 |
[(set (reg:CCX CC_REG) |
| 5968 |
(compare:CCX (not:DI (match_operand:DI 0 "arith_operand" "rI")) |
| 5969 |
(const_int 0)))] |
| 5970 |
"TARGET_ARCH64" |
| 5971 |
"xnorcc\t%%g0, %0, %%g0" |
| 5972 |
[(set_attr "type" "compare")]) |
| 5973 |
|
| 5974 |
(define_insn "*cmp_cc_set_not" |
| 5975 |
[(set (reg:CC CC_REG) |
| 5976 |
(compare:CC (not:SI (match_operand:SI 1 "arith_operand" "rI")) |
| 5977 |
(const_int 0))) |
| 5978 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 5979 |
(not:SI (match_dup 1)))] |
| 5980 |
"" |
| 5981 |
"xnorcc\t%%g0, %1, %0" |
| 5982 |
[(set_attr "type" "compare")]) |
| 5983 |
|
| 5984 |
(define_insn "*cmp_ccx_set_not" |
| 5985 |
[(set (reg:CCX CC_REG) |
| 5986 |
(compare:CCX (not:DI (match_operand:DI 1 "arith_operand" "rI")) |
| 5987 |
(const_int 0))) |
| 5988 |
(set (match_operand:DI 0 "register_operand" "=r") |
| 5989 |
(not:DI (match_dup 1)))] |
| 5990 |
"TARGET_ARCH64" |
| 5991 |
"xnorcc\t%%g0, %1, %0" |
| 5992 |
[(set_attr "type" "compare")]) |
| 5993 |
|
| 5994 |
(define_insn "*cmp_cc_set" |
| 5995 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 5996 |
(match_operand:SI 1 "register_operand" "r")) |
| 5997 |
(set (reg:CC CC_REG) |
| 5998 |
(compare:CC (match_dup 1) (const_int 0)))] |
| 5999 |
"" |
| 6000 |
"orcc\t%1, 0, %0" |
| 6001 |
[(set_attr "type" "compare")]) |
| 6002 |
|
| 6003 |
(define_insn "*cmp_ccx_set64" |
| 6004 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6005 |
(match_operand:DI 1 "register_operand" "r")) |
| 6006 |
(set (reg:CCX CC_REG) |
| 6007 |
(compare:CCX (match_dup 1) (const_int 0)))] |
| 6008 |
"TARGET_ARCH64" |
| 6009 |
"orcc\t%1, 0, %0" |
| 6010 |
[(set_attr "type" "compare")]) |
| 6011 |
|
| 6012 |
|
| 6013 |
;; Floating point arithmetic instructions. |
| 6014 |
|
| 6015 |
(define_expand "addtf3" |
| 6016 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 6017 |
(plus:TF (match_operand:TF 1 "general_operand" "") |
| 6018 |
(match_operand:TF 2 "general_operand" "")))] |
| 6019 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 6020 |
"emit_tfmode_binop (PLUS, operands); DONE;") |
| 6021 |
|
| 6022 |
(define_insn "*addtf3_hq" |
| 6023 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6024 |
(plus:TF (match_operand:TF 1 "register_operand" "e") |
| 6025 |
(match_operand:TF 2 "register_operand" "e")))] |
| 6026 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6027 |
"faddq\t%1, %2, %0" |
| 6028 |
[(set_attr "type" "fp")]) |
| 6029 |
|
| 6030 |
(define_insn "adddf3" |
| 6031 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6032 |
(plus:DF (match_operand:DF 1 "register_operand" "e") |
| 6033 |
(match_operand:DF 2 "register_operand" "e")))] |
| 6034 |
"TARGET_FPU" |
| 6035 |
"faddd\t%1, %2, %0" |
| 6036 |
[(set_attr "type" "fp") |
| 6037 |
(set_attr "fptype" "double")]) |
| 6038 |
|
| 6039 |
(define_insn "addsf3" |
| 6040 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6041 |
(plus:SF (match_operand:SF 1 "register_operand" "f") |
| 6042 |
(match_operand:SF 2 "register_operand" "f")))] |
| 6043 |
"TARGET_FPU" |
| 6044 |
"fadds\t%1, %2, %0" |
| 6045 |
[(set_attr "type" "fp")]) |
| 6046 |
|
| 6047 |
(define_expand "subtf3" |
| 6048 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 6049 |
(minus:TF (match_operand:TF 1 "general_operand" "") |
| 6050 |
(match_operand:TF 2 "general_operand" "")))] |
| 6051 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 6052 |
"emit_tfmode_binop (MINUS, operands); DONE;") |
| 6053 |
|
| 6054 |
(define_insn "*subtf3_hq" |
| 6055 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6056 |
(minus:TF (match_operand:TF 1 "register_operand" "e") |
| 6057 |
(match_operand:TF 2 "register_operand" "e")))] |
| 6058 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6059 |
"fsubq\t%1, %2, %0" |
| 6060 |
[(set_attr "type" "fp")]) |
| 6061 |
|
| 6062 |
(define_insn "subdf3" |
| 6063 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6064 |
(minus:DF (match_operand:DF 1 "register_operand" "e") |
| 6065 |
(match_operand:DF 2 "register_operand" "e")))] |
| 6066 |
"TARGET_FPU" |
| 6067 |
"fsubd\t%1, %2, %0" |
| 6068 |
[(set_attr "type" "fp") |
| 6069 |
(set_attr "fptype" "double")]) |
| 6070 |
|
| 6071 |
(define_insn "subsf3" |
| 6072 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6073 |
(minus:SF (match_operand:SF 1 "register_operand" "f") |
| 6074 |
(match_operand:SF 2 "register_operand" "f")))] |
| 6075 |
"TARGET_FPU" |
| 6076 |
"fsubs\t%1, %2, %0" |
| 6077 |
[(set_attr "type" "fp")]) |
| 6078 |
|
| 6079 |
(define_expand "multf3" |
| 6080 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 6081 |
(mult:TF (match_operand:TF 1 "general_operand" "") |
| 6082 |
(match_operand:TF 2 "general_operand" "")))] |
| 6083 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 6084 |
"emit_tfmode_binop (MULT, operands); DONE;") |
| 6085 |
|
| 6086 |
(define_insn "*multf3_hq" |
| 6087 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6088 |
(mult:TF (match_operand:TF 1 "register_operand" "e") |
| 6089 |
(match_operand:TF 2 "register_operand" "e")))] |
| 6090 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6091 |
"fmulq\t%1, %2, %0" |
| 6092 |
[(set_attr "type" "fpmul")]) |
| 6093 |
|
| 6094 |
(define_insn "muldf3" |
| 6095 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6096 |
(mult:DF (match_operand:DF 1 "register_operand" "e") |
| 6097 |
(match_operand:DF 2 "register_operand" "e")))] |
| 6098 |
"TARGET_FPU" |
| 6099 |
"fmuld\t%1, %2, %0" |
| 6100 |
[(set_attr "type" "fpmul") |
| 6101 |
(set_attr "fptype" "double")]) |
| 6102 |
|
| 6103 |
(define_insn "mulsf3" |
| 6104 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6105 |
(mult:SF (match_operand:SF 1 "register_operand" "f") |
| 6106 |
(match_operand:SF 2 "register_operand" "f")))] |
| 6107 |
"TARGET_FPU" |
| 6108 |
"fmuls\t%1, %2, %0" |
| 6109 |
[(set_attr "type" "fpmul")]) |
| 6110 |
|
| 6111 |
(define_insn "fmadf4" |
| 6112 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6113 |
(fma:DF (match_operand:DF 1 "register_operand" "e") |
| 6114 |
(match_operand:DF 2 "register_operand" "e") |
| 6115 |
(match_operand:DF 3 "register_operand" "e")))] |
| 6116 |
"TARGET_FMAF" |
| 6117 |
"fmaddd\t%1, %2, %3, %0" |
| 6118 |
[(set_attr "type" "fpmul")]) |
| 6119 |
|
| 6120 |
(define_insn "fmsdf4" |
| 6121 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6122 |
(fma:DF (match_operand:DF 1 "register_operand" "e") |
| 6123 |
(match_operand:DF 2 "register_operand" "e") |
| 6124 |
(neg:DF (match_operand:DF 3 "register_operand" "e"))))] |
| 6125 |
"TARGET_FMAF" |
| 6126 |
"fmsubd\t%1, %2, %3, %0" |
| 6127 |
[(set_attr "type" "fpmul")]) |
| 6128 |
|
| 6129 |
(define_insn "*nfmadf4" |
| 6130 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6131 |
(neg:DF (fma:DF (match_operand:DF 1 "register_operand" "e") |
| 6132 |
(match_operand:DF 2 "register_operand" "e") |
| 6133 |
(match_operand:DF 3 "register_operand" "e"))))] |
| 6134 |
"TARGET_FMAF" |
| 6135 |
"fnmaddd\t%1, %2, %3, %0" |
| 6136 |
[(set_attr "type" "fpmul")]) |
| 6137 |
|
| 6138 |
(define_insn "*nfmsdf4" |
| 6139 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6140 |
(neg:DF (fma:DF (match_operand:DF 1 "register_operand" "e") |
| 6141 |
(match_operand:DF 2 "register_operand" "e") |
| 6142 |
(neg:DF (match_operand:DF 3 "register_operand" "e")))))] |
| 6143 |
"TARGET_FMAF" |
| 6144 |
"fnmsubd\t%1, %2, %3, %0" |
| 6145 |
[(set_attr "type" "fpmul")]) |
| 6146 |
|
| 6147 |
(define_insn "fmasf4" |
| 6148 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6149 |
(fma:SF (match_operand:SF 1 "register_operand" "f") |
| 6150 |
(match_operand:SF 2 "register_operand" "f") |
| 6151 |
(match_operand:SF 3 "register_operand" "f")))] |
| 6152 |
"TARGET_FMAF" |
| 6153 |
"fmadds\t%1, %2, %3, %0" |
| 6154 |
[(set_attr "type" "fpmul")]) |
| 6155 |
|
| 6156 |
(define_insn "fmssf4" |
| 6157 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6158 |
(fma:SF (match_operand:SF 1 "register_operand" "f") |
| 6159 |
(match_operand:SF 2 "register_operand" "f") |
| 6160 |
(neg:SF (match_operand:SF 3 "register_operand" "f"))))] |
| 6161 |
"TARGET_FMAF" |
| 6162 |
"fmsubs\t%1, %2, %3, %0" |
| 6163 |
[(set_attr "type" "fpmul")]) |
| 6164 |
|
| 6165 |
(define_insn "*nfmasf4" |
| 6166 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6167 |
(neg:SF (fma:SF (match_operand:SF 1 "register_operand" "f") |
| 6168 |
(match_operand:SF 2 "register_operand" "f") |
| 6169 |
(match_operand:SF 3 "register_operand" "f"))))] |
| 6170 |
"TARGET_FMAF" |
| 6171 |
"fnmadds\t%1, %2, %3, %0" |
| 6172 |
[(set_attr "type" "fpmul")]) |
| 6173 |
|
| 6174 |
(define_insn "*nfmssf4" |
| 6175 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6176 |
(neg:SF (fma:SF (match_operand:SF 1 "register_operand" "f") |
| 6177 |
(match_operand:SF 2 "register_operand" "f") |
| 6178 |
(neg:SF (match_operand:SF 3 "register_operand" "f")))))] |
| 6179 |
"TARGET_FMAF" |
| 6180 |
"fnmsubs\t%1, %2, %3, %0" |
| 6181 |
[(set_attr "type" "fpmul")]) |
| 6182 |
|
| 6183 |
(define_insn "*muldf3_extend" |
| 6184 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6185 |
(mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "f")) |
| 6186 |
(float_extend:DF (match_operand:SF 2 "register_operand" "f"))))] |
| 6187 |
"TARGET_FSMULD" |
| 6188 |
"fsmuld\t%1, %2, %0" |
| 6189 |
[(set_attr "type" "fpmul") |
| 6190 |
(set_attr "fptype" "double")]) |
| 6191 |
|
| 6192 |
(define_insn "*multf3_extend" |
| 6193 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6194 |
(mult:TF (float_extend:TF (match_operand:DF 1 "register_operand" "e")) |
| 6195 |
(float_extend:TF (match_operand:DF 2 "register_operand" "e"))))] |
| 6196 |
"(TARGET_V8 || TARGET_V9) && TARGET_FPU && TARGET_HARD_QUAD" |
| 6197 |
"fdmulq\t%1, %2, %0" |
| 6198 |
[(set_attr "type" "fpmul")]) |
| 6199 |
|
| 6200 |
(define_expand "divtf3" |
| 6201 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 6202 |
(div:TF (match_operand:TF 1 "general_operand" "") |
| 6203 |
(match_operand:TF 2 "general_operand" "")))] |
| 6204 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 6205 |
"emit_tfmode_binop (DIV, operands); DONE;") |
| 6206 |
|
| 6207 |
;; don't have timing for quad-prec. divide. |
| 6208 |
(define_insn "*divtf3_hq" |
| 6209 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6210 |
(div:TF (match_operand:TF 1 "register_operand" "e") |
| 6211 |
(match_operand:TF 2 "register_operand" "e")))] |
| 6212 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6213 |
"fdivq\t%1, %2, %0" |
| 6214 |
[(set_attr "type" "fpdivs")]) |
| 6215 |
|
| 6216 |
(define_expand "divdf3" |
| 6217 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6218 |
(div:DF (match_operand:DF 1 "register_operand" "e") |
| 6219 |
(match_operand:DF 2 "register_operand" "e")))] |
| 6220 |
"TARGET_FPU" |
| 6221 |
"") |
| 6222 |
|
| 6223 |
(define_insn "*divdf3_nofix" |
| 6224 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6225 |
(div:DF (match_operand:DF 1 "register_operand" "e") |
| 6226 |
(match_operand:DF 2 "register_operand" "e")))] |
| 6227 |
"TARGET_FPU && !sparc_fix_ut699" |
| 6228 |
"fdivd\t%1, %2, %0" |
| 6229 |
[(set_attr "type" "fpdivd") |
| 6230 |
(set_attr "fptype" "double")]) |
| 6231 |
|
| 6232 |
(define_insn "*divdf3_fix" |
| 6233 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6234 |
(div:DF (match_operand:DF 1 "register_operand" "e") |
| 6235 |
(match_operand:DF 2 "register_operand" "e")))] |
| 6236 |
"TARGET_FPU && sparc_fix_ut699" |
| 6237 |
"fdivd\t%1, %2, %0\n\tstd\t%0, [%%sp-8]\n\tnop" |
| 6238 |
[(set_attr "type" "fpdivd") |
| 6239 |
(set_attr "fptype" "double") |
| 6240 |
(set_attr "length" "3")]) |
| 6241 |
|
| 6242 |
(define_insn "divsf3" |
| 6243 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6244 |
(div:SF (match_operand:SF 1 "register_operand" "f") |
| 6245 |
(match_operand:SF 2 "register_operand" "f")))] |
| 6246 |
"TARGET_FPU && !sparc_fix_ut699" |
| 6247 |
"fdivs\t%1, %2, %0" |
| 6248 |
[(set_attr "type" "fpdivs")]) |
| 6249 |
|
| 6250 |
(define_expand "negtf2" |
| 6251 |
[(set (match_operand:TF 0 "register_operand" "") |
| 6252 |
(neg:TF (match_operand:TF 1 "register_operand" "")))] |
| 6253 |
"TARGET_FPU" |
| 6254 |
"") |
| 6255 |
|
| 6256 |
(define_insn "*negtf2_hq" |
| 6257 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6258 |
(neg:TF (match_operand:TF 1 "register_operand" "e")))] |
| 6259 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6260 |
"fnegq\t%1, %0" |
| 6261 |
[(set_attr "type" "fpmove")]) |
| 6262 |
|
| 6263 |
(define_insn_and_split "*negtf2" |
| 6264 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6265 |
(neg:TF (match_operand:TF 1 "register_operand" "e")))] |
| 6266 |
"TARGET_FPU && !TARGET_HARD_QUAD" |
| 6267 |
"#" |
| 6268 |
"&& reload_completed" |
| 6269 |
[(clobber (const_int 0))] |
| 6270 |
{ |
| 6271 |
rtx set_dest = operands[0]; |
| 6272 |
rtx set_src = operands[1]; |
| 6273 |
rtx dest1, dest2; |
| 6274 |
rtx src1, src2; |
| 6275 |
|
| 6276 |
dest1 = gen_df_reg (set_dest, 0); |
| 6277 |
dest2 = gen_df_reg (set_dest, 1); |
| 6278 |
src1 = gen_df_reg (set_src, 0); |
| 6279 |
src2 = gen_df_reg (set_src, 1); |
| 6280 |
|
| 6281 |
/* Now emit using the real source and destination we found, swapping |
| 6282 |
the order if we detect overlap. */ |
| 6283 |
if (reg_overlap_mentioned_p (dest1, src2)) |
| 6284 |
{ |
| 6285 |
emit_insn (gen_movdf (dest2, src2)); |
| 6286 |
emit_insn (gen_negdf2 (dest1, src1)); |
| 6287 |
} |
| 6288 |
else |
| 6289 |
{ |
| 6290 |
emit_insn (gen_negdf2 (dest1, src1)); |
| 6291 |
if (REGNO (dest2) != REGNO (src2)) |
| 6292 |
emit_insn (gen_movdf (dest2, src2)); |
| 6293 |
} |
| 6294 |
DONE; |
| 6295 |
} |
| 6296 |
[(set_attr "length" "2")]) |
| 6297 |
|
| 6298 |
(define_expand "negdf2" |
| 6299 |
[(set (match_operand:DF 0 "register_operand" "") |
| 6300 |
(neg:DF (match_operand:DF 1 "register_operand" "")))] |
| 6301 |
"TARGET_FPU" |
| 6302 |
"") |
| 6303 |
|
| 6304 |
(define_insn_and_split "*negdf2_notv9" |
| 6305 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6306 |
(neg:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6307 |
"TARGET_FPU && !TARGET_V9" |
| 6308 |
"#" |
| 6309 |
"&& reload_completed" |
| 6310 |
[(clobber (const_int 0))] |
| 6311 |
{ |
| 6312 |
rtx set_dest = operands[0]; |
| 6313 |
rtx set_src = operands[1]; |
| 6314 |
rtx dest1, dest2; |
| 6315 |
rtx src1, src2; |
| 6316 |
|
| 6317 |
dest1 = gen_highpart (SFmode, set_dest); |
| 6318 |
dest2 = gen_lowpart (SFmode, set_dest); |
| 6319 |
src1 = gen_highpart (SFmode, set_src); |
| 6320 |
src2 = gen_lowpart (SFmode, set_src); |
| 6321 |
|
| 6322 |
/* Now emit using the real source and destination we found, swapping |
| 6323 |
the order if we detect overlap. */ |
| 6324 |
if (reg_overlap_mentioned_p (dest1, src2)) |
| 6325 |
{ |
| 6326 |
emit_insn (gen_movsf (dest2, src2)); |
| 6327 |
emit_insn (gen_negsf2 (dest1, src1)); |
| 6328 |
} |
| 6329 |
else |
| 6330 |
{ |
| 6331 |
emit_insn (gen_negsf2 (dest1, src1)); |
| 6332 |
if (REGNO (dest2) != REGNO (src2)) |
| 6333 |
emit_insn (gen_movsf (dest2, src2)); |
| 6334 |
} |
| 6335 |
DONE; |
| 6336 |
} |
| 6337 |
[(set_attr "length" "2")]) |
| 6338 |
|
| 6339 |
(define_insn "*negdf2_v9" |
| 6340 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6341 |
(neg:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6342 |
"TARGET_FPU && TARGET_V9" |
| 6343 |
"fnegd\t%1, %0" |
| 6344 |
[(set_attr "type" "fpmove") |
| 6345 |
(set_attr "fptype" "double")]) |
| 6346 |
|
| 6347 |
(define_insn "negsf2" |
| 6348 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6349 |
(neg:SF (match_operand:SF 1 "register_operand" "f")))] |
| 6350 |
"TARGET_FPU" |
| 6351 |
"fnegs\t%1, %0" |
| 6352 |
[(set_attr "type" "fpmove")]) |
| 6353 |
|
| 6354 |
(define_expand "abstf2" |
| 6355 |
[(set (match_operand:TF 0 "register_operand" "") |
| 6356 |
(abs:TF (match_operand:TF 1 "register_operand" "")))] |
| 6357 |
"TARGET_FPU" |
| 6358 |
"") |
| 6359 |
|
| 6360 |
(define_insn "*abstf2_hq" |
| 6361 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6362 |
(abs:TF (match_operand:TF 1 "register_operand" "e")))] |
| 6363 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6364 |
"fabsq\t%1, %0" |
| 6365 |
[(set_attr "type" "fpmove")]) |
| 6366 |
|
| 6367 |
(define_insn_and_split "*abstf2" |
| 6368 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6369 |
(abs:TF (match_operand:TF 1 "register_operand" "e")))] |
| 6370 |
"TARGET_FPU && !TARGET_HARD_QUAD" |
| 6371 |
"#" |
| 6372 |
"&& reload_completed" |
| 6373 |
[(clobber (const_int 0))] |
| 6374 |
{ |
| 6375 |
rtx set_dest = operands[0]; |
| 6376 |
rtx set_src = operands[1]; |
| 6377 |
rtx dest1, dest2; |
| 6378 |
rtx src1, src2; |
| 6379 |
|
| 6380 |
dest1 = gen_df_reg (set_dest, 0); |
| 6381 |
dest2 = gen_df_reg (set_dest, 1); |
| 6382 |
src1 = gen_df_reg (set_src, 0); |
| 6383 |
src2 = gen_df_reg (set_src, 1); |
| 6384 |
|
| 6385 |
/* Now emit using the real source and destination we found, swapping |
| 6386 |
the order if we detect overlap. */ |
| 6387 |
if (reg_overlap_mentioned_p (dest1, src2)) |
| 6388 |
{ |
| 6389 |
emit_insn (gen_movdf (dest2, src2)); |
| 6390 |
emit_insn (gen_absdf2 (dest1, src1)); |
| 6391 |
} |
| 6392 |
else |
| 6393 |
{ |
| 6394 |
emit_insn (gen_absdf2 (dest1, src1)); |
| 6395 |
if (REGNO (dest2) != REGNO (src2)) |
| 6396 |
emit_insn (gen_movdf (dest2, src2)); |
| 6397 |
} |
| 6398 |
DONE; |
| 6399 |
} |
| 6400 |
[(set_attr "length" "2")]) |
| 6401 |
|
| 6402 |
(define_expand "absdf2" |
| 6403 |
[(set (match_operand:DF 0 "register_operand" "") |
| 6404 |
(abs:DF (match_operand:DF 1 "register_operand" "")))] |
| 6405 |
"TARGET_FPU" |
| 6406 |
"") |
| 6407 |
|
| 6408 |
(define_insn_and_split "*absdf2_notv9" |
| 6409 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6410 |
(abs:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6411 |
"TARGET_FPU && !TARGET_V9" |
| 6412 |
"#" |
| 6413 |
"&& reload_completed" |
| 6414 |
[(clobber (const_int 0))] |
| 6415 |
{ |
| 6416 |
rtx set_dest = operands[0]; |
| 6417 |
rtx set_src = operands[1]; |
| 6418 |
rtx dest1, dest2; |
| 6419 |
rtx src1, src2; |
| 6420 |
|
| 6421 |
dest1 = gen_highpart (SFmode, set_dest); |
| 6422 |
dest2 = gen_lowpart (SFmode, set_dest); |
| 6423 |
src1 = gen_highpart (SFmode, set_src); |
| 6424 |
src2 = gen_lowpart (SFmode, set_src); |
| 6425 |
|
| 6426 |
/* Now emit using the real source and destination we found, swapping |
| 6427 |
the order if we detect overlap. */ |
| 6428 |
if (reg_overlap_mentioned_p (dest1, src2)) |
| 6429 |
{ |
| 6430 |
emit_insn (gen_movsf (dest2, src2)); |
| 6431 |
emit_insn (gen_abssf2 (dest1, src1)); |
| 6432 |
} |
| 6433 |
else |
| 6434 |
{ |
| 6435 |
emit_insn (gen_abssf2 (dest1, src1)); |
| 6436 |
if (REGNO (dest2) != REGNO (src2)) |
| 6437 |
emit_insn (gen_movsf (dest2, src2)); |
| 6438 |
} |
| 6439 |
DONE; |
| 6440 |
} |
| 6441 |
[(set_attr "length" "2")]) |
| 6442 |
|
| 6443 |
(define_insn "*absdf2_v9" |
| 6444 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6445 |
(abs:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6446 |
"TARGET_FPU && TARGET_V9" |
| 6447 |
"fabsd\t%1, %0" |
| 6448 |
[(set_attr "type" "fpmove") |
| 6449 |
(set_attr "fptype" "double")]) |
| 6450 |
|
| 6451 |
(define_insn "abssf2" |
| 6452 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6453 |
(abs:SF (match_operand:SF 1 "register_operand" "f")))] |
| 6454 |
"TARGET_FPU" |
| 6455 |
"fabss\t%1, %0" |
| 6456 |
[(set_attr "type" "fpmove")]) |
| 6457 |
|
| 6458 |
(define_expand "sqrttf2" |
| 6459 |
[(set (match_operand:TF 0 "nonimmediate_operand" "") |
| 6460 |
(sqrt:TF (match_operand:TF 1 "general_operand" "")))] |
| 6461 |
"TARGET_FPU && (TARGET_HARD_QUAD || TARGET_ARCH64)" |
| 6462 |
"emit_tfmode_unop (SQRT, operands); DONE;") |
| 6463 |
|
| 6464 |
(define_insn "*sqrttf2_hq" |
| 6465 |
[(set (match_operand:TF 0 "register_operand" "=e") |
| 6466 |
(sqrt:TF (match_operand:TF 1 "register_operand" "e")))] |
| 6467 |
"TARGET_FPU && TARGET_HARD_QUAD" |
| 6468 |
"fsqrtq\t%1, %0" |
| 6469 |
[(set_attr "type" "fpsqrts")]) |
| 6470 |
|
| 6471 |
(define_expand "sqrtdf2" |
| 6472 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6473 |
(sqrt:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6474 |
"TARGET_FPU" |
| 6475 |
"") |
| 6476 |
|
| 6477 |
(define_insn "*sqrtdf2_nofix" |
| 6478 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6479 |
(sqrt:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6480 |
"TARGET_FPU && !sparc_fix_ut699" |
| 6481 |
"fsqrtd\t%1, %0" |
| 6482 |
[(set_attr "type" "fpsqrtd") |
| 6483 |
(set_attr "fptype" "double")]) |
| 6484 |
|
| 6485 |
(define_insn "*sqrtdf2_fix" |
| 6486 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 6487 |
(sqrt:DF (match_operand:DF 1 "register_operand" "e")))] |
| 6488 |
"TARGET_FPU && sparc_fix_ut699" |
| 6489 |
"fsqrtd\t%1, %0\n\tstd\t%0, [%%sp-8]\n\tnop" |
| 6490 |
[(set_attr "type" "fpsqrtd") |
| 6491 |
(set_attr "fptype" "double") |
| 6492 |
(set_attr "length" "3")]) |
| 6493 |
|
| 6494 |
(define_insn "sqrtsf2" |
| 6495 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 6496 |
(sqrt:SF (match_operand:SF 1 "register_operand" "f")))] |
| 6497 |
"TARGET_FPU && !sparc_fix_ut699" |
| 6498 |
"fsqrts\t%1, %0" |
| 6499 |
[(set_attr "type" "fpsqrts")]) |
| 6500 |
|
| 6501 |
|
| 6502 |
;; Arithmetic shift instructions. |
| 6503 |
|
| 6504 |
(define_insn "ashlsi3" |
| 6505 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6506 |
(ashift:SI (match_operand:SI 1 "register_operand" "r") |
| 6507 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6508 |
"" |
| 6509 |
{ |
| 6510 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6511 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); |
| 6512 |
return "sll\t%1, %2, %0"; |
| 6513 |
} |
| 6514 |
[(set_attr "type" "shift")]) |
| 6515 |
|
| 6516 |
(define_expand "ashldi3" |
| 6517 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6518 |
(ashift:DI (match_operand:DI 1 "register_operand" "r") |
| 6519 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6520 |
"TARGET_ARCH64 || TARGET_V8PLUS" |
| 6521 |
{ |
| 6522 |
if (TARGET_ARCH32) |
| 6523 |
{ |
| 6524 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6525 |
FAIL; |
| 6526 |
emit_insn (gen_ashldi3_v8plus (operands[0], operands[1], operands[2])); |
| 6527 |
DONE; |
| 6528 |
} |
| 6529 |
}) |
| 6530 |
|
| 6531 |
(define_insn "*ashldi3_sp64" |
| 6532 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6533 |
(ashift:DI (match_operand:DI 1 "register_operand" "r") |
| 6534 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6535 |
"TARGET_ARCH64" |
| 6536 |
{ |
| 6537 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6538 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); |
| 6539 |
return "sllx\t%1, %2, %0"; |
| 6540 |
} |
| 6541 |
[(set_attr "type" "shift")]) |
| 6542 |
|
| 6543 |
(define_insn "ashldi3_v8plus" |
| 6544 |
[(set (match_operand:DI 0 "register_operand" "=&h,&h,r") |
| 6545 |
(ashift:DI (match_operand:DI 1 "arith_operand" "rI,0,rI") |
| 6546 |
(match_operand:SI 2 "arith_operand" "rI,rI,rI"))) |
| 6547 |
(clobber (match_scratch:SI 3 "=X,X,&h"))] |
| 6548 |
"TARGET_V8PLUS" |
| 6549 |
{ |
| 6550 |
return output_v8plus_shift (insn ,operands, \"sllx\"); |
| 6551 |
} |
| 6552 |
[(set_attr "type" "multi") |
| 6553 |
(set_attr "length" "5,5,6")]) |
| 6554 |
|
| 6555 |
(define_insn "*cmp_ccnz_ashift_1" |
| 6556 |
[(set (reg:CCNZ CC_REG) |
| 6557 |
(compare:CCNZ (ashift:SI (match_operand:SI 0 "register_operand" "r") |
| 6558 |
(const_int 1)) |
| 6559 |
(const_int 0)))] |
| 6560 |
"" |
| 6561 |
"addcc\t%0, %0, %%g0" |
| 6562 |
[(set_attr "type" "compare")]) |
| 6563 |
|
| 6564 |
(define_insn "*cmp_ccnz_set_ashift_1" |
| 6565 |
[(set (reg:CCNZ CC_REG) |
| 6566 |
(compare:CCNZ (ashift:SI (match_operand:SI 1 "register_operand" "r") |
| 6567 |
(const_int 1)) |
| 6568 |
(const_int 0))) |
| 6569 |
(set (match_operand:SI 0 "register_operand" "=r") |
| 6570 |
(ashift:SI (match_dup 1) (const_int 1)))] |
| 6571 |
"" |
| 6572 |
"addcc\t%1, %1, %0" |
| 6573 |
[(set_attr "type" "compare")]) |
| 6574 |
|
| 6575 |
(define_insn "ashrsi3" |
| 6576 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6577 |
(ashiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 6578 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6579 |
"" |
| 6580 |
{ |
| 6581 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6582 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); |
| 6583 |
return "sra\t%1, %2, %0"; |
| 6584 |
} |
| 6585 |
[(set_attr "type" "shift")]) |
| 6586 |
|
| 6587 |
(define_insn "*ashrsi3_extend0" |
| 6588 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6589 |
(sign_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 6590 |
(match_operand:SI 2 "arith_operand" "rI"))))] |
| 6591 |
"TARGET_ARCH64" |
| 6592 |
{ |
| 6593 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6594 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); |
| 6595 |
return "sra\t%1, %2, %0"; |
| 6596 |
} |
| 6597 |
[(set_attr "type" "shift")]) |
| 6598 |
|
| 6599 |
;; This handles the case where |
| 6600 |
;; (sign_extend:DI (ashiftrt:SI (match_operand:SI) (match_operand:SI))) |
| 6601 |
;; but combiner "simplifies" it for us. |
| 6602 |
(define_insn "*ashrsi3_extend1" |
| 6603 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6604 |
(ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 1 "register_operand" "r") 0) |
| 6605 |
(const_int 32)) |
| 6606 |
(match_operand:SI 2 "small_int_operand" "I")))] |
| 6607 |
"TARGET_ARCH64 && INTVAL (operands[2]) >= 32 && INTVAL (operands[2]) < 64" |
| 6608 |
{ |
| 6609 |
operands[2] = GEN_INT (INTVAL (operands[2]) - 32); |
| 6610 |
return "sra\t%1, %2, %0"; |
| 6611 |
} |
| 6612 |
[(set_attr "type" "shift")]) |
| 6613 |
|
| 6614 |
;; This handles the case where |
| 6615 |
;; (ashiftrt:DI (sign_extend:DI (match_operand:SI)) (const_int)) |
| 6616 |
;; but combiner "simplifies" it for us. |
| 6617 |
(define_insn "*ashrsi3_extend2" |
| 6618 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6619 |
(sign_extract:DI (subreg:DI (match_operand:SI 1 "register_operand" "r") 0) |
| 6620 |
(match_operand 2 "small_int_operand" "I") |
| 6621 |
(const_int 32)))] |
| 6622 |
"TARGET_ARCH64 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 32" |
| 6623 |
{ |
| 6624 |
operands[2] = GEN_INT (32 - INTVAL (operands[2])); |
| 6625 |
return "sra\t%1, %2, %0"; |
| 6626 |
} |
| 6627 |
[(set_attr "type" "shift")]) |
| 6628 |
|
| 6629 |
(define_expand "ashrdi3" |
| 6630 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6631 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6632 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6633 |
"TARGET_ARCH64 || TARGET_V8PLUS" |
| 6634 |
{ |
| 6635 |
if (TARGET_ARCH32) |
| 6636 |
{ |
| 6637 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6638 |
FAIL; /* prefer generic code in this case */ |
| 6639 |
emit_insn (gen_ashrdi3_v8plus (operands[0], operands[1], operands[2])); |
| 6640 |
DONE; |
| 6641 |
} |
| 6642 |
}) |
| 6643 |
|
| 6644 |
(define_insn "*ashrdi3_sp64" |
| 6645 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6646 |
(ashiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6647 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6648 |
"TARGET_ARCH64" |
| 6649 |
{ |
| 6650 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6651 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); |
| 6652 |
return "srax\t%1, %2, %0"; |
| 6653 |
} |
| 6654 |
[(set_attr "type" "shift")]) |
| 6655 |
|
| 6656 |
(define_insn "ashrdi3_v8plus" |
| 6657 |
[(set (match_operand:DI 0 "register_operand" "=&h,&h,r") |
| 6658 |
(ashiftrt:DI (match_operand:DI 1 "arith_operand" "rI,0,rI") |
| 6659 |
(match_operand:SI 2 "arith_operand" "rI,rI,rI"))) |
| 6660 |
(clobber (match_scratch:SI 3 "=X,X,&h"))] |
| 6661 |
"TARGET_V8PLUS" |
| 6662 |
{ |
| 6663 |
return output_v8plus_shift (insn, operands, \"srax\"); |
| 6664 |
} |
| 6665 |
[(set_attr "type" "multi") |
| 6666 |
(set_attr "length" "5,5,6")]) |
| 6667 |
|
| 6668 |
(define_insn "lshrsi3" |
| 6669 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6670 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 6671 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6672 |
"" |
| 6673 |
{ |
| 6674 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6675 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); |
| 6676 |
return "srl\t%1, %2, %0"; |
| 6677 |
} |
| 6678 |
[(set_attr "type" "shift")]) |
| 6679 |
|
| 6680 |
(define_insn "*lshrsi3_extend0" |
| 6681 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6682 |
(zero_extend:DI |
| 6683 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 6684 |
(match_operand:SI 2 "arith_operand" "rI"))))] |
| 6685 |
"TARGET_ARCH64" |
| 6686 |
{ |
| 6687 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6688 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); |
| 6689 |
return "srl\t%1, %2, %0"; |
| 6690 |
} |
| 6691 |
[(set_attr "type" "shift")]) |
| 6692 |
|
| 6693 |
;; This handles the case where |
| 6694 |
;; (zero_extend:DI (lshiftrt:SI (match_operand:SI) (match_operand:SI))) |
| 6695 |
;; but combiner "simplifies" it for us. |
| 6696 |
(define_insn "*lshrsi3_extend1" |
| 6697 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6698 |
(and:DI (subreg:DI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") |
| 6699 |
(match_operand:SI 2 "arith_operand" "rI")) 0) |
| 6700 |
(match_operand 3 "const_int_operand" "")))] |
| 6701 |
"TARGET_ARCH64 && (unsigned HOST_WIDE_INT) INTVAL (operands[3]) == 0xffffffff" |
| 6702 |
{ |
| 6703 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6704 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); |
| 6705 |
return "srl\t%1, %2, %0"; |
| 6706 |
} |
| 6707 |
[(set_attr "type" "shift")]) |
| 6708 |
|
| 6709 |
;; This handles the case where |
| 6710 |
;; (lshiftrt:DI (zero_extend:DI (match_operand:SI)) (const_int)) |
| 6711 |
;; but combiner "simplifies" it for us. |
| 6712 |
(define_insn "*lshrsi3_extend2" |
| 6713 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6714 |
(zero_extract:DI (subreg:DI (match_operand:SI 1 "register_operand" "r") 0) |
| 6715 |
(match_operand 2 "small_int_operand" "I") |
| 6716 |
(const_int 32)))] |
| 6717 |
"TARGET_ARCH64 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 32" |
| 6718 |
{ |
| 6719 |
operands[2] = GEN_INT (32 - INTVAL (operands[2])); |
| 6720 |
return "srl\t%1, %2, %0"; |
| 6721 |
} |
| 6722 |
[(set_attr "type" "shift")]) |
| 6723 |
|
| 6724 |
(define_expand "lshrdi3" |
| 6725 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6726 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6727 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6728 |
"TARGET_ARCH64 || TARGET_V8PLUS" |
| 6729 |
{ |
| 6730 |
if (TARGET_ARCH32) |
| 6731 |
{ |
| 6732 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6733 |
FAIL; |
| 6734 |
emit_insn (gen_lshrdi3_v8plus (operands[0], operands[1], operands[2])); |
| 6735 |
DONE; |
| 6736 |
} |
| 6737 |
}) |
| 6738 |
|
| 6739 |
(define_insn "*lshrdi3_sp64" |
| 6740 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 6741 |
(lshiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6742 |
(match_operand:SI 2 "arith_operand" "rI")))] |
| 6743 |
"TARGET_ARCH64" |
| 6744 |
{ |
| 6745 |
if (GET_CODE (operands[2]) == CONST_INT) |
| 6746 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); |
| 6747 |
return "srlx\t%1, %2, %0"; |
| 6748 |
} |
| 6749 |
[(set_attr "type" "shift")]) |
| 6750 |
|
| 6751 |
(define_insn "lshrdi3_v8plus" |
| 6752 |
[(set (match_operand:DI 0 "register_operand" "=&h,&h,r") |
| 6753 |
(lshiftrt:DI (match_operand:DI 1 "arith_operand" "rI,0,rI") |
| 6754 |
(match_operand:SI 2 "arith_operand" "rI,rI,rI"))) |
| 6755 |
(clobber (match_scratch:SI 3 "=X,X,&h"))] |
| 6756 |
"TARGET_V8PLUS" |
| 6757 |
{ |
| 6758 |
return output_v8plus_shift (insn, operands, \"srlx\"); |
| 6759 |
} |
| 6760 |
[(set_attr "type" "multi") |
| 6761 |
(set_attr "length" "5,5,6")]) |
| 6762 |
|
| 6763 |
(define_insn "" |
| 6764 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6765 |
(ashiftrt:SI (subreg:SI (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6766 |
(const_int 32)) 4) |
| 6767 |
(match_operand:SI 2 "small_int_operand" "I")))] |
| 6768 |
"TARGET_ARCH64 && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 32" |
| 6769 |
{ |
| 6770 |
operands[2] = GEN_INT (INTVAL (operands[2]) + 32); |
| 6771 |
return "srax\t%1, %2, %0"; |
| 6772 |
} |
| 6773 |
[(set_attr "type" "shift")]) |
| 6774 |
|
| 6775 |
(define_insn "" |
| 6776 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6777 |
(lshiftrt:SI (subreg:SI (ashiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6778 |
(const_int 32)) 4) |
| 6779 |
(match_operand:SI 2 "small_int_operand" "I")))] |
| 6780 |
"TARGET_ARCH64 && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 32" |
| 6781 |
{ |
| 6782 |
operands[2] = GEN_INT (INTVAL (operands[2]) + 32); |
| 6783 |
return "srlx\t%1, %2, %0"; |
| 6784 |
} |
| 6785 |
[(set_attr "type" "shift")]) |
| 6786 |
|
| 6787 |
(define_insn "" |
| 6788 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6789 |
(ashiftrt:SI (subreg:SI (ashiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6790 |
(match_operand:SI 2 "small_int_operand" "I")) 4) |
| 6791 |
(match_operand:SI 3 "small_int_operand" "I")))] |
| 6792 |
"TARGET_ARCH64 |
| 6793 |
&& (unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 32 |
| 6794 |
&& (unsigned HOST_WIDE_INT) INTVAL (operands[3]) < 32 |
| 6795 |
&& (unsigned HOST_WIDE_INT) (INTVAL (operands[2]) + INTVAL (operands[3])) < 64" |
| 6796 |
{ |
| 6797 |
operands[2] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[3])); |
| 6798 |
|
| 6799 |
return "srax\t%1, %2, %0"; |
| 6800 |
} |
| 6801 |
[(set_attr "type" "shift")]) |
| 6802 |
|
| 6803 |
(define_insn "" |
| 6804 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 6805 |
(lshiftrt:SI (subreg:SI (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") |
| 6806 |
(match_operand:SI 2 "small_int_operand" "I")) 4) |
| 6807 |
(match_operand:SI 3 "small_int_operand" "I")))] |
| 6808 |
"TARGET_ARCH64 |
| 6809 |
&& (unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 32 |
| 6810 |
&& (unsigned HOST_WIDE_INT) INTVAL (operands[3]) < 32 |
| 6811 |
&& (unsigned HOST_WIDE_INT) (INTVAL (operands[2]) + INTVAL (operands[3])) < 64" |
| 6812 |
{ |
| 6813 |
operands[2] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[3])); |
| 6814 |
|
| 6815 |
return "srlx\t%1, %2, %0"; |
| 6816 |
} |
| 6817 |
[(set_attr "type" "shift")]) |
| 6818 |
|
| 6819 |
|
| 6820 |
;; Unconditional and other jump instructions. |
| 6821 |
|
| 6822 |
(define_expand "jump" |
| 6823 |
[(set (pc) (label_ref (match_operand 0 "" "")))] |
| 6824 |
"") |
| 6825 |
|
| 6826 |
(define_insn "*jump_ubranch" |
| 6827 |
[(set (pc) (label_ref (match_operand 0 "" "")))] |
| 6828 |
"!TARGET_CBCOND" |
| 6829 |
{ |
| 6830 |
return output_ubranch (operands[0], insn); |
| 6831 |
} |
| 6832 |
[(set_attr "type" "uncond_branch")]) |
| 6833 |
|
| 6834 |
(define_insn "*jump_cbcond" |
| 6835 |
[(set (pc) (label_ref (match_operand 0 "" "")))] |
| 6836 |
"TARGET_CBCOND" |
| 6837 |
{ |
| 6838 |
return output_ubranch (operands[0], insn); |
| 6839 |
} |
| 6840 |
[(set_attr "type" "uncond_cbcond")]) |
| 6841 |
|
| 6842 |
(define_expand "tablejump" |
| 6843 |
[(parallel [(set (pc) (match_operand 0 "register_operand" "r")) |
| 6844 |
(use (label_ref (match_operand 1 "" "")))])] |
| 6845 |
"" |
| 6846 |
{ |
| 6847 |
gcc_assert (GET_MODE (operands[0]) == CASE_VECTOR_MODE); |
| 6848 |
|
| 6849 |
/* In pic mode, our address differences are against the base of the |
| 6850 |
table. Add that base value back in; CSE ought to be able to combine |
| 6851 |
the two address loads. */ |
| 6852 |
if (flag_pic) |
| 6853 |
{ |
| 6854 |
rtx tmp, tmp2; |
| 6855 |
tmp = gen_rtx_LABEL_REF (Pmode, operands[1]); |
| 6856 |
tmp2 = operands[0]; |
| 6857 |
if (CASE_VECTOR_MODE != Pmode) |
| 6858 |
tmp2 = gen_rtx_SIGN_EXTEND (Pmode, tmp2); |
| 6859 |
tmp = gen_rtx_PLUS (Pmode, tmp2, tmp); |
| 6860 |
operands[0] = memory_address (Pmode, tmp); |
| 6861 |
} |
| 6862 |
}) |
| 6863 |
|
| 6864 |
(define_insn "*tablejump<P:mode>" |
| 6865 |
[(set (pc) (match_operand:P 0 "address_operand" "p")) |
| 6866 |
(use (label_ref (match_operand 1 "" "")))] |
| 6867 |
"" |
| 6868 |
"jmp\t%a0%#" |
| 6869 |
[(set_attr "type" "uncond_branch")]) |
| 6870 |
|
| 6871 |
|
| 6872 |
;; Jump to subroutine instructions. |
| 6873 |
|
| 6874 |
(define_expand "call" |
| 6875 |
;; Note that this expression is not used for generating RTL. |
| 6876 |
;; All the RTL is generated explicitly below. |
| 6877 |
[(call (match_operand 0 "call_operand" "") |
| 6878 |
(match_operand 3 "" "i"))] |
| 6879 |
;; operands[2] is next_arg_register |
| 6880 |
;; operands[3] is struct_value_size_rtx. |
| 6881 |
"" |
| 6882 |
{ |
| 6883 |
rtx fn_rtx; |
| 6884 |
|
| 6885 |
gcc_assert (MEM_P (operands[0]) && GET_MODE (operands[0]) == FUNCTION_MODE); |
| 6886 |
|
| 6887 |
gcc_assert (GET_CODE (operands[3]) == CONST_INT); |
| 6888 |
|
| 6889 |
if (GET_CODE (XEXP (operands[0], 0)) == LABEL_REF) |
| 6890 |
{ |
| 6891 |
/* This is really a PIC sequence. We want to represent |
| 6892 |
it as a funny jump so its delay slots can be filled. |
| 6893 |
|
| 6894 |
??? But if this really *is* a CALL, will not it clobber the |
| 6895 |
call-clobbered registers? We lose this if it is a JUMP_INSN. |
| 6896 |
Why cannot we have delay slots filled if it were a CALL? */ |
| 6897 |
|
| 6898 |
/* We accept negative sizes for untyped calls. */ |
| 6899 |
if (TARGET_ARCH32 && INTVAL (operands[3]) != 0) |
| 6900 |
emit_jump_insn |
| 6901 |
(gen_rtx_PARALLEL |
| 6902 |
(VOIDmode, |
| 6903 |
gen_rtvec (3, |
| 6904 |
gen_rtx_SET (pc_rtx, XEXP (operands[0], 0)), |
| 6905 |
operands[3], |
| 6906 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 15))))); |
| 6907 |
else |
| 6908 |
emit_jump_insn |
| 6909 |
(gen_rtx_PARALLEL |
| 6910 |
(VOIDmode, |
| 6911 |
gen_rtvec (2, |
| 6912 |
gen_rtx_SET (pc_rtx, XEXP (operands[0], 0)), |
| 6913 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 15))))); |
| 6914 |
goto finish_call; |
| 6915 |
} |
| 6916 |
|
| 6917 |
fn_rtx = operands[0]; |
| 6918 |
|
| 6919 |
/* We accept negative sizes for untyped calls. */ |
| 6920 |
if (TARGET_ARCH32 && INTVAL (operands[3]) != 0) |
| 6921 |
sparc_emit_call_insn |
| 6922 |
(gen_rtx_PARALLEL |
| 6923 |
(VOIDmode, |
| 6924 |
gen_rtvec (3, gen_rtx_CALL (VOIDmode, fn_rtx, const0_rtx), |
| 6925 |
operands[3], |
| 6926 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 15)))), |
| 6927 |
XEXP (fn_rtx, 0)); |
| 6928 |
else |
| 6929 |
sparc_emit_call_insn |
| 6930 |
(gen_rtx_PARALLEL |
| 6931 |
(VOIDmode, |
| 6932 |
gen_rtvec (2, gen_rtx_CALL (VOIDmode, fn_rtx, const0_rtx), |
| 6933 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 15)))), |
| 6934 |
XEXP (fn_rtx, 0)); |
| 6935 |
|
| 6936 |
finish_call: |
| 6937 |
|
| 6938 |
DONE; |
| 6939 |
}) |
| 6940 |
|
| 6941 |
;; We can't use the same pattern for these two insns, because then registers |
| 6942 |
;; in the address may not be properly reloaded. |
| 6943 |
|
| 6944 |
(define_insn "*call_address<P:mode>" |
| 6945 |
[(call (mem:P (match_operand:P 0 "address_operand" "p")) |
| 6946 |
(match_operand 1 "" "")) |
| 6947 |
(clobber (reg:P O7_REG))] |
| 6948 |
;;- Do not use operand 1 for most machines. |
| 6949 |
"" |
| 6950 |
"call\t%a0, %1%#" |
| 6951 |
[(set_attr "type" "call")]) |
| 6952 |
|
| 6953 |
(define_insn "*call_symbolic<P:mode>" |
| 6954 |
[(call (mem:P (match_operand:P 0 "symbolic_operand" "s")) |
| 6955 |
(match_operand 1 "" "")) |
| 6956 |
(clobber (reg:P O7_REG))] |
| 6957 |
;;- Do not use operand 1 for most machines. |
| 6958 |
"" |
| 6959 |
"call\t%a0, %1%#" |
| 6960 |
[(set_attr "type" "call")]) |
| 6961 |
|
| 6962 |
;; This is a call that wants a structure value. |
| 6963 |
;; There is no such critter for v9 (??? we may need one anyway). |
| 6964 |
(define_insn "*call_address_struct_value_sp32" |
| 6965 |
[(call (mem:SI (match_operand:SI 0 "address_operand" "p")) |
| 6966 |
(match_operand 1 "" "")) |
| 6967 |
(match_operand 2 "immediate_operand" "") |
| 6968 |
(clobber (reg:SI O7_REG))] |
| 6969 |
;;- Do not use operand 1 for most machines. |
| 6970 |
"TARGET_ARCH32 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) > 0" |
| 6971 |
{ |
| 6972 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0xfff); |
| 6973 |
return "call\t%a0, %1\n\t nop\n\tunimp\t%2"; |
| 6974 |
} |
| 6975 |
[(set_attr "type" "call_no_delay_slot") |
| 6976 |
(set_attr "length" "3")]) |
| 6977 |
|
| 6978 |
;; This is a call that wants a structure value. |
| 6979 |
;; There is no such critter for v9 (??? we may need one anyway). |
| 6980 |
(define_insn "*call_symbolic_struct_value_sp32" |
| 6981 |
[(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s")) |
| 6982 |
(match_operand 1 "" "")) |
| 6983 |
(match_operand 2 "immediate_operand" "") |
| 6984 |
(clobber (reg:SI O7_REG))] |
| 6985 |
;;- Do not use operand 1 for most machines. |
| 6986 |
"TARGET_ARCH32 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) > 0" |
| 6987 |
{ |
| 6988 |
operands[2] = GEN_INT (INTVAL (operands[2]) & 0xfff); |
| 6989 |
return "call\t%a0, %1\n\t nop\n\tunimp\t%2"; |
| 6990 |
} |
| 6991 |
[(set_attr "type" "call_no_delay_slot") |
| 6992 |
(set_attr "length" "3")]) |
| 6993 |
|
| 6994 |
;; This is a call that may want a structure value. This is used for |
| 6995 |
;; untyped_calls. |
| 6996 |
(define_insn "*call_address_untyped_struct_value_sp32" |
| 6997 |
[(call (mem:SI (match_operand:SI 0 "address_operand" "p")) |
| 6998 |
(match_operand 1 "" "")) |
| 6999 |
(match_operand 2 "immediate_operand" "") |
| 7000 |
(clobber (reg:SI O7_REG))] |
| 7001 |
;;- Do not use operand 1 for most machines. |
| 7002 |
"TARGET_ARCH32 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0" |
| 7003 |
"call\t%a0, %1\n\t nop\n\tnop" |
| 7004 |
[(set_attr "type" "call_no_delay_slot") |
| 7005 |
(set_attr "length" "3")]) |
| 7006 |
|
| 7007 |
;; This is a call that may want a structure value. This is used for |
| 7008 |
;; untyped_calls. |
| 7009 |
(define_insn "*call_symbolic_untyped_struct_value_sp32" |
| 7010 |
[(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s")) |
| 7011 |
(match_operand 1 "" "")) |
| 7012 |
(match_operand 2 "immediate_operand" "") |
| 7013 |
(clobber (reg:SI O7_REG))] |
| 7014 |
;;- Do not use operand 1 for most machines. |
| 7015 |
"TARGET_ARCH32 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0" |
| 7016 |
"call\t%a0, %1\n\t nop\n\tnop" |
| 7017 |
[(set_attr "type" "call_no_delay_slot") |
| 7018 |
(set_attr "length" "3")]) |
| 7019 |
|
| 7020 |
(define_expand "call_value" |
| 7021 |
;; Note that this expression is not used for generating RTL. |
| 7022 |
;; All the RTL is generated explicitly below. |
| 7023 |
[(set (match_operand 0 "register_operand" "") |
| 7024 |
(call (match_operand 1 "call_operand" "") |
| 7025 |
(match_operand 4 "" "")))] |
| 7026 |
;; operand 2 is stack_size_rtx |
| 7027 |
;; operand 3 is next_arg_register |
| 7028 |
"" |
| 7029 |
{ |
| 7030 |
rtx fn_rtx; |
| 7031 |
rtvec vec; |
| 7032 |
|
| 7033 |
gcc_assert (MEM_P (operands[1]) && GET_MODE (operands[1]) == FUNCTION_MODE); |
| 7034 |
|
| 7035 |
fn_rtx = operands[1]; |
| 7036 |
|
| 7037 |
vec = gen_rtvec (2, |
| 7038 |
gen_rtx_SET (operands[0], |
| 7039 |
gen_rtx_CALL (VOIDmode, fn_rtx, const0_rtx)), |
| 7040 |
gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 15))); |
| 7041 |
|
| 7042 |
sparc_emit_call_insn (gen_rtx_PARALLEL (VOIDmode, vec), XEXP (fn_rtx, 0)); |
| 7043 |
|
| 7044 |
DONE; |
| 7045 |
}) |
| 7046 |
|
| 7047 |
(define_insn "*call_value_address<P:mode>" |
| 7048 |
[(set (match_operand 0 "" "") |
| 7049 |
(call (mem:P (match_operand:P 1 "address_operand" "p")) |
| 7050 |
(match_operand 2 "" ""))) |
| 7051 |
(clobber (reg:P O7_REG))] |
| 7052 |
;;- Do not use operand 2 for most machines. |
| 7053 |
"" |
| 7054 |
"call\t%a1, %2%#" |
| 7055 |
[(set_attr "type" "call")]) |
| 7056 |
|
| 7057 |
(define_insn "*call_value_symbolic<P:mode>" |
| 7058 |
[(set (match_operand 0 "" "") |
| 7059 |
(call (mem:P (match_operand:P 1 "symbolic_operand" "s")) |
| 7060 |
(match_operand 2 "" ""))) |
| 7061 |
(clobber (reg:P O7_REG))] |
| 7062 |
;;- Do not use operand 2 for most machines. |
| 7063 |
"" |
| 7064 |
"call\t%a1, %2%#" |
| 7065 |
[(set_attr "type" "call")]) |
| 7066 |
|
| 7067 |
(define_expand "untyped_call" |
| 7068 |
[(parallel [(call (match_operand 0 "" "") |
| 7069 |
(const_int 0)) |
| 7070 |
(match_operand:BLK 1 "memory_operand" "") |
| 7071 |
(match_operand 2 "" "")])] |
| 7072 |
"" |
| 7073 |
{ |
| 7074 |
rtx valreg1 = gen_rtx_REG (DImode, 8); |
| 7075 |
rtx result = operands[1]; |
| 7076 |
|
| 7077 |
/* Pass constm1 to indicate that it may expect a structure value, but |
| 7078 |
we don't know what size it is. */ |
| 7079 |
emit_call_insn (gen_call (operands[0], const0_rtx, NULL, constm1_rtx)); |
| 7080 |
|
| 7081 |
/* Save the function value registers. */ |
| 7082 |
emit_move_insn (adjust_address (result, DImode, 0), valreg1); |
| 7083 |
if (TARGET_FPU) |
| 7084 |
{ |
| 7085 |
rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32); |
| 7086 |
emit_move_insn (adjust_address (result, TARGET_ARCH64 ? TFmode : DFmode, 8), |
| 7087 |
valreg2); |
| 7088 |
} |
| 7089 |
|
| 7090 |
/* The optimizer does not know that the call sets the function value |
| 7091 |
registers we stored in the result block. We avoid problems by |
| 7092 |
claiming that all hard registers are used and clobbered at this |
| 7093 |
point. */ |
| 7094 |
emit_insn (gen_blockage ()); |
| 7095 |
|
| 7096 |
DONE; |
| 7097 |
}) |
| 7098 |
|
| 7099 |
|
| 7100 |
;; Tail call instructions. |
| 7101 |
|
| 7102 |
(define_expand "sibcall" |
| 7103 |
[(parallel [(call (match_operand 0 "call_operand" "") (const_int 0)) |
| 7104 |
(return)])] |
| 7105 |
"" |
| 7106 |
"") |
| 7107 |
|
| 7108 |
(define_insn "*sibcall_symbolic<P:mode>" |
| 7109 |
[(call (mem:P (match_operand:P 0 "symbolic_operand" "s")) |
| 7110 |
(match_operand 1 "" "")) |
| 7111 |
(return)] |
| 7112 |
"" |
| 7113 |
{ |
| 7114 |
return output_sibcall (insn, operands[0]); |
| 7115 |
} |
| 7116 |
[(set_attr "type" "sibcall")]) |
| 7117 |
|
| 7118 |
(define_expand "sibcall_value" |
| 7119 |
[(parallel [(set (match_operand 0 "register_operand") |
| 7120 |
(call (match_operand 1 "call_operand" "") (const_int 0))) |
| 7121 |
(return)])] |
| 7122 |
"" |
| 7123 |
"") |
| 7124 |
|
| 7125 |
(define_insn "*sibcall_value_symbolic<P:mode>" |
| 7126 |
[(set (match_operand 0 "" "") |
| 7127 |
(call (mem:P (match_operand:P 1 "symbolic_operand" "s")) |
| 7128 |
(match_operand 2 "" ""))) |
| 7129 |
(return)] |
| 7130 |
"" |
| 7131 |
{ |
| 7132 |
return output_sibcall (insn, operands[1]); |
| 7133 |
} |
| 7134 |
[(set_attr "type" "sibcall")]) |
| 7135 |
|
| 7136 |
|
| 7137 |
;; Special instructions. |
| 7138 |
|
| 7139 |
(define_expand "prologue" |
| 7140 |
[(const_int 0)] |
| 7141 |
"" |
| 7142 |
{ |
| 7143 |
if (TARGET_FLAT) |
| 7144 |
sparc_flat_expand_prologue (); |
| 7145 |
else |
| 7146 |
sparc_expand_prologue (); |
| 7147 |
DONE; |
| 7148 |
}) |
| 7149 |
|
| 7150 |
;; The "register window save" insn is modelled as follows. The dwarf2 |
| 7151 |
;; information is manually added in emit_window_save. |
| 7152 |
|
| 7153 |
(define_insn "window_save" |
| 7154 |
[(unspec_volatile [(match_operand 0 "arith_operand" "rI")] UNSPECV_SAVEW)] |
| 7155 |
"!TARGET_FLAT" |
| 7156 |
"save\t%%sp, %0, %%sp" |
| 7157 |
[(set_attr "type" "savew")]) |
| 7158 |
|
| 7159 |
(define_expand "epilogue" |
| 7160 |
[(return)] |
| 7161 |
"" |
| 7162 |
{ |
| 7163 |
if (TARGET_FLAT) |
| 7164 |
sparc_flat_expand_epilogue (false); |
| 7165 |
else |
| 7166 |
sparc_expand_epilogue (false); |
| 7167 |
}) |
| 7168 |
|
| 7169 |
(define_expand "sibcall_epilogue" |
| 7170 |
[(return)] |
| 7171 |
"" |
| 7172 |
{ |
| 7173 |
if (TARGET_FLAT) |
| 7174 |
sparc_flat_expand_epilogue (false); |
| 7175 |
else |
| 7176 |
sparc_expand_epilogue (false); |
| 7177 |
DONE; |
| 7178 |
}) |
| 7179 |
|
| 7180 |
(define_expand "eh_return" |
| 7181 |
[(use (match_operand 0 "general_operand" ""))] |
| 7182 |
"" |
| 7183 |
{ |
| 7184 |
emit_move_insn (gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM), operands[0]); |
| 7185 |
emit_jump_insn (gen_eh_return_internal ()); |
| 7186 |
emit_barrier (); |
| 7187 |
DONE; |
| 7188 |
}) |
| 7189 |
|
| 7190 |
(define_insn_and_split "eh_return_internal" |
| 7191 |
[(eh_return)] |
| 7192 |
"" |
| 7193 |
"#" |
| 7194 |
"epilogue_completed" |
| 7195 |
[(return)] |
| 7196 |
{ |
| 7197 |
if (TARGET_FLAT) |
| 7198 |
sparc_flat_expand_epilogue (true); |
| 7199 |
else |
| 7200 |
sparc_expand_epilogue (true); |
| 7201 |
}) |
| 7202 |
|
| 7203 |
(define_expand "return" |
| 7204 |
[(return)] |
| 7205 |
"sparc_can_use_return_insn_p ()" |
| 7206 |
{ |
| 7207 |
if (cfun->calls_alloca) |
| 7208 |
emit_insn (gen_frame_blockage ()); |
| 7209 |
}) |
| 7210 |
|
| 7211 |
(define_insn "*return_internal" |
| 7212 |
[(return)] |
| 7213 |
"" |
| 7214 |
{ |
| 7215 |
return output_return (insn); |
| 7216 |
} |
| 7217 |
[(set_attr "type" "return") |
| 7218 |
(set (attr "length") |
| 7219 |
(cond [(eq_attr "calls_eh_return" "true") |
| 7220 |
(if_then_else (eq_attr "delayed_branch" "true") |
| 7221 |
(if_then_else (ior (eq_attr "isa" "v9") |
| 7222 |
(eq_attr "flat" "true")) |
| 7223 |
(const_int 2) |
| 7224 |
(const_int 3)) |
| 7225 |
(if_then_else (eq_attr "flat" "true") |
| 7226 |
(const_int 3) |
| 7227 |
(const_int 4))) |
| 7228 |
(ior (eq_attr "leaf_function" "true") (eq_attr "flat" "true")) |
| 7229 |
(if_then_else (eq_attr "empty_delay_slot" "true") |
| 7230 |
(const_int 2) |
| 7231 |
(const_int 1)) |
| 7232 |
(eq_attr "empty_delay_slot" "true") |
| 7233 |
(if_then_else (eq_attr "delayed_branch" "true") |
| 7234 |
(const_int 2) |
| 7235 |
(const_int 3)) |
| 7236 |
] (const_int 1)))]) |
| 7237 |
|
| 7238 |
;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and |
| 7239 |
;; all of memory. This blocks insns from being moved across this point. |
| 7240 |
|
| 7241 |
(define_insn "blockage" |
| 7242 |
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)] |
| 7243 |
"" |
| 7244 |
"" |
| 7245 |
[(set_attr "length" "0")]) |
| 7246 |
|
| 7247 |
;; Do not schedule instructions accessing memory before this point. |
| 7248 |
|
| 7249 |
(define_expand "frame_blockage" |
| 7250 |
[(set (match_dup 0) |
| 7251 |
(unspec:BLK [(match_dup 1)] UNSPEC_FRAME_BLOCKAGE))] |
| 7252 |
"" |
| 7253 |
{ |
| 7254 |
operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); |
| 7255 |
MEM_VOLATILE_P (operands[0]) = 1; |
| 7256 |
operands[1] = stack_pointer_rtx; |
| 7257 |
}) |
| 7258 |
|
| 7259 |
(define_insn "*frame_blockage<P:mode>" |
| 7260 |
[(set (match_operand:BLK 0 "" "") |
| 7261 |
(unspec:BLK [(match_operand:P 1 "" "")] UNSPEC_FRAME_BLOCKAGE))] |
| 7262 |
"" |
| 7263 |
"" |
| 7264 |
[(set_attr "length" "0")]) |
| 7265 |
|
| 7266 |
;; We use membar #Sync for the speculation barrier on V9. |
| 7267 |
|
| 7268 |
(define_insn "speculation_barrier" |
| 7269 |
[(unspec_volatile [(const_int 0)] UNSPECV_SPECULATION_BARRIER)] |
| 7270 |
"TARGET_V9" |
| 7271 |
"membar\t64" |
| 7272 |
[(set_attr "type" "multi")]) |
| 7273 |
|
| 7274 |
(define_expand "probe_stack" |
| 7275 |
[(set (match_operand 0 "memory_operand" "") (const_int 0))] |
| 7276 |
"" |
| 7277 |
{ |
| 7278 |
operands[0] |
| 7279 |
= adjust_address (operands[0], GET_MODE (operands[0]), SPARC_STACK_BIAS); |
| 7280 |
}) |
| 7281 |
|
| 7282 |
(define_insn "@probe_stack_range<P:mode>" |
| 7283 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7284 |
(unspec_volatile:P [(match_operand:P 1 "register_operand" "0") |
| 7285 |
(match_operand:P 2 "register_operand" "r")] |
| 7286 |
UNSPECV_PROBE_STACK_RANGE))] |
| 7287 |
"" |
| 7288 |
{ |
| 7289 |
return output_probe_stack_range (operands[0], operands[2]); |
| 7290 |
} |
| 7291 |
[(set_attr "type" "multi")]) |
| 7292 |
|
| 7293 |
;; Prepare to return any type including a structure value. |
| 7294 |
|
| 7295 |
(define_expand "untyped_return" |
| 7296 |
[(match_operand:BLK 0 "memory_operand" "") |
| 7297 |
(match_operand 1 "" "")] |
| 7298 |
"" |
| 7299 |
{ |
| 7300 |
rtx valreg1 = gen_rtx_REG (DImode, 24); |
| 7301 |
rtx result = operands[0]; |
| 7302 |
|
| 7303 |
if (TARGET_ARCH32) |
| 7304 |
{ |
| 7305 |
rtx rtnreg = gen_rtx_REG (SImode, RETURN_ADDR_REGNUM); |
| 7306 |
rtx value = gen_reg_rtx (SImode); |
| 7307 |
|
| 7308 |
/* Fetch the instruction where we will return to and see if it's an unimp |
| 7309 |
instruction (the most significant 10 bits will be zero). If so, |
| 7310 |
update the return address to skip the unimp instruction. */ |
| 7311 |
emit_move_insn (value, |
| 7312 |
gen_rtx_MEM (SImode, plus_constant (SImode, rtnreg, 8))); |
| 7313 |
emit_insn (gen_lshrsi3 (value, value, GEN_INT (22))); |
| 7314 |
emit_insn (gen_update_return (rtnreg, value)); |
| 7315 |
} |
| 7316 |
|
| 7317 |
/* Reload the function value registers. |
| 7318 |
Put USE insns before the return. */ |
| 7319 |
emit_move_insn (valreg1, adjust_address (result, DImode, 0)); |
| 7320 |
emit_use (valreg1); |
| 7321 |
|
| 7322 |
if (TARGET_FPU) |
| 7323 |
{ |
| 7324 |
rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32); |
| 7325 |
emit_move_insn (valreg2, |
| 7326 |
adjust_address (result, TARGET_ARCH64 ? TFmode : DFmode, 8)); |
| 7327 |
emit_use (valreg2); |
| 7328 |
} |
| 7329 |
|
| 7330 |
/* Construct the return. */ |
| 7331 |
expand_naked_return (); |
| 7332 |
|
| 7333 |
DONE; |
| 7334 |
}) |
| 7335 |
|
| 7336 |
;; Adjust the return address conditionally. If the value of op1 is equal |
| 7337 |
;; to all zero then adjust the return address i.e. op0 = op0 + 4. |
| 7338 |
;; This is technically *half* the check required by the 32-bit SPARC |
| 7339 |
;; psABI. This check only ensures that an "unimp" insn was written by |
| 7340 |
;; the caller, but doesn't check to see if the expected size matches |
| 7341 |
;; (this is encoded in the 12 lower bits). This check is obsolete and |
| 7342 |
;; only used by the above code "untyped_return". |
| 7343 |
|
| 7344 |
(define_insn "update_return" |
| 7345 |
[(unspec:SI [(match_operand:SI 0 "register_operand" "r") |
| 7346 |
(match_operand:SI 1 "register_operand" "r")] UNSPEC_UPDATE_RETURN)] |
| 7347 |
"TARGET_ARCH32" |
| 7348 |
{ |
| 7349 |
if (flag_delayed_branch) |
| 7350 |
return "cmp\t%1, 0\n\tbe,a\t.+8\n\t add\t%0, 4, %0"; |
| 7351 |
else |
| 7352 |
return "cmp\t%1, 0\n\tbne\t.+12\n\t nop\n\tadd\t%0, 4, %0"; |
| 7353 |
} |
| 7354 |
[(set (attr "type") (const_string "multi")) |
| 7355 |
(set (attr "length") |
| 7356 |
(if_then_else (eq_attr "delayed_branch" "true") |
| 7357 |
(const_int 3) |
| 7358 |
(const_int 4)))]) |
| 7359 |
|
| 7360 |
(define_insn "nop" |
| 7361 |
[(const_int 0)] |
| 7362 |
"" |
| 7363 |
"nop") |
| 7364 |
|
| 7365 |
(define_expand "indirect_jump" |
| 7366 |
[(set (pc) (match_operand 0 "address_operand" "p"))] |
| 7367 |
"" |
| 7368 |
"") |
| 7369 |
|
| 7370 |
(define_insn "*branch<P:mode>" |
| 7371 |
[(set (pc) (match_operand:P 0 "address_operand" "p"))] |
| 7372 |
"" |
| 7373 |
"jmp\t%a0%#" |
| 7374 |
[(set_attr "type" "uncond_branch")]) |
| 7375 |
|
| 7376 |
(define_expand "save_stack_nonlocal" |
| 7377 |
[(set (match_operand 0 "memory_operand" "") |
| 7378 |
(match_operand 1 "register_operand" "")) |
| 7379 |
(set (match_dup 2) (match_dup 3))] |
| 7380 |
"" |
| 7381 |
{ |
| 7382 |
operands[0] = adjust_address (operands[0], Pmode, 0); |
| 7383 |
operands[2] = adjust_address (operands[0], Pmode, GET_MODE_SIZE (Pmode)); |
| 7384 |
operands[3] = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM); |
| 7385 |
}) |
| 7386 |
|
| 7387 |
(define_expand "restore_stack_nonlocal" |
| 7388 |
[(set (match_operand 0 "register_operand" "") |
| 7389 |
(match_operand 1 "memory_operand" ""))] |
| 7390 |
"" |
| 7391 |
{ |
| 7392 |
operands[1] = adjust_address (operands[1], Pmode, 0); |
| 7393 |
}) |
| 7394 |
|
| 7395 |
(define_expand "nonlocal_goto" |
| 7396 |
[(match_operand 0 "general_operand" "") |
| 7397 |
(match_operand 1 "general_operand" "") |
| 7398 |
(match_operand 2 "memory_operand" "") |
| 7399 |
(match_operand 3 "memory_operand" "")] |
| 7400 |
"" |
| 7401 |
{ |
| 7402 |
rtx i7 = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM); |
| 7403 |
rtx r_label = operands[1]; |
| 7404 |
rtx r_sp = adjust_address (operands[2], Pmode, 0); |
| 7405 |
rtx r_fp = operands[3]; |
| 7406 |
rtx r_i7 = adjust_address (operands[2], Pmode, GET_MODE_SIZE (Pmode)); |
| 7407 |
|
| 7408 |
/* We need to flush all the register windows so that their contents will |
| 7409 |
be re-synchronized by the restore insn of the target function. */ |
| 7410 |
if (!TARGET_FLAT) |
| 7411 |
emit_insn (gen_flush_register_windows ()); |
| 7412 |
|
| 7413 |
emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); |
| 7414 |
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); |
| 7415 |
|
| 7416 |
r_label = copy_to_reg (r_label); |
| 7417 |
|
| 7418 |
/* Restore the frame pointer and stack pointer. We must use a |
| 7419 |
temporary since the setjmp buffer may be a local. */ |
| 7420 |
r_fp = copy_to_reg (r_fp); |
| 7421 |
emit_stack_restore (SAVE_NONLOCAL, r_sp); |
| 7422 |
r_i7 = copy_to_reg (r_i7); |
| 7423 |
|
| 7424 |
/* Ensure the frame pointer move is not optimized. */ |
| 7425 |
emit_insn (gen_blockage ()); |
| 7426 |
emit_clobber (hard_frame_pointer_rtx); |
| 7427 |
emit_move_insn (hard_frame_pointer_rtx, r_fp); |
| 7428 |
emit_move_insn (i7, r_i7); |
| 7429 |
|
| 7430 |
/* USE of hard_frame_pointer_rtx added for consistency; |
| 7431 |
not clear if really needed. */ |
| 7432 |
emit_use (hard_frame_pointer_rtx); |
| 7433 |
emit_use (stack_pointer_rtx); |
| 7434 |
emit_use (i7); |
| 7435 |
|
| 7436 |
emit_indirect_jump (r_label); |
| 7437 |
DONE; |
| 7438 |
}) |
| 7439 |
|
| 7440 |
(define_expand "builtin_setjmp_receiver" |
| 7441 |
[(label_ref (match_operand 0 "" ""))] |
| 7442 |
"TARGET_VXWORKS_RTP && flag_pic" |
| 7443 |
{ |
| 7444 |
load_got_register (); |
| 7445 |
DONE; |
| 7446 |
}) |
| 7447 |
|
| 7448 |
;; Special insn to flush register windows. |
| 7449 |
|
| 7450 |
(define_insn "flush_register_windows" |
| 7451 |
[(unspec_volatile [(const_int 0)] UNSPECV_FLUSHW)] |
| 7452 |
"" |
| 7453 |
{ |
| 7454 |
return TARGET_V9 ? "flushw" : "ta\t3"; |
| 7455 |
} |
| 7456 |
[(set_attr "type" "flushw")]) |
| 7457 |
|
| 7458 |
;; Special pattern for the FLUSH instruction. |
| 7459 |
|
| 7460 |
(define_insn "@flush<P:mode>" |
| 7461 |
[(unspec_volatile [(match_operand:P 0 "memory_operand" "m")] UNSPECV_FLUSH)] |
| 7462 |
"" |
| 7463 |
{ |
| 7464 |
return TARGET_V9 ? "flush\t%f0" : "iflush\t%f0"; |
| 7465 |
} |
| 7466 |
[(set_attr "type" "iflush")]) |
| 7467 |
|
| 7468 |
;; Special insns to load and store the 32-bit FP Status Register. |
| 7469 |
|
| 7470 |
(define_insn "ldfsr" |
| 7471 |
[(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")] UNSPECV_LDFSR)] |
| 7472 |
"TARGET_FPU" |
| 7473 |
"ld\t%0, %%fsr" |
| 7474 |
[(set_attr "type" "load") |
| 7475 |
(set_attr "subtype" "regular")]) |
| 7476 |
|
| 7477 |
(define_insn "stfsr" |
| 7478 |
[(set (match_operand:SI 0 "memory_operand" "=m") |
| 7479 |
(unspec_volatile:SI [(const_int 0)] UNSPECV_STFSR))] |
| 7480 |
"TARGET_FPU" |
| 7481 |
"st\t%%fsr, %0" |
| 7482 |
[(set_attr "type" "store")]) |
| 7483 |
|
| 7484 |
|
| 7485 |
;; Find first set instructions. |
| 7486 |
|
| 7487 |
(define_expand "popcountdi2" |
| 7488 |
[(set (match_operand:DI 0 "register_operand" "") |
| 7489 |
(popcount:DI (match_operand:DI 1 "register_operand" "")))] |
| 7490 |
"TARGET_POPC" |
| 7491 |
{ |
| 7492 |
if (TARGET_ARCH32) |
| 7493 |
{ |
| 7494 |
emit_insn (gen_popcountdi_v8plus (operands[0], operands[1])); |
| 7495 |
DONE; |
| 7496 |
} |
| 7497 |
}) |
| 7498 |
|
| 7499 |
(define_insn "*popcountdi_sp64" |
| 7500 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 7501 |
(popcount:DI (match_operand:DI 1 "register_operand" "r")))] |
| 7502 |
"TARGET_POPC && TARGET_ARCH64" |
| 7503 |
"popc\t%1, %0") |
| 7504 |
|
| 7505 |
(define_insn "popcountdi_v8plus" |
| 7506 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 7507 |
(popcount:DI (match_operand:DI 1 "register_operand" "r"))) |
| 7508 |
(clobber (match_scratch:SI 2 "=&h"))] |
| 7509 |
"TARGET_POPC && TARGET_ARCH32" |
| 7510 |
{ |
| 7511 |
if (sparc_check_64 (operands[1], insn) <= 0) |
| 7512 |
output_asm_insn ("srl\t%L1, 0, %L1", operands); |
| 7513 |
return "sllx\t%H1, 32, %2\n\tor\t%L1, %2, %2\n\tpopc\t%2, %L0\n\tclr\t%H0"; |
| 7514 |
} |
| 7515 |
[(set_attr "type" "multi") |
| 7516 |
(set_attr "length" "5")]) |
| 7517 |
|
| 7518 |
(define_expand "popcountsi2" |
| 7519 |
[(set (match_dup 2) |
| 7520 |
(zero_extend:DI (match_operand:SI 1 "register_operand" ""))) |
| 7521 |
(set (match_operand:SI 0 "register_operand" "") |
| 7522 |
(truncate:SI (popcount:DI (match_dup 2))))] |
| 7523 |
"TARGET_POPC" |
| 7524 |
{ |
| 7525 |
if (TARGET_ARCH32) |
| 7526 |
{ |
| 7527 |
emit_insn (gen_popcountsi_v8plus (operands[0], operands[1])); |
| 7528 |
DONE; |
| 7529 |
} |
| 7530 |
else |
| 7531 |
operands[2] = gen_reg_rtx (DImode); |
| 7532 |
}) |
| 7533 |
|
| 7534 |
(define_insn "*popcountsi_sp64" |
| 7535 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 7536 |
(truncate:SI |
| 7537 |
(popcount:DI (match_operand:DI 1 "register_operand" "r"))))] |
| 7538 |
"TARGET_POPC && TARGET_ARCH64" |
| 7539 |
"popc\t%1, %0") |
| 7540 |
|
| 7541 |
(define_insn "popcountsi_v8plus" |
| 7542 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 7543 |
(popcount:SI (match_operand:SI 1 "register_operand" "r")))] |
| 7544 |
"TARGET_POPC && TARGET_ARCH32" |
| 7545 |
{ |
| 7546 |
if (sparc_check_64 (operands[1], insn) <= 0) |
| 7547 |
output_asm_insn ("srl\t%1, 0, %1", operands); |
| 7548 |
return "popc\t%1, %0"; |
| 7549 |
} |
| 7550 |
[(set_attr "type" "multi") |
| 7551 |
(set_attr "length" "2")]) |
| 7552 |
|
| 7553 |
(define_expand "clzdi2" |
| 7554 |
[(set (match_operand:DI 0 "register_operand" "") |
| 7555 |
(clz:DI (match_operand:DI 1 "register_operand" "")))] |
| 7556 |
"TARGET_VIS3" |
| 7557 |
{ |
| 7558 |
if (TARGET_ARCH32) |
| 7559 |
{ |
| 7560 |
emit_insn (gen_clzdi_v8plus (operands[0], operands[1])); |
| 7561 |
DONE; |
| 7562 |
} |
| 7563 |
}) |
| 7564 |
|
| 7565 |
(define_insn "*clzdi_sp64" |
| 7566 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 7567 |
(clz:DI (match_operand:DI 1 "register_operand" "r")))] |
| 7568 |
"TARGET_VIS3 && TARGET_ARCH64" |
| 7569 |
"lzd\t%1, %0" |
| 7570 |
[(set_attr "type" "lzd")]) |
| 7571 |
|
| 7572 |
(define_insn "clzdi_v8plus" |
| 7573 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 7574 |
(clz:DI (match_operand:DI 1 "register_operand" "r"))) |
| 7575 |
(clobber (match_scratch:SI 2 "=&h"))] |
| 7576 |
"TARGET_VIS3 && TARGET_ARCH32" |
| 7577 |
{ |
| 7578 |
if (sparc_check_64 (operands[1], insn) <= 0) |
| 7579 |
output_asm_insn ("srl\t%L1, 0, %L1", operands); |
| 7580 |
return "sllx\t%H1, 32, %2\n\tor\t%L1, %2, %2\n\tlzd\t%2, %L0\n\tclr\t%H0"; |
| 7581 |
} |
| 7582 |
[(set_attr "type" "multi") |
| 7583 |
(set_attr "length" "5")]) |
| 7584 |
|
| 7585 |
(define_expand "clzsi2" |
| 7586 |
[(set (match_dup 2) |
| 7587 |
(zero_extend:DI (match_operand:SI 1 "register_operand" ""))) |
| 7588 |
(set (match_dup 3) |
| 7589 |
(truncate:SI (clz:DI (match_dup 2)))) |
| 7590 |
(set (match_operand:SI 0 "register_operand" "") |
| 7591 |
(minus:SI (match_dup 3) (const_int 32)))] |
| 7592 |
"TARGET_VIS3" |
| 7593 |
{ |
| 7594 |
if (TARGET_ARCH32) |
| 7595 |
{ |
| 7596 |
emit_insn (gen_clzsi_v8plus (operands[0], operands[1])); |
| 7597 |
DONE; |
| 7598 |
} |
| 7599 |
else |
| 7600 |
{ |
| 7601 |
operands[2] = gen_reg_rtx (DImode); |
| 7602 |
operands[3] = gen_reg_rtx (SImode); |
| 7603 |
} |
| 7604 |
}) |
| 7605 |
|
| 7606 |
(define_insn "*clzsi_sp64" |
| 7607 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 7608 |
(truncate:SI |
| 7609 |
(clz:DI (match_operand:DI 1 "register_operand" "r"))))] |
| 7610 |
"TARGET_VIS3 && TARGET_ARCH64" |
| 7611 |
"lzd\t%1, %0" |
| 7612 |
[(set_attr "type" "lzd")]) |
| 7613 |
|
| 7614 |
(define_insn "clzsi_v8plus" |
| 7615 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 7616 |
(clz:SI (match_operand:SI 1 "register_operand" "r")))] |
| 7617 |
"TARGET_VIS3 && TARGET_ARCH32" |
| 7618 |
{ |
| 7619 |
if (sparc_check_64 (operands[1], insn) <= 0) |
| 7620 |
output_asm_insn ("srl\t%1, 0, %1", operands); |
| 7621 |
return "lzd\t%1, %0\n\tsub\t%0, 32, %0"; |
| 7622 |
} |
| 7623 |
[(set_attr "type" "multi") |
| 7624 |
(set_attr "length" "3")]) |
| 7625 |
|
| 7626 |
|
| 7627 |
;; Peepholes go at the end. |
| 7628 |
|
| 7629 |
;; Optimize consecutive loads or stores into ldd and std when possible. |
| 7630 |
;; The conditions in which we do this are very restricted and are |
| 7631 |
;; explained in the code for {registers,memory}_ok_for_ldd functions. |
| 7632 |
|
| 7633 |
(define_peephole2 |
| 7634 |
[(set (match_operand:SI 0 "memory_operand" "") |
| 7635 |
(const_int 0)) |
| 7636 |
(set (match_operand:SI 1 "memory_operand" "") |
| 7637 |
(const_int 0))] |
| 7638 |
"TARGET_V9 |
| 7639 |
&& mems_ok_for_ldd_peep (operands[0], operands[1], NULL_RTX)" |
| 7640 |
[(set (match_dup 0) (const_int 0))] |
| 7641 |
{ |
| 7642 |
operands[0] = widen_mem_for_ldd_peep (operands[0], operands[1], DImode); |
| 7643 |
}) |
| 7644 |
|
| 7645 |
(define_peephole2 |
| 7646 |
[(set (match_operand:SI 0 "memory_operand" "") |
| 7647 |
(const_int 0)) |
| 7648 |
(set (match_operand:SI 1 "memory_operand" "") |
| 7649 |
(const_int 0))] |
| 7650 |
"TARGET_V9 |
| 7651 |
&& mems_ok_for_ldd_peep (operands[1], operands[0], NULL_RTX)" |
| 7652 |
[(set (match_dup 1) (const_int 0))] |
| 7653 |
{ |
| 7654 |
operands[1] = widen_mem_for_ldd_peep (operands[1], operands[0], DImode); |
| 7655 |
}) |
| 7656 |
|
| 7657 |
(define_peephole2 |
| 7658 |
[(set (match_operand:SI 0 "register_operand" "") |
| 7659 |
(match_operand:SI 1 "memory_operand" "")) |
| 7660 |
(set (match_operand:SI 2 "register_operand" "") |
| 7661 |
(match_operand:SI 3 "memory_operand" ""))] |
| 7662 |
"registers_ok_for_ldd_peep (operands[0], operands[2]) |
| 7663 |
&& mems_ok_for_ldd_peep (operands[1], operands[3], operands[0])" |
| 7664 |
[(set (match_dup 0) (match_dup 1))] |
| 7665 |
{ |
| 7666 |
operands[1] = widen_mem_for_ldd_peep (operands[1], operands[3], DImode); |
| 7667 |
operands[0] = gen_rtx_REG (DImode, REGNO (operands[0])); |
| 7668 |
}) |
| 7669 |
|
| 7670 |
(define_peephole2 |
| 7671 |
[(set (match_operand:SI 0 "memory_operand" "") |
| 7672 |
(match_operand:SI 1 "register_operand" "")) |
| 7673 |
(set (match_operand:SI 2 "memory_operand" "") |
| 7674 |
(match_operand:SI 3 "register_operand" ""))] |
| 7675 |
"registers_ok_for_ldd_peep (operands[1], operands[3]) |
| 7676 |
&& mems_ok_for_ldd_peep (operands[0], operands[2], NULL_RTX)" |
| 7677 |
[(set (match_dup 0) (match_dup 1))] |
| 7678 |
{ |
| 7679 |
operands[0] = widen_mem_for_ldd_peep (operands[0], operands[2], DImode); |
| 7680 |
operands[1] = gen_rtx_REG (DImode, REGNO (operands[1])); |
| 7681 |
}) |
| 7682 |
|
| 7683 |
(define_peephole2 |
| 7684 |
[(set (match_operand:SF 0 "register_operand" "") |
| 7685 |
(match_operand:SF 1 "memory_operand" "")) |
| 7686 |
(set (match_operand:SF 2 "register_operand" "") |
| 7687 |
(match_operand:SF 3 "memory_operand" ""))] |
| 7688 |
"registers_ok_for_ldd_peep (operands[0], operands[2]) |
| 7689 |
&& mems_ok_for_ldd_peep (operands[1], operands[3], operands[0])" |
| 7690 |
[(set (match_dup 0) (match_dup 1))] |
| 7691 |
{ |
| 7692 |
operands[1] = widen_mem_for_ldd_peep (operands[1], operands[3], DFmode); |
| 7693 |
operands[0] = gen_rtx_REG (DFmode, REGNO (operands[0])); |
| 7694 |
}) |
| 7695 |
|
| 7696 |
(define_peephole2 |
| 7697 |
[(set (match_operand:SF 0 "memory_operand" "") |
| 7698 |
(match_operand:SF 1 "register_operand" "")) |
| 7699 |
(set (match_operand:SF 2 "memory_operand" "") |
| 7700 |
(match_operand:SF 3 "register_operand" ""))] |
| 7701 |
"registers_ok_for_ldd_peep (operands[1], operands[3]) |
| 7702 |
&& mems_ok_for_ldd_peep (operands[0], operands[2], NULL_RTX)" |
| 7703 |
[(set (match_dup 0) (match_dup 1))] |
| 7704 |
{ |
| 7705 |
operands[0] = widen_mem_for_ldd_peep (operands[0], operands[2], DFmode); |
| 7706 |
operands[1] = gen_rtx_REG (DFmode, REGNO (operands[1])); |
| 7707 |
}) |
| 7708 |
|
| 7709 |
(define_peephole2 |
| 7710 |
[(set (match_operand:SI 0 "register_operand" "") |
| 7711 |
(match_operand:SI 1 "memory_operand" "")) |
| 7712 |
(set (match_operand:SI 2 "register_operand" "") |
| 7713 |
(match_operand:SI 3 "memory_operand" ""))] |
| 7714 |
"registers_ok_for_ldd_peep (operands[2], operands[0]) |
| 7715 |
&& mems_ok_for_ldd_peep (operands[3], operands[1], operands[0])" |
| 7716 |
[(set (match_dup 2) (match_dup 3))] |
| 7717 |
{ |
| 7718 |
operands[3] = widen_mem_for_ldd_peep (operands[3], operands[1], DImode); |
| 7719 |
operands[2] = gen_rtx_REG (DImode, REGNO (operands[2])); |
| 7720 |
}) |
| 7721 |
|
| 7722 |
(define_peephole2 |
| 7723 |
[(set (match_operand:SI 0 "memory_operand" "") |
| 7724 |
(match_operand:SI 1 "register_operand" "")) |
| 7725 |
(set (match_operand:SI 2 "memory_operand" "") |
| 7726 |
(match_operand:SI 3 "register_operand" ""))] |
| 7727 |
"registers_ok_for_ldd_peep (operands[3], operands[1]) |
| 7728 |
&& mems_ok_for_ldd_peep (operands[2], operands[0], NULL_RTX)" |
| 7729 |
[(set (match_dup 2) (match_dup 3))] |
| 7730 |
{ |
| 7731 |
operands[2] = widen_mem_for_ldd_peep (operands[2], operands[0], DImode); |
| 7732 |
operands[3] = gen_rtx_REG (DImode, REGNO (operands[3])); |
| 7733 |
}) |
| 7734 |
|
| 7735 |
(define_peephole2 |
| 7736 |
[(set (match_operand:SF 0 "register_operand" "") |
| 7737 |
(match_operand:SF 1 "memory_operand" "")) |
| 7738 |
(set (match_operand:SF 2 "register_operand" "") |
| 7739 |
(match_operand:SF 3 "memory_operand" ""))] |
| 7740 |
"registers_ok_for_ldd_peep (operands[2], operands[0]) |
| 7741 |
&& mems_ok_for_ldd_peep (operands[3], operands[1], operands[0])" |
| 7742 |
[(set (match_dup 2) (match_dup 3))] |
| 7743 |
{ |
| 7744 |
operands[3] = widen_mem_for_ldd_peep (operands[3], operands[1], DFmode); |
| 7745 |
operands[2] = gen_rtx_REG (DFmode, REGNO (operands[2])); |
| 7746 |
}) |
| 7747 |
|
| 7748 |
(define_peephole2 |
| 7749 |
[(set (match_operand:SF 0 "memory_operand" "") |
| 7750 |
(match_operand:SF 1 "register_operand" "")) |
| 7751 |
(set (match_operand:SF 2 "memory_operand" "") |
| 7752 |
(match_operand:SF 3 "register_operand" ""))] |
| 7753 |
"registers_ok_for_ldd_peep (operands[3], operands[1]) |
| 7754 |
&& mems_ok_for_ldd_peep (operands[2], operands[0], NULL_RTX)" |
| 7755 |
[(set (match_dup 2) (match_dup 3))] |
| 7756 |
{ |
| 7757 |
operands[2] = widen_mem_for_ldd_peep (operands[2], operands[0], DFmode); |
| 7758 |
operands[3] = gen_rtx_REG (DFmode, REGNO (operands[3])); |
| 7759 |
}) |
| 7760 |
|
| 7761 |
;; Optimize the case of following a reg-reg move with a test |
| 7762 |
;; of reg just moved. Don't allow floating point regs for operand 0 or 1. |
| 7763 |
;; This can result from a float to fix conversion. |
| 7764 |
|
| 7765 |
(define_peephole2 |
| 7766 |
[(set (match_operand:SI 0 "register_operand" "") |
| 7767 |
(match_operand:SI 1 "register_operand" "")) |
| 7768 |
(set (reg:CC CC_REG) |
| 7769 |
(compare:CC (match_operand:SI 2 "register_operand" "") |
| 7770 |
(const_int 0)))] |
| 7771 |
"(rtx_equal_p (operands[2], operands[0]) |
| 7772 |
|| rtx_equal_p (operands[2], operands[1])) |
| 7773 |
&& !SPARC_FP_REG_P (REGNO (operands[0])) |
| 7774 |
&& !SPARC_FP_REG_P (REGNO (operands[1]))" |
| 7775 |
[(parallel [(set (match_dup 0) (match_dup 1)) |
| 7776 |
(set (reg:CC CC_REG) |
| 7777 |
(compare:CC (match_dup 1) (const_int 0)))])] |
| 7778 |
"") |
| 7779 |
|
| 7780 |
(define_peephole2 |
| 7781 |
[(set (match_operand:DI 0 "register_operand" "") |
| 7782 |
(match_operand:DI 1 "register_operand" "")) |
| 7783 |
(set (reg:CCX CC_REG) |
| 7784 |
(compare:CCX (match_operand:DI 2 "register_operand" "") |
| 7785 |
(const_int 0)))] |
| 7786 |
"TARGET_ARCH64 |
| 7787 |
&& (rtx_equal_p (operands[2], operands[0]) |
| 7788 |
|| rtx_equal_p (operands[2], operands[1])) |
| 7789 |
&& !SPARC_FP_REG_P (REGNO (operands[0])) |
| 7790 |
&& !SPARC_FP_REG_P (REGNO (operands[1]))" |
| 7791 |
[(parallel [(set (match_dup 0) (match_dup 1)) |
| 7792 |
(set (reg:CCX CC_REG) |
| 7793 |
(compare:CCX (match_dup 1) (const_int 0)))])] |
| 7794 |
"") |
| 7795 |
|
| 7796 |
|
| 7797 |
;; Prefetch instructions. |
| 7798 |
|
| 7799 |
;; ??? UltraSPARC-III note: A memory operation loading into the floating point |
| 7800 |
;; register file, if it hits the prefetch cache, has a chance to dual-issue |
| 7801 |
;; with other memory operations. With DFA we might be able to model this, |
| 7802 |
;; but it requires a lot of state. |
| 7803 |
(define_expand "prefetch" |
| 7804 |
[(match_operand 0 "address_operand" "") |
| 7805 |
(match_operand 1 "const_int_operand" "") |
| 7806 |
(match_operand 2 "const_int_operand" "")] |
| 7807 |
"TARGET_V9" |
| 7808 |
{ |
| 7809 |
if (TARGET_ARCH64) |
| 7810 |
emit_insn (gen_prefetch_64 (operands[0], operands[1], operands[2])); |
| 7811 |
else |
| 7812 |
emit_insn (gen_prefetch_32 (operands[0], operands[1], operands[2])); |
| 7813 |
DONE; |
| 7814 |
}) |
| 7815 |
|
| 7816 |
(define_insn "prefetch_64" |
| 7817 |
[(prefetch (match_operand:DI 0 "address_operand" "p") |
| 7818 |
(match_operand:DI 1 "const_int_operand" "n") |
| 7819 |
(match_operand:DI 2 "const_int_operand" "n"))] |
| 7820 |
"" |
| 7821 |
{ |
| 7822 |
static const char * const prefetch_instr[2][2] = { |
| 7823 |
{ |
| 7824 |
"prefetch\t[%a0], 1", /* no locality: prefetch for one read */ |
| 7825 |
"prefetch\t[%a0], 0", /* medium to high locality: prefetch for several reads */ |
| 7826 |
}, |
| 7827 |
{ |
| 7828 |
"prefetch\t[%a0], 3", /* no locality: prefetch for one write */ |
| 7829 |
"prefetch\t[%a0], 2", /* medium to high locality: prefetch for several writes */ |
| 7830 |
} |
| 7831 |
}; |
| 7832 |
int read_or_write = INTVAL (operands[1]); |
| 7833 |
int locality = INTVAL (operands[2]); |
| 7834 |
|
| 7835 |
gcc_assert (IN_RANGE (read_or_write, 0, 2)); |
| 7836 |
gcc_assert (IN_RANGE (locality, 0, 3)); |
| 7837 |
return prefetch_instr [read_or_write & 1][locality == 0 ? 0 : 1]; |
| 7838 |
} |
| 7839 |
[(set_attr "type" "load") |
| 7840 |
(set_attr "subtype" "prefetch")]) |
| 7841 |
|
| 7842 |
(define_insn "prefetch_32" |
| 7843 |
[(prefetch (match_operand:SI 0 "address_operand" "p") |
| 7844 |
(match_operand:SI 1 "const_int_operand" "n") |
| 7845 |
(match_operand:SI 2 "const_int_operand" "n"))] |
| 7846 |
"" |
| 7847 |
{ |
| 7848 |
static const char * const prefetch_instr[2][2] = { |
| 7849 |
{ |
| 7850 |
"prefetch\t[%a0], 1", /* no locality: prefetch for one read */ |
| 7851 |
"prefetch\t[%a0], 0", /* medium to high locality: prefetch for several reads */ |
| 7852 |
}, |
| 7853 |
{ |
| 7854 |
"prefetch\t[%a0], 3", /* no locality: prefetch for one write */ |
| 7855 |
"prefetch\t[%a0], 2", /* medium to high locality: prefetch for several writes */ |
| 7856 |
} |
| 7857 |
}; |
| 7858 |
int read_or_write = INTVAL (operands[1]); |
| 7859 |
int locality = INTVAL (operands[2]); |
| 7860 |
|
| 7861 |
gcc_assert (IN_RANGE (read_or_write, 0, 2)); |
| 7862 |
gcc_assert (IN_RANGE (locality, 0, 3)); |
| 7863 |
return prefetch_instr [read_or_write & 1][locality == 0 ? 0 : 1]; |
| 7864 |
} |
| 7865 |
[(set_attr "type" "load") |
| 7866 |
(set_attr "subtype" "prefetch")]) |
| 7867 |
|
| 7868 |
|
| 7869 |
;; Trap instructions. |
| 7870 |
|
| 7871 |
(define_insn "trap" |
| 7872 |
[(trap_if (const_int 1) (const_int 5))] |
| 7873 |
"" |
| 7874 |
"ta\t5" |
| 7875 |
[(set_attr "type" "trap")]) |
| 7876 |
|
| 7877 |
(define_expand "ctrapsi4" |
| 7878 |
[(trap_if (match_operator 0 "comparison_operator" |
| 7879 |
[(match_operand:SI 1 "compare_operand" "") |
| 7880 |
(match_operand:SI 2 "arith_operand" "")]) |
| 7881 |
(match_operand 3 "arith_operand"))] |
| 7882 |
"" |
| 7883 |
{ |
| 7884 |
operands[1] = gen_compare_reg (operands[0]); |
| 7885 |
if (GET_MODE (operands[1]) != CCmode && GET_MODE (operands[1]) != CCXmode) |
| 7886 |
FAIL; |
| 7887 |
operands[2] = const0_rtx; |
| 7888 |
}) |
| 7889 |
|
| 7890 |
(define_expand "ctrapdi4" |
| 7891 |
[(trap_if (match_operator 0 "comparison_operator" |
| 7892 |
[(match_operand:DI 1 "compare_operand" "") |
| 7893 |
(match_operand:DI 2 "arith_operand" "")]) |
| 7894 |
(match_operand 3 "arith_operand"))] |
| 7895 |
"TARGET_ARCH64" |
| 7896 |
{ |
| 7897 |
operands[1] = gen_compare_reg (operands[0]); |
| 7898 |
if (GET_MODE (operands[1]) != CCmode && GET_MODE (operands[1]) != CCXmode) |
| 7899 |
FAIL; |
| 7900 |
operands[2] = const0_rtx; |
| 7901 |
}) |
| 7902 |
|
| 7903 |
(define_insn "*trapsi_insn" |
| 7904 |
[(trap_if (match_operator 0 "icc_comparison_operator" |
| 7905 |
[(reg:CC CC_REG) (const_int 0)]) |
| 7906 |
(match_operand:SI 1 "arith_operand" "rM"))] |
| 7907 |
"" |
| 7908 |
{ |
| 7909 |
if (TARGET_V9) |
| 7910 |
return "t%C0\t%%icc, %1"; |
| 7911 |
else |
| 7912 |
return "t%C0\t%1"; |
| 7913 |
} |
| 7914 |
[(set_attr "type" "trap")]) |
| 7915 |
|
| 7916 |
(define_insn "*trapdi_insn" |
| 7917 |
[(trap_if (match_operator 0 "icc_comparison_operator" |
| 7918 |
[(reg:CCX CC_REG) (const_int 0)]) |
| 7919 |
(match_operand:SI 1 "arith_operand" "rM"))] |
| 7920 |
"TARGET_V9" |
| 7921 |
"t%C0\t%%xcc, %1" |
| 7922 |
[(set_attr "type" "trap")]) |
| 7923 |
|
| 7924 |
|
| 7925 |
;; TLS support instructions. |
| 7926 |
|
| 7927 |
(define_insn "@tgd_hi22<P:mode>" |
| 7928 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7929 |
(high:P (unspec:P [(match_operand 1 "tgd_symbolic_operand" "")] |
| 7930 |
UNSPEC_TLSGD)))] |
| 7931 |
"TARGET_TLS" |
| 7932 |
"sethi\\t%%tgd_hi22(%a1), %0") |
| 7933 |
|
| 7934 |
(define_insn "@tgd_lo10<P:mode>" |
| 7935 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7936 |
(lo_sum:P (match_operand:P 1 "register_operand" "r") |
| 7937 |
(unspec:P [(match_operand 2 "tgd_symbolic_operand" "")] |
| 7938 |
UNSPEC_TLSGD)))] |
| 7939 |
"TARGET_TLS" |
| 7940 |
"add\\t%1, %%tgd_lo10(%a2), %0") |
| 7941 |
|
| 7942 |
(define_insn "@tgd_add<P:mode>" |
| 7943 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7944 |
(plus:P (match_operand:P 1 "register_operand" "r") |
| 7945 |
(unspec:P [(match_operand:P 2 "register_operand" "r") |
| 7946 |
(match_operand 3 "tgd_symbolic_operand" "")] |
| 7947 |
UNSPEC_TLSGD)))] |
| 7948 |
"TARGET_TLS" |
| 7949 |
"add\\t%1, %2, %0, %%tgd_add(%a3)") |
| 7950 |
|
| 7951 |
(define_insn "@tgd_call<P:mode>" |
| 7952 |
[(set (match_operand 0 "register_operand" "=r") |
| 7953 |
(call (mem:P (unspec:P [(match_operand:P 1 "symbolic_operand" "s") |
| 7954 |
(match_operand 2 "tgd_symbolic_operand" "")] |
| 7955 |
UNSPEC_TLSGD)) |
| 7956 |
(match_operand 3 "" ""))) |
| 7957 |
(clobber (reg:P O7_REG))] |
| 7958 |
"TARGET_TLS" |
| 7959 |
"call\t%a1, %%tgd_call(%a2)%#" |
| 7960 |
[(set (attr "type") (if_then_else (eq_attr "tls_delay_slot" "true") |
| 7961 |
(const_string "call") |
| 7962 |
(const_string "call_no_delay_slot")))]) |
| 7963 |
|
| 7964 |
(define_insn "@tldm_hi22<P:mode>" |
| 7965 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7966 |
(high:P (unspec:P [(const_int 0)] UNSPEC_TLSLDM)))] |
| 7967 |
"TARGET_TLS" |
| 7968 |
"sethi\\t%%tldm_hi22(%&), %0") |
| 7969 |
|
| 7970 |
(define_insn "@tldm_lo10<P:mode>" |
| 7971 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7972 |
(lo_sum:P (match_operand:P 1 "register_operand" "r") |
| 7973 |
(unspec:P [(const_int 0)] UNSPEC_TLSLDM)))] |
| 7974 |
"TARGET_TLS" |
| 7975 |
"add\\t%1, %%tldm_lo10(%&), %0") |
| 7976 |
|
| 7977 |
(define_insn "@tldm_add<P:mode>" |
| 7978 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7979 |
(plus:P (match_operand:P 1 "register_operand" "r") |
| 7980 |
(unspec:P [(match_operand:P 2 "register_operand" "r")] |
| 7981 |
UNSPEC_TLSLDM)))] |
| 7982 |
"TARGET_TLS" |
| 7983 |
"add\\t%1, %2, %0, %%tldm_add(%&)") |
| 7984 |
|
| 7985 |
(define_insn "@tldm_call<P:mode>" |
| 7986 |
[(set (match_operand 0 "register_operand" "=r") |
| 7987 |
(call (mem:P (unspec:P [(match_operand:P 1 "symbolic_operand" "s")] |
| 7988 |
UNSPEC_TLSLDM)) |
| 7989 |
(match_operand 2 "" ""))) |
| 7990 |
(clobber (reg:P O7_REG))] |
| 7991 |
"TARGET_TLS" |
| 7992 |
"call\t%a1, %%tldm_call(%&)%#" |
| 7993 |
[(set (attr "type") (if_then_else (eq_attr "tls_delay_slot" "true") |
| 7994 |
(const_string "call") |
| 7995 |
(const_string "call_no_delay_slot")))]) |
| 7996 |
|
| 7997 |
(define_insn "@tldo_hix22<P:mode>" |
| 7998 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 7999 |
(high:P (unspec:P [(match_operand 1 "tld_symbolic_operand" "")] |
| 8000 |
UNSPEC_TLSLDO)))] |
| 8001 |
"TARGET_TLS" |
| 8002 |
"sethi\\t%%tldo_hix22(%a1), %0") |
| 8003 |
|
| 8004 |
(define_insn "@tldo_lox10<P:mode>" |
| 8005 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8006 |
(lo_sum:P (match_operand:P 1 "register_operand" "r") |
| 8007 |
(unspec:P [(match_operand 2 "tld_symbolic_operand" "")] |
| 8008 |
UNSPEC_TLSLDO)))] |
| 8009 |
"TARGET_TLS" |
| 8010 |
"xor\\t%1, %%tldo_lox10(%a2), %0") |
| 8011 |
|
| 8012 |
(define_insn "@tldo_add<P:mode>" |
| 8013 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8014 |
(plus:P (match_operand:P 1 "register_operand" "r") |
| 8015 |
(unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8016 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8017 |
UNSPEC_TLSLDO)))] |
| 8018 |
"TARGET_TLS" |
| 8019 |
"add\\t%1, %2, %0, %%tldo_add(%a3)") |
| 8020 |
|
| 8021 |
(define_insn "@tie_hi22<P:mode>" |
| 8022 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8023 |
(high:P (unspec:P [(match_operand 1 "tie_symbolic_operand" "")] |
| 8024 |
UNSPEC_TLSIE)))] |
| 8025 |
"TARGET_TLS" |
| 8026 |
"sethi\\t%%tie_hi22(%a1), %0") |
| 8027 |
|
| 8028 |
(define_insn "@tie_lo10<P:mode>" |
| 8029 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8030 |
(lo_sum:P (match_operand:P 1 "register_operand" "r") |
| 8031 |
(unspec:P [(match_operand 2 "tie_symbolic_operand" "")] |
| 8032 |
UNSPEC_TLSIE)))] |
| 8033 |
"TARGET_TLS" |
| 8034 |
"add\\t%1, %%tie_lo10(%a2), %0") |
| 8035 |
|
| 8036 |
; Note the %%tie_ld operator |
| 8037 |
(define_insn "tie_ld32" |
| 8038 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8039 |
(unspec:SI [(match_operand:SI 1 "register_operand" "r") |
| 8040 |
(match_operand:SI 2 "register_operand" "r") |
| 8041 |
(match_operand 3 "tie_symbolic_operand" "")] |
| 8042 |
UNSPEC_TLSIE))] |
| 8043 |
"TARGET_TLS && TARGET_ARCH32" |
| 8044 |
"ld\\t[%1 + %2], %0, %%tie_ld(%a3)" |
| 8045 |
[(set_attr "type" "load") |
| 8046 |
(set_attr "subtype" "regular")]) |
| 8047 |
|
| 8048 |
; Note the %%tie_ldx operator |
| 8049 |
(define_insn "tie_ld64" |
| 8050 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8051 |
(unspec:DI [(match_operand:DI 1 "register_operand" "r") |
| 8052 |
(match_operand:DI 2 "register_operand" "r") |
| 8053 |
(match_operand 3 "tie_symbolic_operand" "")] |
| 8054 |
UNSPEC_TLSIE))] |
| 8055 |
"TARGET_TLS && TARGET_ARCH64" |
| 8056 |
"ldx\\t[%1 + %2], %0, %%tie_ldx(%a3)" |
| 8057 |
[(set_attr "type" "load") |
| 8058 |
(set_attr "subtype" "regular")]) |
| 8059 |
|
| 8060 |
(define_insn "@tie_add<P:mode>" |
| 8061 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8062 |
(plus:P (match_operand:P 1 "register_operand" "r") |
| 8063 |
(unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8064 |
(match_operand 3 "tie_symbolic_operand" "")] |
| 8065 |
UNSPEC_TLSIE)))] |
| 8066 |
"TARGET_SUN_TLS" |
| 8067 |
"add\\t%1, %2, %0, %%tie_add(%a3)") |
| 8068 |
|
| 8069 |
(define_insn "@tle_hix22<P:mode>" |
| 8070 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8071 |
(high:P (unspec:P [(match_operand 1 "tle_symbolic_operand" "")] |
| 8072 |
UNSPEC_TLSLE)))] |
| 8073 |
"TARGET_TLS" |
| 8074 |
"sethi\\t%%tle_hix22(%a1), %0") |
| 8075 |
|
| 8076 |
(define_insn "@tle_lox10<P:mode>" |
| 8077 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8078 |
(lo_sum:P (match_operand:P 1 "register_operand" "r") |
| 8079 |
(unspec:P [(match_operand 2 "tle_symbolic_operand" "")] |
| 8080 |
UNSPEC_TLSLE)))] |
| 8081 |
"TARGET_TLS" |
| 8082 |
"xor\\t%1, %%tle_lox10(%a2), %0") |
| 8083 |
|
| 8084 |
;; Now patterns combining tldo_add with some integer loads or stores |
| 8085 |
(define_insn "*tldo_ldub<P:mode>" |
| 8086 |
[(set (match_operand:QI 0 "register_operand" "=r") |
| 8087 |
(mem:QI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8088 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8089 |
UNSPEC_TLSLDO) |
| 8090 |
(match_operand:P 1 "register_operand" "r"))))] |
| 8091 |
"TARGET_TLS" |
| 8092 |
"ldub\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8093 |
[(set_attr "type" "load") |
| 8094 |
(set_attr "subtype" "regular") |
| 8095 |
(set_attr "us3load_type" "3cycle")]) |
| 8096 |
|
| 8097 |
(define_insn "*tldo_ldub1<P:mode>" |
| 8098 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 8099 |
(zero_extend:HI |
| 8100 |
(mem:QI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8101 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8102 |
UNSPEC_TLSLDO) |
| 8103 |
(match_operand:P 1 "register_operand" "r")))))] |
| 8104 |
"TARGET_TLS" |
| 8105 |
"ldub\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8106 |
[(set_attr "type" "load") |
| 8107 |
(set_attr "subtype" "regular") |
| 8108 |
(set_attr "us3load_type" "3cycle")]) |
| 8109 |
|
| 8110 |
(define_insn "*tldo_ldub2<P:mode>" |
| 8111 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8112 |
(zero_extend:SI |
| 8113 |
(mem:QI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8114 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8115 |
UNSPEC_TLSLDO) |
| 8116 |
(match_operand:P 1 "register_operand" "r")))))] |
| 8117 |
"TARGET_TLS" |
| 8118 |
"ldub\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8119 |
[(set_attr "type" "load") |
| 8120 |
(set_attr "subtype" "regular") |
| 8121 |
(set_attr "us3load_type" "3cycle")]) |
| 8122 |
|
| 8123 |
(define_insn "*tldo_ldsb1<P:mode>" |
| 8124 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 8125 |
(sign_extend:HI |
| 8126 |
(mem:QI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8127 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8128 |
UNSPEC_TLSLDO) |
| 8129 |
(match_operand:P 1 "register_operand" "r")))))] |
| 8130 |
"TARGET_TLS" |
| 8131 |
"ldsb\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8132 |
[(set_attr "type" "sload") |
| 8133 |
(set_attr "us3load_type" "3cycle")]) |
| 8134 |
|
| 8135 |
(define_insn "*tldo_ldsb2<P:mode>" |
| 8136 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8137 |
(sign_extend:SI |
| 8138 |
(mem:QI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8139 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8140 |
UNSPEC_TLSLDO) |
| 8141 |
(match_operand:P 1 "register_operand" "r")))))] |
| 8142 |
"TARGET_TLS" |
| 8143 |
"ldsb\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8144 |
[(set_attr "type" "sload") |
| 8145 |
(set_attr "us3load_type" "3cycle")]) |
| 8146 |
|
| 8147 |
(define_insn "*tldo_ldub3_sp64" |
| 8148 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8149 |
(zero_extend:DI |
| 8150 |
(mem:QI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8151 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8152 |
UNSPEC_TLSLDO) |
| 8153 |
(match_operand:DI 1 "register_operand" "r")))))] |
| 8154 |
"TARGET_TLS && TARGET_ARCH64" |
| 8155 |
"ldub\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8156 |
[(set_attr "type" "load") |
| 8157 |
(set_attr "subtype" "regular") |
| 8158 |
(set_attr "us3load_type" "3cycle")]) |
| 8159 |
|
| 8160 |
(define_insn "*tldo_ldsb3_sp64" |
| 8161 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8162 |
(sign_extend:DI |
| 8163 |
(mem:QI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8164 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8165 |
UNSPEC_TLSLDO) |
| 8166 |
(match_operand:DI 1 "register_operand" "r")))))] |
| 8167 |
"TARGET_TLS && TARGET_ARCH64" |
| 8168 |
"ldsb\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8169 |
[(set_attr "type" "sload") |
| 8170 |
(set_attr "us3load_type" "3cycle")]) |
| 8171 |
|
| 8172 |
(define_insn "*tldo_lduh<P:mode>" |
| 8173 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 8174 |
(mem:HI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8175 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8176 |
UNSPEC_TLSLDO) |
| 8177 |
(match_operand:P 1 "register_operand" "r"))))] |
| 8178 |
"TARGET_TLS" |
| 8179 |
"lduh\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8180 |
[(set_attr "type" "load") |
| 8181 |
(set_attr "subtype" "regular") |
| 8182 |
(set_attr "us3load_type" "3cycle")]) |
| 8183 |
|
| 8184 |
(define_insn "*tldo_lduh1<P:mode>" |
| 8185 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8186 |
(zero_extend:SI |
| 8187 |
(mem:HI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8188 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8189 |
UNSPEC_TLSLDO) |
| 8190 |
(match_operand:P 1 "register_operand" "r")))))] |
| 8191 |
"TARGET_TLS" |
| 8192 |
"lduh\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8193 |
[(set_attr "type" "load") |
| 8194 |
(set_attr "subtype" "regular") |
| 8195 |
(set_attr "us3load_type" "3cycle")]) |
| 8196 |
|
| 8197 |
(define_insn "*tldo_ldsh1<P:mode>" |
| 8198 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8199 |
(sign_extend:SI |
| 8200 |
(mem:HI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8201 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8202 |
UNSPEC_TLSLDO) |
| 8203 |
(match_operand:P 1 "register_operand" "r")))))] |
| 8204 |
"TARGET_TLS" |
| 8205 |
"ldsh\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8206 |
[(set_attr "type" "sload") |
| 8207 |
(set_attr "us3load_type" "3cycle")]) |
| 8208 |
|
| 8209 |
(define_insn "*tldo_lduh2_sp64" |
| 8210 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8211 |
(zero_extend:DI |
| 8212 |
(mem:HI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8213 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8214 |
UNSPEC_TLSLDO) |
| 8215 |
(match_operand:DI 1 "register_operand" "r")))))] |
| 8216 |
"TARGET_TLS && TARGET_ARCH64" |
| 8217 |
"lduh\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8218 |
[(set_attr "type" "load") |
| 8219 |
(set_attr "subtype" "regular") |
| 8220 |
(set_attr "us3load_type" "3cycle")]) |
| 8221 |
|
| 8222 |
(define_insn "*tldo_ldsh2_sp64" |
| 8223 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8224 |
(sign_extend:DI |
| 8225 |
(mem:HI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8226 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8227 |
UNSPEC_TLSLDO) |
| 8228 |
(match_operand:DI 1 "register_operand" "r")))))] |
| 8229 |
"TARGET_TLS && TARGET_ARCH64" |
| 8230 |
"ldsh\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8231 |
[(set_attr "type" "sload") |
| 8232 |
(set_attr "us3load_type" "3cycle")]) |
| 8233 |
|
| 8234 |
(define_insn "*tldo_lduw<P:mode>" |
| 8235 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8236 |
(mem:SI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8237 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8238 |
UNSPEC_TLSLDO) |
| 8239 |
(match_operand:P 1 "register_operand" "r"))))] |
| 8240 |
"TARGET_TLS" |
| 8241 |
"ld\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8242 |
[(set_attr "type" "load") |
| 8243 |
(set_attr "subtype" "regular")]) |
| 8244 |
|
| 8245 |
(define_insn "*tldo_lduw1_sp64" |
| 8246 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8247 |
(zero_extend:DI |
| 8248 |
(mem:SI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8249 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8250 |
UNSPEC_TLSLDO) |
| 8251 |
(match_operand:DI 1 "register_operand" "r")))))] |
| 8252 |
"TARGET_TLS && TARGET_ARCH64" |
| 8253 |
"lduw\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8254 |
[(set_attr "type" "load") |
| 8255 |
(set_attr "subtype" "regular")]) |
| 8256 |
|
| 8257 |
(define_insn "*tldo_ldsw1_sp64" |
| 8258 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8259 |
(sign_extend:DI |
| 8260 |
(mem:SI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8261 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8262 |
UNSPEC_TLSLDO) |
| 8263 |
(match_operand:DI 1 "register_operand" "r")))))] |
| 8264 |
"TARGET_TLS && TARGET_ARCH64" |
| 8265 |
"ldsw\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8266 |
[(set_attr "type" "sload") |
| 8267 |
(set_attr "us3load_type" "3cycle")]) |
| 8268 |
|
| 8269 |
(define_insn "*tldo_ldx_sp64" |
| 8270 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8271 |
(mem:DI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8272 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8273 |
UNSPEC_TLSLDO) |
| 8274 |
(match_operand:DI 1 "register_operand" "r"))))] |
| 8275 |
"TARGET_TLS && TARGET_ARCH64" |
| 8276 |
"ldx\t[%1 + %2], %0, %%tldo_add(%3)" |
| 8277 |
[(set_attr "type" "load") |
| 8278 |
(set_attr "subtype" "regular")]) |
| 8279 |
|
| 8280 |
(define_insn "*tldo_stb<P:mode>" |
| 8281 |
[(set (mem:QI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8282 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8283 |
UNSPEC_TLSLDO) |
| 8284 |
(match_operand:P 1 "register_operand" "r"))) |
| 8285 |
(match_operand:QI 0 "register_operand" "r"))] |
| 8286 |
"TARGET_TLS" |
| 8287 |
"stb\t%0, [%1 + %2], %%tldo_add(%3)" |
| 8288 |
[(set_attr "type" "store")]) |
| 8289 |
|
| 8290 |
(define_insn "*tldo_sth<P:mode>" |
| 8291 |
[(set (mem:HI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8292 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8293 |
UNSPEC_TLSLDO) |
| 8294 |
(match_operand:P 1 "register_operand" "r"))) |
| 8295 |
(match_operand:HI 0 "register_operand" "r"))] |
| 8296 |
"TARGET_TLS" |
| 8297 |
"sth\t%0, [%1 + %2], %%tldo_add(%3)" |
| 8298 |
[(set_attr "type" "store")]) |
| 8299 |
|
| 8300 |
(define_insn "*tldo_stw<P:mode>" |
| 8301 |
[(set (mem:SI (plus:P (unspec:P [(match_operand:P 2 "register_operand" "r") |
| 8302 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8303 |
UNSPEC_TLSLDO) |
| 8304 |
(match_operand:P 1 "register_operand" "r"))) |
| 8305 |
(match_operand:SI 0 "register_operand" "r"))] |
| 8306 |
"TARGET_TLS" |
| 8307 |
"st\t%0, [%1 + %2], %%tldo_add(%3)" |
| 8308 |
[(set_attr "type" "store")]) |
| 8309 |
|
| 8310 |
(define_insn "*tldo_stx_sp64" |
| 8311 |
[(set (mem:DI (plus:DI (unspec:DI [(match_operand:DI 2 "register_operand" "r") |
| 8312 |
(match_operand 3 "tld_symbolic_operand" "")] |
| 8313 |
UNSPEC_TLSLDO) |
| 8314 |
(match_operand:DI 1 "register_operand" "r"))) |
| 8315 |
(match_operand:DI 0 "register_operand" "r"))] |
| 8316 |
"TARGET_TLS && TARGET_ARCH64" |
| 8317 |
"stx\t%0, [%1 + %2], %%tldo_add(%3)" |
| 8318 |
[(set_attr "type" "store")]) |
| 8319 |
|
| 8320 |
|
| 8321 |
;; Stack protector instructions. |
| 8322 |
|
| 8323 |
(define_expand "stack_protect_set" |
| 8324 |
[(match_operand 0 "memory_operand" "") |
| 8325 |
(match_operand 1 "memory_operand" "")] |
| 8326 |
"" |
| 8327 |
{ |
| 8328 |
#ifdef TARGET_THREAD_SSP_OFFSET |
| 8329 |
rtx tlsreg = gen_rtx_REG (Pmode, 7); |
| 8330 |
rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET)); |
| 8331 |
operands[1] = gen_rtx_MEM (Pmode, addr); |
| 8332 |
#endif |
| 8333 |
if (TARGET_ARCH64) |
| 8334 |
emit_insn (gen_stack_protect_set64 (operands[0], operands[1])); |
| 8335 |
else |
| 8336 |
emit_insn (gen_stack_protect_set32 (operands[0], operands[1])); |
| 8337 |
DONE; |
| 8338 |
}) |
| 8339 |
|
| 8340 |
(define_insn "stack_protect_set32" |
| 8341 |
[(set (match_operand:SI 0 "memory_operand" "=m") |
| 8342 |
(unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET)) |
| 8343 |
(set (match_scratch:SI 2 "=&r") (const_int 0))] |
| 8344 |
"TARGET_ARCH32" |
| 8345 |
{ |
| 8346 |
if (sparc_fix_b2bst) |
| 8347 |
return "ld\t%1, %2\;st\t%2, %0\;mov\t0, %2\;nop"; |
| 8348 |
else |
| 8349 |
return "ld\t%1, %2\;st\t%2, %0\;mov\t0, %2"; |
| 8350 |
} |
| 8351 |
[(set_attr "type" "multi") |
| 8352 |
(set (attr "length") (if_then_else (eq_attr "fix_b2bst" "true") |
| 8353 |
(const_int 4) (const_int 3)))]) |
| 8354 |
|
| 8355 |
(define_insn "stack_protect_set64" |
| 8356 |
[(set (match_operand:DI 0 "memory_operand" "=m") |
| 8357 |
(unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET)) |
| 8358 |
(set (match_scratch:DI 2 "=&r") (const_int 0))] |
| 8359 |
"TARGET_ARCH64" |
| 8360 |
"ldx\t%1, %2\;stx\t%2, %0\;mov\t0, %2" |
| 8361 |
[(set_attr "type" "multi") |
| 8362 |
(set_attr "length" "3")]) |
| 8363 |
|
| 8364 |
(define_expand "stack_protect_test" |
| 8365 |
[(match_operand 0 "memory_operand" "") |
| 8366 |
(match_operand 1 "memory_operand" "") |
| 8367 |
(match_operand 2 "" "")] |
| 8368 |
"" |
| 8369 |
{ |
| 8370 |
rtx result, test; |
| 8371 |
#ifdef TARGET_THREAD_SSP_OFFSET |
| 8372 |
rtx tlsreg = gen_rtx_REG (Pmode, 7); |
| 8373 |
rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET)); |
| 8374 |
operands[1] = gen_rtx_MEM (Pmode, addr); |
| 8375 |
#endif |
| 8376 |
if (TARGET_ARCH64) |
| 8377 |
{ |
| 8378 |
result = gen_reg_rtx (Pmode); |
| 8379 |
emit_insn (gen_stack_protect_test64 (result, operands[0], operands[1])); |
| 8380 |
test = gen_rtx_EQ (VOIDmode, result, const0_rtx); |
| 8381 |
emit_jump_insn (gen_cbranchdi4 (test, result, const0_rtx, operands[2])); |
| 8382 |
} |
| 8383 |
else |
| 8384 |
{ |
| 8385 |
emit_insn (gen_stack_protect_test32 (operands[0], operands[1])); |
| 8386 |
result = gen_rtx_REG (CCmode, SPARC_ICC_REG); |
| 8387 |
test = gen_rtx_EQ (VOIDmode, result, const0_rtx); |
| 8388 |
emit_jump_insn (gen_cbranchcc4 (test, result, const0_rtx, operands[2])); |
| 8389 |
} |
| 8390 |
DONE; |
| 8391 |
}) |
| 8392 |
|
| 8393 |
(define_insn "stack_protect_test32" |
| 8394 |
[(set (reg:CC CC_REG) |
| 8395 |
(unspec:CC [(match_operand:SI 0 "memory_operand" "m") |
| 8396 |
(match_operand:SI 1 "memory_operand" "m")] |
| 8397 |
UNSPEC_SP_TEST)) |
| 8398 |
(set (match_scratch:SI 3 "=r") (const_int 0)) |
| 8399 |
(clobber (match_scratch:SI 2 "=&r"))] |
| 8400 |
"TARGET_ARCH32" |
| 8401 |
"ld\t%0, %2\;ld\t%1, %3\;xorcc\t%2, %3, %2\;mov\t0, %3" |
| 8402 |
[(set_attr "type" "multi") |
| 8403 |
(set_attr "length" "4")]) |
| 8404 |
|
| 8405 |
(define_insn "stack_protect_test64" |
| 8406 |
[(set (match_operand:DI 0 "register_operand" "=&r") |
| 8407 |
(unspec:DI [(match_operand:DI 1 "memory_operand" "m") |
| 8408 |
(match_operand:DI 2 "memory_operand" "m")] |
| 8409 |
UNSPEC_SP_TEST)) |
| 8410 |
(set (match_scratch:DI 3 "=r") (const_int 0))] |
| 8411 |
"TARGET_ARCH64" |
| 8412 |
"ldx\t%1, %0\;ldx\t%2, %3\;xor\t%0, %3, %0\;mov\t0, %3" |
| 8413 |
[(set_attr "type" "multi") |
| 8414 |
(set_attr "length" "4")]) |
| 8415 |
|
| 8416 |
|
| 8417 |
;; Vector instructions. |
| 8418 |
|
| 8419 |
(define_mode_iterator VM32 [V1SI V2HI V4QI]) |
| 8420 |
(define_mode_iterator VM64 [V1DI V2SI V4HI V8QI]) |
| 8421 |
(define_mode_iterator VMALL [V1SI V2HI V4QI V1DI V2SI V4HI V8QI]) |
| 8422 |
|
| 8423 |
(define_mode_attr vbits [(V2SI "32") (V4HI "16") (V1SI "32s") (V2HI "16s") |
| 8424 |
(V8QI "8")]) |
| 8425 |
(define_mode_attr vconstr [(V1SI "f") (V2HI "f") (V4QI "f") |
| 8426 |
(V1DI "e") (V2SI "e") (V4HI "e") (V8QI "e")]) |
| 8427 |
(define_mode_attr vfptype [(V1SI "single") (V2HI "single") (V4QI "single") |
| 8428 |
(V1DI "double") (V2SI "double") (V4HI "double") |
| 8429 |
(V8QI "double")]) |
| 8430 |
(define_mode_attr veltmode [(V1SI "si") (V2HI "hi") (V4QI "qi") (V1DI "di") |
| 8431 |
(V2SI "si") (V4HI "hi") (V8QI "qi")]) |
| 8432 |
|
| 8433 |
(define_expand "mov<VMALL:mode>" |
| 8434 |
[(set (match_operand:VMALL 0 "nonimmediate_operand" "") |
| 8435 |
(match_operand:VMALL 1 "general_operand" ""))] |
| 8436 |
"TARGET_VIS" |
| 8437 |
{ |
| 8438 |
if (sparc_expand_move (<VMALL:MODE>mode, operands)) |
| 8439 |
DONE; |
| 8440 |
}) |
| 8441 |
|
| 8442 |
(define_insn "*mov<VM32:mode>_insn" |
| 8443 |
[(set (match_operand:VM32 0 "nonimmediate_operand" "=f,f,f,f,m,m,*r, m,*r,*r, f") |
| 8444 |
(match_operand:VM32 1 "input_operand" "Y,Z,f,m,f,Y, m,*r,*r, f,*r"))] |
| 8445 |
"TARGET_VIS |
| 8446 |
&& (register_operand (operands[0], <VM32:MODE>mode) |
| 8447 |
|| register_or_zero_or_all_ones_operand (operands[1], <VM32:MODE>mode))" |
| 8448 |
"@ |
| 8449 |
fzeros\t%0 |
| 8450 |
fones\t%0 |
| 8451 |
fsrc2s\t%1, %0 |
| 8452 |
ld\t%1, %0 |
| 8453 |
st\t%1, %0 |
| 8454 |
st\t%r1, %0 |
| 8455 |
ld\t%1, %0 |
| 8456 |
st\t%1, %0 |
| 8457 |
mov\t%1, %0 |
| 8458 |
movstouw\t%1, %0 |
| 8459 |
movwtos\t%1, %0" |
| 8460 |
[(set_attr "type" "visl,visl,vismv,fpload,fpstore,store,load,store,*,vismv,vismv") |
| 8461 |
(set_attr "subtype" "single,single,single,*,*,*,regular,*,*,movstouw,single") |
| 8462 |
(set_attr "cpu_feature" "vis,vis,vis,*,*,*,*,*,*,vis3,vis3")]) |
| 8463 |
|
| 8464 |
(define_insn "*mov<VM64:mode>_insn_sp64" |
| 8465 |
[(set (match_operand:VM64 0 "nonimmediate_operand" "=e,e,e,e,m,m,*r, m,*r, e,*r") |
| 8466 |
(match_operand:VM64 1 "input_operand" "Y,Z,e,m,e,Y, m,*r, e,*r,*r"))] |
| 8467 |
"TARGET_VIS |
| 8468 |
&& TARGET_ARCH64 |
| 8469 |
&& (register_operand (operands[0], <VM64:MODE>mode) |
| 8470 |
|| register_or_zero_or_all_ones_operand (operands[1], <VM64:MODE>mode))" |
| 8471 |
"@ |
| 8472 |
fzero\t%0 |
| 8473 |
fone\t%0 |
| 8474 |
fsrc2\t%1, %0 |
| 8475 |
ldd\t%1, %0 |
| 8476 |
std\t%1, %0 |
| 8477 |
stx\t%r1, %0 |
| 8478 |
ldx\t%1, %0 |
| 8479 |
stx\t%1, %0 |
| 8480 |
movdtox\t%1, %0 |
| 8481 |
movxtod\t%1, %0 |
| 8482 |
mov\t%1, %0" |
| 8483 |
[(set_attr "type" "visl,visl,vismv,fpload,fpstore,store,load,store,vismv,vismv,*") |
| 8484 |
(set_attr "subtype" "double,double,double,*,*,*,regular,*,movdtox,movxtod,*") |
| 8485 |
(set_attr "cpu_feature" "vis,vis,vis,*,*,*,*,*,vis3,vis3,*")]) |
| 8486 |
|
| 8487 |
(define_insn "*mov<VM64:mode>_insn_sp32" |
| 8488 |
[(set (match_operand:VM64 0 "nonimmediate_operand" |
| 8489 |
"=T,o,e,e,e,*r, f,e,T,f,o,*r,*r, o") |
| 8490 |
(match_operand:VM64 1 "input_operand" |
| 8491 |
" Y,Y,Y,Z,e, f,*r,T,e,o,f,*r, o,*r"))] |
| 8492 |
"TARGET_VIS |
| 8493 |
&& TARGET_ARCH32 |
| 8494 |
&& (register_operand (operands[0], <VM64:MODE>mode) |
| 8495 |
|| register_or_zero_or_all_ones_operand (operands[1], <VM64:MODE>mode))" |
| 8496 |
"@ |
| 8497 |
stx\t%r1, %0 |
| 8498 |
# |
| 8499 |
fzero\t%0 |
| 8500 |
fone\t%0 |
| 8501 |
fsrc2\t%1, %0 |
| 8502 |
# |
| 8503 |
# |
| 8504 |
ldd\t%1, %0 |
| 8505 |
std\t%1, %0 |
| 8506 |
# |
| 8507 |
# |
| 8508 |
# |
| 8509 |
ldd\t%1, %0 |
| 8510 |
std\t%1, %0" |
| 8511 |
[(set_attr "type" "store,*,visl,visl,vismv,*,*,fpload,fpstore,*,*,*,load,store") |
| 8512 |
(set_attr "subtype" "*,*,double,double,double,*,*,*,*,*,*,*,regular,*") |
| 8513 |
(set_attr "length" "*,2,*,*,*,2,2,*,*,2,2,2,*,*") |
| 8514 |
(set_attr "cpu_feature" "*,*,vis,vis,vis,vis3,vis3,*,*,*,*,*,*,*")]) |
| 8515 |
|
| 8516 |
(define_split |
| 8517 |
[(set (match_operand:VM64 0 "register_operand" "") |
| 8518 |
(match_operand:VM64 1 "register_operand" ""))] |
| 8519 |
"reload_completed |
| 8520 |
&& TARGET_VIS |
| 8521 |
&& TARGET_ARCH32 |
| 8522 |
&& sparc_split_reg_reg_legitimate (operands[0], operands[1])" |
| 8523 |
[(clobber (const_int 0))] |
| 8524 |
{ |
| 8525 |
sparc_split_reg_reg (operands[0], operands[1], SImode); |
| 8526 |
DONE; |
| 8527 |
}) |
| 8528 |
|
| 8529 |
(define_split |
| 8530 |
[(set (match_operand:VM64 0 "register_operand" "") |
| 8531 |
(match_operand:VM64 1 "memory_operand" ""))] |
| 8532 |
"reload_completed |
| 8533 |
&& TARGET_VIS |
| 8534 |
&& TARGET_ARCH32 |
| 8535 |
&& sparc_split_reg_mem_legitimate (operands[0], operands[1])" |
| 8536 |
[(clobber (const_int 0))] |
| 8537 |
{ |
| 8538 |
sparc_split_reg_mem (operands[0], operands[1], SImode); |
| 8539 |
DONE; |
| 8540 |
}) |
| 8541 |
|
| 8542 |
(define_split |
| 8543 |
[(set (match_operand:VM64 0 "memory_operand" "") |
| 8544 |
(match_operand:VM64 1 "register_operand" ""))] |
| 8545 |
"reload_completed |
| 8546 |
&& TARGET_VIS |
| 8547 |
&& TARGET_ARCH32 |
| 8548 |
&& sparc_split_reg_mem_legitimate (operands[1], operands[0])" |
| 8549 |
[(clobber (const_int 0))] |
| 8550 |
{ |
| 8551 |
sparc_split_mem_reg (operands[0], operands[1], SImode); |
| 8552 |
DONE; |
| 8553 |
}) |
| 8554 |
|
| 8555 |
(define_split |
| 8556 |
[(set (match_operand:VM64 0 "memory_operand" "") |
| 8557 |
(match_operand:VM64 1 "const_zero_operand" ""))] |
| 8558 |
"reload_completed |
| 8559 |
&& TARGET_VIS |
| 8560 |
&& TARGET_ARCH32 |
| 8561 |
&& !mem_min_alignment (operands[0], 8) |
| 8562 |
&& offsettable_memref_p (operands[0])" |
| 8563 |
[(clobber (const_int 0))] |
| 8564 |
{ |
| 8565 |
emit_move_insn_1 (adjust_address (operands[0], SImode, 0), const0_rtx); |
| 8566 |
emit_move_insn_1 (adjust_address (operands[0], SImode, 4), const0_rtx); |
| 8567 |
DONE; |
| 8568 |
}) |
| 8569 |
|
| 8570 |
(define_expand "vec_init<VMALL:mode><VMALL:veltmode>" |
| 8571 |
[(match_operand:VMALL 0 "register_operand" "") |
| 8572 |
(match_operand:VMALL 1 "" "")] |
| 8573 |
"TARGET_VIS" |
| 8574 |
{ |
| 8575 |
sparc_expand_vector_init (operands[0], operands[1]); |
| 8576 |
DONE; |
| 8577 |
}) |
| 8578 |
|
| 8579 |
(define_code_iterator plusminus [plus minus]) |
| 8580 |
(define_code_attr plusminus_insn [(plus "add") (minus "sub")]) |
| 8581 |
|
| 8582 |
(define_mode_iterator VADDSUB [V1SI V2SI V2HI V4HI]) |
| 8583 |
|
| 8584 |
(define_insn "<plusminus_insn><VADDSUB:mode>3" |
| 8585 |
[(set (match_operand:VADDSUB 0 "register_operand" "=<vconstr>") |
| 8586 |
(plusminus:VADDSUB (match_operand:VADDSUB 1 "register_operand" "<vconstr>") |
| 8587 |
(match_operand:VADDSUB 2 "register_operand" "<vconstr>")))] |
| 8588 |
"TARGET_VIS" |
| 8589 |
"fp<plusminus_insn><vbits>\t%1, %2, %0" |
| 8590 |
[(set_attr "type" "fga") |
| 8591 |
(set_attr "subtype" "other") |
| 8592 |
(set_attr "fptype" "<vfptype>")]) |
| 8593 |
|
| 8594 |
(define_mode_iterator VL [V1SI V2HI V4QI V1DI V2SI V4HI V8QI]) |
| 8595 |
(define_mode_attr vlsuf [(V1SI "s") (V2HI "s") (V4QI "s") |
| 8596 |
(V1DI "") (V2SI "") (V4HI "") (V8QI "")]) |
| 8597 |
(define_code_iterator vlop [ior and xor]) |
| 8598 |
(define_code_attr vlinsn [(ior "or") (and "and") (xor "xor")]) |
| 8599 |
(define_code_attr vlninsn [(ior "nor") (and "nand") (xor "xnor")]) |
| 8600 |
|
| 8601 |
(define_insn "<vlop:code><VL:mode>3" |
| 8602 |
[(set (match_operand:VL 0 "register_operand" "=<vconstr>") |
| 8603 |
(vlop:VL (match_operand:VL 1 "register_operand" "<vconstr>") |
| 8604 |
(match_operand:VL 2 "register_operand" "<vconstr>")))] |
| 8605 |
"TARGET_VIS" |
| 8606 |
"f<vlinsn><vlsuf>\t%1, %2, %0" |
| 8607 |
[(set_attr "type" "visl") |
| 8608 |
(set_attr "fptype" "<vfptype>")]) |
| 8609 |
|
| 8610 |
(define_insn "*not_<vlop:code><VL:mode>3" |
| 8611 |
[(set (match_operand:VL 0 "register_operand" "=<vconstr>") |
| 8612 |
(not:VL (vlop:VL (match_operand:VL 1 "register_operand" "<vconstr>") |
| 8613 |
(match_operand:VL 2 "register_operand" "<vconstr>"))))] |
| 8614 |
"TARGET_VIS" |
| 8615 |
"f<vlninsn><vlsuf>\t%1, %2, %0" |
| 8616 |
[(set_attr "type" "visl") |
| 8617 |
(set_attr "fptype" "<vfptype>")]) |
| 8618 |
|
| 8619 |
;; (ior (not (op1)) (not (op2))) is the canonical form of NAND. |
| 8620 |
(define_insn "*nand<VL:mode>_vis" |
| 8621 |
[(set (match_operand:VL 0 "register_operand" "=<vconstr>") |
| 8622 |
(ior:VL (not:VL (match_operand:VL 1 "register_operand" "<vconstr>")) |
| 8623 |
(not:VL (match_operand:VL 2 "register_operand" "<vconstr>"))))] |
| 8624 |
"TARGET_VIS" |
| 8625 |
"fnand<vlsuf>\t%1, %2, %0" |
| 8626 |
[(set_attr "type" "visl") |
| 8627 |
(set_attr "fptype" "<vfptype>")]) |
| 8628 |
|
| 8629 |
(define_code_iterator vlnotop [ior and]) |
| 8630 |
|
| 8631 |
(define_insn "*<vlnotop:code>_not1<VL:mode>_vis" |
| 8632 |
[(set (match_operand:VL 0 "register_operand" "=<vconstr>") |
| 8633 |
(vlnotop:VL (not:VL (match_operand:VL 1 "register_operand" "<vconstr>")) |
| 8634 |
(match_operand:VL 2 "register_operand" "<vconstr>")))] |
| 8635 |
"TARGET_VIS" |
| 8636 |
"f<vlinsn>not1<vlsuf>\t%1, %2, %0" |
| 8637 |
[(set_attr "type" "visl") |
| 8638 |
(set_attr "fptype" "<vfptype>")]) |
| 8639 |
|
| 8640 |
(define_insn "*<vlnotop:code>_not2<VL:mode>_vis" |
| 8641 |
[(set (match_operand:VL 0 "register_operand" "=<vconstr>") |
| 8642 |
(vlnotop:VL (match_operand:VL 1 "register_operand" "<vconstr>") |
| 8643 |
(not:VL (match_operand:VL 2 "register_operand" "<vconstr>"))))] |
| 8644 |
"TARGET_VIS" |
| 8645 |
"f<vlinsn>not2<vlsuf>\t%1, %2, %0" |
| 8646 |
[(set_attr "type" "visl") |
| 8647 |
(set_attr "fptype" "<vfptype>")]) |
| 8648 |
|
| 8649 |
(define_insn "one_cmpl<VL:mode>2" |
| 8650 |
[(set (match_operand:VL 0 "register_operand" "=<vconstr>") |
| 8651 |
(not:VL (match_operand:VL 1 "register_operand" "<vconstr>")))] |
| 8652 |
"TARGET_VIS" |
| 8653 |
"fnot1<vlsuf>\t%1, %0" |
| 8654 |
[(set_attr "type" "visl") |
| 8655 |
(set_attr "fptype" "<vfptype>")]) |
| 8656 |
|
| 8657 |
;; Hard to generate VIS instructions. We have builtins for these. |
| 8658 |
|
| 8659 |
(define_insn "fpack16_vis" |
| 8660 |
[(set (match_operand:V4QI 0 "register_operand" "=f") |
| 8661 |
(unspec:V4QI [(match_operand:V4HI 1 "register_operand" "e") |
| 8662 |
(reg:DI GSR_REG)] |
| 8663 |
UNSPEC_FPACK16))] |
| 8664 |
"TARGET_VIS" |
| 8665 |
"fpack16\t%1, %0" |
| 8666 |
[(set_attr "type" "fgm_pack") |
| 8667 |
(set_attr "fptype" "double")]) |
| 8668 |
|
| 8669 |
(define_insn "fpackfix_vis" |
| 8670 |
[(set (match_operand:V2HI 0 "register_operand" "=f") |
| 8671 |
(unspec:V2HI [(match_operand:V2SI 1 "register_operand" "e") |
| 8672 |
(reg:DI GSR_REG)] |
| 8673 |
UNSPEC_FPACKFIX))] |
| 8674 |
"TARGET_VIS" |
| 8675 |
"fpackfix\t%1, %0" |
| 8676 |
[(set_attr "type" "fgm_pack") |
| 8677 |
(set_attr "fptype" "double")]) |
| 8678 |
|
| 8679 |
(define_insn "fpack32_vis" |
| 8680 |
[(set (match_operand:V8QI 0 "register_operand" "=e") |
| 8681 |
(unspec:V8QI [(match_operand:V2SI 1 "register_operand" "e") |
| 8682 |
(match_operand:V8QI 2 "register_operand" "e") |
| 8683 |
(reg:DI GSR_REG)] |
| 8684 |
UNSPEC_FPACK32))] |
| 8685 |
"TARGET_VIS" |
| 8686 |
"fpack32\t%1, %2, %0" |
| 8687 |
[(set_attr "type" "fgm_pack") |
| 8688 |
(set_attr "fptype" "double")]) |
| 8689 |
|
| 8690 |
(define_insn "fexpand_vis" |
| 8691 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 8692 |
(unspec:V4HI [(match_operand:V4QI 1 "register_operand" "f")] |
| 8693 |
UNSPEC_FEXPAND))] |
| 8694 |
"TARGET_VIS" |
| 8695 |
"fexpand\t%1, %0" |
| 8696 |
[(set_attr "type" "fga") |
| 8697 |
(set_attr "subtype" "fpu") |
| 8698 |
(set_attr "fptype" "double")]) |
| 8699 |
|
| 8700 |
(define_insn "fpmerge_vis" |
| 8701 |
[(set (match_operand:V8QI 0 "register_operand" "=e") |
| 8702 |
(vec_select:V8QI |
| 8703 |
(vec_concat:V8QI (match_operand:V4QI 1 "register_operand" "f") |
| 8704 |
(match_operand:V4QI 2 "register_operand" "f")) |
| 8705 |
(parallel [(const_int 0) (const_int 4) |
| 8706 |
(const_int 1) (const_int 5) |
| 8707 |
(const_int 2) (const_int 6) |
| 8708 |
(const_int 3) (const_int 7)])))] |
| 8709 |
"TARGET_VIS" |
| 8710 |
"fpmerge\t%1, %2, %0" |
| 8711 |
[(set_attr "type" "fga") |
| 8712 |
(set_attr "subtype" "fpu") |
| 8713 |
(set_attr "fptype" "double")]) |
| 8714 |
|
| 8715 |
;; Partitioned multiply instructions |
| 8716 |
(define_insn "fmul8x16_vis" |
| 8717 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 8718 |
(unspec:V4HI [(match_operand:V4QI 1 "register_operand" "f") |
| 8719 |
(match_operand:V4HI 2 "register_operand" "e")] |
| 8720 |
UNSPEC_MUL8))] |
| 8721 |
"TARGET_VIS" |
| 8722 |
"fmul8x16\t%1, %2, %0" |
| 8723 |
[(set_attr "type" "fgm_mul") |
| 8724 |
(set_attr "fptype" "double")]) |
| 8725 |
|
| 8726 |
(define_insn "fmul8x16au_vis" |
| 8727 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 8728 |
(unspec:V4HI [(match_operand:V4QI 1 "register_operand" "f") |
| 8729 |
(match_operand:V2HI 2 "register_operand" "f")] |
| 8730 |
UNSPEC_MUL16AU))] |
| 8731 |
"TARGET_VIS" |
| 8732 |
"fmul8x16au\t%1, %2, %0" |
| 8733 |
[(set_attr "type" "fgm_mul") |
| 8734 |
(set_attr "fptype" "double")]) |
| 8735 |
|
| 8736 |
(define_insn "fmul8x16al_vis" |
| 8737 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 8738 |
(unspec:V4HI [(match_operand:V4QI 1 "register_operand" "f") |
| 8739 |
(match_operand:V2HI 2 "register_operand" "f")] |
| 8740 |
UNSPEC_MUL16AL))] |
| 8741 |
"TARGET_VIS" |
| 8742 |
"fmul8x16al\t%1, %2, %0" |
| 8743 |
[(set_attr "type" "fgm_mul") |
| 8744 |
(set_attr "fptype" "double")]) |
| 8745 |
|
| 8746 |
(define_insn "fmul8sux16_vis" |
| 8747 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 8748 |
(unspec:V4HI [(match_operand:V8QI 1 "register_operand" "e") |
| 8749 |
(match_operand:V4HI 2 "register_operand" "e")] |
| 8750 |
UNSPEC_MUL8SU))] |
| 8751 |
"TARGET_VIS" |
| 8752 |
"fmul8sux16\t%1, %2, %0" |
| 8753 |
[(set_attr "type" "fgm_mul") |
| 8754 |
(set_attr "fptype" "double")]) |
| 8755 |
|
| 8756 |
(define_insn "fmul8ulx16_vis" |
| 8757 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 8758 |
(unspec:V4HI [(match_operand:V8QI 1 "register_operand" "e") |
| 8759 |
(match_operand:V4HI 2 "register_operand" "e")] |
| 8760 |
UNSPEC_MUL8UL))] |
| 8761 |
"TARGET_VIS" |
| 8762 |
"fmul8ulx16\t%1, %2, %0" |
| 8763 |
[(set_attr "type" "fgm_mul") |
| 8764 |
(set_attr "fptype" "double")]) |
| 8765 |
|
| 8766 |
(define_insn "fmuld8sux16_vis" |
| 8767 |
[(set (match_operand:V2SI 0 "register_operand" "=e") |
| 8768 |
(unspec:V2SI [(match_operand:V4QI 1 "register_operand" "f") |
| 8769 |
(match_operand:V2HI 2 "register_operand" "f")] |
| 8770 |
UNSPEC_MULDSU))] |
| 8771 |
"TARGET_VIS" |
| 8772 |
"fmuld8sux16\t%1, %2, %0" |
| 8773 |
[(set_attr "type" "fgm_mul") |
| 8774 |
(set_attr "fptype" "double")]) |
| 8775 |
|
| 8776 |
(define_insn "fmuld8ulx16_vis" |
| 8777 |
[(set (match_operand:V2SI 0 "register_operand" "=e") |
| 8778 |
(unspec:V2SI [(match_operand:V4QI 1 "register_operand" "f") |
| 8779 |
(match_operand:V2HI 2 "register_operand" "f")] |
| 8780 |
UNSPEC_MULDUL))] |
| 8781 |
"TARGET_VIS" |
| 8782 |
"fmuld8ulx16\t%1, %2, %0" |
| 8783 |
[(set_attr "type" "fgm_mul") |
| 8784 |
(set_attr "fptype" "double")]) |
| 8785 |
|
| 8786 |
(define_expand "wrgsr_vis" |
| 8787 |
[(set (reg:DI GSR_REG) (match_operand:DI 0 "arith_operand" ""))] |
| 8788 |
"TARGET_VIS" |
| 8789 |
{ |
| 8790 |
if (TARGET_ARCH32) |
| 8791 |
{ |
| 8792 |
emit_insn (gen_wrgsr_v8plus (operands[0])); |
| 8793 |
DONE; |
| 8794 |
} |
| 8795 |
}) |
| 8796 |
|
| 8797 |
(define_insn "*wrgsr_sp64" |
| 8798 |
[(set (reg:DI GSR_REG) (match_operand:DI 0 "arith_operand" "rI"))] |
| 8799 |
"TARGET_VIS && TARGET_ARCH64" |
| 8800 |
"wr\t%%g0, %0, %%gsr" |
| 8801 |
[(set_attr "type" "gsr") |
| 8802 |
(set_attr "subtype" "reg")]) |
| 8803 |
|
| 8804 |
(define_insn "wrgsr_v8plus" |
| 8805 |
[(set (reg:DI GSR_REG) (match_operand:DI 0 "arith_operand" "I,r")) |
| 8806 |
(clobber (match_scratch:SI 1 "=X,&h"))] |
| 8807 |
"TARGET_VIS && TARGET_ARCH32" |
| 8808 |
{ |
| 8809 |
if (GET_CODE (operands[0]) == CONST_INT |
| 8810 |
|| sparc_check_64 (operands[0], insn)) |
| 8811 |
return "wr\t%%g0, %0, %%gsr"; |
| 8812 |
|
| 8813 |
output_asm_insn("srl\t%L0, 0, %L0", operands); |
| 8814 |
return "sllx\t%H0, 32, %1\n\tor\t%L0, %1, %1\n\twr\t%%g0, %1, %%gsr"; |
| 8815 |
} |
| 8816 |
[(set_attr "type" "multi")]) |
| 8817 |
|
| 8818 |
(define_expand "rdgsr_vis" |
| 8819 |
[(set (match_operand:DI 0 "register_operand" "") (reg:DI GSR_REG))] |
| 8820 |
"TARGET_VIS" |
| 8821 |
{ |
| 8822 |
if (TARGET_ARCH32) |
| 8823 |
{ |
| 8824 |
emit_insn (gen_rdgsr_v8plus (operands[0])); |
| 8825 |
DONE; |
| 8826 |
} |
| 8827 |
}) |
| 8828 |
|
| 8829 |
(define_insn "*rdgsr_sp64" |
| 8830 |
[(set (match_operand:DI 0 "register_operand" "=r") (reg:DI GSR_REG))] |
| 8831 |
"TARGET_VIS && TARGET_ARCH64" |
| 8832 |
"rd\t%%gsr, %0" |
| 8833 |
[(set_attr "type" "gsr") |
| 8834 |
(set_attr "subtype" "reg")]) |
| 8835 |
|
| 8836 |
(define_insn "rdgsr_v8plus" |
| 8837 |
[(set (match_operand:DI 0 "register_operand" "=r") (reg:DI GSR_REG)) |
| 8838 |
(clobber (match_scratch:SI 1 "=&h"))] |
| 8839 |
"TARGET_VIS && TARGET_ARCH32" |
| 8840 |
{ |
| 8841 |
return "rd\t%%gsr, %1\n\tsrlx\t%1, 32, %H0\n\tmov %1, %L0"; |
| 8842 |
} |
| 8843 |
[(set_attr "type" "multi")]) |
| 8844 |
|
| 8845 |
;; Using faligndata only makes sense after an alignaddr since the choice of |
| 8846 |
;; bytes to take out of each operand is dependent on the results of the last |
| 8847 |
;; alignaddr. |
| 8848 |
(define_insn "faligndata<VM64:mode>_vis" |
| 8849 |
[(set (match_operand:VM64 0 "register_operand" "=e") |
| 8850 |
(unspec:VM64 [(match_operand:VM64 1 "register_operand" "e") |
| 8851 |
(match_operand:VM64 2 "register_operand" "e") |
| 8852 |
(reg:DI GSR_REG)] |
| 8853 |
UNSPEC_ALIGNDATA))] |
| 8854 |
"TARGET_VIS" |
| 8855 |
"faligndata\t%1, %2, %0" |
| 8856 |
[(set_attr "type" "fga") |
| 8857 |
(set_attr "subtype" "other") |
| 8858 |
(set_attr "fptype" "double")]) |
| 8859 |
|
| 8860 |
(define_insn "alignaddrsi_vis" |
| 8861 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8862 |
(plus:SI (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 8863 |
(match_operand:SI 2 "register_or_zero_operand" "rJ"))) |
| 8864 |
(set (zero_extract:DI (reg:DI GSR_REG) (const_int 3) (const_int 0)) |
| 8865 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] |
| 8866 |
"TARGET_VIS" |
| 8867 |
"alignaddr\t%r1, %r2, %0" |
| 8868 |
[(set_attr "type" "gsr") |
| 8869 |
(set_attr "subtype" "alignaddr")]) |
| 8870 |
|
| 8871 |
(define_insn "alignaddrdi_vis" |
| 8872 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8873 |
(plus:DI (match_operand:DI 1 "register_or_zero_operand" "rJ") |
| 8874 |
(match_operand:DI 2 "register_or_zero_operand" "rJ"))) |
| 8875 |
(set (zero_extract:DI (reg:DI GSR_REG) (const_int 3) (const_int 0)) |
| 8876 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 8877 |
"TARGET_VIS" |
| 8878 |
"alignaddr\t%r1, %r2, %0" |
| 8879 |
[(set_attr "type" "gsr") |
| 8880 |
(set_attr "subtype" "alignaddr")]) |
| 8881 |
|
| 8882 |
(define_insn "alignaddrlsi_vis" |
| 8883 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 8884 |
(plus:SI (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 8885 |
(match_operand:SI 2 "register_or_zero_operand" "rJ"))) |
| 8886 |
(set (zero_extract:DI (reg:DI GSR_REG) (const_int 3) (const_int 0)) |
| 8887 |
(xor:DI (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))) |
| 8888 |
(const_int 7)))] |
| 8889 |
"TARGET_VIS" |
| 8890 |
"alignaddrl\t%r1, %r2, %0" |
| 8891 |
[(set_attr "type" "gsr") |
| 8892 |
(set_attr "subtype" "alignaddr")]) |
| 8893 |
|
| 8894 |
(define_insn "alignaddrldi_vis" |
| 8895 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 8896 |
(plus:DI (match_operand:DI 1 "register_or_zero_operand" "rJ") |
| 8897 |
(match_operand:DI 2 "register_or_zero_operand" "rJ"))) |
| 8898 |
(set (zero_extract:DI (reg:DI GSR_REG) (const_int 3) (const_int 0)) |
| 8899 |
(xor:DI (plus:DI (match_dup 1) (match_dup 2)) |
| 8900 |
(const_int 7)))] |
| 8901 |
"TARGET_VIS" |
| 8902 |
"alignaddrl\t%r1, %r2, %0" |
| 8903 |
[(set_attr "type" "gsr") |
| 8904 |
(set_attr "subtype" "alignaddr")]) |
| 8905 |
|
| 8906 |
(define_insn "pdist_vis" |
| 8907 |
[(set (match_operand:DI 0 "register_operand" "=e") |
| 8908 |
(unspec:DI [(match_operand:V8QI 1 "register_operand" "e") |
| 8909 |
(match_operand:V8QI 2 "register_operand" "e") |
| 8910 |
(match_operand:DI 3 "register_operand" "0")] |
| 8911 |
UNSPEC_PDIST))] |
| 8912 |
"TARGET_VIS" |
| 8913 |
"pdist\t%1, %2, %0" |
| 8914 |
[(set_attr "type" "pdist") |
| 8915 |
(set_attr "fptype" "double")]) |
| 8916 |
|
| 8917 |
;; Edge instructions produce condition codes equivalent to a 'subcc' |
| 8918 |
;; with the same operands. |
| 8919 |
(define_insn "edge8<P:mode>_vis" |
| 8920 |
[(set (reg:CCNZ CC_REG) |
| 8921 |
(compare:CCNZ (minus:P (match_operand:P 1 "register_or_zero_operand" "rJ") |
| 8922 |
(match_operand:P 2 "register_or_zero_operand" "rJ")) |
| 8923 |
(const_int 0))) |
| 8924 |
(set (match_operand:P 0 "register_operand" "=r") |
| 8925 |
(unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_EDGE8))] |
| 8926 |
"TARGET_VIS" |
| 8927 |
"edge8\t%r1, %r2, %0" |
| 8928 |
[(set_attr "type" "edge")]) |
| 8929 |
|
| 8930 |
(define_insn "edge8l<P:mode>_vis" |
| 8931 |
[(set (reg:CCNZ CC_REG) |
| 8932 |
(compare:CCNZ (minus:P (match_operand:P 1 "register_or_zero_operand" "rJ") |
| 8933 |
(match_operand:P 2 "register_or_zero_operand" "rJ")) |
| 8934 |
(const_int 0))) |
| 8935 |
(set (match_operand:P 0 "register_operand" "=r") |
| 8936 |
(unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_EDGE8L))] |
| 8937 |
"TARGET_VIS" |
| 8938 |
"edge8l\t%r1, %r2, %0" |
| 8939 |
[(set_attr "type" "edge")]) |
| 8940 |
|
| 8941 |
(define_insn "edge16<P:mode>_vis" |
| 8942 |
[(set (reg:CCNZ CC_REG) |
| 8943 |
(compare:CCNZ (minus:P (match_operand:P 1 "register_or_zero_operand" "rJ") |
| 8944 |
(match_operand:P 2 "register_or_zero_operand" "rJ")) |
| 8945 |
(const_int 0))) |
| 8946 |
(set (match_operand:P 0 "register_operand" "=r") |
| 8947 |
(unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_EDGE16))] |
| 8948 |
"TARGET_VIS" |
| 8949 |
"edge16\t%r1, %r2, %0" |
| 8950 |
[(set_attr "type" "edge")]) |
| 8951 |
|
| 8952 |
(define_insn "edge16l<P:mode>_vis" |
| 8953 |
[(set (reg:CCNZ CC_REG) |
| 8954 |
(compare:CCNZ (minus:P (match_operand:P 1 "register_or_zero_operand" "rJ") |
| 8955 |
(match_operand:P 2 "register_or_zero_operand" "rJ")) |
| 8956 |
(const_int 0))) |
| 8957 |
(set (match_operand:P 0 "register_operand" "=r") |
| 8958 |
(unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_EDGE16L))] |
| 8959 |
"TARGET_VIS" |
| 8960 |
"edge16l\t%r1, %r2, %0" |
| 8961 |
[(set_attr "type" "edge")]) |
| 8962 |
|
| 8963 |
(define_insn "edge32<P:mode>_vis" |
| 8964 |
[(set (reg:CCNZ CC_REG) |
| 8965 |
(compare:CCNZ (minus:P (match_operand:P 1 "register_or_zero_operand" "rJ") |
| 8966 |
(match_operand:P 2 "register_or_zero_operand" "rJ")) |
| 8967 |
(const_int 0))) |
| 8968 |
(set (match_operand:P 0 "register_operand" "=r") |
| 8969 |
(unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_EDGE32))] |
| 8970 |
"TARGET_VIS" |
| 8971 |
"edge32\t%r1, %r2, %0" |
| 8972 |
[(set_attr "type" "edge")]) |
| 8973 |
|
| 8974 |
(define_insn "edge32l<P:mode>_vis" |
| 8975 |
[(set (reg:CCNZ CC_REG) |
| 8976 |
(compare:CCNZ (minus:P (match_operand:P 1 "register_or_zero_operand" "rJ") |
| 8977 |
(match_operand:P 2 "register_or_zero_operand" "rJ")) |
| 8978 |
(const_int 0))) |
| 8979 |
(set (match_operand:P 0 "register_operand" "=r") |
| 8980 |
(unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_EDGE32L))] |
| 8981 |
"TARGET_VIS" |
| 8982 |
"edge32l\t%r1, %r2, %0" |
| 8983 |
[(set_attr "type" "edge")]) |
| 8984 |
|
| 8985 |
(define_mode_iterator FPCMP [V8QI V4HI V2SI]) |
| 8986 |
(define_code_iterator fpcmpcond [eq ne le gt]) |
| 8987 |
(define_code_iterator fpcmpucond [leu gtu]) |
| 8988 |
(define_code_attr signed_code [(leu "le") (gtu "gt")]) |
| 8989 |
|
| 8990 |
(define_insn "fpcmp<fpcmpcond:code><FPCMP:vbits><P:mode>_vis" |
| 8991 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 8992 |
(fpcmpcond:P (match_operand:FPCMP 1 "register_operand" "e") |
| 8993 |
(match_operand:FPCMP 2 "register_operand" "e")))] |
| 8994 |
"TARGET_VIS |
| 8995 |
&& (<FPCMP:MODE>mode != V8QImode |
| 8996 |
|| (TARGET_VIS3B && (<fpcmpcond:CODE> == EQ || <fpcmpcond:CODE> == NE)) |
| 8997 |
|| TARGET_VIS4)" |
| 8998 |
"fpcmp<fpcmpcond:code><FPCMP:vbits>\t%1, %2, %0" |
| 8999 |
[(set_attr "type" "viscmp")]) |
| 9000 |
|
| 9001 |
(define_expand "vec_cmp<FPCMP:mode><P:mode>" |
| 9002 |
[(set (match_operand:P 0 "register_operand" "") |
| 9003 |
(match_operator:P 1 "vec_cmp_operator" |
| 9004 |
[(match_operand:FPCMP 2 "register_operand" "") |
| 9005 |
(match_operand:FPCMP 3 "register_operand" "")]))] |
| 9006 |
"TARGET_VIS3B" |
| 9007 |
{ |
| 9008 |
enum rtx_code code = GET_CODE (operands[1]); |
| 9009 |
|
| 9010 |
if (code == LT || code == GE) |
| 9011 |
{ |
| 9012 |
PUT_CODE (operands[1], swap_condition (code)); |
| 9013 |
std::swap (operands[2], operands[3]); |
| 9014 |
} |
| 9015 |
}) |
| 9016 |
|
| 9017 |
(define_insn "fpcmpu<fpcmpucond:signed_code><FPCMP:vbits><P:mode>_vis" |
| 9018 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9019 |
(fpcmpucond:P (match_operand:FPCMP 1 "register_operand" "e") |
| 9020 |
(match_operand:FPCMP 2 "register_operand" "e")))] |
| 9021 |
"TARGET_VIS3B && (<FPCMP:MODE>mode == V8QImode || TARGET_VIS4)" |
| 9022 |
"fpcmpu<fpcmpucond:signed_code><FPCMP:vbits>\t%1, %2, %0" |
| 9023 |
[(set_attr "type" "viscmp")]) |
| 9024 |
|
| 9025 |
(define_expand "vec_cmpu<FPCMP:mode><P:mode>" |
| 9026 |
[(set (match_operand:P 0 "register_operand" "") |
| 9027 |
(match_operator:P 1 "vec_cmpu_operator" |
| 9028 |
[(match_operand:FPCMP 2 "register_operand" "") |
| 9029 |
(match_operand:FPCMP 3 "register_operand" "")]))] |
| 9030 |
"TARGET_VIS3B" |
| 9031 |
{ |
| 9032 |
enum rtx_code code = GET_CODE (operands[1]); |
| 9033 |
|
| 9034 |
if (code == LTU || code == GEU) |
| 9035 |
{ |
| 9036 |
PUT_CODE (operands[1], swap_condition (code)); |
| 9037 |
std::swap (operands[2], operands[3]); |
| 9038 |
} |
| 9039 |
}) |
| 9040 |
|
| 9041 |
(define_expand "vcond_mask_<FPCMP:mode><P:mode>" |
| 9042 |
[(match_operand:FPCMP 0 "register_operand" "") |
| 9043 |
(match_operand:FPCMP 1 "register_operand" "") |
| 9044 |
(match_operand:FPCMP 2 "register_operand" "") |
| 9045 |
(match_operand:P 3 "register_operand" "")] |
| 9046 |
"TARGET_VIS3B" |
| 9047 |
{ |
| 9048 |
sparc_expand_vcond_mask (<FPCMP:MODE>mode, operands, UNSPEC_CMASK<vbits>); |
| 9049 |
DONE; |
| 9050 |
}) |
| 9051 |
|
| 9052 |
(define_insn "array8<P:mode>_vis" |
| 9053 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9054 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9055 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9056 |
UNSPEC_ARRAY8))] |
| 9057 |
"TARGET_VIS" |
| 9058 |
"array8\t%r1, %r2, %0" |
| 9059 |
[(set_attr "type" "array")]) |
| 9060 |
|
| 9061 |
(define_insn "array16<P:mode>_vis" |
| 9062 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9063 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9064 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9065 |
UNSPEC_ARRAY16))] |
| 9066 |
"TARGET_VIS" |
| 9067 |
"array16\t%r1, %r2, %0" |
| 9068 |
[(set_attr "type" "array")]) |
| 9069 |
|
| 9070 |
(define_insn "array32<P:mode>_vis" |
| 9071 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9072 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9073 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9074 |
UNSPEC_ARRAY32))] |
| 9075 |
"TARGET_VIS" |
| 9076 |
"array32\t%r1, %r2, %0" |
| 9077 |
[(set_attr "type" "array")]) |
| 9078 |
|
| 9079 |
(define_insn "bmaskdi_vis" |
| 9080 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 9081 |
(plus:DI (match_operand:DI 1 "register_or_zero_operand" "rJ") |
| 9082 |
(match_operand:DI 2 "register_or_zero_operand" "rJ"))) |
| 9083 |
(set (zero_extract:DI (reg:DI GSR_REG) (const_int 32) (const_int 32)) |
| 9084 |
(plus:DI (match_dup 1) (match_dup 2)))] |
| 9085 |
"TARGET_VIS2 && TARGET_ARCH64" |
| 9086 |
"bmask\t%r1, %r2, %0" |
| 9087 |
[(set_attr "type" "bmask")]) |
| 9088 |
|
| 9089 |
(define_insn "bmasksi_vis" |
| 9090 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 9091 |
(plus:SI (match_operand:SI 1 "register_or_zero_operand" "rJ") |
| 9092 |
(match_operand:SI 2 "register_or_zero_operand" "rJ"))) |
| 9093 |
(set (zero_extract:DI (reg:DI GSR_REG) (const_int 32) (const_int 32)) |
| 9094 |
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] |
| 9095 |
"TARGET_VIS2" |
| 9096 |
"bmask\t%r1, %r2, %0" |
| 9097 |
[(set_attr "type" "bmask")]) |
| 9098 |
|
| 9099 |
(define_insn "bshuffle<VM64:mode>_vis" |
| 9100 |
[(set (match_operand:VM64 0 "register_operand" "=e") |
| 9101 |
(unspec:VM64 [(match_operand:VM64 1 "register_operand" "e") |
| 9102 |
(match_operand:VM64 2 "register_operand" "e") |
| 9103 |
(reg:DI GSR_REG)] |
| 9104 |
UNSPEC_BSHUFFLE))] |
| 9105 |
"TARGET_VIS2" |
| 9106 |
"bshuffle\t%1, %2, %0" |
| 9107 |
[(set_attr "type" "fga") |
| 9108 |
(set_attr "subtype" "other") |
| 9109 |
(set_attr "fptype" "double")]) |
| 9110 |
|
| 9111 |
;; Unlike constant permutation, we can vastly simplify the compression of |
| 9112 |
;; the 64-bit selector input to the 32-bit %gsr value by knowing what the |
| 9113 |
;; width of the input is. |
| 9114 |
(define_expand "vec_perm<VM64:mode>" |
| 9115 |
[(match_operand:VM64 0 "register_operand" "") |
| 9116 |
(match_operand:VM64 1 "register_operand" "") |
| 9117 |
(match_operand:VM64 2 "register_operand" "") |
| 9118 |
(match_operand:VM64 3 "register_operand" "")] |
| 9119 |
"TARGET_VIS2" |
| 9120 |
{ |
| 9121 |
sparc_expand_vec_perm_bmask (<MODE>mode, operands[3]); |
| 9122 |
emit_insn (gen_bshuffle<VM64:mode>_vis (operands[0], operands[1], operands[2])); |
| 9123 |
DONE; |
| 9124 |
}) |
| 9125 |
|
| 9126 |
;; VIS 2.0 adds edge variants which do not set the condition codes |
| 9127 |
(define_insn "edge8n<P:mode>_vis" |
| 9128 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9129 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9130 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9131 |
UNSPEC_EDGE8N))] |
| 9132 |
"TARGET_VIS2" |
| 9133 |
"edge8n\t%r1, %r2, %0" |
| 9134 |
[(set_attr "type" "edgen")]) |
| 9135 |
|
| 9136 |
(define_insn "edge8ln<P:mode>_vis" |
| 9137 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9138 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9139 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9140 |
UNSPEC_EDGE8LN))] |
| 9141 |
"TARGET_VIS2" |
| 9142 |
"edge8ln\t%r1, %r2, %0" |
| 9143 |
[(set_attr "type" "edgen")]) |
| 9144 |
|
| 9145 |
(define_insn "edge16n<P:mode>_vis" |
| 9146 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9147 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9148 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9149 |
UNSPEC_EDGE16N))] |
| 9150 |
"TARGET_VIS2" |
| 9151 |
"edge16n\t%r1, %r2, %0" |
| 9152 |
[(set_attr "type" "edgen")]) |
| 9153 |
|
| 9154 |
(define_insn "edge16ln<P:mode>_vis" |
| 9155 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9156 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9157 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9158 |
UNSPEC_EDGE16LN))] |
| 9159 |
"TARGET_VIS2" |
| 9160 |
"edge16ln\t%r1, %r2, %0" |
| 9161 |
[(set_attr "type" "edgen")]) |
| 9162 |
|
| 9163 |
(define_insn "edge32n<P:mode>_vis" |
| 9164 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9165 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9166 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9167 |
UNSPEC_EDGE32N))] |
| 9168 |
"TARGET_VIS2" |
| 9169 |
"edge32n\t%r1, %r2, %0" |
| 9170 |
[(set_attr "type" "edgen")]) |
| 9171 |
|
| 9172 |
(define_insn "edge32ln<P:mode>_vis" |
| 9173 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9174 |
(unspec:P [(match_operand:P 1 "register_or_zero_operand" "rJ") |
| 9175 |
(match_operand:P 2 "register_or_zero_operand" "rJ")] |
| 9176 |
UNSPEC_EDGE32LN))] |
| 9177 |
"TARGET_VIS2" |
| 9178 |
"edge32ln\t%r1, %r2, %0" |
| 9179 |
[(set_attr "type" "edge")]) |
| 9180 |
|
| 9181 |
;; Conditional moves are possible via fcmpX --> cmaskX -> bshuffle |
| 9182 |
(define_insn "cmask8<P:mode>_vis" |
| 9183 |
[(set (reg:DI GSR_REG) |
| 9184 |
(unspec:DI [(match_operand:P 0 "register_or_zero_operand" "rJ") |
| 9185 |
(reg:DI GSR_REG)] |
| 9186 |
UNSPEC_CMASK8))] |
| 9187 |
"TARGET_VIS3" |
| 9188 |
"cmask8\t%r0" |
| 9189 |
[(set_attr "type" "fga") |
| 9190 |
(set_attr "subtype" "cmask")]) |
| 9191 |
|
| 9192 |
(define_insn "cmask16<P:mode>_vis" |
| 9193 |
[(set (reg:DI GSR_REG) |
| 9194 |
(unspec:DI [(match_operand:P 0 "register_or_zero_operand" "rJ") |
| 9195 |
(reg:DI GSR_REG)] |
| 9196 |
UNSPEC_CMASK16))] |
| 9197 |
"TARGET_VIS3" |
| 9198 |
"cmask16\t%r0" |
| 9199 |
[(set_attr "type" "fga") |
| 9200 |
(set_attr "subtype" "cmask")]) |
| 9201 |
|
| 9202 |
(define_insn "cmask32<P:mode>_vis" |
| 9203 |
[(set (reg:DI GSR_REG) |
| 9204 |
(unspec:DI [(match_operand:P 0 "register_or_zero_operand" "rJ") |
| 9205 |
(reg:DI GSR_REG)] |
| 9206 |
UNSPEC_CMASK32))] |
| 9207 |
"TARGET_VIS3" |
| 9208 |
"cmask32\t%r0" |
| 9209 |
[(set_attr "type" "fga") |
| 9210 |
(set_attr "subtype" "cmask")]) |
| 9211 |
|
| 9212 |
(define_insn "fchksm16_vis" |
| 9213 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 9214 |
(unspec:V4HI [(match_operand:V4HI 1 "register_operand" "e") |
| 9215 |
(match_operand:V4HI 2 "register_operand" "e")] |
| 9216 |
UNSPEC_FCHKSM16))] |
| 9217 |
"TARGET_VIS3" |
| 9218 |
"fchksm16\t%1, %2, %0" |
| 9219 |
[(set_attr "type" "fga") |
| 9220 |
(set_attr "subtype" "fpu")]) |
| 9221 |
|
| 9222 |
(define_code_iterator vis3_shift [ashift ss_ashift lshiftrt ashiftrt]) |
| 9223 |
(define_code_attr vis3_shift_insn |
| 9224 |
[(ashift "fsll") (ss_ashift "fslas") (lshiftrt "fsrl") (ashiftrt "fsra")]) |
| 9225 |
(define_code_attr vis3_shift_patname |
| 9226 |
[(ashift "ashl") (ss_ashift "ssashl") (lshiftrt "lshr") (ashiftrt "ashr")]) |
| 9227 |
|
| 9228 |
(define_mode_iterator GCM [V4HI V2SI]) |
| 9229 |
|
| 9230 |
(define_insn "v<vis3_shift_patname><GCM:mode>3" |
| 9231 |
[(set (match_operand:GCM 0 "register_operand" "=<vconstr>") |
| 9232 |
(vis3_shift:GCM (match_operand:GCM 1 "register_operand" "<vconstr>") |
| 9233 |
(match_operand:GCM 2 "register_operand" "<vconstr>")))] |
| 9234 |
"TARGET_VIS3" |
| 9235 |
"<vis3_shift_insn><vbits>\t%1, %2, %0" |
| 9236 |
[(set_attr "type" "fga") |
| 9237 |
(set_attr "subtype" "fpu")]) |
| 9238 |
|
| 9239 |
(define_insn "pdistn<P:mode>_vis" |
| 9240 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9241 |
(unspec:P [(match_operand:V8QI 1 "register_operand" "e") |
| 9242 |
(match_operand:V8QI 2 "register_operand" "e")] |
| 9243 |
UNSPEC_PDISTN))] |
| 9244 |
"TARGET_VIS3" |
| 9245 |
"pdistn\t%1, %2, %0" |
| 9246 |
[(set_attr "type" "pdistn") |
| 9247 |
(set_attr "fptype" "double")]) |
| 9248 |
|
| 9249 |
(define_insn "fmean16_vis" |
| 9250 |
[(set (match_operand:V4HI 0 "register_operand" "=e") |
| 9251 |
(truncate:V4HI |
| 9252 |
(lshiftrt:V4SI |
| 9253 |
(plus:V4SI |
| 9254 |
(plus:V4SI |
| 9255 |
(zero_extend:V4SI |
| 9256 |
(match_operand:V4HI 1 "register_operand" "e")) |
| 9257 |
(zero_extend:V4SI |
| 9258 |
(match_operand:V4HI 2 "register_operand" "e"))) |
| 9259 |
(const_vector:V4SI [(const_int 1) (const_int 1) |
| 9260 |
(const_int 1) (const_int 1)])) |
| 9261 |
(const_int 1))))] |
| 9262 |
"TARGET_VIS3" |
| 9263 |
"fmean16\t%1, %2, %0" |
| 9264 |
[(set_attr "type" "fga") |
| 9265 |
(set_attr "subtype" "fpu")]) |
| 9266 |
|
| 9267 |
(define_insn "fp<plusminus_insn>64_vis" |
| 9268 |
[(set (match_operand:V1DI 0 "register_operand" "=e") |
| 9269 |
(plusminus:V1DI (match_operand:V1DI 1 "register_operand" "e") |
| 9270 |
(match_operand:V1DI 2 "register_operand" "e")))] |
| 9271 |
"TARGET_VIS3B" |
| 9272 |
"fp<plusminus_insn>64\t%1, %2, %0" |
| 9273 |
[(set_attr "type" "fga") |
| 9274 |
(set_attr "subtype" "addsub64")]) |
| 9275 |
|
| 9276 |
(define_insn "<plusminus_insn>v8qi3" |
| 9277 |
[(set (match_operand:V8QI 0 "register_operand" "=e") |
| 9278 |
(plusminus:V8QI (match_operand:V8QI 1 "register_operand" "e") |
| 9279 |
(match_operand:V8QI 2 "register_operand" "e")))] |
| 9280 |
"TARGET_VIS4" |
| 9281 |
"fp<plusminus_insn>8\t%1, %2, %0" |
| 9282 |
[(set_attr "type" "fga") |
| 9283 |
(set_attr "subtype" "other")]) |
| 9284 |
|
| 9285 |
(define_mode_iterator VASS [V4HI V2SI V2HI V1SI]) |
| 9286 |
(define_code_iterator vis3_addsub_ss [ss_plus ss_minus]) |
| 9287 |
(define_code_attr vis3_addsub_ss_insn |
| 9288 |
[(ss_plus "fpadds") (ss_minus "fpsubs")]) |
| 9289 |
(define_code_attr vis3_addsub_ss_patname |
| 9290 |
[(ss_plus "ssadd") (ss_minus "sssub")]) |
| 9291 |
|
| 9292 |
(define_insn "<vis3_addsub_ss_patname><VASS:mode>3" |
| 9293 |
[(set (match_operand:VASS 0 "register_operand" "=<vconstr>") |
| 9294 |
(vis3_addsub_ss:VASS (match_operand:VASS 1 "register_operand" "<vconstr>") |
| 9295 |
(match_operand:VASS 2 "register_operand" "<vconstr>")))] |
| 9296 |
"TARGET_VIS3" |
| 9297 |
"<vis3_addsub_ss_insn><vbits>\t%1, %2, %0" |
| 9298 |
[(set_attr "type" "fga") |
| 9299 |
(set_attr "subtype" "other")]) |
| 9300 |
|
| 9301 |
(define_mode_iterator VMMAX [V8QI V4HI V2SI]) |
| 9302 |
(define_code_iterator vis4_minmax [smin smax]) |
| 9303 |
(define_code_attr vis4_minmax_insn |
| 9304 |
[(smin "fpmin") (smax "fpmax")]) |
| 9305 |
(define_code_attr vis4_minmax_patname |
| 9306 |
[(smin "min") (smax "max")]) |
| 9307 |
|
| 9308 |
(define_insn "<vis4_minmax_patname><VMMAX:mode>3" |
| 9309 |
[(set (match_operand:VMMAX 0 "register_operand" "=<vconstr>") |
| 9310 |
(vis4_minmax:VMMAX (match_operand:VMMAX 1 "register_operand" "<vconstr>") |
| 9311 |
(match_operand:VMMAX 2 "register_operand" "<vconstr>")))] |
| 9312 |
"TARGET_VIS4" |
| 9313 |
"<vis4_minmax_insn><vbits>\t%1, %2, %0" |
| 9314 |
[(set_attr "type" "fga") |
| 9315 |
(set_attr "subtype" "maxmin")]) |
| 9316 |
|
| 9317 |
(define_code_iterator vis4_uminmax [umin umax]) |
| 9318 |
(define_code_attr vis4_uminmax_insn |
| 9319 |
[(umin "fpminu") (umax "fpmaxu")]) |
| 9320 |
(define_code_attr vis4_uminmax_patname |
| 9321 |
[(umin "minu") (umax "maxu")]) |
| 9322 |
|
| 9323 |
(define_insn "<vis4_uminmax_patname><VMMAX:mode>3" |
| 9324 |
[(set (match_operand:VMMAX 0 "register_operand" "=<vconstr>") |
| 9325 |
(vis4_uminmax:VMMAX (match_operand:VMMAX 1 "register_operand" "<vconstr>") |
| 9326 |
(match_operand:VMMAX 2 "register_operand" "<vconstr>")))] |
| 9327 |
"TARGET_VIS4" |
| 9328 |
"<vis4_uminmax_insn><vbits>\t%1, %2, %0" |
| 9329 |
[(set_attr "type" "fga") |
| 9330 |
(set_attr "subtype" "maxmin")]) |
| 9331 |
|
| 9332 |
;; The use of vis3_addsub_ss_patname in the VIS4 instruction below is |
| 9333 |
;; intended. |
| 9334 |
(define_insn "<vis3_addsub_ss_patname>v8qi3" |
| 9335 |
[(set (match_operand:V8QI 0 "register_operand" "=e") |
| 9336 |
(vis3_addsub_ss:V8QI (match_operand:V8QI 1 "register_operand" "e") |
| 9337 |
(match_operand:V8QI 2 "register_operand" "e")))] |
| 9338 |
"TARGET_VIS4" |
| 9339 |
"<vis3_addsub_ss_insn>8\t%1, %2, %0" |
| 9340 |
[(set_attr "type" "fga") |
| 9341 |
(set_attr "subtype" "other")]) |
| 9342 |
|
| 9343 |
(define_mode_iterator VAUS [V4HI V8QI]) |
| 9344 |
(define_code_iterator vis4_addsub_us [us_plus us_minus]) |
| 9345 |
(define_code_attr vis4_addsub_us_insn |
| 9346 |
[(us_plus "fpaddus") (us_minus "fpsubus")]) |
| 9347 |
(define_code_attr vis4_addsub_us_patname |
| 9348 |
[(us_plus "usadd") (us_minus "ussub")]) |
| 9349 |
|
| 9350 |
(define_insn "<vis4_addsub_us_patname><VAUS:mode>3" |
| 9351 |
[(set (match_operand:VAUS 0 "register_operand" "=<vconstr>") |
| 9352 |
(vis4_addsub_us:VAUS (match_operand:VAUS 1 "register_operand" "<vconstr>") |
| 9353 |
(match_operand:VAUS 2 "register_operand" "<vconstr>")))] |
| 9354 |
"TARGET_VIS4" |
| 9355 |
"<vis4_addsub_us_insn><vbits>\t%1, %2, %0" |
| 9356 |
[(set_attr "type" "fga") |
| 9357 |
(set_attr "subtype" "other")]) |
| 9358 |
|
| 9359 |
(define_insn "*naddsf3" |
| 9360 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 9361 |
(neg:SF (plus:SF (match_operand:SF 1 "register_operand" "f") |
| 9362 |
(match_operand:SF 2 "register_operand" "f"))))] |
| 9363 |
"TARGET_VIS3" |
| 9364 |
"fnadds\t%1, %2, %0" |
| 9365 |
[(set_attr "type" "fp")]) |
| 9366 |
|
| 9367 |
(define_insn "*nadddf3" |
| 9368 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 9369 |
(neg:DF (plus:DF (match_operand:DF 1 "register_operand" "e") |
| 9370 |
(match_operand:DF 2 "register_operand" "e"))))] |
| 9371 |
"TARGET_VIS3" |
| 9372 |
"fnaddd\t%1, %2, %0" |
| 9373 |
[(set_attr "type" "fp") |
| 9374 |
(set_attr "fptype" "double")]) |
| 9375 |
|
| 9376 |
(define_insn "*nmulsf3" |
| 9377 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 9378 |
(mult:SF (neg:SF (match_operand:SF 1 "register_operand" "f")) |
| 9379 |
(match_operand:SF 2 "register_operand" "f")))] |
| 9380 |
"TARGET_VIS3" |
| 9381 |
"fnmuls\t%1, %2, %0" |
| 9382 |
[(set_attr "type" "fpmul")]) |
| 9383 |
|
| 9384 |
(define_insn "*nmuldf3" |
| 9385 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 9386 |
(mult:DF (neg:DF (match_operand:DF 1 "register_operand" "e")) |
| 9387 |
(match_operand:DF 2 "register_operand" "e")))] |
| 9388 |
"TARGET_VIS3" |
| 9389 |
"fnmuld\t%1, %2, %0" |
| 9390 |
[(set_attr "type" "fpmul") |
| 9391 |
(set_attr "fptype" "double")]) |
| 9392 |
|
| 9393 |
(define_insn "*nmuldf3_extend" |
| 9394 |
[(set (match_operand:DF 0 "register_operand" "=e") |
| 9395 |
(mult:DF (neg:DF (float_extend:DF |
| 9396 |
(match_operand:SF 1 "register_operand" "f"))) |
| 9397 |
(float_extend:DF |
| 9398 |
(match_operand:SF 2 "register_operand" "f"))))] |
| 9399 |
"TARGET_VIS3" |
| 9400 |
"fnsmuld\t%1, %2, %0" |
| 9401 |
[(set_attr "type" "fpmul") |
| 9402 |
(set_attr "fptype" "double")]) |
| 9403 |
|
| 9404 |
(define_insn "fhaddsf_vis" |
| 9405 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 9406 |
(unspec:SF [(match_operand:SF 1 "register_operand" "f") |
| 9407 |
(match_operand:SF 2 "register_operand" "f")] |
| 9408 |
UNSPEC_FHADD))] |
| 9409 |
"TARGET_VIS3" |
| 9410 |
"fhadds\t%1, %2, %0" |
| 9411 |
[(set_attr "type" "fp")]) |
| 9412 |
|
| 9413 |
(define_insn "fhadddf_vis" |
| 9414 |
[(set (match_operand:DF 0 "register_operand" "=f") |
| 9415 |
(unspec:DF [(match_operand:DF 1 "register_operand" "f") |
| 9416 |
(match_operand:DF 2 "register_operand" "f")] |
| 9417 |
UNSPEC_FHADD))] |
| 9418 |
"TARGET_VIS3" |
| 9419 |
"fhaddd\t%1, %2, %0" |
| 9420 |
[(set_attr "type" "fp") |
| 9421 |
(set_attr "fptype" "double")]) |
| 9422 |
|
| 9423 |
(define_insn "fhsubsf_vis" |
| 9424 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 9425 |
(unspec:SF [(match_operand:SF 1 "register_operand" "f") |
| 9426 |
(match_operand:SF 2 "register_operand" "f")] |
| 9427 |
UNSPEC_FHSUB))] |
| 9428 |
"TARGET_VIS3" |
| 9429 |
"fhsubs\t%1, %2, %0" |
| 9430 |
[(set_attr "type" "fp")]) |
| 9431 |
|
| 9432 |
(define_insn "fhsubdf_vis" |
| 9433 |
[(set (match_operand:DF 0 "register_operand" "=f") |
| 9434 |
(unspec:DF [(match_operand:DF 1 "register_operand" "f") |
| 9435 |
(match_operand:DF 2 "register_operand" "f")] |
| 9436 |
UNSPEC_FHSUB))] |
| 9437 |
"TARGET_VIS3" |
| 9438 |
"fhsubd\t%1, %2, %0" |
| 9439 |
[(set_attr "type" "fp") |
| 9440 |
(set_attr "fptype" "double")]) |
| 9441 |
|
| 9442 |
(define_insn "fnhaddsf_vis" |
| 9443 |
[(set (match_operand:SF 0 "register_operand" "=f") |
| 9444 |
(neg:SF (unspec:SF [(match_operand:SF 1 "register_operand" "f") |
| 9445 |
(match_operand:SF 2 "register_operand" "f")] |
| 9446 |
UNSPEC_FHADD)))] |
| 9447 |
"TARGET_VIS3" |
| 9448 |
"fnhadds\t%1, %2, %0" |
| 9449 |
[(set_attr "type" "fp")]) |
| 9450 |
|
| 9451 |
(define_insn "fnhadddf_vis" |
| 9452 |
[(set (match_operand:DF 0 "register_operand" "=f") |
| 9453 |
(neg:DF (unspec:DF [(match_operand:DF 1 "register_operand" "f") |
| 9454 |
(match_operand:DF 2 "register_operand" "f")] |
| 9455 |
UNSPEC_FHADD)))] |
| 9456 |
"TARGET_VIS3" |
| 9457 |
"fnhaddd\t%1, %2, %0" |
| 9458 |
[(set_attr "type" "fp") |
| 9459 |
(set_attr "fptype" "double")]) |
| 9460 |
|
| 9461 |
;; VIS4B instructions (specified in the unpublished OSA 2017) |
| 9462 |
|
| 9463 |
(define_mode_iterator DUMODE [V8QI V4HI V2SI]) |
| 9464 |
|
| 9465 |
;; Unpack a DUMODE right-justified value from {8,4,2} consecutive bitfields of (opnd 1): |
| 9466 |
;; for 0 <= (opnd 2) <= 7 : V8QI value from 8 consecutive bitfields of (opnd 2) + 1 bits |
| 9467 |
;; for 8 <= (opnd 2) <= 15: V4HI value from 4 consecutive bitfields of (opnd 2) + 1 bits |
| 9468 |
;; for 16 <= (opnd 2) <= 31: V2SI value from 2 consecutive bitfields of (opnd 2) + 1 bits |
| 9469 |
(define_insn "dictunpack<DUMODE:vbits>" |
| 9470 |
[(set (match_operand:DUMODE 0 "register_operand" "=e") |
| 9471 |
(unspec:DUMODE [(match_operand:DF 1 "register_operand" "e") |
| 9472 |
(match_operand:SI 2 "imm5_operand_dictunpack<DUMODE:vbits>" "t")] |
| 9473 |
UNSPEC_DICTUNPACK))] |
| 9474 |
"TARGET_VIS4B" |
| 9475 |
"dictunpack\t%1, %2, %0" |
| 9476 |
[(set_attr "type" "fga") |
| 9477 |
(set_attr "subtype" "other")]) |
| 9478 |
|
| 9479 |
;; Same as fpcmp but the {8,4,2}-bit result is shifted left by (opnd 3) * {8,4,2} |
| 9480 |
(define_insn "fpcmp<fpcmpcond:code><FPCMP:vbits><P:mode>shl" |
| 9481 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9482 |
(unspec:P [(fpcmpcond:FPCMP (match_operand:FPCMP 1 "register_operand" "e") |
| 9483 |
(match_operand:FPCMP 2 "register_operand" "e")) |
| 9484 |
(match_operand:SI 3 "imm2_operand" "q")] |
| 9485 |
UNSPEC_FPCMPSHL))] |
| 9486 |
"TARGET_VIS4B" |
| 9487 |
"fpcmp<fpcmpcond:code><FPCMP:vbits>shl\t%1, %2, %3, %0" |
| 9488 |
[(set_attr "type" "viscmp")]) |
| 9489 |
|
| 9490 |
;; Same as fpcmpu but the {8,4,2}-bit result is shifted left by (opnd 3) * {8,4,2} |
| 9491 |
(define_insn "fpcmpu<fpcmpucond:signed_code><FPCMP:vbits><P:mode>shl" |
| 9492 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9493 |
(unspec:P [(fpcmpucond:FPCMP (match_operand:FPCMP 1 "register_operand" "e") |
| 9494 |
(match_operand:FPCMP 2 "register_operand" "e")) |
| 9495 |
(match_operand:SI 3 "imm2_operand" "q")] |
| 9496 |
UNSPEC_FPCMPUSHL))] |
| 9497 |
"TARGET_VIS4B" |
| 9498 |
"fpcmpu<fpcmpucond:signed_code><FPCMP:vbits>shl\t%1, %2, %3, %0" |
| 9499 |
[(set_attr "type" "viscmp")]) |
| 9500 |
|
| 9501 |
;; Dual Equal comparison: the unshifted result is the OR of two EQ comparisons |
| 9502 |
;; of (opnd 1) with 1) the 32-bit highpart of (opnd 2) concatenated with itself |
| 9503 |
;; and 2) the 32-bit lowpart of (opnd 2) concatenated with itself. |
| 9504 |
(define_insn "fpcmpde<FPCMP:vbits><P:mode>shl" |
| 9505 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9506 |
(unspec:P [(match_operand:FPCMP 1 "register_operand" "e") |
| 9507 |
(match_operand:FPCMP 2 "register_operand" "e") |
| 9508 |
(match_operand:SI 3 "imm2_operand" "q")] |
| 9509 |
UNSPEC_FPCMPDESHL))] |
| 9510 |
"TARGET_VIS4B" |
| 9511 |
"fpcmpde<FPCMP:vbits>shl\t%1, %2, %3, %0" |
| 9512 |
[(set_attr "type" "viscmp")]) |
| 9513 |
|
| 9514 |
;; Unsigned Range comparison: the unshifted result is True if (opnd 1) lies in |
| 9515 |
;; partitioned unsigned range (LB,HB) with LB) the 32-bit highpart of (opnd 2) |
| 9516 |
;; concatenated with itself and HB) the 32-bit lowpart of (opnd 2) concatenated |
| 9517 |
;; with itself. |
| 9518 |
(define_insn "fpcmpur<FPCMP:vbits><P:mode>shl" |
| 9519 |
[(set (match_operand:P 0 "register_operand" "=r") |
| 9520 |
(unspec:P [(match_operand:FPCMP 1 "register_operand" "e") |
| 9521 |
(match_operand:FPCMP 2 "register_operand" "e") |
| 9522 |
(match_operand:SI 3 "imm2_operand" "q")] |
| 9523 |
UNSPEC_FPCMPURSHL))] |
| 9524 |
"TARGET_VIS4B" |
| 9525 |
"fpcmpur<FPCMP:vbits>shl\t%1, %2, %3, %0" |
| 9526 |
[(set_attr "type" "viscmp")]) |
| 9527 |
|
| 9528 |
(include "sync.md") |