diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -11086,7 +11086,7 @@ /// as defined by `LS(P)` in 3.2.1 of the AAVFABI. /// TODO: Add support for references, section 3.2.1, item 1. static unsigned getAArch64LS(QualType QT, ParamKindTy Kind, ASTContext &C) { - if (getAArch64MTV(QT, Kind) && QT.getCanonicalType()->isPointerType()) { + if (!getAArch64MTV(QT, Kind) && QT.getCanonicalType()->isPointerType()) { QualType PTy = QT.getCanonicalType()->getPointeeType(); if (getAArch64PBV(PTy, C)) return C.getTypeSize(PTy); @@ -11129,9 +11129,15 @@ }) && "Invalid size"); - return std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)), - *std::max_element(std::begin(Sizes), std::end(Sizes)), - OutputBecomesInput); + const auto Ret = + std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)), + *std::max_element(std::begin(Sizes), std::end(Sizes)), + OutputBecomesInput); +#ifndef NDEBUG + fprintf(stderr, "getNDSWDS %s %d %d\n", FD->getNameAsString().c_str(), + std::get<0>(Ret), std::get<1>(Ret)); +#endif + return Ret; } /// Mangle the parameter part of the vector function name according to diff --git a/clang/test/OpenMP/declare_simd_aarch64_ndswds.c b/clang/test/OpenMP/declare_simd_aarch64_ndswds.c new file mode 100644 --- /dev/null +++ b/clang/test/OpenMP/declare_simd_aarch64_ndswds.c @@ -0,0 +1,20 @@ +// REQUIRES: aarch64-registered-target +// REQUIRES: asserts +// -fopemp and -fopenmp-simd behavior are expected to be the same. + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c -emit-llvm %s -o - -femit-all-decls 2>&1 | FileCheck %s --check-prefix=AARCH64 +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls 2>&1 | FileCheck %s --check-prefix=AARCH64 + +#pragma omp declare simd linear(sin) linear(cos) notinbranch +void SineCosineWithFloat(float in, float *sin, float *cos); +// AARCH64-DAG: getNDSWDS SineCosineWithFloat 32 32 + +#pragma omp declare simd notinbranch +void SineCosineNoLinear(float in, float *sin, float *cos); +// AARCH64-DAG: getNDSWDS SineCosineNoLinear 32 64 + +static float *F; +void do_something() { + SineCosineWithFloat(*F, F, F); + SineCosineNoLinear(*F, F, F); +}