Skip to content

Commit

Permalink
[AArch64] Re-enable SME only for Linux and new versions of Clang
Browse files Browse the repository at this point in the history
This was previously disabled in
679e851, so re-enable it but only for
Linux where SME is known to work correctly.

Change-Id: I2626b03f3854b27162df1b55fc6767e02ffe318d
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5802958
Reviewed-by: Frank Barchard <[email protected]>
Reviewed-by: Justin Green <[email protected]>
  • Loading branch information
georges-arm authored and Frank Barchard committed Sep 23, 2024
1 parent 8315fa1 commit a37e6bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions include/libyuv/cpu_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ extern "C" {
#define VISUALC_HAS_AVX2 1
#endif // VisualStudio >= 2012

// Temporary disable SME.
#if !defined(LIBYUV_DISABLE_SME)
#define LIBYUV_DISABLE_SME
// Clang 19 required for SME due to needing __arm_tpidr2_save from compiler-rt,
// only enabled on Linux for now.
#if !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__) && \
defined(__gnu_linux__) && defined(__clang__) && (__clang_major__ >= 19)
#define CLANG_HAS_SME 1
#endif

#ifdef __cplusplus
Expand Down
3 changes: 2 additions & 1 deletion include/libyuv/rotate_row.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ extern "C" {
#define HAS_TRANSPOSE4X4_32_NEON
#endif

#if !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__)
#if !defined(LIBYUV_DISABLE_SME) && defined(CLANG_HAS_SME) && \
defined(__aarch64__)
#define HAS_TRANSPOSEWXH_SME
#define HAS_TRANSPOSEUVWXH_SME
#endif
Expand Down
6 changes: 4 additions & 2 deletions source/rotate_sme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ namespace libyuv {
extern "C" {
#endif

#if !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__)
#if !defined(LIBYUV_DISABLE_SME) && defined(CLANG_HAS_SME) && \
defined(__aarch64__)

__arm_locally_streaming __arm_new("za") void TransposeWxH_SME(
const uint8_t* src,
Expand Down Expand Up @@ -164,7 +165,8 @@ __arm_locally_streaming __arm_new("za") void TransposeUVWxH_SME(
} while (height > 0);
}

#endif // !defined(LIBYUV_DISABLE_SME) && defined(__aarch64__)
#endif // !defined(LIBYUV_DISABLE_SME) && defined(CLANG_HAS_SME) &&
// defined(__aarch64__)

#ifdef __cplusplus
} // extern "C"
Expand Down

0 comments on commit a37e6bc

Please sign in to comment.