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

Side by Side Diff: test/cctest/test-assembler-arm.cc

Issue 2124022: Update and improve support for ARMv7 bitfield instructions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | test/cctest/test-disasm-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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 t.b = 2.75; 273 t.b = 2.75;
274 t.c = 17.17; 274 t.c = 17.17;
275 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 275 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
276 USE(dummy); 276 USE(dummy);
277 CHECK_EQ(4.25, t.c); 277 CHECK_EQ(4.25, t.c);
278 CHECK_EQ(4.25, t.b); 278 CHECK_EQ(4.25, t.b);
279 CHECK_EQ(1.5, t.a); 279 CHECK_EQ(1.5, t.a);
280 } 280 }
281 } 281 }
282 282
283
284 TEST(5) {
285 // Test the ARMv7 bitfield instructions.
286 InitializeVM();
287 v8::HandleScope scope;
288
289 Assembler assm(NULL, 0);
290
291 // On entry, r0 = 0xAAAAAAAA = 0b10..10101010.
292 __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555
293 __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11
294 __ bfc(r0, 1, 3); // 0b11..111111110001 = -15
295 __ mov(r1, Operand(7));
296 __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7
297 __ mov(pc, Operand(lr));
298
299 CodeDesc desc;
300 assm.GetCode(&desc);
301 Object* code = Heap::CreateCode(desc,
302 NULL,
303 Code::ComputeFlags(Code::STUB),
304 Handle<Object>(Heap::undefined_value()));
305 CHECK(code->IsCode());
306 #ifdef DEBUG
307 Code::cast(code)->Print();
308 #endif
309 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry());
310 int res = reinterpret_cast<int>(
311 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0));
312 ::printf("f() = %d\n", res);
313 CHECK_EQ(-7, res);
314 }
315
283 #undef __ 316 #undef __
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698