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

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

Issue 1414883007: Subzero. ARM32. Implements bool folding. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments && pulls. Created 5 years, 1 month 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 | « tests_lit/llvm2ice_tests/fp.cmp.ll ('k') | tests_lit/llvm2ice_tests/test_i1.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
7 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ 7 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \
8 ; RUN: | %if --need=target_X8632 --command FileCheck %s 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s
9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
10 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ 10 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \
11 ; RUN: | %if --need=target_X8632 --command FileCheck %s 11 ; RUN: | %if --need=target_X8632 --command FileCheck %s
12 12
13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \
14 ; RUN: --command %p2i --filetype=asm --assemble \ 14 ; RUN: --command %p2i --filetype=asm --assemble \
15 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ 15 ; RUN: --disassemble --target arm32 -i %s --args -O2 \
16 ; RUN: -allow-externally-defined-symbols \ 16 ; RUN: -allow-externally-defined-symbols \
17 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ 17 ; RUN: | %if --need=target_ARM32 --need=allow_dump \
18 ; RUN: --command FileCheck --check-prefix ARM32 %s 18 ; RUN: --command FileCheck --check-prefix ARM32 --check-prefix ARM32-O2 %s
19 ; RUN: %if --need=target_ARM32 --need=allow_dump \ 19 ; RUN: %if --need=target_ARM32 --need=allow_dump \
20 ; RUN: --command %p2i --filetype=asm --assemble \ 20 ; RUN: --command %p2i --filetype=asm --assemble \
21 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ 21 ; RUN: --disassemble --target arm32 -i %s --args -Om1 \
22 ; RUN: -allow-externally-defined-symbols \ 22 ; RUN: -allow-externally-defined-symbols \
23 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ 23 ; RUN: | %if --need=target_ARM32 --need=allow_dump \
24 ; RUN: --command FileCheck --check-prefix ARM32 %s 24 ; RUN: --command FileCheck --check-prefix ARM32 --check-prefix ARM32-OM1 %s
25 25
26 define internal void @testSelect(i32 %a, i32 %b) { 26 define internal void @testSelect(i32 %a, i32 %b) {
27 entry: 27 entry:
28 %cmp = icmp slt i32 %a, %b 28 %cmp = icmp slt i32 %a, %b
29 %cond = select i1 %cmp, i32 %a, i32 %b 29 %cond = select i1 %cmp, i32 %a, i32 %b
30 tail call void @useInt(i32 %cond) 30 tail call void @useInt(i32 %cond)
31 %cmp1 = icmp sgt i32 %a, %b 31 %cmp1 = icmp sgt i32 %a, %b
32 %cond2 = select i1 %cmp1, i32 10, i32 20 32 %cond2 = select i1 %cmp1, i32 10, i32 20
33 tail call void @useInt(i32 %cond2) 33 tail call void @useInt(i32 %cond2)
34 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding. 34 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding.
35 %d1 = zext i1 %cmp to i32 35 %d1 = zext i1 %cmp to i32
36 call void @useInt(i32 %d1) 36 call void @useInt(i32 %d1)
37 %d2 = zext i1 %cmp1 to i32 37 %d2 = zext i1 %cmp1 to i32
38 call void @useInt(i32 %d2) 38 call void @useInt(i32 %d2)
39 ret void 39 ret void
40 } 40 }
41 41
42 declare void @useInt(i32 %x) 42 declare void @useInt(i32 %x)
43 43
44 ; CHECK-LABEL: testSelect 44 ; CHECK-LABEL: testSelect
45 ; CHECK: cmp 45 ; CHECK: cmp
46 ; CHECK: cmp 46 ; CHECK: cmp
47 ; CHECK: call {{.*}} R_{{.*}} useInt 47 ; CHECK: call {{.*}} R_{{.*}} useInt
48 ; CHECK: cmp 48 ; CHECK: cmp
49 ; CHECK: cmp 49 ; CHECK: cmp
50 ; CHECK: call {{.*}} R_{{.*}} useInt 50 ; CHECK: call {{.*}} R_{{.*}} useInt
51 ; CHECK: ret 51 ; CHECK: ret
52 ; ARM32-LABEL: testSelect 52 ; ARM32-LABEL: testSelect
53 ; ARM32: cmp 53 ; ARM32: cmp
54 ; ARM32: cmp 54 ; ARM32-OM1: cmp
55 ; ARM32: bl {{.*}} useInt 55 ; ARM32: bl {{.*}} useInt
56 ; ARM32: cmp 56 ; ARM32: cmp
57 ; ARM32: cmp 57 ; ARM32-Om1: cmp
58 ; ARM32: mov {{.*}}, #20 58 ; ARM32-Om1: mov {{.*}}, #20
59 ; ARM32: movne {{.*}}, #10 59 ; ARM32-Om1: movne {{.*}}, #10
60 ; ARM32-O2: movle [[REG:r[0-9]+]], #20
61 ; ARM32-O2: movgt [[REG]], #10
62 ; ARM32: bl {{.*}} useInt
63 ; ARM32: bl {{.*}} useInt
60 ; ARM32: bl {{.*}} useInt 64 ; ARM32: bl {{.*}} useInt
61 ; ARM32: bx lr 65 ; ARM32: bx lr
62 66
63 ; Check for valid addressing mode in the cmp instruction when the 67 ; Check for valid addressing mode in the cmp instruction when the
64 ; operand is an immediate. 68 ; operand is an immediate.
65 define internal i32 @testSelectImm32(i32 %a, i32 %b) { 69 define internal i32 @testSelectImm32(i32 %a, i32 %b) {
66 entry: 70 entry:
67 %cond = select i1 false, i32 %a, i32 %b 71 %cond = select i1 false, i32 %a, i32 %b
68 ret i32 %cond 72 ret i32 %cond
69 } 73 }
70 ; CHECK-LABEL: testSelectImm32 74 ; CHECK-LABEL: testSelectImm32
71 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, 75 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}},
72 ; ARM32-LABEL: testSelectImm32 76 ; ARM32-LABEL: testSelectImm32
73 ; ARM32-NOT: cmp #{{.*}}, 77 ; ARM32-NOT: cmp #{{.*}},
74 78
75 ; Check for valid addressing mode in the cmp instruction when the 79 ; Check for valid addressing mode in the cmp instruction when the
76 ; operand is an immediate. There is a different x86-32 lowering 80 ; operand is an immediate. There is a different x86-32 lowering
77 ; sequence for 64-bit operands. 81 ; sequence for 64-bit operands.
78 define internal i64 @testSelectImm64(i64 %a, i64 %b) { 82 define internal i64 @testSelectImm64(i64 %a, i64 %b) {
79 entry: 83 entry:
80 %cond = select i1 true, i64 %a, i64 %b 84 %cond = select i1 true, i64 %a, i64 %b
81 ret i64 %cond 85 ret i64 %cond
82 } 86 }
83 ; CHECK-LABEL: testSelectImm64 87 ; CHECK-LABEL: testSelectImm64
84 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, 88 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}},
85 ; ARM32-LABEL: testSelectImm64 89 ; ARM32-LABEL: testSelectImm64
86 ; ARM32-NOT: cmp #{{.*}}, 90 ; ARM32-NOT: cmp #{{.*}},
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/fp.cmp.ll ('k') | tests_lit/llvm2ice_tests/test_i1.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698