Skip to content

[x86][Windows] Clang-cl does not emit the expected code on 32-bit x86 for __iso_volatile_store64 and __iso_volatile_load64 intrinsics #156228

@AlexGuteniev

Description

@AlexGuteniev

The expected codegen for all __iso_volatile_load... and __iso_volatile_store... is non tearing load and store.
These intrinsics are used in <atomic>.

For x86 MSVC emits movq, when it is allowed to use SSE2, or fistp otherwise. See https://godbolt.org/z/jcd1PM6xj

clang-cl emits pair of 32 bit operations, it should emit non-tearing operations.

C:\Program Files\Microsoft Visual Studio\2022\Preview>clang-cl --version
clang version 19.1.5
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\Llvm\x64\bin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions