On Wed, Apr 16, 2014 at 02:45:28PM -0600, Jeff Law wrote: > Isn't the problem that operands 1 is a MEM which use the same register > as operands 3 in the memory address?
Yes, exactly. > ISTM either removing the memory constraint entirely, or splitting it off > into a separate alternative and only earlyclobbering that alternative > would be better. > > Or am I missing something? No, that does seem better :-) I tried both your suggestions; the first results in better code. Here's a new patch. As before, it builds and fixes the testcase, but I didn't run the testsuite (I have no emulator set up). Thanks, Segher gcc/ PR target/60822 2014-04-16 Segher Boessenkool <seg...@kernel.crashing.org> * config/m68k/m68k.md (extendplussidi): Don't allow memory for operand 1. --- gcc/config/m68k/m68k.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index e61048b..57ba1a1 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -1868,9 +1868,12 @@ (define_insn "extendsidi2" ;; Maybe there is a way to make that the general case, by forcing the ;; result of the SI tree to be in the lower register of the DI target +;; Don't allow two memory operands: it needs an earlyclobber and will +;; result in worse code. + (define_insn "extendplussidi" [(set (match_operand:DI 0 "register_operand" "=d") - (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn") + (sign_extend:DI (plus:SI (match_operand:SI 1 "nonmemory_operand" "%rn") (match_operand:SI 2 "general_operand" "rmn"))))] "" { -- 1.8.1.4