5788 Commits

Author SHA1 Message Date
Robin Voetter
64f99f36a6
spirv: ptr_add
Implements the ptr_add air tag for spirv.

The implementation for slices is probably wrong, but there seems to be no test for this...
2023-05-20 17:30:22 +02:00
Robin Voetter
0ba0d8fecb
spirv: dont use OpIAddCarry
This instruction is not really working well in the LLVM SPIRV translator,
as it is not implemented.

This commit also intruces the constructStruct helper function to initialize
structs at runtime. This is ALSO buggy in the translator, and we must work
around OpCompositeConstruct not working when some of the constituents are
runtime-known only.

Some other improvements are made:
- improved variable() so that it is more useful and no longer requires the
  address space. It always puts values in the Function address space,
  and returns a pointer to the Generic address space
- adds a boolToInt utility function
2023-05-20 17:30:21 +02:00
Robin Voetter
7d519b3383
spirv: use intInfo instead of arithmeticTypeInfo in airIntCast
This ensures that we can also cast enums and error sets here. In the future
this function will need to be changed to support composite and strange
integers, but that is fine.
2023-05-20 17:30:21 +02:00
Robin Voetter
6e3770e970
spirv: implement pointer comparison in for air cmp
It turns out that the Khronos LLVM SPIRV translator does not support OpPtrEqual.
Therefore, this instruction is emitted using a series of conversions.

This commit breaks intToEnum, because enum was removed from the arithmetic type
info. The enum should be converted to an int before this function is called.
2023-05-20 17:30:21 +02:00
Andrew Kelley
b873ce1e0e
Merge pull request #15727 from jacobly0/x86_64-behavior
x86_64: behavior
2023-05-19 00:56:59 -07:00
Andrew Kelley
503302ceef Sema: simplify "duplicate test name" error message
* Avoid redundant words ("found")
   - All compile errors are found by the compiler
 * Avoid unnecessary prepositions ("with")
   - There is a grammatically correct alternate word order without the
     preposition.
2023-05-18 19:17:04 -07:00
Jacob Young
79bdd2bd63 x86_64: implement saturating add/sub for weird types 2023-05-18 20:42:38 -04:00
Jacob Young
60e69fdaa1 codegen: emit global vector padding 2023-05-18 20:42:38 -04:00
Jacob Young
35da95fe87 x86_64: implement integer vector @truncate 2023-05-18 20:42:38 -04:00
Jacob Young
01b63cd081 x86_64: delete some incorrect code 2023-05-18 20:42:38 -04:00
Jacob Young
36ddab03fa x86_64: fix multi-limb compare 2023-05-18 20:42:38 -04:00
Jacob Young
80df8da82f x86_64: initialize array sentinels 2023-05-18 20:42:38 -04:00
Jacob Young
729daed591 x86_64: rewrite casts 2023-05-18 20:42:38 -04:00
Jacob Young
403c2d91be x86_64: fix float min/max behavior 2023-05-18 20:42:38 -04:00
Andrew Kelley
ad391ad399 Revert "Sema: handle recursive inferred errors better in analyzeIsNonErrComptimeOnly"
This reverts commit 5aa9628de3c6637f45b9d8cf8cbd19c422a74f6f.

