Commit Graph

1454 Commits

Author SHA1 Message Date
Andrew Kelley
33c592e981 make udivmod generic and add tests 2017-08-18 17:20:03 -04:00
Andrew Kelley
51bde26842 add compiler-rt fns: udivmodti4, udivti3, umodti3 2017-08-18 16:26:09 -04:00
Andrew Kelley
ea9e1639ca include compiler-rt tests in main testing suite 2017-08-18 13:51:16 -04:00
Andrew Kelley
0aa36e882e remove dependency on quadmath.h 2017-08-18 13:28:59 -04:00
Andrew Kelley
b73d4f74c2 depend on libquadmath
it seems to be shipped with gcc and clang
2017-08-18 13:13:03 -04:00
Andrew Kelley
e1c225694d cast between __float128 and double to fix build in some places 2017-08-18 12:43:48 -04:00
Andrew Kelley
3a762e5a8d make casting between __float128 and long double explicit 2017-08-18 12:37:01 -04:00
Andrew Kelley
1b5d61bee9 fix bitCast for big integers
and make bigfloat use __float128
2017-08-17 22:52:12 -04:00
Andrew Kelley
2173e1f457 fix big integer shifting by large number 2017-08-17 22:01:19 -04:00
Andrew Kelley
e63d864c1e add compiler_rt functions for f128
* __letf2
 * __cmptf2
 * __getf2
 * __unordtf2
 * __eqtf2
 * __lttf2
 * __netf2
 * __gttf2
2017-08-17 19:10:15 -04:00
Andrew Kelley
0d117bb0a9 fix wrong value for clz, ctz at compile time
closes #418

