Skip to content

x86_64 backend: no encoding found when disabling sse #23426

@leecannon

Description

@leecannon

Zig Version

0.15.0-dev.165+0bdc0bb53

Steps to Reproduce and Observed Behavior

$ touch empty.zig
$ ../zig/build/stage3/bin/zig build-exe -fno-llvm -fno-lld -mcpu baseline-sse+soft_float empty.zig
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none stmxcsr m32 none none none
error(x86_64_encoder): no encoding found for: none pmovmskb eax xmm0 none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none pmovmskb eax xmm0 none none
error(x86_64_encoder): no encoding found for: none pmovmskb eax xmm0 none none
error(x86_64_encoder): no encoding found for: none pmovmskb eax xmm0 none none
error(x86_64_encoder): no encoding found for: none pmovmskb eax xmm0 none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
error(x86_64_encoder): no encoding found for: none movlhps xmm0 xmm none none
error(x86_64_encoder): no encoding found for: none pmovmskb r32 xmm none none
/home/lee/src/zig/build/stage3/lib/zig/std/start.zig:643:46: error: root source file struct 'empty' has no member named 'main'
    const ReturnType = @typeInfo(@TypeOf(root.main)).@"fn".return_type.?;
                                         ~~~~^~~~~
empty.zig:1:1: note: struct declared here

^
/home/lee/src/zig/build/stage3/lib/zig/std/start.zig:616:20: note: called from here
    return callMain();
           ~~~~~~~~^~
/home/lee/src/zig/build/stage3/lib/zig/std/start.zig:571:36: note: called from here
    std.posix.exit(callMainWithArgs(argc, argv, envp));
                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
referenced by:
    _start: /home/lee/src/zig/build/stage3/lib/zig/std/start.zig:464:40
    comptime: /home/lee/src/zig/build/stage3/lib/zig/std/start.zig:91:63
    2 reference(s) hidden; use '-freference-trace=4' to see all references
/home/lee/src/zig/build/stage3/lib/zig/ubsan_rt.zig:102:5: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
    fn isMinusOne(value: Value) bool {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/os/linux/x86_64.zig:385:1: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
fn getContextInternal() callconv(.naked) usize {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/mem.zig:732:1: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
fn eqlBytes(a: []const u8, b: []const u8) bool {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt.zig:1181:5: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
pub fn formatInt(
~~~~^~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt.zig:1181:5: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
pub fn formatInt(
~~~~^~
/home/lee/src/zig/build/stage3/lib/zig/std/compress/flate/bit_reader.zig:113:13: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
        pub fn readF(self: *Self, comptime U: type, comptime how: u3) !U {
        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/compress/flate/bit_reader.zig:113:13: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
        pub fn readF(self: *Self, comptime U: type, comptime how: u3) !U {
        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/compress/flate/bit_reader.zig:113:13: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
        pub fn readF(self: *Self, comptime U: type, comptime how: u3) !U {
        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/compress/flate/bit_reader.zig:113:13: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
        pub fn readF(self: *Self, comptime U: type, comptime how: u3) !U {
        ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt/format_float.zig:361:5: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
pub fn binaryToDecimal(comptime T: type, bits: T, mantissa_bits: std.math.Log2Int(T), exponent_bits: u5, explicit_leading_bit: bool, comptime tables: anytype) FloatDecimal(T) {
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/math.zig:1209:5: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt/format_float.zig:570:1: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
fn multipleOfPowerOf2(value: anytype, p: u32) bool {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt/format_float.zig:91:1: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
fn copySpecialStr(buf: []u8, f: anytype) []const u8 {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt/format_float.zig:552:1: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
fn pow5Factor(value_: anytype) u32 {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lee/src/zig/build/stage3/lib/zig/std/fmt/format_float.zig:122:1: error: emit MIR failed: InvalidInstruction (Zig compiler bug)
fn isPowerOf10(n_: u128) bool {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Adding -sse2 results in a seg fault.

$ ../zig/build/stage3/bin/zig build-exe -fno-llvm -fno-lld -mcpu baseline-sse-sse2+soft_float empty.zig
error(x86_64_encoder): no encoding found for: none stmxcsr m32 none none none
error(x86_64_encoder): no encoding found for: none movups xmm0 m128 none none
[1]    156137 segmentation fault (core dumped)  ../zig/build/stage3/bin/zig build-exe -fno-llvm -fno-lld -mcpu  empty.zig

Expected Behavior

Compile error about missing main.

$ ../zig/build/stage3/bin/zig build-exe -mcpu baseline-sse+soft_float empty.zig
/home/lee/src/zig/build/stage3/lib/zig/std/start.zig:643:46: error: root source file struct 'empty' has no member named 'main'
    const ReturnType = @typeInfo(@TypeOf(root.main)).@"fn".return_type.?;
                                         ~~~~^~~~~
empty.zig:1:1: note: struct declared here

^
/home/lee/src/zig/build/stage3/lib/zig/std/start.zig:616:20: note: called from here
    return callMain();
           ~~~~~~~~^~
/home/lee/src/zig/build/stage3/lib/zig/std/start.zig:571:36: note: called from here
    std.posix.exit(callMainWithArgs(argc, argv, envp));
                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
referenced by:
    _start: /home/lee/src/zig/build/stage3/lib/zig/std/start.zig:464:40
    comptime: /home/lee/src/zig/build/stage3/lib/zig/std/start.zig:91:63
    2 reference(s) hidden; use '-freference-trace=4' to see all references

Metadata

Metadata

Assignees

No one assigned

    Labels

    abi-sfThe software floating point ABI for various architecturesarch-x86_6464-bit x86backend-self-hostedenhancementSolving this issue will likely involve adding new logic or components to the codebase.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions