SPRUJG0 December   2024 F29H850TU , F29H859TU-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Performance Optimization
    1. 2.1 Compiler Settings
      1. 2.1.1 Enabling Debug and Source Inter-listing
      2. 2.1.2 Optimization Control
      3. 2.1.3 Floating-Point Math
      4. 2.1.4 Fixed-Point Division
      5. 2.1.5 Single vs Double Precision Floating-Point
    2. 2.2 Memory Settings
      1. 2.2.1 Executing Code From RAM
      2. 2.2.2 Executing Code From Flash
      3. 2.2.3 Data Placement
    3. 2.3 Code Construction and Configuration
      1. 2.3.1 Inlining
      2. 2.3.2 Intrinsics
      3. 2.3.3 Volatile Variables
      4. 2.3.4 Function Arguments
    4. 2.4 Application Code Optimization
      1. 2.4.1 Optimized SDK Libraries
      2. 2.4.2 Optimizing Code-Size With Libraries
      3. 2.4.3 C29 Special Instructions
      4. 2.4.4 C29 Parallelism
      5. 2.4.5 32-Bit Variables and Writes Preferred
  6. 3References

Intrinsics

Compiler provided built-ins, or intrinsics can be leveraged for TMU instructions that are not yet generated by the compiler.

  • 1/sqrtf() with ISQRTF, using the intrinsic "float __builtin_c29_i32_isqrtf32_m(float f0)"
Example: 
y =__builtin_c29_i32_isqrtf32_m(x);
  • 1/expf() with IEXP2F, using the intrinsic float __builtin_c29_i32_iexp2f32_m(float f0) and the formula 1/expf(x) = IEXP2F(x * 1.44269504088896f)
 Example:
y = __builtin_c29_i32_iexp2f32_m(x * 1.44269504088896f);
  • expf() with IEXP2F, using the intrinsic float __builtin_c29_i32_iexp2f32_m(float f0) and the formula expf(x) = IEXP2F(x * -1.44269504088896f)
Example:
y = __builtin_c29_i32_iexp2f32_m(x * -1.44269504088896f);
  • 1/exp2f() with IEXP2F, using the intrinsic float __builtin_c29_i32_iexp2f32_m(float f0)
Example:
y = __builtin_c29_i32_iexp2f32_m(x);
  • exp2f() with IEXP2F, using the intrinsic float __builtin_c29_i32_iexp2f32_m(float f0)
Example:
y = __builtin_c29_i32_iexp2f32_m(-x);
  • atanf() with PUATANF, using the intrinsic float __builtin_c29_i32_puatanf32_m(float f0)
Example:
// x is per-unit in [-1,1]
// y is per-unit in [-0.125, 0.125] i.e. [-pi/4, pi/4] radians
y = __builtin_c29_i32_puatanf32_m(x);
  • atan2f() with PUATANF and QUADF, using the intrinsics float __builtin_c29_i32_puatanf32_m(float f0) and float __builtin_c29_quadf32(unsigned int * tdm_w_uip0, float * rw_fp1, float * rw_fp2)
Example:
test_output =puatan2f32(y_input,x_input);

static inline float32_t puatan2f32(float32_t y, float32_t x)
{
   uint32_t flags;
   return __builtin_c29_quadf32(&flags, &y, &x) +      __builtin_c29_i32_puatanf32_m(y / x);
}