also make clz, ctz return smaller integer bit widths
and use smaller integer bit widths for enum tag types
2017-08-17 17:14:35 -04:00
Andrew Kelley
6a98bf3dba compiler_rt implementations for __fixuns* functions
* add u128 and i128 integer types
 * add f128 floating point type
 * implement big integer multiplication (See #405)
2017-08-16 19:07:35 -04:00
Andrew Kelley
cf46cd5f2b organize file path of compiler_rt 2017-08-15 07:16:22 -04:00
Andrew Kelley
38f898e9c7 update gitignore 2017-08-14 13:29:18 -04:00
Andrew Kelley
dea90e20e6 fix tokenization error pointing to wrong character
closes #401
2017-08-14 13:28:42 -04:00
Andrew Kelley
ba7b5daa22 Merge pull request #417 from zig-lang/coverage-fix
Fix coverage build command
2017-08-10 16:26:54 -04:00
Marc Tiehuis
3a0bfeb9d2 Fix coverage build command
Seems like this was deleted at some stage.

coverage command works as expected once removed. Do correct me if I've missed something, though.
2017-08-10 19:24:50 +12:00
Andrew Kelley
35d3444e27 more intuitive left shift and right shift operators
Before:
 * << is left shift, not allowed to shift 1 bits out
 * <<% is left shift, allowed to shift 1 bits out
 * >> is right shift, allowed to shift 1 bits out

After:
 * << is left shift, allowed to shift 1 bits out
 * >> is right shift, allowed to shift 1 bits out
 * @shlExact is left shift, not allowed to shift 1 bits out
 * @shrExact is right shift, not allowed to shift 1 bits out

Closes #413
2017-08-09 10:09:38 -04:00
Andrew Kelley
54675b060a add ptrToInt builtin, remove usize(ptr) cast
closes #415
2017-08-08 17:38:25 -04:00
Andrew Kelley
9ca798bc75 zen update 2017-08-08 15:49:12 -04:00
Andrew Kelley
221e5b188c README: add the zen of zig 2017-08-07 19:11:55 -04:00
Andrew Kelley
f78ee53484 fix printing floating point compile errors
now we just need compiler_rt implementations for:

 undefined symbol '__fixunsdfti'
 undefined symbol '__umodti3'
 undefined symbol '__udivti3'
2017-08-07 18:11:24 -04:00
Andrew Kelley
2234788fa8 add ability to explicitly cast float to integer
closes #414
2017-08-07 15:57:41 -04:00
Andrew Kelley
38b47d8aca Merge pull request #412 from zig-lang/issue-399
Correct floating-point literal allowed ranges
2017-08-07 09:15:13 -04:00
Marc Tiehuis
0705b711f8 Correct floating-point literal allowed ranges
The exponent range for floating-point values is [-1022, 1023].

Fixes #399.
2017-08-07 18:08:09 +12:00
Andrew Kelley
d8227c79a2 limit generated C preprocessor tokens to alphabet
closes #407

The mangling strategy replaces bytes outside the alphabet
with "_xx_" where xx is the hex code of the byte.
2017-08-06 19:31:05 -04:00
Andrew Kelley
1268bdfa60 Revert "silence false positives about uninitialized variables"
This reverts commit 3d1a0f2ee9.

breaks build for older compilers
2017-08-06 18:33:30 -04:00
Andrew Kelley
d83e4092bf fix constant debug info when number literal is 0 2017-08-06 18:15:11 -04:00
Andrew Kelley
a0a57beed5 fix invalid target info 2017-08-06 18:14:46 -04:00
Andrew Kelley
f1b2735a2e fix segfault when var args fn proto shows up in ir printing 2017-08-06 18:14:17 -04:00
Andrew Kelley
3d1a0f2ee9 silence false positives about uninitialized variables 2017-08-06 18:13:48 -04:00
Andrew Kelley
d247859ff6 remove duplicate gitignore entry 2017-08-06 16:14:57 -04:00
Andrew Kelley
57fb8efde2 add missing stdcallcc to ExitProcess decl 2017-08-06 16:13:52 -04:00
Andrew Kelley
ad9f48b74b fix initializing undefined and crash when casting to invalid type
closes #408
2017-08-05 16:54:50 -04:00
Marc Tiehuis
27e4893ee5 Add Visual Studio Code extension link 2017-07-15 21:36:47 +12:00
Andrew Kelley
f4b214c010 remove unused enum 2017-07-08 18:02:50 -04:00
Andrew Kelley
d1e68c3ca8 better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
Andrew Kelley
3e8af78895 Merge branch 'math'
This merges the standard library math functions that
Marc Tiehuis (@tiehuis) has been working on. Marc has
joined the Zig organization and now has commit access.
Thank you for this huge contribution to Zig.

Closes #374.
2017-06-27 17:15:41 -04:00
Marc Tiehuis
e81bf1c38c Return undefined in frexp instead of 0 on nan input
This is more in line what usual C implementations do.
2017-06-22 19:29:57 +12:00
Marc Tiehuis
5aff641f4b Fix pow tests
See #393.
2017-06-21 23:24:00 +12:00
Marc Tiehuis
994f4da8d4 Fix scalbn constant multiplier 2017-06-21 18:53:33 +12:00
Marc Tiehuis
14a324a0fa Fixes for release mode tests 2017-06-21 18:21:11 +12:00
Andrew Kelley
dfa2d11167 fix incorrect install line in cmakelists 2017-06-20 11:10:54 -04:00
Marc Tiehuis
aeb12d52b0 Add install targets for math library files 2017-06-20 23:10:50 +12:00
Marc Tiehuis
5bbec42a4e Add math special case tests and general fixes
- Should cover special case inputs for most functions
 - Fixed a number of runtime panicking behaviour reliant on shift
   overflow/division by zero etc.
2017-06-20 23:10:22 +12:00
Andrew Kelley
221286433a don't call c.getrandom because older libcs don't have it
See #397
2017-06-19 21:39:44 -04:00
Andrew Kelley
c9fc8bd802 workaround for llvm bug
See #393 for details
2017-06-19 14:36:33 -04:00
Andrew Kelley
799c699101 Merge branch 'master' into math 2017-06-19 11:01:41 -04:00
Andrew Kelley
62b23f5da5 build: link against system libs reported by llvm-config 2017-06-19 10:33:19 -04:00
Marc Tiehuis
4efb9ae2e5 Get tests passing under release mode
This does not fix the underlying issue in pow at this stage, but we may
be able to narrow down the cause after adding tests for specific edge
cases in functions.
2017-06-18 14:16:04 +12:00