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

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

Issue 1698483002: [arm][arm64] Improve CountTrailingZero implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments addressed Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/cctest/test-disasm-arm.cc » ('j') | 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 563b050c48fe60b2c3b08ed284c1855148ff9d53..68eaab16f6f55f2f0830027ecf2fc075914bd6ba 100644
--- a/test/cctest/test-assembler-arm.cc
+++ b/test/cctest/test-assembler-arm.cc
@@ -1819,6 +1819,55 @@ TEST(uxtah) {
}
+#define TEST_RBIT(expected_, input_) \
+ t.input = input_; \
+ t.result = 0; \
+ dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \
+ CHECK_EQ(expected_, t.result);
+
+
+TEST(rbit) {
+ CcTest::InitializeVM();
+ Isolate* const isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+ Assembler assm(isolate, nullptr, 0);
+
+ if (CpuFeatures::IsSupported(ARMv7)) {
+ CpuFeatureScope scope(&assm, ARMv7);
+
+ typedef struct {
+ uint32_t input;
+ uint32_t result;
+ } T;
+ T t;
+
+ __ ldr(r1, MemOperand(r0, offsetof(T, input)));
+ __ rbit(r1, r1);
+ __ str(r1, MemOperand(r0, offsetof(T, result)));
+ __ bx(lr);
+
+ CodeDesc desc;
+ assm.GetCode(&desc);
+ Handle<Code> code = isolate->factory()->NewCode(
+ desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
+
+#ifdef OBJECT_PRINT
+ code->Print(std::cout);
+#endif
+
+ F3 f = FUNCTION_CAST<F3>(code->entry());
+ Object* dummy = NULL;
+ TEST_RBIT(0xffffffff, 0xffffffff);
+ TEST_RBIT(0x00000000, 0x00000000);
+ TEST_RBIT(0xffff0000, 0x0000ffff);
+ TEST_RBIT(0xff00ff00, 0x00ff00ff);
+ TEST_RBIT(0xf0f0f0f0, 0x0f0f0f0f);
+ TEST_RBIT(0x1e6a2c48, 0x12345678);
+ USE(dummy);
+ }
+}
+
+
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 | « test/cctest/compiler/test-run-machops.cc ('k') | test/cctest/test-disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698