1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +rdrnd -target-feature +rdseed -emit-llvm -o - %s | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // Don't include mm_malloc.h, it's system specific. 4*f4a2713aSLionel Sambuc #define __MM_MALLOC_H 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc #include <x86intrin.h> 7*f4a2713aSLionel Sambuc rdrand16(unsigned short * p)8*f4a2713aSLionel Sambucint rdrand16(unsigned short *p) { 9*f4a2713aSLionel Sambuc return _rdrand16_step(p); 10*f4a2713aSLionel Sambuc // CHECK: @rdrand16 11*f4a2713aSLionel Sambuc // CHECK: call { i16, i32 } @llvm.x86.rdrand.16 12*f4a2713aSLionel Sambuc // CHECK: store i16 13*f4a2713aSLionel Sambuc } 14*f4a2713aSLionel Sambuc rdrand32(unsigned * p)15*f4a2713aSLionel Sambucint rdrand32(unsigned *p) { 16*f4a2713aSLionel Sambuc return _rdrand32_step(p); 17*f4a2713aSLionel Sambuc // CHECK: @rdrand32 18*f4a2713aSLionel Sambuc // CHECK: call { i32, i32 } @llvm.x86.rdrand.32 19*f4a2713aSLionel Sambuc // CHECK: store i32 20*f4a2713aSLionel Sambuc } 21*f4a2713aSLionel Sambuc rdrand64(unsigned long long * p)22*f4a2713aSLionel Sambucint rdrand64(unsigned long long *p) { 23*f4a2713aSLionel Sambuc return _rdrand64_step(p); 24*f4a2713aSLionel Sambuc // CHECK: @rdrand64 25*f4a2713aSLionel Sambuc // CHECK: call { i64, i32 } @llvm.x86.rdrand.64 26*f4a2713aSLionel Sambuc // CHECK: store i64 27*f4a2713aSLionel Sambuc } 28*f4a2713aSLionel Sambuc rdseed16(unsigned short * p)29*f4a2713aSLionel Sambucint rdseed16(unsigned short *p) { 30*f4a2713aSLionel Sambuc return _rdseed16_step(p); 31*f4a2713aSLionel Sambuc // CHECK: @rdseed16 32*f4a2713aSLionel Sambuc // CHECK: call { i16, i32 } @llvm.x86.rdseed.16 33*f4a2713aSLionel Sambuc // CHECK: store i16 34*f4a2713aSLionel Sambuc } 35*f4a2713aSLionel Sambuc rdseed32(unsigned * p)36*f4a2713aSLionel Sambucint rdseed32(unsigned *p) { 37*f4a2713aSLionel Sambuc return _rdseed32_step(p); 38*f4a2713aSLionel Sambuc // CHECK: @rdseed32 39*f4a2713aSLionel Sambuc // CHECK: call { i32, i32 } @llvm.x86.rdseed.32 40*f4a2713aSLionel Sambuc // CHECK: store i32 41*f4a2713aSLionel Sambuc } 42*f4a2713aSLionel Sambuc rdseed64(unsigned long long * p)43*f4a2713aSLionel Sambucint rdseed64(unsigned long long *p) { 44*f4a2713aSLionel Sambuc return _rdseed64_step(p); 45*f4a2713aSLionel Sambuc // CHECK: @rdseed64 46*f4a2713aSLionel Sambuc // CHECK: call { i64, i32 } @llvm.x86.rdseed.64 47*f4a2713aSLionel Sambuc // CHECK: store i64 48*f4a2713aSLionel Sambuc } 49