Changeset 11668
 Timestamp:
 Jan 30, 2009, 12:24:53 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/compiler/PPC/ppc2.lisp
r11585 r11668 6646 6646 (ppc2formtypep form2 type)) 6647 6647 (setq overflow nil)))) 6648 (cond ((null vreg) 6649 (ppc2form seg nil nil form1) 6650 (ppc2form seg nil xfer form2)) 6651 (overflow 6652 (multiplevaluebind (r1 r2) (ppc2twountargetedregforms seg form1 ppc::arg_y form2 ppc::arg_z) 6653 (ensuringnodetarget (target vreg) 6654 (if *ppc2opencodeinline* 6655 (! fixnumaddoverflowinline target r1 r2) 6656 (progn 6657 (! fixnumaddoverflowool r1 r2) 6658 (ppc2copyregister seg target ($ ppc::arg_z))))) 6659 (^))) 6660 (t 6661 ;; There isn't any "addi" that checks for overflow, which is 6662 ;; why we didn't bother. 6663 (let* ((fix1 (acodefixnumformp form1)) 6664 (fix2 (acodefixnumformp form2)) 6665 (other (if (and fix1 6666 (typep (ash fix1 *ppc2targetfixnumshift*) 6667 '(signedbyte 32))) 6668 form2 6669 (if (and fix2 6670 (typep (ash fix2 *ppc2targetfixnumshift*) 6671 '(signedbyte 32))) 6672 form1)))) 6673 (if (and fix1 fix2) 6674 (ppc2lri seg vreg (ash (+ fix1 fix2) *ppc2targetfixnumshift*)) 6675 (if other 6676 (let* ((constant (ash (or fix1 fix2) *ppc2targetfixnumshift*)) 6677 (reg (ppc2oneuntargetedregform seg other ppc::arg_z)) 6678 (high (ldb (byte 16 16) constant)) 6679 (low (ldb (byte 16 0) constant))) 6680 (declare (fixnum high low)) 6681 (if (zerop constant) 6682 (< reg) 6683 (progn 6684 (if (logbitp 15 low) (setq high (ldb (byte 16 0) (1+ high)))) 6685 (if (and (eq vreg reg) (not (zerop high))) 6686 (withnodetemps (vreg) (temp) 6687 (! addimmediate temp reg high low) 6688 (< temp)) 6689 (ensuringnodetarget (target vreg) 6690 (! addimmediate target reg high low)))))) 6691 (multiplevaluebind (r1 r2) (ppc2twountargetedregforms seg form1 ppc::arg_y form2 ppc::arg_z) 6692 (ensuringnodetarget (target vreg) 6693 (! fixnumadd target r1 r2))))) 6694 (^))))) 6648 (let* ((fix1 (acodefixnumformp form1)) 6649 (fix2 (acodefixnumformp form2)) 6650 (sum (and fix1 fix2 (if overflow (+ fix1 fix2) (%i+ fix1 fix2))))) 6651 (cond ((null vreg) 6652 (ppc2form seg nil nil form1) 6653 (ppc2form seg nil xfer form2)) 6654 (sum 6655 (if (nx1targetfixnump sum) 6656 (ppc2useoperator (%nx1operator fixnum) seg vreg xfer sum) 6657 (ppc2useoperator (%nx1operator immediate) seg vreg xfer sum))) 6658 (overflow 6659 (multiplevaluebind (r1 r2) (ppc2twountargetedregforms seg form1 ppc::arg_y form2 ppc::arg_z) 6660 (ensuringnodetarget (target vreg) 6661 (if *ppc2opencodeinline* 6662 (! fixnumaddoverflowinline target r1 r2) 6663 (progn 6664 (! fixnumaddoverflowool r1 r2) 6665 (ppc2copyregister seg target ($ ppc::arg_z))))) 6666 (^))) 6667 (t 6668 ;; There isn't any "addi" that checks for overflow, which is 6669 ;; why we didn't bother. 6670 (let* ((other (if (and fix1 6671 (typep (ash fix1 *ppc2targetfixnumshift*) 6672 '(signedbyte 32))) 6673 form2 6674 (if (and fix2 6675 (typep (ash fix2 *ppc2targetfixnumshift*) 6676 '(signedbyte 32))) 6677 form1)))) 6678 (if (and fix1 fix2) 6679 (ppc2lri seg vreg (ash (+ fix1 fix2) *ppc2targetfixnumshift*)) 6680 (if other 6681 (let* ((constant (ash (or fix1 fix2) *ppc2targetfixnumshift*)) 6682 (reg (ppc2oneuntargetedregform seg other ppc::arg_z)) 6683 (high (ldb (byte 16 16) constant)) 6684 (low (ldb (byte 16 0) constant))) 6685 (declare (fixnum high low)) 6686 (if (zerop constant) 6687 (< reg) 6688 (progn 6689 (if (logbitp 15 low) (setq high (ldb (byte 16 0) (1+ high)))) 6690 (if (and (eq vreg reg) (not (zerop high))) 6691 (withnodetemps (vreg) (temp) 6692 (! addimmediate temp reg high low) 6693 (< temp)) 6694 (ensuringnodetarget (target vreg) 6695 (! addimmediate target reg high low)))))) 6696 (multiplevaluebind (r1 r2) (ppc2twountargetedregforms seg form1 ppc::arg_y form2 ppc::arg_z) 6697 (ensuringnodetarget (target vreg) 6698 (! fixnumadd target r1 r2))))) 6699 (^)))))) 6695 6700 6696 6701 (defppc2 ppc2%i %i (seg vreg xfer num1 num2 &optional overflow) … … 6701 6706 (setq overflow nil)))) 6702 6707 (let* ((v1 (acodefixnumformp num1)) 6703 (v2 (acodefixnumformp num2))) 6704 (if (and v1 v2) 6705 (ppc2useoperator (%nx1operator fixnum) seg vreg xfer (%i v1 v2)) 6708 (v2 (acodefixnumformp num2)) 6709 (diff (and v1 v2 (if overflow ( v1 v2) (%i v1 v2))))) 6710 (if diff 6711 (if (nx1targetfixnump diff) 6712 (ppc2useoperator (%nx1operator fixnum) seg vreg xfer diff) 6713 (ppc2useoperator (%nx1operator immediate) seg vreg xfer diff)) 6706 6714 (if (and v2 (neq v2 mostnegativefixnum)) 6707 6715 (ppc2useoperator (%nx1operator %i+) seg vreg xfer num1 (makeacode (%nx1operator fixnum) ( v2)) overflow)
Note: See TracChangeset
for help on using the changeset viewer.