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

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

Issue 560773002: Subzero: Fix Phi lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes, plus a new TODO 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
« no previous file with comments | « src/llvm2ice.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 ; compare/branch fusing.
4
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 \
7 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s
8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
11 ; RUN: | FileCheck --check-prefix=DUMP %s
12
13 define internal i32 @testPhi1(i32 %arg) {
14 entry:
15 %cmp1 = icmp sgt i32 %arg, 0
16 br i1 %cmp1, label %next, label %target
17 next:
18 br label %target
19 target:
20 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ]
21 %result = zext i1 %merge to i32
22 ret i32 %result
23 }
24 ; Test that compare/branch fusing does not happen, and Phi lowering is
25 ; put in the right place.
26 ; CHECK-LABEL: testPhi1
27 ; CHECK: cmp {{.*}}, 0
28 ; CHECK: mov {{.*}}, 1
29 ; CHECK: jg
30 ; CHECK: mov {{.*}}, 0
31 ; CHECK: mov [[PHI:.*]],
32 ; CHECK: cmp {{.*}}, 0
33 ; CHECK: jne
34 ; CHECK: :
35 ; CHECK: mov [[PHI]], 0
36 ; CHECK: :
37 ; CHECK: movzx {{.*}}, [[PHI]]
38
39 define internal i32 @testPhi2(i32 %arg) {
40 entry:
41 %cmp1 = icmp sgt i32 %arg, 0
42 br i1 %cmp1, label %next, label %target
43 next:
44 br label %target
45 target:
46 %merge = phi i32 [ 12345, %entry ], [ 54321, %next ]
47 ret i32 %merge
48 }
49 ; Test that compare/branch fusing and Phi lowering happens as expected.
50 ; CHECK-LABEL: testPhi2
51 ; CHECK: mov {{.*}}, 12345
52 ; CHECK: cmp {{.*}}, 0
53 ; CHECK-NEXT: jg
54 ; CHECK: :
55 ; CHECK: mov [[PHI:.*]], 54321
56 ; CHECK: :
57 ; CHECK: mov {{.*}}, [[PHI]]
58
59 ; ERRORS-NOT: ICE translation error
60 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « src/llvm2ice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698