summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-04-30 18:16:07 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-04-30 18:16:07 +0000
commit9aa91b1f4e0a02e5394e288250c06f41bb9c4d17 (patch)
treea829bcd80a40490bca9b136bae2e34585cf5c0f0 /clang/lib/CodeGen/BackendUtil.cpp
parent57b3df59b92c36441c931381e57df35f1959cf4b (diff)
downloadbcm5719-llvm-9aa91b1f4e0a02e5394e288250c06f41bb9c4d17.tar.gz
bcm5719-llvm-9aa91b1f4e0a02e5394e288250c06f41bb9c4d17.zip
InstCombine: Turn (zext A) udiv (zext B) into (zext (A udiv B)). Same for urem or constant B.
This obviously helps a lot if the division would be turned into a libcall (think i64 udiv on i386), but div is also one of the few remaining instructions on modern CPUs that become more expensive when the bitwidth gets bigger. This also helps register pressure on i386 when dividing chars, divb needs two 8-bit parts of a 16 bit register as input where divl uses two registers. int foo(unsigned char a) { return a/10; } int bar(unsigned char a, unsigned char b) { return a/b; } compiles into (x86_64) _foo: imull $205, %edi, %eax shrl $11, %eax ret _bar: movzbl %dil, %eax divb %sil, %al movzbl %al, %eax ret llvm-svn: 130615
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud