harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiaoming Gu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-5901) [drlvm][jit]integer MUL & DIV strength reduction
Date Mon, 22 Sep 2008 08:56:44 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-5901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Xiaoming Gu updated HARMONY-5901:
---------------------------------

    Attachment: H5901-V7.patch

This message is for H5901-V7.patch.

In this patch, I fixed some bugs for REM (remainder) strength reduction and merged H5965 to
H5901.

The first bug in REM reduction is that the code forgot to take absolute before calling whichPowerOf2.
But even with this bug fixed, it's not correct. The formula behind the reduction when with
negative divisor is src1%X=(src1&((1<<k)-1)) | (-1^((1<<k)-1)) assuming X=-2^k.
We get -9%-8=-1 and 9%-8=-7. Tha latter is wrong. It's changed to use src1%X=src1-(src1/X)*X
to get the correct result. Thanks for Ian Rogers pointing out the bugs.

I'm working on the left work for MUL strength reduction.

> [drlvm][jit]integer MUL & DIV strength reduction
> ------------------------------------------------
>
>                 Key: HARMONY-5901
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5901
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Xiaoming Gu
>         Attachments: 5901.patch, H5901-V2.patch, H5901-V3.patch, H5901-V4.patch, H5901-V5.patch,
H5901-V6.patch, H5901-V7.patch
>
>
> 1. Mulitiplication replacement
>     a. It's about integer multiplication.
>     b. One of two multipliers is a power of 2.
>     c. The power of 2 could be negative.
>     For example, 23*4 is transformed to 23<<2 and 23*(-4) is transformed to (23<<2)*(-1).
> 2. Division replacement
>     a. It's about integer division.
>     b. The divisor is a power of 2.
>     c. The power of 2 could be negative.
>     d. Because of round-up difference between division and shift right, the following
equations from Aleksey are used.
>               Baseline: q = a / (1 << d);
>               Optimized: q = (a + [(1 << d) - 1] & (a >> 31)) >>
d;
>     For example, 23/4 is transformed to  (23+((1<<2)-1)&(23>>31))>>2.
and (-23)/(-4) is transformed to ((-23+((1<<2)-1)&(-23>>31))>>2)*(-1).
> 3. Comments for SAR and SHR swapped
>      The comments for the two similar operations were misplaced in working_vm/vm/port/src/encoder/ia32_em64t.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message