Dan Gohman | da594cf | 2009-09-09 00:09:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=thumbv6-apple-darwin -relocation-model=pic -disable-fp-elim -mattr=+v6 | FileCheck %s |
Evan Cheng | af35b28 | 2009-08-20 17:01:04 +0000 | [diff] [blame] | 2 | ; rdar://7157006 |
| 3 | |
| 4 | %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } |
| 5 | %struct.__sFILEX = type opaque |
| 6 | %struct.__sbuf = type { i8*, i32 } |
| 7 | %struct.asl_file_t = type { i32, i32, i32, %struct.file_string_t*, i64, i64, i64, i64, i64, i64, i32, %struct.FILE*, i8*, i8* } |
| 8 | %struct.file_string_t = type { i64, i32, %struct.file_string_t*, [0 x i8] } |
| 9 | |
| 10 | @llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.asl_file_t*, i64, i64*)* @t to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] |
| 11 | |
| 12 | define arm_apcscc i32 @t(%struct.asl_file_t* %s, i64 %off, i64* %out) nounwind optsize { |
| 13 | ; CHECK: t: |
Jim Grosbach | 46999f2 | 2009-10-19 22:57:03 +0000 | [diff] [blame] | 14 | ; CHECK: adds r3, #8 |
Evan Cheng | af35b28 | 2009-08-20 17:01:04 +0000 | [diff] [blame] | 15 | entry: |
| 16 | %val = alloca i64, align 4 ; <i64*> [#uses=3] |
| 17 | %0 = icmp eq %struct.asl_file_t* %s, null ; <i1> [#uses=1] |
| 18 | br i1 %0, label %bb13, label %bb1 |
| 19 | |
| 20 | bb1: ; preds = %entry |
| 21 | %1 = getelementptr inbounds %struct.asl_file_t* %s, i32 0, i32 11 ; <%struct.FILE**> [#uses=2] |
| 22 | %2 = load %struct.FILE** %1, align 4 ; <%struct.FILE*> [#uses=2] |
| 23 | %3 = icmp eq %struct.FILE* %2, null ; <i1> [#uses=1] |
| 24 | br i1 %3, label %bb13, label %bb3 |
| 25 | |
| 26 | bb3: ; preds = %bb1 |
| 27 | %4 = add nsw i64 %off, 8 ; <i64> [#uses=1] |
| 28 | %5 = getelementptr inbounds %struct.asl_file_t* %s, i32 0, i32 10 ; <i32*> [#uses=1] |
| 29 | %6 = load i32* %5, align 4 ; <i32> [#uses=1] |
| 30 | %7 = zext i32 %6 to i64 ; <i64> [#uses=1] |
| 31 | %8 = icmp sgt i64 %4, %7 ; <i1> [#uses=1] |
| 32 | br i1 %8, label %bb13, label %bb5 |
| 33 | |
| 34 | bb5: ; preds = %bb3 |
| 35 | %9 = call arm_apcscc i32 @fseeko(%struct.FILE* %2, i64 %off, i32 0) nounwind ; <i32> [#uses=1] |
| 36 | %10 = icmp eq i32 %9, 0 ; <i1> [#uses=1] |
| 37 | br i1 %10, label %bb7, label %bb13 |
| 38 | |
| 39 | bb7: ; preds = %bb5 |
| 40 | store i64 0, i64* %val, align 4 |
| 41 | %11 = load %struct.FILE** %1, align 4 ; <%struct.FILE*> [#uses=1] |
| 42 | %val8 = bitcast i64* %val to i8* ; <i8*> [#uses=1] |
| 43 | %12 = call arm_apcscc i32 @fread(i8* noalias %val8, i32 8, i32 1, %struct.FILE* noalias %11) nounwind ; <i32> [#uses=1] |
| 44 | %13 = icmp eq i32 %12, 1 ; <i1> [#uses=1] |
| 45 | br i1 %13, label %bb10, label %bb13 |
| 46 | |
| 47 | bb10: ; preds = %bb7 |
| 48 | %14 = icmp eq i64* %out, null ; <i1> [#uses=1] |
| 49 | br i1 %14, label %bb13, label %bb11 |
| 50 | |
| 51 | bb11: ; preds = %bb10 |
| 52 | %15 = load i64* %val, align 4 ; <i64> [#uses=1] |
| 53 | %16 = call arm_apcscc i64 @asl_core_ntohq(i64 %15) nounwind ; <i64> [#uses=1] |
| 54 | store i64 %16, i64* %out, align 4 |
| 55 | ret i32 0 |
| 56 | |
| 57 | bb13: ; preds = %bb10, %bb7, %bb5, %bb3, %bb1, %entry |
| 58 | %.0 = phi i32 [ 2, %entry ], [ 2, %bb1 ], [ 7, %bb3 ], [ 7, %bb5 ], [ 7, %bb7 ], [ 0, %bb10 ] ; <i32> [#uses=1] |
| 59 | ret i32 %.0 |
| 60 | } |
| 61 | |
| 62 | declare arm_apcscc i32 @fseeko(%struct.FILE* nocapture, i64, i32) nounwind |
| 63 | |
| 64 | declare arm_apcscc i32 @fread(i8* noalias nocapture, i32, i32, %struct.FILE* noalias nocapture) nounwind |
| 65 | |
| 66 | declare arm_apcscc i64 @asl_core_ntohq(i64) |