Main Content

Simplify array indexing

Strength reduction optimization

Description

App Configuration Pane: Advanced

Configuration Objects: coder.EmbeddedCodeConfig

Strength reduction optimization.

Settings

Off

This value is the default value.

The code generator does not use the strength reduction optimization.

On

The code generator tries to use the strength reduction optimization to simplify array indexing in loops in the generated code. When possible, for array indices in loops, the code generator replaces multiply operations with add operations. Multiply operations can be expensive. When the C/C++ compiler on the target platform does not optimize the array indexing, the strength reduction optimization is useful. Even when the optimization replaces the multiply operations in the generated code, it is possible that the C/C++ compiler can generate multiply instructions.

Programmatic Use

Property: EnableStrengthReduction
Values: false | true
Default: false

Version History

Introduced in R2016b