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

Side by Side Diff: tests_lit/llvm2ice_tests/select-opt.ll

Issue 1141213004: Subzero: Fold icmp into br/select lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove unnecessary break statement Created 5 years, 7 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 ; Simple test of the select instruction. The CHECK lines are only 1 ; Simple test of the select instruction. The CHECK lines are only
2 ; checking for basic instruction patterns that should be present 2 ; checking for basic instruction patterns that should be present
3 ; regardless of the optimization level, so there are no special OPTM1 3 ; regardless of the optimization level, so there are no special OPTM1
4 ; match lines. 4 ; match lines.
5 5
6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s
7 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 | FileCheck %s 7 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 | FileCheck %s
8 8
9 define void @testSelect(i32 %a, i32 %b) { 9 define void @testSelect(i32 %a, i32 %b) {
10 entry: 10 entry:
11 %cmp = icmp slt i32 %a, %b 11 %cmp = icmp slt i32 %a, %b
12 %cond = select i1 %cmp, i32 %a, i32 %b 12 %cond = select i1 %cmp, i32 %a, i32 %b
13 tail call void @useInt(i32 %cond) 13 tail call void @useInt(i32 %cond)
14 %cmp1 = icmp sgt i32 %a, %b 14 %cmp1 = icmp sgt i32 %a, %b
15 %cond2 = select i1 %cmp1, i32 10, i32 20 15 %cond2 = select i1 %cmp1, i32 10, i32 20
16 tail call void @useInt(i32 %cond2) 16 tail call void @useInt(i32 %cond2)
17 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding.
18 %d1 = zext i1 %cmp to i32
19 call void @useInt(i32 %d1)
20 %d2 = zext i1 %cmp1 to i32
21 call void @useInt(i32 %d2)
17 ret void 22 ret void
18 } 23 }
19 24
20 declare void @useInt(i32 %x) 25 declare void @useInt(i32 %x)
21 26
22 ; CHECK-LABEL: testSelect 27 ; CHECK-LABEL: testSelect
23 ; CHECK: cmp 28 ; CHECK: cmp
24 ; CHECK: cmp 29 ; CHECK: cmp
25 ; CHECK: call {{.*}} R_{{.*}} useInt 30 ; CHECK: call {{.*}} R_{{.*}} useInt
26 ; CHECK: cmp 31 ; CHECK: cmp
(...skipping 14 matching lines...) Expand all
41 ; Check for valid addressing mode in the cmp instruction when the 46 ; Check for valid addressing mode in the cmp instruction when the
42 ; operand is an immediate. There is a different x86-32 lowering 47 ; operand is an immediate. There is a different x86-32 lowering
43 ; sequence for 64-bit operands. 48 ; sequence for 64-bit operands.
44 define i64 @testSelectImm64(i64 %a, i64 %b) { 49 define i64 @testSelectImm64(i64 %a, i64 %b) {
45 entry: 50 entry:
46 %cond = select i1 true, i64 %a, i64 %b 51 %cond = select i1 true, i64 %a, i64 %b
47 ret i64 %cond 52 ret i64 %cond
48 } 53 }
49 ; CHECK-LABEL: testSelectImm64 54 ; CHECK-LABEL: testSelectImm64
50 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, 55 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}},
OLDNEW
« src/IceTargetLoweringX8632.h ('K') | « tests_lit/llvm2ice_tests/bool-folding.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698