[PATCH] D144935: Add missing roundtointegral builtin functions for some FP instructions to be generated from C-written codes
Jun Sha via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 6 22:17:41 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa7d6593a0a17: Add missing roundtointegral builtin functions for some FP instructions to be… (authored by joshua-arch1).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Changed prior to commit:
https://reviews.llvm.org/D144935?vs=500990&id=502927#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144935/new/
https://reviews.llvm.org/D144935
Files:
clang/include/clang/Basic/Builtins.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/builtins.c
Index: clang/test/CodeGen/builtins.c
===================================================================
--- clang/test/CodeGen/builtins.c
+++ clang/test/CodeGen/builtins.c
@@ -411,6 +411,15 @@
resld = __builtin_roundl(LD);
// CHECK: call x86_fp80 @llvm.round.f80
+ resf = __builtin_roundevenf(F);
+ // CHECK: call float @llvm.roundeven.f32
+
+ resd = __builtin_roundeven(D);
+ // CHECK: call double @llvm.roundeven.f64
+
+ resld = __builtin_roundevenl(LD);
+ // CHECK: call x86_fp80 @llvm.roundeven.f80
+
resli = __builtin_lroundf (F);
// CHECK: call i64 @llvm.lround.i64.f32
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -2444,6 +2444,18 @@
Intrinsic::round,
Intrinsic::experimental_constrained_round));
+ case Builtin::BIroundeven:
+ case Builtin::BIroundevenf:
+ case Builtin::BIroundevenl:
+ case Builtin::BI__builtin_roundeven:
+ case Builtin::BI__builtin_roundevenf:
+ case Builtin::BI__builtin_roundevenf16:
+ case Builtin::BI__builtin_roundevenl:
+ case Builtin::BI__builtin_roundevenf128:
+ return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(*this, E,
+ Intrinsic::roundeven,
+ Intrinsic::experimental_constrained_roundeven));
+
case Builtin::BIsin:
case Builtin::BIsinf:
case Builtin::BIsinl:
Index: clang/include/clang/Basic/Builtins.def
===================================================================
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -350,6 +350,11 @@
BUILTIN(__builtin_roundf16, "hh" , "Fnc")
BUILTIN(__builtin_roundl, "LdLd" , "Fnc")
BUILTIN(__builtin_roundf128, "LLdLLd" , "Fnc")
+BUILTIN(__builtin_roundeven, "dd" , "Fnc")
+BUILTIN(__builtin_roundevenf, "ff" , "Fnc")
+BUILTIN(__builtin_roundevenf16, "hh" , "Fnc")
+BUILTIN(__builtin_roundevenl, "LdLd" , "Fnc")
+BUILTIN(__builtin_roundevenf128, "LLdLLd" , "Fnc")
BUILTIN(__builtin_scalbln , "ddLi", "Fne")
BUILTIN(__builtin_scalblnf, "ffLi", "Fne")
BUILTIN(__builtin_scalblnl, "LdLdLi", "Fne")
@@ -1420,6 +1425,10 @@
LIBBUILTIN(roundf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
LIBBUILTIN(roundl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
+LIBBUILTIN(roundeven, "dd", "fnc", MATH_H, ALL_LANGUAGES)
+LIBBUILTIN(roundevenf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
+LIBBUILTIN(roundevenl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
+
LIBBUILTIN(scalbln, "ddLi", "fne", MATH_H, ALL_LANGUAGES)
LIBBUILTIN(scalblnf, "ffLi", "fne", MATH_H, ALL_LANGUAGES)
LIBBUILTIN(scalblnl, "LdLdLi", "fne", MATH_H, ALL_LANGUAGES)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144935.502927.patch
Type: text/x-patch
Size: 2823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230307/26cf1c14/attachment.bin>
More information about the cfe-commits
mailing list