Skip to content

Function quotRem is inefficient

Function quotRem gets compiled into two div instructions although div computes both quotient and remainder. This inefficiency exists both with NCG and LLVM backends. Thus, quotRem is at least twice as slow as it could be.

As far as I understand, quotRem is decomposed into two primops quotInt# and remInt# (or quotWord# and remWord#) and each of them is compiled independently into code which has div instruction. I propose to add new primops quotRemInt# and quotRemWord# to address this flaw.

Please see the sample code and corresponding assembly.

Trac metadata
Trac field Value
Version 7.0.3
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information