| 1 |
;; XSTORMY16 Machine description template |
| 2 |
;; Copyright (C) 1997-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Red Hat, Inc. |
| 4 |
|
| 5 |
;; This file is part of GCC. |
| 6 |
|
| 7 |
;; GCC is free software; you can redistribute it and/or modify |
| 8 |
;; it under the terms of the GNU General Public License as published by |
| 9 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 10 |
;; any later version. |
| 11 |
|
| 12 |
;; GCC is distributed in the hope that it will be useful, |
| 13 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
;; GNU General Public License for more details. |
| 16 |
|
| 17 |
;; You should have received a copy of the GNU General Public License |
| 18 |
;; along with GCC; see the file COPYING3. If not see |
| 19 |
;; <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. |
| 22 |
|
| 23 |
;; Constraints |
| 24 |
;; a $0 |
| 25 |
;; b $1 |
| 26 |
;; c $2 |
| 27 |
;; d $8 |
| 28 |
;; e $0..$7 |
| 29 |
;; t $0..$1 |
| 30 |
;; z $8..$9 |
| 31 |
;; I 0..3 |
| 32 |
;; J 2**N mask |
| 33 |
;; K 2**N antimask |
| 34 |
;; L 0..255 |
| 35 |
;; M -255..0 |
| 36 |
;; N -3..0 |
| 37 |
;; O 1..4 |
| 38 |
;; P -4..-1 |
| 39 |
;; Q post-inc mem (push) |
| 40 |
;; R pre-dec mem (pop) |
| 41 |
;; S immediate mem |
| 42 |
;; T Rx |
| 43 |
;; U -inf..1 or 16..inf |
| 44 |
;; Z 0 |
| 45 |
|
| 46 |
(define_constants |
| 47 |
[ |
| 48 |
(CARRY_REG 16) |
| 49 |
] |
| 50 |
) |
| 51 |
|
| 52 |
(define_code_iterator any_lshift [ashift lshiftrt]) |
| 53 |
(define_code_iterator any_or_plus [plus ior xor]) |
| 54 |
(define_code_iterator any_rotate [rotate rotatert]) |
| 55 |
|
| 56 |
;; :::::::::::::::::::: |
| 57 |
;; :: |
| 58 |
;; :: Attributes |
| 59 |
;; :: |
| 60 |
;; :::::::::::::::::::: |
| 61 |
|
| 62 |
; Categorize branches for the conditional in the length attribute. |
| 63 |
(define_attr "branch_class" "notdirectbranch,br12,bcc12,bcc8p2,bcc8p4" |
| 64 |
(const_string "notdirectbranch")) |
| 65 |
|
| 66 |
; The length of an instruction, used for branch shortening. |
| 67 |
(define_attr "length" "" |
| 68 |
(cond |
| 69 |
[(eq_attr "branch_class" "br12") |
| 70 |
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -2046)) |
| 71 |
(lt (minus (match_dup 0) (pc)) (const_int 2048))) |
| 72 |
(const_int 2) |
| 73 |
(const_int 4)) |
| 74 |
(eq_attr "branch_class" "bcc12") |
| 75 |
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -2044)) |
| 76 |
(lt (minus (match_dup 0) (pc)) (const_int 2048))) |
| 77 |
(const_int 4) |
| 78 |
(const_int 8)) |
| 79 |
(eq_attr "branch_class" "bcc8p2") |
| 80 |
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -124)) |
| 81 |
(lt (minus (match_dup 0) (pc)) (const_int 128))) |
| 82 |
(const_int 4) |
| 83 |
(const_int 8)) |
| 84 |
(eq_attr "branch_class" "bcc8p4") |
| 85 |
(if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -122)) |
| 86 |
(lt (minus (match_dup 0) (pc)) (const_int 128))) |
| 87 |
(const_int 6) |
| 88 |
(const_int 10))] |
| 89 |
(const_int 2))) |
| 90 |
|
| 91 |
; The operand which determines the setting of Rpsw. |
| 92 |
; The numbers indicate the operand number, |
| 93 |
; 'clobber' indicates it is changed in some unspecified way |
| 94 |
; 'nop' means it is not changed. |
| 95 |
(define_attr "psw_operand" "clobber,nop,0,1,2,3,4" (const_string "0")) |
| 96 |
|
| 97 |
(define_asm_attributes [(set_attr "length" "4") |
| 98 |
(set_attr "psw_operand" "clobber")]) |
| 99 |
|
| 100 |
(include "predicates.md") |
| 101 |
(include "constraints.md") |
| 102 |
|
| 103 |
;; :::::::::::::::::::: |
| 104 |
;; :: |
| 105 |
;; :: Moves |
| 106 |
;; :: |
| 107 |
;; :::::::::::::::::::: |
| 108 |
;; push/pop qi and hi are here as separate insns rather than part of |
| 109 |
;; the movqi/hi patterns because we need to ensure that reload isn't |
| 110 |
;; passed anything it can't cope with. Without these patterns, we |
| 111 |
;; might end up with |
| 112 |
|
| 113 |
;; (set (mem (post_inc (sp))) mem (post_inc (reg))) |
| 114 |
|
| 115 |
;; If, in this example, reg needs reloading, reload will read reg from |
| 116 |
;; the stack , adjust sp, and store reg back at what is now the wrong |
| 117 |
;; offset. By using separate patterns for push and pop we ensure that |
| 118 |
;; insns like this one are never generated. |
| 119 |
|
| 120 |
(define_insn "pushqi1" |
| 121 |
[(set (mem:QI (post_inc:HI (reg:HI 15))) |
| 122 |
(match_operand:QI 0 "register_operand" "r"))] |
| 123 |
"" |
| 124 |
"push %0" |
| 125 |
[(set_attr "psw_operand" "nop") |
| 126 |
(set_attr "length" "2")]) |
| 127 |
|
| 128 |
(define_insn "popqi1" |
| 129 |
[(set (match_operand:QI 0 "register_operand" "=r") |
| 130 |
(mem:QI (pre_dec:HI (reg:HI 15))))] |
| 131 |
"" |
| 132 |
"pop %0" |
| 133 |
[(set_attr "psw_operand" "nop") |
| 134 |
(set_attr "length" "2")]) |
| 135 |
|
| 136 |
(define_expand "movqi" |
| 137 |
[(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "") |
| 138 |
(match_operand:QI 1 "general_operand" ""))] |
| 139 |
"" |
| 140 |
{ xstormy16_expand_move (QImode, operands[0], operands[1]); |
| 141 |
DONE; |
| 142 |
}) |
| 143 |
|
| 144 |
(define_insn "movqi_internal" |
| 145 |
[(set (match_operand:QI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,e") |
| 146 |
(match_operand:QI 1 "general_operand" "r,e,m,i,i,i,i,ie,W"))] |
| 147 |
"" |
| 148 |
"@ |
| 149 |
mov %0,%1 |
| 150 |
mov.b %0,%1 |
| 151 |
mov.b %0,%1 |
| 152 |
mov %0,%1 |
| 153 |
mov Rx,%1 |
| 154 |
mov %0,%1 |
| 155 |
mov.b %0,%1 |
| 156 |
mov.b %0,%1 |
| 157 |
mov.b %0,%1" |
| 158 |
[(set_attr_alternative "length" |
| 159 |
[(const_int 2) |
| 160 |
(if_then_else (match_operand:QI 0 "short_memory_operand" "") |
| 161 |
(const_int 2) |
| 162 |
(const_int 4)) |
| 163 |
(if_then_else (match_operand:QI 1 "short_memory_operand" "") |
| 164 |
(const_int 2) |
| 165 |
(const_int 4)) |
| 166 |
(const_int 2) |
| 167 |
(const_int 2) |
| 168 |
(const_int 4) |
| 169 |
(const_int 4) |
| 170 |
(const_int 2) |
| 171 |
(const_int 2)]) |
| 172 |
(set_attr "psw_operand" "0,0,0,0,nop,0,nop,0,0")]) |
| 173 |
|
| 174 |
(define_insn "pushhi1" |
| 175 |
[(set (mem:HI (post_inc:HI (reg:HI 15))) |
| 176 |
(match_operand:HI 0 "register_operand" "r"))] |
| 177 |
"" |
| 178 |
"push %0" |
| 179 |
[(set_attr "psw_operand" "nop") |
| 180 |
(set_attr "length" "2")]) |
| 181 |
|
| 182 |
(define_insn "pophi1" |
| 183 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 184 |
(mem:HI (pre_dec:HI (reg:HI 15))))] |
| 185 |
"" |
| 186 |
"pop %0" |
| 187 |
[(set_attr "psw_operand" "nop") |
| 188 |
(set_attr "length" "2")]) |
| 189 |
|
| 190 |
(define_expand "movhi" |
| 191 |
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "") |
| 192 |
(match_operand:HI 1 "general_operand" ""))] |
| 193 |
"" |
| 194 |
{ xstormy16_expand_move (HImode, operands[0], operands[1]); |
| 195 |
DONE; |
| 196 |
}) |
| 197 |
|
| 198 |
(define_insn "movhi_internal" |
| 199 |
[(set (match_operand:HI 0 "nonimmediate_nonstack_operand" "=r,m,e,e,T,r,S,W,e") |
| 200 |
(match_operand:HI 1 "general_operand" "r,e,m,L,L,i,i,ie,W"))] |
| 201 |
"" |
| 202 |
"@ |
| 203 |
mov %0,%1 |
| 204 |
mov.w %0,%1 |
| 205 |
mov.w %0,%1 |
| 206 |
mov.w %0,%1 |
| 207 |
mov.w Rx,%1 |
| 208 |
mov.w %0,%1 |
| 209 |
mov.w %0,%1 |
| 210 |
mov.w %0,%1 |
| 211 |
mov.w %0,%1" |
| 212 |
[(set_attr_alternative "length" |
| 213 |
[(const_int 2) |
| 214 |
(if_then_else (match_operand:QI 0 "short_memory_operand" "") |
| 215 |
(const_int 2) |
| 216 |
(const_int 4)) |
| 217 |
(if_then_else (match_operand:QI 1 "short_memory_operand" "") |
| 218 |
(const_int 2) |
| 219 |
(const_int 4)) |
| 220 |
(const_int 2) |
| 221 |
(const_int 2) |
| 222 |
(const_int 4) |
| 223 |
(const_int 4) |
| 224 |
(const_int 4) |
| 225 |
(const_int 4)]) |
| 226 |
(set_attr "psw_operand" "0,0,0,0,nop,0,nop,0,0")]) |
| 227 |
|
| 228 |
(define_expand "movsi" |
| 229 |
[(set (match_operand:SI 0 "nonimmediate_operand" "") |
| 230 |
(match_operand:SI 1 "general_operand" ""))] |
| 231 |
"" |
| 232 |
{ xstormy16_expand_move (SImode, operands[0], operands[1]); |
| 233 |
DONE; |
| 234 |
}) |
| 235 |
|
| 236 |
(define_insn_and_split "*movsi_internal" |
| 237 |
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,Q,r,m,e,&e,e,r,S") |
| 238 |
(match_operand:SI 1 "general_operand" "r,r,R,e,o, V,L,i,i"))] |
| 239 |
"" |
| 240 |
"#" |
| 241 |
"reload_completed" |
| 242 |
[(pc)] |
| 243 |
{ xstormy16_split_move (SImode, operands[0], operands[1]); |
| 244 |
DONE; |
| 245 |
} |
| 246 |
[(set_attr_alternative "length" |
| 247 |
[(const_int 4) |
| 248 |
(const_int 4) |
| 249 |
(const_int 4) |
| 250 |
(if_then_else (match_operand:QI 0 "short_memory_operand" "") |
| 251 |
(const_int 6) |
| 252 |
(const_int 8)) |
| 253 |
(if_then_else (match_operand:QI 1 "short_memory_operand" "") |
| 254 |
(const_int 6) |
| 255 |
(const_int 8)) |
| 256 |
(if_then_else (match_operand:QI 1 "short_memory_operand" "") |
| 257 |
(const_int 6) |
| 258 |
(const_int 8)) |
| 259 |
(const_int 4) |
| 260 |
(const_int 8) |
| 261 |
(const_int 8)])]) |
| 262 |
|
| 263 |
;; :::::::::::::::::::: |
| 264 |
;; :: |
| 265 |
;; :: Conversions |
| 266 |
;; :: |
| 267 |
;; :::::::::::::::::::: |
| 268 |
|
| 269 |
(define_insn "extendqihi2" |
| 270 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 271 |
(sign_extend:HI (match_operand:QI 1 "register_operand" "0")))] |
| 272 |
"" |
| 273 |
"cbw %0") |
| 274 |
|
| 275 |
(define_insn "extendhisi2" |
| 276 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 277 |
(sign_extend:SI (match_operand:HI 1 "register_operand" "0")))] |
| 278 |
"" |
| 279 |
"mov %h0,%0 | asr %h0,#15" |
| 280 |
[(set_attr "length" "4") |
| 281 |
(set_attr "psw_operand" "clobber")]) |
| 282 |
|
| 283 |
(define_insn "zero_extendqihi2" |
| 284 |
[(set (match_operand:HI 0 "register_operand" "=e,T,r") |
| 285 |
(zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m,0,0")))] |
| 286 |
"" |
| 287 |
"@ |
| 288 |
mov.b %0,%1 |
| 289 |
and Rx,#255 |
| 290 |
shl %0,#8 | shr %0,#8" |
| 291 |
[(set_attr "psw_operand" "nop,nop,0") |
| 292 |
(set_attr_alternative "length" |
| 293 |
[(const_int 4) |
| 294 |
(const_int 2) |
| 295 |
(const_int 4)])]) |
| 296 |
|
| 297 |
(define_insn "zero_extendhisi2" |
| 298 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 299 |
(zero_extend:SI (match_operand:HI 1 "register_operand" "0")))] |
| 300 |
"" |
| 301 |
"mov %h0,#0" |
| 302 |
[(set_attr "length" "4") |
| 303 |
(set_attr "psw_operand" "clobber")]) |
| 304 |
|
| 305 |
;; :::::::::::::::::::: |
| 306 |
;; :: |
| 307 |
;; :: Bit field extraction |
| 308 |
;; :: |
| 309 |
;; :::::::::::::::::::: |
| 310 |
|
| 311 |
;; Extract an unsigned bit field |
| 312 |
;(define_insn "extzv" |
| 313 |
; [(set (match_operand:SI 0 "register_operand" "=r") |
| 314 |
; (zero_extract:SI (match_operand:SI 1 "register_operand" "r") |
| 315 |
; (match_operand:SI 2 "const_int_operand" "n") |
| 316 |
; (match_operand:SI 3 "const_int_operand" "n")))] |
| 317 |
; "" |
| 318 |
; "extzv %0,%1,%2,%3" |
| 319 |
; [(set_attr "length" "4")]) |
| 320 |
|
| 321 |
;; Insert a bit field |
| 322 |
;(define_insn "insv" |
| 323 |
; [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r") |
| 324 |
; (match_operand:SI 1 "const_int_operand" "n") |
| 325 |
; (match_operand:SI 2 "const_int_operand" "n")) |
| 326 |
; (match_operand:SI 3 "nonmemory_operand" "ri"))] |
| 327 |
; "" |
| 328 |
; "insv %0,%1,%2,%3" |
| 329 |
; [(set_attr "length" "4")]) |
| 330 |
|
| 331 |
|
| 332 |
;; :::::::::::::::::::: |
| 333 |
;; :: |
| 334 |
;; :: 16-bit Integer arithmetic |
| 335 |
;; :: |
| 336 |
;; :::::::::::::::::::: |
| 337 |
|
| 338 |
;; Addition |
| 339 |
; Note - the early clobber modifier is no longer needed on operand 3 |
| 340 |
; and in fact can cause some reload spill failures if it is present. |
| 341 |
; Note that the 'Z' constraint matches "add $reg,0", which reload |
| 342 |
; will occasionally emit. We avoid the "add $reg,imm" match because |
| 343 |
; it clobbers the carry. |
| 344 |
(define_insn "addhi3" |
| 345 |
[(set (match_operand:HI 0 "register_operand" "=r,r,r,T,T,r,r,r") |
| 346 |
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0,0,0") |
| 347 |
(match_operand:HI 2 "xs_hi_nonmemory_operand" "O,P,Z,L,M,Ir,N,i"))) |
| 348 |
(clobber (reg:BI CARRY_REG))] |
| 349 |
"" |
| 350 |
"@ |
| 351 |
inc %0,%o2 |
| 352 |
dec %0,%O2 |
| 353 |
; |
| 354 |
add Rx,%2 |
| 355 |
sub Rx,#%n2 |
| 356 |
add %0,%2 |
| 357 |
sub %0,#%n2 |
| 358 |
add %0,%2" |
| 359 |
[(set_attr "length" "2,2,0,2,2,2,2,4")]) |
| 360 |
|
| 361 |
(define_insn "addchi4" |
| 362 |
[(set (match_operand:HI 0 "register_operand" "=T,r,r") |
| 363 |
(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0") |
| 364 |
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i"))) |
| 365 |
(set (reg:BI CARRY_REG) |
| 366 |
(truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1)) |
| 367 |
(zero_extend:SI (match_dup 2))) |
| 368 |
(const_int 16))))] |
| 369 |
"" |
| 370 |
"@ |
| 371 |
add Rx,%2 |
| 372 |
add %0,%2 |
| 373 |
add %0,%2" |
| 374 |
[(set_attr "length" "2,2,4")]) |
| 375 |
|
| 376 |
(define_insn "addchi5" |
| 377 |
[(set (match_operand:HI 0 "register_operand" "=T,r,r") |
| 378 |
(plus:HI (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0") |
| 379 |
(zero_extend:HI (reg:BI CARRY_REG))) |
| 380 |
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i"))) |
| 381 |
(set (reg:BI CARRY_REG) |
| 382 |
(truncate:BI (lshiftrt:SI (plus:SI (plus:SI |
| 383 |
(zero_extend:SI (match_dup 1)) |
| 384 |
(zero_extend:SI (reg:BI CARRY_REG))) |
| 385 |
(zero_extend:SI (match_dup 2))) |
| 386 |
(const_int 16))))] |
| 387 |
"" |
| 388 |
"@ |
| 389 |
adc Rx,%2 |
| 390 |
adc %0,%2 |
| 391 |
adc %0,%2" |
| 392 |
[(set_attr "length" "2,2,4")]) |
| 393 |
|
| 394 |
;; Subtraction |
| 395 |
; Operand 3 is marked earlyclobber because that helps reload |
| 396 |
; to generate better code---this pattern will never need the |
| 397 |
; carry register as an input, and some output reloads or input |
| 398 |
; reloads might need to use it. In fact, without the '&' reload |
| 399 |
; will fail in some cases. |
| 400 |
(define_insn "subhi3" |
| 401 |
[(set (match_operand:HI 0 "register_operand" "=r,r,T,T,r,r,r") |
| 402 |
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0,0,0,0,0") |
| 403 |
(match_operand:HI 2 "xs_hi_nonmemory_operand" "O,P,L,M,rI,M,i"))) |
| 404 |
(clobber (reg:BI CARRY_REG))] |
| 405 |
"" |
| 406 |
"@ |
| 407 |
dec %0,%o2 |
| 408 |
inc %0,%O2 |
| 409 |
sub Rx,%2 |
| 410 |
add Rx,#%n2 |
| 411 |
sub %0,%2 |
| 412 |
add %0,#%n2 |
| 413 |
sub %0,%2" |
| 414 |
[(set_attr "length" "2,2,2,2,2,2,4")]) |
| 415 |
|
| 416 |
(define_insn "subchi4" |
| 417 |
[(set (match_operand:HI 0 "register_operand" "=T,r,r") |
| 418 |
(minus:HI (match_operand:HI 1 "register_operand" "0,0,0") |
| 419 |
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i"))) |
| 420 |
(set (reg:BI CARRY_REG) |
| 421 |
(truncate:BI (lshiftrt:SI (minus:SI (zero_extend:SI (match_dup 1)) |
| 422 |
(zero_extend:SI (match_dup 2))) |
| 423 |
(const_int 16))))] |
| 424 |
"" |
| 425 |
"@ |
| 426 |
sub Rx,%2 |
| 427 |
sub %0,%2 |
| 428 |
sub %0,%2" |
| 429 |
[(set_attr "length" "2,2,4")]) |
| 430 |
|
| 431 |
(define_insn "subchi5" |
| 432 |
[(set (match_operand:HI 0 "register_operand" "=T,r,r") |
| 433 |
(minus:HI (minus:HI (match_operand:HI 1 "register_operand" "0,0,0") |
| 434 |
(zero_extend:HI (reg:BI CARRY_REG))) |
| 435 |
(match_operand:HI 2 "xs_hi_nonmemory_operand" "L,Ir,i"))) |
| 436 |
(set (reg:BI CARRY_REG) |
| 437 |
(truncate:BI (lshiftrt:SI (minus:SI (minus:SI |
| 438 |
(zero_extend:SI (match_dup 1)) |
| 439 |
(zero_extend:SI (reg:BI CARRY_REG))) |
| 440 |
(zero_extend:SI (match_dup 2))) |
| 441 |
(const_int 16))))] |
| 442 |
"" |
| 443 |
"@ |
| 444 |
sbc Rx,%2 |
| 445 |
sbc %0,%2 |
| 446 |
sbc %0,%2" |
| 447 |
[(set_attr "length" "2,2,4")]) |
| 448 |
|
| 449 |
; Basic multiplication |
| 450 |
(define_insn "mulhi3" |
| 451 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 452 |
(mult:HI (match_operand:HI 1 "register_operand" "%a") |
| 453 |
(match_operand:HI 2 "register_operand" "c"))) |
| 454 |
(clobber (match_scratch:HI 3 "=b")) |
| 455 |
] |
| 456 |
"" |
| 457 |
"mul" |
| 458 |
[(set_attr "psw_operand" "nop")]) |
| 459 |
|
| 460 |
;; Unsigned multiplication producing 64-bit results from 32-bit inputs |
| 461 |
; The constraint on operand 0 is 't' because it is actually two regs |
| 462 |
; long, and both regs must match the constraint. |
| 463 |
(define_insn "umulhisi3" |
| 464 |
[(set (match_operand:SI 0 "register_operand" "=t") |
| 465 |
(mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "%a")) |
| 466 |
(zero_extend:SI (match_operand:HI 2 "register_operand" "c")))) |
| 467 |
] |
| 468 |
"" |
| 469 |
"mul" |
| 470 |
[(set_attr "psw_operand" "nop")]) |
| 471 |
|
| 472 |
;; Unsigned division giving both quotient and remainder |
| 473 |
(define_insn "udivmodhi4" |
| 474 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 475 |
(udiv:HI (match_operand:HI 1 "register_operand" "a") |
| 476 |
(match_operand:HI 2 "register_operand" "c"))) |
| 477 |
(set (match_operand:HI 3 "register_operand" "=b") |
| 478 |
(umod:HI (match_dup 1) |
| 479 |
(match_dup 2)))] |
| 480 |
"" |
| 481 |
"div" |
| 482 |
[(set_attr "psw_operand" "nop")]) |
| 483 |
|
| 484 |
;; Signed division giving both quotient and remainder |
| 485 |
(define_insn "divmodhi4" |
| 486 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 487 |
(div:HI (match_operand:HI 1 "register_operand" "a") |
| 488 |
(match_operand:HI 2 "register_operand" "c"))) |
| 489 |
(set (match_operand:HI 3 "register_operand" "=b") |
| 490 |
(mod:HI (match_dup 1) |
| 491 |
(match_dup 2)))] |
| 492 |
"" |
| 493 |
"sdiv" |
| 494 |
[(set_attr "psw_operand" "nop")]) |
| 495 |
|
| 496 |
;; Signed 32/16 division |
| 497 |
(define_insn "sdivlh" |
| 498 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 499 |
(div:HI (match_operand:SI 2 "register_operand" "t") |
| 500 |
(match_operand:HI 3 "register_operand" "c"))) |
| 501 |
(set (match_operand:HI 1 "register_operand" "=b") |
| 502 |
(mod:HI (match_dup 2) |
| 503 |
(match_dup 3)))] |
| 504 |
"" |
| 505 |
"sdivlh" |
| 506 |
[(set_attr "psw_operand" "nop")]) |
| 507 |
|
| 508 |
;; Unsigned 32/16 division |
| 509 |
(define_insn "udivlh" |
| 510 |
[(set (match_operand:HI 0 "register_operand" "=a") |
| 511 |
(udiv:HI (match_operand:SI 2 "register_operand" "t") |
| 512 |
(match_operand:HI 3 "register_operand" "c"))) |
| 513 |
(set (match_operand:HI 1 "register_operand" "=b") |
| 514 |
(umod:HI (match_dup 2) |
| 515 |
(match_dup 3)))] |
| 516 |
"" |
| 517 |
"divlh" |
| 518 |
[(set_attr "psw_operand" "nop")]) |
| 519 |
|
| 520 |
;; Negation |
| 521 |
|
| 522 |
(define_insn "neghi2" |
| 523 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 524 |
(neg:HI (match_operand:HI 1 "register_operand" "0")))] |
| 525 |
"" |
| 526 |
"not %0 | inc %0" |
| 527 |
[(set_attr "length" "4")]) |
| 528 |
|
| 529 |
;; :::::::::::::::::::: |
| 530 |
;; :: |
| 531 |
;; :: 16-bit Integer Shifts and Rotates |
| 532 |
;; :: |
| 533 |
;; :::::::::::::::::::: |
| 534 |
|
| 535 |
;; Arithmetic Shift Left |
| 536 |
(define_insn "ashlhi3" |
| 537 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 538 |
(ashift:HI (match_operand:HI 1 "register_operand" "0") |
| 539 |
(match_operand:HI 2 "nonmemory_operand" "ri"))) |
| 540 |
(clobber (reg:BI CARRY_REG))] |
| 541 |
"" |
| 542 |
"shl %0,%2") |
| 543 |
|
| 544 |
;; Arithmetic Shift Right |
| 545 |
(define_insn "ashrhi3" |
| 546 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 547 |
(ashiftrt:HI (match_operand:HI 1 "register_operand" "0") |
| 548 |
(match_operand:HI 2 "nonmemory_operand" "ri"))) |
| 549 |
(clobber (reg:BI CARRY_REG))] |
| 550 |
"" |
| 551 |
"asr %0,%2") |
| 552 |
|
| 553 |
;; Logical Shift Right |
| 554 |
(define_insn "lshrhi3" |
| 555 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 556 |
(lshiftrt:HI (match_operand:HI 1 "register_operand" "0") |
| 557 |
(match_operand:HI 2 "nonmemory_operand" "ri"))) |
| 558 |
(clobber (reg:BI CARRY_REG))] |
| 559 |
"" |
| 560 |
"shr %0,%2") |
| 561 |
|
| 562 |
;; HImode rotate left by 1 bit |
| 563 |
(define_insn "*rotatehi_1" |
| 564 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 565 |
(rotate:HI (match_operand:HI 1 "register_operand" "0") |
| 566 |
(const_int 1))) |
| 567 |
(clobber (reg:BI CARRY_REG))] |
| 568 |
"" |
| 569 |
"shl %0,#1 | adc %0,#0" |
| 570 |
[(set_attr "length" "4")]) |
| 571 |
|
| 572 |
;; HImode rotate left by 8 bits |
| 573 |
(define_insn "*<code>hi_8" |
| 574 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 575 |
(any_rotate:HI (match_operand:HI 1 "register_operand" "0") |
| 576 |
(const_int 8)))] |
| 577 |
"" |
| 578 |
"swpb %0") |
| 579 |
|
| 580 |
;; :::::::::::::::::::: |
| 581 |
;; :: |
| 582 |
;; :: 16-Bit Integer Logical operations |
| 583 |
;; :: |
| 584 |
;; :::::::::::::::::::: |
| 585 |
|
| 586 |
;; Logical AND, 16-bit integers |
| 587 |
(define_insn "andhi3" |
| 588 |
[(set (match_operand:HI 0 "xstormy16_splittable_below100_or_register" "=T,r,r,r,W") |
| 589 |
(and:HI (match_operand:HI 1 "xstormy16_below100_or_register" "%0,0,0,0,0") |
| 590 |
(match_operand:HI 2 "nonmemory_operand" "L,r,K,i,K")))] |
| 591 |
"" |
| 592 |
"@ |
| 593 |
and Rx,%2 |
| 594 |
and %0,%2 |
| 595 |
clr1 %0,%B2 |
| 596 |
and %0,%2 |
| 597 |
#" |
| 598 |
[(set_attr "length" "2,2,2,4,2")]) |
| 599 |
|
| 600 |
(define_split |
| 601 |
[(set (match_operand:HI 0 "xstormy16_below100_operand" "") |
| 602 |
(and:HI (match_operand:HI 1 "xstormy16_below100_operand" "") |
| 603 |
(match_operand:HI 2 "xstormy16_onebit_clr_operand" "")))] |
| 604 |
"" |
| 605 |
[(set (match_dup 3) |
| 606 |
(and:QI (match_dup 4) |
| 607 |
(match_dup 5)))] |
| 608 |
{ int s = ((INTVAL (operands[2]) & 0xff) == 0xff) ? 1 : 0; |
| 609 |
operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, s); |
| 610 |
operands[4] = simplify_gen_subreg (QImode, operands[1], HImode, s); |
| 611 |
operands[5] = simplify_gen_subreg (QImode, operands[2], HImode, s); |
| 612 |
operands[5] = GEN_INT (INTVAL (operands[5]) | ~ (HOST_WIDE_INT) 0xff); |
| 613 |
}) |
| 614 |
|
| 615 |
;; Inclusive OR, 16-bit integers |
| 616 |
(define_insn "iorhi3" |
| 617 |
[(set (match_operand:HI 0 "xstormy16_splittable_below100_or_register" "=T,r,r,r,W") |
| 618 |
(ior:HI (match_operand:HI 1 "xstormy16_below100_or_register" "%0,0,0,0,0") |
| 619 |
(match_operand:HI 2 "nonmemory_operand" "L,r,J,i,J")))] |
| 620 |
"" |
| 621 |
"@ |
| 622 |
or Rx,%2 |
| 623 |
or %0,%2 |
| 624 |
set1 %0,%B2 |
| 625 |
or %0,%2 |
| 626 |
#" |
| 627 |
[(set_attr "length" "2,2,2,4,2")]) |
| 628 |
|
| 629 |
(define_split |
| 630 |
[(set (match_operand:HI 0 "xstormy16_below100_operand" "") |
| 631 |
(ior:HI (match_operand:HI 1 "xstormy16_below100_operand" "") |
| 632 |
(match_operand:HI 2 "xstormy16_onebit_set_operand" "")))] |
| 633 |
"" |
| 634 |
[(set (match_dup 3) |
| 635 |
(ior:QI (match_dup 4) |
| 636 |
(match_dup 5)))] |
| 637 |
{ int s = ((INTVAL (operands[2]) & 0xff) == 0x00) ? 1 : 0; |
| 638 |
operands[3] = simplify_gen_subreg (QImode, operands[0], HImode, s); |
| 639 |
operands[4] = simplify_gen_subreg (QImode, operands[1], HImode, s); |
| 640 |
operands[5] = simplify_gen_subreg (QImode, operands[2], HImode, s); |
| 641 |
operands[5] = GEN_INT (INTVAL (operands[5]) & 0xff); |
| 642 |
}) |
| 643 |
|
| 644 |
;; Exclusive OR, 16-bit integers |
| 645 |
(define_insn "xorhi3" |
| 646 |
[(set (match_operand:HI 0 "register_operand" "=T,r,r") |
| 647 |
(xor:HI (match_operand:HI 1 "register_operand" "%0,0,0") |
| 648 |
(match_operand:HI 2 "nonmemory_operand" "L,r,i")))] |
| 649 |
"" |
| 650 |
"@ |
| 651 |
xor Rx,%2 |
| 652 |
xor %0,%2 |
| 653 |
xor %0,%2" |
| 654 |
[(set_attr "length" "2,2,4")]) |
| 655 |
|
| 656 |
;; One's complement, 16-bit integers |
| 657 |
(define_insn "one_cmplhi2" |
| 658 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 659 |
(not:HI (match_operand:HI 1 "register_operand" "0")))] |
| 660 |
"" |
| 661 |
"not %0") |
| 662 |
|
| 663 |
;; :::::::::::::::::::: |
| 664 |
;; :: |
| 665 |
;; :: 32-bit Integer arithmetic |
| 666 |
;; :: |
| 667 |
;; :::::::::::::::::::: |
| 668 |
|
| 669 |
;; Addition |
| 670 |
(define_insn_and_split "addsi3" |
| 671 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 672 |
(plus:SI (match_operand:SI 1 "register_operand" "%0") |
| 673 |
(match_operand:SI 2 "nonmemory_operand" "ri"))) |
| 674 |
(clobber (reg:BI CARRY_REG))] |
| 675 |
"" |
| 676 |
"#" |
| 677 |
"reload_completed" |
| 678 |
[(pc)] |
| 679 |
{ xstormy16_expand_arith (SImode, PLUS, operands[0], operands[1], |
| 680 |
operands[2]); |
| 681 |
DONE; |
| 682 |
} |
| 683 |
[(set_attr "length" "4")]) |
| 684 |
|
| 685 |
;; Subtraction |
| 686 |
(define_insn_and_split "subsi3" |
| 687 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 688 |
(minus:SI (match_operand:SI 1 "register_operand" "0") |
| 689 |
(match_operand:SI 2 "nonmemory_operand" "ri"))) |
| 690 |
(clobber (reg:BI CARRY_REG))] |
| 691 |
"" |
| 692 |
"#" |
| 693 |
"reload_completed" |
| 694 |
[(pc)] |
| 695 |
{ xstormy16_expand_arith (SImode, MINUS, operands[0], operands[1], |
| 696 |
operands[2]); |
| 697 |
DONE; |
| 698 |
} |
| 699 |
[(set_attr "length" "4")]) |
| 700 |
|
| 701 |
(define_expand "negsi2" |
| 702 |
[(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 703 |
(neg:SI (match_operand:SI 1 "register_operand" ""))) |
| 704 |
(clobber (reg:BI CARRY_REG))])] |
| 705 |
"" |
| 706 |
{ operands[2] = gen_reg_rtx (HImode); }) |
| 707 |
|
| 708 |
(define_insn_and_split "*negsi2_internal" |
| 709 |
[(set (match_operand:SI 0 "register_operand" "=&r") |
| 710 |
(neg:SI (match_operand:SI 1 "register_operand" "r"))) |
| 711 |
(clobber (reg:BI CARRY_REG))] |
| 712 |
"" |
| 713 |
"#" |
| 714 |
"reload_completed" |
| 715 |
[(pc)] |
| 716 |
{ xstormy16_expand_arith (SImode, NEG, operands[0], operands[0], |
| 717 |
operands[1]); |
| 718 |
DONE; |
| 719 |
}) |
| 720 |
|
| 721 |
;; :::::::::::::::::::: |
| 722 |
;; :: |
| 723 |
;; :: 32-bit Integer Shifts and Rotates |
| 724 |
;; :: |
| 725 |
;; :::::::::::::::::::: |
| 726 |
|
| 727 |
;; Arithmetic Shift Left |
| 728 |
(define_expand "ashlsi3" |
| 729 |
[(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 730 |
(ashift:SI (match_operand:SI 1 "register_operand" "") |
| 731 |
(match_operand:SI 2 "const_int_operand" ""))) |
| 732 |
(clobber (reg:BI CARRY_REG)) |
| 733 |
(clobber (match_dup 3))])] |
| 734 |
"" |
| 735 |
{ if (! const_int_operand (operands[2], SImode)) |
| 736 |
FAIL; |
| 737 |
operands[3] = gen_reg_rtx (HImode); |
| 738 |
}) |
| 739 |
|
| 740 |
;; Arithmetic Shift Right |
| 741 |
(define_expand "ashrsi3" |
| 742 |
[(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 743 |
(ashiftrt:SI (match_operand:SI 1 "register_operand" "") |
| 744 |
(match_operand:SI 2 "const_int_operand" ""))) |
| 745 |
(clobber (reg:BI CARRY_REG)) |
| 746 |
(clobber (match_dup 3))])] |
| 747 |
"" |
| 748 |
{ if (! const_int_operand (operands[2], SImode)) |
| 749 |
FAIL; |
| 750 |
operands[3] = gen_reg_rtx (HImode); |
| 751 |
}) |
| 752 |
|
| 753 |
;; Logical Shift Right |
| 754 |
(define_expand "lshrsi3" |
| 755 |
[(parallel [(set (match_operand:SI 0 "register_operand" "") |
| 756 |
(lshiftrt:SI (match_operand:SI 1 "register_operand" "") |
| 757 |
(match_operand:SI 2 "const_int_operand" ""))) |
| 758 |
(clobber (reg:BI CARRY_REG)) |
| 759 |
(clobber (match_dup 3))])] |
| 760 |
"" |
| 761 |
{ if (! const_int_operand (operands[2], SImode)) |
| 762 |
FAIL; |
| 763 |
operands[3] = gen_reg_rtx (HImode); |
| 764 |
}) |
| 765 |
|
| 766 |
(define_insn "*shiftsi" |
| 767 |
[(set (match_operand:SI 0 "register_operand" "=r,r") |
| 768 |
(match_operator:SI 4 "shift_operator" |
| 769 |
[(match_operand:SI 1 "register_operand" "0,0") |
| 770 |
(match_operand:SI 2 "const_int_operand" "U,n")])) |
| 771 |
(clobber (reg:BI CARRY_REG)) |
| 772 |
(clobber (match_operand:HI 3 "" "=X,r"))] |
| 773 |
"" |
| 774 |
"* return xstormy16_output_shift (SImode, GET_CODE (operands[4]), |
| 775 |
operands[0], operands[2], operands[3]);" |
| 776 |
[(set_attr "length" "6,10") |
| 777 |
(set_attr "psw_operand" "clobber,clobber")]) |
| 778 |
|
| 779 |
|
| 780 |
;; :::::::::::::::::::: |
| 781 |
;; :: |
| 782 |
;; :: Branches |
| 783 |
;; :: |
| 784 |
;; :::::::::::::::::::: |
| 785 |
|
| 786 |
(define_expand "cbranchhi4" |
| 787 |
[(set (pc) |
| 788 |
(if_then_else (match_operator 0 "comparison_operator" |
| 789 |
[(match_operand:HI 1 "register_operand" "") |
| 790 |
(match_operand:HI 2 "nonmemory_operand" "")]) |
| 791 |
(label_ref (match_operand 3 "" "")) |
| 792 |
(pc))) |
| 793 |
(clobber (reg:BI CARRY_REG))] |
| 794 |
"" |
| 795 |
{ |
| 796 |
xstormy16_emit_cbranch (GET_CODE (operands[0]), operands[1], operands[2], |
| 797 |
operands[3]); |
| 798 |
DONE; |
| 799 |
}) |
| 800 |
|
| 801 |
(define_insn "cbranchhi" |
| 802 |
[(set (pc) |
| 803 |
(if_then_else (match_operator:HI 1 "comparison_operator" |
| 804 |
[(match_operand:HI 2 "nonmemory_operand" |
| 805 |
"r,e,L") |
| 806 |
(match_operand:HI 3 "nonmemory_operand" |
| 807 |
"r,L,e")]) |
| 808 |
(label_ref (match_operand 0 "" "")) |
| 809 |
(pc))) |
| 810 |
(clobber (reg:BI CARRY_REG))] |
| 811 |
"" |
| 812 |
"* |
| 813 |
{ |
| 814 |
return xstormy16_output_cbranch_hi (operands[1], \"%l0\", 0, insn); |
| 815 |
}" |
| 816 |
[(set_attr "branch_class" "bcc12") |
| 817 |
(set_attr "psw_operand" "0,0,1")]) |
| 818 |
|
| 819 |
(define_insn "cbranchhi_neg" |
| 820 |
[(set (pc) |
| 821 |
(if_then_else (match_operator:HI 1 "comparison_operator" |
| 822 |
[(match_operand:HI 2 "nonmemory_operand" |
| 823 |
"r,e,L") |
| 824 |
(match_operand:HI 3 "nonmemory_operand" |
| 825 |
"r,L,e")]) |
| 826 |
(pc) |
| 827 |
(label_ref (match_operand 0 "" "")))) |
| 828 |
(clobber (reg:BI CARRY_REG))] |
| 829 |
"" |
| 830 |
"* |
| 831 |
{ |
| 832 |
return xstormy16_output_cbranch_hi (operands[1], \"%l0\", 1, insn); |
| 833 |
}" |
| 834 |
[(set_attr "branch_class" "bcc12") |
| 835 |
(set_attr "psw_operand" "0,0,1")]) |
| 836 |
|
| 837 |
(define_insn "*eqbranchsi" |
| 838 |
[(set (pc) |
| 839 |
(if_then_else (match_operator:SI 1 "equality_operator" |
| 840 |
[(match_operand:SI 2 "register_operand" |
| 841 |
"r") |
| 842 |
(const_int 0)]) |
| 843 |
(label_ref (match_operand 0 "" "")) |
| 844 |
(pc))) |
| 845 |
(clobber (match_operand:SI 3 "register_operand" "=2"))] |
| 846 |
"" |
| 847 |
"* |
| 848 |
{ |
| 849 |
return xstormy16_output_cbranch_si (operands[1], \"%l0\", 0, insn); |
| 850 |
}" |
| 851 |
[(set_attr "branch_class" "bcc8p2") |
| 852 |
(set_attr "psw_operand" "clobber")]) |
| 853 |
|
| 854 |
(define_insn "*ineqbranch_1" |
| 855 |
[(set (pc) |
| 856 |
(if_then_else (match_operator:HI 4 "xstormy16_ineqsi_operator" |
| 857 |
[(minus:HI (match_operand:HI 1 "register_operand" "T,r,r") |
| 858 |
(zero_extend:HI (reg:BI CARRY_REG))) |
| 859 |
(match_operand:HI 3 "nonmemory_operand" "L,r,i")]) |
| 860 |
(label_ref (match_operand 0 "" "")) |
| 861 |
(pc))) |
| 862 |
(set (match_operand:HI 2 "register_operand" "=1,1,1") |
| 863 |
(minus:HI (minus:HI (match_dup 1) (zero_extend:HI (reg:BI CARRY_REG))) |
| 864 |
(match_dup 3))) |
| 865 |
(clobber (reg:BI CARRY_REG))] |
| 866 |
"" |
| 867 |
"* |
| 868 |
{ |
| 869 |
return xstormy16_output_cbranch_si (operands[4], \"%l0\", 0, insn); |
| 870 |
}" |
| 871 |
[(set_attr "branch_class" "bcc8p2,bcc8p2,bcc8p4") |
| 872 |
(set_attr "psw_operand" "2,2,2")]) |
| 873 |
|
| 874 |
;; :::::::::::::::::::: |
| 875 |
;; :: |
| 876 |
;; :: Call and branch instructions |
| 877 |
;; :: |
| 878 |
;; :::::::::::::::::::: |
| 879 |
|
| 880 |
;; Subroutine call instruction returning no value. Operand 0 is the function |
| 881 |
;; to call; operand 1 is the number of bytes of arguments pushed (in mode |
| 882 |
;; `SImode', except it is normally a `const_int'); operand 2 is the number of |
| 883 |
;; registers used as operands. |
| 884 |
|
| 885 |
;; On most machines, operand 2 is not actually stored into the RTL pattern. It |
| 886 |
;; is supplied for the sake of some RISC machines which need to put this |
| 887 |
;; information into the assembler code; they can put it in the RTL instead of |
| 888 |
;; operand 1. |
| 889 |
|
| 890 |
(define_expand "call" |
| 891 |
[(call (match_operand:HI 0 "memory_operand" "m") |
| 892 |
(match_operand 1 "" "")) |
| 893 |
(use (match_operand 2 "immediate_operand" ""))] |
| 894 |
"" |
| 895 |
"xstormy16_expand_call (NULL_RTX, operands[0], operands[1]); DONE;") |
| 896 |
|
| 897 |
;; Subroutine call instruction returning a value. Operand 0 is the hard |
| 898 |
;; register in which the value is returned. There are three more operands, the |
| 899 |
;; same as the three operands of the `call' instruction (but with numbers |
| 900 |
;; increased by one). |
| 901 |
|
| 902 |
;; Subroutines that return `BLKmode' objects use the `call' insn. |
| 903 |
|
| 904 |
(define_expand "call_value" |
| 905 |
[(set (match_operand 0 "register_operand" "=r") |
| 906 |
(call (match_operand:HI 1 "memory_operand" "m") |
| 907 |
(match_operand:SI 2 "" ""))) |
| 908 |
(use (match_operand 3 "immediate_operand" ""))] |
| 909 |
"" |
| 910 |
"xstormy16_expand_call (operands[0], operands[1], operands[2]); DONE;") |
| 911 |
|
| 912 |
(define_insn "*call_internal" |
| 913 |
[(call (mem:HI (match_operand:HI 0 "nonmemory_operand" "i,r")) |
| 914 |
(match_operand 1 "" "")) |
| 915 |
(use (match_operand:HI 2 "nonmemory_operand" "X,z"))] |
| 916 |
"" |
| 917 |
"@ |
| 918 |
callf %C0 |
| 919 |
call %2,%0" |
| 920 |
[(set_attr "length" "4,2") |
| 921 |
(set_attr "psw_operand" "clobber")]) |
| 922 |
|
| 923 |
(define_insn "*call_value_internal" |
| 924 |
[(set (match_operand 3 "register_operand" "=r,r") |
| 925 |
(call (mem:HI (match_operand:HI 0 "nonmemory_operand" "i,r")) |
| 926 |
(match_operand 1 "" ""))) |
| 927 |
(use (match_operand:HI 2 "nonmemory_operand" "X,z"))] |
| 928 |
"" |
| 929 |
"@ |
| 930 |
callf %C0 |
| 931 |
call %2,%0" |
| 932 |
[(set_attr "length" "4,2") |
| 933 |
(set_attr "psw_operand" "clobber")]) |
| 934 |
|
| 935 |
;; Subroutine return |
| 936 |
(define_expand "return" |
| 937 |
[(return)] |
| 938 |
"direct_return()" |
| 939 |
"") |
| 940 |
|
| 941 |
(define_insn "return_internal" |
| 942 |
[(return)] |
| 943 |
"" |
| 944 |
"ret" |
| 945 |
[(set_attr "psw_operand" "nop")]) |
| 946 |
|
| 947 |
(define_insn "return_internal_interrupt" |
| 948 |
[(return) |
| 949 |
(unspec_volatile [(const_int 0)] 1)] |
| 950 |
"" |
| 951 |
"iret" |
| 952 |
[(set_attr "psw_operand" "clobber")]) |
| 953 |
|
| 954 |
;; Normal unconditional jump |
| 955 |
(define_insn "jump" |
| 956 |
[(set (pc) (label_ref (match_operand 0 "" "")))] |
| 957 |
"" |
| 958 |
"* |
| 959 |
{ |
| 960 |
return xstormy16_output_cbranch_hi (NULL_RTX, \"%l0\", 0, insn); |
| 961 |
}" |
| 962 |
[(set_attr "branch_class" "br12") |
| 963 |
(set_attr "psw_operand" "nop")]) |
| 964 |
|
| 965 |
;; Indirect jump through a register |
| 966 |
(define_expand "indirect_jump" |
| 967 |
[(set (match_dup 1) (const_int 0)) |
| 968 |
(parallel [(set (pc) (match_operand:HI 0 "register_operand" "")) |
| 969 |
(use (match_dup 1))])] |
| 970 |
"" |
| 971 |
"operands[1] = gen_reg_rtx (HImode);") |
| 972 |
|
| 973 |
(define_insn "" |
| 974 |
[(set (pc) (match_operand:HI 0 "register_operand" "r")) |
| 975 |
(use (match_operand:HI 1 "register_operand" "z"))] |
| 976 |
"" |
| 977 |
"jmp %1,%0" |
| 978 |
[(set_attr "length" "4") |
| 979 |
(set_attr "psw_operand" "nop")]) |
| 980 |
|
| 981 |
;; Table-based switch statements. |
| 982 |
(define_expand "casesi" |
| 983 |
[(use (match_operand:SI 0 "register_operand" "")) |
| 984 |
(use (match_operand:SI 1 "immediate_operand" "")) |
| 985 |
(use (match_operand:SI 2 "immediate_operand" "")) |
| 986 |
(use (label_ref (match_operand 3 "" ""))) |
| 987 |
(use (label_ref (match_operand 4 "" "")))] |
| 988 |
"" |
| 989 |
" |
| 990 |
{ |
| 991 |
xstormy16_expand_casesi (operands[0], operands[1], operands[2], |
| 992 |
operands[3], operands[4]); |
| 993 |
DONE; |
| 994 |
}") |
| 995 |
|
| 996 |
(define_insn "tablejump_pcrel" |
| 997 |
[(set (pc) (mem:HI (plus:HI (pc) |
| 998 |
(match_operand:HI 0 "register_operand" "r")))) |
| 999 |
(use (label_ref:SI (match_operand 1 "" "")))] |
| 1000 |
"" |
| 1001 |
"br %0" |
| 1002 |
[(set_attr "psw_operand" "nop")]) |
| 1003 |
|
| 1004 |
;; :::::::::::::::::::: |
| 1005 |
;; :: |
| 1006 |
;; :: Prologue and Epilogue instructions |
| 1007 |
;; :: |
| 1008 |
;; :::::::::::::::::::: |
| 1009 |
|
| 1010 |
;; Called after register allocation to add any instructions needed for |
| 1011 |
;; the prologue. Using a prologue insn is favored compared to putting |
| 1012 |
;; all of the instructions in the TARGET_ASM_FUNCTION_PROLOGUE macro, |
| 1013 |
;; since it allows the scheduler to intermix instructions with the |
| 1014 |
;; saves of the caller saved registers. In some cases, it might be |
| 1015 |
;; necessary to emit a barrier instruction as the last insn to prevent |
| 1016 |
;; such scheduling. |
| 1017 |
(define_expand "prologue" |
| 1018 |
[(const_int 1)] |
| 1019 |
"" |
| 1020 |
{ |
| 1021 |
xstormy16_expand_prologue (); |
| 1022 |
DONE; |
| 1023 |
}) |
| 1024 |
|
| 1025 |
;; Called after register allocation to add any instructions needed for |
| 1026 |
;; the epilogue. Using an epilogue insn is favored compared to putting |
| 1027 |
;; all of the instructions in the TARGET_ASM_FUNCTION_EPILOGUE macro, |
| 1028 |
;; since it allows the scheduler to intermix instructions with the |
| 1029 |
;; restores of the caller saved registers. In some cases, it might be |
| 1030 |
;; necessary to emit a barrier instruction as the first insn to |
| 1031 |
;; prevent such scheduling. |
| 1032 |
(define_expand "epilogue" |
| 1033 |
[(const_int 2)] |
| 1034 |
"" |
| 1035 |
{ |
| 1036 |
xstormy16_expand_epilogue (); |
| 1037 |
DONE; |
| 1038 |
}) |
| 1039 |
|
| 1040 |
;; :::::::::::::::::::: |
| 1041 |
;; :: |
| 1042 |
;; :: Miscellaneous instructions |
| 1043 |
;; :: |
| 1044 |
;; :::::::::::::::::::: |
| 1045 |
|
| 1046 |
;; No operation, needed in case the user uses -g but not -O. |
| 1047 |
(define_insn "nop" |
| 1048 |
[(const_int 0)] |
| 1049 |
"" |
| 1050 |
"nop" |
| 1051 |
[(set_attr "psw_operand" "nop")]) |
| 1052 |
|
| 1053 |
;; Pseudo instruction that prevents the scheduler from moving code above this |
| 1054 |
;; point. |
| 1055 |
(define_insn "blockage" |
| 1056 |
[(unspec_volatile [(const_int 0)] 0)] |
| 1057 |
"" |
| 1058 |
"" |
| 1059 |
[(set_attr "length" "0") |
| 1060 |
(set_attr "psw_operand" "nop")]) |
| 1061 |
|
| 1062 |
;;--------------------------------------------------------------------------- |
| 1063 |
|
| 1064 |
(define_expand "iorqi3" |
| 1065 |
[(match_operand:QI 0 "xstormy16_below100_or_register" "") |
| 1066 |
(match_operand:QI 1 "xstormy16_below100_or_register" "") |
| 1067 |
(match_operand:QI 2 "nonmemory_operand" "")] |
| 1068 |
"" |
| 1069 |
{ |
| 1070 |
xstormy16_expand_iorqi3 (operands); |
| 1071 |
DONE; |
| 1072 |
}) |
| 1073 |
|
| 1074 |
(define_insn "iorqi3_internal" |
| 1075 |
[(set (match_operand:QI 0 "xstormy16_below100_or_register" "=Wr") |
| 1076 |
(ior:QI (match_operand:QI 1 "xstormy16_below100_or_register" "0") |
| 1077 |
(match_operand:QI 2 "xstormy16_onebit_set_operand" "i")))] |
| 1078 |
"" |
| 1079 |
"set1 %0,%B2" |
| 1080 |
[(set_attr "length" "2") |
| 1081 |
(set_attr "psw_operand" "0")]) |
| 1082 |
|
| 1083 |
(define_peephole2 |
| 1084 |
[(set (match_operand:QI 0 "register_operand" "") |
| 1085 |
(match_operand:QI 1 "xstormy16_below100_operand" "")) |
| 1086 |
(set (match_operand:HI 2 "register_operand" "") |
| 1087 |
(ior:HI (match_operand:HI 3 "register_operand" "") |
| 1088 |
(match_operand:QI 4 "xstormy16_onebit_set_operand" ""))) |
| 1089 |
(set (match_operand:QI 5 "xstormy16_below100_operand" "") |
| 1090 |
(match_operand:QI 6 "register_operand" "")) |
| 1091 |
] |
| 1092 |
"REGNO (operands[0]) == REGNO (operands[2]) |
| 1093 |
&& REGNO (operands[0]) == REGNO (operands[3]) |
| 1094 |
&& REGNO (operands[0]) == REGNO (operands[6]) |
| 1095 |
&& rtx_equal_p (operands[1], operands[5])" |
| 1096 |
[(set (match_dup 1) |
| 1097 |
(ior:QI (match_dup 1) |
| 1098 |
(match_dup 4))) |
| 1099 |
] |
| 1100 |
"") |
| 1101 |
|
| 1102 |
|
| 1103 |
(define_expand "andqi3" |
| 1104 |
[(match_operand:QI 0 "xstormy16_below100_or_register" "") |
| 1105 |
(match_operand:QI 1 "xstormy16_below100_or_register" "") |
| 1106 |
(match_operand:QI 2 "nonmemory_operand" "")] |
| 1107 |
"" |
| 1108 |
{ |
| 1109 |
xstormy16_expand_andqi3 (operands); |
| 1110 |
DONE; |
| 1111 |
}) |
| 1112 |
|
| 1113 |
(define_insn "andqi3_internal" |
| 1114 |
[(set (match_operand:QI 0 "xstormy16_below100_or_register" "=Wr") |
| 1115 |
(and:QI (match_operand:QI 1 "xstormy16_below100_or_register" "0") |
| 1116 |
(match_operand:QI 2 "xstormy16_onebit_clr_operand" "i")))] |
| 1117 |
"" |
| 1118 |
"clr1 %0,%B2" |
| 1119 |
[(set_attr "length" "2") |
| 1120 |
(set_attr "psw_operand" "0")]) |
| 1121 |
|
| 1122 |
(define_peephole2 |
| 1123 |
[(set (match_operand:HI 0 "register_operand" "") |
| 1124 |
(and:HI (match_operand:HI 1 "register_operand" "") |
| 1125 |
(match_operand 2 "immediate_operand" ""))) |
| 1126 |
(set (match_operand:HI 3 "register_operand" "") |
| 1127 |
(zero_extend:HI (match_operand:QI 4 "register_operand" ""))); |
| 1128 |
] |
| 1129 |
"REGNO (operands[0]) == REGNO (operands[1]) |
| 1130 |
&& REGNO (operands[0]) == REGNO (operands[3]) |
| 1131 |
&& REGNO (operands[0]) == REGNO (operands[4])" |
| 1132 |
[(set (match_dup 0) |
| 1133 |
(and:HI (match_dup 1) |
| 1134 |
(match_dup 5))) |
| 1135 |
] |
| 1136 |
"operands[5] = GEN_INT (INTVAL (operands[2]) & 0xff);") |
| 1137 |
|
| 1138 |
(define_peephole2 |
| 1139 |
[(set (match_operand:QI 0 "register_operand" "") |
| 1140 |
(match_operand:QI 1 "xstormy16_below100_operand" "")) |
| 1141 |
(set (match_operand:HI 2 "register_operand" "") |
| 1142 |
(and:HI (match_operand:HI 3 "register_operand" "") |
| 1143 |
(match_operand:QI 4 "xstormy16_onebit_clr_operand" ""))) |
| 1144 |
(set (match_operand:QI 5 "xstormy16_below100_operand" "") |
| 1145 |
(match_operand:QI 6 "register_operand" "")) |
| 1146 |
] |
| 1147 |
"REGNO (operands[0]) == REGNO (operands[2]) |
| 1148 |
&& REGNO (operands[0]) == REGNO (operands[3]) |
| 1149 |
&& REGNO (operands[0]) == REGNO (operands[6]) |
| 1150 |
&& rtx_equal_p (operands[1], operands[5])" |
| 1151 |
[(set (match_dup 1) |
| 1152 |
(and:QI (match_dup 1) |
| 1153 |
(match_dup 4))) |
| 1154 |
] |
| 1155 |
"") |
| 1156 |
|
| 1157 |
;; GCC uses different techniques to optimize MSB and LSB accesses, so |
| 1158 |
;; we have to code those separately. |
| 1159 |
|
| 1160 |
(define_insn "*bclrx" |
| 1161 |
[(set (pc) |
| 1162 |
(if_then_else (eq:HI (and:QI (match_operand:QI 1 "xstormy16_below100_operand" "W") |
| 1163 |
(match_operand:HI 2 "immediate_operand" "i")) |
| 1164 |
(const_int 0)) |
| 1165 |
(label_ref (match_operand 0 "" "")) |
| 1166 |
(pc))) |
| 1167 |
(clobber (reg:BI CARRY_REG))] |
| 1168 |
"" |
| 1169 |
"bn %1,%B2,%l0" |
| 1170 |
[(set_attr "length" "4") |
| 1171 |
(set_attr "psw_operand" "nop")]) |
| 1172 |
|
| 1173 |
(define_insn "*bclrx2" |
| 1174 |
[(set (pc) |
| 1175 |
(if_then_else (zero_extract:HI |
| 1176 |
(xor:HI (subreg:HI |
| 1177 |
(match_operand:QI 1 "xstormy16_below100_operand" "W") 0) |
| 1178 |
(match_operand:HI 2 "xstormy16_onebit_set_operand" "J")) |
| 1179 |
(const_int 1) |
| 1180 |
(match_operand:HI 3 "immediate_operand" "i")) |
| 1181 |
(label_ref (match_operand 0 "" "")) |
| 1182 |
(pc))) |
| 1183 |
(clobber (reg:BI CARRY_REG))] |
| 1184 |
"" |
| 1185 |
"bn %1,%B2,%l0" |
| 1186 |
[(set_attr "length" "4") |
| 1187 |
(set_attr "psw_operand" "nop")]) |
| 1188 |
|
| 1189 |
(define_insn "*bclrx3" |
| 1190 |
[(set (pc) |
| 1191 |
(if_then_else (eq:HI (and:HI (zero_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W")) |
| 1192 |
(match_operand:HI 2 "immediate_operand" "i")) |
| 1193 |
(const_int 0)) |
| 1194 |
(label_ref (match_operand 0 "" "")) |
| 1195 |
(pc))) |
| 1196 |
(clobber (reg:BI CARRY_REG))] |
| 1197 |
"" |
| 1198 |
"bn %1,%B2,%l0" |
| 1199 |
[(set_attr "length" "4") |
| 1200 |
(set_attr "psw_operand" "nop")]) |
| 1201 |
|
| 1202 |
(define_insn "*bclr7" |
| 1203 |
[(set (pc) |
| 1204 |
(if_then_else (xor:HI (lshiftrt:HI (subreg:HI |
| 1205 |
(match_operand:QI 1 "xstormy16_below100_operand" "W") 0) |
| 1206 |
(const_int 7)) |
| 1207 |
(const_int 1)) |
| 1208 |
(label_ref (match_operand 0 "" "")) |
| 1209 |
(pc))) |
| 1210 |
(clobber (reg:BI CARRY_REG))] |
| 1211 |
"" |
| 1212 |
"bn %1,#7,%l0" |
| 1213 |
[(set_attr "length" "4") |
| 1214 |
(set_attr "psw_operand" "nop")]) |
| 1215 |
|
| 1216 |
(define_insn "*bclr15" |
| 1217 |
[(set (pc) |
| 1218 |
(if_then_else (ge:HI (sign_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W")) |
| 1219 |
(const_int 0)) |
| 1220 |
(label_ref (match_operand 0 "" "")) |
| 1221 |
(pc))) |
| 1222 |
(clobber (reg:BI CARRY_REG))] |
| 1223 |
"" |
| 1224 |
"bn %1,#7,%l0" |
| 1225 |
[(set_attr "length" "4") |
| 1226 |
(set_attr "psw_operand" "nop")]) |
| 1227 |
|
| 1228 |
(define_insn "*bsetx" |
| 1229 |
[(set (pc) |
| 1230 |
(if_then_else (ne:HI (and:QI (match_operand:QI 1 "xstormy16_below100_operand" "W") |
| 1231 |
(match_operand:HI 2 "immediate_operand" "i")) |
| 1232 |
(const_int 0)) |
| 1233 |
(label_ref (match_operand 0 "" "")) |
| 1234 |
(pc))) |
| 1235 |
(clobber (reg:BI CARRY_REG))] |
| 1236 |
"" |
| 1237 |
"bp %1,%B2,%l0" |
| 1238 |
[(set_attr "length" "4") |
| 1239 |
(set_attr "psw_operand" "nop")]) |
| 1240 |
|
| 1241 |
(define_insn "*bsetx2" |
| 1242 |
[(set (pc) |
| 1243 |
(if_then_else (zero_extract:HI (match_operand:QI 1 "xstormy16_below100_operand" "W") |
| 1244 |
(const_int 1) |
| 1245 |
(match_operand:HI 2 "immediate_operand" "i")) |
| 1246 |
(label_ref (match_operand 0 "" "")) |
| 1247 |
(pc))) |
| 1248 |
(clobber (reg:BI CARRY_REG))] |
| 1249 |
"" |
| 1250 |
"bp %1,%b2,%l0" |
| 1251 |
[(set_attr "length" "4") |
| 1252 |
(set_attr "psw_operand" "nop")]) |
| 1253 |
|
| 1254 |
(define_insn "*bsetx3" |
| 1255 |
[(set (pc) |
| 1256 |
(if_then_else (ne:HI (and:HI (zero_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W")) |
| 1257 |
(match_operand:HI 2 "immediate_operand" "i")) |
| 1258 |
(const_int 0)) |
| 1259 |
(label_ref (match_operand 0 "" "")) |
| 1260 |
(pc))) |
| 1261 |
(clobber (reg:BI CARRY_REG))] |
| 1262 |
"" |
| 1263 |
"bp %1,%B2,%l0" |
| 1264 |
[(set_attr "length" "4") |
| 1265 |
(set_attr "psw_operand" "nop")]) |
| 1266 |
|
| 1267 |
(define_insn "*bset7" |
| 1268 |
[(set (pc) |
| 1269 |
(if_then_else (lshiftrt:HI (subreg:HI (match_operand:QI 1 "xstormy16_below100_operand" "W") 0) |
| 1270 |
(const_int 7)) |
| 1271 |
(label_ref (match_operand 0 "" "")) |
| 1272 |
(pc))) |
| 1273 |
(clobber (reg:BI CARRY_REG))] |
| 1274 |
"" |
| 1275 |
"bp %1,#7,%l0" |
| 1276 |
[(set_attr "length" "4") |
| 1277 |
(set_attr "psw_operand" "nop")]) |
| 1278 |
|
| 1279 |
(define_insn "*bset15" |
| 1280 |
[(set (pc) |
| 1281 |
(if_then_else (lt:HI (sign_extend:HI (match_operand:QI 1 "xstormy16_below100_operand" "W")) |
| 1282 |
(const_int 0)) |
| 1283 |
(label_ref (match_operand 0 "" "")) |
| 1284 |
(pc))) |
| 1285 |
(clobber (reg:BI CARRY_REG))] |
| 1286 |
"" |
| 1287 |
"bp %1,#7,%l0" |
| 1288 |
[(set_attr "length" "4") |
| 1289 |
(set_attr "psw_operand" "nop")]) |
| 1290 |
|
| 1291 |
(define_insn "bswaphi2" |
| 1292 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1293 |
(bswap:HI (match_operand:HI 1 "register_operand" "0")))] |
| 1294 |
"" |
| 1295 |
"swpb %0") |
| 1296 |
|
| 1297 |
(define_insn "bswapsi2" |
| 1298 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 1299 |
(bswap:SI (match_operand:SI 1 "register_operand" "0")))] |
| 1300 |
"" |
| 1301 |
"swpb %0 | swpb %h0 | swpw %0,%h0" |
| 1302 |
[(set_attr "length" "6")]) |
| 1303 |
|
| 1304 |
(define_insn "swaphi" |
| 1305 |
[(set (match_operand:HI 0 "register_operand" "+r") |
| 1306 |
(match_operand:HI 1 "register_operand" "+r")) |
| 1307 |
(set (match_dup 1) |
| 1308 |
(match_dup 0))] |
| 1309 |
"" |
| 1310 |
"swpw %0,%1") |
| 1311 |
|
| 1312 |
(define_peephole2 |
| 1313 |
[(set (match_operand:HI 0 "register_operand") |
| 1314 |
(match_operand:HI 1 "register_operand")) |
| 1315 |
(set (match_dup 1) |
| 1316 |
(match_operand:HI 2 "register_operand")) |
| 1317 |
(set (match_dup 2) |
| 1318 |
(match_dup 0))] |
| 1319 |
"REGNO (operands[0]) != REGNO (operands[1]) |
| 1320 |
&& REGNO (operands[0]) != REGNO (operands[2]) |
| 1321 |
&& REGNO (operands[1]) != REGNO (operands[2]) |
| 1322 |
&& peep2_reg_dead_p (3, operands[0])" |
| 1323 |
[(parallel [(set (match_dup 2) (match_dup 1)) |
| 1324 |
(set (match_dup 1) (match_dup 2))])]) |
| 1325 |
|
| 1326 |
;; Recognize shl+and and shr+and as macro instructions. |
| 1327 |
(define_insn_and_split "*<code>_and_internal" |
| 1328 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1329 |
(and:HI (any_lshift:HI (match_operand 1 "register_operand" "0") |
| 1330 |
(match_operand 2 "const_int_operand" "i")) |
| 1331 |
(match_operand 3 "const_int_operand" "i"))) |
| 1332 |
(clobber (reg:BI CARRY_REG))] |
| 1333 |
"IN_RANGE (INTVAL (operands[2]), 0, 15)" |
| 1334 |
"#" |
| 1335 |
"reload_completed" |
| 1336 |
[(parallel [(set (match_dup 0) (any_lshift:HI (match_dup 1) (match_dup 2))) |
| 1337 |
(clobber (reg:BI CARRY_REG))]) |
| 1338 |
(set (match_dup 0) (and:HI (match_dup 0) (match_dup 3)))]) |
| 1339 |
|
| 1340 |
;; Swap nibbles instruction |
| 1341 |
(define_insn "*swpn" |
| 1342 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1343 |
(any_or_plus:HI |
| 1344 |
(any_or_plus:HI |
| 1345 |
(and:HI (ashift:HI (match_operand:HI 1 "register_operand" "0") |
| 1346 |
(const_int 4)) |
| 1347 |
(const_int 240)) |
| 1348 |
(and:HI (lshiftrt:HI (match_dup 1) (const_int 4)) |
| 1349 |
(const_int 15))) |
| 1350 |
(and:HI (match_dup 1) (const_int -256))))] |
| 1351 |
"" |
| 1352 |
"swpn %0") |
| 1353 |
|
| 1354 |
(define_insn "*swpn_zext" |
| 1355 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1356 |
(any_or_plus:HI |
| 1357 |
(and:HI (ashift:HI (match_operand:HI 1 "register_operand" "0") |
| 1358 |
(const_int 4)) |
| 1359 |
(const_int 240)) |
| 1360 |
(and:HI (lshiftrt:HI (match_dup 1) (const_int 4)) |
| 1361 |
(const_int 15))))] |
| 1362 |
"" |
| 1363 |
"swpn %0 | and %0,#255" |
| 1364 |
[(set_attr "length" "6")]) |
| 1365 |
|
| 1366 |
;; Alternate form when we use PLUS instead of IOR early in the |
| 1367 |
;; expanders. |
| 1368 |
(define_insn "*swpn_zext" |
| 1369 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1370 |
(zero_extend:HI |
| 1371 |
(subreg:QI |
| 1372 |
(any_or_plus:HI |
| 1373 |
(ashift:HI (match_operand:HI 1 "register_operand" "0") |
| 1374 |
(const_int 4)) |
| 1375 |
(lshiftrt:HI (match_dup 1) (const_int 4))) 0)))] |
| 1376 |
"" |
| 1377 |
"swpn %0 | and %0,#255" |
| 1378 |
[(set_attr "length" "6")]) |
| 1379 |
|
| 1380 |
(define_insn "*swpn_sext" |
| 1381 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1382 |
(sign_extend:HI |
| 1383 |
(rotate:QI (subreg:QI (match_operand:HI 1 "register_operand" "0") 0) |
| 1384 |
(const_int 4))))] |
| 1385 |
"" |
| 1386 |
"swpn %0 | cbw %0" |
| 1387 |
[(set_attr "length" "4")]) |
| 1388 |
|
| 1389 |
(define_insn "*swpn_sext_2" |
| 1390 |
[(set (match_operand:HI 0 "register_operand" "=r") |
| 1391 |
(sign_extend:HI |
| 1392 |
(subreg:QI |
| 1393 |
(any_or_plus:HI |
| 1394 |
(ashift:HI (match_operand:HI 1 "register_operand" "0") |
| 1395 |
(const_int 4)) |
| 1396 |
(subreg:HI (lshiftrt:QI (subreg:QI (match_dup 1) 0) |
| 1397 |
(const_int 4)) 0)) 0)))] |
| 1398 |
"" |
| 1399 |
"swpn %0 | cbw %0" |
| 1400 |
[(set_attr "length" "4")]) |
| 1401 |
|
| 1402 |
;; Recognize swpn_zext+ior as a macro instruction. |
| 1403 |
(define_insn_and_split "*swpn_zext_ior" |
| 1404 |
[(set (match_operand:HI 0 "register_operand") |
| 1405 |
(any_or_plus:HI |
| 1406 |
(any_or_plus:HI |
| 1407 |
(and:HI (ashift:HI (match_operand:HI 1 "register_operand") |
| 1408 |
(const_int 4)) |
| 1409 |
(const_int 240)) |
| 1410 |
(and:HI (lshiftrt:HI (match_dup 1) (const_int 4)) |
| 1411 |
(const_int 15))) |
| 1412 |
(match_operand:HI 2 "nonmemory_operand")))] |
| 1413 |
"can_create_pseudo_p ()" |
| 1414 |
"#" |
| 1415 |
"&& 1" |
| 1416 |
[(set (match_dup 3) (ior:HI (and:HI (ashift:HI (match_dup 1) (const_int 4)) |
| 1417 |
(const_int 240)) |
| 1418 |
(and:HI (lshiftrt:HI (match_dup 1) (const_int 4)) |
| 1419 |
(const_int 15)))) |
| 1420 |
(set (match_dup 0) (ior:HI (match_dup 3) (match_dup 2)))] |
| 1421 |
"operands[3] = gen_reg_rtx (HImode);") |
| 1422 |
|