[flang-commits] [flang] ece9aa2 - [flang] Implement the runtime portion of the UNPACK intrinsic
Peter Steinfeld via flang-commits
flang-commits at lists.llvm.org
Wed Jul 21 08:04:04 PDT 2021
Author: Peter Steinfeld
Date: 2021-07-21T08:03:49-07:00
New Revision: ece9aa29ff65dac90727810e2f72fc586b86de45
URL: https://github.com/llvm/llvm-project/commit/ece9aa29ff65dac90727810e2f72fc586b86de45
DIFF: https://github.com/llvm/llvm-project/commit/ece9aa29ff65dac90727810e2f72fc586b86de45.diff
LOG: [flang] Implement the runtime portion of the UNPACK intrinsic
I'd previously merged this into the fir-dev branch. This change is to
do the same thing to the main branch of llvm-project.
Differential Revision: https://reviews.llvm.org/D106294
Added:
Modified:
flang/unittests/RuntimeGTest/Transformational.cpp
Removed:
################################################################################
diff --git a/flang/unittests/RuntimeGTest/Transformational.cpp b/flang/unittests/RuntimeGTest/Transformational.cpp
index 90c1fa36d9941..969eea3ceaece 100644
--- a/flang/unittests/RuntimeGTest/Transformational.cpp
+++ b/flang/unittests/RuntimeGTest/Transformational.cpp
@@ -212,4 +212,20 @@ TEST(Transformational, Unpack) {
EXPECT_EQ(*result.ZeroBasedIndexedElement<std::int32_t>(j), expect[j]);
}
result.Destroy();
+
+ // Test for scalar value of the "field" argument
+ auto scalarField{MakeArray<TypeCategory::Integer, 4>(
+ std::vector<int>{}, std::vector<std::int32_t>{343})};
+ RTNAME(Unpack)(result, *vector, *mask, *scalarField, __FILE__, __LINE__);
+ EXPECT_EQ(result.rank(), 2);
+ EXPECT_EQ(result.GetDimension(0).LowerBound(), 1);
+ EXPECT_EQ(result.GetDimension(0).Extent(), 2);
+ EXPECT_EQ(result.GetDimension(1).LowerBound(), 1);
+ EXPECT_EQ(result.GetDimension(1).Extent(), 3);
+ static std::int32_t scalarExpect[6]{343, 1, 2, 343, 343, 3};
+ for (int j{0}; j < 6; ++j) {
+ EXPECT_EQ(
+ *result.ZeroBasedIndexedElement<std::int32_t>(j), scalarExpect[j]);
+ }
+ result.Destroy();
}
More information about the flang-commits
mailing list