Commit Graph

248 Commits

Author SHA1 Message Date
Jeroen van Rijn
7c3ce334d6 Fix #4508 for abs, min, max (#4516)
* Fix #4508 for abs, min, max and the rest of the builtins.

None of these segfault now:
```odin
package bug

main :: proc() {
	p :: proc() {}

	// _ = len(p())
	// _ = cap(p())

	// _ = size_of(p())
	// _ = align_of(p())

	// T :: struct {}
	// _ = offset_of(p())
	// _ = offset_of(T, p())
	// _ = offset_of(p(), foo)
	// _ = offset_of(p(), "")

	// _ = type_of(p())
	// _ = type_info_of(p())
	// _ = typeid_of(p())

	// A: [4]int
	// _ = swizzle(p())    //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---
	// _ = swizzle(A, p()) //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---

	// _ = complex(p(), p())
	// _ = quaternion(p(), p(), p(), p())
	// _ = quaternion(w=p(), x=p(), y=p(), z=p())

	// _ = real(p())
	// _ = imag(p())
	// _ = jmag(p())
	// _ = kmag(p())
	// _ = conj(p())

	// _ = expand_values(p())

	// _ = min(p())
	// _ = max(p())
	// _ = abs(p())
	// _ = clamp(p(), p(), p())

	// _ = soa_zip(p())
	// _ = soa_unzip(p())
}
```
2024-11-25 15:27:35 +01:00
jakubtomsu
71880eb1ff report error when builtin min/max has 1 (non-type) param 2024-11-17 21:02:30 +01:00
gingerBill
ee76acd665 Merge pull request #4427 from laytan/posix-additions
Finish sys/posix with Linux and partial Windows support & clean up other packages as a result
2024-10-30 11:43:47 +00:00
Laytan
e064f8c6be fix #load_directory including nested directories 2024-10-28 18:59:39 +01:00
Misomosi
6ef915c312 Fixes #4395 by not assuming simd returns val 2024-10-20 22:51:39 -04:00
gingerBill
53bb6c85f7 a ordered to an ordered 2024-10-02 15:48:58 +01:00
Feoramund
9456c36684 Specify integer-like only for some atomic_* intrinsics
Fixes #4256
2024-09-18 17:18:48 -04:00
Laytan Laats
603efa860a add '#caller_expression' 2024-09-14 22:13:37 +02:00
Laytan Laats
490f8c1568 add fixed point sign extend to 128 int deps 2024-09-05 15:55:55 +02:00
Jeroen van Rijn
c1cb1a3d7e Simplified #assert check 2024-08-31 19:13:37 +02:00
Jeroen van Rijn
a4ac50a5b4 Check for #assert condition to be a constant bool
Fixes #4170
2024-08-31 19:06:17 +02:00
Laytan
d299d4e1cd riscv: add an error when atomics are used without the atomics extension 2024-08-25 21:17:00 +02:00
gingerBill
d0eaf7642d Add intrinsics.type_has_shared_fields 2024-08-24 14:36:18 +01:00
Laytan
ca6ef95b03 add support for linux_riscv64 and freestanding_riscv64 2024-08-20 14:06:40 +02:00
Laytan Laats
efe68c2e24 posix: add package 2024-08-14 01:44:35 +02:00
gingerBill
f56abf3780 Add intrinsics.masked_expand_load and intrinsics.masked_compress_store 2024-08-05 14:54:09 +01:00
gingerBill
84ac56f778 Add intrinsics.simd_masked_load and intrinsics.simd_masked_store 2024-08-05 14:08:41 +01:00
gingerBill
7e701d1677 Add intrinsics.simd_gather and `intrinsics.simd_scatter 2024-08-05 13:46:24 +01:00
gingerBill
90fc52c2ee Rename add_sat -> saturating_add 2024-08-05 13:19:01 +01:00
gingerBill
9a01a13914 Add simd_reduce_any and simd_reduce_all 2024-08-05 13:13:19 +01:00
gingerBill
fd06be2243 Allow swizzle to take more arguments than the original array length 2024-08-05 12:33:02 +01:00
Laytan Laats
853487e86c fix add_sat and sub_sat intrinsics 2024-07-16 22:07:49 +02:00
gingerBill
23ca27f40b Add intrinsics add_sat and sub_sat 2024-07-16 00:48:17 +01:00
gingerBill
d87583bead Minimize mutex lock for #load_directory 2024-07-15 02:22:23 +01:00
gingerBill
48aef50164 Add #load cache files to -export-dependencies:json 2024-07-08 17:46:10 +01:00
Karl Zylinski
782286357b error on type_of(value of untyped type) 2024-07-03 22:21:32 +02:00
gingerBill
544959326b Add intrinsics.type_struct_has_implicit_padding #3844 2024-07-01 12:13:35 +01:00
gingerBill
d6b8544f50 Add internal flag for testing stuff 2024-06-29 12:04:31 +01:00
gingerBill
c098739484 Remove @(warning) and #warning(...) 2024-06-25 09:36:59 +01:00
gingerBill
dab3c832e0 Add #warning(<string>) builtin compile time procedure 2024-06-20 15:32:30 +01:00
gingerBill
5dc98336a8 Merge pull request #3524 from Feoramund/freebsd-amd64-syscall-errno
Add `intrinsics.syscall_bsd`
2024-06-20 11:47:01 +01:00
gingerBill
23351ca8be Merge pull request #3137 from laytan/show-defineable
Add flags to show/export defineable values and warn if a -define is unused in the project
2024-06-20 11:45:52 +01:00
Feoramund
5b5402fb23 Add intrinsics.syscall_bsd
This is a BSD-style syscall that checks for a high Carry Flag as the
error state. If the CF is high, the boolean return value is false, and
if it is low (no errors) then the boolean return value is true.
2024-06-12 13:07:13 -04:00
gingerBill
fa3cae2bb0 Add intrinsics.procedure_of
```odin
foo :: proc(x: $T) { fmt.println(x) }
bar :: intrinsics.procedure_of(foo(int(123))) // parameters are never ran at compile time, similar to `size_of`
bar(333) // prints 333
```
2024-06-10 15:02:34 +01:00
Feoramund
49f147cc86 Prevent panic when swizzle called with < 2 indices
The requirement for at least 2 indices has been sourced from
`lb_addr_swizzle` in `llvm_backend_general.cpp`, where there is an
assert to ensure the swizzle_count is `1 < n <= 4`.
2024-06-08 17:05:00 -04:00
Laytan Laats
315695b4f8 collect and show docs of defineables 2024-06-07 15:08:41 +02:00
gingerBill
7044a7d776 Try to fix a possible race condition with polymorphic record parameters 2024-06-06 23:55:48 +01:00
Laytan Laats
b818a77131 check if -define is actually used 2024-06-06 19:46:01 +02:00
Laytan Laats
9a95049393 -show-defineables and -export-defineables 2024-06-06 19:44:54 +02:00
Laytan Laats
b47a15733d implement #exists(path) 2024-06-04 19:06:13 +02:00
Laytan Laats
4f5b2bd127 fix crash when you have 2 #load_directory calls with the same path 2024-06-04 19:01:50 +02:00
Dudejoe870
9b78061c8f Initial hash directive implementation 2024-05-28 22:42:10 -05:00
gingerBill
856537f0ce Fix #3603 2024-05-20 15:54:53 +01:00
gingerBill
5473758467 Add intrinsics type_is_matrix_row_major & type_is_matrix_column_major 2024-05-20 10:15:21 +01:00
gingerBill
c9b1c99a40 Fix soa_zip and soa_unzip 2024-05-16 16:27:09 +01:00
gingerBill
b0f0e4d02a Add intrinsics type_bit_set_elem_type & type_bit_set_underlying_type 2024-05-09 15:47:09 +01:00
gingerBill
05a1704898 Fix #3464 2024-05-07 11:24:21 +01:00
Laytan Laats
25f1d0906d compiler: improve target features support 2024-05-02 00:59:52 +02:00
gingerBill
3dfd61dd4f Make intrinsics.overflow_* NOT #optional_ok 2024-04-10 12:32:26 +01:00
Laytan Laats
ce196529dc enable the required target feature atomics when using them in wasm 2024-04-08 13:56:04 +02:00