https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127723

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <[email protected]>:

https://gcc.gnu.org/g:fbcafeec06a66175108be68c34aceafba7a453b9

commit r17-4947-gfbcafeec06a66175108be68c34aceafba7a453b9
Author: Tobias Burnus <[email protected]>
Date:   Wed Oct 7 06:36:24 2026 +0200

    OpenMP: Add the 'scaled' modifier to the 'simdlen' clause [PR127723]

    This OpenMP 6.1 (TR14) feature was added to handle the fancier
    simdlen variants of AArch64/RISC-V.

    Namely, besides 'simdlen(length)' there is now also an optional scale
    factor:
      simdlen( scaled(arith-type [, divisor]) : length )
    with the scaling factor defaulting to one when absent and otherwise being
      max(1, round_down(VL(type) / divisor))
    and VL(type) is a target & type specific value, which might be only
    known at runtime (divisor and length must be >= 1 and constant).
    And 'type' is an arithmetic type (C/C++) or numeric intrinsic type
    (Fortran).

    The 'simdlen' with 'scaled' can be specified on 'declare simd', on
    the 'simd' directive and - as context selector - on 'declare variant'.

    This commit adds support for C and C++, only, and currently fails with
    a sorry in gimplify_scan_omp_clauses and simd_clone_clauses_extract.

            PR middle-end/127723

    gcc/ChangeLog:

            * attribs.cc (omp_declare_simd_clauses_equal): Handle
            simdlen's type and divisor of the scaled modifier.
            * omp-general.cc (resolve_omp_target_device_matches,
            omp_construct_simd_compare): Likewise.
            * gimplify.cc (gimplify_scan_omp_clauses): Remove
            simdlen clause with a sorry when it has a scaled modifier.
            * omp-simd-clone.cc (simd_clone_clauses_extract): Likewise.
            * tree-core.h (enum omp_clause_code): Update comment for
            OMP_CLAUSE_SIMDLEN.
            * tree-pretty-print.cc (dump_omp_clause): Handle scaled
            modifier to simdlen.
            (dump_omp_context_selector): Fix dumping of simd trait.
            * tree.cc (omp_clause_num_ops): OMP_CLAUSE_SIMDLEN takes
            now three operands.
            * tree.h (OMP_CLAUSE_SIMDLEN_TYPE,
            OMP_CLAUSE_SIMDLEN_DIVISOR): New defines.

    gcc/c/ChangeLog:

            * c-parser.cc (c_parser_omp_clause_simdlen): Handle
            simdlen's type and divisor of the scaled modifier.
            * c-typeck.cc (c_finish_omp_clauses): Add comment
            about safelen vs. simdlen with scaled.

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_omp_clause_simdlen): Handle
            simdlen's type and divisor of the scaled modifier.
            * pt.cc (tsubst_omp_clauses): Likewise
            * semantics.cc (finish_omp_clauses): Likewise;
            add comment about safelen vs. simdlen with scaled.

    gcc/testsuite/ChangeLog:

            * c-c++-common/gomp/simdlen-scaled-1.c: New test.
            * c-c++-common/gomp/simdlen-scaled-2.c: New test.
            * c-c++-common/gomp/simdlen-scaled-3.c: New test.
            * c-c++-common/gomp/simdlen-scaled-4.c: New test.
            * g++.dg/gomp/simdlen-scaled-1.C: New test.
            * g++.dg/gomp/simdlen-scaled-2.C: New test.

Reply via email to