<div class="gmail_quote">On 20 June 2012 13:51, Don Clugston <span dir="ltr"><<a href="mailto:dac@nospam.com" target="_blank">dac@nospam.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 19/06/12 20:19, Iain Buclaw wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
Had round one of the code review process, so I'm going to post the main<br>
issues here that most affect D users / the platforms they want to run on<br>
/ the compiler version they want to use.<br>
<br>
<br>
<br>
1) D Inline Asm and naked function support is raising far too many alarm<br>
bells. So would just be easier to remove it and avoid all the other<br>
comments on why we need middle-end and backend headers in gdc.<br>
</blockquote>
<br></div>
You seem to be conflating a couple of unrelated issues here.<br>
One is the calling convention. The other is inline asm.<br>
<br>
Comments in the thread about "asm is mostly used for short things which get inlined" leave me completely baffled, as it is completely wrong.<br>
<br>
There are two uses for asm, and they are very different:<br>
(1) Functionality. This happens when there are gaps in the language, and you get an abstraction inversion. You can address these with intrinsics.<br>
(2) Speed. High-speed, all-asm functions. These _always_ include a loop.<br>
<br>
<br>
You seem to be focusing on (1), but case (2) is completely different.<br>
<br>
Case (2) cannot be replaced with intrinsics. For example, you can't write asm code using MSVC intrinsics (because the compiler rewrites your code).<br>
Currently, D is the best way to write (2). It is much, much better than an external assembler.<br>
</blockquote></div><div><br></div><div>Case 1 has no alternative to inline asm. I've thrown out some crazy ideas to think about (but nobody seems to like them). I still think it could be addressed though.</div><div><br>
</div><div>Case 2; I'm not convinced. These such long functions are the type I'm generally interested in aswell, and have the most experience with. But in my experience, they're almost always best written with intrinsics.</div>
<div>If they're small enough to be inlined, then you can't afford not to use intrinsics. If they are truly big functions, then you begin to sacrifice readability and maintain-ability, and certainly limit the number of programmers that can maintain the code.</div>
<div>I rarely fail to produce identical code with intrinsics to that which I would write with hand written asm. The flags are always the biggest challenge, as discussed prior in this thread. I think that could be addressed with better intrinsics.</div>