summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAttr.cpp
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2017-04-18 08:32:27 +0000
committerDiana Picus <diana.picus@linaro.org>2017-04-18 08:32:27 +0000
commite2626bb7c29ea12d23e908c512ec64c2bb87abba (patch)
tree5cb24015719e4a908d097beeacad3c0cd5957d72 /clang/lib/Sema/SemaAttr.cpp
parentfb73eb0324e85c2ffcaef44b7be70df4f1fbb3ce (diff)
downloadbcm5719-llvm-e2626bb7c29ea12d23e908c512ec64c2bb87abba.tar.gz
bcm5719-llvm-e2626bb7c29ea12d23e908c512ec64c2bb87abba.zip
[ARM] Check for correct HW div when lowering divmod
For subtargets that use the custom lowering for divmod, e.g. gnueabi, we used to check if the subtarget has hardware divide and then lower to a div-mul-sub sequence if true, or to a libcall if false. However, judging by the usage of hasDivide vs hasDivideInARMMode, it seems that hasDivide only refers to Thumb. For instance, in the ARMTargetLowering constructor, the code that specifies whether to use libcalls for (S|U)DIV looks like this: bool hasDivide = Subtarget->isThumb() ? Subtarget->hasDivide() : Subtarget->hasDivideInARMMode(); In the case of divmod for arm-gnueabi, using only hasDivide() to determine what to do means that instead of lowering to __aeabi_idivmod to get the remainder, we lower to div-mul-sub and then further lower the div to __aeabi_idiv. Even worse, if we have hardware divide in ARM but not in Thumb, we generate a libcall instead of using it (this is not an issue in practice since AFAICT none of the cores that we support have hardware divide in ARM but not Thumb). This patch fixes the code dealing with custom lowering to take into account the mode (Thumb or ARM) when deciding whether or not hardware division is available. Differential Revision: https://reviews.llvm.org/D32005 llvm-svn: 300536
Diffstat (limited to 'clang/lib/Sema/SemaAttr.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud