SPRACN6 July   2019 F29H850TU , F29H859TU-Q1 , TMS320F28384D , TMS320F28384D-Q1 , TMS320F28384S , TMS320F28384S-Q1 , TMS320F28386D , TMS320F28386D-Q1 , TMS320F28386S , TMS320F28386S-Q1 , TMS320F28388D , TMS320F28388S , TMS320F28P550SJ , TMS320F28P559SJ-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1

 

  1.   Fast Integer Division – A Differentiated Offering From C2000 Product Family
    1.     Trademarks
    2. 1 Introduction
    3. 2 Different Division Functions
      1. 2.1 Truncated Division or Traditional Division
      2. 2.2 Floored Division or Modulo Division
      3. 2.3 Euclidean Division
    4. 3 Intrinsic Support Through TI C2000 Compiler
      1. 3.1 Software Examples
    5. 4 Cycle Count
    6. 5 Summary
    7. 6 References

Intrinsic Support Through TI C2000 Compiler

The division functions are standardized operations and hence to provide optimal cycles and ease of developing applications using these operations, TI C2000 compiler provides support through intrinsics. The TMS320C28x Optimizing C/C++ Compiler v18.12.0.LTS User's Guide[2] and later versions support the generation of division functions in one of three ways:

  • Intrinsics, declared in stdlib.h, which take numerator and denominator and return a structure containing both the remainder and quotient. The intrinsics supported are mentioned in the TMS320C28x Optimizing C/C++ Compiler v18.12.0.LTS User's Guide.
  • Operators for division (/) and modulo (%), which will automatically be optimized.
  • Standard library functions ldiv and lldiv, found in stdlib.h.

Euclidean/Modulo division are supported only using intrinsics. Operators and the standard library functions will perform traditional division according to the C standard.

Compiler option, --idiv_support, controls support for these division types. A value of 'idiv0' implies hardware acceleration for different division functions and value of none implies no hardware acceleration for the different division functions. The option is only valid when FPU32 or FPU64 is available (--float_support=fpu32 or fpu64) and when using the C2000 EABI (--abi=eabi).

For more details on intrinsics definitions, macros, and additional background information, see the TMS320C28x Optimizing C/C++ Compiler v18.12.0.LTS User's Guide and the TMS320C28x Assembly Language Tools v18.12.0.LTS User's Guide User's Guide[3].