Skip to content

Suboptimal code gen in Clang for _mm_setzero_ps with #pragma STDC FENV_ACCESS ON on x64 #59052

@pavlejosipovic

Description

@pavlejosipovic

_mm_setzero_ps() is supposed to generate xorps xmm0, xmm0 but if STDC FENV_ACCESS ON is set (it get set by -ffp-model=strict)
than it generates
xor eax, eax cvtsi2ss xmm0, eax shufps xmm0, xmm0, 0

This happens only on Clang, with GCC or MSVC this doesn't happen.
Below are code snippets for STDC FENV_ACCESS OFF/ON
https://godbolt.org/z/nqx9ejKre
https://godbolt.org/z/7hKzh95E4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions