[LLVMdev] SSE intrinsic alignment bug?

Eli Friedman eli.friedman at gmail.com
Thu May 22 16:56:02 PDT 2008


On Thu, May 22, 2008 at 4:47 PM, Dale Johannesen <dalej at apple.com> wrote:
> The intent here is that "in" and "out" are always aligned

What the heck?  in and out are pointers!  Here's a similar test in IL,
which should be a bit more readable:

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-pc-linux-gnu"

define void @a(<4 x float>* %x) nounwind  {
entry:
	%tmp2 = load <4 x float>* %x, align 1
	%inv = call <4 x float> @llvm.x86.sse.rcp.ps(<4 x float> %tmp2)
	store <4 x float> %inv, <4 x float>* %x, align 1
	ret void
}

declare <4 x float> @llvm.x86.sse.rcp.ps(<4 x float>)

Generated code:
a:
	movl	4(%esp), %eax
	rcpps	(%eax), %xmm0
	movups	%xmm0, (%eax)
	ret

This is pretty clearly a bug.

-Eli



More information about the llvm-dev mailing list