h8300.md

来自「gcc3.2.1源代码」· Markdown 代码 · 共 2,182 行 · 第 1/5 页

MD
2,182 行
字号
  [(set (match_operand:HI 0 "register_operand" "=r,r")	(sign_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  bld	#7,%s0\;subx	%t0,%t0  mov.b	%R1,%s0\;bld	#7,%s0\;subx	%t0,%t0"  [(set_attr "length" "4,8")   (set_attr "cc" "clobber,clobber")])(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r")	(sign_extend:HI (match_operand:QI 1 "register_operand" "0")))]  "TARGET_H8300H || TARGET_H8300S"  "exts.w	%T0"  [(set_attr "length" "2")   (set_attr "cc" "set_znv")]);; The compiler can synthesize a 300H variant of this which is;; just as efficient as one that we'd create(define_insn "extendqisi2"  [(set (match_operand:SI 0 "register_operand" "=r,r")	(sign_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0  mov.b	%R1,%w0\;bld	#7,%w0\;subx	%x0,%x0\;subx	%y0,%y0\;subx	%z0,%z0"  [(set_attr "length" "8,10")   (set_attr "cc" "clobber,clobber")])(define_expand "extendhisi2"  [(set (match_operand:SI 0 "register_operand" "")	(sign_extend:SI (match_operand:HI 1 "register_operand" "")))]  ""  "")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r,r")	(sign_extend:SI (match_operand:HI 1 "general_operand_src" "0,g>")))]  "TARGET_H8300"  "@  bld	#7,%x0\;subx	%y0,%y0\;subx	%z0,%z0  mov.w	%T1,%f0\;bld	#7,%x0\;subx	%y0,%y0\;subx	%z0,%z0"  [(set_attr "length" "6,8")   (set_attr "cc" "clobber,clobber")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(sign_extend:SI (match_operand:HI 1 "register_operand" "0")))]  "TARGET_H8300H || TARGET_H8300S"  "exts.l	%S0"  [(set_attr "length" "2")   (set_attr "cc" "set_znv")]);; ----------------------------------------------------------------------;; SHIFTS;; ----------------------------------------------------------------------;;;; We make some attempt to provide real efficient shifting.  One example is;; doing an 8 bit shift of a 16 bit value by moving a byte reg into the other;; reg and moving 0 into the former reg.;;;; We also try to achieve this in a uniform way.  IE: We don't try to achieve;; this in both rtl and at insn emit time.  Ideally, we'd use rtl as that would;; give the optimizer more cracks at the code.  However, we wish to do things;; like optimizing shifting the sign bit to bit 0 by rotating the other way.;; There is rtl to handle this (rotate + and), but the H8/300 doesn't handle;; 16 bit rotates.  Also, if we emit complicated rtl, combine may not be able;; to detect cases it can optimize.;;;; For these and other fuzzy reasons, I've decided to go the less pretty but;; easier "do it at insn emit time" route.;; QI BIT SHIFTS(define_expand "ashlqi3"  [(set (match_operand:QI 0 "register_operand" "")	(ashift:QI (match_operand:QI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (QImode, ASHIFT, operands)) DONE; else FAIL;")(define_expand "ashrqi3"  [(set (match_operand:QI 0 "register_operand" "")	(ashiftrt:QI (match_operand:QI 1 "register_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (QImode, ASHIFTRT, operands)) DONE; else FAIL;")(define_expand "lshrqi3"  [(set (match_operand:QI 0 "register_operand" "")	(lshiftrt:QI (match_operand:QI 1 "register_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (QImode, LSHIFTRT, operands)) DONE; else FAIL;")(define_insn ""  [(set (match_operand:QI 0 "register_operand" "=r,r")	(match_operator:QI 3 "nshift_operator"			[ (match_operand:QI 1 "register_operand" "0,0")			  (match_operand:QI 2 "nonmemory_operand" "KM,rn")]))   (clobber (match_scratch:QI 4 "=X,&r"))]  ""  "* return output_a_shift (operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")]);; HI BIT SHIFTS(define_expand "ashlhi3"  [(set (match_operand:HI 0 "register_operand" "")	(ashift:HI (match_operand:HI 1 "nonmemory_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (HImode, ASHIFT, operands)) DONE; else FAIL;")(define_expand "lshrhi3"  [(set (match_operand:HI 0 "register_operand" "")	(lshiftrt:HI (match_operand:HI 1 "general_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (HImode, LSHIFTRT, operands)) DONE; else FAIL;")(define_expand "ashrhi3"  [(set (match_operand:HI 0 "register_operand" "")	(ashiftrt:HI (match_operand:HI 1 "register_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (HImode, ASHIFTRT, operands)) DONE; else FAIL;")(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r,r")	(match_operator:HI 3 "nshift_operator"			[ (match_operand:HI 1 "register_operand" "0,0")			  (match_operand:QI 2 "nonmemory_operand" "KM,rn")]))   (clobber (match_scratch:QI 4 "=X,&r"))]  ""  "* return output_a_shift (operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")]);;  SI BIT SHIFTS(define_expand "ashlsi3"  [(set (match_operand:SI 0 "register_operand" "")	(ashift:SI (match_operand:SI 1 "general_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (SImode, ASHIFT, operands)) DONE; else FAIL;")(define_expand "lshrsi3"  [(set (match_operand:SI 0 "register_operand" "")	(lshiftrt:SI (match_operand:SI 1 "general_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (SImode, LSHIFTRT, operands)) DONE; else FAIL;")(define_expand "ashrsi3"  [(set (match_operand:SI 0 "register_operand" "")	(ashiftrt:SI (match_operand:SI 1 "general_operand" "")		     (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_shift (SImode, ASHIFTRT, operands)) DONE; else FAIL;")(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r,r")	(match_operator:SI 3 "nshift_operator"			[ (match_operand:SI 1 "register_operand" "0,0")			  (match_operand:QI 2 "nonmemory_operand" "K,rn")]))   (clobber (match_scratch:QI 4 "=X,&r"))]  ""  "* return output_a_shift (operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")]);; ----------------------------------------------------------------------;; ROTATIONS;; ----------------------------------------------------------------------(define_expand "rotlqi3"  [(set (match_operand:QI 0 "register_operand" "")	(rotate:QI (match_operand:QI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;")(define_insn "*rotlqi3_1"  [(set (match_operand:QI 0 "register_operand" "=r")	(rotate:QI (match_operand:QI 1 "register_operand" "0")		   (match_operand:QI 2 "immediate_operand" "")))]  ""  "* return emit_a_rotate (ROTATE, operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")])(define_expand "rotlhi3"  [(set (match_operand:HI 0 "register_operand" "")	(rotate:HI (match_operand:HI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  ""  "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;")(define_insn "*rotlhi3_1"  [(set (match_operand:HI 0 "register_operand" "=r")	(rotate:HI (match_operand:HI 1 "register_operand" "0")		   (match_operand:QI 2 "immediate_operand" "")))]  ""  "* return emit_a_rotate (ROTATE, operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")])(define_expand "rotlsi3"  [(set (match_operand:SI 0 "register_operand" "")	(rotate:SI (match_operand:SI 1 "register_operand" "")		   (match_operand:QI 2 "nonmemory_operand" "")))]  "TARGET_H8300H || TARGET_H8300S"  "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;")(define_insn "*rotlsi3_1"  [(set (match_operand:SI 0 "register_operand" "=r")	(rotate:SI (match_operand:SI 1 "register_operand" "0")		   (match_operand:QI 2 "immediate_operand" "")))]  "TARGET_H8300H || TARGET_H8300S"  "* return emit_a_rotate (ROTATE, operands);"  [(set_attr "length" "20")   (set_attr "cc" "clobber")]);; -----------------------------------------------------------------;; BIT FIELDS;; -----------------------------------------------------------------;; The H8/300 has given 1/8th of its opcode space to bitfield;; instructions so let's use them as well as we can.;; You'll never believe all these patterns perform one basic action --;; load a bit from the source, optionally invert the bit, then store it;; in the destination (which is known to be zero).;;;; Combine obviously need some work to better identify this situation and;; canonicalize the form better.;;;; Normal loads with a 16bit destination.;;(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=&r")	(zero_extract:HI (match_operand:HI 1 "register_operand" "r")			 (const_int 1)			 (match_operand:HI 2 "immediate_operand" "n")))]  "TARGET_H8300"  "sub.w	%0,%0\;bld	%Z2,%Y1\;bst	#0,%X0"  [(set_attr "cc" "clobber")   (set_attr "length" "6")]);;;; Inverted loads with a 16bit destination.;;(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=&r")	(zero_extract:HI (xor:HI (match_operand:HI 1 "register_operand" "r")				 (match_operand:HI 3 "const_int_operand" "n"))			 (const_int 1)			 (match_operand:HI 2 "const_int_operand" "n")))]  "TARGET_H8300   && (1 << INTVAL (operands[2])) == INTVAL (operands[3])"  "sub.w	%0,%0\;bild	%Z2,%Y1\;bst	#0,%X0"  [(set_attr "cc" "clobber")   (set_attr "length" "8")]);;;; Normal loads with a 32bit destination.;;(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=&r")	(zero_extract:SI (match_operand:HI 1 "register_operand" "r")			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "TARGET_H8300   && INTVAL (operands[2]) < 16"  "* return output_simode_bld (0, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "6")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(zero_extract:SI (match_operand:SI 1 "register_operand" "r")			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "(TARGET_H8300H || TARGET_H8300S)   && INTVAL (operands[2]) < 16"  "* return output_simode_bld (0, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "6")]);;;; Inverted loads with a 32bit destination.;;(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=&r")	(zero_extract:SI (xor:HI (match_operand:HI 1 "register_operand" "r")				 (match_operand:HI 3 "const_int_operand" "n"))			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "TARGET_H8300   && INTVAL (operands[2]) < 16   && (1 << INTVAL (operands[2])) == INTVAL (operands[3])"  "* return output_simode_bld (1, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "6")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")	(zero_extract:SI (xor:SI (match_operand:SI 1 "register_operand" "r")				 (match_operand 3 "const_int_operand" "n"))			 (const_int 1)			 (match_operand 2 "const_int_operand" "n")))]  "(TARGET_H8300H || TARGET_H8300S)   && INTVAL (operands[2]) < 16   && (1 << INTVAL (operands[2])) == INTVAL (operands[3])"  "* return output_simode_bld (1, operands);"  [(set_attr "cc" "clobber")   (set_attr "length" "6")])(define_expand "insv"  [(set (zero_extract:HI (match_operand:HI 0 "general_operand" "")			 (match_operand:HI 1 "general_operand" "")			 (match_operand:HI 2 "general_operand" ""))	(match_operand:HI 3 "general_operand" ""))]  "TARGET_H8300"  "{  /* We only have single bit bitfield instructions.  */  if (INTVAL (operands[1]) != 1)    FAIL;  /* For now, we don't allow memory operands.  */  if (GET_CODE (operands[0]) == MEM      || GET_CODE (operands[3]) == MEM)    FAIL;}")(define_insn ""  [(set (zero_extract:HI (match_operand:HI 0 "register_operand" "+r")			 (const_int 1)			 (match_operand:HI 1 "immediate_operand" "n"))	(match_operand:HI 2 "register_operand" "r"))]  ""  "bld	#0,%R2\;bst	%Z1,%Y0 ; i1"  [(set_attr "cc" "clobber")   (set_attr "length" "4")])(define_expand "extzv"  [(set (match_operand:HI 0 "register_operand" "")	(zero_extract:HI (match_operand:HI 1 "bit_operand" "")			 (match_operand:HI 2 "general_operand" "")			 (match_operand:HI 3 "general_operand" "")))]  "TARGET_H8300"  "{  /* We only have single bit bitfield instructions.  */  if (INTVAL (operands[2]) != 1)    FAIL;  /* For now, we don't allow memory operands.  */  if (GET_CODE (operands[1]) == MEM)    FAIL;}");; BAND, BOR, and BXOR patterns(define_insn ""  [(set (match_operand:HI 0 "bit_operand" "=Ur")	(match_operator:HI 4 "bit_operator"	   [(zero_extract:HI (match_operand:HI 1 "register_operand" "r")			     (const_int 1)			     (match_operand:HI 2 "immediate_operand" "n"))	    (match_operand:HI 3 "bit_operand" "0")]))]  ""  "bld	%Z2,%Y1\;%b4	#0,%R0\;bst	#0,%R0; bl1"  [(set_attr "cc" "clobber")   (set_attr "length" "6")   (set_attr "adjust_length" "no")])(define_insn ""  [(set (match_operand:HI 0 "bit_operand" "=Ur")	(match_operator:HI 5 "bit_operator"	   [(zero_extract:HI (match_operand:HI 1 "register_operand" "r")			     (const_int 1)			     (match_operand:HI 2 "immediate_operand" "n"))	    (zero_extract:HI (match_operand:HI 3 "register_operand" "r")			     (const_int 1)			     (match_operand:HI 4 "immediate_operand" "n"))]))]  ""  "bld	%Z2,%Y1\;%b5	%Z4,%Y3\;bst	#0,%R0; bl3"  [(set_attr "cc" "clobber")   (set_attr "length" "6")   (set_attr "adjust_length" "no")]);; -----------------------------------------------------------------;; COMBINE PATTERNS;; -----------------------------------------------------------------(define_insn ""  [(set (match_operand:HI 0 "register_operand" "=r")        (ior:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "r"))		(match_operand:HI 2 "register_operand" "0")))]  "REG_P (operands[0])   && REG_P (operands[1])   && REGNO (operands[0]) != REGNO (operands[1])"  "or\\t%X1,%s0"  [(set_attr "cc" "clobber")   (set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")        (ior:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "r"))		(match_operand:SI 2 "register_operand" "0")))]  "(TARGET_H8300H || TARGET_H8300S)   && REG_P (operands[0])   && REG_P (operands[1])   && (REGNO (operands[0]) != REGNO (operands[1]))"  "or.w\\t%T1,%f0"  [(set_attr "cc" "clobber")   (set_attr "length" "2")])(define_insn ""  [(set (match_operand:SI 0 "register_operand" "=r")        (ior:SI (zero_extend:SI (match_operand:QI 1 "register_operand" "r"))		(match_operand:SI 2 "register_operand" "0")))]  "REG_P (operands[0])   && REG_P (operands[1])   && 

⌨️ 快捷键说明

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