PATCH RFC: With -fnon-call-exceptions don't eliminate division by zero
Ian Lance Taylor
iant@google.com
Mon Oct 11 22:29:00 GMT 2010
Andrew Pinski <pinskia@gmail.com> writes:
> On Mon, Oct 11, 2010 at 2:16 PM, Ian Lance Taylor <iant@google.com> wrote:
>> The -fnon-call-exceptions options indicates that certain operations,
>> including division by zero, should generate an exception. This includes
>> cases like 0 / 0. This patch ensures that 0 / 0 and any other division
>> by zero is not eliminated when -fnon-call-exceptions is used. This
>> includes a test case which fails without the patch and passes with the
>> patch.
>>
>> This patch is entirely in the middle-end so I don't require approval.
>> However, I would like to see if there are any comments before I commit
>> this. Thanks.
>
> The testcase will never work on powerpc or spu or any other target
> where dividing by zero does not cause an exception to happen. (MIPS
> does a specific check for 0 and causes a trap).
Thanks. I changed the test to the appended. Are there other targets
which should be excluded?
> Not to mention I think on those targets we should remove the divide by
> zero still as they did not cause an exception to happen.
I don't think it's worth worrying about that minor optimization for an
unusual case. Remember that this is only when using
-fnon-call-exceptions.
Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20101011-1.c
Type: text/x-csrc
Size: 886 bytes
Desc: 20101011-1.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101011/3bf49999/attachment.bin>
More information about the Gcc-patches
mailing list