mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
LLVM DSL: fix FNeg pattern matching
This commit is contained in:
parent
cda8b3a59e
commit
fc68c508c8
1 changed files with 14 additions and 1 deletions
|
@ -828,7 +828,7 @@ struct llvm_neg
|
|||
|
||||
static_assert(llvm_value_t<T>::is_sint || llvm_value_t<T>::is_uint || llvm_value_t<T>::is_float, "llvm_neg<>: invalid type");
|
||||
|
||||
static constexpr auto opc = llvm_value_t<T>::is_float ? llvm::Instruction::FSub : llvm::Instruction::Sub;
|
||||
static constexpr auto opc = llvm_value_t<T>::is_float ? llvm::Instruction::FNeg : llvm::Instruction::Sub;
|
||||
|
||||
llvm::Value* eval(llvm::IRBuilder<>* ir) const
|
||||
{
|
||||
|
@ -849,6 +849,19 @@ struct llvm_neg
|
|||
{
|
||||
llvm::Value* v1 = {};
|
||||
|
||||
if constexpr (llvm_value_t<T>::is_float)
|
||||
{
|
||||
if (auto i = llvm::dyn_cast_or_null<llvm::UnaryOperator>(value); i && i->getOpcode() == opc)
|
||||
{
|
||||
v1 = i->getOperand(0);
|
||||
|
||||
if (auto r1 = a1.match(v1); v1)
|
||||
{
|
||||
return r1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (auto i = llvm::dyn_cast_or_null<llvm::BinaryOperator>(value); i && i->getOpcode() == opc)
|
||||
{
|
||||
v1 = i->getOperand(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue