Added disable-handle-pseudo-memory-ops option.

This commit is contained in:
Matt Pharr
2011-10-23 13:35:23 -07:00
parent d224252b5d
commit 6084d6aeaf
4 changed files with 18 additions and 4 deletions

View File

@@ -284,6 +284,7 @@ Opt::Opt() {
fastMaskedVload = false; fastMaskedVload = false;
unrollLoops = true; unrollLoops = true;
disableAsserts = false; disableAsserts = false;
disableHandlePseudoMemoryOps = false;
disableBlendedMaskedStores = false; disableBlendedMaskedStores = false;
disableCoherentControlFlow = false; disableCoherentControlFlow = false;
disableUniformControlFlow = false; disableUniformControlFlow = false;

6
ispc.h
View File

@@ -227,6 +227,12 @@ struct Opt {
/** Indicates whether assert() statements should be ignored (for /** Indicates whether assert() statements should be ignored (for
performance in the generated code). */ performance in the generated code). */
bool disableAsserts; bool disableAsserts;
/** If enabled, the various __pseudo* memory ops (gather/scatter,
masked load/store) are left in their __pseudo* form, for better
understanding of the structure of generated code when reading
it. */
bool disableHandlePseudoMemoryOps;
/** On targets that don't have a masked store instruction but do have a /** On targets that don't have a masked store instruction but do have a
blending instruction, by default, we simulate masked stores by blending instruction, by default, we simulate masked stores by

View File

@@ -88,6 +88,7 @@ static void usage(int ret) {
printf(" fast-masked-vload\t\tFaster masked vector loads on SSE (may go past end of array)\n"); printf(" fast-masked-vload\t\tFaster masked vector loads on SSE (may go past end of array)\n");
printf(" fast-math\t\t\tPerform non-IEEE-compliant optimizations of numeric expressions\n"); printf(" fast-math\t\t\tPerform non-IEEE-compliant optimizations of numeric expressions\n");
#if 0 #if 0
printf(" disable-handle-pseudo-memory-ops\n");
printf(" disable-blended-masked-stores\t\tScalarize masked stores on SSE (vs. using vblendps)\n"); printf(" disable-blended-masked-stores\t\tScalarize masked stores on SSE (vs. using vblendps)\n");
printf(" disable-coherent-control-flow\t\tDisable coherent control flow optimizations\n"); printf(" disable-coherent-control-flow\t\tDisable coherent control flow optimizations\n");
printf(" disable-uniform-control-flow\t\tDisable uniform control flow optimizations\n"); printf(" disable-uniform-control-flow\t\tDisable uniform control flow optimizations\n");
@@ -254,6 +255,8 @@ int main(int Argc, char *Argv[]) {
// These are only used for performance tests of specific // These are only used for performance tests of specific
// optimizations // optimizations
else if (!strcmp(opt, "disable-handle-pseudo-memory-ops"))
g->opt.disableHandlePseudoMemoryOps = true;
else if (!strcmp(opt, "disable-blended-masked-stores")) else if (!strcmp(opt, "disable-blended-masked-stores"))
g->opt.disableBlendedMaskedStores = true; g->opt.disableBlendedMaskedStores = true;
else if (!strcmp(opt, "disable-coherent-control-flow")) else if (!strcmp(opt, "disable-coherent-control-flow"))

12
opt.cpp
View File

@@ -201,8 +201,10 @@ Optimize(llvm::Module *module, int optLevel) {
// them into something that can actually execute. // them into something that can actually execute.
optPM.add(llvm::createPromoteMemoryToRegisterPass()); optPM.add(llvm::createPromoteMemoryToRegisterPass());
optPM.add(CreateGatherScatterFlattenPass()); optPM.add(CreateGatherScatterFlattenPass());
optPM.add(CreateLowerGatherScatterPass()); if (g->opt.disableHandlePseudoMemoryOps == false) {
optPM.add(CreateLowerMaskedStorePass()); optPM.add(CreateLowerGatherScatterPass());
optPM.add(CreateLowerMaskedStorePass());
}
optPM.add(CreateIsCompileTimeConstantPass(true)); optPM.add(CreateIsCompileTimeConstantPass(true));
optPM.add(llvm::createFunctionInliningPass()); optPM.add(llvm::createFunctionInliningPass());
optPM.add(CreateMakeInternalFuncsStaticPass()); optPM.add(CreateMakeInternalFuncsStaticPass());
@@ -282,8 +284,10 @@ Optimize(llvm::Module *module, int optLevel) {
optPM.add(CreateLowerMaskedStorePass()); optPM.add(CreateLowerMaskedStorePass());
if (!g->opt.disableGatherScatterOptimizations) if (!g->opt.disableGatherScatterOptimizations)
optPM.add(CreateGatherScatterImprovementsPass()); optPM.add(CreateGatherScatterImprovementsPass());
optPM.add(CreateLowerMaskedStorePass()); if (g->opt.disableHandlePseudoMemoryOps == false) {
optPM.add(CreateLowerGatherScatterPass()); optPM.add(CreateLowerMaskedStorePass());
optPM.add(CreateLowerGatherScatterPass());
}
optPM.add(llvm::createFunctionInliningPass()); optPM.add(llvm::createFunctionInliningPass());
optPM.add(llvm::createConstantPropagationPass()); optPM.add(llvm::createConstantPropagationPass());
optPM.add(CreateIntrinsicsOptPass()); optPM.add(CreateIntrinsicsOptPass());