Re: [PATCH bpf-next V2] bpf: abstract loop unrolling pragmas in BPF selftests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/8/24 12:36 PM, Jose E. Marchesi wrote:
[Changes from V1:
- Avoid conflict by rebasing with latest master.]

Some BPF tests use loop unrolling compiler pragmas that are clang
specific and not supported by GCC.  These pragmas, along with their
GCC equivalences are:

   #pragma clang loop unroll_count(N)
   #pragma GCC unroll N

   #pragma clang loop unroll(full)
   #pragma GCC unroll 65534

   #pragma clang loop unroll(disable)
   #pragma GCC unroll 1

   #pragma unroll [aka #pragma clang loop unroll(enable)]
   There is no GCC equivalence to this pragma.  It enables unrolling on
   loops that the compiler would not ordinarily unroll even with
   -O2|-funroll-loops, but it is not equivalent to full unrolling
   either.

This patch adds a new header progs/bpf_compiler.h that defines the
following macros, which correspond to each pair of compiler-specific
pragmas above:

   __pragma_loop_unroll_count(N)
   __pragma_loop_unroll_full
   __pragma_loop_no_unroll
   __pragma_loop_unroll

The selftests using loop unrolling pragmas are then changed to include
the header and use these macros in place of the explicit pragmas.

Tested in bpf-next master.
No regressions.

Signed-off-by: Jose E. Marchesi <jose.marchesi@xxxxxxxxxx>
Cc: Yonghong Song <yhs@xxxxxxxx>
Cc: Eduard Zingerman <eddyz87@xxxxxxxxx>
Cc: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
Cc: david.faust@xxxxxxxxxx
Cc: cupertino.miranda@xxxxxxxxxx

Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux