[llvm-dev] error: couldn't allocate input reg for constraint '{xmm0}'

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 17 13:09:24 PST 2018


Here is some zig code:

pub fn setXmm0(comptime T: type, value: T) void {
    comptime assert(builtin.arch == builtin.Arch.x86_64);
    const aligned_value: T align(16) = value;
    asm volatile (
        \\movaps (%[ptr]), %%xmm0
            :
        : [ptr] "r" (&aligned_value)
        : "xmm0"
    );
}

I want to improve this and integrate more tightly with LLVM IR, like this:

    asm volatile (""
        :
        : [value] "{xmm0}" (value)
     );

Here, this communicates to llvm to make sure xmm0 is set to value, in
whatever way it needs to. Here is the LLVM IR:

  call void asm sideeffect "", "{xmm0}"(i128 %1)

But LLVM gives me this error:
error: couldn't allocate input reg for constraint '{xmm0}'

Is this a bug in LLVM or some fundamental limitation?


More information about the llvm-dev mailing list