📄 alpha.md
字号:
[(set (match_operand:SI 0 "register_operand" "=r") (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))] "! TARGET_BWX" "zapnot %1,3,%0" [(set_attr "type" "shift")])(define_expand "zero_extendhisi2" [(set (match_operand:SI 0 "register_operand" "") (zero_extend:SI (match_operand:HI 1 "register_operand" "")))] "" "")(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r,r") (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] "TARGET_BWX" "@ zapnot %1,3,%0 ldwu %0,%1" [(set_attr "type" "shift,ld")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))] "" "zapnot %1,3,%0" [(set_attr "type" "shift")])(define_expand "zero_extendhidi2" [(set (match_operand:DI 0 "register_operand" "") (zero_extend:DI (match_operand:HI 1 "register_operand" "")))] "" "")(define_insn "zero_extendsidi2" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))] "" "zapnot %1,15,%0" [(set_attr "type" "shift")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")) (match_operand:DI 2 "reg_or_0_operand" "rJ")))] "" "bic %r2,%1,%0" [(set_attr "type" "ilog")])(define_insn "iordi3" [(set (match_operand:DI 0 "register_operand" "=r,r") (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ") (match_operand:DI 2 "or_operand" "rI,N")))] "" "@ bis %r1,%2,%0 ornot %r1,%N2,%0" [(set_attr "type" "ilog")])(define_insn "one_cmpldi2" [(set (match_operand:DI 0 "register_operand" "=r") (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))] "" "ornot $31,%1,%0" [(set_attr "type" "ilog")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")) (match_operand:DI 2 "reg_or_0_operand" "rJ")))] "" "ornot %r2,%1,%0" [(set_attr "type" "ilog")])(define_insn "xordi3" [(set (match_operand:DI 0 "register_operand" "=r,r") (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ") (match_operand:DI 2 "or_operand" "rI,N")))] "" "@ xor %r1,%2,%0 eqv %r1,%N2,%0" [(set_attr "type" "ilog")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ") (match_operand:DI 2 "register_operand" "rI"))))] "" "eqv %r1,%2,%0" [(set_attr "type" "ilog")]);; Handle the FFS insn if we support CIX. (define_expand "ffsdi2" [(set (match_dup 2) (unspec [(match_operand:DI 1 "register_operand" "")] 1)) (set (match_dup 3) (plus:DI (match_dup 2) (const_int 1))) (set (match_operand:DI 0 "register_operand" "") (if_then_else:DI (eq (match_dup 1) (const_int 0)) (const_int 0) (match_dup 3)))] "TARGET_CIX" "{ operands[2] = gen_reg_rtx (DImode); operands[3] = gen_reg_rtx (DImode);}")(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (unspec [(match_operand:DI 1 "register_operand" "r")] 1))] "TARGET_CIX" "cttz %1,%0" [(set_attr "type" "shift")]);; Next come the shifts and the various extract and insert operations.(define_insn "ashldi3" [(set (match_operand:DI 0 "register_operand" "=r,r") (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ") (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))] "" "*{ switch (which_alternative) { case 0: if (operands[2] == const1_rtx) return \"addq %r1,%r1,%0\"; else return \"s%P2addq %r1,0,%0\"; case 1: return \"sll %r1,%2,%0\"; }}" [(set_attr "type" "iadd,shift")]);; ??? The following pattern is made by combine, but earlier phases;; (specifically flow) can't handle it. This occurs in jump.c. Deal;; with this in a better way at some point.;;(define_insn "";; [(set (match_operand:DI 0 "register_operand" "=r");; (sign_extend:DI;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ");; (match_operand:DI 2 "const_int_operand" "P"));; 0)))];; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3";; "*;;{;; if (operands[2] == const1_rtx);; return \"addl %r1,%r1,%0\";;; else;; return \"s%P2addl %r1,0,%0\";;; }";; [(set_attr "type" "iadd")]) (define_insn "lshrdi3" [(set (match_operand:DI 0 "register_operand" "=r") (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (match_operand:DI 2 "reg_or_6bit_operand" "rI")))] "" "srl %r1,%2,%0" [(set_attr "type" "shift")])(define_insn "ashrdi3" [(set (match_operand:DI 0 "register_operand" "=r") (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (match_operand:DI 2 "reg_or_6bit_operand" "rI")))] "" "sra %r1,%2,%0" [(set_attr "type" "shift")])(define_expand "extendqihi2" [(set (match_dup 2) (ashift:DI (match_operand:QI 1 "some_operand" "") (const_int 56))) (set (match_operand:HI 0 "register_operand" "") (ashiftrt:DI (match_dup 2) (const_int 56)))] "" "{ if (TARGET_BWX) { emit_insn (gen_extendqihi2x (operands[0], force_reg (QImode, operands[1]))); DONE; } /* If we have an unaligned MEM, extend to DImode (which we do specially) and then copy to the result. */ if (unaligned_memory_operand (operands[1], HImode)) { rtx temp = gen_reg_rtx (DImode); emit_insn (gen_extendqidi2 (temp, operands[1])); emit_move_insn (operands[0], gen_lowpart (HImode, temp)); DONE; } operands[0] = gen_lowpart (DImode, operands[0]); operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1])); operands[2] = gen_reg_rtx (DImode);}")(define_insn "extendqidi2x" [(set (match_operand:DI 0 "register_operand" "=r") (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))] "TARGET_BWX" "sextb %1,%0" [(set_attr "type" "shift")])(define_insn "extendhidi2x" [(set (match_operand:DI 0 "register_operand" "=r") (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))] "TARGET_BWX" "sextw %1,%0" [(set_attr "type" "shift")])(define_insn "extendqisi2x" [(set (match_operand:SI 0 "register_operand" "=r") (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))] "TARGET_BWX" "sextb %1,%0" [(set_attr "type" "shift")])(define_insn "extendhisi2x" [(set (match_operand:SI 0 "register_operand" "=r") (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))] "TARGET_BWX" "sextw %1,%0" [(set_attr "type" "shift")])(define_insn "extendqihi2x" [(set (match_operand:HI 0 "register_operand" "=r") (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))] "TARGET_BWX" "sextb %1,%0" [(set_attr "type" "shift")])(define_expand "extendqisi2" [(set (match_dup 2) (ashift:DI (match_operand:QI 1 "some_operand" "") (const_int 56))) (set (match_operand:SI 0 "register_operand" "") (ashiftrt:DI (match_dup 2) (const_int 56)))] "" "{ if (TARGET_BWX) { emit_insn (gen_extendqisi2x (operands[0], force_reg (QImode, operands[1]))); DONE; } /* If we have an unaligned MEM, extend to a DImode form of the result (which we do specially). */ if (unaligned_memory_operand (operands[1], QImode)) { rtx temp = gen_reg_rtx (DImode); emit_insn (gen_extendqidi2 (temp, operands[1])); emit_move_insn (operands[0], gen_lowpart (SImode, temp)); DONE; } operands[0] = gen_lowpart (DImode, operands[0]); operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1])); operands[2] = gen_reg_rtx (DImode);}")(define_expand "extendqidi2" [(set (match_dup 2) (ashift:DI (match_operand:QI 1 "some_operand" "") (const_int 56))) (set (match_operand:DI 0 "register_operand" "") (ashiftrt:DI (match_dup 2) (const_int 56)))] "" "{ extern rtx get_unaligned_address (); if (TARGET_BWX) { emit_insn (gen_extendqidi2x (operands[0], force_reg (QImode, operands[1]))); DONE; } if (unaligned_memory_operand (operands[1], QImode)) { rtx seq = gen_unaligned_extendqidi (operands[0], get_unaligned_address (operands[1], 1)); alpha_set_memflags (seq, operands[1]); emit_insn (seq); DONE; } operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1])); operands[2] = gen_reg_rtx (DImode);}")(define_expand "extendhisi2" [(set (match_dup 2) (ashift:DI (match_operand:HI 1 "some_operand" "") (const_int 48))) (set (match_operand:SI 0 "register_operand" "") (ashiftrt:DI (match_dup 2) (const_int 48)))] "" "{ if (TARGET_BWX) { emit_insn (gen_extendhisi2x (operands[0], force_reg (HImode, operands[1]))); DONE; } /* If we have an unaligned MEM, extend to a DImode form of the result (which we do specially). */ if (unaligned_memory_operand (operands[1], HImode)) { rtx temp = gen_reg_rtx (DImode); emit_insn (gen_extendhidi2 (temp, operands[1])); emit_move_insn (operands[0], gen_lowpart (SImode, temp)); DONE; } operands[0] = gen_lowpart (DImode, operands[0]); operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1])); operands[2] = gen_reg_rtx (DImode);}")(define_expand "extendhidi2" [(set (match_dup 2) (ashift:DI (match_operand:HI 1 "some_operand" "") (const_int 48))) (set (match_operand:DI 0 "register_operand" "") (ashiftrt:DI (match_dup 2) (const_int 48)))] "" "{ extern rtx get_unaligned_address (); if (TARGET_BWX) { emit_insn (gen_extendhidi2x (operands[0], force_reg (HImode, operands[1]))); DONE; } if (unaligned_memory_operand (operands[1], HImode)) { rtx seq = gen_unaligned_extendhidi (operands[0], get_unaligned_address (operands[1], 2)); alpha_set_memflags (seq, operands[1]); emit_insn (seq); DONE; } operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1])); operands[2] = gen_reg_rtx (DImode);}");; Here's how we sign extend an unaligned byte and halfword. Doing this;; as a pattern saves one instruction. The code is similar to that for;; the unaligned loads (see below).;;;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.(define_expand "unaligned_extendqidi" [(set (match_dup 2) (match_operand:DI 1 "address_operand" "")) (set (match_dup 3) (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1)) (const_int -8)))) (set (match_dup 4) (ashift:DI (match_dup 3) (minus:DI (const_int 56) (ashift:DI (and:DI (plus:DI (match_dup 2) (const_int -1)) (const_int 7)) (const_int 3))))) (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) (ashiftrt:DI (match_dup 4) (const_int 56)))] "" "{ operands[2] = gen_reg_rtx (DImode); operands[3] = gen_reg_rtx (DImode); operands[4] = gen_reg_rtx (DImode);}")(define_expand "unaligned_extendhidi" [(set (match_dup 2) (match_operand:DI 1 "address_operand" "")) (set (match_dup 3) (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2)) (const_int -8)))) (set (match_dup 4) (ashift:DI (match_dup 3) (minus:DI (const_int 56) (ashift:DI (and:DI (plus:DI (match_dup 2) (const_int -1)) (const_int 7)) (const_int 3))))) (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) (ashiftrt:DI (match_dup 4) (const_int 48)))] "" "{ operands[2] = gen_reg_rtx (DImode); operands[3] = gen_reg_rtx (DImode); operands[4] = gen_reg_rtx (DImode);}")(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (match_operand:DI 2 "mode_width_operand" "n") (match_operand:DI 3 "mul8_operand" "I")))] "" "ext%M2l %r1,%s3,%0" [(set_attr "type" "shift")])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -