I think the primary problem here are the many definitions and understandings of what 'intrinsics' mean.<div><br></div><div>To be clear, I think most of the LLVM developers have been operating under the following assumption: intrinsics are a library-means of expressing operations very useful or common on a particular system which have no in-language formulation. As such, they are just a language extension with defined and specified semantics. The compiler is then free to interpret them, lower them, optimize, and even delete them according to the as-if rules. I think that's fundamentally the *right* model, as there is no alternative. If you want to express operations on SSE vectors, but would like the compiler to have all of its usual freedom, what else can you use besides intrinsics?</div>
<div><div><br></div><div>However...</div><div><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 10:41 AM, David A. Greene <span dir="ltr"><<a href="mailto:dag@cray.com">dag@cray.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":6c9">We absolutely need some way to tell LLVM, "leave this alone."  It goes<br>
beyond intrinsics even.</div></blockquote></div><br></div></div><div>This is a very reasonable requirement, and I actually think LLVM has exactly the means to deal with it: *volatile* inline asm. This says to the compiler, explicitly and without ambiguity, "leave this alone". It must not be changed, it must be preserved at all costs.</div>
<div><br></div><div>I think anything short of volatile inline asm is subject to as-if, and merely a matter of time before the compiler begins optimizing even these sequences.</div>