Skip to content

optimizer: Implement strength reduction for multiplication, division, and modulo by powers of 2 #97

Description

@MohamedGonem

Implement strength reduction optimizations in internal/optimizer/simplify_arith.go:

  • Replace x * 2^k with x << k (for pure expressions).
  • Replace x / 2^k with x >> k (for pure, unsigned integer expressions).
  • Replace x % 2^k with x & (2^k - 1) (for pure, unsigned integer expressions).

Files: internal/optimizer/simplify_arith.go (lines 43, 52, 65)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions