diff options
author | bunnei <bunneidev@gmail.com> | 2021-07-29 18:45:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 18:45:37 -0700 |
commit | a98f14e9b0e6834a78136d623d5d094a57a10d1d (patch) | |
tree | 4b96040bfb6714e3e6115f0094391e3f7ec1fb53 /src/shader_recompiler/frontend/ir/value.h | |
parent | 23b3333f725d986bbe5ecf4715caef94aa7b0e4a (diff) | |
parent | 66a0cedba39cabba30c756626d7b58bd0e519d8e (diff) |
Merge pull request #6722 from ReinUsesLisp/xmad-opts
shader: Fold integer FMA from Nvidia's pattern
Diffstat (limited to 'src/shader_recompiler/frontend/ir/value.h')
-rw-r--r-- | src/shader_recompiler/frontend/ir/value.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 795194d410..334bb47aa8 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h @@ -57,6 +57,7 @@ public: [[nodiscard]] IR::Inst* Inst() const; [[nodiscard]] IR::Inst* InstRecursive() const; + [[nodiscard]] IR::Inst* TryInstRecursive() const; [[nodiscard]] IR::Value Resolve() const; [[nodiscard]] IR::Reg Reg() const; [[nodiscard]] IR::Pred Pred() const; @@ -308,6 +309,13 @@ inline IR::Inst* Value::InstRecursive() const { return inst; } +inline IR::Inst* Value::TryInstRecursive() const { + if (IsIdentity()) { + return inst->Arg(0).TryInstRecursive(); + } + return type == Type::Opaque ? inst : nullptr; +} + inline IR::Value Value::Resolve() const { if (IsIdentity()) { return inst->Arg(0).Resolve(); |