From 2ba016cd5ce50a3683d3e6c2c62f00e1cccfd8b5 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Fri, 5 Jun 2020 15:40:00 -0700 Subject: [PATCH] [arm][darwin] Don't generate libcalls for wide shifts on Darwin Similar to ceb801612a678bdffe7e7bf163bd0eed9c9b73a2. Darwin doesn't always use compiler-rt, and so we can't assume that these functions are available on arm. --- llvm/lib/Target/ARM/ARMISelLowering.cpp | 3 ++- llvm/test/CodeGen/ARM/shift_minsize.ll | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index e4805ee..0bd726e 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -17958,7 +17958,8 @@ bool ARMTargetLowering::isCheapToSpeculateCtlz() const { } bool ARMTargetLowering::shouldExpandShift(SelectionDAG &DAG, SDNode *N) const { - return !Subtarget->hasMinSize() || Subtarget->isTargetWindows(); + return !Subtarget->hasMinSize() || Subtarget->isTargetWindows() || + Subtarget->isTargetDarwin(); } Value *ARMTargetLowering::emitLoadLinked(IRBuilder<> &Builder, Value *Addr, diff --git a/llvm/test/CodeGen/ARM/shift_minsize.ll b/llvm/test/CodeGen/ARM/shift_minsize.ll index de7327e..36434a2 100644 --- a/llvm/test/CodeGen/ARM/shift_minsize.ll +++ b/llvm/test/CodeGen/ARM/shift_minsize.ll @@ -1,11 +1,16 @@ ; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s ; RUN: llc -mtriple=thumbv7-windows %s -o - | FileCheck %s -check-prefix=CHECK-WIN +; RUN: llc < %s -mtriple=aarch64-apple-darwin | FileCheck %s -check-prefix=CHECK-DARWIN ; The Windows runtime doesn't have these. ; CHECK-WIN-NOT: __ashldi3 ; CHECK-WIN-NOT: __ashrdi3 ; CHECK-WIN-NOT: __lshrdi3 +; Darwin compiler-rt excludes these. +; CHECK-DARWIN-NOT: __ashlti3 +; CHECK-DARWIN-NOT: __ashrti3 + define i64 @f0(i64 %val, i64 %amt) minsize optsize { ; CHECK-LABEL: f0: ; CHECK: bl __aeabi_llsl -- 2.7.4