llvm-project/llvm/test/CodeGen/AArch64/range-prefetch.ll
Kerry McLaughlin 04e5bc7dfb
[AArch64] Add support for range prefetch intrinsic (#170490)
This patch adds support in Clang for the RPRFM instruction, by adding
the following intrinsics:

```
void __pldx_range(unsigned int *access_kind*, unsigned int retention_policy,
                               signed int length*, unsigned int count, signed int stride,
                               size_t reuse distance,  void const *addr);

void __pld_range(unsigned int access_kind*, unsigned int retention_policy,
                              uint64_t metadata, void const *addr);
```

The `__ARM_PREFETCH_RANGE` macro can be used to test whether these
intrinsics are implemented. If the RPRFM instruction is not available, this
instruction is a NOP.

This implements the following ACLE proposal:
https://github.com/ARM-software/acle/pull/423
2026-01-12 15:53:17 +00:00

19 lines
934 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc -mtriple=aarch64 -mattr=+v8.9a --global-isel=0 < %s | FileCheck %s
; RUN: llc -mtriple=aarch64 -mattr=+v8.9a --global-isel=1 --global-isel-abort=1 < %s | FileCheck %s
define void @range_prefetch_metadata_accesses(ptr %a, i64 %metadata) {
; CHECK-LABEL: range_prefetch_metadata_accesses:
; CHECK: // %bb.0:
; CHECK-NEXT: rprfm pldkeep, x1, [x0]
; CHECK-NEXT: rprfm pstkeep, x1, [x0]
; CHECK-NEXT: rprfm pldstrm, x1, [x0]
; CHECK-NEXT: rprfm pststrm, x1, [x0]
; CHECK-NEXT: ret
call void @llvm.aarch64.range.prefetch(ptr %a, i32 0, i32 0, i64 %metadata)
call void @llvm.aarch64.range.prefetch(ptr %a, i32 1, i32 0, i64 %metadata)
call void @llvm.aarch64.range.prefetch(ptr %a, i32 0, i32 1, i64 %metadata)
call void @llvm.aarch64.range.prefetch(ptr %a, i32 1, i32 1, i64 %metadata)
ret void
}