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

Unified Diff: test/cctest/test-assembler-arm.cc

Issue 102623003: [v8-dev] ARM: Optimize truncating division and fix sim (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-assembler-arm.cc
diff --git a/test/cctest/test-assembler-arm.cc b/test/cctest/test-assembler-arm.cc
index 69ea6f4742601f035472c046cb909906dcbde307..b21dc34dc4afcebb0a9d3293e1ea2f50bbee8b4b 100644
--- a/test/cctest/test-assembler-arm.cc
+++ b/test/cctest/test-assembler-arm.cc
@@ -1439,6 +1439,72 @@ TEST(17) {
}
+#define TEST_SDIV(expected_, dividend_, divisor_) \
+ t.dividend = dividend_; \
+ t.divisor = divisor_; \
+ t.result = 0; \
+ dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); \
+ CHECK_EQ(expected_, t.result);
+
+
+TEST(18) {
+ // Test the sdiv.
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+
+ typedef struct {
+ uint32_t dividend;
+ uint32_t divisor;
+ uint32_t result;
+ } T;
+ T t;
+
+ Assembler assm(isolate, NULL, 0);
+
+ if (CpuFeatures::IsSupported(SUDIV)) {
+ CpuFeatureScope scope(&assm, SUDIV);
+
+ __ mov(r3, Operand(r0));
+
+ __ ldr(r0, MemOperand(r3, OFFSET_OF(T, dividend)));
+ __ ldr(r1, MemOperand(r3, OFFSET_OF(T, divisor)));
+
+ __ sdiv(r2, r0, r1);
+ __ str(r2, MemOperand(r3, OFFSET_OF(T, result)));
+
+ __ bx(lr);
+
+ CodeDesc desc;
+ assm.GetCode(&desc);
+ Object* code = isolate->heap()->CreateCode(
+ desc,
+ Code::ComputeFlags(Code::STUB),
+ Handle<Code>())->ToObjectChecked();
+ CHECK(code->IsCode());
+#ifdef DEBUG
+ Code::cast(code)->Print();
ulan 2013/12/11 13:57:10 Is this leftover from debug?
vincent.belliard.fr 2013/12/11 14:20:29 This is done in almost all the arm assembler tests
ulan 2013/12/11 14:40:07 OK, thanks.
+#endif
+ F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
+ Object* dummy;
+ TEST_SDIV(1073741824, kMinInt, -2);
+ TEST_SDIV(kMinInt, kMinInt, -1);
+ TEST_SDIV(5, 10, 2);
+ TEST_SDIV(3, 10, 3);
+ TEST_SDIV(-5, 10, -2);
+ TEST_SDIV(-3, 10, -3);
+ TEST_SDIV(-5, -10, 2);
+ TEST_SDIV(-3, -10, 3);
+ TEST_SDIV(5, -10, -2);
+ TEST_SDIV(3, -10, -3);
+ USE(dummy);
+ }
+}
+
+
+#undef TEST_SDIV
+
+
TEST(code_relative_offset) {
// Test extracting the offset of a label from the beginning of the code
// in a register.
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698