[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 20 13:34:00 PDT 2018
thakis updated this revision to Diff 156596.
thakis edited the summary of this revision.
https://reviews.llvm.org/D49606
Files:
clang/lib/Headers/intrin.h
clang/test/Headers/ms-intrin.cpp
Index: clang/test/Headers/ms-intrin.cpp
===================================================================
--- clang/test/Headers/ms-intrin.cpp
+++ clang/test/Headers/ms-intrin.cpp
@@ -42,6 +42,8 @@
__stosw(0, 0, 0);
#ifdef _M_X64
+ __shiftleft128(1, 2, 3);
+ __shiftright128(1, 2, 3);
__movsq(0, 0, 0);
__stosq(0, 0, 0);
#endif
Index: clang/lib/Headers/intrin.h
===================================================================
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -853,6 +853,20 @@
__asm__ volatile ("nop");
}
#endif
+#if defined(__x86_64__)
+static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
+__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
+ unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
+ unsigned __int128 __res = __val << (__d & 63);
+ return (unsigned __int64)(__res >> 64);
+}
+static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
+__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
+ unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
+ unsigned __int128 __res = __val >> (__d & 63);
+ return (unsigned __int64)__res;
+}
+#endif
/*----------------------------------------------------------------------------*\
|* Privileged intrinsics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49606.156596.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180720/357f9c52/attachment-0001.bin>
More information about the cfe-commits
mailing list