[all-commits] [llvm/llvm-project] 7792f5: [clang] Add __builtin_convert_from_arbitrary_fp
Chinmay Deshpande via All-commits
all-commits at lists.llvm.org
Tue Jul 28 13:40:05 PDT 2026
Branch: refs/heads/users/chinmaydd/builtin-convert-from-arbitrary-fp
Home: https://github.com/llvm/llvm-project
Commit: 7792f522cc149f7a8b13be78c1ce62778069533c
https://github.com/llvm/llvm-project/commit/7792f522cc149f7a8b13be78c1ce62778069533c
Author: Chinmay Deshpande <chdeshpa at amd.com>
Date: 2026-07-28 (Tue, 28 Jul 2026)
Changed paths:
M clang/docs/LanguageExtensions.md
M clang/docs/ReleaseNotes.md
M clang/include/clang/AST/ComputeDependence.h
M clang/include/clang/AST/Expr.h
M clang/include/clang/AST/RecursiveASTVisitor.h
M clang/include/clang/AST/TextNodeDumper.h
M clang/include/clang/Basic/Builtins.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Basic/StmtNodes.td
M clang/include/clang/Basic/TokenKinds.def
M clang/include/clang/Sema/Sema.h
M clang/include/clang/Serialization/ASTBitCodes.h
M clang/lib/AST/ASTImporter.cpp
M clang/lib/AST/ComputeDependence.cpp
M clang/lib/AST/Expr.cpp
M clang/lib/AST/ExprClassification.cpp
M clang/lib/AST/ExprConstant.cpp
M clang/lib/AST/ItaniumMangle.cpp
M clang/lib/AST/StmtPrinter.cpp
M clang/lib/AST/StmtProfile.cpp
M clang/lib/AST/TextNodeDumper.cpp
M clang/lib/CodeGen/CGExprScalar.cpp
M clang/lib/Parse/ParseExpr.cpp
M clang/lib/Sema/SemaChecking.cpp
M clang/lib/Sema/SemaExceptionSpec.cpp
M clang/lib/Sema/SemaExpr.cpp
M clang/lib/Sema/TreeTransform.h
M clang/lib/Serialization/ASTReaderStmt.cpp
M clang/lib/Serialization/ASTWriterStmt.cpp
M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
M clang/test/AST/ast-dump-expr.c
A clang/test/CodeGen/builtins-convert-from-arbitrary-fp.c
M clang/test/CodeGenCXX/mangle-exprs.cpp
M clang/test/PCH/exprs.c
M clang/test/PCH/exprs.h
A clang/test/Sema/builtins-convert-from-arbitrary-fp.c
A clang/test/SemaCXX/builtins-convert-from-arbitrary-fp.cpp
M clang/tools/libclang/CIndex.cpp
M clang/tools/libclang/CXCursor.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
M llvm/test/CodeGen/X86/arbitrary-fp-to-float.ll
Log Message:
-----------
[clang] Add __builtin_convert_from_arbitrary_fp
Expose the llvm.convert.from.arbitrary.fp intrinsic as a target-independent
builtin. It reinterprets an integer as the bits of a narrow floating-point
format that has no corresponding C type, and widens it to a native
floating-point type:
_Float16 h = __builtin_convert_from_arbitrary_fp(b, "Float8E4M3FN", _Float16);
Since the destination type cannot be derived from the arguments, it is passed
as a type argument and the builtin is parsed as a keyword, following the
__builtin_convertvector precedent.
The format is a string literal validated with
APFloatBase::isValidArbitraryFPFormat, so every format the IR verifier accepts
is accepted here; formats that no target lowers yet keep being reported by the
backend. The integer operand may be any integer type whose width matches the
format, which covers char/unsigned char for the 8-bit formats and _BitInt for
the narrower ones. Vector operands are supported with matching element counts.
Clang only permits _BitInt vector elements of power-of-two width, so vectors of
the 6-bit formats cannot be spelled.
Change-Id: Ie725d2e7b1889f7c6368036a8c28e8ee18dd4125
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
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