📄 m68k.md
字号:
(match_operand:DI 1 "general_operand" ""))) (clobber (match_dup 2))])] "" "operands[2] = gen_reg_rtx (DImode);")(define_insn "" [(set (cc0) (compare (match_operand:DI 1 "nonimmediate_operand" "0,d") (match_operand:DI 2 "general_operand" "d,0"))) (clobber (match_operand:DI 0 "register_operand" "=d,d"))] "" "*{ if (rtx_equal_p (operands[0], operands[1])) return \"sub%.l %R2,%R0\;subx%.l %2,%0\"; else { cc_status.flags |= CC_REVERSED; return \"sub%.l %R1,%R0\;subx%.l %1,%0\"; }}");; This is the second "hook" for PIC code (in addition to movsi). See;; comment of movsi for a description of PIC handling.(define_expand "cmpsi" [(set (cc0) (compare (match_operand:SI 0 "nonimmediate_operand" "") (match_operand:SI 1 "general_operand" "")))] "" "{ if (flag_pic && symbolic_operand (operands[1], SImode)) { /* The source is an address which requires PIC relocation. Call legitimize_pic_address with the source, mode, and a relocation register (a new pseudo, or the final destination if reload_in_progress is set). Then fall through normally */ extern rtx legitimize_pic_address(); rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode); operands[1] = legitimize_pic_address (operands[1], SImode, temp); }}");; A composite of the cmp, cmpa, & cmpi m68000 op codes.(define_insn "" [(set (cc0) (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>") (match_operand:SI 1 "general_operand" "mr,Ksr,>")))] "" "*{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)#ifdef SGS_CMP_ORDER return \"cmpm%.l %0,%1\";#else return \"cmpm%.l %1,%0\";#endif if (REG_P (operands[1]) || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM)) { cc_status.flags |= CC_REVERSED;#ifdef SGS_CMP_ORDER return \"cmp%.l %d1,%d0\";#else return \"cmp%.l %d0,%d1\";#endif }#ifdef SGS_CMP_ORDER return \"cmp%.l %d0,%d1\";#else return \"cmp%.l %d1,%d0\";#endif}")(define_insn "cmphi" [(set (cc0) (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m,>") (match_operand:HI 1 "general_operand" "d,rnm,m,n,>")))] "" "*{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)#ifdef SGS_CMP_ORDER return \"cmpm%.w %0,%1\";#else return \"cmpm%.w %1,%0\";#endif if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1])) || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM)) { cc_status.flags |= CC_REVERSED;#ifdef SGS_CMP_ORDER return \"cmp%.w %d1,%d0\";#else return \"cmp%.w %d0,%d1\";#endif }#ifdef SGS_CMP_ORDER return \"cmp%.w %d0,%d1\";#else return \"cmp%.w %d1,%d0\";#endif}")(define_insn "cmpqi" [(set (cc0) (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>") (match_operand:QI 1 "general_operand" "dm,nd,>")))] "" "*{ if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)#ifdef SGS_CMP_ORDER return \"cmpm%.b %0,%1\";#else return \"cmpm%.b %1,%0\";#endif if (REG_P (operands[1]) || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM)) { cc_status.flags |= CC_REVERSED;#ifdef SGS_CMP_ORDER return \"cmp%.b %d1,%d0\";#else return \"cmp%.b %d0,%d1\";#endif }#ifdef SGS_CMP_ORDER return \"cmp%.b %d0,%d1\";#else return \"cmp%.b %d1,%d0\";#endif}")(define_expand "cmpdf" [(set (cc0) (compare (match_operand:DF 0 "general_operand" "") (match_operand:DF 1 "general_operand" "")))] "TARGET_68881 || TARGET_FPA" "{ if (TARGET_FPA) { emit_insn (gen_cmpdf_fpa (operands[0], operands[1])); DONE; }}")(define_insn "cmpdf_fpa" [(set (cc0) (compare (match_operand:DF 0 "general_operand" "x,y") (match_operand:DF 1 "general_operand" "xH,rmF"))) (clobber (match_scratch:SI 2 "=d,d"))] "TARGET_FPA" "fpcmp%.d %y1,%0\;fpmove fpastatus,%2\;movw %2,cc")(define_insn "" [(set (cc0) (compare (match_operand:DF 0 "general_operand" "f,mG") (match_operand:DF 1 "general_operand" "fmG,f")))] "TARGET_68881" "*{ cc_status.flags = CC_IN_68881;#ifdef SGS_CMP_ORDER if (REG_P (operands[0])) { if (REG_P (operands[1])) return \"fcmp%.x %0,%1\"; else return \"fcmp%.d %0,%f1\"; } cc_status.flags |= CC_REVERSED; return \"fcmp%.d %1,%f0\";#else if (REG_P (operands[0])) { if (REG_P (operands[1])) return \"fcmp%.x %1,%0\"; else return \"fcmp%.d %f1,%0\"; } cc_status.flags |= CC_REVERSED; return \"fcmp%.d %f0,%1\";#endif}")(define_expand "cmpsf" [(set (cc0) (compare (match_operand:SF 0 "general_operand" "") (match_operand:SF 1 "general_operand" "")))] "TARGET_68881 || TARGET_FPA" "{ if (TARGET_FPA) { emit_insn (gen_cmpsf_fpa (operands[0], operands[1])); DONE; }}")(define_insn "cmpsf_fpa" [(set (cc0) (compare (match_operand:SF 0 "general_operand" "x,y") (match_operand:SF 1 "general_operand" "xH,rmF"))) (clobber (match_scratch:SI 2 "=d,d"))] "TARGET_FPA" "fpcmp%.s %w1,%x0\;fpmove fpastatus,%2\;movw %2,cc")(define_insn "" [(set (cc0) (compare (match_operand:SF 0 "general_operand" "f,mdG") (match_operand:SF 1 "general_operand" "fmdG,f")))] "TARGET_68881" "*{ cc_status.flags = CC_IN_68881;#ifdef SGS_CMP_ORDER if (FP_REG_P (operands[0])) { if (FP_REG_P (operands[1])) return \"fcmp%.x %0,%1\"; else return \"fcmp%.s %0,%f1\"; } cc_status.flags |= CC_REVERSED; return \"fcmp%.s %1,%f0\";#else if (FP_REG_P (operands[0])) { if (FP_REG_P (operands[1])) return \"fcmp%.x %1,%0\"; else return \"fcmp%.s %f1,%0\"; } cc_status.flags |= CC_REVERSED; return \"fcmp%.s %f0,%1\";#endif}");; Recognizers for btst instructions.(define_insn "" [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do") (const_int 1) (minus:SI (const_int 7) (match_operand:SI 1 "general_operand" "di"))))] "" "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")(define_insn "" [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d") (const_int 1) (minus:SI (const_int 31) (match_operand:SI 1 "general_operand" "di"))))] "" "* { return output_btst (operands, operands[1], operands[0], insn, 31); }");; The following two patterns are like the previous two;; except that they use the fact that bit-number operands;; are automatically masked to 3 or 5 bits.(define_insn "" [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do") (const_int 1) (minus:SI (const_int 7) (and:SI (match_operand:SI 1 "register_operand" "d") (const_int 7)))))] "" "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")(define_insn "" [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d") (const_int 1) (minus:SI (const_int 31) (and:SI (match_operand:SI 1 "register_operand" "d") (const_int 31)))))] "" "* { return output_btst (operands, operands[1], operands[0], insn, 31); }");; Nonoffsettable mem refs are ok in this one pattern;; since we don't try to adjust them.(define_insn "" [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "md") (const_int 1) (match_operand:SI 1 "const_int_operand" "n")))] "(unsigned) INTVAL (operands[1]) < 8" "*{ operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1])); return output_btst (operands, operands[1], operands[0], insn, 7);}")(define_insn "" [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "do") (const_int 1) (match_operand:SI 1 "const_int_operand" "n")))] "" "*{ if (GET_CODE (operands[0]) == MEM) { operands[0] = adj_offsettable_operand (operands[0], INTVAL (operands[1]) / 8); operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]) % 8); return output_btst (operands, operands[1], operands[0], insn, 7); } operands[1] = gen_rtx (CONST_INT, VOIDmode, 31 - INTVAL (operands[1])); return output_btst (operands, operands[1], operands[0], insn, 31);}");; move instructions;; A special case in which it is not desirable;; to reload the constant into a data register.(define_insn "" [(set (match_operand:SI 0 "push_operand" "=m") (match_operand:SI 1 "const_int_operand" "J"))] "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000" "*{ if (operands[1] == const0_rtx) return \"clr%.l %0\"; return \"pea %a1\";}");This is never used.;(define_insn "swapsi"; [(set (match_operand:SI 0 "general_operand" "+r"); (match_operand:SI 1 "general_operand" "+r")); (set (match_dup 1) (match_dup 0))]; ""; "exg %1,%0");; Special case of fullword move when source is zero.;; The reason this is special is to avoid loading a zero;; into a data reg with moveq in order to store it elsewhere. (define_insn "" [(set (match_operand:SI 0 "general_operand" "=g") (const_int 0))] ;; clr insns on 68000 read before writing. ;; This isn't so on the 68010, but we have no alternative for it. "(TARGET_68020 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))" "*{ if (ADDRESS_REG_P (operands[0])) return \"sub%.l %0,%0\"; /* moveq is faster on the 68000. */ if (DATA_REG_P (operands[0]) && !TARGET_68020)#if defined(MOTOROLA) && !defined(CRDS) return \"moveq%.l %#0,%0\";#else return \"moveq %#0,%0\";#endif return \"clr%.l %0\";}");; General case of fullword move. ;;;; This is the main "hook" for PIC code. When generating;; PIC, movsi is responsible for determining when the source address;; needs PIC relocation and appropriately calling legitimize_pic_address;; to perform the actual relocation.;;;; In both the PIC and non-PIC cases the patterns generated will;; matched by the next define_insn. (define_expand "movsi" [(set (match_operand:SI 0 "general_operand" "") (match_operand:SI 1 "general_operand" ""))] "" "{ if (flag_pic && symbolic_operand (operands[1], SImode)) { /* The source is an address which requires PIC relocation. Call legitimize_pic_address with the source, mode, and a relocation register (a new pseudo, or the final destination if reload_in_progress is set). Then fall through normally */ extern rtx legitimize_pic_address(); rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode); operands[1] = legitimize_pic_address (operands[1], SImode, temp); }}");; General case of fullword move. The register constraints;; force integer constants in range for a moveq to be reloaded;; if they are headed for memory.(define_insn "" ;; Notes: make sure no alternative allows g vs g. ;; We don't allow f-regs since fixed point cannot go in them. ;; We do allow y and x regs since fixed point is allowed in them. [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m") (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))] "" "*{ if (which_alternative == 3) return \"fpmove%.l %x1,fpa0\;fpmove%.l fpa0,%x0\"; if (FPA_REG_P (operands[1]) || FPA_REG_P (operands[0])) return \"fpmove%.l %x1,%x0\"; if (GET_CODE (operands[1]) == CONST_INT) { if (operands[1] == const0_rtx && (DATA_REG_P (operands[0]) || GET_CODE (operands[0]) == MEM) /* clr insns on 68000 read before writing.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -