-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:optimizationsmissed-optimization
Description
When the result of a modulo by constant is compared against another constant we can sometimes avoid the expensive modulo instructions as described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87290
For example
int
mod16 (int a, int b)
{
return a % 16 == 13;
}
with -O2 using this on aarch64 GCC produces better code: https://godbolt.org/z/9K8Gd1Eaf
Metadata
Metadata
Assignees
Labels
good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:optimizationsmissed-optimization