Skip to content

libclc should remove __CLC_SUBNORMAL_DISABLE and reimplement __clc_fp32_subnormals_supported #153148

@arsenm

Description

@arsenm

This does not need to be a library build or link time constant, but can be performed with a runtime check which will specialize to a constant based on the ultimate use.

The build should compile with -Xclang -fdenormal-fp-math=dynamic, and then replace __clc_fp32_subnormals_supported with a check like:

  __builtin_isfpclass(__builtin_canonicalizef(0x1p-149f), __FPCLASS_POSZERO)

__clc_flush_denormal_if_not_supported is also approximately equivalent to llvm.canonicalize, but implementing it as
__builtin_fabsf(x) < 0x1p-149f ? copysign(0.0f, x) : x avoids the requirement to quiet a signaling nan so is slightly more foldable.

Metadata

Metadata

Labels

libclclibclc OpenCL library

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions