📄 ns32k.md
字号:
"" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (ashiftrt:QI (match_operand:QI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "ashb %n2,%0")(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (ashiftrt:QI (match_operand:QI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "ashb %2,%0");; logical shift instructions;; Logical right shift on the 32k works by negating the shift count.(define_expand "lshrsi3" [(set (match_operand:SI 0 "general_operand" "=g") (lshiftrt:SI (match_operand:SI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g") (lshiftrt:SI (match_operand:SI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "lshd %n2,%0")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g") (lshiftrt:SI (match_operand:SI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "lshd %2,%0")(define_expand "lshrhi3" [(set (match_operand:HI 0 "general_operand" "=g") (lshiftrt:HI (match_operand:HI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:HI 0 "general_operand" "=g") (lshiftrt:HI (match_operand:HI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "lshw %n2,%0")(define_insn "" [(set (match_operand:HI 0 "general_operand" "=g") (lshiftrt:HI (match_operand:HI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "lshw %2,%0")(define_expand "lshrqi3" [(set (match_operand:QI 0 "general_operand" "=g") (lshiftrt:QI (match_operand:QI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (lshiftrt:QI (match_operand:QI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "lshb %n2,%0")(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (lshiftrt:QI (match_operand:QI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "lshb %2,%0");; Rotate instructions;; See note 1(define_insn "rotlsi3" [(set (match_operand:SI 0 "general_operand" "=g") (rotate:SI (match_operand:SI 1 "general_operand" "0") (match_operand:SI 2 "general_operand" "g")))] "" "rotd %2,%0")(define_insn "rotlhi3" [(set (match_operand:HI 0 "general_operand" "=g") (rotate:HI (match_operand:HI 1 "general_operand" "0") (match_operand:SI 2 "general_operand" "g")))] "" "rotw %2,%0")(define_insn "rotlqi3" [(set (match_operand:QI 0 "general_operand" "=g") (rotate:QI (match_operand:QI 1 "general_operand" "0") (match_operand:SI 2 "general_operand" "g")))] "" "rotb %2,%0");; Right rotate on the 32k works by negating the shift count.(define_expand "rotrsi3" [(set (match_operand:SI 0 "general_operand" "=g") (rotatert:SI (match_operand:SI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g") (rotatert:SI (match_operand:SI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "rotd %n2,%0")(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g") (rotatert:SI (match_operand:SI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "rotd %2,%0")(define_expand "rotrhi3" [(set (match_operand:HI 0 "general_operand" "=g") (rotatert:HI (match_operand:HI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:HI 0 "general_operand" "=g") (rotatert:HI (match_operand:HI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "rotw %n2,%0")(define_insn "" [(set (match_operand:HI 0 "general_operand" "=g") (rotatert:HI (match_operand:HI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "rotw %2,%0")(define_expand "rotrqi3" [(set (match_operand:QI 0 "general_operand" "=g") (rotatert:QI (match_operand:QI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" "{ if (GET_CODE (operands[2]) != CONST_INT) operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));}")(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (rotatert:QI (match_operand:QI 1 "general_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "" "rotb %n2,%0")(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (rotatert:QI (match_operand:QI 1 "general_operand" "0") (neg:SI (match_operand:SI 2 "general_operand" "r"))))] "" "rotb %2,%0");;- load or push effective address ;; These come after the move, add, and multiply patterns;; because we don't want pushl $1 turned into pushad 1.(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g<") (match_operand:QI 1 "address_operand" "p"))] "" "*{ if (REG_P (operands[0]) && GET_CODE (operands[1]) == MULT && GET_CODE (XEXP (operands[1], 1)) == CONST_INT && (INTVAL (XEXP (operands[1], 1)) == 2 || INTVAL (XEXP (operands[1], 1)) == 4)) { rtx xoperands[3]; xoperands[0] = operands[0]; xoperands[1] = XEXP (operands[1], 0); xoperands[2] = GEN_INT (INTVAL (XEXP (operands[1], 1)) >> 1); return output_shift_insn (xoperands); } return \"addr %a1,%0\";}");;; Index insns. These are about the same speed as multiply-add counterparts.;;; but slower then using power-of-2 shifts if we can use them;;;; See note 1;(define_insn ""; [(set (match_operand:SI 0 "register_operand" "=r"); (plus:SI (match_operand:SI 1 "general_operand" "g"); (mult:SI (match_operand:SI 2 "register_operand" "0"); (plus:SI (match_operand:SI 3 "general_operand" "g") (const_int 1)))))]; "GET_CODE (operands[3]) != CONST_INT || INTVAL (operands[3]) > 8"; "indexd %0,%3,%1");;(define_insn ""; [(set (match_operand:SI 0 "register_operand" "=r"); (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "0"); (plus:SI (match_operand:SI 2 "general_operand" "g") (const_int 1))); (match_operand:SI 3 "general_operand" "g")))]; "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 8"; "indexd %0,%2,%3");; Set, Clear, and Invert bit;; See note 1(define_insn "" [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+g") (const_int 1) (match_operand:SI 1 "general_operand" "g")) (const_int 1))] "" "sbitd %1,%0");; See note 1(define_insn "" [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+g") (const_int 1) (match_operand:SI 1 "general_operand" "g")) (const_int 0))] "" "cbitd %1,%0");; See note 1(define_insn "" [(set (match_operand:SI 0 "general_operand" "+g") (xor:SI (ashift:SI (const_int 1) (match_operand:SI 1 "general_operand" "g")) (match_dup 0)))] "" "ibitd %1,%0");; See note 1(define_insn "" [(set (match_operand:QI 0 "general_operand" "=g") (xor:QI (subreg:QI (ashift:SI (const_int 1) (match_operand:QI 1 "general_operand" "g")) 0) (match_dup 0)))] "" "ibitb %1,%0");; Recognize jbs and jbc instructions.(define_insn "" [(set (cc0) (zero_extract (match_operand:SI 0 "general_operand" "rm") (const_int 1) (match_operand:SI 1 "general_operand" "g")))] "" "*{ cc_status.flags = CC_Z_IN_F; return \"tbitd %1,%0\";}");; extract(base, width, offset);; Signed bitfield extraction is not supported in hardware on the;; NS 32032. It is therefore better to let GCC figure out a;; good strategy for generating the proper instruction sequence;; and represent it as rtl.;; Optimize the case of extracting a byte or word from a register.;; Otherwise we must load a register with the offset of the;; chunk we want, and perform an extract insn (each of which;; is very expensive). Since we use the stack to do our bit-twiddling;; we cannot use it for a destination. Perhaps things are fast;; enough on the 32532 that such hacks are not needed.(define_insn "" [(set (match_operand:SI 0 "general_operand" "=ro") (zero_extract:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "const_int_operand" "i") (match_operand:SI 3 "const_int_operand" "i")))] "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16) && (INTVAL (operands[3]) == 8 || INTVAL (operands[3]) == 16 || INTVAL (operands[3]) == 24)" "*{ output_asm_insn (\"movd %1,tos\", operands); if (INTVAL (operands[2]) == 16) { if (INTVAL (operands[3]) == 8) output_asm_insn (\"movzwd 1(sp),%0\", operands); else output_asm_insn (\"movzwd 2(sp),%0\", operands); } else { if (INTVAL (operands[3]) == 8) output_asm_insn (\"movzbd 1(sp),%0\", operands); else if (INTVAL (operands[3]) == 16) output_asm_insn (\"movzbd 2(sp),%0\", operands); else output_asm_insn (\"movzbd 3(sp),%0\", operands); } if (TARGET_32532 || TARGET_32332) return \"cmpqd %$0,tos\"; else return \"adjspb %$-4\";}");; The exts/ext instructions have the problem that they always access;; 32 bits even if the bitfield is smaller. For example the instruction;; extsd 7(r1),r0,2,5;; would read not only at address 7(r1) but also at 8(r1) to 10(r1).;; If these addresses are in a different (unmapped) page a memory fault;; is the result.;;;; Timing considerations:;; movd 0(r1),r0 3 bytes;; lshd -26,r0 4;; andd 0x1f,r0 5;; takes about 13 cycles on the 532 while;; extsd 7(r1),r0,2,5 5 bytes;; takes about 21 cycles.;;;; The inss/ins instructions suffer from the same problem.;;;; A machine specific option (-mbitfield/-mnobitfield) is used;; to allow/disallow the use of these instructions.(define_insn "" [(set (match_operand:SI 0 "general_operand" "=g<") (zero_extract:SI (match_operand:SI 1 "register_operand" "g") (match_operand:SI 2 "const_int_operand" "i") (match_operand:SI 3 "general_operand" "rK")))] "TARGET_BITFIELD" "*{ if (GET_CODE (operands[3]) == CONST_INT) return \"extsd %1,%0,%3,%2\"; else return \"extd %3,%1,%0,%2\";}")(define_insn "extzv" [(set (match_operand:SI 0 "general_operand" "=g<") (zero_extract:SI (match_operand:QI 1 "general_operand" "g") (match_operand:SI 2 "const_int_operand" "i") (match_operand:SI 3 "general_operand" "rK")))] "TARGET_BITFIELD" "*{ if (GET_CODE (operands[3]) == CONST_INT) return \"extsd %1,%0,%3,%2\"; else return \"extd %3,%1,%0,%2\";}")(define_insn "" [(set (zero_extract:SI (match_operand:SI 0 "memory_operand" "+o") (match_operand:SI 1 "const_int_operand" "i") (match_operand:SI 2 "general_operand" "rn")) (match_operand:SI 3 "general_operand" "rm"))] "TARGET_BITFIELD" "*{ if (GET_CODE (operands[2]) == CONST_INT) { if (INTVAL (operands[2]) >= 8) { operands[0] = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8); operands[2] = GEN_INT (INTVAL (operands[2]) % 8); } if (INTVAL (operands[1]) <= 8) return \"inssb %3,%0,%2,%1\"; else if (INTVAL (operands[1]) <= 16) return \"inssw %3,%0,%2,%1\"; else return \"inssd %3,%0,%2,%1\"; } return \"insd %2,%3,%0,%1\";}")(define_insn "" [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r") (match_operand:SI 1 "const_int_operand" "i") (match_operand:SI 2 "general_operand" "rK")) (match_operand:SI 3 "general_operand" "rm"))] "TARGET_BITFIELD" "*{ if (GET_CODE (operands[2]) == CONST_INT) if (INTVAL (operands[1]) <= 8) return \"inssb %3,%0,%2,%1\"; else if (INTVAL (operands[1]) <= 16) return \"inssw %3,%0,%2,%1\"; else return \"inssd %3,%0,%2,%1\"; return \"insd %2,%3,%0,%1\";}")(define_insn "insv" [(set (zero_extract:SI (match_operand:QI 0 "general_operand" "+g") (match_operand:SI 1 "const_int_operand" "i") (match_operand:SI 2 "general_operand" "rK")) (match_operand:SI 3 "general_operand" "rm"))] "TARGET_BITFIELD" "*{ if (GET_CODE (operands[2]) == CONST_INT) if (INTVAL (operands[1]) <= 8) return \"inssb %3,%0,%2,%1\"; else if (INTVAL (operands[1]) <= 16) return \"inssw %3,%0,%2,%1\"; else return \"inssd %3,%0,%2,%1\"; return \"insd %2,%3,%0,%1\";}")(define_insn "jump" [(set (pc) (label_ref (match_operand 0 "" "")))] "" "br %l0")(define_insn "beq" [(set (pc)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -