$NetBSD: patch-bd,v 1.2 2002/03/28 10:11:54 jmc Exp $ --- ../gcc-2.95.3/gcc/config/vax/vax.md.orig 2000/07/26 00:18:55 1.1.1.1 +++ ../gcc-2.95.3/gcc/config/vax/vax.md 2002/03/28 06:51:36 1.16 @@ -135,20 +135,20 @@ ;; patterns need to be recognized. ;; -- Ken Raeburn (Raeburn@Watch.COM) 24 August 1991. -(define_insn "sltu" - [(set (match_operand:SI 0 "general_operand" "=ro") - (ltu (cc0) (const_int 0)))] - "" - "clrl %0\;adwc $0,%0") +;;(define_insn "sltu" +;; [(set (match_operand:SI 0 "nonimmediate_operand" "=ro") +;; (ltu (cc0) (const_int 0)))] +;; "" +;; "clrl %0\;adwc $0,%0") -(define_insn "sgeu" - [(set (match_operand:SI 0 "general_operand" "=ro") - (geu (cc0) (const_int 0)))] - "" - "movl $1,%0\;sbwc $0,%0") +;;(define_insn "sgeu" +;; [(set (match_operand:SI 0 "nonimmediate_operand" "=ro") +;; (geu (cc0) (const_int 0)))] +;; "" +;; "movl $1,%0\;sbwc $0,%0") (define_insn "movdf" - [(set (match_operand:DF 0 "general_operand" "=g,g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g,g") (match_operand:DF 1 "general_operand" "G,gF"))] "" "@ @@ -156,7 +156,7 @@ mov%# %1,%0") (define_insn "movsf" - [(set (match_operand:SF 0 "general_operand" "=g,g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g,g") (match_operand:SF 1 "general_operand" "G,gF"))] "" "@ @@ -171,7 +171,7 @@ ;; "movh %1,%0") (define_insn "movdi" - [(set (match_operand:DI 0 "general_operand" "=g,g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g,g") (match_operand:DI 1 "general_operand" "I,g"))] "" "@ @@ -194,9 +194,33 @@ ;; Loads of constants between 64 and 128 used to be done with ;; "addl3 $63,#,dst" but this is slower than movzbl and takes as much space. + +(define_expand "movsi" + [(set (match_operand:SI 0 "nonimmediate_operand" "") + (match_operand:SI 1 "general_operand" ""))] + "" + " +{ + if (GET_CODE (operands[1]) == CONST && + GET_CODE (XEXP (operands[1], 0)) == PLUS && + GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF && +#ifdef NO_EXTERNAL_INDIRECT_ADDRESS + (!flag_pic || !SYMBOL_REF_FLAG (XEXP (XEXP (operands[1], 0), 0))) && +#endif + GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT) + { + rtx symbol_ref = XEXP (XEXP (operands[1], 0), 0); + rtx const_int = XEXP (XEXP (operands[1], 0), 1); + rtx temp = gen_reg_rtx (Pmode); + emit_move_insn (temp, symbol_ref); + emit_move_insn (operands[0], + plus_constant_for_output (temp, INTVAL (const_int))); + DONE; + } +}") -(define_insn "movsi" - [(set (match_operand:SI 0 "general_operand" "=g") +(define_insn "movgensi" + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:SI 1 "general_operand" "g"))] "" "* @@ -212,14 +236,20 @@ /* Make sure the reg hasn't been clobbered. */ && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) return \"incl %0\"; - if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST) + if (GET_CODE (operands[1]) == SYMBOL_REF + || GET_CODE (operands[1]) == LABEL_REF + || GET_CODE (operands[1]) == CONST) { if (push_operand (operands[0], SImode)) return \"pushab %a1\"; return \"movab %a1,%0\"; } if (operands[1] == const0_rtx) - return \"clrl %0\"; + { + if (push_operand (operands[0], SImode)) + return \"pushl %1\"; + return \"clrl %0\"; + } if (GET_CODE (operands[1]) == CONST_INT && (unsigned) INTVAL (operands[1]) >= 64) { @@ -241,7 +271,7 @@ }") (define_insn "movhi" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (match_operand:HI 1 "general_operand" "g"))] "" "* @@ -274,7 +304,7 @@ }") (define_insn "movstricthi" - [(set (strict_low_part (match_operand:HI 0 "register_operand" "=g")) + [(set (strict_low_part (match_operand:HI 0 "register_operand" "+g")) (match_operand:HI 1 "general_operand" "g"))] "" "* @@ -295,7 +325,7 @@ }") (define_insn "movqi" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (match_operand:QI 1 "general_operand" "g"))] "" "* @@ -324,7 +354,7 @@ }") (define_insn "movstrictqi" - [(set (strict_low_part (match_operand:QI 0 "register_operand" "=g")) + [(set (strict_low_part (match_operand:QI 0 "register_operand" "+g")) (match_operand:QI 1 "general_operand" "g"))] "" "* @@ -358,8 +388,8 @@ ;; that anything generated as this insn will be recognized as one ;; and that it won't successfully combine with anything. (define_insn "movstrhi1" - [(set (match_operand:BLK 0 "general_operand" "=g") - (match_operand:BLK 1 "general_operand" "g")) + [(set (match_operand:BLK 0 "memory_operand" "=m") + (match_operand:BLK 1 "memory_operand" "m")) (use (match_operand:HI 2 "general_operand" "g")) (clobber (reg:SI 0)) (clobber (reg:SI 1)) @@ -373,67 +403,67 @@ ;; Extension and truncation insns. (define_insn "truncsiqi2" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "g")))] "" "cvtlb %1,%0") (define_insn "truncsihi2" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "g")))] "" "cvtlw %1,%0") (define_insn "trunchiqi2" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))] "" "cvtwb %1,%0") (define_insn "extendhisi2" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))] "" "cvtwl %1,%0") (define_insn "extendqihi2" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))] "" "cvtbw %1,%0") (define_insn "extendqisi2" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))] "" "cvtbl %1,%0") (define_insn "extendsfdf2" - [(set (match_operand:DF 0 "general_operand" "=g") + [(set (match_operand:DF 0 "nonimmediate_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") + [(set (match_operand:SF 0 "nonimmediate_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") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))] "" "movzwl %1,%0") (define_insn "zero_extendqihi2" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))] "" "movzbw %1,%0") (define_insn "zero_extendqisi2" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))] "" "movzbl %1,%0") @@ -441,37 +471,37 @@ ;; Fix-to-float conversion insns. (define_insn "floatsisf2" - [(set (match_operand:SF 0 "general_operand" "=g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g") (float:SF (match_operand:SI 1 "nonimmediate_operand" "g")))] "" "cvtlf %1,%0") (define_insn "floatsidf2" - [(set (match_operand:DF 0 "general_operand" "=g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g") (float:DF (match_operand:SI 1 "nonimmediate_operand" "g")))] "" "cvtl%# %1,%0") (define_insn "floathisf2" - [(set (match_operand:SF 0 "general_operand" "=g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g") (float:SF (match_operand:HI 1 "nonimmediate_operand" "g")))] "" "cvtwf %1,%0") (define_insn "floathidf2" - [(set (match_operand:DF 0 "general_operand" "=g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g") (float:DF (match_operand:HI 1 "nonimmediate_operand" "g")))] "" "cvtw%# %1,%0") (define_insn "floatqisf2" - [(set (match_operand:SF 0 "general_operand" "=g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g") (float:SF (match_operand:QI 1 "nonimmediate_operand" "g")))] "" "cvtbf %1,%0") (define_insn "floatqidf2" - [(set (match_operand:DF 0 "general_operand" "=g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g") (float:DF (match_operand:QI 1 "nonimmediate_operand" "g")))] "" "cvtb%# %1,%0") @@ -479,37 +509,37 @@ ;; Float-to-fix conversion insns. (define_insn "fix_truncsfqi2" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_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") + [(set (match_operand:HI 0 "nonimmediate_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") + [(set (match_operand:SI 0 "nonimmediate_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") + [(set (match_operand:QI 0 "nonimmediate_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") + [(set (match_operand:HI 0 "nonimmediate_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") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))] "" "cvt%#l %1,%0") @@ -517,7 +547,7 @@ ;;- All kinds of add instructions. (define_insn "adddf3" - [(set (match_operand:DF 0 "general_operand" "=g,g,g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g,g,g") (plus:DF (match_operand:DF 1 "general_operand" "0,gF,gF") (match_operand:DF 2 "general_operand" "gF,0,gF")))] "" @@ -527,7 +557,7 @@ add%#3 %1,%2,%0") (define_insn "addsf3" - [(set (match_operand:SF 0 "general_operand" "=g,g,g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g,g,g") (plus:SF (match_operand:SF 1 "general_operand" "0,gF,gF") (match_operand:SF 2 "general_operand" "gF,0,gF")))] "" @@ -550,7 +580,7 @@ (define_insn "addsi3" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (plus:SI (match_operand:SI 1 "general_operand" "g") (match_operand:SI 2 "general_operand" "g")))] "" @@ -602,7 +632,7 @@ }") (define_insn "addhi3" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (plus:HI (match_operand:HI 1 "general_operand" "g") (match_operand:HI 2 "general_operand" "g")))] "" @@ -628,7 +658,7 @@ }") (define_insn "addqi3" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (plus:QI (match_operand:QI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" @@ -655,14 +685,14 @@ ;; The add-with-carry (adwc) instruction only accepts two operands. (define_insn "adddi3" - [(set (match_operand:DI 0 "general_operand" "=ro>,ro>") + [(set (match_operand:DI 0 "nonimmediate_operand" "=ro>,ro>") (plus:DI (match_operand:DI 1 "general_operand" "%0,ro>") (match_operand:DI 2 "general_operand" "Fro,F")))] "" "* { rtx low[3]; - char *pattern; + const char *pattern; int carry = 1; split_quadword_operands (operands, low, 3); @@ -700,7 +730,7 @@ ;;- All kinds of subtract instructions. (define_insn "subdf3" - [(set (match_operand:DF 0 "general_operand" "=g,g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g,g") (minus:DF (match_operand:DF 1 "general_operand" "0,gF") (match_operand:DF 2 "general_operand" "gF,gF")))] "" @@ -709,7 +739,7 @@ sub%#3 %2,%1,%0") (define_insn "subsf3" - [(set (match_operand:SF 0 "general_operand" "=g,g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g,g") (minus:SF (match_operand:SF 1 "general_operand" "0,gF") (match_operand:SF 2 "general_operand" "gF,gF")))] "" @@ -718,7 +748,7 @@ subf3 %2,%1,%0") (define_insn "subsi3" - [(set (match_operand:SI 0 "general_operand" "=g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g") (minus:SI (match_operand:SI 1 "general_operand" "0,g") (match_operand:SI 2 "general_operand" "g,g")))] "" @@ -727,7 +757,7 @@ subl3 %2,%1,%0") (define_insn "subhi3" - [(set (match_operand:HI 0 "general_operand" "=g,g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g") (minus:HI (match_operand:HI 1 "general_operand" "0,g") (match_operand:HI 2 "general_operand" "g,g")))] "" @@ -736,7 +766,7 @@ subw3 %2,%1,%0") (define_insn "subqi3" - [(set (match_operand:QI 0 "general_operand" "=g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g") (minus:QI (match_operand:QI 1 "general_operand" "0,g") (match_operand:QI 2 "general_operand" "g,g")))] "" @@ -746,14 +776,14 @@ ;; The subtract-with-carry (sbwc) instruction only takes two operands. (define_insn "subdi3" - [(set (match_operand:DI 0 "general_operand" "=or>,or>") + [(set (match_operand:DI 0 "nonimmediate_operand" "=or>,or>") (minus:DI (match_operand:DI 1 "general_operand" "0,or>") (match_operand:DI 2 "general_operand" "For,F")))] "" "* { rtx low[3]; - char *pattern; + const char *pattern; int carry = 1; split_quadword_operands (operands, low, 3); @@ -791,7 +821,7 @@ ;;- Multiply instructions. (define_insn "muldf3" - [(set (match_operand:DF 0 "general_operand" "=g,g,g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g,g,g") (mult:DF (match_operand:DF 1 "general_operand" "0,gF,gF") (match_operand:DF 2 "general_operand" "gF,0,gF")))] "" @@ -801,7 +831,7 @@ mul%#3 %1,%2,%0") (define_insn "mulsf3" - [(set (match_operand:SF 0 "general_operand" "=g,g,g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g,g,g") (mult:SF (match_operand:SF 1 "general_operand" "0,gF,gF") (match_operand:SF 2 "general_operand" "gF,0,gF")))] "" @@ -811,7 +841,7 @@ mulf3 %1,%2,%0") (define_insn "mulsi3" - [(set (match_operand:SI 0 "general_operand" "=g,g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g,g") (mult:SI (match_operand:SI 1 "general_operand" "0,g,g") (match_operand:SI 2 "general_operand" "g,0,g")))] "" @@ -821,7 +851,7 @@ mull3 %1,%2,%0") (define_insn "mulhi3" - [(set (match_operand:HI 0 "general_operand" "=g,g,") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g,") (mult:HI (match_operand:HI 1 "general_operand" "0,g,g") (match_operand:HI 2 "general_operand" "g,0,g")))] "" @@ -831,7 +861,7 @@ mulw3 %1,%2,%0") (define_insn "mulqi3" - [(set (match_operand:QI 0 "general_operand" "=g,g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g,g") (mult:QI (match_operand:QI 1 "general_operand" "0,g,g") (match_operand:QI 2 "general_operand" "g,0,g")))] "" @@ -841,7 +871,7 @@ mulb3 %1,%2,%0") (define_insn "mulsidi3" - [(set (match_operand:DI 0 "general_operand" "=g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "g")) (sign_extend:DI @@ -850,7 +880,7 @@ "emul %1,%2,$0,%0") (define_insn "" - [(set (match_operand:DI 0 "general_operand" "=g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (plus:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "g")) @@ -862,7 +892,7 @@ ;; 'F' constraint means type CONST_DOUBLE (define_insn "" - [(set (match_operand:DI 0 "general_operand" "=g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (plus:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "g")) @@ -881,7 +911,7 @@ ;;- Divide instructions. (define_insn "divdf3" - [(set (match_operand:DF 0 "general_operand" "=g,g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g,g") (div:DF (match_operand:DF 1 "general_operand" "0,gF") (match_operand:DF 2 "general_operand" "gF,gF")))] "" @@ -890,7 +920,7 @@ div%#3 %2,%1,%0") (define_insn "divsf3" - [(set (match_operand:SF 0 "general_operand" "=g,g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g,g") (div:SF (match_operand:SF 1 "general_operand" "0,gF") (match_operand:SF 2 "general_operand" "gF,gF")))] "" @@ -899,7 +929,7 @@ divf3 %2,%1,%0") (define_insn "divsi3" - [(set (match_operand:SI 0 "general_operand" "=g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g") (div:SI (match_operand:SI 1 "general_operand" "0,g") (match_operand:SI 2 "general_operand" "g,g")))] "" @@ -908,7 +938,7 @@ divl3 %2,%1,%0") (define_insn "divhi3" - [(set (match_operand:HI 0 "general_operand" "=g,g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g") (div:HI (match_operand:HI 1 "general_operand" "0,g") (match_operand:HI 2 "general_operand" "g,g")))] "" @@ -917,7 +947,7 @@ divw3 %2,%1,%0") (define_insn "divqi3" - [(set (match_operand:QI 0 "general_operand" "=g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g") (div:QI (match_operand:QI 1 "general_operand" "0,g") (match_operand:QI 2 "general_operand" "g,g")))] "" @@ -939,7 +969,7 @@ ;; Bit-and on the vax is done with a clear-bits insn. (define_expand "andsi3" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (and:SI (not:SI (match_operand:SI 1 "general_operand" "g")) (match_operand:SI 2 "general_operand" "g")))] "" @@ -962,7 +992,7 @@ }") (define_expand "andhi3" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (and:HI (not:HI (match_operand:HI 1 "general_operand" "g")) (match_operand:HI 2 "general_operand" "g")))] "" @@ -984,7 +1014,7 @@ }") (define_expand "andqi3" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (and:QI (not:QI (match_operand:QI 1 "general_operand" "g")) (match_operand:QI 2 "general_operand" "g")))] "" @@ -1006,7 +1036,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g") (and:SI (not:SI (match_operand:SI 1 "general_operand" "g,g")) (match_operand:SI 2 "general_operand" "0,g")))] "" @@ -1015,7 +1045,7 @@ bicl3 %1,%2,%0") (define_insn "" - [(set (match_operand:HI 0 "general_operand" "=g,g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g") (and:HI (not:HI (match_operand:HI 1 "general_operand" "g,g")) (match_operand:HI 2 "general_operand" "0,g")))] "" @@ -1024,7 +1054,7 @@ bicw3 %1,%2,%0") (define_insn "" - [(set (match_operand:QI 0 "general_operand" "=g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g") (and:QI (not:QI (match_operand:QI 1 "general_operand" "g,g")) (match_operand:QI 2 "general_operand" "0,g")))] "" @@ -1038,7 +1068,7 @@ ;; opportunities in combine.c. (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g") (and:SI (match_operand:SI 1 "general_operand" "0,g") (match_operand:SI 2 "const_int_operand" "n,n")))] "" @@ -1047,7 +1077,7 @@ bicl3 %N2,%1,%0") (define_insn "" - [(set (match_operand:HI 0 "general_operand" "=g,g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g") (and:HI (match_operand:HI 1 "general_operand" "0,g") (match_operand:HI 2 "const_int_operand" "n,n")))] "" @@ -1056,7 +1086,7 @@ bicw3 %H2,%1,%0") (define_insn "" - [(set (match_operand:QI 0 "general_operand" "=g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g") (and:QI (match_operand:QI 1 "general_operand" "0,g") (match_operand:QI 2 "const_int_operand" "n,n")))] "" @@ -1067,7 +1097,7 @@ ;;- Bit set instructions. (define_insn "iorsi3" - [(set (match_operand:SI 0 "general_operand" "=g,g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g,g") (ior:SI (match_operand:SI 1 "general_operand" "0,g,g") (match_operand:SI 2 "general_operand" "g,0,g")))] "" @@ -1077,7 +1107,7 @@ bisl3 %2,%1,%0") (define_insn "iorhi3" - [(set (match_operand:HI 0 "general_operand" "=g,g,g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g,g") (ior:HI (match_operand:HI 1 "general_operand" "0,g,g") (match_operand:HI 2 "general_operand" "g,0,g")))] "" @@ -1087,7 +1117,7 @@ bisw3 %2,%1,%0") (define_insn "iorqi3" - [(set (match_operand:QI 0 "general_operand" "=g,g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g,g") (ior:QI (match_operand:QI 1 "general_operand" "0,g,g") (match_operand:QI 2 "general_operand" "g,0,g")))] "" @@ -1099,7 +1129,7 @@ ;;- xor instructions. (define_insn "xorsi3" - [(set (match_operand:SI 0 "general_operand" "=g,g,g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g,g,g") (xor:SI (match_operand:SI 1 "general_operand" "0,g,g") (match_operand:SI 2 "general_operand" "g,0,g")))] "" @@ -1109,7 +1139,7 @@ xorl3 %2,%1,%0") (define_insn "xorhi3" - [(set (match_operand:HI 0 "general_operand" "=g,g,g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g,g,g") (xor:HI (match_operand:HI 1 "general_operand" "0,g,g") (match_operand:HI 2 "general_operand" "g,0,g")))] "" @@ -1119,7 +1149,7 @@ xorw3 %2,%1,%0") (define_insn "xorqi3" - [(set (match_operand:QI 0 "general_operand" "=g,g,g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g,g,g") (xor:QI (match_operand:QI 1 "general_operand" "0,g,g") (match_operand:QI 2 "general_operand" "g,0,g")))] "" @@ -1129,49 +1159,49 @@ xorb3 %2,%1,%0") (define_insn "negdf2" - [(set (match_operand:DF 0 "general_operand" "=g") + [(set (match_operand:DF 0 "nonimmediate_operand" "=g") (neg:DF (match_operand:DF 1 "general_operand" "gF")))] "" "mneg%# %1,%0") (define_insn "negsf2" - [(set (match_operand:SF 0 "general_operand" "=g") + [(set (match_operand:SF 0 "nonimmediate_operand" "=g") (neg:SF (match_operand:SF 1 "general_operand" "gF")))] "" "mnegf %1,%0") (define_insn "negsi2" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (neg:SI (match_operand:SI 1 "general_operand" "g")))] "" "mnegl %1,%0") (define_insn "neghi2" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (neg:HI (match_operand:HI 1 "general_operand" "g")))] "" "mnegw %1,%0") (define_insn "negqi2" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (neg:QI (match_operand:QI 1 "general_operand" "g")))] "" "mnegb %1,%0") (define_insn "one_cmplsi2" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (not:SI (match_operand:SI 1 "general_operand" "g")))] "" "mcoml %1,%0") (define_insn "one_cmplhi2" - [(set (match_operand:HI 0 "general_operand" "=g") + [(set (match_operand:HI 0 "nonimmediate_operand" "=g") (not:HI (match_operand:HI 1 "general_operand" "g")))] "" "mcomw %1,%0") (define_insn "one_cmplqi2" - [(set (match_operand:QI 0 "general_operand" "=g") + [(set (match_operand:QI 0 "nonimmediate_operand" "=g") (not:QI (match_operand:QI 1 "general_operand" "g")))] "" "mcomb %1,%0") @@ -1182,32 +1212,32 @@ ;; prevents converting shifts to ZERO_EXTRACTs with negative positions, ;; which isn't valid. (define_expand "ashrsi3" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (ashiftrt:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" " { if (GET_CODE (operands[2]) != CONST_INT) - operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2])); + operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2])); }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (ashiftrt:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "const_int_operand" "n")))] "" "ashl $%n2,%1,%0") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (ashiftrt:SI (match_operand:SI 1 "general_operand" "g") (neg:QI (match_operand:QI 2 "general_operand" "g"))))] "" "ashl %2,%1,%0") (define_insn "ashlsi3" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (ashift:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" @@ -1231,24 +1261,24 @@ ;; Arithmetic right shift on the vax works by negating the shift count. (define_expand "ashrdi3" - [(set (match_operand:DI 0 "general_operand" "=g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (ashiftrt:DI (match_operand:DI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" " { - operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2])); + operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2])); }") (define_insn "ashldi3" - [(set (match_operand:DI 0 "general_operand" "=g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (ashift:DI (match_operand:DI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" "ashq %2,%1,%0") (define_insn "" - [(set (match_operand:DI 0 "general_operand" "=g") + [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (ashiftrt:DI (match_operand:DI 1 "general_operand" "g") (neg:QI (match_operand:QI 2 "general_operand" "g"))))] "" @@ -1263,7 +1293,7 @@ [(set (match_dup 3) (minus:QI (const_int 32) (match_dup 4))) - (set (match_operand:SI 0 "general_operand" "=g") + (set (match_operand:SI 0 "nonimmediate_operand" "=g") (zero_extract:SI (match_operand:SI 1 "register_operand" "r") (match_dup 3) (match_operand:SI 2 "register_operand" "g")))] @@ -1276,32 +1306,32 @@ ;; Rotate right on the vax works by negating the shift count. (define_expand "rotrsi3" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (rotatert:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" " { if (GET_CODE (operands[2]) != CONST_INT) - operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2])); + operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2])); }") (define_insn "rotlsi3" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (rotate:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "general_operand" "g")))] "" "rotl %2,%1,%0") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (rotatert:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "const_int_operand" "n")))] "" "rotl %R2,%1,%0") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (rotatert:SI (match_operand:SI 1 "general_operand" "g") (neg:QI (match_operand:QI 2 "general_operand" "g"))))] "" @@ -1309,7 +1339,7 @@ ;This insn is probably slower than a multiply and an add. ;(define_insn "" -; [(set (match_operand:SI 0 "general_operand" "=g") +; [(set (match_operand:SI 0 "nonimmediate_operand" "=g") ; (mult:SI (plus:SI (match_operand:SI 1 "general_operand" "g") ; (match_operand:SI 2 "general_operand" "g")) ; (match_operand:SI 3 "general_operand" "g")))] @@ -1348,7 +1378,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=&g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=&g") (zero_extract:SI (match_operand:SI 1 "register_operand" "ro") (match_operand:QI 2 "const_int_operand" "n") (match_operand:SI 3 "const_int_operand" "n")))] @@ -1373,7 +1403,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (sign_extract:SI (match_operand:SI 1 "register_operand" "ro") (match_operand:QI 2 "const_int_operand" "n") (match_operand:SI 3 "const_int_operand" "n")))] @@ -1425,7 +1455,7 @@ ;; anyway, we can't allow immediate values for the primary source operand. (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (sign_extract:SI (match_operand:SI 1 "register_operand" "ro") (match_operand:QI 2 "general_operand" "g") (match_operand:SI 3 "general_operand" "g")))] @@ -1442,7 +1472,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (zero_extract:SI (match_operand:SI 1 "register_operand" "ro") (match_operand:QI 2 "general_operand" "g") (match_operand:SI 3 "general_operand" "g")))] @@ -1488,7 +1518,7 @@ "cmpzv %2,%1,%0,%3") (define_insn "extv" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (sign_extract:SI (match_operand:QI 1 "memory_operand" "m") (match_operand:QI 2 "general_operand" "g") (match_operand:SI 3 "general_operand" "g")))] @@ -1517,7 +1547,7 @@ "") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (zero_extract:SI (match_operand:QI 1 "memory_operand" "m") (match_operand:QI 2 "general_operand" "g") (match_operand:SI 3 "general_operand" "g")))] @@ -1602,7 +1632,9 @@ (label_ref (match_operand 0 "" "")) (pc)))] "" - "jgtru %l0") + "* + OUTPUT_JUMP(\"jgtru %l0\", 0, \"jneq %l0\"); + ") (define_insn "blt" [(set (pc) @@ -1620,7 +1652,9 @@ (label_ref (match_operand 0 "" "")) (pc)))] "" - "jlssu %l0") + "* + OUTPUT_JUMP(\"jlssu %l0\", 0, 0); + ") (define_insn "bge" [(set (pc) @@ -1638,7 +1672,9 @@ (label_ref (match_operand 0 "" "")) (pc)))] "" - "jgequ %l0") + "* + OUTPUT_JUMP(\"jgequ %l0\", 0, 0); + ") (define_insn "ble" [(set (pc) @@ -1656,10 +1692,12 @@ (label_ref (match_operand 0 "" "")) (pc)))] "" - "jlequ %l0") + "* + OUTPUT_JUMP(\"jlequ %l0\", NULL, \"jeql %l0\"); + ") ;; Recognize reversed jumps. -(define_insn "" +(define_insn "*rbr" [(set (pc) (if_then_else (match_operator 0 "comparison_operator" [(cc0) @@ -1667,7 +1705,19 @@ (pc) (label_ref (match_operand 1 "" ""))))] "" - "j%C0 %l1") ; %C0 negates condition + "* + if ((cc_status.flags & CC_NO_OVERFLOW) != 0) + { + if (GET_CODE (operands[0]) == LTU + || GET_CODE (operands[0]) == GEU) + fatal (\"Cannot reverse branch\"); + if (GET_CODE (operands[0]) == GTU) + return \"jeql %l0\"; + if (GET_CODE (operands[0]) == LEU) + return \"jneq %l0\"; + } + return \"j%C0 %l1\"; /* %C0 negates condition */ + ") ;; Recognize jbs, jlbs, jbc and jlbc instructions. Note that the operand ;; of jlbs and jlbc insns are SImode in the hardware. However, if it is @@ -1840,63 +1890,66 @@ ;; It is used in the call instruction as a byte, but in the addl2 as ;; a word. Since the only time we actually use it in the call instruction ;; is when it is a constant, SImode (for addl2) is the proper mode. -(define_insn "call_pop" +(define_expand "call_pop" + [(parallel [(call (match_operand:QI 0 "memory_operand" "") + (match_operand:SI 1 "const_int_operand" "")) + (set (reg:SI 14) + (plus:SI (reg:SI 14) + (match_operand:SI 3 "immediate_operand" "")))])] + "" + " +{ + if (INTVAL (operands[1]) > 255 * 4) + abort (); + operands[1] = GEN_INT ((INTVAL (operands[1]) + 3)/ 4); +}") + +(define_insn "*call_pop" [(call (match_operand:QI 0 "memory_operand" "m") (match_operand:SI 1 "const_int_operand" "n")) (set (reg:SI 14) (plus:SI (reg:SI 14) - (match_operand:SI 3 "immediate_operand" "i")))] + (match_operand:SI 2 "immediate_operand" "i")))] "" - "* - if (INTVAL (operands[1]) > 255 * 4) - /* Vax `calls' really uses only one byte of #args, so pop explicitly. */ - return \"calls $0,%0\;addl2 %1,sp\"; - operands[1] = GEN_INT ((INTVAL (operands[1]) + 3)/ 4); - return \"calls %1,%0\"; -") + "calls %1,%0") -(define_insn "call_value_pop" - [(set (match_operand 0 "" "=g") +(define_expand "call_value_pop" + [(parallel [(set (match_operand 0 "" "") + (call (match_operand:QI 1 "memory_operand" "") + (match_operand:SI 2 "const_int_operand" ""))) + (set (reg:SI 14) + (plus:SI (reg:SI 14) + (match_operand:SI 4 "immediate_operand" "")))])] + "" + " +{ + if (INTVAL (operands[2]) > 255 * 4) + abort (); + operands[2] = GEN_INT ((INTVAL (operands[2]) + 3)/ 4); +}") + +(define_insn "*call_value_pop" + [(set (match_operand 0 "" "") (call (match_operand:QI 1 "memory_operand" "m") (match_operand:SI 2 "const_int_operand" "n"))) (set (reg:SI 14) (plus:SI (reg:SI 14) - (match_operand:SI 4 "immediate_operand" "i")))] + (match_operand:SI 3 "immediate_operand" "i")))] "" - "* - if (INTVAL (operands[2]) > 255 * 4) - /* Vax `calls' really uses only one byte of #args, so pop explicitly. */ - return \"calls $0,%1\;addl2 %2,sp\"; - operands[2] = GEN_INT ((INTVAL (operands[2]) + 3)/ 4); - return \"calls %2,%1\"; -") + "calls %2,%1") -;; Define another set of these for the case of functions with no -;; operands. In that case, combine may simplify the adjustment of sp. -(define_insn "" +;; Define another set of these for the case of functions with no operands. +;; These will allow the optimizers to do a slightly better job. +(define_insn "call" [(call (match_operand:QI 0 "memory_operand" "m") - (match_operand:SI 1 "const_int_operand" "n")) - (set (reg:SI 14) (reg:SI 14))] + (const_int 0))] "" - "* - if (INTVAL (operands[1]) > 255 * 4) - /* Vax `calls' really uses only one byte of #args, so pop explicitly. */ - return \"calls $0,%0\;addl2 %1,sp\"; - operands[1] = GEN_INT ((INTVAL (operands[1]) + 3)/ 4); - return \"calls %1,%0\"; -") + "calls $0,%0") -(define_insn "" - [(set (match_operand 0 "" "=g") +(define_insn "call_value" + [(set (match_operand 0 "" "") (call (match_operand:QI 1 "memory_operand" "m") - (match_operand:SI 2 "const_int_operand" "n"))) - (set (reg:SI 14) (reg:SI 14))] + (const_int 0)))] "" - "* - if (INTVAL (operands[2]) > 255 * 4) - /* Vax `calls' really uses only one byte of #args, so pop explicitly. */ - return \"calls $0,%1\;addl2 %2,sp\"; - operands[2] = GEN_INT ((INTVAL (operands[2]) + 3)/ 4); - return \"calls %2,%1\"; -") + "calls $0,%1") ;; Call subroutine returning any type. @@ -1949,7 +2002,7 @@ ;; If you are tempted to try `g', please don't--it's not worth ;; the risk we will reopen the same bug. (define_insn "indirect_jump" - [(set (pc) (match_operand:SI 0 "general_operand" "r"))] + [(set (pc) (match_operand:SI 0 "register_operand" "r"))] "" "jmp (%0)") @@ -2003,7 +2056,7 @@ (mult:SI (minus:SI (match_dup 0) (const_int 0)) (const_int 2))))) - (label_ref:SI (match_operand 3 "" ""))) + (label_ref:SI (match_operand 2 "" ""))) (pc)))] "" "casel %0,$0,%1") @@ -2017,7 +2070,7 @@ ;; because < matches any autodecrement, not just a push. (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:QI 1 "address_operand" "p"))] "" "* @@ -2029,7 +2082,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:HI 1 "address_operand" "p"))] "" "* @@ -2041,7 +2094,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:SI 1 "address_operand" "p"))] "" "* @@ -2053,7 +2106,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:DI 1 "address_operand" "p"))] "" "* @@ -2065,7 +2118,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:SF 1 "address_operand" "p"))] "" "* @@ -2077,7 +2130,7 @@ }") (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g") + [(set (match_operand:SI 0 "nonimmediate_operand" "=g") (match_operand:DF 1 "address_operand" "p"))] "" "* @@ -2102,7 +2155,7 @@ ;; above sequences to before attempting to recognize the new insn. (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=ro") + [(set (match_operand:SI 0 "nonimmediate_operand" "=ro") (and:SI (ashiftrt:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n")))] @@ -2124,13 +2177,14 @@ ;; optimized away. (define_insn "" - [(set (match_operand:SI 0 "general_operand" "=ro") + [(set (match_operand:SI 0 "nonimmediate_operand" "=ro") (and:SI (ashift:SI (match_operand:SI 1 "general_operand" "g") (match_operand:QI 2 "const_int_operand" "n")) (match_operand:SI 3 "const_int_operand" "n")))] "" "* { - operands[3] = GEN_INT (INTVAL (operands[3]) & ~((1 << INTVAL (operands[2])) - 1)); + operands[3] + = GEN_INT (INTVAL (operands[3]) & ~((1 << INTVAL (operands[2])) - 1)); return \"rotl %2,%1,%0\;bicl2 %N3,%0\"; }")