[PATCH] D53176: AArch64/TargetTransformInfo: Report div/rem constant immediate costs as TCC_Free
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 11 15:21:23 PDT 2018
MatzeB added a comment.
- This is not inspired by some benchmark, but from me needing stable tests in an upcoming change making DAGCombiner slightly less aggressive with OpaqueConstants. It does however seem like the right thing to do in general.
- The same transformation was done for ARM in https://reviews.llvm.org/rL266464, arguing that no effect could be measured in some unspecified benchmark on aarch64.
- With this home-made microbenchmark, I do measure more than 5x perf improvement:
#include <stdint.h>
#define SIZE 100000
void __attribute__((noinline)) divfoo(int64_t *signed_arr, uint64_t *unsigned_arr) {
for (unsigned i = 0; i < SIZE; ++i) {
signed_arr[i] /= 0xcafebabe5;
unsigned_arr[i] /= 0xcafebabe5;
}
}
int main(void) {
static int64_t signed_arr[SIZE];
static uint64_t unsigned_arr[SIZE];
for (unsigned i = 0; i < 1000; ++i)
divfoo(signed_arr, unsigned_arr);
}
Repository:
rL LLVM
https://reviews.llvm.org/D53176
More information about the llvm-commits
mailing list