Skip to content

Missing default LLVM cpu-features in some targets #4919

@kassane

Description

@kassane

Version: v1.41.0-git-20d22b1

During building tests, it's common to find warnings without errors:

'-half-precision' is not a recognized feature for this target (ignoring feature)

or (need LLVM 20 - new cpu: lime1)

'lime1' is not a recognized processor for this target (ignoring processor)
# LLVM 19 - missing features
ldc2 --mtriple=wasm32-unknown-emscripten -mcpu=bleeding-edge -vv                                                                            
Targeting 'wasm32-unknown-emscripten' (CPU 'bleeding-edge' with features '')
# LLVM 19 - missing features
ldc2 --mtriple=wasm32-unknown-emscripten -mcpu=generic -vv                                                                            
Targeting 'wasm32-unknown-emscripten' (CPU 'generic' with features '')
# OK
ldc2 --mtriple=wasm32-unknown-emscripten -mcpu=mvp -vv                                                                            
Targeting 'wasm32-unknown-emscripten' (CPU 'mvp' with features '')

Knowing that it is possible add it manually using the -mattr=+feature_name1,-feature_name2 command.
However, it's not all cpu-targets from wasm32 are opaque by default.


Extra info to compare

Rust - wasm32 target-info
rustc --print cfg --target wasm32-unknown-emscripten -C target-cpu=generic
# [...] skip
target_arch="wasm32"
target_endian="little"
# [...] skip
target_feature="multivalue"
target_feature="mutable-globals"
target_feature="reference-types"
target_feature="sign-ext"
# [...] skip
rustc -Vv   
rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-unknown-linux-gnu
release: 1.86.0
LLVM version: 19.1.7
Zig - wasm32 target-info
zig cc --version
clang version 19.1.7 (https://github.com/ziglang/zig-bootstrap 1c3c59435891bc9caf8cd1d3783773369d191c5f)
Target: x86_64-unknown-linux-musl
Thread model: posix
InstalledDir: /home/kassane/zig/0.14.0/files
zig build-exe --show-builtin -target wasm32-emscripten-none -mcpu=generic
pub const cpu: std.Target.Cpu = .{
    .arch = .wasm32,
    .model = &std.Target.wasm.cpu.generic,
    .features = std.Target.wasm.featureSet(&.{
        .multivalue,
        .mutable_globals,
        .reference_types,
        .sign_ext,
    }),
};

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions