summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/rdrand-builtins.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/rdrand-builtins.c')
-rw-r--r--test/CodeGen/rdrand-builtins.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/rdrand-builtins.c b/test/CodeGen/rdrand-builtins.c
new file mode 100644
index 0000000..b7970f4
--- /dev/null
+++ b/test/CodeGen/rdrand-builtins.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +rdrnd -emit-llvm -S -emit-llvm -o - %s | FileCheck %s
+
+// Don't include mm_malloc.h, it's system specific.
+#define __MM_MALLOC_H
+
+#include <immintrin.h>
+
+int rdrand16(unsigned short *p) {
+ return _rdrand16_step(p);
+// CHECK: @rdrand16
+// CHECK: call { i16, i32 } @llvm.x86.rdrand.16
+// CHECK: store i16
+}
+
+int rdrand32(unsigned *p) {
+ return _rdrand32_step(p);
+// CHECK: @rdrand32
+// CHECK: call { i32, i32 } @llvm.x86.rdrand.32
+// CHECK: store i32
+}
+
+int rdrand64(unsigned long long *p) {
+ return _rdrand64_step(p);
+// CHECK: @rdrand64
+// CHECK: call { i64, i32 } @llvm.x86.rdrand.64
+// CHECK: store i64
+}
OpenPOWER on IntegriCloud