Index: test/cctest/test-assembler-arm.cc |
=================================================================== |
--- test/cctest/test-assembler-arm.cc (revision 4740) |
+++ test/cctest/test-assembler-arm.cc (working copy) |
@@ -280,4 +280,37 @@ |
} |
} |
+ |
+TEST(5) { |
+ // Test the ARMv7 bitfield instructions. |
+ InitializeVM(); |
+ v8::HandleScope scope; |
+ |
+ Assembler assm(NULL, 0); |
+ |
+ // On entry, r0 = 0xAAAAAAAA = 0b10..10101010. |
+ __ ubfx(r0, r0, 1, 12); // 0b00..010101010101 = 0x555 |
+ __ sbfx(r0, r0, 0, 5); // 0b11..111111110101 = -11 |
+ __ bfc(r0, 1, 3); // 0b11..111111110001 = -15 |
+ __ mov(r1, Operand(7)); |
+ __ bfi(r0, r1, 3, 3); // 0b11..111111111001 = -7 |
+ __ mov(pc, Operand(lr)); |
+ |
+ CodeDesc desc; |
+ assm.GetCode(&desc); |
+ Object* code = Heap::CreateCode(desc, |
+ NULL, |
+ Code::ComputeFlags(Code::STUB), |
+ Handle<Object>(Heap::undefined_value())); |
+ CHECK(code->IsCode()); |
+#ifdef DEBUG |
+ Code::cast(code)->Print(); |
+#endif |
+ F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
+ int res = reinterpret_cast<int>( |
+ CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); |
+ ::printf("f() = %d\n", res); |
+ CHECK_EQ(-7, res); |
+} |
+ |
#undef __ |