Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10815

C7x intrinsics should use signed char, not char.

    XMLWordPrintable

Details

    • Bug
    • Status: Fixed
    • Medium
    • Resolution: Fixed
    • Code Generation Tools
    • CODEGEN-9827
    • Hide
      C7000_1.4.0.LTS
      C7000_1.4.1.LTS
      C7000_2.0.1.STS
      C7000_1.3.0.STS
      C7000_2.1.0.LTS
      C7000_2.0.0.STS
      C7000_3.0.0.STS
      C7000_1.4.2.LTS
      C7000_1.2.0.STS
      Show
      C7000_1.4.0.LTS C7000_1.4.1.LTS C7000_2.0.1.STS C7000_1.3.0.STS C7000_2.1.0.LTS C7000_2.0.0.STS C7000_3.0.0.STS C7000_1.4.2.LTS C7000_1.2.0.STS
    • C7000_3.0.0.STS
    • default
    • Hide
      The workaround for incompatible definitions of intrinsics between cl7x and host emulation is shown below and is also described in SPRUIG6 "C7000 Host Emulation User's Guide", revision H, Section 4.2.1. https://www.ti.com/lit/ug/spruig6h/spruig6h.pdf

      // Define an explicit cast for cl7x and not host emulation
      #ifdef __C7X_HOSTEM__
      #define FORCE_CHAR_PTR
      #else
      #define FORCE_CHAR_PTR (char*)
      #endif

      // Use the cast to match host emulation or cl7x intrinsic declarations.
      char64 x = __vload_dup(FORCE_CHAR_PTR mem);

      However, in 3.0.0 and later compilers, when the intrinsic definitions are corrected, the above workaround will result in an error. Instead signed char (or int8_t) pointers should be consistently used.
      Show
      The workaround for incompatible definitions of intrinsics between cl7x and host emulation is shown below and is also described in SPRUIG6 "C7000 Host Emulation User's Guide", revision H, Section 4.2.1. https://www.ti.com/lit/ug/spruig6h/spruig6h.pdf // Define an explicit cast for cl7x and not host emulation #ifdef __C7X_HOSTEM__ #define FORCE_CHAR_PTR #else #define FORCE_CHAR_PTR (char*) #endif // Use the cast to match host emulation or cl7x intrinsic declarations. char64 x = __vload_dup(FORCE_CHAR_PTR mem); However, in 3.0.0 and later compilers, when the intrinsic definitions are corrected, the above workaround will result in an error. Instead signed char (or int8_t) pointers should be consistently used.

    Description

      Intrinsics that operate on signed 8-bit types should be defined to accept "signed char" instead of "char", which are distinct types in C/C++. For intrinsics that accept references or pointers to signed 8-bit char in particular, this results in an incompatibility with host emulation, which defines these intrinics with int8_t (signed char). Previously, this was considered a known incompatibility between cl7x and host emulation. See SPRUIG6 "C7000 Host Emulation User's Guide", revision H, Section 4.2.1. https://www.ti.com/lit/ug/spruig6h/spruig6h.pdf

      This is now considered a bug, but will only be fixed in 3.0.0 and later revisions of the compiler due to breaking API compatibility. In particular, the following intrinsics that had incompatible declarations between cl7x and host emulation will be consistently defined with signed char types in 3.0.0 and later compilers:

      • __vload_dup(const signed char*)
      • _vload_pred_dup(_vpred, const signed char*)
      • __vload_unpack_short(const signed char*)
      • _vload_pred_unpack_short(_vpred, const signed char*)
      • __vload_unpack_int(const signed char*)
      • _vload_pred_unpack_int(_vpred, const signed char*)
      • __vload_unpack_long(const signed char*)
      • _vload_pred_unpack_long(_vpred, const signed char*)
      • __max_circ_pred(signed char, signed char&, __vpred&)
      • __max_index(signed char, signed char&, __vpred&)
      • __min_index(signed char, signed char&, __vpred&)

      Other intrinsics that are not listed above, including vector versions of those intrinsics, will not result in incompatibility with previous compilers.

      Attachments

        Activity

          People

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: