From f7cc34cae890fdd711173fcb633cd262ee343764 Mon Sep 17 00:00:00 2001 From: Sjoerd Meijer Date: Thu, 31 Jan 2019 08:07:30 +0000 Subject: [SelectionDAG] Codesize: don't expand SHIFT to SHIFT_PARTS And instead just generate a libcall. My motivating example on ARM was a simple: shl i64 %A, %B for which the code bloat is quite significant. For other targets that also accept __int128/i128 such as AArch64 and X86, it is also beneficial for these cases to generate a libcall when optimising for minsize. On these 64-bit targets, the 64-bits shifts are of course unaffected because the SHIFT/SHIFT_PARTS lowering operation action is not set to custom/expand. Differential Revision: https://reviews.llvm.org/D57386 llvm-svn: 352736 --- llvm/test/CodeGen/ARM/shift_minsize.ll | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 llvm/test/CodeGen/ARM/shift_minsize.ll (limited to 'llvm/test/CodeGen/ARM/shift_minsize.ll') diff --git a/llvm/test/CodeGen/ARM/shift_minsize.ll b/llvm/test/CodeGen/ARM/shift_minsize.ll new file mode 100644 index 00000000000..4d10c64392d --- /dev/null +++ b/llvm/test/CodeGen/ARM/shift_minsize.ll @@ -0,0 +1,32 @@ +; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s + +define i64 @f0(i64 %val, i64 %amt) minsize optsize { +; CHECK-LABEL: f0: +; CHECK: bl __aeabi_llsl + %res = shl i64 %val, %amt + ret i64 %res +} + +define i32 @f1(i64 %x, i64 %y) minsize optsize { +; CHECK-LABEL: f1: +; CHECK: bl __aeabi_llsl + %a = shl i64 %x, %y + %b = trunc i64 %a to i32 + ret i32 %b +} + +define i32 @f2(i64 %x, i64 %y) minsize optsize { +; CHECK-LABEL: f2: +; CHECK: bl __aeabi_lasr + %a = ashr i64 %x, %y + %b = trunc i64 %a to i32 + ret i32 %b +} + +define i32 @f3(i64 %x, i64 %y) minsize optsize { +; CHECK-LABEL: f3: +; CHECK: bl __aeabi_llsr + %a = lshr i64 %x, %y + %b = trunc i64 %a to i32 + ret i32 %b +} -- cgit v1.2.3