From 30f9dcd4f5e151601f2c75a0a4ae4419abf5aa37 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Tue, 13 Sep 2011 15:36:34 -0700 Subject: [PATCH] Unroll loops by default, add --opt=disable-loop-unroll to disable. Issue #78. --- examples/aobench_instrumented/Makefile | 2 +- ispc.cpp | 1 + ispc.h | 4 ++++ main.cpp | 31 +++++++++++++++++++------- opt.cpp | 6 +++-- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/examples/aobench_instrumented/Makefile b/examples/aobench_instrumented/Makefile index cedff406..20a5a9b9 100644 --- a/examples/aobench_instrumented/Makefile +++ b/examples/aobench_instrumented/Makefile @@ -2,7 +2,7 @@ CXX=g++ -m64 CXXFLAGS=-Iobjs/ -g3 -Wall ISPC=ispc -ISPCFLAGS=-O2 --fast-math --instrument --arch=x86-64 +ISPCFLAGS=-O2 --instrument --arch=x86-64 default: ao diff --git a/ispc.cpp b/ispc.cpp index cf9e307f..8430f791 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -256,6 +256,7 @@ Opt::Opt() { level = 1; fastMath = false; fastMaskedVload = false; + unrollLoops = true; disableBlendedMaskedStores = false; disableCoherentControlFlow = false; disableUniformControlFlow = false; diff --git a/ispc.h b/ispc.h index 8536732d..4b9bec65 100644 --- a/ispc.h +++ b/ispc.h @@ -244,6 +244,10 @@ struct Opt { arrays, so is unsafe in general.) */ bool fastMaskedVload; + /** Indicates when loops should be unrolled (when doing so seems like + it will make sense. */ + bool unrollLoops; + /** On targets that don't have a masked store instruction but do have a blending instruction, by default, we simulate masked stores by loading the old value, blending, and storing the result. This can diff --git a/main.cpp b/main.cpp index 4b74ffe6..c969f267 100644 --- a/main.cpp +++ b/main.cpp @@ -73,8 +73,6 @@ static void usage(int ret) { printf(" [--emit-asm]\t\t\tGenerate assembly language file as output\n"); printf(" [--emit-llvm]\t\t\tEmit LLVM bitode file as output\n"); printf(" [--emit-obj]\t\t\tGenerate object file file as output (default)\n"); - printf(" [--fast-math]\t\t\tPerform non-IEEE-compliant optimizations of numeric expressions\n"); - printf(" [--fast-masked-vload]\t\tFaster masked vector loads on SSE (may go past end of array)\n"); printf(" [-g]\t\t\t\tGenerate debugging information\n"); printf(" [--help]\t\t\t\tPrint help\n"); printf(" [-h /--header-outfile=]\tOutput filename for header\n"); @@ -88,8 +86,11 @@ static void usage(int ret) { printf(" [--nocpp]\t\t\t\tDon't run the C preprocessor\n"); printf(" [-o /--outfile=]\tOutput filename (may be \"-\" for standard output)\n"); printf(" [-O0/-O1]\t\t\t\tSet optimization level (-O1 is default)\n"); -#if 0 printf(" [--opt=