| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #ifndef V8_A64_DECODER_A64_INL_H_ |
| 29 #define V8_A64_DECODER_A64_INL_H_ |
| 29 | 30 |
| 30 #if V8_TARGET_ARCH_A64 | 31 #include "a64/decoder-a64.h" |
| 31 | |
| 32 #include "globals.h" | 32 #include "globals.h" |
| 33 #include "utils.h" | 33 #include "utils.h" |
| 34 #include "a64/decoder-a64.h" | |
| 35 | 34 |
| 36 | 35 |
| 37 namespace v8 { | 36 namespace v8 { |
| 38 namespace internal { | 37 namespace internal { |
| 39 | 38 |
| 40 | 39 |
| 41 void DispatchingDecoderVisitor::AppendVisitor(DecoderVisitor* new_visitor) { | |
| 42 visitors_.remove(new_visitor); | |
| 43 visitors_.push_front(new_visitor); | |
| 44 } | |
| 45 | |
| 46 | |
| 47 void DispatchingDecoderVisitor::PrependVisitor(DecoderVisitor* new_visitor) { | |
| 48 visitors_.remove(new_visitor); | |
| 49 visitors_.push_back(new_visitor); | |
| 50 } | |
| 51 | |
| 52 | |
| 53 void DispatchingDecoderVisitor::InsertVisitorBefore( | |
| 54 DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) { | |
| 55 visitors_.remove(new_visitor); | |
| 56 std::list<DecoderVisitor*>::iterator it; | |
| 57 for (it = visitors_.begin(); it != visitors_.end(); it++) { | |
| 58 if (*it == registered_visitor) { | |
| 59 visitors_.insert(it, new_visitor); | |
| 60 return; | |
| 61 } | |
| 62 } | |
| 63 // We reached the end of the list. The last element must be | |
| 64 // registered_visitor. | |
| 65 ASSERT(*it == registered_visitor); | |
| 66 visitors_.insert(it, new_visitor); | |
| 67 } | |
| 68 | |
| 69 | |
| 70 void DispatchingDecoderVisitor::InsertVisitorAfter( | |
| 71 DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) { | |
| 72 visitors_.remove(new_visitor); | |
| 73 std::list<DecoderVisitor*>::iterator it; | |
| 74 for (it = visitors_.begin(); it != visitors_.end(); it++) { | |
| 75 if (*it == registered_visitor) { | |
| 76 it++; | |
| 77 visitors_.insert(it, new_visitor); | |
| 78 return; | |
| 79 } | |
| 80 } | |
| 81 // We reached the end of the list. The last element must be | |
| 82 // registered_visitor. | |
| 83 ASSERT(*it == registered_visitor); | |
| 84 visitors_.push_back(new_visitor); | |
| 85 } | |
| 86 | |
| 87 | |
| 88 void DispatchingDecoderVisitor::RemoveVisitor(DecoderVisitor* visitor) { | |
| 89 visitors_.remove(visitor); | |
| 90 } | |
| 91 | |
| 92 | |
| 93 #define DEFINE_VISITOR_CALLERS(A) \ | |
| 94 void DispatchingDecoderVisitor::Visit##A(Instruction* instr) { \ | |
| 95 if (!(instr->Mask(A##FMask) == A##Fixed)) { \ | |
| 96 ASSERT(instr->Mask(A##FMask) == A##Fixed); \ | |
| 97 } \ | |
| 98 std::list<DecoderVisitor*>::iterator it; \ | |
| 99 for (it = visitors_.begin(); it != visitors_.end(); it++) { \ | |
| 100 (*it)->Visit##A(instr); \ | |
| 101 } \ | |
| 102 } | |
| 103 VISITOR_LIST(DEFINE_VISITOR_CALLERS) | |
| 104 #undef DEFINE_VISITOR_CALLERS | |
| 105 | |
| 106 | |
| 107 // Top-level instruction decode function. | 40 // Top-level instruction decode function. |
| 108 void Decoder::Decode(Instruction *instr) { | 41 template<typename V> |
| 42 void Decoder<V>::Decode(Instruction *instr) { |
| 109 if (instr->Bits(28, 27) == 0) { | 43 if (instr->Bits(28, 27) == 0) { |
| 110 VisitUnallocated(instr); | 44 V::VisitUnallocated(instr); |
| 111 } else { | 45 } else { |
| 112 switch (instr->Bits(27, 24)) { | 46 switch (instr->Bits(27, 24)) { |
| 113 // 0: PC relative addressing. | 47 // 0: PC relative addressing. |
| 114 case 0x0: DecodePCRelAddressing(instr); break; | 48 case 0x0: DecodePCRelAddressing(instr); break; |
| 115 | 49 |
| 116 // 1: Add/sub immediate. | 50 // 1: Add/sub immediate. |
| 117 case 0x1: DecodeAddSubImmediate(instr); break; | 51 case 0x1: DecodeAddSubImmediate(instr); break; |
| 118 | 52 |
| 119 // A: Logical shifted register. | 53 // A: Logical shifted register. |
| 120 // Add/sub with carry. | 54 // Add/sub with carry. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Advanced SIMD. | 110 // Advanced SIMD. |
| 177 // F: FP data processing 3 source. | 111 // F: FP data processing 3 source. |
| 178 // Advanced SIMD. | 112 // Advanced SIMD. |
| 179 case 0xE: | 113 case 0xE: |
| 180 case 0xF: DecodeFP(instr); break; | 114 case 0xF: DecodeFP(instr); break; |
| 181 } | 115 } |
| 182 } | 116 } |
| 183 } | 117 } |
| 184 | 118 |
| 185 | 119 |
| 186 void Decoder::DecodePCRelAddressing(Instruction* instr) { | 120 template<typename V> |
| 121 void Decoder<V>::DecodePCRelAddressing(Instruction* instr) { |
| 187 ASSERT(instr->Bits(27, 24) == 0x0); | 122 ASSERT(instr->Bits(27, 24) == 0x0); |
| 188 // We know bit 28 is set, as <b28:b27> = 0 is filtered out at the top level | 123 // We know bit 28 is set, as <b28:b27> = 0 is filtered out at the top level |
| 189 // decode. | 124 // decode. |
| 190 ASSERT(instr->Bit(28) == 0x1); | 125 ASSERT(instr->Bit(28) == 0x1); |
| 191 VisitPCRelAddressing(instr); | 126 V::VisitPCRelAddressing(instr); |
| 192 } | 127 } |
| 193 | 128 |
| 194 | 129 |
| 195 void Decoder::DecodeBranchSystemException(Instruction* instr) { | 130 template<typename V> |
| 131 void Decoder<V>::DecodeBranchSystemException(Instruction* instr) { |
| 196 ASSERT((instr->Bits(27, 24) == 0x4) || | 132 ASSERT((instr->Bits(27, 24) == 0x4) || |
| 197 (instr->Bits(27, 24) == 0x5) || | 133 (instr->Bits(27, 24) == 0x5) || |
| 198 (instr->Bits(27, 24) == 0x6) || | 134 (instr->Bits(27, 24) == 0x6) || |
| 199 (instr->Bits(27, 24) == 0x7) ); | 135 (instr->Bits(27, 24) == 0x7) ); |
| 200 | 136 |
| 201 switch (instr->Bits(31, 29)) { | 137 switch (instr->Bits(31, 29)) { |
| 202 case 0: | 138 case 0: |
| 203 case 4: { | 139 case 4: { |
| 204 VisitUnconditionalBranch(instr); | 140 V::VisitUnconditionalBranch(instr); |
| 205 break; | 141 break; |
| 206 } | 142 } |
| 207 case 1: | 143 case 1: |
| 208 case 5: { | 144 case 5: { |
| 209 if (instr->Bit(25) == 0) { | 145 if (instr->Bit(25) == 0) { |
| 210 VisitCompareBranch(instr); | 146 V::VisitCompareBranch(instr); |
| 211 } else { | 147 } else { |
| 212 VisitTestBranch(instr); | 148 V::VisitTestBranch(instr); |
| 213 } | 149 } |
| 214 break; | 150 break; |
| 215 } | 151 } |
| 216 case 2: { | 152 case 2: { |
| 217 if (instr->Bit(25) == 0) { | 153 if (instr->Bit(25) == 0) { |
| 218 if ((instr->Bit(24) == 0x1) || | 154 if ((instr->Bit(24) == 0x1) || |
| 219 (instr->Mask(0x01000010) == 0x00000010)) { | 155 (instr->Mask(0x01000010) == 0x00000010)) { |
| 220 VisitUnallocated(instr); | 156 V::VisitUnallocated(instr); |
| 221 } else { | 157 } else { |
| 222 VisitConditionalBranch(instr); | 158 V::VisitConditionalBranch(instr); |
| 223 } | 159 } |
| 224 } else { | 160 } else { |
| 225 VisitUnallocated(instr); | 161 V::VisitUnallocated(instr); |
| 226 } | 162 } |
| 227 break; | 163 break; |
| 228 } | 164 } |
| 229 case 6: { | 165 case 6: { |
| 230 if (instr->Bit(25) == 0) { | 166 if (instr->Bit(25) == 0) { |
| 231 if (instr->Bit(24) == 0) { | 167 if (instr->Bit(24) == 0) { |
| 232 if ((instr->Bits(4, 2) != 0) || | 168 if ((instr->Bits(4, 2) != 0) || |
| 233 (instr->Mask(0x00E0001D) == 0x00200001) || | 169 (instr->Mask(0x00E0001D) == 0x00200001) || |
| 234 (instr->Mask(0x00E0001D) == 0x00400001) || | 170 (instr->Mask(0x00E0001D) == 0x00400001) || |
| 235 (instr->Mask(0x00E0001E) == 0x00200002) || | 171 (instr->Mask(0x00E0001E) == 0x00200002) || |
| 236 (instr->Mask(0x00E0001E) == 0x00400002) || | 172 (instr->Mask(0x00E0001E) == 0x00400002) || |
| 237 (instr->Mask(0x00E0001C) == 0x00600000) || | 173 (instr->Mask(0x00E0001C) == 0x00600000) || |
| 238 (instr->Mask(0x00E0001C) == 0x00800000) || | 174 (instr->Mask(0x00E0001C) == 0x00800000) || |
| 239 (instr->Mask(0x00E0001F) == 0x00A00000) || | 175 (instr->Mask(0x00E0001F) == 0x00A00000) || |
| 240 (instr->Mask(0x00C0001C) == 0x00C00000)) { | 176 (instr->Mask(0x00C0001C) == 0x00C00000)) { |
| 241 VisitUnallocated(instr); | 177 V::VisitUnallocated(instr); |
| 242 } else { | 178 } else { |
| 243 VisitException(instr); | 179 V::VisitException(instr); |
| 244 } | 180 } |
| 245 } else { | 181 } else { |
| 246 if (instr->Bits(23, 22) == 0) { | 182 if (instr->Bits(23, 22) == 0) { |
| 247 const Instr masked_003FF0E0 = instr->Mask(0x003FF0E0); | 183 const Instr masked_003FF0E0 = instr->Mask(0x003FF0E0); |
| 248 if ((instr->Bits(21, 19) == 0x4) || | 184 if ((instr->Bits(21, 19) == 0x4) || |
| 249 (masked_003FF0E0 == 0x00033000) || | 185 (masked_003FF0E0 == 0x00033000) || |
| 250 (masked_003FF0E0 == 0x003FF020) || | 186 (masked_003FF0E0 == 0x003FF020) || |
| 251 (masked_003FF0E0 == 0x003FF060) || | 187 (masked_003FF0E0 == 0x003FF060) || |
| 252 (masked_003FF0E0 == 0x003FF0E0) || | 188 (masked_003FF0E0 == 0x003FF0E0) || |
| 253 (instr->Mask(0x00388000) == 0x00008000) || | 189 (instr->Mask(0x00388000) == 0x00008000) || |
| 254 (instr->Mask(0x0038E000) == 0x00000000) || | 190 (instr->Mask(0x0038E000) == 0x00000000) || |
| 255 (instr->Mask(0x0039E000) == 0x00002000) || | 191 (instr->Mask(0x0039E000) == 0x00002000) || |
| 256 (instr->Mask(0x003AE000) == 0x00002000) || | 192 (instr->Mask(0x003AE000) == 0x00002000) || |
| 257 (instr->Mask(0x003CE000) == 0x00042000) || | 193 (instr->Mask(0x003CE000) == 0x00042000) || |
| 258 (instr->Mask(0x003FFFC0) == 0x000320C0) || | 194 (instr->Mask(0x003FFFC0) == 0x000320C0) || |
| 259 (instr->Mask(0x003FF100) == 0x00032100) || | 195 (instr->Mask(0x003FF100) == 0x00032100) || |
| 260 (instr->Mask(0x003FF200) == 0x00032200) || | 196 (instr->Mask(0x003FF200) == 0x00032200) || |
| 261 (instr->Mask(0x003FF400) == 0x00032400) || | 197 (instr->Mask(0x003FF400) == 0x00032400) || |
| 262 (instr->Mask(0x003FF800) == 0x00032800) || | 198 (instr->Mask(0x003FF800) == 0x00032800) || |
| 263 (instr->Mask(0x0038F000) == 0x00005000) || | 199 (instr->Mask(0x0038F000) == 0x00005000) || |
| 264 (instr->Mask(0x0038E000) == 0x00006000)) { | 200 (instr->Mask(0x0038E000) == 0x00006000)) { |
| 265 VisitUnallocated(instr); | 201 V::VisitUnallocated(instr); |
| 266 } else { | 202 } else { |
| 267 VisitSystem(instr); | 203 V::VisitSystem(instr); |
| 268 } | 204 } |
| 269 } else { | 205 } else { |
| 270 VisitUnallocated(instr); | 206 V::VisitUnallocated(instr); |
| 271 } | 207 } |
| 272 } | 208 } |
| 273 } else { | 209 } else { |
| 274 if ((instr->Bit(24) == 0x1) || | 210 if ((instr->Bit(24) == 0x1) || |
| 275 (instr->Bits(20, 16) != 0x1F) || | 211 (instr->Bits(20, 16) != 0x1F) || |
| 276 (instr->Bits(15, 10) != 0) || | 212 (instr->Bits(15, 10) != 0) || |
| 277 (instr->Bits(4, 0) != 0) || | 213 (instr->Bits(4, 0) != 0) || |
| 278 (instr->Bits(24, 21) == 0x3) || | 214 (instr->Bits(24, 21) == 0x3) || |
| 279 (instr->Bits(24, 22) == 0x3)) { | 215 (instr->Bits(24, 22) == 0x3)) { |
| 280 VisitUnallocated(instr); | 216 V::VisitUnallocated(instr); |
| 281 } else { | 217 } else { |
| 282 VisitUnconditionalBranchToRegister(instr); | 218 V::VisitUnconditionalBranchToRegister(instr); |
| 283 } | 219 } |
| 284 } | 220 } |
| 285 break; | 221 break; |
| 286 } | 222 } |
| 287 case 3: | 223 case 3: |
| 288 case 7: { | 224 case 7: { |
| 289 VisitUnallocated(instr); | 225 V::VisitUnallocated(instr); |
| 290 break; | 226 break; |
| 291 } | 227 } |
| 292 } | 228 } |
| 293 } | 229 } |
| 294 | 230 |
| 295 | 231 |
| 296 void Decoder::DecodeLoadStore(Instruction* instr) { | 232 template<typename V> |
| 233 void Decoder<V>::DecodeLoadStore(Instruction* instr) { |
| 297 ASSERT((instr->Bits(27, 24) == 0x8) || | 234 ASSERT((instr->Bits(27, 24) == 0x8) || |
| 298 (instr->Bits(27, 24) == 0x9) || | 235 (instr->Bits(27, 24) == 0x9) || |
| 299 (instr->Bits(27, 24) == 0xC) || | 236 (instr->Bits(27, 24) == 0xC) || |
| 300 (instr->Bits(27, 24) == 0xD) ); | 237 (instr->Bits(27, 24) == 0xD) ); |
| 301 | 238 |
| 302 if (instr->Bit(24) == 0) { | 239 if (instr->Bit(24) == 0) { |
| 303 if (instr->Bit(28) == 0) { | 240 if (instr->Bit(28) == 0) { |
| 304 if (instr->Bit(29) == 0) { | 241 if (instr->Bit(29) == 0) { |
| 305 if (instr->Bit(26) == 0) { | 242 if (instr->Bit(26) == 0) { |
| 306 // TODO(all): VisitLoadStoreExclusive. | 243 // TODO(all): VisitLoadStoreExclusive. |
| 307 VisitUnimplemented(instr); | 244 V::VisitUnimplemented(instr); |
| 308 } else { | 245 } else { |
| 309 DecodeAdvSIMDLoadStore(instr); | 246 DecodeAdvSIMDLoadStore(instr); |
| 310 } | 247 } |
| 311 } else { | 248 } else { |
| 312 if ((instr->Bits(31, 30) == 0x3) || | 249 if ((instr->Bits(31, 30) == 0x3) || |
| 313 (instr->Mask(0xC4400000) == 0x40000000)) { | 250 (instr->Mask(0xC4400000) == 0x40000000)) { |
| 314 VisitUnallocated(instr); | 251 V::VisitUnallocated(instr); |
| 315 } else { | 252 } else { |
| 316 if (instr->Bit(23) == 0) { | 253 if (instr->Bit(23) == 0) { |
| 317 if (instr->Mask(0xC4400000) == 0xC0400000) { | 254 if (instr->Mask(0xC4400000) == 0xC0400000) { |
| 318 VisitUnallocated(instr); | 255 V::VisitUnallocated(instr); |
| 319 } else { | 256 } else { |
| 320 VisitLoadStorePairNonTemporal(instr); | 257 V::VisitLoadStorePairNonTemporal(instr); |
| 321 } | 258 } |
| 322 } else { | 259 } else { |
| 323 VisitLoadStorePairPostIndex(instr); | 260 V::VisitLoadStorePairPostIndex(instr); |
| 324 } | 261 } |
| 325 } | 262 } |
| 326 } | 263 } |
| 327 } else { | 264 } else { |
| 328 if (instr->Bit(29) == 0) { | 265 if (instr->Bit(29) == 0) { |
| 329 if (instr->Mask(0xC4000000) == 0xC4000000) { | 266 if (instr->Mask(0xC4000000) == 0xC4000000) { |
| 330 VisitUnallocated(instr); | 267 V::VisitUnallocated(instr); |
| 331 } else { | 268 } else { |
| 332 VisitLoadLiteral(instr); | 269 V::VisitLoadLiteral(instr); |
| 333 } | 270 } |
| 334 } else { | 271 } else { |
| 335 if ((instr->Mask(0x84C00000) == 0x80C00000) || | 272 if ((instr->Mask(0x84C00000) == 0x80C00000) || |
| 336 (instr->Mask(0x44800000) == 0x44800000) || | 273 (instr->Mask(0x44800000) == 0x44800000) || |
| 337 (instr->Mask(0x84800000) == 0x84800000)) { | 274 (instr->Mask(0x84800000) == 0x84800000)) { |
| 338 VisitUnallocated(instr); | 275 V::VisitUnallocated(instr); |
| 339 } else { | 276 } else { |
| 340 if (instr->Bit(21) == 0) { | 277 if (instr->Bit(21) == 0) { |
| 341 switch (instr->Bits(11, 10)) { | 278 switch (instr->Bits(11, 10)) { |
| 342 case 0: { | 279 case 0: { |
| 343 VisitLoadStoreUnscaledOffset(instr); | 280 V::VisitLoadStoreUnscaledOffset(instr); |
| 344 break; | 281 break; |
| 345 } | 282 } |
| 346 case 1: { | 283 case 1: { |
| 347 if (instr->Mask(0xC4C00000) == 0xC0800000) { | 284 if (instr->Mask(0xC4C00000) == 0xC0800000) { |
| 348 VisitUnallocated(instr); | 285 V::VisitUnallocated(instr); |
| 349 } else { | 286 } else { |
| 350 VisitLoadStorePostIndex(instr); | 287 V::VisitLoadStorePostIndex(instr); |
| 351 } | 288 } |
| 352 break; | 289 break; |
| 353 } | 290 } |
| 354 case 2: { | 291 case 2: { |
| 355 // TODO(all): VisitLoadStoreRegisterOffsetUnpriv. | 292 // TODO(all): VisitLoadStoreRegisterOffsetUnpriv. |
| 356 VisitUnimplemented(instr); | 293 V::VisitUnimplemented(instr); |
| 357 break; | 294 break; |
| 358 } | 295 } |
| 359 case 3: { | 296 case 3: { |
| 360 if (instr->Mask(0xC4C00000) == 0xC0800000) { | 297 if (instr->Mask(0xC4C00000) == 0xC0800000) { |
| 361 VisitUnallocated(instr); | 298 V::VisitUnallocated(instr); |
| 362 } else { | 299 } else { |
| 363 VisitLoadStorePreIndex(instr); | 300 V::VisitLoadStorePreIndex(instr); |
| 364 } | 301 } |
| 365 break; | 302 break; |
| 366 } | 303 } |
| 367 } | 304 } |
| 368 } else { | 305 } else { |
| 369 if (instr->Bits(11, 10) == 0x2) { | 306 if (instr->Bits(11, 10) == 0x2) { |
| 370 if (instr->Bit(14) == 0) { | 307 if (instr->Bit(14) == 0) { |
| 371 VisitUnallocated(instr); | 308 V::VisitUnallocated(instr); |
| 372 } else { | 309 } else { |
| 373 VisitLoadStoreRegisterOffset(instr); | 310 V::VisitLoadStoreRegisterOffset(instr); |
| 374 } | 311 } |
| 375 } else { | 312 } else { |
| 376 VisitUnallocated(instr); | 313 V::VisitUnallocated(instr); |
| 377 } | 314 } |
| 378 } | 315 } |
| 379 } | 316 } |
| 380 } | 317 } |
| 381 } | 318 } |
| 382 } else { | 319 } else { |
| 383 if (instr->Bit(28) == 0) { | 320 if (instr->Bit(28) == 0) { |
| 384 if (instr->Bit(29) == 0) { | 321 if (instr->Bit(29) == 0) { |
| 385 VisitUnallocated(instr); | 322 V::VisitUnallocated(instr); |
| 386 } else { | 323 } else { |
| 387 if ((instr->Bits(31, 30) == 0x3) || | 324 if ((instr->Bits(31, 30) == 0x3) || |
| 388 (instr->Mask(0xC4400000) == 0x40000000)) { | 325 (instr->Mask(0xC4400000) == 0x40000000)) { |
| 389 VisitUnallocated(instr); | 326 V::VisitUnallocated(instr); |
| 390 } else { | 327 } else { |
| 391 if (instr->Bit(23) == 0) { | 328 if (instr->Bit(23) == 0) { |
| 392 VisitLoadStorePairOffset(instr); | 329 V::VisitLoadStorePairOffset(instr); |
| 393 } else { | 330 } else { |
| 394 VisitLoadStorePairPreIndex(instr); | 331 V::VisitLoadStorePairPreIndex(instr); |
| 395 } | 332 } |
| 396 } | 333 } |
| 397 } | 334 } |
| 398 } else { | 335 } else { |
| 399 if (instr->Bit(29) == 0) { | 336 if (instr->Bit(29) == 0) { |
| 400 VisitUnallocated(instr); | 337 V::VisitUnallocated(instr); |
| 401 } else { | 338 } else { |
| 402 if ((instr->Mask(0x84C00000) == 0x80C00000) || | 339 if ((instr->Mask(0x84C00000) == 0x80C00000) || |
| 403 (instr->Mask(0x44800000) == 0x44800000) || | 340 (instr->Mask(0x44800000) == 0x44800000) || |
| 404 (instr->Mask(0x84800000) == 0x84800000)) { | 341 (instr->Mask(0x84800000) == 0x84800000)) { |
| 405 VisitUnallocated(instr); | 342 V::VisitUnallocated(instr); |
| 406 } else { | 343 } else { |
| 407 VisitLoadStoreUnsignedOffset(instr); | 344 V::VisitLoadStoreUnsignedOffset(instr); |
| 408 } | 345 } |
| 409 } | 346 } |
| 410 } | 347 } |
| 411 } | 348 } |
| 412 } | 349 } |
| 413 | 350 |
| 414 | 351 |
| 415 void Decoder::DecodeLogical(Instruction* instr) { | 352 template<typename V> |
| 353 void Decoder<V>::DecodeLogical(Instruction* instr) { |
| 416 ASSERT(instr->Bits(27, 24) == 0x2); | 354 ASSERT(instr->Bits(27, 24) == 0x2); |
| 417 | 355 |
| 418 if (instr->Mask(0x80400000) == 0x00400000) { | 356 if (instr->Mask(0x80400000) == 0x00400000) { |
| 419 VisitUnallocated(instr); | 357 V::VisitUnallocated(instr); |
| 420 } else { | 358 } else { |
| 421 if (instr->Bit(23) == 0) { | 359 if (instr->Bit(23) == 0) { |
| 422 VisitLogicalImmediate(instr); | 360 V::VisitLogicalImmediate(instr); |
| 423 } else { | 361 } else { |
| 424 if (instr->Bits(30, 29) == 0x1) { | 362 if (instr->Bits(30, 29) == 0x1) { |
| 425 VisitUnallocated(instr); | 363 V::VisitUnallocated(instr); |
| 426 } else { | 364 } else { |
| 427 VisitMoveWideImmediate(instr); | 365 V::VisitMoveWideImmediate(instr); |
| 428 } | 366 } |
| 429 } | 367 } |
| 430 } | 368 } |
| 431 } | 369 } |
| 432 | 370 |
| 433 | 371 |
| 434 void Decoder::DecodeBitfieldExtract(Instruction* instr) { | 372 template<typename V> |
| 373 void Decoder<V>::DecodeBitfieldExtract(Instruction* instr) { |
| 435 ASSERT(instr->Bits(27, 24) == 0x3); | 374 ASSERT(instr->Bits(27, 24) == 0x3); |
| 436 | 375 |
| 437 if ((instr->Mask(0x80400000) == 0x80000000) || | 376 if ((instr->Mask(0x80400000) == 0x80000000) || |
| 438 (instr->Mask(0x80400000) == 0x00400000) || | 377 (instr->Mask(0x80400000) == 0x00400000) || |
| 439 (instr->Mask(0x80008000) == 0x00008000)) { | 378 (instr->Mask(0x80008000) == 0x00008000)) { |
| 440 VisitUnallocated(instr); | 379 V::VisitUnallocated(instr); |
| 441 } else if (instr->Bit(23) == 0) { | 380 } else if (instr->Bit(23) == 0) { |
| 442 if ((instr->Mask(0x80200000) == 0x00200000) || | 381 if ((instr->Mask(0x80200000) == 0x00200000) || |
| 443 (instr->Mask(0x60000000) == 0x60000000)) { | 382 (instr->Mask(0x60000000) == 0x60000000)) { |
| 444 VisitUnallocated(instr); | 383 V::VisitUnallocated(instr); |
| 445 } else { | 384 } else { |
| 446 VisitBitfield(instr); | 385 V::VisitBitfield(instr); |
| 447 } | 386 } |
| 448 } else { | 387 } else { |
| 449 if ((instr->Mask(0x60200000) == 0x00200000) || | 388 if ((instr->Mask(0x60200000) == 0x00200000) || |
| 450 (instr->Mask(0x60000000) != 0x00000000)) { | 389 (instr->Mask(0x60000000) != 0x00000000)) { |
| 451 VisitUnallocated(instr); | 390 V::VisitUnallocated(instr); |
| 452 } else { | 391 } else { |
| 453 VisitExtract(instr); | 392 V::VisitExtract(instr); |
| 454 } | 393 } |
| 455 } | 394 } |
| 456 } | 395 } |
| 457 | 396 |
| 458 | 397 |
| 459 void Decoder::DecodeAddSubImmediate(Instruction* instr) { | 398 template<typename V> |
| 399 void Decoder<V>::DecodeAddSubImmediate(Instruction* instr) { |
| 460 ASSERT(instr->Bits(27, 24) == 0x1); | 400 ASSERT(instr->Bits(27, 24) == 0x1); |
| 461 if (instr->Bit(23) == 1) { | 401 if (instr->Bit(23) == 1) { |
| 462 VisitUnallocated(instr); | 402 V::VisitUnallocated(instr); |
| 463 } else { | 403 } else { |
| 464 VisitAddSubImmediate(instr); | 404 V::VisitAddSubImmediate(instr); |
| 465 } | 405 } |
| 466 } | 406 } |
| 467 | 407 |
| 468 | 408 |
| 469 void Decoder::DecodeDataProcessing(Instruction* instr) { | 409 template<typename V> |
| 410 void Decoder<V>::DecodeDataProcessing(Instruction* instr) { |
| 470 ASSERT((instr->Bits(27, 24) == 0xA) || | 411 ASSERT((instr->Bits(27, 24) == 0xA) || |
| 471 (instr->Bits(27, 24) == 0xB) ); | 412 (instr->Bits(27, 24) == 0xB) ); |
| 472 | 413 |
| 473 if (instr->Bit(24) == 0) { | 414 if (instr->Bit(24) == 0) { |
| 474 if (instr->Bit(28) == 0) { | 415 if (instr->Bit(28) == 0) { |
| 475 if (instr->Mask(0x80008000) == 0x00008000) { | 416 if (instr->Mask(0x80008000) == 0x00008000) { |
| 476 VisitUnallocated(instr); | 417 V::VisitUnallocated(instr); |
| 477 } else { | 418 } else { |
| 478 VisitLogicalShifted(instr); | 419 V::VisitLogicalShifted(instr); |
| 479 } | 420 } |
| 480 } else { | 421 } else { |
| 481 switch (instr->Bits(23, 21)) { | 422 switch (instr->Bits(23, 21)) { |
| 482 case 0: { | 423 case 0: { |
| 483 if (instr->Mask(0x0000FC00) != 0) { | 424 if (instr->Mask(0x0000FC00) != 0) { |
| 484 VisitUnallocated(instr); | 425 V::VisitUnallocated(instr); |
| 485 } else { | 426 } else { |
| 486 VisitAddSubWithCarry(instr); | 427 V::VisitAddSubWithCarry(instr); |
| 487 } | 428 } |
| 488 break; | 429 break; |
| 489 } | 430 } |
| 490 case 2: { | 431 case 2: { |
| 491 if ((instr->Bit(29) == 0) || | 432 if ((instr->Bit(29) == 0) || |
| 492 (instr->Mask(0x00000410) != 0)) { | 433 (instr->Mask(0x00000410) != 0)) { |
| 493 VisitUnallocated(instr); | 434 V::VisitUnallocated(instr); |
| 494 } else { | 435 } else { |
| 495 if (instr->Bit(11) == 0) { | 436 if (instr->Bit(11) == 0) { |
| 496 VisitConditionalCompareRegister(instr); | 437 V::VisitConditionalCompareRegister(instr); |
| 497 } else { | 438 } else { |
| 498 VisitConditionalCompareImmediate(instr); | 439 V::VisitConditionalCompareImmediate(instr); |
| 499 } | 440 } |
| 500 } | 441 } |
| 501 break; | 442 break; |
| 502 } | 443 } |
| 503 case 4: { | 444 case 4: { |
| 504 if (instr->Mask(0x20000800) != 0x00000000) { | 445 if (instr->Mask(0x20000800) != 0x00000000) { |
| 505 VisitUnallocated(instr); | 446 V::VisitUnallocated(instr); |
| 506 } else { | 447 } else { |
| 507 VisitConditionalSelect(instr); | 448 V::VisitConditionalSelect(instr); |
| 508 } | 449 } |
| 509 break; | 450 break; |
| 510 } | 451 } |
| 511 case 6: { | 452 case 6: { |
| 512 if (instr->Bit(29) == 0x1) { | 453 if (instr->Bit(29) == 0x1) { |
| 513 VisitUnallocated(instr); | 454 V::VisitUnallocated(instr); |
| 514 } else { | 455 } else { |
| 515 if (instr->Bit(30) == 0) { | 456 if (instr->Bit(30) == 0) { |
| 516 if ((instr->Bit(15) == 0x1) || | 457 if ((instr->Bit(15) == 0x1) || |
| 517 (instr->Bits(15, 11) == 0) || | 458 (instr->Bits(15, 11) == 0) || |
| 518 (instr->Bits(15, 12) == 0x1) || | 459 (instr->Bits(15, 12) == 0x1) || |
| 519 (instr->Bits(15, 12) == 0x3) || | 460 (instr->Bits(15, 12) == 0x3) || |
| 520 (instr->Bits(15, 13) == 0x3) || | 461 (instr->Bits(15, 13) == 0x3) || |
| 521 (instr->Mask(0x8000EC00) == 0x00004C00) || | 462 (instr->Mask(0x8000EC00) == 0x00004C00) || |
| 522 (instr->Mask(0x8000E800) == 0x80004000) || | 463 (instr->Mask(0x8000E800) == 0x80004000) || |
| 523 (instr->Mask(0x8000E400) == 0x80004000)) { | 464 (instr->Mask(0x8000E400) == 0x80004000)) { |
| 524 VisitUnallocated(instr); | 465 V::VisitUnallocated(instr); |
| 525 } else { | 466 } else { |
| 526 VisitDataProcessing2Source(instr); | 467 V::VisitDataProcessing2Source(instr); |
| 527 } | 468 } |
| 528 } else { | 469 } else { |
| 529 if ((instr->Bit(13) == 1) || | 470 if ((instr->Bit(13) == 1) || |
| 530 (instr->Bits(20, 16) != 0) || | 471 (instr->Bits(20, 16) != 0) || |
| 531 (instr->Bits(15, 14) != 0) || | 472 (instr->Bits(15, 14) != 0) || |
| 532 (instr->Mask(0xA01FFC00) == 0x00000C00) || | 473 (instr->Mask(0xA01FFC00) == 0x00000C00) || |
| 533 (instr->Mask(0x201FF800) == 0x00001800)) { | 474 (instr->Mask(0x201FF800) == 0x00001800)) { |
| 534 VisitUnallocated(instr); | 475 V::VisitUnallocated(instr); |
| 535 } else { | 476 } else { |
| 536 VisitDataProcessing1Source(instr); | 477 V::VisitDataProcessing1Source(instr); |
| 537 } | 478 } |
| 538 } | 479 } |
| 539 break; | 480 break; |
| 540 } | 481 } |
| 541 } | 482 } |
| 542 case 1: | 483 case 1: |
| 543 case 3: | 484 case 3: |
| 544 case 5: | 485 case 5: |
| 545 case 7: VisitUnallocated(instr); break; | 486 case 7: V::VisitUnallocated(instr); break; |
| 546 } | 487 } |
| 547 } | 488 } |
| 548 } else { | 489 } else { |
| 549 if (instr->Bit(28) == 0) { | 490 if (instr->Bit(28) == 0) { |
| 550 if (instr->Bit(21) == 0) { | 491 if (instr->Bit(21) == 0) { |
| 551 if ((instr->Bits(23, 22) == 0x3) || | 492 if ((instr->Bits(23, 22) == 0x3) || |
| 552 (instr->Mask(0x80008000) == 0x00008000)) { | 493 (instr->Mask(0x80008000) == 0x00008000)) { |
| 553 VisitUnallocated(instr); | 494 V::VisitUnallocated(instr); |
| 554 } else { | 495 } else { |
| 555 VisitAddSubShifted(instr); | 496 V::VisitAddSubShifted(instr); |
| 556 } | 497 } |
| 557 } else { | 498 } else { |
| 558 if ((instr->Mask(0x00C00000) != 0x00000000) || | 499 if ((instr->Mask(0x00C00000) != 0x00000000) || |
| 559 (instr->Mask(0x00001400) == 0x00001400) || | 500 (instr->Mask(0x00001400) == 0x00001400) || |
| 560 (instr->Mask(0x00001800) == 0x00001800)) { | 501 (instr->Mask(0x00001800) == 0x00001800)) { |
| 561 VisitUnallocated(instr); | 502 V::VisitUnallocated(instr); |
| 562 } else { | 503 } else { |
| 563 VisitAddSubExtended(instr); | 504 V::VisitAddSubExtended(instr); |
| 564 } | 505 } |
| 565 } | 506 } |
| 566 } else { | 507 } else { |
| 567 if ((instr->Bit(30) == 0x1) || | 508 if ((instr->Bit(30) == 0x1) || |
| 568 (instr->Bits(30, 29) == 0x1) || | 509 (instr->Bits(30, 29) == 0x1) || |
| 569 (instr->Mask(0xE0600000) == 0x00200000) || | 510 (instr->Mask(0xE0600000) == 0x00200000) || |
| 570 (instr->Mask(0xE0608000) == 0x00400000) || | 511 (instr->Mask(0xE0608000) == 0x00400000) || |
| 571 (instr->Mask(0x60608000) == 0x00408000) || | 512 (instr->Mask(0x60608000) == 0x00408000) || |
| 572 (instr->Mask(0x60E00000) == 0x00E00000) || | 513 (instr->Mask(0x60E00000) == 0x00E00000) || |
| 573 (instr->Mask(0x60E00000) == 0x00800000) || | 514 (instr->Mask(0x60E00000) == 0x00800000) || |
| 574 (instr->Mask(0x60E00000) == 0x00600000)) { | 515 (instr->Mask(0x60E00000) == 0x00600000)) { |
| 575 VisitUnallocated(instr); | 516 V::VisitUnallocated(instr); |
| 576 } else { | 517 } else { |
| 577 VisitDataProcessing3Source(instr); | 518 V::VisitDataProcessing3Source(instr); |
| 578 } | 519 } |
| 579 } | 520 } |
| 580 } | 521 } |
| 581 } | 522 } |
| 582 | 523 |
| 583 | 524 |
| 584 void Decoder::DecodeFP(Instruction* instr) { | 525 template<typename V> |
| 526 void Decoder<V>::DecodeFP(Instruction* instr) { |
| 585 ASSERT((instr->Bits(27, 24) == 0xE) || | 527 ASSERT((instr->Bits(27, 24) == 0xE) || |
| 586 (instr->Bits(27, 24) == 0xF) ); | 528 (instr->Bits(27, 24) == 0xF) ); |
| 587 | 529 |
| 588 if (instr->Bit(28) == 0) { | 530 if (instr->Bit(28) == 0) { |
| 589 DecodeAdvSIMDDataProcessing(instr); | 531 DecodeAdvSIMDDataProcessing(instr); |
| 590 } else { | 532 } else { |
| 591 if (instr->Bit(29) == 1) { | 533 if (instr->Bit(29) == 1) { |
| 592 VisitUnallocated(instr); | 534 V::VisitUnallocated(instr); |
| 593 } else { | 535 } else { |
| 594 if (instr->Bits(31, 30) == 0x3) { | 536 if (instr->Bits(31, 30) == 0x3) { |
| 595 VisitUnallocated(instr); | 537 V::VisitUnallocated(instr); |
| 596 } else if (instr->Bits(31, 30) == 0x1) { | 538 } else if (instr->Bits(31, 30) == 0x1) { |
| 597 DecodeAdvSIMDDataProcessing(instr); | 539 DecodeAdvSIMDDataProcessing(instr); |
| 598 } else { | 540 } else { |
| 599 if (instr->Bit(24) == 0) { | 541 if (instr->Bit(24) == 0) { |
| 600 if (instr->Bit(21) == 0) { | 542 if (instr->Bit(21) == 0) { |
| 601 if ((instr->Bit(23) == 1) || | 543 if ((instr->Bit(23) == 1) || |
| 602 (instr->Bit(18) == 1) || | 544 (instr->Bit(18) == 1) || |
| 603 (instr->Mask(0x80008000) == 0x00000000) || | 545 (instr->Mask(0x80008000) == 0x00000000) || |
| 604 (instr->Mask(0x000E0000) == 0x00000000) || | 546 (instr->Mask(0x000E0000) == 0x00000000) || |
| 605 (instr->Mask(0x000E0000) == 0x000A0000) || | 547 (instr->Mask(0x000E0000) == 0x000A0000) || |
| 606 (instr->Mask(0x00160000) == 0x00000000) || | 548 (instr->Mask(0x00160000) == 0x00000000) || |
| 607 (instr->Mask(0x00160000) == 0x00120000)) { | 549 (instr->Mask(0x00160000) == 0x00120000)) { |
| 608 VisitUnallocated(instr); | 550 V::VisitUnallocated(instr); |
| 609 } else { | 551 } else { |
| 610 VisitFPFixedPointConvert(instr); | 552 V::VisitFPFixedPointConvert(instr); |
| 611 } | 553 } |
| 612 } else { | 554 } else { |
| 613 if (instr->Bits(15, 10) == 32) { | 555 if (instr->Bits(15, 10) == 32) { |
| 614 VisitUnallocated(instr); | 556 V::VisitUnallocated(instr); |
| 615 } else if (instr->Bits(15, 10) == 0) { | 557 } else if (instr->Bits(15, 10) == 0) { |
| 616 if ((instr->Bits(23, 22) == 0x3) || | 558 if ((instr->Bits(23, 22) == 0x3) || |
| 617 (instr->Mask(0x000E0000) == 0x000A0000) || | 559 (instr->Mask(0x000E0000) == 0x000A0000) || |
| 618 (instr->Mask(0x000E0000) == 0x000C0000) || | 560 (instr->Mask(0x000E0000) == 0x000C0000) || |
| 619 (instr->Mask(0x00160000) == 0x00120000) || | 561 (instr->Mask(0x00160000) == 0x00120000) || |
| 620 (instr->Mask(0x00160000) == 0x00140000) || | 562 (instr->Mask(0x00160000) == 0x00140000) || |
| 621 (instr->Mask(0x20C40000) == 0x00800000) || | 563 (instr->Mask(0x20C40000) == 0x00800000) || |
| 622 (instr->Mask(0x20C60000) == 0x00840000) || | 564 (instr->Mask(0x20C60000) == 0x00840000) || |
| 623 (instr->Mask(0xA0C60000) == 0x80060000) || | 565 (instr->Mask(0xA0C60000) == 0x80060000) || |
| 624 (instr->Mask(0xA0C60000) == 0x00860000) || | 566 (instr->Mask(0xA0C60000) == 0x00860000) || |
| 625 (instr->Mask(0xA0C60000) == 0x00460000) || | 567 (instr->Mask(0xA0C60000) == 0x00460000) || |
| 626 (instr->Mask(0xA0CE0000) == 0x80860000) || | 568 (instr->Mask(0xA0CE0000) == 0x80860000) || |
| 627 (instr->Mask(0xA0CE0000) == 0x804E0000) || | 569 (instr->Mask(0xA0CE0000) == 0x804E0000) || |
| 628 (instr->Mask(0xA0CE0000) == 0x000E0000) || | 570 (instr->Mask(0xA0CE0000) == 0x000E0000) || |
| 629 (instr->Mask(0xA0D60000) == 0x00160000) || | 571 (instr->Mask(0xA0D60000) == 0x00160000) || |
| 630 (instr->Mask(0xA0D60000) == 0x80560000) || | 572 (instr->Mask(0xA0D60000) == 0x80560000) || |
| 631 (instr->Mask(0xA0D60000) == 0x80960000)) { | 573 (instr->Mask(0xA0D60000) == 0x80960000)) { |
| 632 VisitUnallocated(instr); | 574 V::VisitUnallocated(instr); |
| 633 } else { | 575 } else { |
| 634 VisitFPIntegerConvert(instr); | 576 V::VisitFPIntegerConvert(instr); |
| 635 } | 577 } |
| 636 } else if (instr->Bits(14, 10) == 16) { | 578 } else if (instr->Bits(14, 10) == 16) { |
| 637 const Instr masked_A0DF8000 = instr->Mask(0xA0DF8000); | 579 const Instr masked_A0DF8000 = instr->Mask(0xA0DF8000); |
| 638 if ((instr->Mask(0x80180000) != 0) || | 580 if ((instr->Mask(0x80180000) != 0) || |
| 639 (masked_A0DF8000 == 0x00020000) || | 581 (masked_A0DF8000 == 0x00020000) || |
| 640 (masked_A0DF8000 == 0x00030000) || | 582 (masked_A0DF8000 == 0x00030000) || |
| 641 (masked_A0DF8000 == 0x00068000) || | 583 (masked_A0DF8000 == 0x00068000) || |
| 642 (masked_A0DF8000 == 0x00428000) || | 584 (masked_A0DF8000 == 0x00428000) || |
| 643 (masked_A0DF8000 == 0x00430000) || | 585 (masked_A0DF8000 == 0x00430000) || |
| 644 (masked_A0DF8000 == 0x00468000) || | 586 (masked_A0DF8000 == 0x00468000) || |
| 645 (instr->Mask(0xA0D80000) == 0x00800000) || | 587 (instr->Mask(0xA0D80000) == 0x00800000) || |
| 646 (instr->Mask(0xA0DE0000) == 0x00C00000) || | 588 (instr->Mask(0xA0DE0000) == 0x00C00000) || |
| 647 (instr->Mask(0xA0DF0000) == 0x00C30000) || | 589 (instr->Mask(0xA0DF0000) == 0x00C30000) || |
| 648 (instr->Mask(0xA0DC0000) == 0x00C40000)) { | 590 (instr->Mask(0xA0DC0000) == 0x00C40000)) { |
| 649 VisitUnallocated(instr); | 591 V::VisitUnallocated(instr); |
| 650 } else { | 592 } else { |
| 651 VisitFPDataProcessing1Source(instr); | 593 V::VisitFPDataProcessing1Source(instr); |
| 652 } | 594 } |
| 653 } else if (instr->Bits(13, 10) == 8) { | 595 } else if (instr->Bits(13, 10) == 8) { |
| 654 if ((instr->Bits(15, 14) != 0) || | 596 if ((instr->Bits(15, 14) != 0) || |
| 655 (instr->Bits(2, 0) != 0) || | 597 (instr->Bits(2, 0) != 0) || |
| 656 (instr->Mask(0x80800000) != 0x00000000)) { | 598 (instr->Mask(0x80800000) != 0x00000000)) { |
| 657 VisitUnallocated(instr); | 599 V::VisitUnallocated(instr); |
| 658 } else { | 600 } else { |
| 659 VisitFPCompare(instr); | 601 V::VisitFPCompare(instr); |
| 660 } | 602 } |
| 661 } else if (instr->Bits(12, 10) == 4) { | 603 } else if (instr->Bits(12, 10) == 4) { |
| 662 if ((instr->Bits(9, 5) != 0) || | 604 if ((instr->Bits(9, 5) != 0) || |
| 663 (instr->Mask(0x80800000) != 0x00000000)) { | 605 (instr->Mask(0x80800000) != 0x00000000)) { |
| 664 VisitUnallocated(instr); | 606 V::VisitUnallocated(instr); |
| 665 } else { | 607 } else { |
| 666 VisitFPImmediate(instr); | 608 V::VisitFPImmediate(instr); |
| 667 } | 609 } |
| 668 } else { | 610 } else { |
| 669 if (instr->Mask(0x80800000) != 0x00000000) { | 611 if (instr->Mask(0x80800000) != 0x00000000) { |
| 670 VisitUnallocated(instr); | 612 V::VisitUnallocated(instr); |
| 671 } else { | 613 } else { |
| 672 switch (instr->Bits(11, 10)) { | 614 switch (instr->Bits(11, 10)) { |
| 673 case 1: { | 615 case 1: { |
| 674 VisitFPConditionalCompare(instr); | 616 V::VisitFPConditionalCompare(instr); |
| 675 break; | 617 break; |
| 676 } | 618 } |
| 677 case 2: { | 619 case 2: { |
| 678 if ((instr->Bits(15, 14) == 0x3) || | 620 if ((instr->Bits(15, 14) == 0x3) || |
| 679 (instr->Mask(0x00009000) == 0x00009000) || | 621 (instr->Mask(0x00009000) == 0x00009000) || |
| 680 (instr->Mask(0x0000A000) == 0x0000A000)) { | 622 (instr->Mask(0x0000A000) == 0x0000A000)) { |
| 681 VisitUnallocated(instr); | 623 V::VisitUnallocated(instr); |
| 682 } else { | 624 } else { |
| 683 VisitFPDataProcessing2Source(instr); | 625 V::VisitFPDataProcessing2Source(instr); |
| 684 } | 626 } |
| 685 break; | 627 break; |
| 686 } | 628 } |
| 687 case 3: { | 629 case 3: { |
| 688 VisitFPConditionalSelect(instr); | 630 V::VisitFPConditionalSelect(instr); |
| 689 break; | 631 break; |
| 690 } | 632 } |
| 691 default: UNREACHABLE(); | 633 default: UNREACHABLE(); |
| 692 } | 634 } |
| 693 } | 635 } |
| 694 } | 636 } |
| 695 } | 637 } |
| 696 } else { | 638 } else { |
| 697 // Bit 30 == 1 has been handled earlier. | 639 // Bit 30 == 1 has been handled earlier. |
| 698 ASSERT(instr->Bit(30) == 0); | 640 ASSERT(instr->Bit(30) == 0); |
| 699 if (instr->Mask(0xA0800000) != 0) { | 641 if (instr->Mask(0xA0800000) != 0) { |
| 700 VisitUnallocated(instr); | 642 V::VisitUnallocated(instr); |
| 701 } else { | 643 } else { |
| 702 VisitFPDataProcessing3Source(instr); | 644 V::VisitFPDataProcessing3Source(instr); |
| 703 } | 645 } |
| 704 } | 646 } |
| 705 } | 647 } |
| 706 } | 648 } |
| 707 } | 649 } |
| 708 } | 650 } |
| 709 | 651 |
| 710 | 652 |
| 711 void Decoder::DecodeAdvSIMDLoadStore(Instruction* instr) { | 653 template<typename V> |
| 654 void Decoder<V>::DecodeAdvSIMDLoadStore(Instruction* instr) { |
| 712 // TODO(all): Implement Advanced SIMD load/store instruction decode. | 655 // TODO(all): Implement Advanced SIMD load/store instruction decode. |
| 713 ASSERT(instr->Bits(29, 25) == 0x6); | 656 ASSERT(instr->Bits(29, 25) == 0x6); |
| 714 VisitUnimplemented(instr); | 657 V::VisitUnimplemented(instr); |
| 715 } | 658 } |
| 716 | 659 |
| 717 | 660 |
| 718 void Decoder::DecodeAdvSIMDDataProcessing(Instruction* instr) { | 661 template<typename V> |
| 662 void Decoder<V>::DecodeAdvSIMDDataProcessing(Instruction* instr) { |
| 719 // TODO(all): Implement Advanced SIMD data processing instruction decode. | 663 // TODO(all): Implement Advanced SIMD data processing instruction decode. |
| 720 ASSERT(instr->Bits(27, 25) == 0x7); | 664 ASSERT(instr->Bits(27, 25) == 0x7); |
| 721 VisitUnimplemented(instr); | 665 V::VisitUnimplemented(instr); |
| 722 } | 666 } |
| 723 | 667 |
| 724 | 668 |
| 725 } } // namespace v8::internal | 669 } } // namespace v8::internal |
| 726 | 670 |
| 727 #endif // V8_TARGET_ARCH_A64 | 671 #endif // V8_A64_DECODER_A64_INL_H_ |
| OLD | NEW |