SPRUIG6K January 2018 – March 2024
As of the v3.0 of the C7000 compiler, the C7000 TI Compiler (cl7x) accepts constructor-style syntax for vector initialization. To create portable code that compiles using both cl7x and Host Emulation, use the constructor-style syntax for vector initialization instead of the "cast/scalar-widening" style of initialization, which works correctly only with cl7x.
Examples of the correct and incorrect vector constructor initialization syntax are shown in the following code.
/* Host Emulation vector constructor syntax examples */
// The following examples work for both cl7x and Host Emulation
long2 ex1 = long2(1); // -> (1,1)
long2 ex2 = long2(1,2); // -> (1,2)
long8 ex3 = long8(long4(1), long4(2)); // -> (1,1,1,1,2,2,2,2)
long8 ex4 = long8(long4(1),2,3,4,5); // -> (1,1,1,1,2,3,4,5)
// Do not use the following syntax for code that needs to compile
// with Host Emulation. This is valid C++ syntax, but results are
// not as expected when compiling with Host Emulation.
//long8 ex5 = (long8)(1,2,3,4,5,6,7,8); // -> (8,8,8,8,8,8,8,8) [for Host Emulation]