From 2b39f5137a9db4939fd23d39de63257467986f80 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sat, 5 Dec 2020 18:26:26 +0000 Subject: [PATCH] VAX: Fix predicates for widening multiply and multiply-add insns It makes no sense for insn operand predicates, as long as they accept a register operand, to be more restrictive than the set of the associated constraints, because expand will choose the insn based on the relevant operand being a pseudo register then and reload will keep it happily as an immediate if a constraint permits it. So the restriction posed by such a predicate will be happily ignored, and moreover if a splitter is added, such as required for MODE_CC support, the new instructions will reject the original operands supplied, causing an ICE like below: .../gcc/testsuite/gfortran.dg/graphite/PR67518.f90:44:0: Error: could not split insn (insn 90 662 663 (set (reg:DI 10 %r10 [orig:97 _235 ] [97]) (mult:DI (sign_extend:DI (mem/c:SI (plus:SI (reg/f:SI 13 %fp) (const_int -800 [0xfffffffffffffce0])) [14 %sfp+-800 S4 A32])) (sign_extend:DI (const_int -51 [0xffffffffffffffcd])))) 299 {mulsidi3} (expr_list:REG_EQUAL (mult:DI (sign_extend:DI (subreg:SI (mem/c:DI (plus:SI (reg/f:SI 13 %fp) (const_int -800 [0xfffffffffffffce0])) [14 %sfp+-800 S8 A32]) 0)) (const_int -51 [0xffffffffffffffcd])) (nil))) during RTL pass: final .../gcc/testsuite/gfortran.dg/graphite/PR67518.f90:44:0: internal compiler error: in final_scan_insn_1, at final.c:3073 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Change the predicates used with the widening multiply and multiply-add insns to allow immediates then, just as the constraints and the machine instructions produced permit. Also give the insns names, for easier reference here and elsewhere. gcc/ * config/vax/vax.md (mulsidi3): Fix the multiplicand predicates. (*maddsidi4, *maddsidi4_const): Likewise. Name insns. --- gcc/config/vax/vax.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md index 34fdf67..2f6643a 100644 --- a/gcc/config/vax/vax.md +++ b/gcc/config/vax/vax.md @@ -445,35 +445,32 @@ (define_insn "mulsidi3" [(set (match_operand:DI 0 "nonimmediate_operand" "=g") - (mult:DI (sign_extend:DI - (match_operand:SI 1 "nonimmediate_operand" "nrmT")) - (sign_extend:DI - (match_operand:SI 2 "nonimmediate_operand" "nrmT"))))] + (mult:DI + (sign_extend:DI (match_operand:SI 1 "general_operand" "nrmT")) + (sign_extend:DI (match_operand:SI 2 "general_operand" "nrmT"))))] "" "emul %1,%2,$0,%0") -(define_insn "" +(define_insn "*maddsidi4" [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (plus:DI - (mult:DI (sign_extend:DI - (match_operand:SI 1 "nonimmediate_operand" "nrmT")) - (sign_extend:DI - (match_operand:SI 2 "nonimmediate_operand" "nrmT"))) - (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "g"))))] + (mult:DI + (sign_extend:DI (match_operand:SI 1 "general_operand" "nrmT")) + (sign_extend:DI (match_operand:SI 2 "general_operand" "nrmT"))) + (sign_extend:DI (match_operand:SI 3 "general_operand" "g"))))] "" "emul %1,%2,%3,%0") ;; 'F' constraint means type CONST_DOUBLE -(define_insn "" +(define_insn "*maddsidi4_const" [(set (match_operand:DI 0 "nonimmediate_operand" "=g") (plus:DI - (mult:DI (sign_extend:DI - (match_operand:SI 1 "nonimmediate_operand" "nrmT")) - (sign_extend:DI - (match_operand:SI 2 "nonimmediate_operand" "nrmT"))) - (match_operand:DI 3 "immediate_operand" "F")))] + (mult:DI + (sign_extend:DI (match_operand:SI 1 "general_operand" "nrmT")) + (sign_extend:DI (match_operand:SI 2 "general_operand" "nrmT"))) + (match_operand:DI 3 "immediate_operand" "F")))] "GET_CODE (operands[3]) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (operands[3]) == (CONST_DOUBLE_LOW (operands[3]) >> 31)" + && CONST_DOUBLE_HIGH (operands[3]) == (CONST_DOUBLE_LOW (operands[3]) >> 31)" "* { if (CONST_DOUBLE_HIGH (operands[3])) -- 2.7.4