Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=thumbv8 | FileCheck %s |
| 2 | ; RUN: llc < %s -mtriple=thumbv8 -relocation-model=pic | FileCheck %s --check-prefix=CHECK-PIC |
| 3 | |
| 4 | %struct.FF = type { i32 (i32*)*, i32 (i32*, i32*, i32, i32, i32, i32)*, i32 (i32, i32, i8*)*, void ()*, i32 (i32, i8*, i32*)*, i32 ()* } |
| 5 | %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 } |
| 6 | |
| 7 | @FuncPtr = external hidden unnamed_addr global %struct.FF* |
| 8 | @.str1 = external hidden unnamed_addr constant [6 x i8], align 4 |
| 9 | @G = external unnamed_addr global i32 |
| 10 | @.str2 = external hidden unnamed_addr constant [58 x i8], align 4 |
| 11 | @.str3 = external hidden unnamed_addr constant [58 x i8], align 4 |
| 12 | |
| 13 | define i32 @test() nounwind optsize ssp { |
| 14 | entry: |
| 15 | ; CHECK-LABEL: test: |
| 16 | ; CHECK: push |
| 17 | ; CHECK-NOT: push |
| 18 | %block_size = alloca i32, align 4 |
| 19 | %block_count = alloca i32, align 4 |
| 20 | %index_cache = alloca i32, align 4 |
| 21 | store i32 0, i32* %index_cache, align 4 |
| 22 | %tmp = load i32* @G, align 4 |
| 23 | %tmp1 = call i32 @bar(i32 0, i32 0, i32 %tmp) nounwind |
| 24 | switch i32 %tmp1, label %bb8 [ |
| 25 | i32 0, label %bb |
| 26 | i32 536870913, label %bb4 |
| 27 | i32 536870914, label %bb6 |
| 28 | ] |
| 29 | |
| 30 | bb: |
| 31 | %tmp2 = load i32* @G, align 4 |
| 32 | %tmp4 = icmp eq i32 %tmp2, 0 |
| 33 | br i1 %tmp4, label %bb1, label %bb8 |
| 34 | |
| 35 | bb1: |
| 36 | ; CHECK: %bb6 |
| 37 | ; CHECK: it eq |
| 38 | ; CHECK-NEXT: ldreq |
| 39 | ; CHECK-NEXT: it eq |
| 40 | ; CHECK-NEXT: cmpeq |
| 41 | ; CHECK: %bb1 |
| 42 | %tmp5 = load i32* %block_size, align 4 |
| 43 | %tmp6 = load i32* %block_count, align 4 |
| 44 | %tmp7 = call %struct.FF* @Get() nounwind |
| 45 | store %struct.FF* %tmp7, %struct.FF** @FuncPtr, align 4 |
| 46 | %tmp10 = zext i32 %tmp6 to i64 |
| 47 | %tmp11 = zext i32 %tmp5 to i64 |
| 48 | %tmp12 = mul nsw i64 %tmp10, %tmp11 |
| 49 | %tmp13 = call i32 @foo(i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0), i64 %tmp12, i32 %tmp5) nounwind |
| 50 | br label %bb8 |
| 51 | |
| 52 | bb4: |
| 53 | ; CHECK-PIC: cmp |
| 54 | ; CHECK-PIC: cmp |
| 55 | ; CHECK-PIC-NEXT: bne |
| 56 | ; CHECK-PIC-NEXT: %bb4 |
| 57 | ; CHECK-PIC-NEXT: movs |
| 58 | ; CHECK-PIC-NEXT: add |
| 59 | ; CHECK-PIC-NEXT: pop |
| 60 | ret i32 0 |
| 61 | |
| 62 | bb6: |
| 63 | ret i32 1 |
| 64 | |
| 65 | bb8: |
| 66 | ret i32 -1 |
| 67 | } |
| 68 | |
| 69 | declare i32 @printf(i8*, ...) |
| 70 | |
| 71 | declare %struct.FF* @Get() |
| 72 | |
| 73 | declare i32 @foo(i8*, i64, i32) |
| 74 | |
| 75 | declare i32 @bar(i32, i32, i32) |