mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2026-01-01 20:25:23 +01:00
Add OpShift arithmetic and logical operations
This commit is contained in:
parent
9c7f96a809
commit
c29314ad14
3 changed files with 53 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ add_library(sirit
|
|||
insts/misc.cpp
|
||||
insts/logical.cpp
|
||||
insts/conversion.cpp
|
||||
insts/bit.cpp
|
||||
)
|
||||
target_include_directories(sirit
|
||||
PUBLIC ../include
|
||||
|
|
|
|||
38
src/insts/bit.cpp
Normal file
38
src/insts/bit.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* This file is part of the sirit project.
|
||||
* Copyright (c) 2018 ReinUsesLisp
|
||||
* This software may be used and distributed according to the terms of the GNU
|
||||
* Lesser General Public License version 2.1 or any later version.
|
||||
*/
|
||||
|
||||
#include "common_types.h"
|
||||
#include "op.h"
|
||||
#include "sirit/sirit.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
Id Module::OpShiftRightLogical(Id result_type, Id base, Id shift) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftRightLogical, bound++,
|
||||
result_type)};
|
||||
op->Add(base);
|
||||
op->Add(shift);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpShiftRightArithmetic(Id result_type, Id base, Id shift) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftRightArithmetic, bound++,
|
||||
result_type)};
|
||||
op->Add(base);
|
||||
op->Add(shift);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
Id Module::OpShiftLeftLogical(Id result_type, Id base, Id shift) {
|
||||
auto op{std::make_unique<Op>(spv::Op::OpShiftLeftLogical, bound++,
|
||||
result_type)};
|
||||
op->Add(base);
|
||||
op->Add(shift);
|
||||
return AddCode(std::move(op));
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
Loading…
Add table
Add a link
Reference in a new issue