📄 ns32k.md
字号:
(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_rtx (CONST_INT, VOIDmode, 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) (if_then_else (eq (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "*{ if (cc_prev_status.flags & CC_Z_IN_F) return \"bfc %l0\"; else if (cc_prev_status.flags & CC_Z_IN_NOT_F) return \"bfs %l0\"; else return \"beq %l0\";}")(define_insn "bne" [(set (pc) (if_then_else (ne (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "*{ if (cc_prev_status.flags & CC_Z_IN_F) return \"bfs %l0\"; else if (cc_prev_status.flags & CC_Z_IN_NOT_F) return \"bfc %l0\"; else return \"bne %l0\";}")(define_insn "bgt" [(set (pc) (if_then_else (gt (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "bgt %l0")(define_insn "bgtu" [(set (pc) (if_then_else (gtu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "bhi %l0")(define_insn "blt" [(set (pc) (if_then_else (lt (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "blt %l0")(define_insn "bltu" [(set (pc) (if_then_else (ltu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "blo %l0")(define_insn "bge" [(set (pc) (if_then_else (ge (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "bge %l0")(define_insn "bgeu" [(set (pc) (if_then_else (geu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "bhs %l0")(define_insn "ble" [(set (pc) (if_then_else (le (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "ble %l0")(define_insn "bleu" [(set (pc) (if_then_else (leu (cc0) (const_int 0)) (label_ref (match_operand 0 "" "")) (pc)))] "" "bls %l0")(define_insn "" [(set (pc) (if_then_else (eq (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "*{ if (cc_prev_status.flags & CC_Z_IN_F) return \"bfs %l0\"; else if (cc_prev_status.flags & CC_Z_IN_NOT_F) return \"bfc %l0\"; else return \"bne %l0\";}")(define_insn "" [(set (pc) (if_then_else (ne (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "*{ if (cc_prev_status.flags & CC_Z_IN_F) return \"bfc %l0\"; else if (cc_prev_status.flags & CC_Z_IN_NOT_F) return \"bfs %l0\"; else return \"beq %l0\";}")(define_insn "" [(set (pc) (if_then_else (gt (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "ble %l0")(define_insn "" [(set (pc) (if_then_else (gtu (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "bls %l0")(define_insn "" [(set (pc) (if_then_else (lt (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "bge %l0")(define_insn "" [(set (pc) (if_then_else (ltu (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "bhs %l0")(define_insn "" [(set (pc) (if_then_else (ge (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "blt %l0")(define_insn "" [(set (pc) (if_then_else (geu (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "blo %l0")(define_insn "" [(set (pc) (if_then_else (le (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "bgt %l0")(define_insn "" [(set (pc) (if_then_else (leu (cc0) (const_int 0)) (pc) (label_ref (match_operand 0 "" ""))))] "" "bhi %l0");; Subtract-and-jump and Add-and-jump insns.;; These can actually be used for adding numbers in the range -8 to 7(define_insn "" [(set (pc) (if_then_else (ne (match_operand:SI 0 "general_operand" "+g") (match_operand:SI 1 "const_int_operand" "i")) (label_ref (match_operand 2 "" "")) (pc))) (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 1)))] "INTVAL (operands[1]) > -8 && INTVAL (operands[1]) <= 8" "acbd %$%n1,%0,%l2")(define_insn "" [(set (pc) (if_then_else (ne (match_operand:SI 0 "general_operand" "+g") (match_operand:SI 1 "const_int_operand" "i")) (label_ref (match_operand 2 "" "")) (pc))) (set (match_dup 0) (plus:SI (match_dup 0) (match_operand:SI 3 "const_int_operand" "i")))] "INTVAL (operands[1]) == - INTVAL (operands[3]) && INTVAL (operands[3]) >= -8 && INTVAL (operands[3]) < 8" "acbd %3,%0,%l2")(define_insn "call" [(call (match_operand:QI 0 "memory_operand" "m") (match_operand:QI 1 "general_operand" "g"))] "" "*{#ifndef JSR_ALWAYS if (GET_CODE (operands[0]) == MEM) { rtx temp = XEXP (operands[0], 0); if (CONSTANT_ADDRESS_P (temp)) {#ifdef ENCORE_ASM return \"bsr %?%0\";#else#ifdef CALL_MEMREF_IMPLICIT operands[0] = temp; return \"bsr %0\";#else#ifdef GNX_V3 return \"bsr %0\";#else return \"bsr %?%a0\";#endif#endif#endif } if (GET_CODE (XEXP (operands[0], 0)) == REG)#if defined (GNX_V3) || defined (CALL_MEMREF_IMPLICIT) return \"jsr %0\";#else return \"jsr %a0\";#endif }#endif /* not JSR_ALWAYS */ return \"jsr %0\";}")(define_insn "call_value" [(set (match_operand 0 "" "=rf") (call (match_operand:QI 1 "memory_operand" "m") (match_operand:QI 2 "general_operand" "g")))] "" "*{#ifndef JSR_ALWAYS if (GET_CODE (operands[1]) == MEM) { rtx temp = XEXP (operands[1], 0); if (CONSTANT_ADDRESS_P (temp)) {#ifdef ENCORE_ASM return \"bsr %?%1\";#else#ifdef CALL_MEMREF_IMPLICIT operands[1] = temp; return \"bsr %1\";#else#ifdef GNX_V3 return \"bsr %1\";#else return \"bsr %?%a1\";#endif#endif#endif } if (GET_CODE (XEXP (operands[1], 0)) == REG)#if defined (GNX_V3) || defined (CALL_MEMREF_IMPLICIT) return \"jsr %1\";#else return \"jsr %a1\";#endif }#endif /* not JSR_ALWAYS */ return \"jsr %1\";}");; Call subroutine returning any type.(define_expand "untyped_call" [(parallel [(call (match_operand 0 "" "") (const_int 0)) (match_operand 1 "" "") (match_operand 2 "" "")])] "" "{ int i; emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx)); for (i = 0; i < XVECLEN (operands[2], 0); i++) { rtx set = XVECEXP (operands[2], 0, i); emit_move_insn (SET_DEST (set), SET_SRC (set)); } /* The optimizer does not know that the call sets the function value registers we stored in the result block. We avoid problems by claiming that all hard registers are used and clobbered at this point. */ emit_insn (gen_blockage ()); DONE;}");; UNSPEC_VOLATILE is considered to use and clobber all hard registers and;; all of memory. This blocks insns from being moved across this point.(define_insn "blockage"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -