diff --git a/main.cpp b/main.cpp index 2ec1f9a8..3af1c776 100644 --- a/main.cpp +++ b/main.cpp @@ -91,7 +91,7 @@ static void usage(int ret) { printf(" disable-gather-scatter-flattening\tDisable flattening when all lanes are on\n"); printf(" disable-uniform-memory-optimizations\tDisable uniform-based coherent memory access\n"); printf(" disable-masked-store-optimizations\tDisable lowering to regular stores when possible\n"); - printf(" [--target={sse2,sse4,sse4x2,avx}] Select target ISA (SSE4 is default)\n"); + printf(" [--target={sse2,sse4,sse4x2,avx}] Select target ISA (SSE4 is default unless compiling for atom; then SSE2 is.)\n"); printf(" [--version]\t\t\t\tPrint ispc version\n"); printf(" [--woff]\t\t\t\tDisable warnings\n"); printf(" [--wno-perf]\t\t\tDon't issue warnings related to performance-related issues\n"); @@ -192,7 +192,7 @@ int main(int Argc, char *Argv[]) { // as we're parsing below g = new Globals; - bool debugSet = false, optSet = false; + bool debugSet = false, optSet = false, targetSet = false; Module::OutputType ot = Module::Object; for (int i = 1; i < argc; ++i) { @@ -226,6 +226,7 @@ int main(int Argc, char *Argv[]) { else if (!strcmp(argv[i], "--target")) { if (++i == argc) usage(1); lDoTarget(argv[i]); + targetSet = true; } else if (!strncmp(argv[i], "--target=", 9)) { const char *target = argv[i] + 9; @@ -315,6 +316,11 @@ int main(int Argc, char *Argv[]) { if (debugSet && !optSet) g->opt.level = 0; + // Make SSE2 the default target on atom unless the target has been set + // explicitly. + if (!targetSet && (g->target.cpu == "atom")) + lDoTarget("sse2"); + m = new Module(file); if (m->CompileFile() == 0) { if (outFileName != NULL)