Commit Graph

82 Commits

Author SHA1 Message Date
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
Matt Pharr
f1aaf0115e Fix a number of cases in the parser where segfaults were possible with malformed programs. 2011-07-07 12:48:14 +01:00
Matt Pharr
6b5ee6ccc0 Add missing "$$=NULL;" in error production in parser.
This fixes a crash from a malformed program bug.
2011-07-07 11:10:27 +01:00
Matt Pharr
a1d5ea69b9 Support 64-bit integer constants in parser. Partial fix to issue #21. 2011-07-06 16:54:14 +01:00
Matt Pharr
af70718eca Always include the passed arg types when printing errors about function overload resolution failing. 2011-07-06 15:33:50 +01: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
4d733af3c7 Add check to make sure file exists before running preprocessor.
(If the file doesn't exist, clang ends up crashing, so we'd like to
avoid that.)
2011-07-06 11:33:33 +01:00
Matt Pharr
b8dae5cb9a Fix GetDirectoryAndFileName() on Windows.
Use the Windows pathname manipulation routines to robustly implement this
on Windows.  Fixes issue #30.
2011-07-06 03:23:25 -07:00
Matt Pharr
6ea213ad5d Added a few error productions to the parser.
A few more productions to recover from parse errors (in function parameter lists and in statement lists).  These eliminate some of the massive cascading error messages from a single parse error that the previous error recovery strategy would sometimes cause.  Fixes issue #44.
2011-07-06 09:32:14 +01:00
Pete Couperus
126e065601 Merge from petecoup/shortvec-in-struct branch.
Fixes issue #49: using short vector types in struct declarations
would give a bogus parse error.
2011-07-06 09:07:51 +01:00
Matt Pharr
5cc750ecee Add comment re popcnt on SSE2 target. 2011-07-06 07:38:29 +01:00
Matt Pharr
92106e866e Fix typos in documentation. 2011-07-06 07:37:20 +01:00
Matt Pharr
6d3e44ead7 Add missing 'internal' qualifiers to two atomic function implementations. 2011-07-06 07:20:46 +01:00
Matt Pharr
f0d254b941 Bump release number in doxygen.cfg v1.0.3 2011-07-04 17:27:01 +01:00
Matt Pharr
5bcc611409 Implement global atomics and a memory barrier in the standard library.
This checkin provides the standard set of atomic operations and a memory barrier in the ispc standard library.  Both signed and unsigned 32- and 64-bit integer types are supported.
2011-07-04 17:20:42 +01:00
Matt Pharr
24f47b300d Merge branch 'master' of github.com:ispc/ispc 2011-07-04 15:49:16 +01: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
c6bc8fd64f Type conversion and function call overload resolution bug fixes. 2011-07-04 15:11:28 +01:00
Matt Pharr
3b3015162f Documentation updates for new preprocessor support. 2011-07-04 14:55:55 +01:00
Matt Pharr
46ccc251c8 Added C preprocessor support for Windows.
Link the appropriate clang libraries to make the preprocessor
stuff work on Windows builds.  Also updated the solution files
for the examples to stop using cl.exe for preprocessing but to
just call ispc directly.  Finishes fixes for issue #32.
2011-07-04 05:01:04 -07:00
Matt Pharr
b0658549c5 Fix crash when no input filename was provided. 2011-07-04 12:52:03 +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
Pete Couperus
fac50ba454 Use clang's preprocessor, rather than forking a process to run cpp
on Mac/Linux (and not having a built-in preprocessor solution at all
on Windows.)  Fixes issue #32.
2011-07-04 08:35:31 +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
a9540b7c18 Update implementations of masked load/store builtins for AVX to actually use the AVX intrinsics that do this. (As always, not yet tested, pending fuller LLVM AVX support.) 2011-07-01 16:27:49 +01:00
Matt Pharr
28625eb1df Disable ability to specify AVX target on command line (pending things coming more online in LLVM's AVX codebase.) 2011-07-01 16:25:22 +01:00
Matt Pharr
c6bbfe8b54 Many fixes to AVX builtins implementations. (Found by inspection, still not working pending further LLVM support for AVX.)
- Call SSE versions for all the various scalar intrinsics
- Fix names of many (all?) AVX intrinsics; all were missing .256 suffix, others had additional issues.
2011-07-01 16:20:03 +01:00
Matt Pharr
9b7eb88b0c Small fixes to calls to SSE double-precision intrinsic calls for scalar values: actually use the scalar version, not the vector version. 2011-07-01 16:16:05 +01:00
Matt Pharr
6ed6961958 Add checks to sample task systems to ensure that TasksInit has been
called; if not, print an informative error message.
2011-07-01 14:11:16 +01:00
Matt Pharr
d2d5858be1 It is no longer legal to initialize arrays and structs with single
scalar values (that ispc used to smear across the array/struct
elements).  Now, initializers in variable declarations must be
{ }-delimited lists, with one element per struct member or array
element, respectively.

There were a few problems with the previous implementation of the
functionality to initialize from scalars.  First, the expression
would be evaluated once per value initialized, so if it had side-effects,
the wrong thing would happen.  Next, for large multidimensional arrays,
the generated code would be a long series of move instructions, rather
than loops (and this in turn made LLVM take a long time.)

While both of these problems are fixable, it's a non-trivial
amount of re-plumbing for a questionable feature anyway.

Fixes issue #50.
2011-07-01 13:45:58 +01:00
Matt Pharr
a2940d63b4 Update call to llvm::Target::createTargetMachine() for LLVM dev tree
build to handle recent change to API.  If building with LLVM tot, a
version starting with or after this change must be used:

    commit 276365dd4bc0c2160f91fd8062ae1fc90c86c324
    Author: Evan Cheng <evan.cheng@apple.com>
    Date:   Thu Jun 30 01:53:36 2011 +0000

    Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to
    be the first encoded as the first feature. It then uses the CPU name to look up
    features / scheduling itineray even though clients know full well the CPU name
    being used to query these properties.

    The fix is to just have the clients explictly pass the CPU name!

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 08:32:58 +01:00
Matt Pharr
32764e7639 Update release notes, doxygen version number v1.0.2 2011-07-01 05:12:57 +01:00
Matt Pharr
bcae21dbca Update examples to use fpmath:fast and to enable intrinsics on Windows 2011-06-30 13:17:14 -07:00
Matt Pharr
eb22fa6173 Generalize FunctionEmitContext::PtrToIntInst and IntToPtrInst to
do the right thing if given a varying lvalue (i.e. an array of
pointers).  Fixes issue #34.
2011-06-29 12:38:12 +01:00
Matt Pharr
5f7e61f9b5 Another stdlib dependency improvement 2011-06-29 12:26:44 +01:00
Matt Pharr
28a68e3c1f More code simplifications from using CollectionType. Finishes Issue #37 2011-06-29 09:32:31 +01:00
Matt Pharr
6b153566f3 Simplify a bunch of code by using CollectionType to collect struct
codepaths in with array/vector codepaths. (Issue #37).
2011-06-29 07:59:43 +01:00
Matt Pharr
214fb3197a Initial plumbing to add CollectionType base-class as common ancestor
to StructTypes, ArrayTypes, and VectorTypes.  Issue #37.
2011-06-29 07:42:09 +01:00
Matt Pharr
b4068efcfb Fixes to run_tests.sh script
- Use bash, not zsh (don't make people install zsh for no good reason)
- Print help if -h command line option is given
- Allow specifying the compilation target to use on the command line
- If one or more filenames are provided, just run those tests.  Otherwise,
  run everything in the tests/ directory.
2011-06-29 07:25:01 +01:00
Matt Pharr
24216d841f Update release notes for 1.0.2 stuff so far 2011-06-29 07:00:17 +01:00
Matt Pharr
be45beb54b Implement our own routine to turn C99-style hexadecimal float constants in strong form into floating-point values. With this, we can correctly handle hex float constants on Windows, where the builtin atof() routine just returns zero for them. Fixes issue #16. 2011-06-29 06:57:39 +01:00
Matt Pharr
cb58c78c1a Pipe through source file locations of structure element declarations; these are now supplied to the llvm::DIBuilder::createMemberType() method rather than giving it the position of the overall struct declaration for each one. Fixes issue #31 2011-06-29 05:38:42 +01:00
Matt Pharr
86de910ecd Improve implementation of __masked_store_blend_64() for AVX target by doing two 8-wide 32-bit blends rather than serializing. Fixes issue #29 2011-06-28 20:52:06 -07:00
Matt Pharr
ce7978ae74 Align stack-allocated arrays of uniform types to the target vector alignment (they will often be accessed in programCount-sized chunks and this should make that a bit more efficient in the common case). Fixes issue #15 2011-06-28 20:42:18 -07:00
Matt Pharr
7aec7486f8 Make SSE2 the default target on Atom CPUs unless explicitly overridden. (Fixes issue #45 2011-06-28 08:32:58 -07:00
Daniel Schubert
b6d6ee6fc2 Fixed typos. 2011-06-28 07:38:00 -07:00
Matt Pharr
cb74346d36 Fix typo (thx jsimmons) 2011-06-27 19:51:46 -07:00
Matt Pharr
2709c354d7 Add support for broadcast(), rotate(), and shuffle() stdlib routines 2011-06-27 17:31:44 -07:00
Matt Pharr
36063bae79 Update call to llvm::DIBuilder::createMemberType to fix building with LLVM dev TOT 2011-06-26 08:00:00 -07:00