Hi!

On 2026-07-16T19:34:51+0200, Paul-Antoine Arras <[email protected]> wrote:
> On 16/07/2026 16:45, Tobias Burnus wrote:
>> Paul-Antoine Arras wrote:
>>> Add GOMP_has_masked_thread_num_with_end, which is semantically 
>>> identically but
>>> meant for -fopenmp-ompt.
>> 
>> Which solves the issue I mentioned in my other email
>> - sorry for the belated review due to vaccation - namely: [...]

We've managed to keep things under control, and moving forward.

>>> @@ -9098,7 +9098,11 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, 
>>> omp_context *ctx)
>>>     gsi_replace (gsi_p, bind, true);
>>> -  bfn_decl = builtin_decl_explicit 
>>> (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM);
>>> +  if (flag_openmp_ompt)
>>> +    bfn_decl
>>> +      = builtin_decl_explicit 
>>> (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END);
>>> +  else
>>> +    bfn_decl = builtin_decl_explicit 
>>> (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM);
>> 
>> Elsewhere, you use such version:
>> 
>>    bfn_decl = builtin_decl_explicit (
>>                 flag_openmp_ompt ? BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM
>>                                  : 
>> BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END);
>> 
>> which seems to be tad more readable - however, not that it really
>> matters.
>
> Agreed! Refactored in the updated patch.

> --- a/gcc/omp-low.cc
> +++ b/gcc/omp-low.cc
> @@ -9098,7 +9098,9 @@ lower_omp_master (gimple_stmt_iterator *gsi_p, 
> omp_context *ctx)

> -  bfn_decl = builtin_decl_explicit (BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM);
> +  bfn_decl = builtin_decl_explicit (
> +    flag_openmp_ompt ? BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM
> +                  : BUILT_IN_GOMP_HAS_MASKED_THREAD_NUM_WITH_END);

Please test your patches; v1 vs. v2:

    PASS: c-c++-common/gomp/masked-1.c (test for excess errors)
    PASS: c-c++-common/gomp/masked-1.c scan-tree-dump omplower 
"GOMP_has_masked_thread_num"
    [-PASS:-]{+FAIL:+} c-c++-common/gomp/masked-1.c scan-tree-dump-not omplower 
"GOMP_has_masked_thread_num_with_end"
    PASS: c-c++-common/gomp/masked-1.c scan-tree-dump-not omplower 
"GOMP_masked_end"
    PASS: c-c++-common/gomp/masked-1.c scan-tree-dump-not omplower 
"omp_get_thread_num"

    PASS: c-c++-common/gomp/masked-3.c (test for excess errors)
    [-PASS:-]{+FAIL:+} c-c++-common/gomp/masked-3.c scan-tree-dump-times 
omplower "GOMP_has_masked_thread_num_with_end" 1
    PASS: c-c++-common/gomp/masked-3.c scan-tree-dump-times omplower 
"GOMP_masked_end" 1
    PASS: c-c++-common/gomp/masked-3.c scan-tree-dump-not omplower 
"omp_get_thread_num"

Similar for C++.


Sorry if I sound grumpy, but I am; such things are a waste of time.


Grüße
 Thomas

Reply via email to