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

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

Issue 2892163002: MIPS64: Add optimizations to li macro. (Closed)
Patch Set: Address comments Created 3 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
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | test/cctest/test-assembler-mips64.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 5537 matching lines...) Expand 10 before | Expand all | Expand 10 after
5548 struct TestCaseSubu { 5548 struct TestCaseSubu {
5549 uint32_t imm; 5549 uint32_t imm;
5550 uint32_t expected_res; 5550 uint32_t expected_res;
5551 int32_t num_instr; 5551 int32_t num_instr;
5552 }; 5552 };
5553 5553
5554 // We call Subu(v0, zero_reg, imm) to test cases listed below. 5554 // We call Subu(v0, zero_reg, imm) to test cases listed below.
5555 // 0 - imm = expected_res 5555 // 0 - imm = expected_res
5556 struct TestCaseSubu tc[] = { 5556 struct TestCaseSubu tc[] = {
5557 // imm, expected_res, num_instr 5557 // imm, expected_res, num_instr
5558 {0xffff8000, 0x00008000, 2}, // min_int16 5558 {0xffff8000, 0x8000, 2}, // min_int16
5559 // Generates ori + addu 5559 // Generates ori + addu
5560 // We can't have just addiu because -min_int16 > max_int16 so use 5560 // We can't have just addiu because -min_int16 > max_int16 so use
5561 // register. We can load min_int16 to at register with addiu and then 5561 // register. We can load min_int16 to at register with addiu and then
5562 // subtract at with subu, but now we use ori + addu because -min_int16 can 5562 // subtract at with subu, but now we use ori + addu because -min_int16 can
5563 // be loaded using ori. 5563 // be loaded using ori.
5564 {0x8000, 0xffff8000, 1}, // max_int16 + 1 5564 {0x8000, 0xffff8000, 1}, // max_int16 + 1
5565 // Generates addiu 5565 // Generates addiu
5566 // max_int16 + 1 is not int16 but -(max_int16 + 1) is, just use addiu. 5566 // max_int16 + 1 is not int16 but -(max_int16 + 1) is, just use addiu.
5567 {0xffff7fff, 0x8001, 2}, // min_int16 - 1 5567 {0xffff7fff, 0x8001, 2}, // min_int16 - 1
5568 // Generates ori + addu 5568 // Generates ori + addu
(...skipping 12 matching lines...) Expand all
5581 // We have to generate three instructions in this case. 5581 // We have to generate three instructions in this case.
5582 }; 5582 };
5583 5583
5584 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseSubu); 5584 size_t nr_test_cases = sizeof(tc) / sizeof(TestCaseSubu);
5585 for (size_t i = 0; i < nr_test_cases; ++i) { 5585 for (size_t i = 0; i < nr_test_cases; ++i) {
5586 CHECK_EQ(tc[i].expected_res, run_Subu(tc[i].imm, tc[i].num_instr)); 5586 CHECK_EQ(tc[i].expected_res, run_Subu(tc[i].imm, tc[i].num_instr));
5587 } 5587 }
5588 } 5588 }
5589 5589
5590 #undef __ 5590 #undef __
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | test/cctest/test-assembler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698