shader: Reimplement GetCbufU64 as GetCbufU32x2
It may generate better code on some compilers and it's easier to handle.
This commit is contained in:
parent
5b3c6d59c2
commit
3f594dd86b
9 changed files with 21 additions and 22 deletions
|
@ -30,25 +30,25 @@ void TranslatorVisitor::LDC(u64 insn) {
|
|||
const auto [index, offset]{Slot(ir, ldc.mode, imm_index, reg, imm)};
|
||||
switch (ldc.size) {
|
||||
case Size::U8:
|
||||
X(ldc.dest_reg, ir.GetCbuf(index, offset, 8, false));
|
||||
X(ldc.dest_reg, IR::U32{ir.GetCbuf(index, offset, 8, false)});
|
||||
break;
|
||||
case Size::S8:
|
||||
X(ldc.dest_reg, ir.GetCbuf(index, offset, 8, true));
|
||||
X(ldc.dest_reg, IR::U32{ir.GetCbuf(index, offset, 8, true)});
|
||||
break;
|
||||
case Size::U16:
|
||||
X(ldc.dest_reg, ir.GetCbuf(index, offset, 16, false));
|
||||
X(ldc.dest_reg, IR::U32{ir.GetCbuf(index, offset, 16, false)});
|
||||
break;
|
||||
case Size::S16:
|
||||
X(ldc.dest_reg, ir.GetCbuf(index, offset, 16, true));
|
||||
X(ldc.dest_reg, IR::U32{ir.GetCbuf(index, offset, 16, true)});
|
||||
break;
|
||||
case Size::B32:
|
||||
X(ldc.dest_reg, ir.GetCbuf(index, offset, 32, false));
|
||||
X(ldc.dest_reg, IR::U32{ir.GetCbuf(index, offset, 32, false)});
|
||||
break;
|
||||
case Size::B64: {
|
||||
if (!IR::IsAligned(ldc.dest_reg, 2)) {
|
||||
throw NotImplementedException("Unaligned destination register");
|
||||
}
|
||||
const IR::Value vector{ir.UnpackUint2x32(ir.GetCbuf(index, offset, 64, false))};
|
||||
const IR::Value vector{ir.GetCbuf(index, offset, 64, false)};
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
X(ldc.dest_reg + i, IR::U32{ir.CompositeExtract(vector, i)});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue