Skip to content

[AArch64][Clang] Define __ARM_NEON_SVE_BRIDGE unconditionally #118272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/lib/Basic/Targets/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__ARM_FP16_FORMAT_IEEE", "1");
Builder.defineMacro("__ARM_FP16_ARGS", "1");

// Clang supports arm_neon_sve_bridge.h
Builder.defineMacro("__ARM_NEON_SVE_BRIDGE", "1");

if (Opts.UnsafeFPMath)
Builder.defineMacro("__ARM_FP_FAST", "1");

Expand All @@ -464,9 +467,6 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
if (FPU & SveMode)
Builder.defineMacro("__ARM_FEATURE_SVE", "1");

if ((FPU & NeonMode) && (FPU & SveMode))
Builder.defineMacro("__ARM_NEON_SVE_BRIDGE", "1");

if (HasSVE2)
Builder.defineMacro("__ARM_FEATURE_SVE2", "1");

Expand Down
1 change: 1 addition & 0 deletions clang/test/Preprocessor/aarch64-target-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
// CHECK-NOT: __ARM_FP_FAST 1
// CHECK: __ARM_NEON 1
// CHECK: __ARM_NEON_FP 0xE
// CHECK: __ARM_NEON_SVE_BRIDGE 1
// CHECK: __ARM_PCS_AAPCS64 1
// CHECK-NOT: __ARM_PCS 1
// CHECK-NOT: __ARM_PCS_VFP 1
Expand Down
1 change: 1 addition & 0 deletions clang/test/Preprocessor/init-aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
// AARCH64-NEXT: #define __ARM_FP 0xE
// AARCH64-NEXT: #define __ARM_FP16_ARGS 1
// AARCH64-NEXT: #define __ARM_FP16_FORMAT_IEEE 1
// AARCH64-NEXT: #define __ARM_NEON_SVE_BRIDGE 1
// AARCH64-NEXT: #define __ARM_PCS_AAPCS64 1
// AARCH64-NEXT: #define __ARM_SIZEOF_MINIMAL_ENUM 4
// AARCH64-NEXT: #define __ARM_SIZEOF_WCHAR_T 4
Expand Down
15 changes: 15 additions & 0 deletions clang/test/Sema/aarch64-sve-intrinsics/acle_neon_sve_bridge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -verify -emit-llvm -o - %s
// REQUIRES: aarch64-registered-target

// Test that we can use __ARM_NEON_SVE_BRIDGE to guard to inclusion of arm_neon_sve_bridge.h,
// and use the associated intrinsics via a target() attribute.

// expected-no-diagnostics

#ifdef __ARM_NEON_SVE_BRIDGE
#include <arm_neon_sve_bridge.h>
#endif

uint32x4_t __attribute__((target("+sve"))) foo(svuint32_t a) {
return svget_neonq_u32(a);
}
Loading