[llvm-commits] [llvm] r160117 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/rdrand.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Jul 12 10:27:25 PDT 2012


On Jul 12, 2012, at 9:53 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:

> You should make sure we don't CSE these instructions:

Also fun:

void f(unsigned *p, int n) {
  while (n--)
    _rdrand32_step(p++);
}

Becomes:

	rdrandl	%eax
	.align	16, 0x90
.LBB0_2:                                # %while.body
                                        # =>This Inner Loop Header: Depth=1
	movl	%eax, (%rdi)
	addq	$4, %rdi
	decl	%esi
	jne	.LBB0_2

I think these instructions should be marked as having unmodeled side-effects, and they should be fully chained in the selection DAG. There are security implications if we get too clever, so it is better to be safe than optimal.

/jakob




More information about the llvm-commits mailing list