Taylor R Campbell [Sun, 25 Aug 2019 19:49:44 +0000 (19:49 +0000)]
Merge branch 'riastradh-
20190113-aarch64-v6'
Taylor R Campbell [Sun, 25 Aug 2019 19:48:23 +0000 (19:48 +0000)]
Open-code floating-point arithmetic on aarch64.
Disabled by default for now due to limited testing.
Taylor R Campbell [Sun, 25 Aug 2019 19:25:34 +0000 (19:25 +0000)]
Reduce some extraneous MOVK instructions in immediate loads.
Taylor R Campbell [Sun, 25 Aug 2019 19:03:51 +0000 (19:03 +0000)]
Fix set of architectures with busted fp compare exceptions.
Taylor R Campbell [Sun, 25 Aug 2019 19:03:01 +0000 (19:03 +0000)]
Work around buggy libm on NetBSD/aarch64.
Will be fixed upstream but it doesn't hurt to add one more bit here.
Taylor R Campbell [Sun, 25 Aug 2019 18:35:37 +0000 (18:35 +0000)]
Show for which parameters the test failed.
Taylor R Campbell [Sun, 25 Aug 2019 18:32:03 +0000 (18:32 +0000)]
Simplify flo:-inf.0 and flo:+inf.0.
We have put out a release now whose reader understands +inf.0/-inf.0,
so we should be able to use the notation.
Fixes bugs with incorrectly raising the divide-by-zero exception flag
(even if no trap), e.g.:
;|log1mexp-invalid/(4.
9406564584124654e-324)| failed 1 sub-tests out of 1 in 0. seconds:
assertion 3: value was 3 but expected an object eqv? to 1
Here 3 = (invalid-operation divide-by-zero), 1 = (invalid-operation)
[aarch64].
Taylor R Campbell [Sun, 25 Aug 2019 18:25:43 +0000 (18:25 +0000)]
Fix missing #include.
Mistake failed silently because it only changed #ifdef outcome.
Taylor R Campbell [Sun, 25 Aug 2019 15:40:15 +0000 (15:40 +0000)]
Let caller specify how to get a temporary in ADD-IMMEDIATE.
Fixes
; Compiling file: "test-hack.bin" => "test-hack.com"...
;Unassigned variable: *needed-registers*
because of attempt to allocate a temporary in ADD-IMMEDIATE during
GENERATE/REMOTE-LINKS.
Taylor R Campbell [Sun, 25 Aug 2019 15:38:25 +0000 (15:38 +0000)]
New GENERAL-TEMPORARY! shorthand.
Taylor R Campbell [Sun, 25 Aug 2019 15:09:11 +0000 (15:09 +0000)]
Fix units for cc_entry_to_block_offset/cc_return_to_block_offset.
It would make more sense for the compiler to generate debug data
labels in instruction units, but this is a simpler change and is what
was done in the past on machines like mips with 32-bit aligned
instructions.
aarch64 now has functioning debug data!
Taylor R Campbell [Sat, 24 Aug 2019 07:10:39 +0000 (07:10 +0000)]
Fix comment about odd rounding mode.
Taylor R Campbell [Sat, 24 Aug 2019 07:09:39 +0000 (07:09 +0000)]
Add missing include guards.
Taylor R Campbell [Sat, 24 Aug 2019 07:07:11 +0000 (07:07 +0000)]
Update and clarify fp-env documentation.
Taylor R Campbell [Sat, 24 Aug 2019 04:32:50 +0000 (04:32 +0000)]
Simplify flo:update-environment!.
Caller is interested in exceptions afterward, so it is not sensible
to deregister interest in the floating-point environment afterward.
If you really want that, surround it in flo:preserving-environment.
Taylor R Campbell [Sat, 24 Aug 2019 04:26:31 +0000 (04:26 +0000)]
Fix two bugs in floating-point environment.
1. Don't cache it in the current thread.
We can't mark everywhere the cache needs to be invalidated --
i.e., every floating-point instruction -- and it's not clear
there's any performance benefit to the cache anyway. The main
performance cost, as I recall, was swapping environments on every
thread switch, which we avoid for all threads in the default
environment.
2. The default environment initialization left the machine in a wacky
state after reset-package!, which caused many spurious exception
traps once I undid the cache. There's no need to preserve the
machine environment here; we are setting up the default
environment, after all, so the environment we're in when done
should be the default one.
Taylor R Campbell [Sat, 24 Aug 2019 01:40:11 +0000 (01:40 +0000)]
Test busted flo:set-environment!.
Taylor R Campbell [Sat, 20 Apr 2019 19:48:07 +0000 (19:48 +0000)]
Simplify some logic by using dedicated scratch registers or targets.
No need to allocate temporaries except when we need more than two or
three of them.
Taylor R Campbell [Thu, 22 Aug 2019 14:23:08 +0000 (14:23 +0000)]
Use AC_CHECK_TOOL for as and allow configure parameter.
This way we auto-detect a cross-assembler more easily with, e.g.,
--build=aarch64--netbsd.
Taylor R Campbell [Mon, 22 Apr 2019 04:07:27 +0000 (04:07 +0000)]
Fix sign error in previous.
Taylor R Campbell [Sat, 20 Apr 2019 20:09:12 +0000 (20:09 +0000)]
Link the endian-independent cmpauxmd for aarch64.
Taylor R Campbell [Sat, 9 Feb 2019 17:40:30 +0000 (17:40 +0000)]
Update aarch64 release note.
Taylor R Campbell [Fri, 1 Feb 2019 05:30:38 +0000 (05:30 +0000)]
Validate signed-26 PC-relative offset in B instruction.
Taylor R Campbell [Fri, 1 Feb 2019 05:29:29 +0000 (05:29 +0000)]
Comment out bogus ADRP-ADD pseudo-instruction definition.
This will cause the compiler to fail noisily if it tries to assemble
code with sufficiently distant PC-relative addresses, which is better
than silently assembling garbage.
Need to find a proper fix.
Taylor R Campbell [Fri, 25 Jan 2019 04:35:12 +0000 (04:35 +0000)]
No need for a separate function here.
Taylor R Campbell [Fri, 25 Jan 2019 04:31:15 +0000 (04:31 +0000)]
Fix comment about ADRP to reflect reality.
Taylor R Campbell [Fri, 25 Jan 2019 04:30:38 +0000 (04:30 +0000)]
Add another step to the compiler tests README.
Taylor R Campbell [Fri, 25 Jan 2019 04:21:09 +0000 (04:21 +0000)]
Add note on ughbletchness of ADRP.
Taylor R Campbell [Fri, 25 Jan 2019 03:56:51 +0000 (03:56 +0000)]
Add some basic compiler tests.
For use when bringing up a compiler or back end that can't yet run
the normal test suite.
Taylor R Campbell [Fri, 25 Jan 2019 03:39:32 +0000 (03:39 +0000)]
Fix some bugs in logical immediate encoding.
Taylor R Campbell [Wed, 23 Jan 2019 08:17:57 +0000 (08:17 +0000)]
One more TODO item.
Taylor R Campbell [Wed, 23 Jan 2019 08:15:50 +0000 (08:15 +0000)]
Update TODO.
Taylor R Campbell [Wed, 23 Jan 2019 08:12:26 +0000 (08:12 +0000)]
Disable some tests when trapping is busted.
Taylor R Campbell [Wed, 23 Jan 2019 07:52:00 +0000 (07:52 +0000)]
Expect failure, not error, if trapping is not supported.
Makes these tests pass on my arm64 laptop.
Taylor R Campbell [Wed, 23 Jan 2019 07:50:38 +0000 (07:50 +0000)]
Check at runtime whether feenableexcept does anything.
The bits are defined on aarch64, but apparently some CPUs are
fabricated without support for them so they just read back as zers.
Bummer!
Taylor R Campbell [Wed, 23 Jan 2019 07:49:00 +0000 (07:49 +0000)]
Fix excessive sign bits in uuo link instruction.
Taylor R Campbell [Wed, 23 Jan 2019 05:33:39 +0000 (05:33 +0000)]
Fix displaced byte load rule.
The offset is not a machine register! Yikes.
Taylor R Campbell [Wed, 23 Jan 2019 05:21:52 +0000 (05:21 +0000)]
Fix FIXNUM-NOT rule: don't set the low bits.
Taylor R Campbell [Wed, 23 Jan 2019 05:21:34 +0000 (05:21 +0000)]
Implement aarch64 logical immediate encoding.
Taylor R Campbell [Wed, 23 Jan 2019 03:02:31 +0000 (03:02 +0000)]
Fix far uuo links.
Apparently ADRP really does do Rd <- (PC & ~0xfff) + (imm << 12), not
PC + (imm << 12), which means it's gonna cause some trouble for the
assembler in LIAR, since it means the code needs to know its own
offset within a page of memory and the target's offset within a page
of memory.
Taylor R Campbell [Wed, 23 Jan 2019 03:02:16 +0000 (03:02 +0000)]
Fix loading complemented immediates.
Taylor R Campbell [Wed, 23 Jan 2019 03:01:43 +0000 (03:01 +0000)]
Fix UNSIGNED-LESS-THAN-FIXNUM? branch condition.
Add some condition code aliases while here and clarify comments.
Taylor R Campbell [Tue, 22 Jan 2019 09:01:33 +0000 (09:01 +0000)]
Fix indexing of remote links.
Taylor R Campbell [Tue, 22 Jan 2019 03:47:47 +0000 (03:47 +0000)]
Fix byte ordering in GENERATE/NSECTS.
Taylor R Campbell [Tue, 22 Jan 2019 03:47:35 +0000 (03:47 +0000)]
Fix register choices in GENERATE/REMOTE-LINKS.
Taylor R Campbell [Tue, 22 Jan 2019 03:47:03 +0000 (03:47 +0000)]
Fix sense of INVOCATION-PREFIX:DYNAMIC-LINK choice.
Taylor R Campbell [Tue, 22 Jan 2019 01:55:18 +0000 (01:55 +0000)]
Fix reference to constant section in GENERATE/REMOTE-LINKS.
Taylor R Campbell [Mon, 21 Jan 2019 23:37:32 +0000 (23:37 +0000)]
Sign-extend PC-relative branch target.
Taylor R Campbell [Mon, 21 Jan 2019 22:39:29 +0000 (22:39 +0000)]
Fix indexing in MOVE-FRAME-UP code: objects, not bytes, here.
And with this, the cold load completes on aarch64!
Taylor R Campbell [Mon, 21 Jan 2019 22:39:11 +0000 (22:39 +0000)]
Fix large application setup.
Taylor R Campbell [Mon, 21 Jan 2019 20:59:02 +0000 (20:59 +0000)]
Teach cmpintmd to flush the instruction cache on aarch64.
Taylor R Campbell [Mon, 21 Jan 2019 20:53:14 +0000 (20:53 +0000)]
Fix argument to PUSH_D_CACHE_REGION.
Takes startptr/count, not startptr/endptr.
This was not an issue before because until aarch64, the only extant
port that even used this, i386, ignored the argument as a macro and
flushed the entire cache.
Taylor R Campbell [Mon, 21 Jan 2019 19:06:38 +0000 (19:06 +0000)]
Fix branch instruction in uuo link stub.
Taylor R Campbell [Mon, 21 Jan 2019 19:06:20 +0000 (19:06 +0000)]
Tweak read/write_compiled_closure_target for clarity and assertions.
Taylor R Campbell [Mon, 21 Jan 2019 19:06:02 +0000 (19:06 +0000)]
Fix cache-assignment code generation.
Taylor R Campbell [Mon, 21 Jan 2019 19:05:51 +0000 (19:05 +0000)]
Fix case.
Taylor R Campbell [Mon, 21 Jan 2019 01:20:14 +0000 (01:20 +0000)]
Fix LSR instruction encoding.
Taylor R Campbell [Mon, 21 Jan 2019 00:37:29 +0000 (00:37 +0000)]
Fix scale->shift.
Taylor R Campbell [Sun, 20 Jan 2019 21:36:42 +0000 (21:36 +0000)]
Fix read/write_compiled_closure_target.
Byte offsets, not object or instruction word offsets.
Taylor R Campbell [Sun, 20 Jan 2019 20:10:39 +0000 (20:10 +0000)]
Fix comment.
Taylor R Campbell [Sun, 20 Jan 2019 00:19:13 +0000 (00:19 +0000)]
Fix PC-relative calculations to work entirely in newspace.
Taylor R Campbell [Sun, 20 Jan 2019 00:18:55 +0000 (00:18 +0000)]
Fix read/write_compiled_closure_target offsets.
Taylor R Campbell [Sat, 19 Jan 2019 23:57:34 +0000 (23:57 +0000)]
Allow non-branch in cc_return_address_to_entry_address.
This happens for trampolines. Maybe this should be a special case.
Taylor R Campbell [Sat, 19 Jan 2019 23:57:08 +0000 (23:57 +0000)]
Fix scaling of PC offsets: they're byte offsets, not word offsets.
Taylor R Campbell [Sat, 19 Jan 2019 23:56:55 +0000 (23:56 +0000)]
Fix some symbol sizing.
Taylor R Campbell [Sat, 19 Jan 2019 23:56:45 +0000 (23:56 +0000)]
Tidy up interface_to_C.
Taylor R Campbell [Sat, 19 Jan 2019 23:56:31 +0000 (23:56 +0000)]
Note there is a way to do negative offsets.
Taylor R Campbell [Sat, 19 Jan 2019 22:43:03 +0000 (22:43 +0000)]
Make C_to_interface go through interface_to_scheme.
This way C_to_interface sets up VAL, which is necessary in case it is
invoking a continuation.
Taylor R Campbell [Sat, 19 Jan 2019 21:20:47 +0000 (21:20 +0000)]
Fix encoding of ROR and EXTR instructions.
Taylor R Campbell [Sat, 19 Jan 2019 20:51:56 +0000 (20:51 +0000)]
Load UARG2, don't clobber UARG1, in apply hooks.
Taylor R Campbell [Sat, 19 Jan 2019 20:51:44 +0000 (20:51 +0000)]
Fix calculation of hook instruction address.
Taylor R Campbell [Sat, 19 Jan 2019 18:33:01 +0000 (18:33 +0000)]
Fix order of arguments to load-tagged-immediate.
Taylor R Campbell [Sat, 19 Jan 2019 08:03:54 +0000 (08:03 +0000)]
Fix reversed byte order branches in read_uuo_frame_size.
Taylor R Campbell [Sat, 19 Jan 2019 08:03:41 +0000 (08:03 +0000)]
Fix extraction of PC offset from branch instruction.
Taylor R Campbell [Sat, 19 Jan 2019 08:02:50 +0000 (08:02 +0000)]
Fix format word padding and tweak block offsets.
We already arranged for all entries to be 64-bit aligned, so we might
as well take advantage of that in block offsets.
Taylor R Campbell [Fri, 18 Jan 2019 08:15:28 +0000 (08:15 +0000)]
Fix uuo link and trampoline instructions.
Taylor R Campbell [Fri, 18 Jan 2019 07:13:32 +0000 (07:13 +0000)]
Make interface_to_scheme match reality, not sensibility.
Should change cmpint.c so we pass a separate dispatch routine in for
entries and continuations, but that requires changing all the
cmpauxen at once.
Taylor R Campbell [Fri, 18 Jan 2019 07:13:15 +0000 (07:13 +0000)]
Compiler oughta agree cmpauxmd about what register is stack pointer.
Taylor R Campbell [Fri, 18 Jan 2019 07:03:11 +0000 (07:03 +0000)]
Simplify format words: make them always be instruction words.
No need for endianness conditionalization.
Taylor R Campbell [Fri, 18 Jan 2019 06:23:00 +0000 (06:23 +0000)]
Fix passage of dynamic-link. Only machine register, not regblock.
Taylor R Campbell [Fri, 18 Jan 2019 06:22:18 +0000 (06:22 +0000)]
Assert block offset is zero.
Taylor R Campbell [Wed, 16 Jan 2019 04:48:27 +0000 (04:48 +0000)]
Add a TODO.
Taylor R Campbell [Wed, 16 Jan 2019 04:47:27 +0000 (04:47 +0000)]
Teach ucode identify about aarch64.
Also make this always return a string here, so it doesn't crash on
boot if it hasn't been taught about new compiled code types.
Taylor R Campbell [Wed, 16 Jan 2019 04:47:13 +0000 (04:47 +0000)]
Save an instruction in multiplication with CSETM.
Taylor R Campbell [Wed, 16 Jan 2019 04:47:00 +0000 (04:47 +0000)]
Tweak some register numbering to reduce a bit of code.
Taylor R Campbell [Wed, 16 Jan 2019 04:46:17 +0000 (04:46 +0000)]
Fix register block indexing: no hooks in the register block here.
Taylor R Campbell [Tue, 15 Jan 2019 17:27:45 +0000 (17:27 +0000)]
Fix add/sub immediate syntax and criterion.
Taylor R Campbell [Tue, 15 Jan 2019 16:37:11 +0000 (16:37 +0000)]
Use a temporary if necessary in AFFIX-TYPE.
Taylor R Campbell [Tue, 15 Jan 2019 16:29:02 +0000 (16:29 +0000)]
Draft aarch64 cmpauxmd.
Taylor R Campbell [Tue, 15 Jan 2019 03:48:25 +0000 (03:48 +0000)]
Fix push order in move-frame-up / dynamic-link.
Taylor R Campbell [Tue, 15 Jan 2019 03:20:21 +0000 (03:20 +0000)]
Fix some instruction syntax bugs.
- Specify target _and_ source -- we're not x86 here.
- Specify operand size.
- Specify multipliers correctly.
Taylor R Campbell [Tue, 15 Jan 2019 03:19:18 +0000 (03:19 +0000)]
Avoid REGISTER-COPY-IF-AVAILABLE and TEMPORARY-COPY-IF-AVAILABLE.
These give out register references, which are a pain. Just use
REUSE-PSEUDO-REGISTER-IF-AVAILABLE! to get the machine register
number.
Taylor R Campbell [Tue, 15 Jan 2019 03:18:32 +0000 (03:18 +0000)]
Disable floating-point vector primitives too.
Until we have open-coded floating-point arithmetic.
Taylor R Campbell [Tue, 15 Jan 2019 03:17:35 +0000 (03:17 +0000)]
Make RTL:CONSTANT-COST always return positive.
Otherwise CSE might substitute constants for registers where at best
it's not helpful and at worst we don't have rules for it.
Taylor R Campbell [Tue, 15 Jan 2019 03:15:35 +0000 (03:15 +0000)]
Fix up some instruction decriptions.
- Migrate some things with citations and updates to instr1.scm.
- No need for `(evaluation ,terms) in fixed-width instructions.
- Fix some missing or duplicated bits.
- Add some more instructions.
Taylor R Campbell [Tue, 15 Jan 2019 03:14:40 +0000 (03:14 +0000)]
Umptuple-check that instruction widths sum to multiples of 32 bits.
Taylor R Campbell [Tue, 15 Jan 2019 03:12:46 +0000 (03:12 +0000)]
Put something in these stub files so they compile as code.
Otherwise the portable fasdumper barfs trying to fasdump a pathname.
Taylor R Campbell [Tue, 15 Jan 2019 03:12:25 +0000 (03:12 +0000)]
Update config.guess and config.sub so they recognize aarch64.
Taylor R Campbell [Tue, 15 Jan 2019 03:11:36 +0000 (03:11 +0000)]
Fix configure goo for aarch64 with byte order specified.
Taylor R Campbell [Tue, 15 Jan 2019 03:09:58 +0000 (03:09 +0000)]
Block offset units are instructions, not bytes, so we get two more bits.