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/compiler/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
6 | 6 |
7 #include "src/isolate-inl.h" | 7 #include "src/isolate-inl.h" |
8 | 8 |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 | 10 |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 case wasm::kExprI32ReinterpretF32: | 721 case wasm::kExprI32ReinterpretF32: |
722 op = m->BitcastFloat32ToInt32(); | 722 op = m->BitcastFloat32ToInt32(); |
723 break; | 723 break; |
724 case wasm::kExprI32Clz: | 724 case wasm::kExprI32Clz: |
725 op = m->Word32Clz(); | 725 op = m->Word32Clz(); |
726 break; | 726 break; |
727 case wasm::kExprI32Ctz: { | 727 case wasm::kExprI32Ctz: { |
728 if (m->Word32Ctz().IsSupported()) { | 728 if (m->Word32Ctz().IsSupported()) { |
729 op = m->Word32Ctz().op(); | 729 op = m->Word32Ctz().op(); |
730 break; | 730 break; |
| 731 } else if (m->Word32ReverseBits().IsSupported()) { |
| 732 Node* reversed = graph()->NewNode(m->Word32ReverseBits().op(), input); |
| 733 Node* result = graph()->NewNode(m->Word32Clz(), reversed); |
| 734 return result; |
731 } else { | 735 } else { |
732 return BuildI32Ctz(input); | 736 return BuildI32Ctz(input); |
733 } | 737 } |
734 } | 738 } |
735 case wasm::kExprI32Popcnt: { | 739 case wasm::kExprI32Popcnt: { |
736 if (m->Word32Popcnt().IsSupported()) { | 740 if (m->Word32Popcnt().IsSupported()) { |
737 op = m->Word32Popcnt().op(); | 741 op = m->Word32Popcnt().op(); |
738 break; | 742 break; |
739 } else { | 743 } else { |
740 return BuildI32Popcnt(input); | 744 return BuildI32Popcnt(input); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 case wasm::kExprI64ReinterpretF64: | 852 case wasm::kExprI64ReinterpretF64: |
849 op = m->BitcastFloat64ToInt64(); | 853 op = m->BitcastFloat64ToInt64(); |
850 break; | 854 break; |
851 case wasm::kExprI64Clz: | 855 case wasm::kExprI64Clz: |
852 op = m->Word64Clz(); | 856 op = m->Word64Clz(); |
853 break; | 857 break; |
854 case wasm::kExprI64Ctz: { | 858 case wasm::kExprI64Ctz: { |
855 if (m->Word64Ctz().IsSupported()) { | 859 if (m->Word64Ctz().IsSupported()) { |
856 op = m->Word64Ctz().op(); | 860 op = m->Word64Ctz().op(); |
857 break; | 861 break; |
| 862 } else if (m->Word64ReverseBits().IsSupported()) { |
| 863 Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); |
| 864 Node* result = graph()->NewNode(m->Word64Clz(), reversed); |
| 865 return result; |
858 } else { | 866 } else { |
859 return BuildI64Ctz(input); | 867 return BuildI64Ctz(input); |
860 } | 868 } |
861 } | 869 } |
862 case wasm::kExprI64Popcnt: { | 870 case wasm::kExprI64Popcnt: { |
863 if (m->Word64Popcnt().IsSupported()) { | 871 if (m->Word64Popcnt().IsSupported()) { |
864 op = m->Word64Popcnt().op(); | 872 op = m->Word64Popcnt().op(); |
865 break; | 873 break; |
866 } else { | 874 } else { |
867 return BuildI64Popcnt(input); | 875 return BuildI64Popcnt(input); |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 module_env->module->GetName(function.name_offset)); | 2154 module_env->module->GetName(function.name_offset)); |
2147 } | 2155 } |
2148 | 2156 |
2149 return code; | 2157 return code; |
2150 } | 2158 } |
2151 | 2159 |
2152 | 2160 |
2153 } // namespace compiler | 2161 } // namespace compiler |
2154 } // namespace internal | 2162 } // namespace internal |
2155 } // namespace v8 | 2163 } // namespace v8 |
OLD | NEW |