| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -mcpu=cortex-a8 | FileCheck %s | 
|  | 2 |  | 
|  | 3 | ; Do not move the umull above previous call which would require use of | 
|  | 4 | ; more callee-saved registers and introduce copies. | 
|  | 5 | ; rdar://9329627 | 
|  | 6 |  | 
|  | 7 | %struct.FF = type { i32 (i32*)*, i32 (i32*, i32*, i32, i32, i32, i32)*, i32 (i32, i32, i8*)*, void ()*, i32 (i32, i8*, i32*)*, i32 ()* } | 
|  | 8 | %struct.BD = type { %struct.BD*, i32, i32, i32, i32, i64, i32 (%struct.BD*, i8*, i64, i32)*, i32 (%struct.BD*, i8*, i32, i32)*, i32 (%struct.BD*, i8*, i64, i32)*, i32 (%struct.BD*, i8*, i32, i32)*, i32 (%struct.BD*, i64, i32)*, [16 x i8], i64, i64 } | 
|  | 9 |  | 
|  | 10 | @FuncPtr = external hidden unnamed_addr global %struct.FF* | 
|  | 11 | @.str1 = external hidden unnamed_addr constant [6 x i8], align 4 | 
|  | 12 | @G = external unnamed_addr global i32 | 
|  | 13 | @.str2 = external hidden unnamed_addr constant [58 x i8], align 4 | 
|  | 14 | @.str3 = external hidden unnamed_addr constant [58 x i8], align 4 | 
|  | 15 |  | 
|  | 16 | define i32 @test() nounwind optsize ssp { | 
|  | 17 | entry: | 
| Stephen Lin | f799e3f | 2013-07-13 20:38:47 +0000 | [diff] [blame] | 18 | ; CHECK-LABEL: test: | 
| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 19 | ; CHECK: push | 
|  | 20 | ; CHECK-NOT: push | 
|  | 21 | %block_size = alloca i32, align 4 | 
|  | 22 | %block_count = alloca i32, align 4 | 
|  | 23 | %index_cache = alloca i32, align 4 | 
|  | 24 | store i32 0, i32* %index_cache, align 4 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 25 | %tmp = load i32, i32* @G, align 4 | 
| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 26 | %tmp1 = call i32 @bar(i32 0, i32 0, i32 %tmp) nounwind | 
|  | 27 | switch i32 %tmp1, label %bb8 [ | 
|  | 28 | i32 0, label %bb | 
|  | 29 | i32 536870913, label %bb4 | 
|  | 30 | i32 536870914, label %bb6 | 
|  | 31 | ] | 
|  | 32 |  | 
|  | 33 | bb: | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 34 | %tmp2 = load i32, i32* @G, align 4 | 
| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 35 | %tmp4 = icmp eq i32 %tmp2, 0 | 
|  | 36 | br i1 %tmp4, label %bb1, label %bb8 | 
|  | 37 |  | 
|  | 38 | bb1: | 
|  | 39 | ; CHECK: %bb1 | 
|  | 40 | ; CHECK-NOT: umull | 
| Tim Northover | b5ece52 | 2016-05-10 19:17:47 +0000 | [diff] [blame] | 41 | ; CHECK: bl _Get | 
| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 42 | ; CHECK: umull | 
| Tim Northover | b5ece52 | 2016-05-10 19:17:47 +0000 | [diff] [blame] | 43 | ; CHECK: bl _foo | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 44 | %tmp5 = load i32, i32* %block_size, align 4 | 
|  | 45 | %tmp6 = load i32, i32* %block_count, align 4 | 
| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 46 | %tmp7 = call %struct.FF* @Get() nounwind | 
|  | 47 | store %struct.FF* %tmp7, %struct.FF** @FuncPtr, align 4 | 
|  | 48 | %tmp10 = zext i32 %tmp6 to i64 | 
|  | 49 | %tmp11 = zext i32 %tmp5 to i64 | 
|  | 50 | %tmp12 = mul nsw i64 %tmp10, %tmp11 | 
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 51 | %tmp13 = call i32 @foo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str1, i32 0, i32 0), i64 %tmp12, i32 %tmp5) nounwind | 
| Evan Cheng | 1355bbd | 2011-04-26 21:31:35 +0000 | [diff] [blame] | 52 | br label %bb8 | 
|  | 53 |  | 
|  | 54 | bb4: | 
|  | 55 | ret i32 0 | 
|  | 56 |  | 
|  | 57 | bb6: | 
|  | 58 | ret i32 1 | 
|  | 59 |  | 
|  | 60 | bb8: | 
|  | 61 | ret i32 -1 | 
|  | 62 | } | 
|  | 63 |  | 
|  | 64 | declare i32 @printf(i8*, ...) | 
|  | 65 |  | 
|  | 66 | declare %struct.FF* @Get() | 
|  | 67 |  | 
|  | 68 | declare i32 @foo(i8*, i64, i32) | 
|  | 69 |  | 
|  | 70 | declare i32 @bar(i32, i32, i32) |