Hi Sun

Are you reviewing this one?

-Mei

-----Original Message-----
From: Sun Chan [mailto:sun.c...@gmail.com] 
Sent: Wednesday, May 18, 2011 2:41 PM
To: Ye, Mei
Cc: open64-devel@lists.sourceforge.net
Subject: Re: [Open64-devel] code review - more if-merging transformations

why is this xform better? If comp is false, you have added extra compare needed.
Sun

On Thu, May 19, 2011 at 2:52 AM, Ye, Mei <mei...@amd.com> wrote:
> Attached are two patches.  Patch1 does a transformation as explained below.
> Patch2 changes the interface of a function call returning two values.
>
>
>
> Problem:
>
>  In the code shown below, the first if-condition has an explicit cast to
>  "unsigned long long", since "comp" is an "int", so it will need to be
>  casted to a "signed 64 bit" followed by an unsigned" cast before its  value
> is bit-anded.  If "comp" is a negative value, and "width - 1" is  greater or
> equal to "32", the 1st if-condition can be evaluated to "TRUE",  and the 2nd
> if-condition can be evaluated to "FALSE". Therefore, it is  illegal to
> if-merging them.
>
>  if (comp & ((unsigned long long) 1 << (width - 1))) {
>
>      ....
>
> }
>
> else {
>
>      ...
>
> }
>
>  if (comp & (1<<(width-1))) {
>
>    ....
>
> }
>
> else {
>
>      ....
>
> }
>
>  Solution:
>
>  If we create a if-condition "if (width <= 32)" and wrap it around the if-
> regions, we can remove the conversion in the THEN-path of the first if-
> region.  Therefore we can if-merge the THEN-paths.
>
>
>
>  if (width <= 32) {
>
>    if (comp & ( 1 << (width - 1))) {
>
>    }
>
>    else {
>
>     ....
>
>    }
>
> }
>
> else {
>
>     if (comp & ((unsigned long long) 1 << (width - 1))) {
>
>       ...
>
>     }
>
>     else {
>
>      ...
>
>     }
>
> }
>
>  .....
>
>  if (width <= 32) {
>
>     if (comp & ( 1 << (width - 1))) {
>
>      ...
>
>     }
>
>     else {
>
>     ...
>
>     }
>
> }
>
> else {
>
>     if (comp & ( 1 << (width - 1))) {
>
>       ...
>
>     }
>
>     else {
>
>       ...
>
>     }
>
> }
>
>
>
>  changes:
>
>  opt_proactive.cxx
>
> Pattern match and invoke transformations as described above.  Also add code
> to infer values when possible.
>
>  opt_cfg.[h,cxx]
>
> Add code to Insert a SC_IF.
>
>  opt_wn.cxx
>
> Add code to evaluate a multiply operation.
>
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its
> next-generation tools to help Windows* and Linux* C/C++ and Fortran
> developers boost performance applications - including clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel



------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to