// Copyright Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #include #include #include #include namespace rocRoller { template <> std::shared_ptr> GetGenerator(Register::ValuePtr dst, Register::ValuePtr lhs, Register::ValuePtr rhs, Expression::LogicalOr const&) { // Choose the proper generator, based on the context, register type // and datatype. return Component::Get>( getContextFromValues(dst, lhs, rhs), promoteRegisterType(nullptr, lhs, rhs), promoteDataType(nullptr, lhs, rhs)); } template <> Generator LogicalOrGenerator::generate( Register::ValuePtr dst, Register::ValuePtr lhs, Register::ValuePtr rhs, Expression::LogicalOr const&) { AssertFatal(lhs != nullptr); AssertFatal(rhs != nullptr); if(dst != nullptr && !dst->isSCC()) { co_yield(Instruction::Lock(Scheduling::Dependency::SCC, "Start Compare writing to non-SCC dest")); } auto tmp = Register::Value::Placeholder(m_context, Register::Type::Scalar, DataType::Raw32, 1); co_yield_(Instruction("s_or_b32", {tmp}, {lhs, rhs}, {}, "")); co_yield_(Instruction("s_cmp_lg_u32", {}, {tmp, Register::Value::Literal(0)}, {}, "")); if(dst != nullptr && !dst->isSCC()) { co_yield m_context->copier()->copy(dst, m_context->getSCC(), ""); co_yield(Instruction::Unlock("End Compare writing to non-SCC dest")); } } template <> Generator LogicalOrGenerator::generate( Register::ValuePtr dst, Register::ValuePtr lhs, Register::ValuePtr rhs, Expression::LogicalOr const&) { AssertFatal(lhs != nullptr); AssertFatal(rhs != nullptr); if(dst != nullptr && !dst->isSCC()) { co_yield(Instruction::Lock(Scheduling::Dependency::SCC, "Start Compare writing to non-SCC dest")); } auto tmp = Register::Value::Placeholder(m_context, Register::Type::Scalar, DataType::Bool64, 1); co_yield_(Instruction("s_or_b64", {tmp}, {lhs, rhs}, {}, "")); co_yield_(Instruction("s_cmp_lg_u64", {}, {tmp, Register::Value::Literal(0)}, {}, "")); if(dst != nullptr && !dst->isSCC()) { co_yield m_context->copier()->copy(dst, m_context->getSCC(), ""); co_yield(Instruction::Unlock("End Compare writing to non-SCC dest")); } } }