[PATCH] D51204: [COFF, ARM64] Add MS intrinsics: __getReg, _ReadStatusReg, _WriteStatusReg

Mandeep Singh Grang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 24 11:25:02 PDT 2018


mgrang updated this revision to Diff 162431.
mgrang edited the summary of this revision.

https://reviews.llvm.org/D51204

Files:
  lib/Headers/intrin.h
  test/Headers/arm64-ms-intrin.cpp


Index: test/Headers/arm64-ms-intrin.cpp
===================================================================
--- /dev/null
+++ test/Headers/arm64-ms-intrin.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple arm64-windows -S -emit-llvm -o - %s \
+// RUN: -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: -isystem %S/Inputs/include 2>&1 | FileCheck %s
+
+#include <intrin.h>
+
+unsigned __int64 check__getReg() {
+  return __getReg(1);
+}
+// CHECK: call i64 @__getReg(i32 1)
+
+__int64 check_ReadStatusReg() {
+  return _ReadStatusReg(1);
+}
+// CHECK: call i64 @_ReadStatusReg(i32 1)
+
+void check_WriteStatusReg() {
+  __int64 x;
+  _WriteStatusReg(1, x);
+}
+// CHECK: call void @_WriteStatusReg(i32 1, i64 %0)
Index: lib/Headers/intrin.h
===================================================================
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -865,6 +865,15 @@
 #endif
 
 /*----------------------------------------------------------------------------*\
+|* MS AArch64 specific
+\*----------------------------------------------------------------------------*/
+#if defined(__aarch64__)
+unsigned __int64 __getReg(int);
+__int64 _ReadStatusReg(int);
+void _WriteStatusReg(int, __int64);
+#endif
+
+/*----------------------------------------------------------------------------*\
 |* Privileged intrinsics
 \*----------------------------------------------------------------------------*/
 #if defined(__i386__) || defined(__x86_64__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51204.162431.patch
Type: text/x-patch
Size: 1461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180824/cfa599eb/attachment.bin>


More information about the cfe-commits mailing list