mirror of
https://github.com/yuzu-emu/sirit
synced 2024-11-22 23:43:37 +00:00
Add OpLogicalNot and OpBitcast
This commit is contained in:
parent
4f66fb18e9
commit
9c7f96a809
4 changed files with 46 additions and 0 deletions
|
@ -243,6 +243,11 @@ class Module {
|
||||||
/// Result is true if Operand is false. Result is false if Operand is true.
|
/// Result is true if Operand is false. Result is false if Operand is true.
|
||||||
Id OpLogicalNot(Id result_type, Id operand);
|
Id OpLogicalNot(Id result_type, Id operand);
|
||||||
|
|
||||||
|
// Conversion
|
||||||
|
|
||||||
|
/// Bit pattern-preserving type conversion.
|
||||||
|
Id OpBitcast(Id result_type, Id operand);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Id AddCode(std::unique_ptr<Op> op);
|
Id AddCode(std::unique_ptr<Op> op);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ add_library(sirit
|
||||||
insts/annotation.cpp
|
insts/annotation.cpp
|
||||||
insts/misc.cpp
|
insts/misc.cpp
|
||||||
insts/logical.cpp
|
insts/logical.cpp
|
||||||
|
insts/conversion.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(sirit
|
target_include_directories(sirit
|
||||||
PUBLIC ../include
|
PUBLIC ../include
|
||||||
|
|
20
src/insts/conversion.cpp
Normal file
20
src/insts/conversion.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* 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::OpBitcast(Id result_type, Id operand) {
|
||||||
|
auto op{std::make_unique<Op>(spv::Op::OpBitcast, bound++, result_type)};
|
||||||
|
op->Add(operand);
|
||||||
|
return AddCode(std::move(op));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Sirit
|
20
src/insts/logical.cpp
Normal file
20
src/insts/logical.cpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* 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::OpLogicalNot(Id result_type, Id operand) {
|
||||||
|
auto op{std::make_unique<Op>(spv::Op::OpLogicalNot, bound++, result_type)};
|
||||||
|
op->Add(operand);
|
||||||
|
return AddCode(std::move(op));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Sirit
|
Loading…
Reference in a new issue