1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mcpu=core-avx-i -mattr=+rdseed | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=core-avx-i -mattr=+rdseed | FileCheck %s --check-prefix=X64
5 declare {i16, i32} @llvm.x86.rdseed.16()
6 declare {i32, i32} @llvm.x86.rdseed.32()
8 define i32 @_rdseed16_step(i16* %random_val) {
9 ; X86-LABEL: _rdseed16_step:
11 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
12 ; X86-NEXT: rdseedw %ax
13 ; X86-NEXT: movzwl %ax, %edx
14 ; X86-NEXT: movl $1, %eax
15 ; X86-NEXT: cmovael %edx, %eax
16 ; X86-NEXT: movw %dx, (%ecx)
19 ; X64-LABEL: _rdseed16_step:
21 ; X64-NEXT: rdseedw %ax
22 ; X64-NEXT: movzwl %ax, %ecx
23 ; X64-NEXT: movl $1, %eax
24 ; X64-NEXT: cmovael %ecx, %eax
25 ; X64-NEXT: movw %cx, (%rdi)
27 %call = call {i16, i32} @llvm.x86.rdseed.16()
28 %randval = extractvalue {i16, i32} %call, 0
29 store i16 %randval, i16* %random_val
30 %isvalid = extractvalue {i16, i32} %call, 1
34 define i32 @_rdseed32_step(i32* %random_val) {
35 ; X86-LABEL: _rdseed32_step:
37 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
38 ; X86-NEXT: rdseedl %edx
39 ; X86-NEXT: movl $1, %eax
40 ; X86-NEXT: cmovael %edx, %eax
41 ; X86-NEXT: movl %edx, (%ecx)
44 ; X64-LABEL: _rdseed32_step:
46 ; X64-NEXT: rdseedl %ecx
47 ; X64-NEXT: movl $1, %eax
48 ; X64-NEXT: cmovael %ecx, %eax
49 ; X64-NEXT: movl %ecx, (%rdi)
51 %call = call {i32, i32} @llvm.x86.rdseed.32()
52 %randval = extractvalue {i32, i32} %call, 0
53 store i32 %randval, i32* %random_val
54 %isvalid = extractvalue {i32, i32} %call, 1