[PATCH] D98264: [AArch64] Implement __rndr, __rndrrs intrinsics

Stelios Ioannou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 08:01:05 PST 2021


stelios-arm created this revision.
stelios-arm added reviewers: dmgreen, SjoerdMeijer, fhahn, simon_tatham, ostannard, c-rhodes.
stelios-arm added a project: LLVM.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
stelios-arm requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch implements the  `__rndr` and `__rndrrs` intrinsics to provide access to the random number instructions introduced in Armv8.5-A. They are only defined for the AArch64 execution state and are available when `__ARM_FEATURE_RNG` is defined.

These intrinsics store the random number in their pointer argument and return a status code if the generation succeeded. The difference between `__rndr` and `__rndrrs`, is that the latter intrinsic reseeds the random number generator.

The instructions write the NZCV flags indicating the success of the operation that we can then read with a CSET.

[1] https://developer.arm.com/docs/101028/latest/data-processing-intrinsics
[2] https://bugs.llvm.org/show_bug.cgi?id=47838


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98264

Files:
  clang/include/clang/Basic/BuiltinsAArch64.def
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/arm_acle.h
  clang/test/CodeGen/arm_acle.c
  clang/test/CodeGen/builtins-arm64.c
  clang/test/Preprocessor/init-aarch64.c
  llvm/include/llvm/IR/IntrinsicsAArch64.td
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/lib/Target/AArch64/AArch64InstrFormats.td
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/test/CodeGen/AArch64/rand.ll
  llvm/test/CodeGen/AArch64/stp-opt-with-renaming.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98264.329347.patch
Type: text/x-patch
Size: 13672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210309/d6bed3cb/attachment.bin>


More information about the llvm-commits mailing list