OLD | NEW |
(Empty) | |
| 1 ; RUIN: %llvm2ice -verbose inst %s | FileCheck %s |
| 2 ; RUIN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 3 ; RUN: %szdiff --llvm2ice=%llvm2ice %s | FileCheck --check-prefix=DUMP %s |
| 4 |
| 5 define i32 @simple_loop(i32 %a, i32 %n) { |
| 6 entry: |
| 7 %cmp4 = icmp sgt i32 %n, 0 |
| 8 br i1 %cmp4, label %for.body, label %for.end |
| 9 |
| 10 for.body: |
| 11 %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 12 %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ] |
| 13 %gep_array = mul i32 %i.06, 4 |
| 14 %gep = add i32 %a, %gep_array |
| 15 %gep.asptr = inttoptr i32 %gep to i32* |
| 16 %v0 = load i32* %gep.asptr, align 1 |
| 17 %add = add i32 %v0, %sum.05 |
| 18 %inc = add i32 %i.06, 1 |
| 19 %cmp = icmp slt i32 %inc, %n |
| 20 br i1 %cmp, label %for.body, label %for.end |
| 21 |
| 22 for.end: |
| 23 %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ] |
| 24 ret i32 %sum.0.lcssa |
| 25 } |
| 26 |
| 27 ; Checks for verbose instruction output |
| 28 |
| 29 ; CHECK: br i1 %cmp4, label %for.body, label %for.end |
| 30 ; CHECK-NEXT: for.body |
| 31 ; CHECK: %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 32 ; CHECK-NEXT: %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ] |
| 33 |
| 34 ; Checks for emitted assembly |
| 35 |
| 36 ; CHECK: .globl simple_loop |
| 37 |
| 38 ; CHECK: mov ecx, dword ptr [esp+{{[0-9]+}}] |
| 39 ; CHECK: cmp ecx, 0 |
| 40 ; CHECK-NEXT: jg {{.*}}for.body |
| 41 ; CHECK-NEXT: jmp {{.*}}for.end |
| 42 |
| 43 ; TODO: the mov from ebx to esi seems redundant here - so this may need to be |
| 44 ; modified later |
| 45 |
| 46 ; CHECK: add [[IREG:[a-z]+]], 1 |
| 47 ; CHECK-NEXT: mov [[ICMPREG:[a-z]+]], [[IREG]] |
| 48 ; CHECK: cmp [[ICMPREG]], ecx |
| 49 ; CHECK-NEXT: jl {{.*}}for.body |
| 50 |
| 51 ; ERRORS-NOT: ICE translation error |
| 52 ; DUMP-NOT: SZ |
OLD | NEW |