📄 alpha.md
字号:
;; ??? 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" "rS")))] "" "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" "rS")))] "" "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)))] "" "{ 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)))] "" "{ 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")])(define_insn "extxl" [(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") (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI") (const_int 3))))] "" "ext%M2l %r1,%3,%0" [(set_attr "type" "shift")]);; Combine has some strange notion of preserving existing undefined behaviour;; in shifts larger than a word size. So capture these patterns that it ;; should have turned into zero_extracts.(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (and (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") (const_int 3))) (match_operand:DI 3 "mode_mask_operand" "n")))] "" "ext%U3l %1,%2,%0" [(set_attr "type" "shift")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") (const_int 3))))] "" "extql %1,%2,%0" [(set_attr "type" "shift")])(define_insn "extqh" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (minus:DI (const_int 56) (ashift:DI (and:DI (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") (const_int -1)) (const_int 7)) (const_int 3)))))] "" "extqh %r1,%2,%0" [(set_attr "type" "shift")])(define_insn "extlh" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (const_int 2147483647)) (minus:DI (const_int 56) (ashift:DI (and:DI (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") (const_int -1)) (const_int 7)) (const_int 3)))))] "" "extlh %r1,%2,%0" [(set_attr "type" "shift")])(define_insn "extwh" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") (const_int 65535)) (minus:DI (const_int 56) (ashift:DI (and:DI (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") (const_int -1)) (const_int 7)) (const_int 3)))))] "" "extwh %r1,%2,%0" [(set_attr "type" "shift")]);; This converts an extXl into an extXh with an appropriate adjustment;; to the address calculation.;;(define_split;; [(set (match_operand:DI 0 "register_operand" "");; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "");; (match_operand:DI 2 "mode_width_operand" "");; (ashift:DI (match_operand:DI 3 "" "");; (const_int 3)));; (match_operand:DI 4 "const_int_operand" "")));; (clobber (match_operand:DI 5 "register_operand" ""))];; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])";; [(set (match_dup 5) (match_dup 6));; (set (match_dup 0);; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2);; (ashift:DI (plus:DI (match_dup 5);; (match_dup 7));; (const_int 3)));; (match_dup 4)))];; ";;{;; operands[6] = plus_constant (operands[3], ;; INTVAL (operands[2]) / BITS_PER_UNIT);;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);;;}") (define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r")) (match_operand:DI 2 "mul8_operand" "I")))] "" "insbl %1,%s2,%0" [(set_attr "type" "shift")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r")) (match_operand:DI 2 "mul8_operand" "I")))] "" "inswl %1,%s2,%0" [(set_attr "type" "shift")])(define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) (match_operand:DI 2 "mul8_operand" "I")))] "" "insll %1,%s2,%0" [(set_attr "type" "shift")])(define_insn "insbl" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r")) (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") (const_int 3))))] ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -