btDbvt.h Intrinsic error

BlindSide
Posts: 3
Joined: Sat Oct 18, 2008 5:52 am

btDbvt.h Intrinsic error

Post by BlindSide »

On line 607 of btDbvt.h:

Code: Select all

return(_mm_cmple_ss(bmi,ami).m128_u32[0]&1);
The problem is that the term "m128_u32" is not recognized by MSVC. A sensible temporary replacement would be:

Code: Select all

return(((unsigned int&)_mm_cmple_ss(bmi,ami).m128_f32[0])&1);
It is bad practice however to directly use the built in unions provided by the compiler, because not all compilers support or recognize them, the Intel compiler being a prime example. If you are going to use intrinsics more extensively in other areas I recommend you use your own union format e.g:

Code: Select all

union btSSEUnion // Please excuse me I am new to your naming conventions.
{
	__m128 ssereg;
	float floats[4];
};
Cheers and good luck.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btDbvt.h Intrinsic error

Post by Erwin Coumans »

This will be fixed for upcoming release, see

http://code.google.com/p/bullet/issues/detail?id=121

Thanks for the report,
Erwin
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btDbvt.h Intrinsic error

Post by Erwin Coumans »

It has been fixed, but some testing using Intel compiler is needed:
http://code.google.com/p/bullet/source/detail?r=1419

Note this issue report here:
http://ompf.org/forum/viewtopic.php?f=11&t=495#p8119

There is a mention about an Intel compiler bug:
As for putting __m128 in a union with float[4], it works, but you really don't want to do it. There is a really nasty bug in ICC that will screw up all code working with this union (broken aliasing rules again?).
Thanks,
Erwin
BlindSide
Posts: 3
Joined: Sat Oct 18, 2008 5:52 am

Re: btDbvt.h Intrinsic error

Post by BlindSide »

Just a very small nitpick, not sure if it actually matters or anything. But the original type we replaced was m128_u32, which suggests an unsigned int representation. I recommend the type in the union be changed to unsigned int for the sake of consistency.

Cheers, and thanks for the prompt response.