summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
index c9af83010..2d2f6f9c6 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
@@ -25,6 +25,13 @@ IR::F32 TranslatorVisitor::F(IR::Reg reg) {
25 return ir.BitCast<IR::F32>(X(reg)); 25 return ir.BitCast<IR::F32>(X(reg));
26} 26}
27 27
28IR::F64 TranslatorVisitor::D(IR::Reg reg) {
29 if (!IR::IsAligned(reg, 2)) {
30 throw NotImplementedException("Unaligned source register {}", reg);
31 }
32 return IR::F64{ir.PackDouble2x32(ir.CompositeConstruct(X(reg), X(reg + 1)))};
33}
34
28void TranslatorVisitor::X(IR::Reg dest_reg, const IR::U32& value) { 35void TranslatorVisitor::X(IR::Reg dest_reg, const IR::U32& value) {
29 ir.SetReg(dest_reg, value); 36 ir.SetReg(dest_reg, value);
30} 37}
@@ -33,6 +40,16 @@ void TranslatorVisitor::F(IR::Reg dest_reg, const IR::F32& value) {
33 X(dest_reg, ir.BitCast<IR::U32>(value)); 40 X(dest_reg, ir.BitCast<IR::U32>(value));
34} 41}
35 42
43void TranslatorVisitor::D(IR::Reg dest_reg, const IR::F64& value) {
44 if (!IR::IsAligned(dest_reg, 2)) {
45 throw NotImplementedException("Unaligned destination register {}", dest_reg);
46 }
47 const IR::Value result{ir.UnpackDouble2x32(value)};
48 for (int i = 0; i < 2; i++) {
49 X(dest_reg + i, IR::U32{ir.CompositeExtract(result, i)});
50 }
51}
52
36IR::U32 TranslatorVisitor::GetReg8(u64 insn) { 53IR::U32 TranslatorVisitor::GetReg8(u64 insn) {
37 union { 54 union {
38 u64 raw; 55 u64 raw;
@@ -68,13 +85,9 @@ IR::F32 TranslatorVisitor::GetFloatReg39(u64 insn) {
68IR::F64 TranslatorVisitor::GetDoubleReg20(u64 insn) { 85IR::F64 TranslatorVisitor::GetDoubleReg20(u64 insn) {
69 union { 86 union {
70 u64 raw; 87 u64 raw;
71 BitField<20, 8, IR::Reg> src; 88 BitField<20, 8, IR::Reg> index;
72 } const index{insn}; 89 } const reg{insn};
73 const IR::Reg reg{index.src}; 90 return D(reg.index);
74 if (!IR::IsAligned(reg, 2)) {
75 throw NotImplementedException("Unaligned source register {}", reg);
76 }
77 return ir.PackDouble2x32(ir.CompositeConstruct(X(reg), X(reg + 1)));
78} 91}
79 92
80static std::pair<IR::U32, IR::U32> CbufAddr(u64 insn) { 93static std::pair<IR::U32, IR::U32> CbufAddr(u64 insn) {