[Mono-list] Stack variable alignment on Windows

Adam Miles amiles at gmail.com
Wed Jun 16 21:18:42 EDT 2010


I'm new to Mono this week and decided to give it a go by porting a C++
raytracer I have written using SSE into C# using Mono.Simd. However on
looking at the assembler generated by Mono it appears all the Simd code is
using movups everywhere rather than movaps because all my Vector4f stack
variables are not 16 byte aligned contrary to what I read here: 
http://tirania.org/blog/archive/2008/Nov-03.html
http://tirania.org/blog/archive/2008/Nov-03.html  

It says from Mono 2.2 stack variables are 16 byte aligned, but I'm using
2.6.5 and find that not to be the case. Does this apply only to certain
platforms / CPU architectures?

I'm using Mono 2.6.5 on Windows 7 64bit.

Repro using unsafe code:

Vector4f a = new Vector4f();

if (((int)&a) % 16 != 0)
{
    Console.WriteLine("Unaligned");
}
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Stack-variable-alignment-on-Windows-tp2258096p2258096.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list