diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2025-11-14 11:19:21 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-14 11:19:21 -0800 |
| commit | 590ab43e8aeec5762b0f4b722993ba0faf710c55 (patch) | |
| tree | 046f104b7187c365f32e15e9a111023141671706 /cross-project-tests | |
| parent | 3a08e423f1e7024c849ddc9f97daedfd5a37eb78 (diff) | |
RuntimeLibcalls: Move VectorLibrary handling into TargetOptions (#167996)
This fixes the -fveclib flag getting lost on its way to the backend.
Previously this was its own cl::opt with a random boolean. Move the
flag handling into CommandFlags with other backend ABI-ish options,
and have clang directly set it, rather than forcing it to go through
command line parsing.
Prior to de68181d7f, codegen used TargetLibraryInfo to find the vector
function. Clang has special handling for TargetLibraryInfo, where it
would
directly construct one with the vector library in the pass pipeline.
RuntimeLibcallsInfo currently is not used as an analysis in codegen, and
needs to know the vector library when constructed.
RuntimeLibraryAnalysis could follow the same trick that
TargetLibraryInfo is using in the future, but a lot more boilerplate changes
are needed to thread that analysis through codegen. Ideally this would come
from an IR module flag, and nothing would be in TargetOptions. For now, it's
better for all of these sorts of controls to be consistent.
Diffstat (limited to 'cross-project-tests')
| -rw-r--r-- | cross-project-tests/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | cross-project-tests/veclib/lit.local.cfg | 2 | ||||
| -rw-r--r-- | cross-project-tests/veclib/veclib-sincos.c | 21 |
3 files changed, 30 insertions, 0 deletions
diff --git a/cross-project-tests/CMakeLists.txt b/cross-project-tests/CMakeLists.txt index 8e9457973653..3f932b8c7fd2 100644 --- a/cross-project-tests/CMakeLists.txt +++ b/cross-project-tests/CMakeLists.txt @@ -104,6 +104,13 @@ add_lit_testsuite(check-cross-dtlto "Running DTLTO cross-project tests" DEPENDS ${CROSS_PROJECT_TEST_DEPS} ) +# veclib tests. +add_lit_testsuite(check-cross-veclib "Running veclib cross-project tests" + ${CMAKE_CURRENT_BINARY_DIR}/veclib + EXCLUDE_FROM_CHECK_ALL + DEPENDS ${CROSS_PROJECT_TEST_DEPS} + ) + # Add check-cross-project-* targets. add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CROSS_PROJECT_TEST_DEPS} diff --git a/cross-project-tests/veclib/lit.local.cfg b/cross-project-tests/veclib/lit.local.cfg new file mode 100644 index 000000000000..530f4c01646f --- /dev/null +++ b/cross-project-tests/veclib/lit.local.cfg @@ -0,0 +1,2 @@ +if "clang" not in config.available_features: + config.unsupported = True diff --git a/cross-project-tests/veclib/veclib-sincos.c b/cross-project-tests/veclib/veclib-sincos.c new file mode 100644 index 000000000000..657d0df19952 --- /dev/null +++ b/cross-project-tests/veclib/veclib-sincos.c @@ -0,0 +1,21 @@ +// REQUIRES: aarch64-registered-target +// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \ +// RUN: -fveclib=ArmPL -o - %s | FileCheck -check-prefix=ARMPL %s +// RUN: %clang -S -target aarch64-unknown-linux-gnu -O2 -fno-math-errno \ +// RUN: -fveclib=SLEEF -o - %s | FileCheck -check-prefix=SLEEF %s + +typedef __SIZE_TYPE__ size_t; + +void sincos(double, double *, double *); + +// ARMPL: armpl_vsincosq_f64 +// ARMPL: armpl_vsincosq_f64 + +// SLEEF: _ZGVnN2vl8l8_sincos +// SLEEF: _ZGVnN2vl8l8_sincos +void vectorize_sincos(double *restrict x, double *restrict s, + double *restrict c, size_t n) { + for (size_t i = 0; i < n; ++i) { + sincos(x[i], &s[i], &c[i]); + } +} |
