⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m68k.md

📁 早期freebsd实现
💻 MD
📖 第 1 页 / 共 5 页
字号:
{  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)    return \"cmpm%.w %1,%0\";  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)    return \"cmpm%.b %1,%0\";  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 "general_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 "general_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 "general_operand" "i")))]  "GET_CODE (operands[1]) == CONST_INT   && (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 "general_operand" "i")))]  "GET_CODE (operands[1]) == CONST_INT"  "*{  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 "general_operand" "J"))]  "GET_CODE (operands[1]) == CONST_INT   && 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.	     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]))))	return \"clr%.l %0\";      else if (DATA_REG_P (operands[0])	       && INTVAL (operands[1]) < 128	       && INTVAL (operands[1]) >= -128)        {#if defined(MOTOROLA) && !defined(CRDS)          return \"moveq%.l %1,%0\";#else	  return \"moveq %1,%0\";#endif	}#ifndef NO_ADDSUB_Q      else if (DATA_REG_P (operands[0])	       /* Do this with a moveq #N-8, dreg; addq #8,dreg */	       && INTVAL (operands[1]) < 136	       && INTVAL (operands[1]) >= 128)        {	  operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) - 8);#if defined(MOTOROLA) && !defined(CRDS)          return \"moveq%.l %1,%0\;addq%.w %#8,%0\";#else	  return \"moveq %1,%0\;addq%.w %#8,%0\";#endif	}      else if (DATA_REG_P (operands[0])	       /* Do this with a moveq #N+8, dreg; subq #8,dreg */	       && INTVAL (operands[1]) < -128	       && INTVAL (operands[1]) >= -136)        {	  operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) + 8);#if defined(MOTOROLA) && !defined(CRDS)          return \"moveq%.l %1,%0;subq%.w %#8,%0\";#else	  return \"moveq %1,%0;subq%.w %#8,%0\";#endif	}#endif      else if (DATA_REG_P (operands[0])	       /* If N is in the right range and is even, then use	          moveq #N/2, dreg; addl dreg,dreg */	       && INTVAL (operands[1]) > 127	       && INTVAL (operands[1]) <= 254	       && INTVAL (operands[1]) % 2 == 0)        {	  operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) / 2);#if defined(MOTOROLA) && !defined(CRDS)          return \"moveq%.l %1,%0\;add%.w %0,%0\";#else	  return \"moveq %1,%0\;add%.w %0,%0\";#endif	}      else if (ADDRESS_REG_P (operands[0])	       && INTVAL (operands[1]) < 0x8000	       && INTVAL (operands[1]) >= -0x8000)	return \"move%.w %1,%0\";      else if (push_operand (operands[0], SImode)	       && INTVAL (operands[1]) < 0x8000	       && INTVAL (operands[1]) >= -0x8000)        return \"pea %a1\";    }  else if ((GET_CODE (operands[1]) == SYMBOL_REF	    || GET_CODE (operands[1]) == CONST)	   && push_operand (operands[0], SImode))    return \"pea %a1\";  else if ((GET_CODE (operands[1]) == SYMBOL_REF	    || GET_CODE (operands[1]) == CONST)	   && ADDRESS_REG_P (operands[0]))    return \"lea %a1,%0\";  return \"move%.l %1,%0\";}")(define_insn "movhi"  [(set (match_operand:HI 0 "general_operand" "=g")	(match_operand:HI 1 "general_operand" "g"))]  ""  "*{  if (GET_CODE (operands[1]) == CONST_INT)    {      if (operands[1] == const0_rtx	  && (DATA_REG_P (operands[0])	      || GET_CODE (operands[0]) == MEM)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -