summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
authorGravatar bunnei2021-07-29 18:45:37 -0700
committerGravatar GitHub2021-07-29 18:45:37 -0700
commita98f14e9b0e6834a78136d623d5d094a57a10d1d (patch)
tree4b96040bfb6714e3e6115f0094391e3f7ec1fb53 /src/shader_recompiler/frontend
parentMerge pull request #6751 from Morph1984/languagecode (diff)
parentshader: Fold integer FMA from Nvidia's pattern (diff)
downloadyuzu-a98f14e9b0e6834a78136d623d5d094a57a10d1d.tar.gz
yuzu-a98f14e9b0e6834a78136d623d5d094a57a10d1d.tar.xz
yuzu-a98f14e9b0e6834a78136d623d5d094a57a10d1d.zip
Merge pull request #6722 from ReinUsesLisp/xmad-opts
shader: Fold integer FMA from Nvidia's pattern
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r--src/shader_recompiler/frontend/ir/value.h8
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 795194d41..334bb47aa 100644
--- a/src/shader_recompiler/frontend/ir/value.h
+++ b/src/shader_recompiler/frontend/ir/value.h
@@ -57,6 +57,7 @@ public:
57 57
58 [[nodiscard]] IR::Inst* Inst() const; 58 [[nodiscard]] IR::Inst* Inst() const;
59 [[nodiscard]] IR::Inst* InstRecursive() const; 59 [[nodiscard]] IR::Inst* InstRecursive() const;
60 [[nodiscard]] IR::Inst* TryInstRecursive() const;
60 [[nodiscard]] IR::Value Resolve() const; 61 [[nodiscard]] IR::Value Resolve() const;
61 [[nodiscard]] IR::Reg Reg() const; 62 [[nodiscard]] IR::Reg Reg() const;
62 [[nodiscard]] IR::Pred Pred() const; 63 [[nodiscard]] IR::Pred Pred() const;
@@ -308,6 +309,13 @@ inline IR::Inst* Value::InstRecursive() const {
308 return inst; 309 return inst;
309} 310}
310 311
312inline IR::Inst* Value::TryInstRecursive() const {
313 if (IsIdentity()) {
314 return inst->Arg(0).TryInstRecursive();
315 }
316 return type == Type::Opaque ? inst : nullptr;
317}
318
311inline IR::Value Value::Resolve() const { 319inline IR::Value Value::Resolve() const {
312 if (IsIdentity()) { 320 if (IsIdentity()) {
313 return inst->Arg(0).Resolve(); 321 return inst->Arg(0).Resolve();