Commit Graph

29 Commits

Author SHA1 Message Date
Matt Pharr
6b4459d402 Windows: fix some compiler warnings during build 2011-10-09 07:40:17 -07:00
Matt Pharr
4a2cbf2c4e Fix regression from AST checkin that caused perf. warnings to be issued for stdlib code. 2011-10-07 09:20:48 -07:00
Matt Pharr
06975bc7ab Add support for compiling to multiple targets.
If a flag along the lines of "--target=sse4,avx-x2" is provided on the command-line,
then the program will be compiled for each of the given targets, with a separate
output file generated for each one.  Further, an output file with dispatch functions
that check the current system's CPU and then chooses the best available variant
is also created.

Issue #11.
2011-10-04 16:01:55 -07:00
Matt Pharr
a6fc657b40 Remove 'externGlobals' member from Module; instead find them when needed via new SymbolTable::GetMatchingVariables method. 2011-10-04 06:36:31 -07:00
Matt Pharr
83f22f1939 Add experimental --fast-masked-vload flag for SSE. 2011-09-12 12:29:33 -07:00
Matt Pharr
7756265503 Add double-pumped AVX target (i.e., run 16-wide). Not yet tested. 2011-08-20 11:28:22 +01:00
Matt Pharr
fe54f1ad8e Fixes to build with latest LLVM ToT 2011-08-18 08:34:49 +01:00
Matt Pharr
04c93043d6 Target handling fixes.
Set the Module's target appropriately when it's first created.
Compile separate 32 and 64 bit versions of the builtins-c bitcocde
  and load the appropriate one based on the target we're compiling
  for.
2011-08-15 16:03:50 +01:00
Matt Pharr
0ac4f7b620 Add various prefetch functions to the standard library. 2011-08-03 13:31:45 -07:00
Matt Pharr
a552927a6a Cleanup implementation of target builtins code.
- Renamed stdlib-sse.ll to builtins-sse.ll (etc.) in an attempt to better indicate
the fact that the stuff in those files has a role beyond implementing stuff for
the standard library.
- Moved declarations of the various __pseudo_* functions from being done with LLVM
API calls in builtins.cpp to just straight up declarations in LLVM assembly
language in builtins.m4.  (Much less code to do it this way, and more clear what's
going on.)
2011-08-01 05:58:43 +01:00
Matt Pharr
43a619669f Fix memory bug where we were accessing memory that had been freed.
(The string for which c_str() was called was just a temporary, so its destructor ran after funcName was initialized, leading funcName to point at freed memory.)
2011-07-22 13:15:50 +01:00
Matt Pharr
98a2d69e72 Add code to check signatures of LLVM intrinsic declarations in stdlib*.ll files.
Fix a case where we were using the wrong signature for stmxcsr and ldmxcsr.
2011-07-22 12:53:17 +01:00
Matt Pharr
8ef3df57c5 Add support for in-memory half float data. Fixes issue #10 2011-07-21 15:55:45 +01:00
Matt Pharr
bba7211654 Add support for int8/int16 types. Addresses issues #9 and #42. 2011-07-21 06:57:40 +01:00
Matt Pharr
654cfb4b4b Many fixes for recent LLVM dev tree API changes 2011-07-18 15:54:39 +01:00
Matt Pharr
65a29ec316 Only create ispc-callable functions for bitcode functions that start with "__"
Don't create ispc-callable symbols for other functions that we find in the LLVM
bitcode files that are loaded up and linked into the module so that they can be 
called from ispc stdlib functions.  This fixes an issue where we had a clash
between the declared versions of double sin(double) and the corresponding
ispc stdlib routines for uniform doubles, which in turn led to bogus code
being generated for calls to those ispc stdlib functions.
2011-07-18 13:03:50 +01:00
Matt Pharr
17e5c8b7c2 Fix LLVM 2.9 build. 2011-07-13 09:24:02 +01:00
Andreas Wendleder
646db5aacb Reflect changes in LLVM's type system. 2011-07-13 06:44:44 +01:00
Matt Pharr
a535aa586b Fix issue #2: use zero extend to convert bool->int, not sign extend.
This way, we match C/C++ in that casting a bool to an int gives either the value
zero or the value one.  There is a new stdlib function int sign_extend(bool)
that does sign extension for cases where that's desired.
2011-07-12 13:30:05 +01:00
Matt Pharr
6e8af5038b Fix issue #62: emit stdlib code as char array, not a string
MSVC 2010 issues an error if given a string larger than 64k characters
long.  To work around this, the pre-processed stdlib.ispc code is now
stored as an array of characters terminated with a NUL (i.e. the same thing
in the end); MSVC is fine with arrays larger than 64k characters.
2011-07-08 09:14:52 -07:00
Matt Pharr
96ad2265e7 Merge pull request #59 from danschubert/patch-1
Fixed VC2010 warning
2011-07-07 05:27:24 -07:00
Matt Pharr
5a53a43ed0 Finish support for 64-bit types in stdlib. Fixes issue #14.
Add much more suppport for doubles and in64 types in the standard library, basically supporting everything for them that are supported for floats and int32s.  (The notable exceptions being the approximate rcp() and rsqrt() functions, which don't really have sensible analogs for doubles (or at least not built-in instructions).)
2011-07-07 13:25:55 +01:00
danschubert
be8e121b71 Fixed VC2010 error message: builtins.cpp(183): warning C4018: '<' : signed/unsigned mismatch 2011-07-07 05:19:32 -07:00
Matt Pharr
8e5ea9c33c Set up NULL values for default arguments when creating ispc functions from LLVM bitcode builtins.
Fixes occasional crashes due to accessing uninitialized memory.
2011-07-06 15:33:26 +01:00
Matt Pharr
6e4c165c7e Use malloc to allocate storage for task parameters on Windows.
Fixes bug #55.  A number of tests were crashing on Windows due to the task
launch code using alloca to allocate space for the tasks' parameters.  On
Windows, the stack isn't generally big enough for this to be a good idea.
Also added an alignment parmaeter to ISPCMalloc() to pass the alignment
requirement along.
2011-07-06 05:53:25 -07:00
Matt Pharr
5c810e620d Improvements to the routine that maps from LLVM types to ispc types. 2011-07-04 15:49:04 +01:00
Matt Pharr
c14c3ceba6 Provide both signed and unsigned int variants of bitcode-based builtins.
When creating function Symbols for functions that were defined in LLVM bitcode for the standard library, if any of the function parameters are integer types, create two ispc-side Symbols: one where the integer types are all signed and the other where they are all unsigned.  This allows us to provide, for example, both store_to_int16(reference int a[], uniform int offset, int val) as well as store_to_int16(reference unsigned int a[], uniform int offset, unsigned int val). functions.

Added some additional tests to exercise the new variants of these.

Also fixed some cases where the __{load,store}_int{8,16} builtins would read from/write to memory even if the mask was all off (which could cause crashes in some cases.)
2011-07-04 12:10:26 +01:00
Matt Pharr
fe7717ab67 Added shuffle() variant to the standard library that takes two
varying values and a permutation index that spans the concatenation
of the two of them (along the lines of SHUFPS...)
2011-07-02 08:43:35 +01:00
Matt Pharr
18af5226ba Initial commit. 2011-06-21 12:48:50 -07:00