This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alignment issues for sse


Hi Brian,

As I understand it (in this alignment situation), the __attribute__ is applicable to a variable, not to a type.

Also, the alignment of the variable is constrained by whatever alignment support is provided by the linker. For example, if you need 256 byte alignment for a PMMU page, many linkers may not support such a big alignment constraint and will only honor the request to the best of their ability.

So for certain things, such as PMMU swap pages, the alignment burden often falls on the shoulders of the software engineer handling PMMU swap pages. (It is MOST unfortunate that the malloc routine doesn't have an extra optional parameter for alignment requirements. Alas and alack.)

Let's hope that's not the issue you are running into.

I don't know if __mode__(__V4SF__) entails the alignment request. You'll have to double-check the documentation.

Regardless, I think you should replace your typedef with a struct.

struct __m128 { int m __attribute((__mode__(__V4SF__))); };

And if the __mode__(__V4SF__) doesn't entail the alignment constrained, add in the aligned(16) as well.

And if your linker doesn't honor the aligned(16) request, you'll have to take some extra-ordinary steps -- let's hope you don't have to go there.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]