On 8 August 2012 07:54, F i L <span dir="ltr"><<a href="mailto:witte2008@gmail.com" target="_blank">witte2008@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">F i L wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Okay, that makes a lot of sense and is inline with what I was reading last night about FPU/SSE assembly code. However I'm also a bit confused. At some point, like in your hightmap example, I'm going to need to do arithmetic work on single vector components. Is there some sort of SSE arithmetic/shuffle instruction which uses "masking" that I should use to isolate and manipulate components?<br>

<br>
If not, and manipulating components is just bad for performance reasons, then I've figured out a solution to my original concern. By using this code:<br>
<br>
@property @trusted pure nothrow<br>
{<br>
  auto ref x(T:float4)(auto ref T v) { return v.ptr[0]; }<br>
  auto ref y(T:float4)(auto ref T v) { return v.ptr[1]; }<br>
  auto ref z(T:float4)(auto ref T v) { return v.ptr[2]; }<br>
  auto ref w(T:float4)(auto ref T v) { return v.ptr[3]; }<br>
<br>
  void x(T:float4)(ref float4 v, float val) { v.ptr[0] = val; }<br>
  void y(T:float4)(ref float4 v, float val) { v.ptr[1] = val; }<br>
  void z(T:float4)(ref float4 v, float val) { v.ptr[2] = val; }<br>
  void w(T:float4)(ref float4 v, float val) { v.ptr[3] = val; }<br>
}<br>
<br>
I am able to perform arithmetic on single components:<br>
<br>
    auto vec = Vectors.float4(x, y, 0, 1); // factory<br>
    vec.x += scalar; // += components<br>
<br>
again, I'll abandon this approach if there's a better way to manipulate single components, like you mentioned above. I'm just not aware of how to do that using SSE instructions alone. I'll do more research, but would appreciate any insight you can give.<br>

</blockquote>
<br>
<br></div>
Okay, disregard this. I see you where talking about your function in std.simd (setY), and I'm referring to that for an example of the appropriate vector functions.<br>
</blockquote></div><br><div>>_<</div>