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

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

Issue 1371703003: Generate better two address code by using commutativity (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add test for commutativity. Created 5 years, 2 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 | « tests_lit/assembler/x86/opcode_register_encodings.ll ('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 ; Test the lowering sequence for commutative operations. If there is a source
2 ; operand whose lifetime ends in an operation, it should be the first operand,
3 ; eliminating the need for a move to start the new lifetime.
4
5 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
6 ; RUN: --target x8632 -i %s --args -O2 \
7 ; RUN: | %if --need=target_X8632 --command FileCheck %s
8
9 declare void @useInteger(i32 %arg)
10 declare void @useFloat(float %arg)
11
12 define void @integerAddLeft(i32 %a, i32 %b) {
13 entry:
14 %tmp = add i32 %a, %b
15 %result = add i32 %a, %tmp
16 tail call void @useInteger(i32 %result)
17 ret void
18 }
19 ; CHECK-LABEL: integerAddLeft
20 ; CHECK-NOT: mov [[REG1:e.x]],[[REG2:e.x]]
Jim Stichnoth 2015/10/06 19:35:49 A few problems here. 1. You're matching eax/ebx/e
sehr 2015/10/07 00:18:30 Completely revamped per your comments here and in
21 ; CHECK: add [[REG1:e.x]],[[REG2:e.x]]
22 ; CHECK: add [[REG1:e.x]],[[REG2:e.x]]
23
24 define void @integerAddRight(i32 %a, i32 %b) {
25 entry:
26 %tmp = add i32 %a, %b
27 %result = add i32 %b, %tmp
28 tail call void @useInteger(i32 %result)
29 ret void
30 }
31 ; CHECK-LABEL: integerAddRight
32 ; CHECK-NOT: mov [[REG1:e.x]],[[REG2:e.x]]
33 ; CHECK: add [[REG1:e.x]],[[REG2:e.x]]
34 ; CHECK: add [[REG1:e.x]],[[REG2:e.x]]
35
36 define void @integerMultiplyLeft(i32 %a, i32 %b) {
37 entry:
38 %tmp = mul i32 %a, %b
39 %result = mul i32 %a, %tmp
40 tail call void @useInteger(i32 %result)
41 ret void
42 }
43 ; CHECK-LABEL: integerMultiplyLeft
44 ; CHECK-NOT: mov [[REG1:e.x]],[[REG2:e.x]]
45 ; CHECK: mul [[REG1:e.x]],[[REG2:e.x]]
46 ; CHECK: mul [[REG1:e.x]],[[REG2:e.x]]
47
48 define void @integerMultiplyRight(i32 %a, i32 %b) {
49 entry:
50 %tmp = mul i32 %a, %b
51 %result = mul i32 %b, %tmp
52 tail call void @useInteger(i32 %result)
53 ret void
54 }
55 ; CHECK-LABEL: integerMultiplyRight
56 ; CHECK-NOT: mov [[REG1:e.x]],[[REG2:e.x]]
57 ; CHECK: mul [[REG1:e.x]],[[REG2:e.x]]
58 ; CHECK: mul [[REG1:e.x]],[[REG2:e.x]]
59
60 define void @floatAddLeft(float %a, float %b) {
61 entry:
62 %tmp = fadd float %a, %b
63 %result = fadd float %a, %tmp
64 tail call void @useFloat(float %result)
65 ret void
66 }
67 ; CHECK-LABEL: floatAddLeft
68 ; CHECK-NOT: movss [[REG1:xmm.]],[[REG2:xmm.]]
69 ; CHECK: addss [[REG1:xmm.]],[[REG2:xmm.]]
70 ; CHECK: addss [[REG1:xmm.]],[[REG2:xmm.]]
71
72 define void @floatAddRight(float %a, float %b) {
73 entry:
74 %tmp = fadd float %a, %b
75 %result = fadd float %b, %tmp
76 tail call void @useFloat(float %result)
77 ret void
78 }
79 ; CHECK-LABEL: floatAddRight
80 ; CHECK-NOT: movss [[REG1:xmm.]],[[REG2:xmm.]]
81 ; CHECK: addss [[REG1:xmm.]],[[REG2:xmm.]]
82 ; CHECK: addss [[REG1:xmm.]],[[REG2:xmm.]]
83
84 define void @floatMultiplyLeft(float %a, float %b) {
85 entry:
86 %tmp = fmul float %a, %b
87 %result = fmul float %a, %tmp
88 tail call void @useFloat(float %result)
89 ret void
90 }
91 ; CHECK-LABEL: floatMultiplyLeft
92 ; CHECK-NOT: movss [[REG1:xmm.]],[[REG2:xmm.]]
93 ; CHECK: mulss [[REG1:xmm.]],[[REG2:xmm.]]
94 ; CHECK: mulss [[REG1:xmm.]],[[REG2:xmm.]]
95
96 define void @floatMultiplyRight(float %a, float %b) {
97 entry:
98 %tmp = fmul float %a, %b
99 %result = fmul float %b, %tmp
100 tail call void @useFloat(float %result)
101 ret void
102 }
103 ; CHECK-LABEL: floatMultiplyRight
104 ; CHECK-NOT: movss [[REG1:xmm.]],[[REG2:xmm.]]
105 ; CHECK: mulss [[REG1:xmm.]],[[REG2:xmm.]]
106 ; CHECK: mulss [[REG1:xmm.]],[[REG2:xmm.]]
OLDNEW
« no previous file with comments | « tests_lit/assembler/x86/opcode_register_encodings.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698