aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMSubtarget.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-08-11 08:43:16 +0000
committerBill Wendling <isanbard@gmail.com>2010-08-11 08:43:16 +0000
commit962e99e5a6f6e6a6ccefa2ccca411263e68ff99d (patch)
tree0966dab4e700d13996e7fdf0a9556afde6483a8f /lib/Target/ARM/ARMSubtarget.cpp
parent8c4ded47fbbde07e851fe428b8f2dbb7802c834f (diff)
downloadexternal_llvm-962e99e5a6f6e6a6ccefa2ccca411263e68ff99d.zip
external_llvm-962e99e5a6f6e6a6ccefa2ccca411263e68ff99d.tar.gz
external_llvm-962e99e5a6f6e6a6ccefa2ccca411263e68ff99d.tar.bz2
Consider this code snippet:
float t1(int argc) { return (argc == 1123) ? 1.234f : 2.38213f; } We would generate truly awful code on ARM (those with a weak stomach should look away): _t1: movw r1, #1123 movs r2, #1 movs r3, #0 cmp r0, r1 mov.w r0, #0 it eq moveq r0, r2 movs r1, #4 cmp r0, #0 it ne movne r3, r1 adr r0, #LCPI1_0 ldr r0, [r0, r3] bx lr The problem was that legalization was creating a cascade of SELECT_CC nodes, for for the comparison of "argc == 1123" which was fed into a SELECT node for the ?: statement which was itself converted to a SELECT_CC node. This is because the ARM back-end doesn't have custom lowering for SELECT nodes, so it used the default "Expand". I added a fairly simple "LowerSELECT" to the ARM back-end. It takes care of this testcase, but can obviously be expanded to include more cases. Now we generate this, which looks optimal to me: _t1: movw r1, #1123 movs r2, #0 cmp r0, r1 adr r0, #LCPI0_0 it eq moveq r2, #4 ldr r0, [r0, r2] bx lr .align 2 LCPI0_0: .long 1075344593 @ float 2.382130e+00 .long 1067316150 @ float 1.234000e+00 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMSubtarget.cpp')
0 files changed, 0 insertions, 0 deletions