[PATCH] D27250: [OpenMP] TargetLibraryInfo from "declare simd".

Francesco Petrogalli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 02:21:12 PST 2016


fpetrogalli created this revision.
fpetrogalli added a reviewer: cfe-commits.

This patch generates a list of global external variables that are
passed to the llvm::TargetLibraryInfo (TLI) to enable the vectorization of
loops containing calls to function that are marked with a #pragma omp
declare simd.

To do so, the global variables are generated as "global external", so
that they get removed in the middle-end and generated no useless code.

A new method of the TLI (provided in a separate LLVM patch) looks for
such global variables and updates the lists of vectorizable functions
that the vectorizer can use.

This behavior enables the programmer to provide vector routines that
are recognized as vectorizable by using the OpenMP directive "declare
simd" as follow:

  $> clang -fopenmp -c -o whatever.o -O3 file.c

where `file.c` is

  #pragma omp declare simd
  double f(double x);
  
  void aaa(double *x, double *y, int N) {
    for (int i = 0; i < N; ++i) {
      x[i] = f(y[i]);
    }
  }


https://reviews.llvm.org/D27250

Files:
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  test/OpenMP/declare_simd_no_definition.c
  test/OpenMP/declare_simd_no_definition.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27250.79712.patch
Type: text/x-patch
Size: 13601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161130/4b2a54f2/attachment.bin>


More information about the cfe-commits mailing list