bool isCSpaceLoad(Instruction *);
bool isImmd32Load(Instruction *);
+ bool isAttribOrSharedLoad(Instruction *);
};
bool
return ld->src(0).getFile() == FILE_IMMEDIATE;
}
+bool
+LoadPropagation::isAttribOrSharedLoad(Instruction *ld)
+{
+ return ld &&
+ (ld->op == OP_VFETCH ||
+ (ld->op == OP_LOAD &&
+ (ld->src(0).getFile() == FILE_SHADER_INPUT ||
+ ld->src(0).getFile() == FILE_MEMORY_SHARED)));
+}
+
void
LoadPropagation::checkSwapSrc01(Instruction *insn)
{
insn->swapSources(0, 1);
else
return;
+ } else
+ if (isAttribOrSharedLoad(i1)) {
+ if (!isAttribOrSharedLoad(i0))
+ insn->swapSources(0, 1);
+ else
+ return;
} else {
return;
}