summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/shader/decode/xmad.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/video_core/shader/decode/xmad.cpp b/src/video_core/shader/decode/xmad.cpp
index 61d23649d..fbd7e9a17 100644
--- a/src/video_core/shader/decode/xmad.cpp
+++ b/src/video_core/shader/decode/xmad.cpp
@@ -100,8 +100,7 @@ u32 ShaderIR::DecodeXmad(NodeBlock& bb, u32 pc) {
100 op_a, Immediate(0)); 100 op_a, Immediate(0));
101 const Node comp_b = GetPredicateComparisonInteger(PredCondition::Equal, is_signed_b, 101 const Node comp_b = GetPredicateComparisonInteger(PredCondition::Equal, is_signed_b,
102 op_b, Immediate(0)); 102 op_b, Immediate(0));
103 const Node comp = 103 const Node comp = Operation(OperationCode::LogicalOr, comp_a, comp_b);
104 Operation(OperationCode::LogicalOr, std::move(comp_a), std::move(comp_b));
105 104
106 const Node comp_minus_a = GetPredicateComparisonInteger( 105 const Node comp_minus_a = GetPredicateComparisonInteger(
107 PredCondition::NotEqual, is_signed_a, 106 PredCondition::NotEqual, is_signed_a,
@@ -120,9 +119,10 @@ u32 ShaderIR::DecodeXmad(NodeBlock& bb, u32 pc) {
120 original_c); 119 original_c);
121 new_c = Operation( 120 new_c = Operation(
122 OperationCode::Select, comp_minus_b, 121 OperationCode::Select, comp_minus_b,
123 SignedOperation(OperationCode::IAdd, is_signed_c, new_c, Immediate(-65536)), new_c); 122 SignedOperation(OperationCode::IAdd, is_signed_c, new_c, Immediate(-65536)),
123 std::move(new_c));
124 124
125 return Operation(OperationCode::Select, comp, original_c, new_c); 125 return Operation(OperationCode::Select, comp, original_c, std::move(new_c));
126 } 126 }
127 default: 127 default:
128 UNREACHABLE(); 128 UNREACHABLE();
@@ -134,18 +134,19 @@ u32 ShaderIR::DecodeXmad(NodeBlock& bb, u32 pc) {
134 op_c = GetTemporary(1); 134 op_c = GetTemporary(1);
135 135
136 // TODO(Rodrigo): Use an appropiate sign for this operation 136 // TODO(Rodrigo): Use an appropiate sign for this operation
137 Node sum = Operation(OperationCode::IAdd, product, op_c); 137 Node sum = SignedOperation(OperationCode::IAdd, is_signed_a, product, std::move(op_c));
138 SetTemporary(bb, 2, sum); 138 SetTemporary(bb, 2, sum);
139 sum = GetTemporary(2); 139 sum = GetTemporary(2);
140 if (is_merge) { 140 if (is_merge) {
141 const Node a = BitfieldExtract(sum, 0, 16); 141 const Node a = SignedOperation(OperationCode::IBitfieldExtract, is_signed_a, std::move(sum),
142 const Node b = 142 Immediate(0), Immediate(16));
143 Operation(OperationCode::ILogicalShiftLeft, NO_PRECISE, original_b, Immediate(16)); 143 const Node b = SignedOperation(OperationCode::ILogicalShiftLeft, is_signed_b, original_b,
144 sum = Operation(OperationCode::IBitwiseOr, NO_PRECISE, a, b); 144 Immediate(16));
145 sum = SignedOperation(OperationCode::IBitwiseOr, is_signed_a, a, b);
145 } 146 }
146 147
147 SetInternalFlagsFromInteger(bb, sum, instr.generates_cc); 148 SetInternalFlagsFromInteger(bb, sum, instr.generates_cc);
148 SetRegister(bb, instr.gpr0, sum); 149 SetRegister(bb, instr.gpr0, std::move(sum));
149 150
150 return pc; 151 return pc;
151} 152}