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

📄 sparc.md

📁 这是leon3处理器的交叉编译链
💻 MD
📖 第 1 页 / 共 5 页
字号:
  if (TARGET_V9)    return "fcmpd\t%0, %1, %2";  return "fcmpd\t%1, %2";}  [(set_attr "type" "fpcmp")   (set_attr "fptype" "double")])(define_insn "*cmptf_fp"  [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c")	(compare:CCFP (match_operand:TF 1 "register_operand" "e")		      (match_operand:TF 2 "register_operand" "e")))]  "TARGET_FPU && TARGET_HARD_QUAD"{  if (TARGET_V9)    return "fcmpq\t%0, %1, %2";  return "fcmpq\t%1, %2";}  [(set_attr "type" "fpcmp")]);; Next come the scc insns.  For seq, sne, sgeu, and sltu, we can do this;; without jumps using the addx/subx instructions.  For seq/sne on v9 we use;; the same code as v8 (the addx/subx method has more applications).  The;; exception to this is "reg != 0" which can be done in one instruction on v9;; (so we do it).  For the rest, on v9 we use conditional moves; on v8, we do;; branches.;; Seq_special[_xxx] and sne_special[_xxx] clobber the CC reg, because they;; generate addcc/subcc instructions.(define_expand "seqsi_special"  [(set (match_dup 3)	(xor:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "register_operand" "")))   (parallel [(set (match_operand:SI 0 "register_operand" "")		   (eq:SI (match_dup 3) (const_int 0)))	      (clobber (reg:CC 100))])]  ""  { operands[3] = gen_reg_rtx (SImode); })(define_expand "seqdi_special"  [(set (match_dup 3)	(xor:DI (match_operand:DI 1 "register_operand" "")		(match_operand:DI 2 "register_operand" "")))   (set (match_operand:DI 0 "register_operand" "")	(eq:DI (match_dup 3) (const_int 0)))]  "TARGET_ARCH64"  { operands[3] = gen_reg_rtx (DImode); })(define_expand "snesi_special"  [(set (match_dup 3)	(xor:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "register_operand" "")))   (parallel [(set (match_operand:SI 0 "register_operand" "")		   (ne:SI (match_dup 3) (const_int 0)))	      (clobber (reg:CC 100))])]  ""  { operands[3] = gen_reg_rtx (SImode); })(define_expand "snedi_special"  [(set (match_dup 3)	(xor:DI (match_operand:DI 1 "register_operand" "")		(match_operand:DI 2 "register_operand" "")))   (set (match_operand:DI 0 "register_operand" "")	(ne:DI (match_dup 3) (const_int 0)))]  "TARGET_ARCH64"  { operands[3] = gen_reg_rtx (DImode); })(define_expand "seqdi_special_trunc"  [(set (match_dup 3)	(xor:DI (match_operand:DI 1 "register_operand" "")		(match_operand:DI 2 "register_operand" "")))   (set (match_operand:SI 0 "register_operand" "")	(eq:SI (match_dup 3) (const_int 0)))]  "TARGET_ARCH64"  { operands[3] = gen_reg_rtx (DImode); })(define_expand "snedi_special_trunc"  [(set (match_dup 3)	(xor:DI (match_operand:DI 1 "register_operand" "")		(match_operand:DI 2 "register_operand" "")))   (set (match_operand:SI 0 "register_operand" "")	(ne:SI (match_dup 3) (const_int 0)))]  "TARGET_ARCH64"  { operands[3] = gen_reg_rtx (DImode); })(define_expand "seqsi_special_extend"  [(set (match_dup 3)	(xor:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "register_operand" "")))   (parallel [(set (match_operand:DI 0 "register_operand" "")		   (eq:DI (match_dup 3) (const_int 0)))	      (clobber (reg:CC 100))])]  "TARGET_ARCH64"  { operands[3] = gen_reg_rtx (SImode); })(define_expand "snesi_special_extend"  [(set (match_dup 3)	(xor:SI (match_operand:SI 1 "register_operand" "")		(match_operand:SI 2 "register_operand" "")))   (parallel [(set (match_operand:DI 0 "register_operand" "")		   (ne:DI (match_dup 3) (const_int 0)))	      (clobber (reg:CC 100))])]  "TARGET_ARCH64"  { operands[3] = gen_reg_rtx (SImode); });; ??? v9: Operand 0 needs a mode, so SImode was chosen.;; However, the code handles both SImode and DImode.(define_expand "seq"  [(set (match_operand:SI 0 "intreg_operand" "")	(eq:SI (match_dup 1) (const_int 0)))]  ""{  if (GET_MODE (sparc_compare_op0) == SImode)    {      rtx pat;      if (GET_MODE (operands[0]) == SImode)	pat = gen_seqsi_special (operands[0], sparc_compare_op0,				 sparc_compare_op1);      else if (! TARGET_ARCH64)	FAIL;      else	pat = gen_seqsi_special_extend (operands[0], sparc_compare_op0,					sparc_compare_op1);      emit_insn (pat);      DONE;    }  else if (GET_MODE (sparc_compare_op0) == DImode)    {      rtx pat;      if (! TARGET_ARCH64)	FAIL;      else if (GET_MODE (operands[0]) == SImode)	pat = gen_seqdi_special_trunc (operands[0], sparc_compare_op0,				       sparc_compare_op1);      else	pat = gen_seqdi_special (operands[0], sparc_compare_op0,				 sparc_compare_op1);      emit_insn (pat);      DONE;    }  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)    {      sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ);      emit_jump_insn (gen_sne (operands[0]));      DONE;    }  else if (TARGET_V9)    {      if (gen_v9_scc (EQ, operands))	DONE;      /* fall through */    }  FAIL;});; ??? v9: Operand 0 needs a mode, so SImode was chosen.;; However, the code handles both SImode and DImode.(define_expand "sne"  [(set (match_operand:SI 0 "intreg_operand" "")	(ne:SI (match_dup 1) (const_int 0)))]  ""{  if (GET_MODE (sparc_compare_op0) == SImode)    {      rtx pat;      if (GET_MODE (operands[0]) == SImode)	pat = gen_snesi_special (operands[0], sparc_compare_op0,				 sparc_compare_op1);      else if (! TARGET_ARCH64)	FAIL;      else	pat = gen_snesi_special_extend (operands[0], sparc_compare_op0,					sparc_compare_op1);      emit_insn (pat);      DONE;    }  else if (GET_MODE (sparc_compare_op0) == DImode)    {      rtx pat;      if (! TARGET_ARCH64)	FAIL;      else if (GET_MODE (operands[0]) == SImode)	pat = gen_snedi_special_trunc (operands[0], sparc_compare_op0,				       sparc_compare_op1);      else	pat = gen_snedi_special (operands[0], sparc_compare_op0,				 sparc_compare_op1);      emit_insn (pat);      DONE;    }  else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)    {      sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE);      emit_jump_insn (gen_sne (operands[0]));      DONE;    }  else if (TARGET_V9)    {      if (gen_v9_scc (NE, operands))	DONE;      /* fall through */    }  FAIL;})(define_expand "sgt"  [(set (match_operand:SI 0 "intreg_operand" "")	(gt:SI (match_dup 1) (const_int 0)))]  ""{  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)    {      sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT);      emit_jump_insn (gen_sne (operands[0]));      DONE;    }  else if (TARGET_V9)    {      if (gen_v9_scc (GT, operands))	DONE;      /* fall through */    }  FAIL;})(define_expand "slt"  [(set (match_operand:SI 0 "intreg_operand" "")	(lt:SI (match_dup 1) (const_int 0)))]  ""{  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)    {      sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT);      emit_jump_insn (gen_sne (operands[0]));      DONE;    }  else if (TARGET_V9)    {      if (gen_v9_scc (LT, operands))	DONE;      /* fall through */    }  FAIL;})(define_expand "sge"  [(set (match_operand:SI 0 "intreg_operand" "")	(ge:SI (match_dup 1) (const_int 0)))]  ""{  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)    {      sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE);      emit_jump_insn (gen_sne (operands[0]));      DONE;    }  else if (TARGET_V9)    {      if (gen_v9_scc (GE, operands))	DONE;      /* fall through */    }  FAIL;})(define_expand "sle"  [(set (match_operand:SI 0 "intreg_operand" "")	(le:SI (match_dup 1) (const_int 0)))]  ""{  if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)    {      sparc_emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE);      emit_jump_insn (gen_sne (operands[0]));      DONE;    }  else if (TARGET_V9)    {      if (gen_v9_scc (LE, operands))	DONE;      /* fall through */    }  FAIL;})(define_expand "sgtu"  [(set (match_operand:SI 0 "intreg_operand" "")	(gtu:SI (match_dup 1) (const_int 0)))]  ""{  if (! TARGET_V9)    {      rtx tem, pat;      /* We can do ltu easily, so if both operands are registers, swap them and	 do a LTU.  */      if ((GET_CODE (sparc_compare_op0) == REG	   || GET_CODE (sparc_compare_op0) == SUBREG)	  && (GET_CODE (sparc_compare_op1) == REG	      || GET_CODE (sparc_compare_op1) == SUBREG))	{	  tem = sparc_compare_op0;	  sparc_compare_op0 = sparc_compare_op1;	  sparc_compare_op1 = tem;	  pat = gen_sltu (operands[0]);          if (pat == NULL_RTX)            FAIL;          emit_insn (pat);	  DONE;	}    }  else    {      if (gen_v9_scc (GTU, operands))	DONE;    }  FAIL;})(define_expand "sltu"  [(set (match_operand:SI 0 "intreg_operand" "")	(ltu:SI (match_dup 1) (const_int 0)))]  ""{  if (TARGET_V9)    {      if (gen_v9_scc (LTU, operands))	DONE;    }  operands[1] = gen_compare_reg (LTU, sparc_compare_op0, sparc_compare_op1);})(define_expand "sgeu"  [(set (match_operand:SI 0 "intreg_operand" "")	(geu:SI (match_dup 1) (const_int 0)))]  ""{  if (TARGET_V9)    {      if (gen_v9_scc (GEU, operands))	DONE;    }  operands[1] = gen_compare_reg (GEU, sparc_compare_op0, sparc_compare_op1);})(define_expand "sleu"  [(set (match_operand:SI 0 "intreg_operand" "")	(leu:SI (match_dup 1) (const_int 0)))]  ""{  if (! TARGET_V9)    {      rtx tem, pat;      /* We can do geu easily, so if both operands are registers, swap them and	 do a GEU.  */      if ((GET_CODE (sparc_compare_op0) == REG	   || GET_CODE (sparc_compare_op0) == SUBREG)	  && (GET_CODE (sparc_compare_op1) == REG	      || GET_CODE (sparc_compare_op1) == SUBREG))	{	  tem = sparc_compare_op0;	  sparc_compare_op0 = sparc_compare_op1;	  sparc_compare_op1 = tem;	  pat = gen_sgeu (operands[0]);          if (pat == NULL_RTX)            FAIL;          emit_insn (pat);	  DONE;	}    }  else    {      if (gen_v9_scc (LEU, operands))	DONE;    }  FAIL;});; Now the DEFINE_INSNs for the scc cases.;; The SEQ and SNE patterns are special because they can be done;; without any branching and do not involve a COMPARE.  We want;; them to always use the splitz below so the results can be;; scheduled.(define_insn_and_split "*snesi_zero"  [(set (match_operand:SI 0 "register_operand" "=r")	(ne:SI (match_operand:SI 1 "register_operand" "r")	       (const_int 0)))   (clobber (reg:CC 100))]  ""  "#"  ""  [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))					   (const_int 0)))   (set (match_dup 0) (ltu:SI (reg:CC 100) (const_int 0)))]  ""  [(set_attr "length" "2")])(define_insn_and_split "*neg_snesi_zero"  [(set (match_operand:SI 0 "register_operand" "=r")	(neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r")		       (const_int 0))))   (clobber (reg:CC 100))]  ""  "#"  ""  [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))					   (const_int 0)))   (set (match_dup 0) (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))]  ""  [(set_attr "length" "2")])(define_insn_and_split "*snesi_zero_extend"  [(set (match_operand:DI 0 "register_operand" "=r")        (ne:DI (match_operand:SI 1 "register_operand" "r")               (const_int 0)))   (clobber (reg:CC 100))]  "TARGET_ARCH64"  "#"  "&& 1"  [(set (reg:CC_NOOV 100) (compare:CC_NOOV (minus:SI (const_int 0)                                                     (match_dup 1))                                           (const_int 0)))   (set (match_dup 0) (zero_extend:DI (plus:SI (plus:SI (const_int 0)                                                        (const_int 0))                                               (ltu:SI (reg:CC_NOOV 100)                                                       (const_int 0)))))]  ""  [(set_attr "length" "2")])(define_insn_and_split "*snedi_zero"  [(set (match_operand:DI 0 "register_operand" "=&r")        (ne:DI (match_operand:DI 1 "register_operand" "r")               (const_int 0)))]  "TARGET_ARCH64"

⌨️ 快捷键说明

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