Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

C6000 Intrinsics and Type Double

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

You are probably here because, while executing code from the host intrinsics package, you saw a message similar to:

_mpyhi is deprecated in favor of _mpyhill.
See http://processors.wiki.ti.com/index.php/C6000_Intrinsics_and_Type_Double

This message is emitted by versions 0.81.00 and later of the host intrinsics package.

Summary

If you just want to know what to do without learning the detailed reasons why ... Replace the deprecated intrinsic with the favored intrinsic. Such a change also requires changing the type of one or more variables from double to long long. In the example above, _mpyhi must change to _mpyhill. Since _mpyhill returns long long instead of double, the variable which is assigned the result of _mpyhi must change from double to long long.

Background

When single instruction multiple data (SIMD) intrinsics were first introduced in the C6000 C compiler, a 64-bit type was needed to hold the results of such instructions. The only 64-bit type then available was double. Thus, the now deprecated _mpyhi has this interface:

double _mpyhi(int, int);

Of course, the results of this operation do not form a true double. Instead, the result is a 64-bit integer that is merely stored within a container of type double. Just in this article, the term double SIMD intrinsics refers to all intrinsics similar to _mpyhi.

Then the host intrinsics package came along. In releases up to and including v0.00.72, the underlying type for the 64-bit value used by double SIMD intrinsics is not double, but long long. This choice caused other problems that are not detailed here. The bottom line is that it became clear the host intrinsics package cannot model using double as simply a 64-bit container exactly as the C6000 compiler does. Rather than attempt that, it is easier to gradually end support for the double SIMD intrinsics.

A few years after the double SIMD intrinsics were introduced, the C6000 compiler added support for the 64-bit integer type long long. When that addition was made, a new intrinsic was created for every double SIMD intrinsic, but these new intrinsics use long long instead of double. For example, _mpyhill was created for _mpyhi.

Thus the overall plan is that each double SIMD intrinsic is to be replaced by its long long counterpart.

Change Not Forced

You can change from the deprecated intrinsics to their replacements when it bests suits you. Support for the deprecated intrinsics will continue for several years before they are finally removed. Until that time, the host intrinsics package will continue to use long long as the underlying 64-bit type of the double SIMD intrinsics.

Table of Deprecated Intrinsics

This table shows the interface of every deprecated intrinsic next to the interface of its replacement.

Deprecated Replacement
unsigned _hi(double); unsigned _hill(long long);
unsigned _lo(double); unsigned _loll(long long);
double _itod(unsigned, unsigned); long long _itoll(unsigned, unsigned);
double _mpy2 (int, int); long long _mpy2ll (int, int);
double _mpyhi (int, int); long long _mpyhill (int, int);
double _mpyli (int, int); long long _mpylill (int, int);
double _mpysu4 (int, unsigned); long long _mpysu4ll (int, unsigned);
double _mpyu4 (unsigned, unsigned); long long _mpyu4ll (unsigned, unsigned);
double _smpy2 (int, int); long long _smpy2ll (int, int);
double *_amemd8(void *); long long *_amem8(void *);
const double *_amemd8_const(void *); const long long *_amem8_const(void *);
double *_memd8(void *); long long *_mem8(void *);
const double *_memd8_const(void *); const long long *_mem8_const(void *);