📄 cris.md
字号:
end_sequence (); emit_no_conflict_block (insns, op0, op1, 0, op1); DONE; }}")(define_insn "*movdi_insn" [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m") (match_operand:DI 1 "general_operand" "r,g,rM"))] "register_operand (operands[0], DImode) || register_operand (operands[1], DImode) || operands[1] == const0_rtx" "#")(define_split [(set (match_operand:DI 0 "nonimmediate_operand" "") (match_operand:DI 1 "general_operand" ""))] "reload_completed" [(match_dup 2)] "operands[2] = cris_split_movdx (operands);");; Side-effect patterns for move.S1 [rx=ry+rx.S2],rw;; and move.S1 [rx=ry+i],rz;; Then movs.S1 and movu.S1 for both modes.;;;; move.S1 [rx=ry+rz.S],rw avoiding when rx is ry, or rw is rx;; FIXME: These could have anonymous mode for operand 0.;; QImode(define_insn "*mov_sideqi_biap" [(set (match_operand:QI 0 "register_operand" "=r,r") (mem:QI (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r,r") (match_operand:SI 2 "const_int_operand" "n,n")) (match_operand:SI 3 "register_operand" "r,r")))) (set (match_operand:SI 4 "register_operand" "=*3,r") (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))] "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)" "@ # move.%s0 [%4=%3+%1%T2],%0");; HImode(define_insn "*mov_sidehi_biap" [(set (match_operand:HI 0 "register_operand" "=r,r") (mem:HI (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r,r") (match_operand:SI 2 "const_int_operand" "n,n")) (match_operand:SI 3 "register_operand" "r,r")))) (set (match_operand:SI 4 "register_operand" "=*3,r") (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))] "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)" "@ # move.%s0 [%4=%3+%1%T2],%0");; SImode(define_insn "*mov_sidesi_biap" [(set (match_operand:SI 0 "register_operand" "=r,r") (mem:SI (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "r,r") (match_operand:SI 2 "const_int_operand" "n,n")) (match_operand:SI 3 "register_operand" "r,r")))) (set (match_operand:SI 4 "register_operand" "=*3,r") (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))] "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)" "@ # move.%s0 [%4=%3+%1%T2],%0");; move.S1 [rx=ry+i],rz;; avoiding move.S1 [ry=ry+i],rz;; and move.S1 [rz=ry+i],rz;; Note that "i" is allowed to be a register.;; FIXME: These could have anonymous mode for operand 0.;; QImode(define_insn "*mov_sideqi" [(set (match_operand:QI 0 "register_operand" "=r,r,r") (mem:QI (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,r,r") (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn")))) (set (match_operand:SI 3 "register_operand" "=*1,r,r") (plus:SI (match_dup 1) (match_dup 2)))] "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)" "*{ if (which_alternative == 0 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return \"#\"; return \"move.%s0 [%3=%1%S2],%0\";}");; HImode(define_insn "*mov_sidehi" [(set (match_operand:HI 0 "register_operand" "=r,r,r") (mem:HI (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,r,r") (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn")))) (set (match_operand:SI 3 "register_operand" "=*1,r,r") (plus:SI (match_dup 1) (match_dup 2)))] "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)" "*{ if (which_alternative == 0 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return \"#\"; return \"move.%s0 [%3=%1%S2],%0\";}");; SImode(define_insn "*mov_sidesi" [(set (match_operand:SI 0 "register_operand" "=r,r,r") (mem:SI (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,r,r") (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn")))) (set (match_operand:SI 3 "register_operand" "=*1,r,r") (plus:SI (match_dup 1) (match_dup 2)))] "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)" "*{ if (which_alternative == 0 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return \"#\"; return \"move.%s0 [%3=%1%S2],%0\";}");; Other way around; move to memory.;; Note that the condition (which for side-effect patterns is usually a;; call to cris_side_effect_mode_ok), isn't consulted for register;; allocation preferences -- constraints is the method for that. The;; drawback is that we can't exclude register allocation to cause;; "move.s rw,[rx=ry+rz.S]" when rw==rx without also excluding rx==ry or;; rx==rz if we use an earlyclobber modifier for the constraint for rx.;; Instead of that, we recognize and split the cases where dangerous;; register combinations are spotted: where a register is set in the;; side-effect, and used in the main insn. We don't handle the case where;; the set in the main insn overlaps the set in the side-effect; that case;; must be handled in gcc. We handle just the case where the set in the;; side-effect overlaps the input operand of the main insn (i.e. just;; moves to memory).;;;; move.s rz,[ry=rx+rw.S];; FIXME: These could have anonymous mode for operand 3.;; QImode(define_insn "*mov_sideqi_biap_mem" [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "r,r,r") (match_operand:SI 1 "const_int_operand" "n,n,n")) (match_operand:SI 2 "register_operand" "r,r,r"))) (match_operand:QI 3 "register_operand" "r,r,r")) (set (match_operand:SI 4 "register_operand" "=*2,!3,r") (plus:SI (mult:SI (match_dup 0) (match_dup 1)) (match_dup 2)))] "cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)" "@ # # move.%s3 %3,[%4=%2+%0%T1]");; HImode(define_insn "*mov_sidehi_biap_mem" [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "r,r,r") (match_operand:SI 1 "const_int_operand" "n,n,n")) (match_operand:SI 2 "register_operand" "r,r,r"))) (match_operand:HI 3 "register_operand" "r,r,r")) (set (match_operand:SI 4 "register_operand" "=*2,!3,r") (plus:SI (mult:SI (match_dup 0) (match_dup 1)) (match_dup 2)))] "cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)" "@ # # move.%s3 %3,[%4=%2+%0%T1]");; SImode(define_insn "*mov_sidesi_biap_mem" [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "r,r,r") (match_operand:SI 1 "const_int_operand" "n,n,n")) (match_operand:SI 2 "register_operand" "r,r,r"))) (match_operand:SI 3 "register_operand" "r,r,r")) (set (match_operand:SI 4 "register_operand" "=*2,!3,r") (plus:SI (mult:SI (match_dup 0) (match_dup 1)) (match_dup 2)))] "cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)" "@ # # move.%s3 %3,[%4=%2+%0%T1]");; Split for the case above where we're out of luck with register;; allocation (again, the condition isn't checked for that), and we end up;; with the set in the side-effect getting the same register as the input;; register.(define_split [(parallel [(set (match_operator 6 "cris_mem_op" [(plus:SI (mult:SI (match_operand:SI 0 "register_operand" "") (match_operand:SI 1 "const_int_operand" "")) (match_operand:SI 2 "register_operand" ""))]) (match_operand 3 "register_operand" "")) (set (match_operand:SI 4 "register_operand" "") (plus:SI (mult:SI (match_dup 0) (match_dup 1)) (match_dup 2)))])] "reload_completed && reg_overlap_mentioned_p (operands[4], operands[3])" [(set (match_dup 5) (match_dup 3)) (set (match_dup 4) (match_dup 2)) (set (match_dup 4) (plus:SI (mult:SI (match_dup 0) (match_dup 1)) (match_dup 4)))] "operands[5] = replace_equiv_address (operands[6], gen_rtx_PLUS (SImode, gen_rtx_MULT (SImode, operands[0], operands[1]), operands[2]));");; move.s rx,[ry=rz+i];; FIXME: These could have anonymous mode for operand 2.;; QImode(define_insn "*mov_sideqi_mem" [(set (mem:QI (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,r") (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn"))) (match_operand:QI 2 "register_operand" "r,r,r,r")) (set (match_operand:SI 3 "register_operand" "=*0,!2,r,r") (plus:SI (match_dup 0) (match_dup 1)))] "cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)" "*{ if (which_alternative == 0 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return \"#\"; if (which_alternative == 1) return \"#\"; return \"move.%s2 %2,[%3=%0%S1]\";}");; HImode(define_insn "*mov_sidehi_mem" [(set (mem:HI (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,r") (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn"))) (match_operand:HI 2 "register_operand" "r,r,r,r")) (set (match_operand:SI 3 "register_operand" "=*0,!2,r,r") (plus:SI (match_dup 0) (match_dup 1)))] "cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)" "*{ if (which_alternative == 0 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return \"#\"; if (which_alternative == 1) return \"#\"; return \"move.%s2 %2,[%3=%0%S1]\";}");; SImode(define_insn "*mov_sidesi_mem" [(set (mem:SI (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,r") (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn"))) (match_operand:SI 2 "register_operand" "r,r,r,r")) (set (match_operand:SI 3 "register_operand" "=*0,!2,r,r") (plus:SI (match_dup 0) (match_dup 1)))] "cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)" "*{ if (which_alternative == 0 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return \"#\"; if (which_alternative == 1) return \"#\"; return \"move.%s2 %2,[%3=%0%S1]\";}");; Like the biap case, a split where the set in the side-effect gets the;; same register as the input register to the main insn, since the;; condition isn't checked at register allocation.(define_split [(parallel [(set (match_operator 4 "cris_mem_op" [(plus:SI (match_operand:SI 0 "cris_bdap_operand" "") (match_operand:SI 1 "cris_bdap_operand" ""))]) (match_operand 2 "register_operand" "")) (set (match_operand:SI 3 "register_operand" "") (plus:SI (match_dup 0) (match_dup 1)))])] "reload_completed && reg_overlap_mentioned_p (operands[3], operands[2])" [(set (match_dup 4) (match_dup 2)) (set (match_dup 3) (match_dup 0)) (set (match_dup 3) (plus:SI (match_dup 3) (match_dup 1)))] "");; Clear memory side-effect patterns. It is hard to get to the mode if;; the MEM was anonymous, so there will be one for each mode.;; clear.d [ry=rx+rw.s2](define_insn "*clear_sidesi_biap" [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "r,r") (match_operand:SI 1 "const_int_operand" "n,n")) (match_operand:SI 2 "register_operand" "r,r"))) (const_int 0)) (set (match_operand:SI 3 "register_operand" "=*2,r") (plus:SI (mult:SI (match_dup 0) (match_dup 1)) (match_dup 2)))] "cris_side_effect_mode_ok (MULT, operands, 3, 2, 0, 1, -1)" "@ # clear.d [%3=%2+%0%T1]");; clear.d [ry=rz+i](define_insn "*clear_sidesi" [(set (mem:SI (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r") (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn"))) (const_int 0)) (set (match_operand:SI 2 "register_operand" "=*0,r,r") (plus:SI (match_dup 0) (match_dup 1)))] "cris_side_effect_mode_ok (PLUS, operands, 2, 0, 1, -1, -1)" "*{ if (which_alternative == 0 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return \"#\"; return \"clear.d [%2=%0%S1]\";}");; clear.w [ry=rx+rw.s2](define_insn "*clear_sidehi_biap"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -