llvm-project/clang/test/Sema/builtins-arm64.c
Archibald Elliott 82b51a1428 [AArch64] Support SLC in ACLE prefetch intrinsics
This change:
- Modifies the ACLE code to allow the new SLC value (3) for the prefetch
  target.

- Introduces a new intrinsic, @llvm.aarch64.prefetch which matches the
  PRFM family instructions much more closely, and can represent all
  values for the PRFM immediate.

  The target-independent @llvm.prefetch intrinsic does not have enough
  information for us to be able to lower to it from the ACLE intrinsics
  correctly.

- Lowers the acle calls to the new intrinsic on aarch64 (the ARM
  lowering is unchanged).

- Implements code generation for the new intrinsic in both SelectionDAG
  and GlobalISel. We specifically choose to continue to support lowering
  the target-independent @llvm.prefetch intrinsic so that other
  frontends can continue to use it.

Differential Revision: https://reviews.llvm.org/D139443
2022-12-16 14:42:27 +00:00

32 lines
1.3 KiB
C

// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple arm64-apple-ios -DTEST1 -fsyntax-only -verify %s
#ifdef TEST1
void __clear_cache(void *start, void *end);
#endif
void test_clear_cache_chars(char *start, char *end) {
__clear_cache(start, end);
}
void test_clear_cache_voids(void *start, void *end) {
__clear_cache(start, end);
}
void test_clear_cache_no_args(void) {
__clear_cache(); // expected-error {{too few arguments to function call}}
}
void test_memory_barriers(void) {
__builtin_arm_dmb(16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_dsb(17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_isb(18); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_prefetch(void) {
__builtin_arm_prefetch(0, 2, 0, 0, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 4, 0, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 0, 2, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 0, 0, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}