This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: PR rtl-optimization/44695: [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117


On Thu, Jul 1, 2010 at 7:18 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>> Why isn't HImode on operand 1 OK?
>
> Because modes don't match between the div and its operands.
>
>>> My comment in the PR is based on how GCC handles extension of the
>>> dividend for 16/32/64 bit operands.
>>>
>>
>> Your suggestion generate a pattern unsupported by hardware
>> before reload
>
> That's what 16/32/64 bit operands do too
>
> (define_expand "divmod<mode>4"
> ?[(parallel [(set (match_operand:SWIM248 0 "register_operand" "")
> ? ? ? ? ? ? ? ? ? (div:SWIM248
> ? ? ? ? ? ? ? ? ? ? (match_operand:SWIM248 1 "register_operand" "")
> ? ? ? ? ? ? ? ? ? ? (match_operand:SWIM248 2 "nonimmediate_operand" "")))
> ? ? ? ? ? ? ?(set (match_operand:SWIM248 3 "register_operand" "")
> ? ? ? ? ? ? ? ? ? (mod:SWIM248 (match_dup 1) (match_dup 2)))
> ? ? ? ? ? ? ?(clobber (reg:CC FLAGS_REG))])]
> ?""
> ?"")

For 16/32/64 bit divide, since dividend is in AX/DX, we can set
DX after reload. For 8bit, dividend is in AX.  We want to set
dividend properly before reload to avoid extra extension.

>
>> and introduces an extra register move during split to fix it.
>
> I think you mean one extra extension? ?That's possible, though it could be

Yes.

> fixed in combine using nonzero_bits or num_sign_bit_copies.
>
> Anyway, can you please post the patch and the result? ?I think you should go
> one step at a time and first fix this bug, then optimize it.
>

While working on it, I noticed that <u>divmodqi4 had mod, which
is wrong for unsigned divmod. There should be divmodqi4 and
udivmodqi4.  This patch fixes it.  It also uses subreg:QI on operand 1
in divmodhiqi3 and udivmodhiqi3.  Does it look OK?

Thanks.


-- 
H.J.
---
gcc/

2010-07-01  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/44695
	* config/i386/i386.md (extract_code): Removed.
	(<u>divmodqi4): Likewise.
	(divmodqi4): New.
	(udivmodqi4): Likewise.
	(divmodhiqi3): Use subreg:QI on operand 1.
	(udivmodhiqi3): Likewise.

gcc/testsuite/

2010-07-01  H.J. Lu  <hongjiu.lu@intel.com>

	PR rtl-optimization/44695
	* gcc.dg/torture/pr44695.c: New.

Attachment: gcc-pr44695-5.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]