📄 ip2k.md
字号:
"" "#" "ip2k_reorg_split_dimode" [(set (match_dup 2) (match_dup 3)) (set (match_dup 4) (match_dup 5))] "{ ip2k_split_words (SImode, DImode, operands); /* Split into 2=3,4=5 */ }");;;; Move 32-bit floating point values.;;(define_expand "movsf" [(set (match_operand:SF 0 "" "") (match_operand:SF 1 "" ""))] "" "if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) operands[1] = copy_to_mode_reg (SFmode, operands[1]); ")(define_insn_and_split "*movsf" [(set (match_operand:SF 0 "ip2k_split_dest_operand" "=r<, o") (match_operand:SF 1 "general_operand" "roi,ri"))] "(ip2k_short_operand (operands[0], SFmode) && ip2k_short_operand (operands[1], SFmode)) || ! (memory_operand (operands[0], SFmode) && memory_operand (operands[1], SFmode))" "#" "(reload_completed || reload_in_progress)" [(set (match_dup 2) (match_dup 3)) (set (match_dup 4) (match_dup 5)) (set (match_dup 6) (match_dup 7)) (set (match_dup 8) (match_dup 9))] "{ /* Split into 2=3,4=5 */ ip2k_split_words (HImode, SImode, operands); /* Split 4=5 into 6=7,8=9 */ ip2k_split_words (QImode, HImode, &operands[4]); operands[0] = operands[2]; operands[1] = operands[3]; ip2k_split_words (QImode, HImode, operands); }");;;; Move 64-bit floating point values.;;;;;; Block move operations.;;;; Copy a block of bytes (memcpy()). We expand the definition to convert;; our memory operand into a register pointer operand instead.;;(define_expand "movstrhi" [(use (match_operand:BLK 0 "memory_operand" "")) (use (match_operand:BLK 1 "memory_operand" "")) (use (match_operand:HI 2 "general_operand" "")) (use (match_operand 3 "const_int_operand" ""))] "" "{ rtx addr0, addr1, count; addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); if (GET_CODE (operands[2]) == CONST_INT) count = gen_int_mode (INTVAL (operands[2]) & 0xffff, HImode); else count = operands[2]; emit_insn (gen_movstrhi_expanded (addr0, count, addr1)); DONE; }");; Block copy instruction. We handle this by calling one of two functions in;; libgcc. The first of these is a special case (faster) routine that handles;; constant block sizes under 256 bytes. This one is particularly common;; because we use it when copying data structures. The second routine handles;; the general case where we have either a variable block size or one that is;; greater than 255 bytes.;;(define_insn "movstrhi_expanded" [(set (mem:BLK (match_operand:HI 0 "nonimmediate_operand" "rS,ro,rS, rS, ro, rS")) (mem:BLK (match_operand:HI 2 "nonimmediate_operand" "ro,rS,rS, ro, rS, rS"))) (use (match_operand:HI 1 "general_operand" "P, P, P,rSi,rSi,roi"))] "" "@ push\\t%L1%<\;push\\t%L2%<\;push\\t%H2%<\;push\\t%L0%<\;push\\t%H0%>%>%>%>\;page\\t__movstrhi_countqi\;call\\t__movstrhi_countqi push\\t%L1%<\;push\\t%L2%<\;push\\t%H2%<\;push\\t%L0%<\;push\\t%H0%>%>%>%>\;page\\t__movstrhi_countqi\;call\\t__movstrhi_countqi push\\t%L1%<\;push\\t%L2%<\;push\\t%H2%<\;push\\t%L0%<\;push\\t%H0%>%>%>%>\;page\\t__movstrhi_countqi\;call\\t__movstrhi_countqi push\\t%L1%<\;push\\t%H1%<\;push\\t%L2%<\;push\\t%H2%<\;push\\t%L0%<\;push\\t%H0%>%>%>%>%>\;page\\t__movstrhi_counthi\;call\\t__movstrhi_counthi push\\t%L1%<\;push\\t%H1%<\;push\\t%L2%<\;push\\t%H2%<\;push\\t%L0%<\;push\\t%H0%>%>%>%>%>\;page\\t__movstrhi_counthi\;call\\t__movstrhi_counthi push\\t%L1%<\;push\\t%H1%<\;push\\t%L2%<\;push\\t%H2%<\;push\\t%L0%<\;push\\t%H0%>%>%>%>%>\;page\\t__movstrhi_counthi\;call\\t__movstrhi_counthi");; Bit insert;;(define_expand "insv" [(set (zero_extract:QI (match_operand:QI 0 "nonimmediate_operand" "") (match_operand 1 "immediate_operand" "") ;size (match_operand 2 "immediate_operand" "")) ;pos (match_operand:QI 3 "general_operand" ""))] "" "{ if (! CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J') || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')) FAIL; }")(define_insn "*insv" [(set (zero_extract:QI (match_operand:QI 0 "nonimmediate_operand" "+roR,roR,roR,roR,&roR,&roR,&r") (match_operand 1 "immediate_operand" "N, N, J, J, N, J, J") ;sz (match_operand 2 "immediate_operand" "J, J, J, J, J, J, J"));pos (match_operand:QI 3 "general_operand" "MN, O, M, O, roR, rn,oR"))] "" "*{ unsigned int pos = INTVAL (operands[2]), siz = INTVAL (operands[1]), mask = (1 << (pos + siz)) - (1 << pos); switch (which_alternative) { case 0: return \"setb\\t%0,%b1\"; case 1: return \"clrb\\t%0,%b1\"; case 2: operands[3] = gen_int_mode (mask & 0xff, QImode); return AS2 (mov, w, %3) CR_TAB AS2 (or, %0, w); case 3: operands[3] = gen_int_mode (0xff & ~mask, QImode); return AS2 (mov, w, %3) CR_TAB AS2 (and, %0, w); case 4: return AS2 (clrb, %0,%b2) CR_TAB AS2 (snb, %3, 0) CR_TAB AS2 (setb, %0, %b2); case 5: case 6: { static char buff[256]; char *p = buff; /* Clear the destination field */ p += sprintf (buff, \"mov\\tw,#$%2.2x\;and\\t%%0,w\;\", 0xff & ~mask); if (CONSTANT_P (operands[3])) /* Constant can just be or-ed in. */ { p += sprintf (p, \"mov\\tw,#$%2.2x\;or\\t%%0,w\", (INTVAL (operands[3]) << pos) & mask & 0xff); return buff; } p += sprintf (p, \"mov\\tw,%%3\;\"); /* Value to deposit */ /* Shift and mask the value before OR-ing into the destination. */ if (pos != 0) p += sprintf (p, \"mulu\\tw,#%d\;\", 1<<pos); p += sprintf (p, \"\;and\\tw,#$%2.2x\;or\\t%%0,w\", mask); return buff; } default: abort (); } }" [(set_attr "skip" "yes,yes,no,no,no,no,no") (set_attr "clobberw" "no,no,yes,yes,no,yes,yes")]);;;; Add bytes;;(define_expand "addqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (plus:QI (match_operand:QI 1 "general_operand" "") (match_operand:QI 2 "general_operand" "")))] "" "")(define_insn "*push_addqi3" [(set (match_operand:QI 0 "push_operand" "=<,<,<") (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%g,g,g") (match_operand:QI 2 "general_operand" "N,M,g")))] "" "@ push\\t%1\;inc\\t1(SP) push\\t%1\;dec\\t1(SP) mov\\tw,%2\;add\\tw,%1\;push\\twreg" [(set_attr "clobberw" "no,no,yes")])(define_insn "*addqi3_w" [(set (reg:QI 10) (plus:QI (match_operand:QI 0 "nonimmediate_operand" "%rS, g,rS, g, rS, g,rS") (match_operand:QI 1 "general_operand" "N, N, M, M,rSi,rSi, g")))] "(ip2k_reorg_split_qimode)" "@ inc\\tw,%0 inc\\tw,%0 dec\\tw,%0 dec\\tw,%0 mov\\tw,%1\;add\\tw,%0 mov\\tw,%1\;add\\tw,%0 mov\\tw,%1\;add\\tw,%0" [(set_attr "skip" "no,no,no,no,no,no,no")])(define_insn_and_split "*addqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "=k,k,z,z,djyoR,djyoR,djyoR,djyS, g,rS, g,rS, g, rS,rS") (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,0, 0, 0, 0, 0,rS, g,rS, g, rS, g,rS") (match_operand:QI 2 "general_operand" "N,g,N,g, N, M, rSi, g, N, N, M, M,rSi,rSi, g")))] "" "@ incsnz\\t%0\;dec\\tiph mov\\tw,%2\;add\\t%0,w incsnz\\t%0\;dec\\tdph mov\\tw,%2\;add\\t%0,w inc\\t%0 dec\\t%0 mov\\tw,%2\;add\\t%0,w mov\\tw,%2\;add\\t%0,w # # # # # # #" "(ip2k_reorg_split_qimode && ! rtx_equal_p (operands[0], operands[1]))" [(set (reg:QI 10) (plus:QI (match_dup 1) (match_dup 2))) (set (match_dup 0) (reg:QI 10))] "" [(set_attr "skip" "no,no,no,no,yes,yes,no,no,no,no,no,no,no,no,no") (set_attr "clobberw" "no,yes,no,yes,no,no,yes,yes,yes,yes,yes,yes,yes,yes,yes")]);;;; Add 16-bit integers.;;(define_expand "addhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (plus:HI (match_operand:HI 1 "general_operand" "") (match_operand:HI 2 "general_operand" "")))] "" "if (rtx_equal_p (operands[1], operands[2])) { /* It is not impossible to wind up with two constants here. If we simply emit the ashl, we'll generate unrecognizable instructions. */ if (! nonimmediate_operand (operands[1], HImode)) operands[1] = copy_to_mode_reg (HImode, operands[1]); emit_insn (gen_ashlhi3 (operands[0], operands[1], GEN_INT (1))); DONE; } ")(define_insn "*push_addhi3" ; 0 1 2 3 4 5 6 7 [(set (match_operand:HI 0 "push_operand" "=<,<, <, <, <, <,<,<") (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%uo,q,uo,bf, uo, uS,q,q") (match_operand:HI 2 "general_operand" "N,N, M, P,uSi,uoi,u,n")))] "" "*{ switch (which_alternative) { case 0: return AS1 (push, %L1%<) CR_TAB AS1 (push, %H1%>) CR_TAB AS1 (incsnz, 2(SP)) CR_TAB AS1 (inc, 1(SP)); case 1: return AS2 (mov, w, %H1) CR_TAB AS1 (push, %L1) CR_TAB AS1 (push, wreg) CR_TAB AS1 (incsnz, 2(SP)) CR_TAB AS1 (inc, 1(SP)); case 2: return AS1 (push, %L1%<) CR_TAB AS1 (push, %H1%>) CR_TAB AS2 (mov, w, #-1) CR_TAB AS2 (add, 2(SP), w) CR_TAB AS2 (addc, 1(SP), w); case 3: OUT_AS2 (mov, w, %L2); OUT_AS2 (add, %L1, w); OUT_AS1 (push, %L1); OUT_AS1 (push, %H1); if (!find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) OUT_AS2 (sub, %L1, w); return \"\"; case 4: case 5: return AS2 (mov, w, %L2) CR_TAB AS2 (add, w, %L1) CR_TAB AS1 (push, wreg%<) CR_TAB AS2 (mov, w, %H2) CR_TAB AS2 (addc, w, %H1) CR_TAB AS1 (push, wreg%>); case 6: return AS2 (mov, w, %H1) CR_TAB AS1 (push, %L1) CR_TAB AS1 (push, wreg) CR_TAB AS2 (mov, w, %L2) CR_TAB AS2 (add, 2(SP), w) CR_TAB AS2 (mov, w, %H2) CR_TAB AS2 (addc, 1(SP), w); case 7: { operands[3] = GEN_INT (INTVAL (operands[2]) + 2); return AS1 (push, %L3) CR_TAB AS1 (push, %H3) CR_TAB AS2 (mov, w, %L1) CR_TAB AS2 (add, 2(SP), w) CR_TAB AS2 (mov, w, %H1) CR_TAB AS2 (addc, 1(SP), w); } default: abort (); } }" [(set_attr "clobberw" "no,yes,yes,yes,yes,yes,yes,yes")])(define_insn "*push_addhi3_zero_ext" ; 0 1 2 3 [(set (match_operand:HI 0 "push_operand" "=<, <, <, <") (plus:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%roRi,roRi,roRi,rSi")) (match_operand:HI 2 "general_operand" "N, P, rSi,roi")))] "" "@ inc\\tw,%L2\;push\\twreg\;push\\t#0\;rl\\t1(SP) mov\\tw,%L2\;add\\tw,%1\;push\\twreg\;push\\t#0\;rl\\t1(SP) mov\\tw,%L2\;add\\tw,%1\;push\\twreg%<\;mov\\tw,%H2\;addc\\tw,$ff\;push\\twreg%> mov\\tw,%L2\;add\\tw,%1\;push\\twreg%<\;mov\\tw,%H2\;addc\\tw,$ff\;push\\twreg%>")(define_insn "*addhi3_imm_zero_ext_w" [(set (match_operand:HI 0 "nonimmediate_operand" "=rS,o,a,b,a,a,rS,o,rS,o") (plus:HI (zero_extend:HI (reg:QI 10)) (match_operand 1 "immediate_operand" "O,O,M,i,P,I, P,P, i,i")))] "" "@ mov\\t%L0,w\;clr\\t%H0 mov\\t%L0,w\;clr\\t%H0 mov\\t%L0,w\;clr\\t%H0\;dec\\t%L0 loadh\\t%x1\;loadl\\t%x1\;add\\t%L0,w mov\\t%L0,w\;clr\\t%H0\;mov\\tw,%1\;add\\t%L0,w mov\\t%L0,w\;clr\\t%H0\;mov\\tw,#%n1\;sub\\t%L0,w add\\tw,%L1\;mov\\t%L0,w\;clr\\t%H0\;rl\\t%H0 add\\tw,%L1\;mov\\t%L0,w\;clr\\t%H0\;rl\\t%H0 add\\tw,%L1\;mov\\t%L0,w\;clr\\t%H0\;mov\\tw,%H1\;addc\\t%H0,w add\\tw,%L1\;mov\\t%L0,w\;clr\\t%H0\;mov\\tw,%H1\;addc\\t%H0,w")(define_insn_and_split "*addhi3_imm_zero_ext" [(set (match_operand:HI 0 "nonimmediate_operand" "=rS, o, rS, o, a, b, a, a, rS, o, rS, o") (plus:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%roR,rS,roR,rS,roR,roR,roR,roR,roR,rS,roR,rS")) (match_operand 2 "immediate_operand" " O, O, N, N, M, i, P, I, P, P, i, i")))] "" "@ # # clr\\t%H0\;incsnz\\tw,%1\;inc\\t%H0\;mov\\t%L0,w clr\\t%H0\;incsnz\\tw,%1\;inc\\t%H0\;mov\\t%L0,w # # #
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -