CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
82 lines
3.2 KiB
C++
82 lines
3.2 KiB
C++
// Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include <rocRoller/CodeGen/Arithmetic/ArithmeticGenerator.hpp>
|
|
#include <rocRoller/CodeGen/Arithmetic/BitwiseOr.hpp>
|
|
#include <rocRoller/CodeGen/CopyGenerator.hpp>
|
|
#include <rocRoller/Utilities/Component.hpp>
|
|
|
|
namespace rocRoller
|
|
{
|
|
template <>
|
|
std::shared_ptr<BinaryArithmeticGenerator<Expression::BitwiseOr>>
|
|
GetGenerator<Expression::BitwiseOr>(Register::ValuePtr dst,
|
|
Register::ValuePtr lhs,
|
|
Register::ValuePtr rhs,
|
|
Expression::BitwiseOr const&)
|
|
{
|
|
return Component::Get<BinaryArithmeticGenerator<Expression::BitwiseOr>>(
|
|
getContextFromValues(dst, lhs, rhs), dst->regType(), dst->variableType().dataType);
|
|
}
|
|
|
|
Generator<Instruction> BitwiseOrGenerator::generate(Register::ValuePtr dest,
|
|
Register::ValuePtr lhs,
|
|
Register::ValuePtr rhs,
|
|
Expression::BitwiseOr const&)
|
|
{
|
|
AssertFatal(lhs != nullptr);
|
|
AssertFatal(rhs != nullptr);
|
|
|
|
auto elementBits = std::max({DataTypeInfo::Get(dest->variableType()).elementBits,
|
|
DataTypeInfo::Get(lhs->variableType()).elementBits,
|
|
DataTypeInfo::Get(rhs->variableType()).elementBits});
|
|
|
|
if(dest->regType() == Register::Type::Scalar)
|
|
{
|
|
if(elementBits <= 32u)
|
|
{
|
|
co_yield_(Instruction("s_or_b32", {dest}, {lhs, rhs}, {}, ""));
|
|
}
|
|
else if(elementBits == 64u)
|
|
{
|
|
co_yield_(Instruction("s_or_b64", {dest}, {lhs, rhs}, {}, ""));
|
|
}
|
|
else
|
|
{
|
|
Throw<FatalError>("Unsupported elementBits for bitwiseOr operation:: ",
|
|
ShowValue(elementBits));
|
|
}
|
|
}
|
|
else if(dest->regType() == Register::Type::Vector)
|
|
{
|
|
co_yield m_context->copier()->ensureTypeCommutative(
|
|
{Register::Type::Vector, Register::Type::Literal},
|
|
lhs,
|
|
{Register::Type::Vector},
|
|
rhs);
|
|
|
|
if(elementBits <= 32u)
|
|
{
|
|
co_yield_(Instruction("v_or_b32", {dest}, {lhs, rhs}, {}, ""));
|
|
}
|
|
else if(elementBits == 64u)
|
|
{
|
|
co_yield_(Instruction(
|
|
"v_or_b32", {dest->subset({0})}, {lhs->subset({0}), rhs->subset({0})}, {}, ""));
|
|
co_yield_(Instruction(
|
|
"v_or_b32", {dest->subset({1})}, {lhs->subset({1}), rhs->subset({1})}, {}, ""));
|
|
}
|
|
else
|
|
{
|
|
Throw<FatalError>("Unsupported elementBits for bitwiseOr operation:: ",
|
|
ShowValue(elementBits));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Throw<FatalError>("Unsupported register type for bitwiseOr operation: ",
|
|
ShowValue(dest->regType()));
|
|
}
|
|
}
|
|
}
|