Harold, Looks good. Thanks for the work!

Jerry

On 9/20/20 11:10 AM, Harald Anlauf wrote:
*ping*

Gesendet: Sonntag, 13. September 2020 um 23:24 Uhr
Von: "Harald Anlauf" <anl...@gmx.de>
An: "fortran" <fort...@gcc.gnu.org>, "gcc-patches" <gcc-patches@gcc.gnu.org>
Cc: "Paul Richard Thomas" <paul.richard.tho...@gmail.com>
Betreff: [PATCH] PR fortran/90903 [part2] Add runtime checking for the MVBITS 
intrinsic

Dear all,

finally here comes the second part of runtime checks for the bit
manipulation intrinsics, this time MVBITS.  This turned out to be
more elaborate than the treatment of simple function calls.

I chose the path to inline expand MVBITS, which enables additional
optimization opportunities in some cases, such as constant arguments.
For the case of scalar arguments, this was mostly straightforward.
However, for the proper handling of MVBITS as an elemental procedure
all honors should go to Paul, as he not only lend me a hand and kindly
guided me through the swampland of the scalarizer, but he also managed
to placate the gimple part of gcc.

Regtested on x86_64-pc-linux-gnu.

OK for master?

Thanks,
Harald


PR fortran/90903 [part2] - Add runtime checking for the MVBITS intrinsic

Implement inline expansion of the intrinsic elemental subroutine MVBITS
with optional runtime checks for valid argument range.

gcc/fortran/ChangeLog:

        * iresolve.c (gfc_resolve_mvbits): Remove unneeded conversion of
        FROMPOS, LEN and TOPOS arguments to fit a C int.
        * trans-intrinsic.c (gfc_conv_intrinsic_mvbits): Add inline
        expansion of MVBITS intrinsic elemental subroutine and add code
        for runtime argument checking.
        (gfc_conv_intrinsic_subroutine): Recognise MVBITS intrinsic, but
        defer handling to gfc_trans_call.
        * trans-stmt.c (replace_ss):
        (gfc_trans_call): Adjust to handle inline expansion, scalarization
        of intrinsic subroutine MVBITS in gfc_conv_intrinsic_mvbits.
        * trans.h (gfc_conv_intrinsic_mvbits): Add prototype for
        gfc_conv_intrinsic_mvbits.

gcc/testsuite/ChangeLog:

        * gfortran.dg/check_bits_2.f90: New test.

Co-authored-by: Paul Thomas  <pa...@gcc.gnu.org>



Reply via email to