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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 F3 f = FUNCTION_CAST<F3>(code->entry()); 1812 F3 f = FUNCTION_CAST<F3>(code->entry());
1813 for (size_t i = 0; i < 128; ++i) { 1813 for (size_t i = 0; i < 128; ++i) {
1814 int32_t r, x = rng->NextInt(), y = rng->NextInt(); 1814 int32_t r, x = rng->NextInt(), y = rng->NextInt();
1815 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); 1815 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0);
1816 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r); 1816 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r);
1817 USE(dummy); 1817 USE(dummy);
1818 } 1818 }
1819 } 1819 }
1820 1820
1821 1821
1822 #define TEST_RBIT(expected_, input_) \
1823 t.input = input_; \
1824 t.result = 0; \
1825 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \
1826 CHECK_EQ(expected_, t.result);
1827
1828
1829 TEST(rbit) {
1830 CcTest::InitializeVM();
1831 Isolate* const isolate = CcTest::i_isolate();
1832 HandleScope scope(isolate);
1833 Assembler assm(isolate, nullptr, 0);
1834
1835 if (CpuFeatures::IsSupported(ARMv7)) {
1836 CpuFeatureScope scope(&assm, ARMv7);
1837
1838 typedef struct {
1839 uint32_t input;
1840 uint32_t result;
1841 } T;
1842 T t;
1843
1844 __ ldr(r1, MemOperand(r0, offsetof(T, input)));
1845 __ rbit(r1, r1);
1846 __ str(r1, MemOperand(r0, offsetof(T, result)));
1847 __ bx(lr);
1848
1849 CodeDesc desc;
1850 assm.GetCode(&desc);
1851 Handle<Code> code = isolate->factory()->NewCode(
1852 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1853
1854 #ifdef OBJECT_PRINT
1855 code->Print(std::cout);
1856 #endif
1857
1858 F3 f = FUNCTION_CAST<F3>(code->entry());
1859 Object* dummy = NULL;
1860 TEST_RBIT(0xffffffff, 0xffffffff);
1861 TEST_RBIT(0x00000000, 0x00000000);
1862 TEST_RBIT(0xffff0000, 0x0000ffff);
1863 TEST_RBIT(0xff00ff00, 0x00ff00ff);
1864 TEST_RBIT(0xf0f0f0f0, 0x0f0f0f0f);
1865 TEST_RBIT(0x1e6a2c48, 0x12345678);
1866 USE(dummy);
1867 }
1868 }
1869
1870
1822 TEST(code_relative_offset) { 1871 TEST(code_relative_offset) {
1823 // Test extracting the offset of a label from the beginning of the code 1872 // Test extracting the offset of a label from the beginning of the code
1824 // in a register. 1873 // in a register.
1825 CcTest::InitializeVM(); 1874 CcTest::InitializeVM();
1826 Isolate* isolate = CcTest::i_isolate(); 1875 Isolate* isolate = CcTest::i_isolate();
1827 HandleScope scope(isolate); 1876 HandleScope scope(isolate);
1828 // Initialize a code object that will contain the code. 1877 // Initialize a code object that will contain the code.
1829 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate); 1878 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate);
1830 1879
1831 Assembler assm(isolate, NULL, 0); 1880 Assembler assm(isolate, NULL, 0);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 HandleScope scope(isolate); 2201 HandleScope scope(isolate);
2153 2202
2154 Assembler assm(isolate, NULL, 0); 2203 Assembler assm(isolate, NULL, 0);
2155 __ mov(r0, Operand(isolate->factory()->infinity_value())); 2204 __ mov(r0, Operand(isolate->factory()->infinity_value()));
2156 __ BlockConstPoolFor(1019); 2205 __ BlockConstPoolFor(1019);
2157 for (int i = 0; i < 1019; ++i) __ nop(); 2206 for (int i = 0; i < 1019; ++i) __ nop();
2158 __ vldr(d0, MemOperand(r0, 0)); 2207 __ vldr(d0, MemOperand(r0, 0));
2159 } 2208 }
2160 2209
2161 #undef __ 2210 #undef __
OLDNEW
« 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