shader_ir/memory: Add LD_L 64 bits loads

This commit is contained in:
ReinUsesLisp 2019-02-02 23:43:11 -03:00
parent eceab45dac
commit 0be835132c

View File

@ -104,16 +104,27 @@ u32 ShaderIR::DecodeMemory(BasicBlock& bb, const BasicBlock& code, u32 pc) {
} }
case OpCode::Id::LD_L: { case OpCode::Id::LD_L: {
UNIMPLEMENTED_IF_MSG(instr.ld_l.unknown == 1, "LD_L Unhandled mode: {}", UNIMPLEMENTED_IF_MSG(instr.ld_l.unknown == 1, "LD_L Unhandled mode: {}",
static_cast<unsigned>(instr.ld_l.unknown.Value())); static_cast<u32>(instr.ld_l.unknown.Value()));
const Node index = Operation(OperationCode::IAdd, GetRegister(instr.gpr8), const auto GetLmem = [&](s32 offset) {
Immediate(static_cast<s32>(instr.smem_imm))); ASSERT(offset % 4 == 0);
const Node lmem = GetLocalMemory(index); const Node immediate_offset = Immediate(static_cast<s32>(instr.smem_imm) + offset);
const Node address = Operation(OperationCode::IAdd, NO_PRECISE, GetRegister(instr.gpr8),
immediate_offset);
return GetLocalMemory(address);
};
switch (instr.ldst_sl.type.Value()) { switch (instr.ldst_sl.type.Value()) {
case Tegra::Shader::StoreType::Bytes32: case Tegra::Shader::StoreType::Bytes32:
SetRegister(bb, instr.gpr0, lmem); SetRegister(bb, instr.gpr0, GetLmem(0));
break; break;
case Tegra::Shader::StoreType::Bytes64: {
SetTemporal(bb, 0, GetLmem(0));
SetTemporal(bb, 1, GetLmem(4));
SetRegister(bb, instr.gpr0, GetTemporal(0));
SetRegister(bb, instr.gpr0.Value() + 1, GetTemporal(1));
break;
}
default: default:
UNIMPLEMENTED_MSG("LD_L Unhandled type: {}", UNIMPLEMENTED_MSG("LD_L Unhandled type: {}",
static_cast<unsigned>(instr.ldst_sl.type.Value())); static_cast<unsigned>(instr.ldst_sl.type.Value()));