8.6.10 Using Unaligned Data and 64-Bit Values
The C6000 has support for unaligned loads and stores of 64-bit and 32-bit values via the use of the _mem8, _memd8, and _mem4 intrinsics. The _lo and _hi intrinsics are useful for extracting the two 32-bit portions from a 64-bit double. The _loll and _hill intrinsics are useful for extracting the two 32-bit portions from a 64-bit long long.
For intrinsics that use 64-bit types, the equivalent C type is long long. Do not use the C type double or the compiler performs a call to a run-time-support math function to do the floating-point conversion. Here are ways to access 64-bit and 32-bit values:
- To get the upper 32 bits of a long long in C code, use >> 32 or the _hill( ) intrinsic.
- To get the lower 32 bits of a long long in C code, use a cast to int or unsigned, or use the _loll intrinsic.
- To get the upper 32 bits of a double (interpreted as an int), use _hi( ).
- To get the lower 32 bits of a double (interpreted as an int), use _lo( ).
- To get the upper 32 bits of a __float2_t, use _hif2().
- To get the lower 32 bits of a __float2_t, use _lof2().
- To create a long long value, use the _itoll(int high32bits, int low32bits) intrinsic.
- To create a __float2_t value, use the _ftof2(float high32bits, float low32bits) intrinsic.
Example 8 shows the usage of the _mem8 intrinsic.