OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/s390/frames-s390.h" | 9 #include "src/s390/frames-s390.h" |
10 | 10 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; | 265 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; |
266 size_t const temp_count = arraysize(temps); | 266 size_t const temp_count = arraysize(temps); |
267 InstructionCode code = kArchStoreWithWriteBarrier; | 267 InstructionCode code = kArchStoreWithWriteBarrier; |
268 code |= AddressingModeField::encode(addressing_mode); | 268 code |= AddressingModeField::encode(addressing_mode); |
269 code |= MiscField::encode(static_cast<int>(record_write_mode)); | 269 code |= MiscField::encode(static_cast<int>(record_write_mode)); |
270 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); | 270 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); |
271 } else { | 271 } else { |
272 ArchOpcode opcode = kArchNop; | 272 ArchOpcode opcode = kArchNop; |
273 ImmediateMode mode = kInt16Imm; | 273 ImmediateMode mode = kInt16Imm; |
| 274 NodeMatcher m(value); |
274 switch (rep) { | 275 switch (rep) { |
275 case MachineRepresentation::kFloat32: | 276 case MachineRepresentation::kFloat32: |
276 opcode = kS390_StoreFloat32; | 277 opcode = kS390_StoreFloat32; |
277 break; | 278 break; |
278 case MachineRepresentation::kFloat64: | 279 case MachineRepresentation::kFloat64: |
279 opcode = kS390_StoreDouble; | 280 opcode = kS390_StoreDouble; |
280 break; | 281 break; |
281 case MachineRepresentation::kBit: // Fall through. | 282 case MachineRepresentation::kBit: // Fall through. |
282 case MachineRepresentation::kWord8: | 283 case MachineRepresentation::kWord8: |
283 opcode = kS390_StoreWord8; | 284 opcode = kS390_StoreWord8; |
284 break; | 285 break; |
285 case MachineRepresentation::kWord16: | 286 case MachineRepresentation::kWord16: |
286 opcode = kS390_StoreWord16; | 287 opcode = kS390_StoreWord16; |
287 break; | 288 break; |
288 #if !V8_TARGET_ARCH_S390X | 289 #if !V8_TARGET_ARCH_S390X |
289 case MachineRepresentation::kTagged: // Fall through. | 290 case MachineRepresentation::kTagged: // Fall through. |
290 #endif | 291 #endif |
291 case MachineRepresentation::kWord32: | 292 case MachineRepresentation::kWord32: |
292 opcode = kS390_StoreWord32; | 293 opcode = kS390_StoreWord32; |
| 294 if (m.IsWord32ReverseBytes()) { |
| 295 opcode = kS390_StoreReverse32; |
| 296 value = value->InputAt(0); |
| 297 } |
293 break; | 298 break; |
294 #if V8_TARGET_ARCH_S390X | 299 #if V8_TARGET_ARCH_S390X |
295 case MachineRepresentation::kTagged: // Fall through. | 300 case MachineRepresentation::kTagged: // Fall through. |
296 case MachineRepresentation::kWord64: | 301 case MachineRepresentation::kWord64: |
297 opcode = kS390_StoreWord64; | 302 opcode = kS390_StoreWord64; |
298 mode = kInt16Imm_4ByteAligned; | 303 mode = kInt16Imm_4ByteAligned; |
| 304 if (m.IsWord64ReverseBytes()) { |
| 305 opcode = kS390_StoreReverse64; |
| 306 value = value->InputAt(0); |
| 307 } |
299 break; | 308 break; |
300 #else | 309 #else |
301 case MachineRepresentation::kWord64: // Fall through. | 310 case MachineRepresentation::kWord64: // Fall through. |
302 #endif | 311 #endif |
303 case MachineRepresentation::kSimd128: // Fall through. | 312 case MachineRepresentation::kSimd128: // Fall through. |
304 case MachineRepresentation::kNone: | 313 case MachineRepresentation::kNone: |
305 UNREACHABLE(); | 314 UNREACHABLE(); |
306 return; | 315 return; |
307 } | 316 } |
308 if (g.CanBeImmediate(offset, mode)) { | 317 if (g.CanBeImmediate(offset, mode)) { |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 #if V8_TARGET_ARCH_S390X | 895 #if V8_TARGET_ARCH_S390X |
887 void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); } | 896 void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); } |
888 #endif | 897 #endif |
889 | 898 |
890 void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); } | 899 void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); } |
891 | 900 |
892 #if V8_TARGET_ARCH_S390X | 901 #if V8_TARGET_ARCH_S390X |
893 void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); } | 902 void InstructionSelector::VisitWord64ReverseBits(Node* node) { UNREACHABLE(); } |
894 #endif | 903 #endif |
895 | 904 |
| 905 void InstructionSelector::VisitWord64ReverseBytes(Node* node) { |
| 906 S390OperandGenerator g(this); |
| 907 Emit(kS390_LoadReverse64RR, g.DefineAsRegister(node), |
| 908 g.UseRegister(node->InputAt(0))); |
| 909 } |
| 910 |
| 911 void InstructionSelector::VisitWord32ReverseBytes(Node* node) { |
| 912 S390OperandGenerator g(this); |
| 913 NodeMatcher input(node->InputAt(0)); |
| 914 if (CanCover(node, input.node()) && input.IsLoad()) { |
| 915 LoadRepresentation load_rep = LoadRepresentationOf(input.node()->op()); |
| 916 if (load_rep.representation() == MachineRepresentation::kWord32) { |
| 917 Node* base = input.node()->InputAt(0); |
| 918 Node* offset = input.node()->InputAt(1); |
| 919 Emit(kS390_LoadReverse32 | AddressingModeField::encode(kMode_MRR), |
| 920 // TODO(john.yan): one of the base and offset can be imm. |
| 921 g.DefineAsRegister(node), g.UseRegister(base), |
| 922 g.UseRegister(offset)); |
| 923 return; |
| 924 } |
| 925 } |
| 926 Emit(kS390_LoadReverse32RR, g.DefineAsRegister(node), |
| 927 g.UseRegister(node->InputAt(0))); |
| 928 } |
| 929 |
896 void InstructionSelector::VisitInt32Add(Node* node) { | 930 void InstructionSelector::VisitInt32Add(Node* node) { |
897 VisitBinop<Int32BinopMatcher>(this, node, kS390_Add, kInt16Imm); | 931 VisitBinop<Int32BinopMatcher>(this, node, kS390_Add, kInt16Imm); |
898 } | 932 } |
899 | 933 |
900 #if V8_TARGET_ARCH_S390X | 934 #if V8_TARGET_ARCH_S390X |
901 void InstructionSelector::VisitInt64Add(Node* node) { | 935 void InstructionSelector::VisitInt64Add(Node* node) { |
902 VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm); | 936 VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm); |
903 } | 937 } |
904 #endif | 938 #endif |
905 | 939 |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 MachineOperatorBuilder::Flags | 1924 MachineOperatorBuilder::Flags |
1891 InstructionSelector::SupportedMachineOperatorFlags() { | 1925 InstructionSelector::SupportedMachineOperatorFlags() { |
1892 return MachineOperatorBuilder::kFloat32RoundDown | | 1926 return MachineOperatorBuilder::kFloat32RoundDown | |
1893 MachineOperatorBuilder::kFloat64RoundDown | | 1927 MachineOperatorBuilder::kFloat64RoundDown | |
1894 MachineOperatorBuilder::kFloat32RoundUp | | 1928 MachineOperatorBuilder::kFloat32RoundUp | |
1895 MachineOperatorBuilder::kFloat64RoundUp | | 1929 MachineOperatorBuilder::kFloat64RoundUp | |
1896 MachineOperatorBuilder::kFloat32RoundTruncate | | 1930 MachineOperatorBuilder::kFloat32RoundTruncate | |
1897 MachineOperatorBuilder::kFloat64RoundTruncate | | 1931 MachineOperatorBuilder::kFloat64RoundTruncate | |
1898 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1932 MachineOperatorBuilder::kFloat64RoundTiesAway | |
1899 MachineOperatorBuilder::kWord32Popcnt | | 1933 MachineOperatorBuilder::kWord32Popcnt | |
| 1934 MachineOperatorBuilder::kWord32ReverseBytes | |
| 1935 MachineOperatorBuilder::kWord64ReverseBytes | |
1900 MachineOperatorBuilder::kWord64Popcnt; | 1936 MachineOperatorBuilder::kWord64Popcnt; |
1901 } | 1937 } |
1902 | 1938 |
1903 // static | 1939 // static |
1904 MachineOperatorBuilder::AlignmentRequirements | 1940 MachineOperatorBuilder::AlignmentRequirements |
1905 InstructionSelector::AlignmentRequirements() { | 1941 InstructionSelector::AlignmentRequirements() { |
1906 return MachineOperatorBuilder::AlignmentRequirements:: | 1942 return MachineOperatorBuilder::AlignmentRequirements:: |
1907 FullUnalignedAccessSupport(); | 1943 FullUnalignedAccessSupport(); |
1908 } | 1944 } |
1909 | 1945 |
1910 } // namespace compiler | 1946 } // namespace compiler |
1911 } // namespace internal | 1947 } // namespace internal |
1912 } // namespace v8 | 1948 } // namespace v8 |
OLD | NEW |