[PATCH] D83065: Added runtime function definitions
Zachary Selk via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 11:19:59 PDT 2020
zacharyselk created this revision.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Added runtime function definitions for 32-bit real I/O and 32-bit complex output
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83065
Files:
flang/runtime/io-api.cpp
Index: flang/runtime/io-api.cpp
===================================================================
--- flang/runtime/io-api.cpp
+++ flang/runtime/io-api.cpp
@@ -784,6 +784,36 @@
return false;
}
+bool IONAME(OutputReal32)(Cookie cookie, float x) {
+ IoStatementState &io{*cookie};
+ if (!io.get_if<OutputStatementState>()) {
+ io.GetIoErrorHandler().Crash(
+ "OutputReal32() called for a non-output I/O statement");
+ return false;
+ }
+ if (auto edit{io.GetNextDataEdit()}) {
+ return RealOutputEditing<24>{io, x}.Edit(*edit);
+ }
+ return false;
+}
+
+bool IONAME(InputReal32)(Cookie cookie, float &x) {
+ IoStatementState &io{*cookie};
+ if (!io.get_if<InputStatementState>()) {
+ io.GetIoErrorHandler().Crash(
+ "InputReal32() called for a non-input I/O statement");
+ return false;
+ }
+ if (auto edit{io.GetNextDataEdit()}) {
+ if (edit->descriptor == DataEdit::ListDirectedNullValue) {
+ return true;
+ }
+ return EditRealInput<24>(io, *edit, reinterpret_cast<void *>(&x));
+ }
+ return false;
+}
+
+
bool IONAME(OutputReal64)(Cookie cookie, double x) {
IoStatementState &io{*cookie};
if (!io.get_if<OutputStatementState>()) {
@@ -813,6 +843,19 @@
return false;
}
+bool IONAME(OutputComplex32)(Cookie cookie, float r, float z) {
+ IoStatementState &io{*cookie};
+ if (io.get_if<ListDirectedStatementState<Direction::Output>>()) {
+ std::cout << "32 bit\n";
+ DataEdit real, imaginary;
+ real.descriptor = DataEdit::ListDirectedRealPart;
+ imaginary.descriptor = DataEdit::ListDirectedImaginaryPart;
+ return RealOutputEditing<24>{io, r}.Edit(real) &&
+ RealOutputEditing<24>{io, z}.Edit(imaginary);
+ }
+ return IONAME(OutputReal32)(cookie, r) && IONAME(OutputReal32)(cookie, z);
+}
+
bool IONAME(OutputComplex64)(Cookie cookie, double r, double z) {
IoStatementState &io{*cookie};
if (io.get_if<ListDirectedStatementState<Direction::Output>>()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83065.275172.patch
Type: text/x-patch
Size: 1962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/673daeed/attachment.bin>
More information about the llvm-commits
mailing list