// 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 arg, Expression::LogicalNot const&) { // Choose the proper generator, based on the context, register type // and datatype. return Component::Get>( getContextFromValues(dst, arg), arg->regType(), arg->variableType().dataType); } template <> Generator LogicalNotGenerator::generate( Register::ValuePtr dst, Register::ValuePtr arg, Expression::LogicalNot const&) { AssertFatal(arg != nullptr); AssertFatal(dst->registerCount() == 1, "Only single-register dst currently supported"); co_yield_(Instruction("s_xor_b32", {dst}, {arg, Register::Value::Literal(1)}, {}, "")); } template <> Generator LogicalNotGenerator::generate( Register::ValuePtr dst, Register::ValuePtr arg, Expression::LogicalNot const&) { AssertFatal(arg != nullptr); AssertFatal(dst->registerCount() == 1, "Only single-register dst currently supported"); co_yield_(Instruction("s_xor_b32", {dst}, {arg, Register::Value::Literal(1)}, {}, "")); } template <> Generator LogicalNotGenerator::generate( Register::ValuePtr dst, Register::ValuePtr arg, Expression::LogicalNot const&) { AssertFatal(arg != 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_xor_b64", {tmp}, {arg, Register::Value::Literal(1)}, {}, "")); 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")); } } }