Skip to content
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

[AArch64][Clang] Implement ACLE rintn intrinsics #66112

Merged
merged 2 commits into from
Sep 14, 2023
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
15 changes: 15 additions & 0 deletions clang/lib/Headers/arm_acle.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,21 @@ __smusdx(int16x2_t __a, int16x2_t __b) {
}
#endif

/* 8.6 Floating-point data-processing intrinsics */
#if (defined(__ARM_FEATURE_DIRECTED_ROUNDING) && \
(__ARM_FEATURE_DIRECTED_ROUNDING)) && \
(defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE)
static __inline__ double __attribute__((__always_inline__, __nodebug__))
__rintn(double __a) {
return __builtin_roundeven(__a);
}

static __inline__ float __attribute__((__always_inline__, __nodebug__))
__rintnf(float __a) {
return __builtin_roundevenf(__a);
}
#endif

/* 9.7 CRC32 intrinsics */
#if (defined(__ARM_FEATURE_CRC32) && __ARM_FEATURE_CRC32) || \
(defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE)
Expand Down
16 changes: 16 additions & 0 deletions clang/test/CodeGen/arm_acle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,22 @@ int32_t test_jcvt(double v) {
}
#endif

#if defined(__ARM_FEATURE_DIRECTED_ROUNDING) && defined(__ARM_64BIT_STATE)

// AArch64-LABEL: @test_rintn(
// AArch64-NEXT: entry:
// AArch64-NEXT: call double @llvm.roundeven.f64(double [[TMP0:%.*]])
double test_rintn(double a) {
return __rintn(a);
}

// AArch64-LABEL: @test_rintnf(
// AArch64-NEXT: entry:
// AArch64-NEXT: call float @llvm.roundeven.f32(float [[TMP0:%.*]])
float test_rintnf(float b) {
return __rintnf(b);
}
#endif

#if defined(__ARM_64BIT_STATE) && defined(__ARM_FEATURE_RNG)

Expand Down