This is a breaking language change and I do not agree with it. Please go
through the proposal process on this one.
2023-05-18 16:24:07 -07:00
zooster
3d64ed0353
make @trap return unreachable/noreturn (#15749)
`@trap` is a special function that we know never returns so it should
behave just like `@panic` and `@compileError` do currently and cause the
"unreachable code" + "control flow is diverted here" compile error.
Currently, `@trap(); @trap();` does not cause this error. Now it does.
2023-05-18 17:00:35 -04:00
Andrew Kelley
ad20236e97
Merge pull request #15573 from motiejus/resolv_dn
glibc hacks: also add a few dn_* functions
2023-05-17 10:42:32 -07:00
Andrew Kelley
958fba0eb7
Merge pull request #15713 from alichraghi/ali-spirv
spirv: get more behavior tests passing
2023-05-16 16:09:22 -07:00
Andrew Kelley
4ba61a2191
Merge pull request #15704 from Vexu/fix-memcpyset
`@mem{cpy,set}` fixes
2023-05-15 22:39:45 -07:00
Ali Chraghi
6fca3f8b72 spirv: lower ptrtoint & ignore dbg_inline instructions 2023-05-15 22:04:42 +03:30
Ali Chraghi
f8de4db873 spirv: implement arithmeticTypeInfo for Enum (@intToEnum) 2023-05-15 14:22:40 +03:30
Veikka Tuominen
0bc5e7b523 Sema: use elemPtrOneLayerOnly in zirMemCpy
Closes #15633
2023-05-15 10:31:24 +03:00
Veikka Tuominen
2703db3b40 Sema: add more type checks to @mem{cpy,set}
Closes #15634
Co-authored-by: Dima Afanasyev <dimaafanasev@example.com>
2023-05-15 10:31:24 +03:00
Veikka Tuominen
ab5a72f6ca Sema: ensure dest ptr of memcpy has length
Closes #15513
2023-05-15 10:31:24 +03:00
Jacob Young
40457a3696 x86_64: implement integer vector bitwise operations 2023-05-15 03:07:51 -04:00
Jacob Young
f39ff6cc68 x86_64: implement integer vector mul 2023-05-15 03:07:51 -04:00
Jacob Young
77a8cb5728 x86_64: fix @clz and @ctz of u8 2023-05-15 03:07:51 -04:00
Jacob Young
6c6d8d67cf x86_64: redo movement, float negation, and @fabs 2023-05-15 03:07:51 -04:00
Jacob Young
b6d6102850 x86_64: reimplement @floatToInt 2023-05-15 03:07:51 -04:00
Jacob Young
72b4657053 Dwarf: fix overflow write byte_size 2023-05-15 03:07:51 -04:00
Jacob Young
904ffb41de x86_64: implement calling function references 2023-05-15 03:07:51 -04:00
Jacob Young
57c38f6433 x86_64: implement global payload pointers 2023-05-15 03:07:51 -04:00
Jacob Young
2cbd442a9d x86_64: implement integer vector movement 2023-05-15 03:07:51 -04:00
Jacob Young
f83ebd8e6c x86_64: implement stack probing 2023-05-15 03:07:51 -04:00
Jacob Young
1336619979 x86_64: fix field_ptr nonsense 2023-05-15 03:07:51 -04:00
Jacob Young
81664f17d5 codegen: implement global enum_numbered 2023-05-15 03:07:51 -04:00
Jacob Young
e36e9323f4 x86_64: implement union_init 2023-05-15 03:07:51 -04:00
Jacob Young
019c884481 x86_64: add missing multply of f16 2023-05-15 03:07:51 -04:00
wrongnull
2516d8671f correct error note and check type of extern variables 2023-05-15 04:52:02 +03:00
Ali Chraghi
9c550721e4 spirv: lower float_to_int and int_to_float 2023-05-15 03:04:17 +03:30
Veikka Tuominen
68bacad804
Merge pull request #15643 from Vexu/fixes
make `@call` compile errors match regular calls
2023-05-13 12:52:16 +03:00
Veikka Tuominen
5aa9628de3 Sema: handle recursive inferred errors better in analyzeIsNonErrComptimeOnly
Closes #15669
2023-05-12 14:59:26 +03:00
Ali Chraghi
ccc490ef68
setup spirv backend in behavior tests 2023-05-11 20:31:52 +02:00
Andrew Kelley
7f7bd206dc
Merge pull request #15519 from dweiller/issue-15482
Optimize lowering of `s[start..][0..len]`
2023-05-11 08:59:44 -07:00
Andrew Kelley
3bb3d39fb4
Merge pull request #15487 from truemedian/http-tests
std.http: more http fixes, add standalone http server test
2023-05-11 08:37:42 -07:00
Andrew Kelley
5569e6b49d
Merge pull request #15639 from jacobly0/signed-mod
llvm/cbe: fix signed `@mod`/`@divFloor` computations
2023-05-11 08:36:33 -07:00
Andrew Kelley
c857959372
Merge pull request #15640 from jacobly0/min-max
llvm: fix `@max`/`@min` of unsupported float types
2023-05-11 08:35:08 -07:00
Veikka Tuominen
0958d5d7db Sema: fix crash when generating anon name on invalid code
Closes #15615
2023-05-11 17:23:06 +03:00
Veikka Tuominen
c0102ac1c8 Sema: add error for resolving inferred error set of generic function
Closes #14991
2023-05-11 17:23:06 +03:00
Veikka Tuominen
f0fdaf32d3 fix incorrect use of mutable pointers to temporary values 2023-05-11 17:23:06 +03:00