📄 vax.md
字号:
;;- Machine description for GNU compiler;;- Vax Version;; Copyright (C) 1987, 1988 Free Software Foundation, Inc.;; This file is part of GNU CC.;; GNU CC is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 1, or (at your option);; any later version.;; GNU CC is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU CC; see the file COPYING. If not, write to;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.;;- Instruction patterns. When multiple patterns apply,;;- the first one in the file is chosen.;;-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.;;-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code;;- updates for most instructions.; tstsi is first test insn so that it is the one to match; a constant argument.(define_insn "tstsi" [(set (cc0) (match_operand:SI 0 "general_operand" "g"))] "" "tstl %0")(define_insn "tsthi" [(set (cc0) (match_operand:HI 0 "general_operand" "g"))] "" "tstw %0")(define_insn "tstqi" [(set (cc0) (match_operand:QI 0 "general_operand" "g"))] "" "tstb %0")(define_insn "tstdf" [(set (cc0) (match_operand:DF 0 "general_operand" "gF"))] "" "tst%# %0")(define_insn "tstsf" [(set (cc0) (match_operand:SF 0 "general_operand" "gF"))] "" "tstf %0");; Put cmpsi first among compare insns so it matches two CONST_INT operands.(define_insn "cmpsi" [(set (cc0) (compare (match_operand:SI 0 "general_operand" "g") (match_operand:SI 1 "general_operand" "g")))] "" "cmpl %0,%1")(define_insn "cmphi" [(set (cc0) (compare (match_operand:HI 0 "general_operand" "g") (match_operand:HI 1 "general_operand" "g")))] "" "cmpw %0,%1")(define_insn "cmpqi" [(set (cc0) (compare (match_operand:QI 0 "general_operand" "g") (match_operand:QI 1 "general_operand" "g")))] "" "cmpb %0,%1")(define_insn "cmpdf" [(set (cc0) (compare (match_operand:DF 0 "general_operand" "gF") (match_operand:DF 1 "general_operand" "gF")))] "" "cmp%# %0,%1")(define_insn "cmpsf" [(set (cc0) (compare (match_operand:SF 0 "general_operand" "gF") (match_operand:SF 1 "general_operand" "gF")))] "" "cmpf %0,%1")(define_insn "" [(set (cc0) (and:SI (match_operand:SI 0 "general_operand" "g") (match_operand:SI 1 "general_operand" "g")))] "" "bitl %0,%1")(define_insn "" [(set (cc0) (and:HI (match_operand:HI 0 "general_operand" "g") (match_operand:HI 1 "general_operand" "g")))] "" "bitw %0,%1")(define_insn "" [(set (cc0) (and:QI (match_operand:QI 0 "general_operand" "g") (match_operand:QI 1 "general_operand" "g")))] "" "bitb %0,%1")(define_insn "movdf" [(set (match_operand:DF 0 "general_operand" "=g") (match_operand:DF 1 "general_operand" "gF"))] "" "*{ if (operands[1] == dconst0_rtx) return \"clr%# %0\"; return \"mov%# %1,%0\";}")(define_insn "movsf" [(set (match_operand:SF 0 "general_operand" "=g") (match_operand:SF 1 "general_operand" "gF"))] "" "*{ if (operands[1] == fconst0_rtx) return \"clrf %0\"; return \"movf %1,%0\";}");; Some vaxes don't support this instruction.;;(define_insn "movti";; [(set (match_operand:TI 0 "general_operand" "=g");; (match_operand:TI 1 "general_operand" "g"))];; "";; "movh %1,%0")(define_insn "movdi" [(set (match_operand:DI 0 "general_operand" "=g") (match_operand:DI 1 "general_operand" "g"))] "" "movq %1,%0");; This handles constants which are not legitimate;; for the sake of shared libraries on VMS.(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g") (match_operand:SI 1 "" "i"))] "CONSTANT_P (operands[1]) && ! LEGITIMATE_CONSTANT_P (operands[1])" "*{ operands[2] = XEXP (XEXP (operands[1], 0), 0); operands[1] = XEXP (XEXP (operands[1], 0), 1); return \"movl %2,%0\;addl2 %1,%0\";}")(define_insn "movsi" [(set (match_operand:SI 0 "general_operand" "=g") (match_operand:SI 1 "supergeneral_operand" "g"))] "" "*{ rtx link; if (operands[1] == const1_rtx && (link = find_reg_note (insn, REG_WAS_0, 0)) /* Make sure the insn that stored the 0 is still present. */ && ! XEXP (link, 0)->volatil && GET_CODE (XEXP (link, 0)) != NOTE /* Make sure cross jumping didn't happen here. */ && no_labels_between_p (XEXP (link, 0), insn)) /* Fastest way to change a 0 to a 1. */ return \"incl %0\"; if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST) { if (push_operand (operands[0], SImode)) return \"pushab %a1\"; return \"movab %a1,%0\"; } /* this is slower than a movl, except when pushing an operand */ if (operands[1] == const0_rtx) return \"clrl %0\"; if (GET_CODE (operands[1]) == CONST_INT && (unsigned) INTVAL (operands[1]) >= 64) { int i = INTVAL (operands[1]); if ((unsigned)(~i) < 64) { operands[1] = gen_rtx (CONST_INT, VOIDmode, ~i); return \"mcoml %1,%0\"; } if ((unsigned)i < 127) { operands[1] = gen_rtx (CONST_INT, VOIDmode, 63); operands[2] = gen_rtx (CONST_INT, VOIDmode, i-63); return \"addl3 %2,%1,%0\"; } /* trading speed for space */ if ((unsigned)i < 0x100) return \"movzbl %1,%0\"; if (i >= -0x80 && i < 0) return \"cvtbl %1,%0\"; if ((unsigned)i < 0x10000) return \"movzwl %1,%0\"; if (i >= -0x8000 && i < 0) return \"cvtwl %1,%0\"; } if (push_operand (operands[0], SImode)) return \"pushl %1\"; return \"movl %1,%0\";}")(define_insn "movhi" [(set (match_operand:HI 0 "general_operand" "=g") (match_operand:HI 1 "general_operand" "g"))] "" "*{ rtx link; if (operands[1] == const1_rtx && (link = find_reg_note (insn, REG_WAS_0, 0)) /* Make sure the insn that stored the 0 is still present. */ && ! XEXP (link, 0)->volatil && GET_CODE (XEXP (link, 0)) != NOTE /* Make sure cross jumping didn't happen here. */ && no_labels_between_p (XEXP (link, 0), insn)) /* Fastest way to change a 0 to a 1. */ return \"incw %0\"; if (operands[1] == const0_rtx) return \"clrw %0\"; if (GET_CODE (operands[1]) == CONST_INT && (unsigned) INTVAL (operands[1]) >= 64) { int i = INTVAL (operands[1]); if ((unsigned)((~i) & 0xffff) < 64) { operands[1] = gen_rtx (CONST_INT, VOIDmode, (~i) & 0xffff); return \"mcomw %1,%0\"; } if ((unsigned)(i & 0xffff) < 127) { operands[1] = gen_rtx (CONST_INT, VOIDmode, 63); operands[2] = gen_rtx (CONST_INT, VOIDmode, (i-63) & 0xffff); return \"addw3 %2,%1,%0\"; } /* this is a lot slower, and only saves 1 measly byte! */ /* if ((unsigned)i < 0x100) return \"movzbw %1,%0\"; */ /* if (i >= -0x80 && i < 0) return \"cvtbw %1,%0\"; */ } return \"movw %1,%0\";}")(define_insn "movqi" [(set (match_operand:QI 0 "general_operand" "=g") (match_operand:QI 1 "general_operand" "g"))] "" "*{ if (operands[1] == const0_rtx) return \"clrb %0\"; if (GET_CODE (operands[1]) == CONST_INT && (unsigned) INTVAL (operands[1]) >= 64) { int i = INTVAL (operands[1]); if ((unsigned)((~i) & 0xff) < 64) { operands[1] = gen_rtx (CONST_INT, VOIDmode, (~i) & 0xff); return \"mcomb %1,%0\"; }#if 0 /* ASCII alphabetics */ if (((unsigned) INTVAL (operands[1]) &0xff) < 127) { operands[1] = gen_rtx (CONST_INT, VOIDmode, 63); operands[2] = gen_rtx (CONST_INT, VOIDmode, i-63); return \"addb3 %2,%1,%0\"; }#endif } return \"movb %1,%0\";}");; The definition of this insn does not really explain what it does,;; but it should suffice;; that anything generated as this insn will be recognized as one;; and that it won't successfully combine with anything.(define_insn "movstrhi" [(set (match_operand:BLK 0 "general_operand" "=g") (match_operand:BLK 1 "general_operand" "g")) (use (match_operand:HI 2 "general_operand" "g")) (clobber (reg:SI 0)) (clobber (reg:SI 1)) (clobber (reg:SI 2)) (clobber (reg:SI 3)) (clobber (reg:SI 4)) (clobber (reg:SI 5))] "" "movc3 %2,%1,%0");; Extension and truncation insns.;; Those for integer source operand;; are ordered widest source type first.(define_insn "truncsiqi2" [(set (match_operand:QI 0 "general_operand" "=g") (truncate:QI (match_operand:SI 1 "general_operand" "g")))] "" "cvtlb %1,%0")(define_insn "truncsihi2" [(set (match_operand:HI 0 "general_operand" "=g") (truncate:HI (match_operand:SI 1 "general_operand" "g")))] "" "cvtlw %1,%0")(define_insn "trunchiqi2" [(set (match_operand:QI 0 "general_operand" "=g") (truncate:QI (match_operand:HI 1 "general_operand" "g")))] "" "cvtwb %1,%0")(define_insn "extendhisi2" [(set (match_operand:SI 0 "general_operand" "=g") (sign_extend:SI (match_operand:HI 1 "general_operand" "g")))] "" "cvtwl %1,%0")(define_insn "extendqihi2" [(set (match_operand:HI 0 "general_operand" "=g") (sign_extend:HI (match_operand:QI 1 "general_operand" "g")))] "" "cvtbw %1,%0")(define_insn "extendqisi2" [(set (match_operand:SI 0 "general_operand" "=g") (sign_extend:SI (match_operand:QI 1 "general_operand" "g")))] "" "cvtbl %1,%0")(define_insn "extendsfdf2" [(set (match_operand:DF 0 "general_operand" "=g") (float_extend:DF (match_operand:SF 1 "general_operand" "gF")))] "" "cvtf%# %1,%0")(define_insn "truncdfsf2" [(set (match_operand:SF 0 "general_operand" "=g") (float_truncate:SF (match_operand:DF 1 "general_operand" "gF")))] "" "cvt%#f %1,%0")(define_insn "zero_extendhisi2" [(set (match_operand:SI 0 "general_operand" "=g") (zero_extend:SI (match_operand:HI 1 "general_operand" "g")))] "" "movzwl %1,%0")(define_insn "zero_extendqihi2" [(set (match_operand:HI 0 "general_operand" "=g") (zero_extend:HI (match_operand:QI 1 "general_operand" "g")))] "" "movzbw %1,%0")(define_insn "zero_extendqisi2" [(set (match_operand:SI 0 "general_operand" "=g") (zero_extend:SI (match_operand:QI 1 "general_operand" "g")))] "" "movzbl %1,%0");; Fix-to-float conversion insns.;; Note that the ones that start with SImode come first.;; That is so that an operand that is a CONST_INT;; (and therefore lacks a specific machine mode).;; will be recognized as SImode (which is always valid);; rather than as QImode or HImode.(define_insn "floatsisf2" [(set (match_operand:SF 0 "general_operand" "=g") (float:SF (match_operand:SI 1 "general_operand" "g")))] "" "cvtlf %1,%0")(define_insn "floatsidf2" [(set (match_operand:DF 0 "general_operand" "=g") (float:DF (match_operand:SI 1 "general_operand" "g")))] "" "cvtl%# %1,%0")(define_insn "floathisf2" [(set (match_operand:SF 0 "general_operand" "=g") (float:SF (match_operand:HI 1 "general_operand" "g")))] "" "cvtwf %1,%0")(define_insn "floathidf2" [(set (match_operand:DF 0 "general_operand" "=g") (float:DF (match_operand:HI 1 "general_operand" "g")))] "" "cvtw%# %1,%0")(define_insn "floatqisf2" [(set (match_operand:SF 0 "general_operand" "=g") (float:SF (match_operand:QI 1 "general_operand" "g")))] "" "cvtbf %1,%0")(define_insn "floatqidf2" [(set (match_operand:DF 0 "general_operand" "=g") (float:DF (match_operand:QI 1 "general_operand" "g")))] "" "cvtb%# %1,%0");; Float-to-fix conversion insns.(define_insn "fix_truncsfqi2" [(set (match_operand:QI 0 "general_operand" "=g") (fix:QI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))] "" "cvtfb %1,%0")(define_insn "fix_truncsfhi2" [(set (match_operand:HI 0 "general_operand" "=g") (fix:HI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))] "" "cvtfw %1,%0")(define_insn "fix_truncsfsi2" [(set (match_operand:SI 0 "general_operand" "=g") (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))] "" "cvtfl %1,%0")(define_insn "fix_truncdfqi2" [(set (match_operand:QI 0 "general_operand" "=g") (fix:QI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))] "" "cvt%#b %1,%0")(define_insn "fix_truncdfhi2" [(set (match_operand:HI 0 "general_operand" "=g") (fix:HI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))] "" "cvt%#w %1,%0")(define_insn "fix_truncdfsi2" [(set (match_operand:SI 0 "general_operand" "=g") (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))] "" "cvt%#l %1,%0");;- All kinds of add instructions.(define_insn "adddf3" [(set (match_operand:DF 0 "general_operand" "=g") (plus:DF (match_operand:DF 1 "general_operand" "gF") (match_operand:DF 2 "general_operand" "gF")))] "" "*{ if (rtx_equal_p (operands[0], operands[1])) return \"add%#2 %2,%0\"; if (rtx_equal_p (operands[0], operands[2])) return \"add%#2 %1,%0\"; return \"add%#3 %1,%2,%0\";}")(define_insn "addsf3" [(set (match_operand:SF 0 "general_operand" "=g") (plus:SF (match_operand:SF 1 "general_operand" "gF") (match_operand:SF 2 "general_operand" "gF")))] "" "*{ if (rtx_equal_p (operands[0], operands[1])) return \"addf2 %2,%0\"; if (rtx_equal_p (operands[0], operands[2])) return \"addf2 %1,%0\"; return \"addf3 %1,%2,%0\";}")(define_insn "addsi3" [(set (match_operand:SI 0 "general_operand" "=g") (plus:SI (match_operand:SI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "*{ if (rtx_equal_p (operands[0], operands[1])) { if (operands[2] == const1_rtx) return \"incl %0\"; if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -1) return \"decl %0\"; if (GET_CODE (operands[2]) == CONST_INT && (unsigned) (- INTVAL (operands[2])) < 64) return \"subl2 $%n2,%0\"; if (GET_CODE (operands[2]) == CONST_INT && (unsigned) INTVAL (operands[2]) >= 64 && GET_CODE (operands[1]) == REG) return \"movab %c2(%1),%0\"; return \"addl2 %2,%0\"; } if (rtx_equal_p (operands[0], operands[2])) return \"addl2 %1,%0\"; if (GET_CODE (operands[2]) == CONST_INT && (unsigned) (- INTVAL (operands[2])) < 64) return \"subl3 $%n2,%1,%0\"; if (GET_CODE (operands[2]) == CONST_INT && (unsigned) INTVAL (operands[2]) >= 64 && GET_CODE (operands[1]) == REG) { if (push_operand (operands[0], SImode)) return \"pushab %c2(%1)\"; return \"movab %c2(%1),%0\"; } return \"addl3 %1,%2,%0\";}")(define_insn "addhi3" [(set (match_operand:HI 0 "general_operand" "=g") (plus:HI (match_operand:HI 1 "general_operand" "g") (match_operand:HI 2 "general_operand" "g")))] "" "*{ if (rtx_equal_p (operands[0], operands[1])) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -