unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Paul Sherwood <paul.sherwood@codethink.co.uk>
Cc: guix-devel@gnu.org, bootstrappable@freelists.org
Subject: ARM Unified Assembly Language - GNU as does some weird stuff
Date: Mon, 25 Jan 2021 23:47:23 +0100	[thread overview]
Message-ID: <20210125234723.319ba85a@scratchpost.org> (raw)
In-Reply-To: <20210107211058.40e0813a@scratchpost.org>

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

Hello Paul,

we are now implementing ARM inline assembly in TinyCC.

The traditional ARM inline assembler is finished now.  Now we started
implementing the Unified Assembly Language dialect.

I'd like to have some help which constructs are valid and which are not.

(GNU as 2.34 seems to have some bugs with Unified Assembly Language--so I
guess we shouldn't use "do what GNU as does" as a yardstick here)

The questionable--maybe invalid--constructs follow (the "#" are for clarity):

================================================================================

(1) b #60

It seems that GNU as ignores the immediate entirely and just always encodes
#0 (to test, do ".syntax unified" and then "b #60" in GNU as).  WTF?

Likewise with bl, blx.

It seems that the debug info still has the user-specified immediate value--but
the executable object file does not.  So in order to test you should strip the
resulting file--otherwise you are gonna be very confused.

No error or warning messages are printed by GNU as here.

================================================================================

(2) push #4

It works in GNU as--but is it specified by ARM to push the register r2 ?
I think exposing ISA implementation details like that is a leaky abstraction--and
no good can come from it.

Likewise with pop, stm*, ldm*.

No error or warning messages are printed by GNU as here.

================================================================================

(3) and r3, r4, LSL #5

This doesn't work in unified mode--but does work in non-unified mode.
Note that "and r3, r3, r4, LSL #5" always works--both in unified mode and in
non-unified mode.

I would have thought the LSL token would be a dead giveaway for disambiguating
what to do here--but apparently GNU as thinks otherwise.

Likewise with ands, eor, eors, sub, subs, sbc, sbcs, rsc, rscs, rsb, rsbs,
orr, orrs, bic, bics, cmp, cmns, mov, movs, mvn, mvns (all arithmetic
instructions), and with other modifiers (LSR, ASR, ROR, RRX).

GNU as fails to assemble these.

================================================================================

(4) lsl r1, #4, #2

GNU as encodes exactly the same as "lsl r1, #4"--drops the "#2" silently.

Likewise with lsr, lsrs, asr, asrs, orr, rors.

No error or warning messages are printed by GNU as here.

================================================================================

(5) vmov.f32 r2, r3, d1

f32 and two 32 bit ARM registers, and one 64 bit VFP register?  What does this
do?!

Likewise with "vmov.f32 d1, r2, r3".

No error or warning messages are printed by GNU as here.

================================================================================

Which of those are good (and should thus be implemented in the same way)
and which of those are bad (and should thus not be implemented the
same way)?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2021-01-25 22:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 17:01 wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello' Jan Nieuwenhuizen
2021-01-05  0:49 ` [bootstrappable] " jeremiah
2021-01-05 16:58 ` Pierre Neidhardt
2021-01-06 11:32 ` [bootstrappable] " Ludovic Courtès
2021-01-06 11:46   ` [bootstrappable] " Andrius Štikonas via Development of GNU Guix and the GNU System distribution.
2021-01-06 14:03     ` Orians, Jeremiah (DTMB)
2021-01-14 21:37     ` Ludovic Courtès
2021-01-15  1:27       ` jeremiah
2021-01-21 11:09         ` Ludovic Courtès
2021-01-21 17:52           ` Orians, Jeremiah (DTMB)
2021-01-28 13:40             ` Ludovic Courtès
2021-01-28 13:44               ` Orians, Jeremiah (DTMB)
2021-01-06 14:38 ` [bootstrappable] " Paul Sherwood
2021-01-07 10:43   ` Jan Nieuwenhuizen
2021-01-07 20:10     ` [bootstrappable] " Danny Milosavljevic
2021-01-07 20:23       ` Danny Milosavljevic
2021-01-07 22:52         ` Danny Milosavljevic
2021-01-08  6:25           ` Jan Nieuwenhuizen
2021-01-08  8:05             ` [Tinycc-devel] " arnold
2021-01-08 13:02               ` Jan Nieuwenhuizen
2021-01-08 13:43             ` Danny Milosavljevic
2021-01-08 14:07               ` Danny Milosavljevic
2021-01-08 16:15                 ` Jan Nieuwenhuizen
2021-01-08 18:56                   ` Danny Milosavljevic
2021-01-08 21:11                     ` Danny Milosavljevic
2021-01-08 22:13                       ` Jan Nieuwenhuizen
2021-01-08  7:16           ` [Tinycc-devel] " grischka
2021-01-08 13:25             ` Danny Milosavljevic
2021-01-08 13:36               ` [bootstrappable] Re: [Tinycc-devel] " Orians, Jeremiah (DTMB)
2021-01-08 15:16                 ` [Tinycc-devel] [bootstrappable] " Vincent Lefevre
2021-01-08 16:12               ` [Tinycc-devel] [bootstrappable] " Jan Nieuwenhuizen
2021-01-25 22:47       ` Danny Milosavljevic [this message]
2021-01-25 23:12         ` [bootstrappable] ARM Unified Assembly Language - GNU as does some weird stuff Orians, Jeremiah (DTMB)
2021-01-26  1:14         ` Danny Milosavljevic
2021-01-08  0:29 ` wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello' Jan Wielkiewicz
2021-01-20 20:19 ` Timothy Sample
2021-01-25 18:48   ` Efraim Flashner
2021-01-29  7:23     ` [bootstrappable] " Jan Nieuwenhuizen
2021-01-29 10:18       ` andrius--- via Development of GNU Guix and the GNU System distribution.
2021-01-29 16:02         ` Orians, Jeremiah (DTMB)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210125234723.319ba85a@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=bootstrappable@freelists.org \
    --cc=guix-devel@gnu.org \
    --cc=paul.sherwood@codethink.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).