[all-commits] [llvm/llvm-project] a63692: [SelectionDAG] Add expansion for llvm.convert.from...
Dmitry Sidorov via All-commits
all-commits at lists.llvm.org
Wed Mar 4 01:41:08 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a636928bb4db9d78e32af0a27e048687506af841
https://github.com/llvm/llvm-project/commit/a636928bb4db9d78e32af0a27e048687506af841
Author: Dmitry Sidorov <Dmitry.Sidorov at amd.com>
Date: 2026-03-04 (Wed, 04 Mar 2026)
Changed paths:
M llvm/include/llvm/ADT/APFloat.h
M llvm/include/llvm/CodeGen/ISDOpcodes.h
M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
M llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
M llvm/lib/CodeGen/TargetLoweringBase.cpp
M llvm/lib/Support/APFloat.cpp
A llvm/test/CodeGen/AMDGPU/arbitrary-fp-to-float.ll
A llvm/test/CodeGen/NVPTX/arbitrary-fp-to-float.ll
A llvm/test/CodeGen/X86/arbitrary-fp-convert-error.ll
A llvm/test/CodeGen/X86/arbitrary-fp-to-float.ll
Log Message:
-----------
[SelectionDAG] Add expansion for llvm.convert.from.arbitrary.fp (#179318)
The expansion converts arbitrary-precision FP represented as integer
following these algorithm:
1. Extract sign, exponent, and mantissa bit fields via masks and shifts.
2. Classify the input (zero, denormal, normal, Inf, NaN) using the
exponent and mantissa fields.
3. Normal path: adjusting the exponent bias and left-shifting the
mantissa to fit the wider destination format.
4. Denormal path: normalizing by finding the MSB position of the
mantissa (via count-leading-zeros), computing the correct exponent from
that position, stripping the implicit leading 1, and shifting the
fraction into the destination mantissa field.
5. Assemble the destination IEEE bit pattern (sign | exponent |
mantissa) and select among the normal, denormal, and special-value
results.
Currently only conversions from OCP floats are covered, in LLVM terms
these are: Float8E5M2, Float8E4M3FN, Float6E3M2FN, Float6E2M3FN,
Float4E2M1FN.
OCP spec:
https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf
AI has assisted in X86 E2E testing.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list