1 ; When optimising for minimum size, we don't want to expand a div to a mul 2 ; and a shift sequence. As a result, the urem instruction e.g. will not be 3 ; expanded to a sequence of umull, lsrs, muls and sub instructions, but 4 ; just a call to __aeabi_uidivmod. 5 ; 6 ; RUN: llc -mtriple=armv7a-eabi -mattr=-neon -verify-machineinstrs %s -o - | FileCheck %s 7 8 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" 9 target triple = "thumbv7m-arm-none-eabi" 10 11 define i32 @foo1() local_unnamed_addr #0 { 12 entry: 13 ; CHECK-LABEL: foo1: 14 ; CHECK:__aeabi_idiv 15 ; CHECK-NOT: smmul 16 %call = tail call i32 bitcast (i32 (...)* @GetValue to i32 ()*)() 17 %div = sdiv i32 %call, 1000000 18 ret i32 %div 19 } 20 21 define i32 @foo2() local_unnamed_addr #0 { 22 entry: 23 ; CHECK-LABEL: foo2: 24 ; CHECK: __aeabi_uidiv 25 ; CHECK-NOT: umull 26 %call = tail call i32 bitcast (i32 (...)* @GetValue to i32 ()*)() 27 %div = udiv i32 %call, 1000000 28 ret i32 %div 29 } 30 31 define i32 @foo3() local_unnamed_addr #0 { 32 entry: 33 ; CHECK-LABEL: foo3: 34 ; CHECK: __aeabi_uidivmod 35 ; CHECK-NOT: umull 36 %call = tail call i32 bitcast (i32 (...)* @GetValue to i32 ()*)() 37 %rem = urem i32 %call, 1000000 38 %cmp = icmp eq i32 %rem, 0 39 %conv = zext i1 %cmp to i32 40 ret i32 %conv 41 } 42 43 declare i32 @GetValue(...) local_unnamed_addr 44 45 attributes #0 = { minsize nounwind optsize } 46