Tim Northover | b4ddc08 | 2014-05-30 10:09:59 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=thumbv8 -arm-atomic-cfg-tidy=0 | FileCheck %s |
| 2 | ; RUN: llc < %s -mtriple=thumbv7 -arm-atomic-cfg-tidy=0 -arm-restrict-it | FileCheck %s |
| 3 | ; RUN: llc < %s -mtriple=thumbv8 -arm-atomic-cfg-tidy=0 -relocation-model=pic | FileCheck %s --check-prefix=CHECK-PIC |
| 4 | ; RUN: llc < %s -mtriple=thumbv7 -arm-atomic-cfg-tidy=0 -arm-restrict-it -relocation-model=pic | FileCheck %s --check-prefix=CHECK-PIC |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 5 | |
| 6 | %struct.FF = type { i32 (i32*)*, i32 (i32*, i32*, i32, i32, i32, i32)*, i32 (i32, i32, i8*)*, void ()*, i32 (i32, i8*, i32*)*, i32 ()* } |
| 7 | %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 } |
| 8 | |
| 9 | @FuncPtr = external hidden unnamed_addr global %struct.FF* |
| 10 | @.str1 = external hidden unnamed_addr constant [6 x i8], align 4 |
| 11 | @G = external unnamed_addr global i32 |
| 12 | @.str2 = external hidden unnamed_addr constant [58 x i8], align 4 |
| 13 | @.str3 = external hidden unnamed_addr constant [58 x i8], align 4 |
| 14 | |
| 15 | define i32 @test() nounwind optsize ssp { |
| 16 | entry: |
| 17 | ; CHECK-LABEL: test: |
| 18 | ; CHECK: push |
| 19 | ; CHECK-NOT: push |
| 20 | %block_size = alloca i32, align 4 |
| 21 | %block_count = alloca i32, align 4 |
| 22 | %index_cache = alloca i32, align 4 |
| 23 | store i32 0, i32* %index_cache, align 4 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 24 | %tmp = load i32, i32* @G, align 4 |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 25 | %tmp1 = call i32 @bar(i32 0, i32 0, i32 %tmp) nounwind |
| 26 | switch i32 %tmp1, label %bb8 [ |
Peter Collingbourne | 6529523 | 2015-04-23 20:31:30 +0000 | [diff] [blame] | 27 | i32 1, label %bb |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 28 | i32 536870913, label %bb4 |
| 29 | i32 536870914, label %bb6 |
| 30 | ] |
| 31 | |
| 32 | bb: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 33 | %tmp2 = load i32, i32* @G, align 4 |
Peter Collingbourne | 6529523 | 2015-04-23 20:31:30 +0000 | [diff] [blame] | 34 | %tmp4 = icmp eq i32 %tmp2, 1 |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 35 | br i1 %tmp4, label %bb1, label %bb8 |
| 36 | |
| 37 | bb1: |
Cong Hou | 511298b | 2015-09-01 01:42:16 +0000 | [diff] [blame] | 38 | ; CHECK: %entry |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 39 | ; CHECK: it eq |
| 40 | ; CHECK-NEXT: ldreq |
| 41 | ; CHECK-NEXT: it eq |
| 42 | ; CHECK-NEXT: cmpeq |
| 43 | ; CHECK: %bb1 |
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 |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +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 |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 52 | br label %bb8 |
| 53 | |
| 54 | bb4: |
| 55 | ; CHECK-PIC: cmp |
| 56 | ; CHECK-PIC: cmp |
Cong Hou | 511298b | 2015-09-01 01:42:16 +0000 | [diff] [blame] | 57 | ; CHECK-PIC: cmp |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 58 | ; CHECK-PIC-NEXT: bne |
Cong Hou | 511298b | 2015-09-01 01:42:16 +0000 | [diff] [blame] | 59 | ; CHECK-PIC: %bb6 |
Joey Gouly | a5153cb | 2013-09-09 14:21:49 +0000 | [diff] [blame] | 60 | ; CHECK-PIC-NEXT: movs |
| 61 | ; CHECK-PIC-NEXT: add |
| 62 | ; CHECK-PIC-NEXT: pop |
| 63 | ret i32 0 |
| 64 | |
| 65 | bb6: |
| 66 | ret i32 1 |
| 67 | |
| 68 | bb8: |
| 69 | ret i32 -1 |
| 70 | } |
| 71 | |
| 72 | declare i32 @printf(i8*, ...) |
| 73 | |
| 74 | declare %struct.FF* @Get() |
| 75 | |
| 76 | declare i32 @foo(i8*, i64, i32) |
| 77 | |
| 78 | declare i32 @bar(i32, i32, i32) |