6 #include <gtest/gtest.h>
15 TEST(SExtOperationTests, test_bitunary_reduction)
22 auto bitType32 = BitType::Create(32);
26 auto y = bitnot_op::create(32, x);
29 auto & ex = GraphExport::Create(*z,
"x");
34 ReduceNode<SExtOperation>(
36 *jlm::rvsdg::TryGetOwnerNode<jlm::rvsdg::SimpleNode>(*ex.origin()));
42 EXPECT_TRUE(is<bitnot_op>(jlm::rvsdg::TryGetOwnerNode<jlm::rvsdg::Node>(*ex.origin())));
45 TEST(SExtOperationTests, test_bitbinary_reduction)
52 auto bt32 = BitType::Create(32);
57 auto z = bitadd_op::create(32, x, y);
60 auto & ex = GraphExport::Create(*w,
"x");
65 ReduceNode<SExtOperation>(
67 *jlm::rvsdg::TryGetOwnerNode<jlm::rvsdg::SimpleNode>(*ex.origin()));
73 EXPECT_TRUE(is<bitadd_op>(jlm::rvsdg::TryGetOwnerNode<jlm::rvsdg::Node>(*ex.origin())));
76 TEST(SExtOperationTests, test_inverse_reduction)
83 auto bt64 = BitType::Create(64);
90 auto & ex = GraphExport::Create(*z,
"x");
95 ReduceNode<SExtOperation>(
97 *jlm::rvsdg::TryGetOwnerNode<jlm::rvsdg::SimpleNode>(*ex.origin()));
103 EXPECT_EQ(ex.origin(), x);
TEST(SExtOperationTests, test_bitunary_reduction)
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const rvsdg::Type > &type)
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
static GraphImport & Create(Graph &graph, std::shared_ptr< const rvsdg::Type > type, std::string name)
Global memory state passed between functions.
std::string view(const rvsdg::Region *region)
std::optional< std::vector< rvsdg::Output * > > NormalizeUnaryOperation(const UnaryOperation &operation, const std::vector< rvsdg::Output * > &operands)
Applies the reductions implemented in the unary operations reduction functions.