[PATCH] D53174: X86/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:13:50 PDT 2018
MatzeB added a comment.
This is currently not motivated by a benchmark but preparation for an upcoming commit of mine where I don't want ConstantHoisting to screw with dev/rem and mess up testcases.
However it does make sense in general and speeds up this microbenchmark by 10x on my measurements:
#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/D53174
More information about the llvm-commits
mailing list