caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Benedikt Meurer <benedikt.meurer@googlemail.com>
To: Jeffrey Scofield <jeffsco@psellos.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] ARM code generator problem
Date: Sat, 11 Aug 2012 10:00:06 +0200	[thread overview]
Message-ID: <EEE012FC-518B-4F89-9992-69E0958BF8CE@gmail.com> (raw)
In-Reply-To: <51E93001-B3AB-4B8D-B46C-7ACA11346C38@psellos.com>


On Aug 10, 2012, at 23:41 , Jeffrey Scofield wrote:

> Greetings,

Hey Jeffrey,

> While working on porting OCaml 4.00.0 to iOS, I ran across
> what looks like a problem in the ARM code generation.
> 
> If you look at asmcomp/arm/emit.mlp you see lots of places where
> s14 is used as a scratch register.  The one that showed up in my
> code is the code sequence for float_of_int:
> 
>    | Lop(Ifloatofint) ->
>        `       fmsr    s14, {emit_reg i.arg.(0)}\n`;
>        `       fsitod  {emit_reg i.res.(0)}, s14\n`; 2
> 
> Note that the emitted code always uses s14 (unconditionally).  This
> suggests that s14 should be set aside as a scratch register.
> 
> However, s14 is also an alias for the low order part of d7.  If you look
> at asmcomp/arm/proc.ml you'll see that d7 is used as a general purpose
> register.
> 
> The result is that a value in d7 is sometimes destroyed by a use
> of s14 as a scratch register.  In my code it was a call to float_of_int
> that destroyed a float value being kept in d7.

If you look at destroyed_at_oper in asmcomp/arm/proc.ml, you'll see that d7 (s14+s15) is marked as destroyed for those operations where it is used as scratch register.

If possible, it would probably also make sense to merge some of the iOS related code into the upstream ARM backend, in case you are interested.

> Regards,
> Jeffrey

greets,
Benedikt

  reply	other threads:[~2012-08-11  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 21:41 Jeffrey Scofield
2012-08-11  8:00 ` Benedikt Meurer [this message]
2012-08-11  8:13   ` Benedikt Meurer
2012-08-11  8:57     ` Jeffrey Scofield
2012-08-11  9:48       ` [Caml-list] " Benedikt Meurer
2012-08-11  8:52   ` [Caml-list] " Jeffrey Scofield
2012-08-13 19:21   ` [Caml-list] " Jeffrey Scofield
2012-08-14  7:11     ` Benedikt Meurer
2012-08-17  4:26       ` Jeffrey Scofield

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

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

  git send-email \
    --in-reply-to=EEE012FC-518B-4F89-9992-69E0958BF8CE@gmail.com \
    --to=benedikt.meurer@googlemail.com \
    --cc=caml-list@inria.fr \
    --cc=jeffsco@psellos.com \
    /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.
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 NNTP newsgroup(s).