#Inline assembly and Self-Hosted x86 Backend

1 messages · Page 1 of 1 (latest)

vivid sable
#

Hello there,
I'm in the process of upgrading to zig 0.15.1 and my project fails to compile on Linux on Debug Mode specifically. I finally realized that this was due to the self-hosted backend and switching back to llvm fixes the issue, but I'm wondering if this is expected? Should I stick to llvm and call it a day, open a bug report (seems weird that this isn't an issue with compiling zig itself), or am I missing something else?

Here's a simple repro:

pub fn main() !void {
    asm volatile (
        \\ bt $0, %edx
        : 
        : [_] "{edx}" (58),
        );
}

zig build-exe main.zig

pub fn main() !void {```

No issue with `zig build-exe main.zig -fllvm`
agile laurel
#

though personally I'd give the register a name (ie. [_] -> [name]) and use %[name] instead

vivid sable
agile laurel
#

probably goes through a different codepath that's less strict about the syntax

#

and yea, i'm not really sure why this syntax was chosen, it's a bit of a strange decision

#

it's likely to change at some point; i think there's plans to integrate inline asm more tightly, or at least use a custom syntax

vivid sable
#

Yeah, I think I read about that, that'll be welcome for sure. Probably not a priority at all though, I get it.

agile laurel
#

yea, the current syntax works fine for now and there's much more important stuff to work on ^-^