summaryrefslogtreecommitdiff
path: root/yjit/src/asm/arm64
Commit message (Collapse)AuthorAgeFilesLines
* Various AArch64 optimizations (https://github.com/Shopify/ruby/pull/433)Kevin Newton2022-08-292-1/+7
| | | | | | | | | | * When we're storing an immediate 0 value at a memory address, we can use STUR XZR, Xd instead of loading 0 into a register and then storing that register. * When we're moving 0 into an argument register, we can use MOV Xd, XZR instead of loading the value into a register first. * In the newarray instruction, we can skip looking at the stack at all if the number of values we're using is 0.
* Optimize bitmask immediates (https://github.com/Shopify/ruby/pull/403)Kevin Newton2022-08-291-77/+18
|
* Op::Xor for backend IR (https://github.com/Shopify/ruby/pull/397)Kevin Newton2022-08-293-0/+64
|
* Load mem displacement when necessary on AArch64 ↵Kevin Newton2022-08-294-13/+149
| | | | | | | | (https://github.com/Shopify/ruby/pull/382) * LDR instruction for AArch64 * Split loads in arm64_split when memory address displacements do not fit
* Left and right shift for IR (https://github.com/Shopify/ruby/pull/374)Kevin Newton2022-08-292-2/+52
| | | | | | | | | * Left and right shift for IR * Update yjit/src/backend/x86_64/mod.rs Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
* A64: Fix off by one in offset encoding for BL ↵Alan Wu2022-08-291-2/+30
| | | | | | | | | | | | | | (https://github.com/Shopify/ruby/pull/344) * A64: Fix off by one in offset encoding for BL It's relative to the address of the instruction not the end of it. * A64: Fix off by one when encoding B It's relative to the start of the instruction not the end. * A64: Add some tests for boundary offsets
* Fixes (https://github.com/Shopify/ruby/pull/340)Kevin Newton2022-08-291-2/+8
| | | | | | * Fix conditional jumps to label * Bitmask immediates cannot be u64::MAX
* Fixes for AArch64 (https://github.com/Shopify/ruby/pull/338)Kevin Newton2022-08-294-86/+111
| | | | | | | | | | | | * Better splitting for Op::Add, Op::Sub, and Op::Cmp * Split stores if the displacement is too large * Use a shifted immediate argument * Split all places where shifted immediates are used * Add more tests to the cirrus workflow
* Fixes (https://github.com/Shopify/ruby/pull/336)Kevin Newton2022-08-291-1/+8
| | | | | | * Fix bitmask encoding to u32 * Fix splitting for Op::And to account for bitmask immediate
* Better splitting for Op::Test on AArch64 ↵Kevin Newton2022-08-291-2/+8
| | | | (https://github.com/Shopify/ruby/pull/335)
* A lot of fixes coming from our pairing session ↵Kevin Newton2022-08-295-237/+321
| | | | | | | | | | | | | | | | | | (https://github.com/Shopify/ruby/pull/329) * Move to/from SP on AArch64 * Consolidate loads and stores * Implement LDR post-index and LDR pre-index for AArch64 * Implement STR post-index and STR pre-index for AArch64 * Module entrypoints for LDR pre/post -index and STR pre/post -index * Use STR (pre-index) and LDR (post-index) to implement push/pop * Go back to using MOV for to/from SP
* Assert not the same register in AArch64Kevin Newton2022-08-291-0/+6
|
* BLR instruction for AArch64 (https://github.com/Shopify/ruby/pull/325)Kevin Newton2022-08-292-4/+34
|
* AArch64 frames (https://github.com/Shopify/ruby/pull/324)Kevin Newton2022-08-293-0/+338
|
* Conditionals (https://github.com/Shopify/ruby/pull/323)Kevin Newton2022-08-293-0/+97
| | | | | | * CSEL on AArch64 * Implement various Op::CSel* instructions
* Port print_int to the new backend (https://github.com/Shopify/ruby/pull/321)Kevin Newton2022-08-295-41/+184
| | | | | | * Port print_int to the new backend * Tests for print_int and print_str
* Port print_str to new backend (https://github.com/Shopify/ruby/pull/318)Kevin Newton2022-08-293-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | * ADR and ADRP for AArch64 * Implement Op::Jbe on X86 * Lera instruction * Op::BakeString * LeaPC -> LeaLabel * Port print_str to the new backend * Port print_value to the new backend * Port print_ptr to the new backend * Write null-terminators in Op::BakeString * Fix up rebase issues on print-str port * Add back in panic for X86 backend for unsupported instructions being lowered * Fix target architecture
* Op::CPushAll and Op::CPopAll (https://github.com/Shopify/ruby/pull/317)Kevin Newton2022-08-291-12/+18
| | | | | Instructions for pushing all caller-save registers and the flags so that we can implement dump_insns.
* Encode MRS and MSR for AArch64 (https://github.com/Shopify/ruby/pull/315)Kevin Newton2022-08-295-0/+130
|
* Better label refs (https://github.com/Shopify/ruby/pull/310)Kevin Newton2022-08-293-19/+21
| | | | | | | | | | | | | | | | Previously we were using a `Box<dyn FnOnce>` to support patching the code when jumping to labels. We needed to do this because some of the closures that were being used to patch needed to capture local variables (on both X86 and ARM it was the type of condition for the conditional jumps). To get around that, we can instead use const generics since the condition codes are always known at compile-time. This means that the closures go from polymorphic to monomorphic, which means they can be represented as an `fn` instead of a `Box<dyn FnOnce>`, which means they can fall back to a plain function pointer. This simplifies the storage of the `LabelRef` structs and should hopefully be a better default going forward.
* More Arm64 lowering/backend work (https://github.com/Shopify/ruby/pull/307)Kevin Newton2022-08-294-17/+206
| | | | | | | | | | | | | | | | | | | * More Arm64 lowering/backend work * We now have encoding support for the LDR instruction for loading a PC-relative memory location * You can now call add/adds/sub/subs with signed immediates, which switches appropriately based on sign * We can now load immediates into registers appropriately, attempting to keep the minimal number of instructions: * If it fits into 16 bytes, we use just a single movz. * Else if it can be encoded into a bitmask immediate, we use a single mov. * Otherwise we use a movz, a movk, and then optionally another one or two movks. * Fixed a bunch of code to do with the Op::Load opcode. * We now handle GC-offsets properly for Op::Load by skipping around them with a jump instruction. (This will be made better by constant pools in the future.) * Op::Lea is doing what it's supposed to do now. * Fixed a bug in the backend tests to do with not using the result of an Op::Add. * Fix the remaining tests for Arm64 * Move split loads logic into each backend
* Arm64 progress (https://github.com/Shopify/ruby/pull/304)Kevin Newton2022-08-298-43/+474
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Get initial wiring up * Split IncrCounter instruction * Breakpoints in Arm64 * Support for ORR * MOV instruction encodings * Implement JmpOpnd and CRet * Add ORN * Add MVN * PUSH, POP, CCALL for Arm64 * Some formatting and implement Op::Not for Arm64 * Consistent constants when working with the Arm64 SP * Allow OR-ing values into the memory buffer * Test lowering Arm64 ADD * Emit unconditional jumps consistently in Arm64 * Begin emitting conditional jumps for A64 * Back out some labelref changes * Remove label API that no longer exists * Use a trait for the label encoders * Encode nop * Add in nops so jumps are the same width no matter what on Arm64 * Op::Jbe for CodePtr * Pass src_addr and dst_addr instead of calculated offset to label refs * Even more jump work for Arm64 * Fix up jumps to use consistent assertions * Handle splitting Add, Sub, and Not insns for Arm64 * More Arm64 splits and various fixes * PR feedback for Arm64 support * Split up jumps and conditional jump logic
* LSL, LSR, B.cond (https://github.com/Shopify/ruby/pull/303)Kevin Newton2022-08-2914-487/+801
| | | | | | | | | | * LSL and LSR * B.cond * Move A64 files around to make more sense * offset -> byte_offset for bcond
* TST, CMP, AND/ANDS with registers (https://github.com/Shopify/ruby/pull/301)Kevin Newton2022-08-295-0/+290
| | | | | | | | * Add TST instruction and AND/ANDS entrypoints for immediates * TST/AND/ANDS for registers * CMP instruction
* AND/ANDS for A64 (https://github.com/Shopify/ruby/pull/300)Kevin Newton2022-08-293-0/+349
|
* LDADDAL, STUR, BL (https://github.com/Shopify/ruby/pull/299)Kevin Newton2022-08-295-53/+384
| | | | | | | | | | | | | | * LDADDAL instruction * STUR * BL instruction * Remove num_bits from imm and uimm * Tests for imm_fits_bits and uimm_fits_bits * Reorder arguments to LDADDAL
* MOVK, MOVZ, BR (https://github.com/Shopify/ruby/pull/296)Kevin Newton2022-08-298-158/+430
| | | | | | | | | | | | * MOVK instruction * More tests for the A64 entrypoints * Finish testing entrypoints * MOVZ * BR instruction
* LDUR (https://github.com/Shopify/ruby/pull/295)Kevin Newton2022-08-296-206/+379
| | | | | | | | | | | | | | | | * LDUR * Fix up immediate masking * Consume operands directly * Consistency and cleanup * More consistency and entrypoints * Cleaner syntax for masks * Cleaner shifting for encodings
* RET A64 instructions (https://github.com/Shopify/ruby/pull/294)Kevin Newton2022-08-292-0/+71
|
* * Arm64 Beginnings (https://github.com/Shopify/ruby/pull/291)Maxime Chevalier-Boisvert2022-08-298-0/+666
* Initial setup for aarch64 * ADDS and SUBS * ADD and SUB for immediates * Revert moved code * Documentation * Rename Arm64* to A64* * Comments on shift types * Share sig_imm_size and unsig_imm_size