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

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

Issue 1127003003: Lower a few basic ARM binops for i{8,16,32,64}. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: move comment 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
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | tests_lit/llvm2ice_tests/arith-opt.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; Assembly test for simple arithmetic operations.
2
3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s
Jim Stichnoth 2015/05/19 14:54:41 Should probably start making --target=x8632 explic
jvoung (off chromium) 2015/05/19 17:15:00 Done. Also added the %if, but wasn't sure if you w
4
5 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented)
6 ; once enough infrastructure is in. Also, switch to --filetype=obj
7 ; when possible.
8 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=asm --assemble \
9 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \
10 ; RUN: | %if --need=target_ARM32 --command FileCheck --check-prefix ARM32 %s
11
12 define i32 @Add(i32 %a, i32 %b) {
13 entry:
14 %add = add i32 %b, %a
15 ret i32 %add
16 }
17 ; CHECK-LABEL: Add
18 ; CHECK: add e
19 ; ARM32-LABEL: Add
20 ; ARM32: add r
21
22 define i32 @And(i32 %a, i32 %b) {
23 entry:
24 %and = and i32 %b, %a
25 ret i32 %and
26 }
27 ; CHECK-LABEL: And
28 ; CHECK: and e
29 ; ARM32-LABEL: And
30 ; ARM32: and r
31
32 define i32 @Or(i32 %a, i32 %b) {
33 entry:
34 %or = or i32 %b, %a
35 ret i32 %or
36 }
37 ; CHECK-LABEL: Or
38 ; CHECK: or e
39 ; ARM32-LABEL: Or
40 ; ARM32: orr r
41
42 define i32 @Xor(i32 %a, i32 %b) {
43 entry:
44 %xor = xor i32 %b, %a
45 ret i32 %xor
46 }
47 ; CHECK-LABEL: Xor
48 ; CHECK: xor e
49 ; ARM32-LABEL: Xor
50 ; ARM32: eor r
51
52 define i32 @Sub(i32 %a, i32 %b) {
53 entry:
54 %sub = sub i32 %a, %b
55 ret i32 %sub
56 }
57 ; CHECK-LABEL: Sub
58 ; CHECK: sub e
59 ; ARM32-LABEL: Sub
60 ; ARM32: sub r
61
62 define i32 @Mul(i32 %a, i32 %b) {
63 entry:
64 %mul = mul i32 %b, %a
65 ret i32 %mul
66 }
67 ; CHECK-LABEL: Mul
68 ; CHECK: imul e
69 ; ARM32-LABEL: Mul
70 ; ARM32: mul r
71
72 ; Check for a valid ARM mul instruction where operands have to be registers.
73 ; On the other hand x86-32 does allow an immediate.
74 define i32 @MulImm(i32 %a, i32 %b) {
75 entry:
76 %mul = mul i32 %a, 99
77 ret i32 %mul
78 }
79 ; CHECK-LABEL: MulImm
80 ; CHECK: imul e{{.*}},e{{.*}},0x63
81 ; ARM32-LABEL: MulImm
82 ; ARM32: mov {{.*}}, #99
83 ; ARM32: mul r{{.*}}, r{{.*}}, r{{.*}}
84
85 ; Check for a valid addressing mode in the x86-32 mul instruction when
86 ; the second source operand is an immediate.
87 define i64 @MulImm64(i64 %a) {
88 entry:
89 %mul = mul i64 %a, 99
90 ret i64 %mul
91 }
92 ; NOTE: the lowering is currently a bit inefficient for small 64-bit constants.
93 ; The top bits of the immediate are 0, but the instructions modeling that
94 ; multiply by 0 are not eliminated (see expanded 64-bit ARM lowering).
95 ; CHECK-LABEL: MulImm64
96 ; CHECK: mov {{.*}},0x63
97 ; CHECK: mov {{.*}},0x0
98 ; CHECK-NOT: mul {{[0-9]+}}
99 ;
100 ; ARM32-LABEL: MulImm64
101 ; ARM32: mov {{.*}}, #99
102 ; ARM32: mov {{.*}}, #0
103 ; ARM32: mul r
104 ; ARM32: mla r
105 ; ARM32: umull r
106 ; ARM32: add r
107
108 define i32 @Sdiv(i32 %a, i32 %b) {
109 entry:
110 %div = sdiv i32 %a, %b
111 ret i32 %div
112 }
113 ; CHECK-LABEL: Sdiv
114 ; CHECK: cdq
115 ; CHECK: idiv e
116 ; ARM32-LABEL: Sdiv
117 ; TODO(jvoung) -- implement divide and check here.
118 ; The lowering needs to check if the denominator is 0 and trap, since
119 ; ARM normally doesn't trap on divide by 0.
120
121 define i32 @Srem(i32 %a, i32 %b) {
122 entry:
123 %rem = srem i32 %a, %b
124 ret i32 %rem
125 }
126 ; CHECK-LABEL: Srem
127 ; CHECK: cdq
128 ; CHECK: idiv e
129 ; ARM32-LABEL: Srem
130
131 define i32 @Udiv(i32 %a, i32 %b) {
132 entry:
133 %div = udiv i32 %a, %b
134 ret i32 %div
135 }
136 ; CHECK-LABEL: Udiv
137 ; CHECK: div e
138 ; ARM32-LABEL: Udiv
139
140 define i32 @Urem(i32 %a, i32 %b) {
141 entry:
142 %rem = urem i32 %a, %b
143 ret i32 %rem
144 }
145 ; CHECK-LABEL: Urem
146 ; CHECK: div e
147 ; ARM32-LABEL: Urem
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | tests_lit/llvm2ice_tests/arith-opt.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698