Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: tests_lit/llvm2ice_tests/phi.ll

Issue 580903005: Subzero: Add branch optimization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 ; This tests some of the subtleties of Phi lowering. In particular, 1 ; This tests some of the subtleties of Phi lowering. In particular,
2 ; it tests that it does the right thing when it tries to enable 2 ; it tests that it does the right thing when it tries to enable
3 ; compare/branch fusing. 3 ; compare/branch fusing.
4 4
5 ; RUN: %llvm2ice -O2 --verbose none --no-phi-edge-split %s \ 5 ; RUN: %llvm2ice -O2 --verbose none --no-phi-edge-split %s \
6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ 6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
7 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s 7 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s
8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s 8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s 9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ 10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 ; Test that compare/branch fusing does not happen, and Phi lowering is 24 ; Test that compare/branch fusing does not happen, and Phi lowering is
25 ; put in the right place. 25 ; put in the right place.
26 ; CHECK-LABEL: testPhi1 26 ; CHECK-LABEL: testPhi1
27 ; CHECK: cmp {{.*}}, 0 27 ; CHECK: cmp {{.*}}, 0
28 ; CHECK: mov {{.*}}, 1 28 ; CHECK: mov {{.*}}, 1
29 ; CHECK: jg 29 ; CHECK: jg
30 ; CHECK: mov {{.*}}, 0 30 ; CHECK: mov {{.*}}, 0
31 ; CHECK: mov [[PHI:.*]], 31 ; CHECK: mov [[PHI:.*]],
32 ; CHECK: cmp {{.*}}, 0 32 ; CHECK: cmp {{.*}}, 0
33 ; CHECK: jne 33 ; CHECK: je
34 ; CHECK: :
35 ; CHECK: mov [[PHI]], 0 34 ; CHECK: mov [[PHI]], 0
36 ; CHECK: :
37 ; CHECK: movzx {{.*}}, [[PHI]] 35 ; CHECK: movzx {{.*}}, [[PHI]]
38 36
39 define internal i32 @testPhi2(i32 %arg) { 37 define internal i32 @testPhi2(i32 %arg) {
40 entry: 38 entry:
41 %cmp1 = icmp sgt i32 %arg, 0 39 %cmp1 = icmp sgt i32 %arg, 0
42 br i1 %cmp1, label %next, label %target 40 br i1 %cmp1, label %next, label %target
43 next: 41 next:
44 br label %target 42 br label %target
45 target: 43 target:
46 %merge = phi i32 [ 12345, %entry ], [ 54321, %next ] 44 %merge = phi i32 [ 12345, %entry ], [ 54321, %next ]
47 ret i32 %merge 45 ret i32 %merge
48 } 46 }
49 ; Test that compare/branch fusing and Phi lowering happens as expected. 47 ; Test that compare/branch fusing and Phi lowering happens as expected.
50 ; CHECK-LABEL: testPhi2 48 ; CHECK-LABEL: testPhi2
51 ; CHECK: mov {{.*}}, 12345 49 ; CHECK: mov {{.*}}, 12345
52 ; CHECK: cmp {{.*}}, 0 50 ; CHECK: cmp {{.*}}, 0
53 ; CHECK-NEXT: jg 51 ; CHECK-NEXT: jle
54 ; CHECK: :
55 ; CHECK: mov [[PHI:.*]], 54321 52 ; CHECK: mov [[PHI:.*]], 54321
56 ; CHECK: :
57 ; CHECK: mov {{.*}}, [[PHI]] 53 ; CHECK: mov {{.*}}, [[PHI]]
58 54
59 ; ERRORS-NOT: ICE translation error 55 ; ERRORS-NOT: ICE translation error
60 ; DUMP-NOT: SZ 56 ; DUMP-NOT: SZ
61 57
62 ; Test that address mode inference doesn't extend past 58 ; Test that address mode inference doesn't extend past
63 ; multi-definition, non-SSA Phi temporaries. 59 ; multi-definition, non-SSA Phi temporaries.
64 define internal i32 @testPhi3(i32 %arg) { 60 define internal i32 @testPhi3(i32 %arg) {
65 entry: 61 entry:
66 br label %body 62 br label %body
(...skipping 26 matching lines...) Expand all
93 ; mov dword ptr [ecx+1000], eax 89 ; mov dword ptr [ecx+1000], eax
94 ; ret 90 ; ret
95 ; 91 ;
96 ; This is bad because the final store address is supposed to be the 92 ; This is bad because the final store address is supposed to be the
97 ; same as the load address in the loop, but it has clearly been 93 ; same as the load address in the loop, but it has clearly been
98 ; over-optimized into a null pointer dereference. 94 ; over-optimized into a null pointer dereference.
99 95
100 ; CHECK-LABEL: testPhi3 96 ; CHECK-LABEL: testPhi3
101 ; CHECK: push [[EBX:.*]] 97 ; CHECK: push [[EBX:.*]]
102 ; CHECK: mov {{.*}}, dword ptr [esp 98 ; CHECK: mov {{.*}}, dword ptr [esp
103 ; CHECK: jmp
104 ; CHECK: mov 99 ; CHECK: mov
105 ; CHECK: mov {{.*}}[[ADDR:.*1000]] 100 ; CHECK: mov {{.*}}[[ADDR:.*1000]]
106 ; CHECK: cmp {{.*}}, 0 101 ; CHECK: cmp {{.*}}, 0
107 ; CHECK: je 102 ; CHECK: jne
108 ; CHECK: jmp
109 ; CHECK: mov {{.*}}[[ADDR]] 103 ; CHECK: mov {{.*}}[[ADDR]]
110 ; CHECK: pop [[EBX]] 104 ; CHECK: pop [[EBX]]
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/nacl-atomic-fence-all.ll ('k') | tests_lit/llvm2ice_tests/simple-loop.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698