📄 alpha.md
字号:
; ??? The FPU communicates with memory and the integer register file; via two fp store units. We need a slot in the fst immediately, and; a slot in LOW after the operand data is ready. At which point the; data may be moved either to the store queue or the integer register; file and the insn retired.;; First define the arithmetic insns. Note that the 32-bit forms also;; sign-extend.;; Handle 32-64 bit extension from memory to a floating point register;; specially, since this occurs frequently in int->double conversions.;;;; Note that while we must retain the =f case in the insn for reload's;; benefit, it should be eliminated after reload, so we should never emit;; code for that case. But we don't reject the possibility.(define_expand "extendsidi2" [(set (match_operand:DI 0 "register_operand" "") (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))] "" "")(define_insn "*extendsidi2_nofix" [(set (match_operand:DI 0 "register_operand" "=r,r,*f,?*f") (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,m")))] "! TARGET_FIX" "@ addl %1,$31,%0 ldl %0,%1 cvtlq %1,%0 lds %0,%1\;cvtlq %0,%0" [(set_attr "type" "iadd,ild,fadd,fld") (set_attr "length" "*,*,*,8")])(define_insn "*extendsidi2_fix" [(set (match_operand:DI 0 "register_operand" "=r,r,r,?*f,?*f") (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,*f,m")))] "TARGET_FIX" "@ addl %1,$31,%0 ldl %0,%1 ftois %1,%0 cvtlq %1,%0 lds %0,%1\;cvtlq %0,%0" [(set_attr "type" "iadd,ild,ftoi,fadd,fld") (set_attr "length" "*,*,*,*,8")]);; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.(define_split [(set (match_operand:DI 0 "hard_fp_register_operand" "") (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))] "reload_completed" [(set (match_dup 2) (match_dup 1)) (set (match_dup 0) (sign_extend:DI (match_dup 2)))] "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));");; Optimize sign-extension of SImode loads. This shows up in the wake of;; reload when converting fp->int.(define_peephole2 [(set (match_operand:SI 0 "hard_int_register_operand" "") (match_operand:SI 1 "memory_operand" "")) (set (match_operand:DI 2 "hard_int_register_operand" "") (sign_extend:DI (match_dup 0)))] "true_regnum (operands[0]) == true_regnum (operands[2]) || peep2_reg_dead_p (2, operands[0])" [(set (match_dup 2) (sign_extend:DI (match_dup 1)))] "")(define_peephole2 [(set (match_operand:SI 0 "hard_int_register_operand" "") (match_operand:SI 1 "hard_fp_register_operand" "")) (set (match_operand:DI 2 "hard_int_register_operand" "") (sign_extend:DI (match_dup 0)))] "TARGET_FIX && (true_regnum (operands[0]) == true_regnum (operands[2]) || peep2_reg_dead_p (2, operands[0]))" [(set (match_dup 2) (sign_extend:DI (match_dup 1)))] "")(define_peephole2 [(set (match_operand:DI 0 "hard_fp_register_operand" "") (sign_extend:DI (match_operand:SI 1 "hard_fp_register_operand" ""))) (set (match_operand:DI 2 "hard_int_register_operand" "") (match_dup 0))] "TARGET_FIX && peep2_reg_dead_p (2, operands[0])" [(set (match_dup 2) (sign_extend:DI (match_dup 1)))] "");; Don't say we have addsi3 if optimizing. This generates better code. We;; have the anonymous addsi3 pattern below in case combine wants to make it.(define_expand "addsi3" [(set (match_operand:SI 0 "register_operand" "") (plus:SI (match_operand:SI 1 "reg_or_0_operand" "") (match_operand:SI 2 "add_operand" "")))] "! optimize" "")(define_insn "*addsi_internal" [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ") (match_operand:SI 2 "add_operand" "rI,O,K,L")))] "" "@ addl %r1,%2,%0 subl %r1,%n2,%0 lda %0,%2(%r1) ldah %0,%h2(%r1)")(define_split [(set (match_operand:SI 0 "register_operand" "") (plus:SI (match_operand:SI 1 "register_operand" "") (match_operand:SI 2 "const_int_operand" "")))] "! add_operand (operands[2], SImode)" [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3))) (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]{ HOST_WIDE_INT val = INTVAL (operands[2]); HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000); HOST_WIDE_INT rest = val - low; operands[3] = GEN_INT (rest); operands[4] = GEN_INT (low);})(define_insn "*addsi_se" [(set (match_operand:DI 0 "register_operand" "=r,r") (sign_extend:DI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ") (match_operand:SI 2 "sext_add_operand" "rI,O"))))] "" "@ addl %r1,%2,%0 subl %r1,%n2,%0")(define_insn "*addsi_se2" [(set (match_operand:DI 0 "register_operand" "=r,r") (sign_extend:DI (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ") (match_operand:DI 2 "sext_add_operand" "rI,O")) 0)))] "" "@ addl %r1,%2,%0 subl %r1,%n2,%0")(define_split [(set (match_operand:DI 0 "register_operand" "") (sign_extend:DI (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "") (match_operand:SI 2 "const_int_operand" "")))) (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))] "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) % 4 == 0" [(set (match_dup 3) (match_dup 4)) (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3) (match_dup 5)) (match_dup 1))))]{ HOST_WIDE_INT val = INTVAL (operands[2]) / 4; int mult = 4; if (val % 2 == 0) val /= 2, mult = 8; operands[4] = GEN_INT (val); operands[5] = GEN_INT (mult);})(define_split [(set (match_operand:DI 0 "register_operand" "") (sign_extend:DI (plus:SI (match_operator:SI 1 "comparison_operator" [(match_operand 2 "" "") (match_operand 3 "" "")]) (match_operand:SI 4 "add_operand" "")))) (clobber (match_operand:DI 5 "register_operand" ""))] "" [(set (match_dup 5) (match_dup 6)) (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]{ operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode, operands[2], operands[3]); operands[7] = gen_lowpart (SImode, operands[5]);})(define_insn "addvsi3" [(set (match_operand:SI 0 "register_operand" "=r,r") (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ") (match_operand:SI 2 "sext_add_operand" "rI,O"))) (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1)) (sign_extend:DI (match_dup 2))) (sign_extend:DI (plus:SI (match_dup 1) (match_dup 2)))) (const_int 0))] "" "@ addlv %r1,%2,%0 sublv %r1,%n2,%0")(define_expand "adddi3" [(set (match_operand:DI 0 "register_operand" "") (plus:DI (match_operand:DI 1 "register_operand" "") (match_operand:DI 2 "add_operand" "")))] "" "")(define_insn "*adddi_er_high_l" [(set (match_operand:DI 0 "register_operand" "=r") (plus:DI (match_operand:DI 1 "register_operand" "r") (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))] "TARGET_EXPLICIT_RELOCS" "ldah %0,%2(%1)\t\t!gprelhigh")(define_split [(set (match_operand:DI 0 "register_operand" "") (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))] "TARGET_EXPLICIT_RELOCS && reload_completed" [(set (match_dup 0) (plus:DI (match_dup 2) (high:DI (match_dup 1))))] "operands[2] = pic_offset_table_rtx;");; We used to expend quite a lot of effort choosing addq/subq/lda.;; With complications like;;;; The NT stack unwind code can't handle a subq to adjust the stack;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,;; the exception handling code will loop if a subq is used and an;; exception occurs.;;;; The 19980616 change to emit prologues as RTL also confused some;; versions of GDB, which also interprets prologues. This has been;; fixed as of GDB 4.18, but it does not harm to unconditionally;; use lda here.;;;; and the fact that the three insns schedule exactly the same, it's;; just not worth the effort.(define_insn "*adddi_internal" [(set (match_operand:DI 0 "register_operand" "=r,r,r") (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r") (match_operand:DI 2 "add_operand" "r,K,L")))] "" "@ addq %1,%2,%0 lda %0,%2(%1) ldah %0,%h2(%1)");; ??? Allow large constants when basing off the frame pointer or some;; virtual register that may eliminate to the frame pointer. This is;; done because register elimination offsets will change the hi/lo split,;; and if we split before reload, we will require additional instructions.(define_insn "*adddi_fp_hack" [(set (match_operand:DI 0 "register_operand" "=r") (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r") (match_operand:DI 2 "const_int_operand" "n")))] "NONSTRICT_REG_OK_FP_BASE_P (operands[1]) && INTVAL (operands[2]) >= 0 /* This is the largest constant an lda+ldah pair can add, minus an upper bound on the displacement between SP and AP during register elimination. See INITIAL_ELIMINATION_OFFSET. */ && INTVAL (operands[2]) < (0x7fff8000 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD - ALPHA_ROUND(current_function_outgoing_args_size) - (ALPHA_ROUND (get_frame_size () + max_reg_num () * UNITS_PER_WORD + current_function_pretend_args_size) - current_function_pretend_args_size))" "#");; Don't do this if we are adjusting SP since we don't want to do it;; in two steps. Don't split FP sources for the reason listed above.(define_split [(set (match_operand:DI 0 "register_operand" "") (plus:DI (match_operand:DI 1 "register_operand" "") (match_operand:DI 2 "const_int_operand" "")))] "! add_operand (operands[2], DImode) && operands[0] != stack_pointer_rtx && operands[1] != frame_pointer_rtx && operands[1] != arg_pointer_rtx" [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3))) (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]{ HOST_WIDE_INT val = INTVAL (operands[2]); HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000); HOST_WIDE_INT rest = val - low; operands[4] = GEN_INT (low); if (CONST_OK_FOR_LETTER_P (rest, 'L')) operands[3] = GEN_INT (rest); else if (! no_new_pseudos) { operands[3] = gen_reg_rtx (DImode); emit_move_insn (operands[3], operands[2]); emit_insn (gen_adddi3 (operands[0], operands[1], operands[3])); DONE; } else FAIL;})(define_insn "*saddl" [(set (match_operand:SI 0 "register_operand" "=r,r") (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r") (match_operand:SI 2 "const48_operand" "I,I")) (match_operand:SI 3 "sext_add_operand" "rI,O")))] "" "@ s%2addl %1,%3,%0 s%2subl %1,%n3,%0")(define_insn "*saddl_se" [(set (match_operand:DI 0 "register_operand" "=r,r") (sign_extend:DI (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r") (match_operand:SI 2 "const48_operand" "I,I")) (match_operand:SI 3 "sext_add_operand" "rI,O"))))] "" "@ s%2addl %1,%3,%0 s%2subl %1,%n3,%0")(define_split [(set (match_operand:DI 0 "register_operand" "") (sign_extend:DI (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator" [(match_operand 2 "" "") (match_operand 3 "" "")]) (match_operand:SI 4 "const48_operand" "")) (match_operand:SI 5 "sext_add_operand" "")))) (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))] "" [(set (match_dup 6) (match_dup 7)) (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4)) (match_dup 5))))]{ operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode, operands[2], operands[3]); operands[8] = gen_lowpart (SImode, operands[6]);})(define_insn "*saddq" [(set (match_operand:DI 0 "register_operand" "=r,r") (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r") (match_operand:DI 2 "const48_operand" "I,I")) (match_operand:DI 3 "sext_add_operand" "rI,O")))] "" "@ s%2addq %1,%3,%0 s%2subq %1,%n3,%0")(define_insn "addvdi3" [(set (match_operand:DI 0 "register_operand" "=r,r") (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ") (match_operand:DI 2 "sext_add_operand" "rI,O"))) (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1)) (sign_extend:TI (match_dup 2))) (sign_extend:TI (plus:DI (match_dup 1) (match_dup 2)))) (const_int 0))] "" "@ addqv %r1,%2,%0 subqv %r1,%n2,%0")(define_insn "negsi2" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))] "" "subl $31,%1,%0")(define_insn "*negsi_se" [(set (match_operand:DI 0 "register_operand" "=r") (sign_extend:DI (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))] "" "subl $31,%1,%0")(define_insn "negvsi2" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operand:SI 1 "register_operand" "r"))) (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1))) (sign_extend:DI (neg:SI (match_dup 1)))) (const_int 0))] "" "sublv $31,%1,%0")(define_insn "negdi2" [(set (match_operand:DI 0 "register_operand" "=r") (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))] "" "subq $31,%1,%0")(define_insn "negvdi2" [(set (match_operand:DI 0 "register_operand" "=r") (neg:DI (match_operand:DI 1 "register_operand" "r"))) (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1))) (sign_extend:TI (neg:DI (match_dup 1)))) (const_int 0))] "" "subqv $31,%1,%0")(define_expand "subsi3" [(set (match_operand:SI 0 "register_operand" "") (minus:SI (match_operand:SI 1 "reg_or_0_operand" "") (match_operand:SI 2 "reg_or_8bit_operand" "")))] "! optimize" "")(define_insn "*subsi_internal" [(set (match_operand:SI 0 "register_operand" "=r") (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") (match_operand:SI 2 "reg_or_8bit_operand" "rI")))] "" "subl %r1,%2,%0")(define_insn "*subsi_se"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -