| OLD | NEW |
| 1 ; This tests a simple loop that sums the elements of an input array. | 1 ; This tests a simple loop that sums the elements of an input array. |
| 2 ; The O2 check patterns represent the best code currently achieved. | 2 ; The O2 check patterns represent the best code currently achieved. |
| 3 | 3 |
| 4 ; RUN: %p2i -i %s --args -O2 --verbose none \ | 4 ; RUN: %p2i -i %s --args -O2 --verbose none \ |
| 5 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 5 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ |
| 6 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s | 6 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 7 ; RUN: %p2i -i %s --args -Om1 --verbose none \ | 7 ; RUN: %p2i -i %s --args -Om1 --verbose none \ |
| 8 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 8 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ |
| 9 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \ | 9 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \ |
| 10 ; RUN: | FileCheck --check-prefix=OPTM1 %s | 10 ; RUN: | FileCheck --check-prefix=OPTM1 %s |
| 11 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s | |
| 12 | 11 |
| 13 define i32 @simple_loop(i32 %a, i32 %n) { | 12 define i32 @simple_loop(i32 %a, i32 %n) { |
| 14 entry: | 13 entry: |
| 15 %cmp4 = icmp sgt i32 %n, 0 | 14 %cmp4 = icmp sgt i32 %n, 0 |
| 16 br i1 %cmp4, label %for.body, label %for.end | 15 br i1 %cmp4, label %for.body, label %for.end |
| 17 | 16 |
| 18 for.body: | 17 for.body: |
| 19 %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ] | 18 %i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ] |
| 20 %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ] | 19 %sum.05 = phi i32 [ %add, %for.body ], [ 0, %entry ] |
| 21 %gep_array = mul i32 %i.06, 4 | 20 %gep_array = mul i32 %i.06, 4 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 ; Check for comparing the induction variable against the loop size. | 44 ; Check for comparing the induction variable against the loop size. |
| 46 ; CHECK-NEXT: cmp [[IREG]], | 45 ; CHECK-NEXT: cmp [[IREG]], |
| 47 ; CHECK-NEXT: jl -{{[0-9]}} | 46 ; CHECK-NEXT: jl -{{[0-9]}} |
| 48 ; | 47 ; |
| 49 ; There's nothing remarkable under Om1 to test for, since Om1 generates | 48 ; There's nothing remarkable under Om1 to test for, since Om1 generates |
| 50 ; such atrocious code (by design). | 49 ; such atrocious code (by design). |
| 51 ; OPTM1-LABEL: simple_loop | 50 ; OPTM1-LABEL: simple_loop |
| 52 ; OPTM1: cmp {{.*}}, 0 | 51 ; OPTM1: cmp {{.*}}, 0 |
| 53 ; OPTM1: jg | 52 ; OPTM1: jg |
| 54 ; OPTM1: ret | 53 ; OPTM1: ret |
| 55 | |
| 56 ; ERRORS-NOT: ICE translation error | |
| OLD | NEW |