1154 Commits

Author SHA1 Message Date
Robin Voetter
3357c59ceb new builtins: @workItemId, @workGroupId, @workGroupSize
* @workItemId returns the index of the work item in a work group for a
  dimension.
* @workGroupId returns the index of the work group in the kernel dispatch for a
  dimension.
* @workGroupSize returns the size of the work group for a dimension.

These builtins are mainly useful for GPU backends. They are currently only
implemented for the AMDGCN LLVM backend.
2023-03-30 12:20:24 +03:00
Jakub Konka
0dc210f950 link: pass expected lib name as hint in getGlobalSymbol() 2023-03-28 12:28:48 +02:00
Jacob Young
fd13e44e0c x86_64: cleanup debug mir dumping 2023-03-27 05:58:00 -04:00
Jacob Young
802c2e4fae x86_64: fix popcnt and disable regressed test 2023-03-27 05:58:00 -04:00
Jacob Young
6c54428415 x86_64: implement trunc with large source 2023-03-27 05:58:00 -04:00
Jacob Young
587eacefec x86_64: fix 64-bit multiply by 32-bit immediate 2023-03-27 05:58:00 -04:00
Jacob Young
65838fcabe x86_64: implement some binary ops for large values 2023-03-27 05:58:00 -04:00
Jacob Young
3a516433b0 x86_64: add live codegen debug 2023-03-27 05:58:00 -04:00
Jacob Young
abb37a7cb8 x86_64: factor out lowering from emitting 2023-03-27 05:58:00 -04:00
Jacob Young
86625c5a75 x86_64: enable mem dst bin ops, and fix uncovered bugs 2023-03-27 04:31:39 -04:00
Jacob Young
14c0b8c548 x86_64: remove unused Mir encodings
This also restores the size of Mir.Inst and simplifies logic in general.
2023-03-25 21:26:18 -04:00
Jacob Young
d29c674d0d x86_64: implement teb inline assembly for windows 2023-03-25 16:23:55 -04:00
Jacob Young
1e080e5056 x86_64: implement atomic loops 2023-03-25 16:23:55 -04:00
Jacob Young
6d9bdc8733 x86_64: fix cmpxchg 2023-03-25 16:23:55 -04:00
Jacob Young
a2f6e068b0 x86_64: implement 128-bit intcast 2023-03-25 16:23:55 -04:00
Jacob Young
d064cf639f x86_64: implement 128-bit shifts 2023-03-25 16:23:55 -04:00
Jacob Young
77300c02d6 x86_64: implement large ptr_elem_val 2023-03-25 16:23:55 -04:00
Jacob Young
8f385e77ca x86_64: implement struct_field_val for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
0cfc0d0d13 x86_64: implement struct_field_ptr for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
3ece975857 x86_64: implement saturating arithmetic 2023-03-25 16:23:55 -04:00
Jacob Young
4ab4bd04fe x86_64: add back assume unused
This seems to have been asserting due to a value tracking bug that has
since been fixed.
2023-03-24 21:34:38 -04:00
Jacob Young
0987ed1970 x86_64: detect canonicalisation hazards 2023-03-24 17:57:58 -04:00
Jacob Young
5e0f091684 x86_64: try to fix br canonicalization 2023-03-24 17:57:58 -04:00
Jacob Young
935ec9ec6a x86_64: canonicalize each br of a block 2023-03-24 17:57:58 -04:00
Jacob Young
c604111e22 x86_64: fix block result value tracking 2023-03-24 17:57:58 -04:00
Jacob Young
12c07fcf20 x86_64: fix more value tracking bugs 2023-03-24 17:57:58 -04:00
Jacob Young
dbe1b4a7e5 x86_64: fix value tracking bugs 2023-03-24 17:57:58 -04:00
Jacob Young
c58b5732f3 x86_64: implement @byteSwap and @bitReverse 2023-03-21 08:49:54 +01:00
Jacob Young
f316cb29cc x86_64: implement atomic and fence ops 2023-03-21 08:49:54 +01:00
Jacob Young
3f4569bf18 codegen: fix backend breakage due to optional layout change 2023-03-21 08:49:54 +01:00
Jacob Young
6c453dd806 x86_64: implement some slice ops 2023-03-21 08:49:54 +01:00
Jacob Young
958c8e1ce9 x86_64: implement @popCount for older processors
This fixes the behavior tests when compiled for baseline.
2023-03-21 08:49:54 +01:00
Jacob Young
f95faac5ae x86_64: (re)implement optional ops
Note that this commit also changes the layout of optional for all
other backends using `src/codegen.zig` without updating them!
2023-03-21 08:49:54 +01:00
Jacob Young
24f0900ecb x86_64: implement some error union ops 2023-03-21 08:49:54 +01:00
Jacob Young
bbd05e2d97 x86_64: improve codegen for neg and not 2023-03-21 08:49:54 +01:00
Jacob Young
80427796df x86_64: implement @returnAddress and @frameAddress 2023-03-21 08:49:54 +01:00
Jacob Young
53ec2a955e x86_64: implement clz, ctz, and popCount 2023-03-21 08:49:54 +01:00
Jacob Young
edd63f9aba x86_64: reimplement inline memcpy and memset 2023-03-21 08:49:54 +01:00
Jacob Young
c865c8fb2a x86_64: implement float division intrinsics 2023-03-21 08:49:54 +01:00
Jacob Young
b6eebb709f x86_64: fix OBO
These loops were skipping over the top stack entry, and there's already
a function that does this correctly.
2023-03-21 08:49:54 +01:00
Jacob Young
30e1daa746 x86_64: implement basic float ops 2023-03-21 08:49:54 +01:00
Jacob Young
29e6aedc95 x86_64: implement min and max as commutative binary ops 2023-03-21 08:49:54 +01:00
Luuk de Gram
09d6938df9
wasm: add atomics opcodes and refactoring
This adds the atomic opcodes for the Threads proposal to the
WebAssembly specification: https://github.com/WebAssembly/threads

PrefixedOpcode has been renamed to MiscOpcode as there's multiple
types of prefixed opcodes. This naming is similar to other tools
such as LLVM. As we now use the 0xFE prefix, we moved the
function_index MIR instruction as it was occupying the same value.
This commit includes renaming all related opcodes.
2023-03-18 20:13:30 +01:00
Jacob Young
d70955b0df x86_64: turn packed struct crashes into compile errors 2023-03-15 01:04:21 -04:00
Jacob Young
ba9d93dc9f x86_64: implement more binary immediate combinations 2023-03-15 01:04:21 -04:00
Jacob Young
05b12e6779 x86_64: handle duplicate prong deaths 2023-03-15 01:04:21 -04:00
Jacob Young
2386159840 x86_64: use short union init 2023-03-15 01:04:21 -04:00
Jacob Young
d14a9e82fe x86_64: use new for loop syntax 2023-03-15 01:04:21 -04:00
Jacob Young
bb6b9c19e0 x86_64: fix lowering of non-pointer optional is null 2023-03-15 01:04:21 -04:00
Jacob Young
5ab426a302 x86_64: fix store of undefined 2023-03-15 00:01:44 -04:00