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

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

Issue 2001073002: [build] Fix a clang warning (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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/x87/disasm-x87.cc ('k') | test/cctest/test-disasm-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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 92
93 // Verify that all invocations of the COMPARE macro passed successfully. 93 // Verify that all invocations of the COMPARE macro passed successfully.
94 // Exit with a failure if at least one of the tests failed. 94 // Exit with a failure if at least one of the tests failed.
95 #define VERIFY_RUN() \ 95 #define VERIFY_RUN() \
96 if (failure) { \ 96 if (failure) { \
97 V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \ 97 V8_Fatal(__FILE__, __LINE__, "MIPS Disassembler tests failed.\n"); \
98 } 98 }
99 99
100
101 #define COMPARE_PC_REL_COMPACT(asm_, compare_string, offset) \ 100 #define COMPARE_PC_REL_COMPACT(asm_, compare_string, offset) \
102 { \ 101 { \
103 int pc_offset = assm.pc_offset(); \ 102 int pc_offset = assm.pc_offset(); \
104 byte *progcounter = &buffer[pc_offset]; \ 103 byte *progcounter = &buffer[pc_offset]; \
105 char str_with_address[100]; \ 104 char str_with_address[100]; \
106 prev_instr_compact_branch = assm.IsPrevInstrCompactBranch(); \ 105 prev_instr_compact_branch = assm.IsPrevInstrCompactBranch(); \
107 if (prev_instr_compact_branch) { \ 106 if (prev_instr_compact_branch) { \
108 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ 107 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \
109 compare_string, progcounter + 8 + (offset * 4)); \ 108 compare_string, \
109 static_cast<void *>(progcounter + 8 + (offset * 4))); \
110 } else { \ 110 } else { \
111 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ 111 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \
112 compare_string, progcounter + 4 + (offset * 4)); \ 112 compare_string, \
113 static_cast<void *>(progcounter + 4 + (offset * 4))); \
113 } \ 114 } \
114 assm.asm_; \ 115 assm.asm_; \
115 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ 116 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \
116 } 117 }
117 118
118
119 #define COMPARE_PC_REL(asm_, compare_string, offset) \ 119 #define COMPARE_PC_REL(asm_, compare_string, offset) \
120 { \ 120 { \
121 int pc_offset = assm.pc_offset(); \ 121 int pc_offset = assm.pc_offset(); \
122 byte *progcounter = &buffer[pc_offset]; \ 122 byte *progcounter = &buffer[pc_offset]; \
123 char str_with_address[100]; \ 123 char str_with_address[100]; \
124 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \ 124 snprintf(str_with_address, sizeof(str_with_address), "%s -> %p", \
125 compare_string, progcounter + (offset * 4)); \ 125 compare_string, static_cast<void *>(progcounter + (offset * 4))); \
126 assm.asm_; \ 126 assm.asm_; \
127 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ 127 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \
128 } 128 }
129 129
130
131 #define COMPARE_PC_JUMP(asm_, compare_string, target) \ 130 #define COMPARE_PC_JUMP(asm_, compare_string, target) \
132 { \ 131 { \
133 int pc_offset = assm.pc_offset(); \ 132 int pc_offset = assm.pc_offset(); \
134 byte *progcounter = &buffer[pc_offset]; \ 133 byte *progcounter = &buffer[pc_offset]; \
135 char str_with_address[100]; \ 134 char str_with_address[100]; \
136 int instr_index = (target >> 2) & kImm26Mask; \ 135 int instr_index = (target >> 2) & kImm26Mask; \
137 snprintf( \ 136 snprintf( \
138 str_with_address, sizeof(str_with_address), "%s %p -> %p", \ 137 str_with_address, sizeof(str_with_address), "%s %p -> %p", \
139 compare_string, reinterpret_cast<byte *>(target), \ 138 compare_string, reinterpret_cast<void *>(target), \
140 reinterpret_cast<byte *>(((uint32_t)(progcounter + 4) & ~0xfffffff) | \ 139 reinterpret_cast<void *>(((uint32_t)(progcounter + 4) & ~0xfffffff) | \
141 (instr_index << 2))); \ 140 (instr_index << 2))); \
142 assm.asm_; \ 141 assm.asm_; \
143 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \ 142 if (!DisassembleAndCompare(progcounter, str_with_address)) failure = true; \
144 } 143 }
145 144
146
147 #define GET_PC_REGION(pc_region) \ 145 #define GET_PC_REGION(pc_region) \
148 { \ 146 { \
149 int pc_offset = assm.pc_offset(); \ 147 int pc_offset = assm.pc_offset(); \
150 byte *progcounter = &buffer[pc_offset]; \ 148 byte *progcounter = &buffer[pc_offset]; \
151 pc_region = reinterpret_cast<int32_t>(progcounter + 4) & ~0xfffffff; \ 149 pc_region = reinterpret_cast<int32_t>(progcounter + 4) & ~0xfffffff; \
152 } 150 }
153 151
154 152
155 TEST(Type0) { 153 TEST(Type0) {
156 SET_UP(); 154 SET_UP();
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1069
1072 1070
1073 TEST(ctc1_cfc1_disasm) { 1071 TEST(ctc1_cfc1_disasm) {
1074 SET_UP(); 1072 SET_UP();
1075 COMPARE(abs_d(f10, f31), "4620fa85 abs.d f10, f31"); 1073 COMPARE(abs_d(f10, f31), "4620fa85 abs.d f10, f31");
1076 COMPARE(ceil_w_s(f8, f31), "4600fa0e ceil.w.s f8, f31"); 1074 COMPARE(ceil_w_s(f8, f31), "4600fa0e ceil.w.s f8, f31");
1077 COMPARE(ctc1(a0, FCSR), "44c4f800 ctc1 a0, FCSR"); 1075 COMPARE(ctc1(a0, FCSR), "44c4f800 ctc1 a0, FCSR");
1078 COMPARE(cfc1(a0, FCSR), "4444f800 cfc1 a0, FCSR"); 1076 COMPARE(cfc1(a0, FCSR), "4444f800 cfc1 a0, FCSR");
1079 VERIFY_RUN(); 1077 VERIFY_RUN();
1080 } 1078 }
OLDNEW
« no previous file with comments | « src/x87/disasm-x87.cc ('k') | test/cctest/test-disasm-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698