Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=core-avx-i -mattr=+rdseed | FileCheck %s
      2 
      3 declare {i16, i32} @llvm.x86.rdseed.16()
      4 declare {i32, i32} @llvm.x86.rdseed.32()
      5 declare {i64, i32} @llvm.x86.rdseed.64()
      6 
      7 define i32 @_rdseed16_step(i16* %random_val) {
      8   %call = call {i16, i32} @llvm.x86.rdseed.16()
      9   %randval = extractvalue {i16, i32} %call, 0
     10   store i16 %randval, i16* %random_val
     11   %isvalid = extractvalue {i16, i32} %call, 1
     12   ret i32 %isvalid
     13 ; CHECK-LABEL: _rdseed16_step:
     14 ; CHECK: rdseedw	%ax
     15 ; CHECK: movzwl	%ax, %ecx
     16 ; CHECK: movl	$1, %eax
     17 ; CHECK: cmovael	%ecx, %eax
     18 ; CHECK: movw	%cx, (%r[[A0:di|cx]])
     19 ; CHECK: ret
     20 }
     21 
     22 define i32 @_rdseed32_step(i32* %random_val) {
     23   %call = call {i32, i32} @llvm.x86.rdseed.32()
     24   %randval = extractvalue {i32, i32} %call, 0
     25   store i32 %randval, i32* %random_val
     26   %isvalid = extractvalue {i32, i32} %call, 1
     27   ret i32 %isvalid
     28 ; CHECK-LABEL: _rdseed32_step:
     29 ; CHECK: rdseedl	%e[[T0:[a-z]+]]
     30 ; CHECK: movl	$1, %eax
     31 ; CHECK: cmovael	%e[[T0]], %eax
     32 ; CHECK: movl	%e[[T0]], (%r[[A0]])
     33 ; CHECK: ret
     34 }
     35 
     36 define i32 @_rdseed64_step(i64* %random_val) {
     37   %call = call {i64, i32} @llvm.x86.rdseed.64()
     38   %randval = extractvalue {i64, i32} %call, 0
     39   store i64 %randval, i64* %random_val
     40   %isvalid = extractvalue {i64, i32} %call, 1
     41   ret i32 %isvalid
     42 ; CHECK-LABEL: _rdseed64_step:
     43 ; CHECK: rdseedq	%r[[T1:[a-z]+]]
     44 ; CHECK: movl	$1, %eax
     45 ; CHECK: cmovael	%e[[T1]], %eax
     46 ; CHECK: movq	%r[[T1]], (%r[[A0]])
     47 ; CHECK: ret
     48 }
     49