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

Side by Side Diff: runtime/vm/assembler_arm_test.cc

Issue 19400003: Adds the vtbl ARM SIMD instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/disassembler_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 } 2154 }
2155 2155
2156 2156
2157 ASSEMBLER_TEST_RUN(Vmulqs, test) { 2157 ASSEMBLER_TEST_RUN(Vmulqs, test) {
2158 EXPECT(test != NULL); 2158 EXPECT(test != NULL);
2159 typedef int (*Tst)(); 2159 typedef int (*Tst)();
2160 EXPECT_EQ(70, EXECUTE_TEST_CODE_INT32(Tst, test->entry())); 2160 EXPECT_EQ(70, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2161 } 2161 }
2162 2162
2163 2163
2164 ASSEMBLER_TEST_GENERATE(VtblX, assembler) {
regis 2013/07/16 20:57:14 The name VtblX is somewhat confusing, because ther
zra 2013/07/16 21:17:53 I don't think we'll need the vtblx instruction, so
2165 if (CPUFeatures::neon_supported()) {
2166 // Index.
2167 __ LoadImmediate(R0, 0x03020100);
2168 __ vmovsr(S0, R0);
2169 __ vmovsr(S1, R0);
2170
2171 // Table.
2172 __ LoadSImmediate(S2, 1.0);
2173 __ LoadSImmediate(S3, 2.0);
2174 __ LoadSImmediate(S4, 3.0);
2175 __ LoadSImmediate(S5, 4.0);
2176
2177 // Select.
2178 __ vtbl(D3, D1, 2, D0);
2179
2180 // Check that S6, S7 are both 1.0
2181 __ vcvtis(S0, S6);
2182 __ vcvtis(S1, S7);
2183 __ vmovrs(R2, S0);
2184 __ vmovrs(R3, S1);
2185
2186 __ LoadImmediate(R0, 0);
2187 __ CompareImmediate(R2, 1);
2188 __ bx(LR, NE);
2189 __ CompareImmediate(R3, 1);
2190 __ bx(LR, NE);
2191 __ LoadImmediate(R0, 42);
2192 __ bx(LR);
2193 } else {
2194 __ LoadImmediate(R0, 42);
2195 __ bx(LR);
2196 }
2197 }
2198
2199
2200 ASSEMBLER_TEST_RUN(VtblX, test) {
2201 EXPECT(test != NULL);
2202 typedef int (*Tst)();
2203 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2204 }
2205
2206
2207 ASSEMBLER_TEST_GENERATE(VtblY, assembler) {
2208 if (CPUFeatures::neon_supported()) {
2209 // Index.
2210 __ LoadImmediate(R0, 0x07060504);
2211 __ vmovsr(S0, R0);
2212 __ vmovsr(S1, R0);
2213
2214 // Table.
2215 __ LoadSImmediate(S2, 2.0);
2216 __ LoadSImmediate(S3, 1.0);
2217 __ LoadSImmediate(S4, 3.0);
2218 __ LoadSImmediate(S5, 4.0);
2219
2220 // Select.
2221 __ vtbl(D3, D1, 2, D0);
2222
2223 // Check that S6, S7 are both 1.0
2224 __ vcvtis(S0, S6);
2225 __ vcvtis(S1, S7);
2226 __ vmovrs(R2, S0);
2227 __ vmovrs(R3, S1);
2228
2229 __ LoadImmediate(R0, 0);
2230 __ CompareImmediate(R2, 1);
2231 __ bx(LR, NE);
2232 __ CompareImmediate(R3, 1);
2233 __ bx(LR, NE);
2234 __ LoadImmediate(R0, 42);
2235 __ bx(LR);
2236 } else {
2237 __ LoadImmediate(R0, 42);
2238 __ bx(LR);
2239 }
2240 }
2241
2242
2243 ASSEMBLER_TEST_RUN(VtblY, test) {
2244 EXPECT(test != NULL);
2245 typedef int (*Tst)();
2246 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2247 }
2248
2249
2250 ASSEMBLER_TEST_GENERATE(VtblZ, assembler) {
2251 if (CPUFeatures::neon_supported()) {
2252 // Index.
2253 __ LoadImmediate(R0, 0x0b0a0908);
2254 __ vmovsr(S0, R0);
2255 __ vmovsr(S1, R0);
2256
2257 // Table.
2258 __ LoadSImmediate(S2, 2.0);
2259 __ LoadSImmediate(S3, 3.0);
2260 __ LoadSImmediate(S4, 1.0);
2261 __ LoadSImmediate(S5, 4.0);
2262
2263 // Select.
2264 __ vtbl(D3, D1, 2, D0);
2265
2266 // Check that S6, S7 are both 1.0
2267 __ vcvtis(S0, S6);
2268 __ vcvtis(S1, S7);
2269 __ vmovrs(R2, S0);
2270 __ vmovrs(R3, S1);
2271
2272 __ LoadImmediate(R0, 0);
2273 __ CompareImmediate(R2, 1);
2274 __ bx(LR, NE);
2275 __ CompareImmediate(R3, 1);
2276 __ bx(LR, NE);
2277 __ LoadImmediate(R0, 42);
2278 __ bx(LR);
2279 } else {
2280 __ LoadImmediate(R0, 42);
2281 __ bx(LR);
2282 }
2283 }
2284
2285
2286 ASSEMBLER_TEST_RUN(VtblZ, test) {
2287 EXPECT(test != NULL);
2288 typedef int (*Tst)();
2289 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2290 }
2291
2292
2293 ASSEMBLER_TEST_GENERATE(VtblW, assembler) {
2294 if (CPUFeatures::neon_supported()) {
2295 // Index.
2296 __ LoadImmediate(R0, 0x0f0e0d0c);
2297 __ vmovsr(S0, R0);
2298 __ vmovsr(S1, R0);
2299
2300 // Table.
2301 __ LoadSImmediate(S2, 2.0);
2302 __ LoadSImmediate(S3, 3.0);
2303 __ LoadSImmediate(S4, 4.0);
2304 __ LoadSImmediate(S5, 1.0);
2305
2306 // Select.
2307 __ vtbl(D3, D1, 2, D0);
2308
2309 // Check that S6, S7 are both 1.0
2310 __ vcvtis(S0, S6);
2311 __ vcvtis(S1, S7);
2312 __ vmovrs(R2, S0);
2313 __ vmovrs(R3, S1);
2314
2315 __ LoadImmediate(R0, 0);
2316 __ CompareImmediate(R2, 1);
2317 __ bx(LR, NE);
2318 __ CompareImmediate(R3, 1);
2319 __ bx(LR, NE);
2320 __ LoadImmediate(R0, 42);
2321 __ bx(LR);
2322 } else {
2323 __ LoadImmediate(R0, 42);
2324 __ bx(LR);
2325 }
2326 }
2327
2328
2329 ASSEMBLER_TEST_RUN(VtblW, test) {
2330 EXPECT(test != NULL);
2331 typedef int (*Tst)();
2332 EXPECT_EQ(42, EXECUTE_TEST_CODE_INT32(Tst, test->entry()));
2333 }
2334
2335
2164 // Called from assembler_test.cc. 2336 // Called from assembler_test.cc.
2165 // LR: return address. 2337 // LR: return address.
2166 // R0: context. 2338 // R0: context.
2167 // R1: value. 2339 // R1: value.
2168 // R2: growable array. 2340 // R2: growable array.
2169 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { 2341 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
2170 __ PushList((1 << CTX) | (1 << LR)); 2342 __ PushList((1 << CTX) | (1 << LR));
2171 __ mov(CTX, ShifterOperand(R0)); 2343 __ mov(CTX, ShifterOperand(R0));
2172 __ StoreIntoObject(R2, 2344 __ StoreIntoObject(R2,
2173 FieldAddress(R2, GrowableObjectArray::data_offset()), 2345 FieldAddress(R2, GrowableObjectArray::data_offset()),
2174 R1); 2346 R1);
2175 __ PopList((1 << CTX) | (1 << LR)); 2347 __ PopList((1 << CTX) | (1 << LR));
2176 __ Ret(); 2348 __ Ret();
2177 } 2349 }
2178 2350
2179 } // namespace dart 2351 } // namespace dart
2180 2352
2181 #endif // defined TARGET_ARCH_ARM 2353 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | runtime/vm/disassembler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698