Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_OPTIMIZING_NODES_VECTOR_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_NODES_VECTOR_H_ |
| 19 | |
| 20 | // This #include should never be used by compilation, because this header file (nodes_vector.h) |
| 21 | // is included in the header file nodes.h itself. However it gives editing tools better context. |
| 22 | #include "nodes.h" |
| 23 | |
| 24 | namespace art { |
| 25 | |
| 26 | // Memory alignment, represented as an offset relative to a base, where 0 <= offset < base, |
| 27 | // and base is a power of two. For example, the value Alignment(16, 0) means memory is |
| 28 | // perfectly aligned at a 16-byte boundary, whereas the value Alignment(16, 4) means |
| 29 | // memory is always exactly 4 bytes above such a boundary. |
| 30 | class Alignment { |
| 31 | public: |
| 32 | Alignment(size_t base, size_t offset) : base_(base), offset_(offset) { |
| 33 | DCHECK_LT(offset, base); |
| 34 | DCHECK(IsPowerOfTwo(base)); |
| 35 | } |
| 36 | |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 37 | // Returns true if memory is at least aligned at the given boundary. |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 38 | // Assumes requested base is power of two. |
| 39 | bool IsAlignedAt(size_t base) const { |
| 40 | DCHECK_NE(0u, base); |
| 41 | DCHECK(IsPowerOfTwo(base)); |
| 42 | return ((offset_ | base_) & (base - 1u)) == 0; |
| 43 | } |
| 44 | |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 45 | size_t Base() const { return base_; } |
| 46 | |
| 47 | size_t Offset() const { return offset_; } |
| 48 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 49 | std::string ToString() const { |
| 50 | return "ALIGN(" + std::to_string(base_) + "," + std::to_string(offset_) + ")"; |
| 51 | } |
| 52 | |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 53 | bool operator==(const Alignment& other) const { |
| 54 | return base_ == other.base_ && offset_ == other.offset_; |
| 55 | } |
| 56 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 57 | private: |
| 58 | size_t base_; |
| 59 | size_t offset_; |
| 60 | }; |
| 61 | |
| 62 | // |
| 63 | // Definitions of abstract vector operations in HIR. |
| 64 | // |
| 65 | |
| 66 | // Abstraction of a vector operation, i.e., an operation that performs |
| 67 | // GetVectorLength() x GetPackedType() operations simultaneously. |
| 68 | class HVecOperation : public HVariableInputSizeInstruction { |
| 69 | public: |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 70 | // A SIMD operation looks like a FPU location. |
| 71 | // TODO: we could introduce SIMD types in HIR. |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 72 | static constexpr DataType::Type kSIMDType = DataType::Type::kFloat64; |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 73 | |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 74 | HVecOperation(InstructionKind kind, |
| 75 | ArenaAllocator* allocator, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 76 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 77 | SideEffects side_effects, |
| 78 | size_t number_of_inputs, |
| 79 | size_t vector_length, |
| 80 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 81 | : HVariableInputSizeInstruction(kind, |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 82 | kSIMDType, |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 83 | side_effects, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 84 | dex_pc, |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 85 | allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 86 | number_of_inputs, |
| 87 | kArenaAllocVectorNode), |
| 88 | vector_length_(vector_length) { |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 89 | SetPackedField<PackedTypeField>(packed_type); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 90 | DCHECK_LT(1u, vector_length); |
| 91 | } |
| 92 | |
| 93 | // Returns the number of elements packed in a vector. |
| 94 | size_t GetVectorLength() const { |
| 95 | return vector_length_; |
| 96 | } |
| 97 | |
| 98 | // Returns the number of bytes in a full vector. |
| 99 | size_t GetVectorNumberOfBytes() const { |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 100 | return vector_length_ * DataType::Size(GetPackedType()); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 101 | } |
| 102 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 103 | // Returns the true component type packed in a vector. |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 104 | DataType::Type GetPackedType() const { |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 105 | return GetPackedField<PackedTypeField>(); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 106 | } |
| 107 | |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 108 | // Assumes vector nodes cannot be moved by default. Each concrete implementation |
| 109 | // that can be moved should override this method and return true. |
Artem Serov | 89ff8b2 | 2017-11-20 11:51:05 +0000 | [diff] [blame] | 110 | // |
| 111 | // Note: similar approach is used for instruction scheduling (if it is turned on for the target): |
| 112 | // by default HScheduler::IsSchedulable returns false for a particular HVecOperation. |
| 113 | // HScheduler${ARCH}::IsSchedulable can be overridden to return true for an instruction (see |
| 114 | // scheduler_arm64.h for example) if it is safe to schedule it; in this case one *must* also |
| 115 | // look at/update HScheduler${ARCH}::IsSchedulingBarrier for this instruction. |
| 116 | // |
| 117 | // Note: For newly introduced vector instructions HScheduler${ARCH}::IsSchedulingBarrier must be |
| 118 | // altered to return true if the instruction might reside outside the SIMD loop body since SIMD |
| 119 | // registers are not kept alive across vector loop boundaries (yet). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 120 | bool CanBeMoved() const override { return false; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 121 | |
| 122 | // Tests if all data of a vector node (vector length and packed type) is equal. |
| 123 | // Each concrete implementation that adds more fields should test equality of |
| 124 | // those fields in its own method *and* call all super methods. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 125 | bool InstructionDataEquals(const HInstruction* other) const override { |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 126 | DCHECK(other->IsVecOperation()); |
| 127 | const HVecOperation* o = other->AsVecOperation(); |
| 128 | return GetVectorLength() == o->GetVectorLength() && GetPackedType() == o->GetPackedType(); |
| 129 | } |
| 130 | |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 131 | // Maps an integral type to the same-size signed type and leaves other types alone. |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 132 | static DataType::Type ToSignedType(DataType::Type type) { |
| 133 | switch (type) { |
| 134 | case DataType::Type::kBool: // 1-byte storage unit |
| 135 | case DataType::Type::kUint8: |
| 136 | return DataType::Type::kInt8; |
| 137 | case DataType::Type::kUint16: |
| 138 | return DataType::Type::kInt16; |
| 139 | default: |
| 140 | DCHECK(type != DataType::Type::kVoid && type != DataType::Type::kReference) << type; |
| 141 | return type; |
| 142 | } |
| 143 | } |
| 144 | |
Aart Bik | 4d1a9d4 | 2017-10-19 14:40:55 -0700 | [diff] [blame] | 145 | // Maps an integral type to the same-size unsigned type and leaves other types alone. |
| 146 | static DataType::Type ToUnsignedType(DataType::Type type) { |
| 147 | switch (type) { |
| 148 | case DataType::Type::kBool: // 1-byte storage unit |
| 149 | case DataType::Type::kInt8: |
| 150 | return DataType::Type::kUint8; |
| 151 | case DataType::Type::kInt16: |
| 152 | return DataType::Type::kUint16; |
| 153 | default: |
| 154 | DCHECK(type != DataType::Type::kVoid && type != DataType::Type::kReference) << type; |
| 155 | return type; |
| 156 | } |
| 157 | } |
| 158 | |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 159 | // Maps an integral type to the same-size (un)signed type. Leaves other types alone. |
| 160 | static DataType::Type ToProperType(DataType::Type type, bool is_unsigned) { |
| 161 | return is_unsigned ? ToUnsignedType(type) : ToSignedType(type); |
| 162 | } |
| 163 | |
Aart Bik | 2dd7b67 | 2017-12-07 11:11:22 -0800 | [diff] [blame] | 164 | // Helper method to determine if an instruction returns a SIMD value. |
| 165 | // TODO: This method is needed until we introduce SIMD as proper type. |
| 166 | static bool ReturnsSIMDValue(HInstruction* instruction) { |
| 167 | if (instruction->IsVecOperation()) { |
| 168 | return !instruction->IsVecExtractScalar(); // only scalar returning vec op |
| 169 | } else if (instruction->IsPhi()) { |
Aart Bik | 3f8e02c | 2018-04-10 11:55:00 -0700 | [diff] [blame] | 170 | // Vectorizer only uses Phis in reductions, so checking for a 2-way phi |
| 171 | // with a direct vector operand as second argument suffices. |
Aart Bik | 2dd7b67 | 2017-12-07 11:11:22 -0800 | [diff] [blame] | 172 | return |
| 173 | instruction->GetType() == kSIMDType && |
Aart Bik | 3f8e02c | 2018-04-10 11:55:00 -0700 | [diff] [blame] | 174 | instruction->InputCount() == 2 && |
| 175 | instruction->InputAt(1)->IsVecOperation(); |
Aart Bik | 2dd7b67 | 2017-12-07 11:11:22 -0800 | [diff] [blame] | 176 | } |
| 177 | return false; |
| 178 | } |
| 179 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 180 | DECLARE_ABSTRACT_INSTRUCTION(VecOperation); |
| 181 | |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 182 | protected: |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 183 | // Additional packed bits. |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 184 | static constexpr size_t kFieldPackedType = HInstruction::kNumberOfGenericPackedBits; |
| 185 | static constexpr size_t kFieldPackedTypeSize = |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 186 | MinimumBitsToStore(static_cast<size_t>(DataType::Type::kLast)); |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 187 | static constexpr size_t kNumberOfVectorOpPackedBits = kFieldPackedType + kFieldPackedTypeSize; |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 188 | static_assert(kNumberOfVectorOpPackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 189 | using PackedTypeField = BitField<DataType::Type, kFieldPackedType, kFieldPackedTypeSize>; |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 190 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 191 | DEFAULT_COPY_CONSTRUCTOR(VecOperation); |
| 192 | |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 193 | private: |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 194 | const size_t vector_length_; |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 195 | }; |
| 196 | |
| 197 | // Abstraction of a unary vector operation. |
| 198 | class HVecUnaryOperation : public HVecOperation { |
| 199 | public: |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 200 | HVecUnaryOperation(InstructionKind kind, |
| 201 | ArenaAllocator* allocator, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 202 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 203 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 204 | size_t vector_length, |
| 205 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 206 | : HVecOperation(kind, |
| 207 | allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 208 | packed_type, |
| 209 | SideEffects::None(), |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 210 | /* number_of_inputs= */ 1, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 211 | vector_length, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 212 | dex_pc) { |
| 213 | SetRawInputAt(0, input); |
| 214 | } |
| 215 | |
| 216 | HInstruction* GetInput() const { return InputAt(0); } |
| 217 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 218 | DECLARE_ABSTRACT_INSTRUCTION(VecUnaryOperation); |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 219 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 220 | protected: |
| 221 | DEFAULT_COPY_CONSTRUCTOR(VecUnaryOperation); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 222 | }; |
| 223 | |
| 224 | // Abstraction of a binary vector operation. |
| 225 | class HVecBinaryOperation : public HVecOperation { |
| 226 | public: |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 227 | HVecBinaryOperation(InstructionKind kind, |
| 228 | ArenaAllocator* allocator, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 229 | HInstruction* left, |
| 230 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 231 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 232 | size_t vector_length, |
| 233 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 234 | : HVecOperation(kind, |
| 235 | allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 236 | packed_type, |
| 237 | SideEffects::None(), |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 238 | /* number_of_inputs= */ 2, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 239 | vector_length, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 240 | dex_pc) { |
| 241 | SetRawInputAt(0, left); |
| 242 | SetRawInputAt(1, right); |
| 243 | } |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 244 | |
| 245 | HInstruction* GetLeft() const { return InputAt(0); } |
| 246 | HInstruction* GetRight() const { return InputAt(1); } |
| 247 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 248 | DECLARE_ABSTRACT_INSTRUCTION(VecBinaryOperation); |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 249 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 250 | protected: |
| 251 | DEFAULT_COPY_CONSTRUCTOR(VecBinaryOperation); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 252 | }; |
| 253 | |
| 254 | // Abstraction of a vector operation that references memory, with an alignment. |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 255 | // The Android runtime guarantees elements have at least natural alignment. |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 256 | class HVecMemoryOperation : public HVecOperation { |
| 257 | public: |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 258 | HVecMemoryOperation(InstructionKind kind, |
| 259 | ArenaAllocator* allocator, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 260 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 261 | SideEffects side_effects, |
| 262 | size_t number_of_inputs, |
| 263 | size_t vector_length, |
| 264 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 265 | : HVecOperation(kind, |
| 266 | allocator, |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 267 | packed_type, |
| 268 | side_effects, |
| 269 | number_of_inputs, |
| 270 | vector_length, |
| 271 | dex_pc), |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 272 | alignment_(DataType::Size(packed_type), 0) { |
Artem Serov | e1811ed | 2017-04-27 16:50:47 +0100 | [diff] [blame] | 273 | DCHECK_GE(number_of_inputs, 2u); |
| 274 | } |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 275 | |
| 276 | void SetAlignment(Alignment alignment) { alignment_ = alignment; } |
| 277 | |
| 278 | Alignment GetAlignment() const { return alignment_; } |
| 279 | |
Artem Serov | e1811ed | 2017-04-27 16:50:47 +0100 | [diff] [blame] | 280 | HInstruction* GetArray() const { return InputAt(0); } |
| 281 | HInstruction* GetIndex() const { return InputAt(1); } |
| 282 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 283 | bool InstructionDataEquals(const HInstruction* other) const override { |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 284 | DCHECK(other->IsVecMemoryOperation()); |
| 285 | const HVecMemoryOperation* o = other->AsVecMemoryOperation(); |
| 286 | return HVecOperation::InstructionDataEquals(o) && GetAlignment() == o->GetAlignment(); |
| 287 | } |
| 288 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 289 | DECLARE_ABSTRACT_INSTRUCTION(VecMemoryOperation); |
| 290 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 291 | protected: |
| 292 | DEFAULT_COPY_CONSTRUCTOR(VecMemoryOperation); |
| 293 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 294 | private: |
| 295 | Alignment alignment_; |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 296 | }; |
| 297 | |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 298 | // Packed type consistency checker ("same vector length" integral types may mix freely). |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 299 | // Tests relaxed type consistency in which packed same-size integral types can co-exist, |
| 300 | // but other type mixes are an error. |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 301 | inline static bool HasConsistentPackedTypes(HInstruction* input, DataType::Type type) { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 302 | if (input->IsPhi()) { |
| 303 | return input->GetType() == HVecOperation::kSIMDType; // carries SIMD |
| 304 | } |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 305 | DCHECK(input->IsVecOperation()); |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 306 | DataType::Type input_type = input->AsVecOperation()->GetPackedType(); |
Aart Bik | 4d1a9d4 | 2017-10-19 14:40:55 -0700 | [diff] [blame] | 307 | DCHECK_EQ(HVecOperation::ToUnsignedType(input_type) == HVecOperation::ToUnsignedType(type), |
| 308 | HVecOperation::ToSignedType(input_type) == HVecOperation::ToSignedType(type)); |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 309 | return HVecOperation::ToSignedType(input_type) == HVecOperation::ToSignedType(type); |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 310 | } |
| 311 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 312 | // |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 313 | // Definitions of concrete unary vector operations in HIR. |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 314 | // |
| 315 | |
| 316 | // Replicates the given scalar into a vector, |
| 317 | // viz. replicate(x) = [ x, .. , x ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 318 | class HVecReplicateScalar final : public HVecUnaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 319 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 320 | HVecReplicateScalar(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 321 | HInstruction* scalar, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 322 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 323 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 324 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 325 | : HVecUnaryOperation( |
| 326 | kVecReplicateScalar, allocator, scalar, packed_type, vector_length, dex_pc) { |
Aart Bik | 5a0eb0c | 2018-03-16 15:00:19 -0700 | [diff] [blame] | 327 | DCHECK(!ReturnsSIMDValue(scalar)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 328 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 329 | |
| 330 | // A replicate needs to stay in place, since SIMD registers are not |
| 331 | // kept alive across vector loop boundaries (yet). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 332 | bool CanBeMoved() const override { return false; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 333 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 334 | DECLARE_INSTRUCTION(VecReplicateScalar); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 335 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 336 | protected: |
| 337 | DEFAULT_COPY_CONSTRUCTOR(VecReplicateScalar); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 338 | }; |
| 339 | |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 340 | // Extracts a particular scalar from the given vector, |
| 341 | // viz. extract[ x1, .. , xn ] = x_i. |
| 342 | // |
| 343 | // TODO: for now only i == 1 case supported. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 344 | class HVecExtractScalar final : public HVecUnaryOperation { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 345 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 346 | HVecExtractScalar(ArenaAllocator* allocator, |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 347 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 348 | DataType::Type packed_type, |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 349 | size_t vector_length, |
| 350 | size_t index, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 351 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 352 | : HVecUnaryOperation( |
| 353 | kVecExtractScalar, allocator, input, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 354 | DCHECK(HasConsistentPackedTypes(input, packed_type)); |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 355 | DCHECK_LT(index, vector_length); |
| 356 | DCHECK_EQ(index, 0u); |
Vladimir Marko | bd78567 | 2018-05-03 17:09:09 +0100 | [diff] [blame] | 357 | // Yields a single component in the vector. |
| 358 | // Overrides the kSIMDType set by the VecOperation constructor. |
| 359 | SetPackedField<TypeField>(packed_type); |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | // An extract needs to stay in place, since SIMD registers are not |
| 363 | // kept alive across vector loop boundaries (yet). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 364 | bool CanBeMoved() const override { return false; } |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 365 | |
| 366 | DECLARE_INSTRUCTION(VecExtractScalar); |
| 367 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 368 | protected: |
| 369 | DEFAULT_COPY_CONSTRUCTOR(VecExtractScalar); |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 370 | }; |
| 371 | |
| 372 | // Reduces the given vector into the first element as sum/min/max, |
| 373 | // viz. sum-reduce[ x1, .. , xn ] = [ y, ---- ], where y = sum xi |
| 374 | // and the "-" denotes "don't care" (implementation dependent). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 375 | class HVecReduce final : public HVecUnaryOperation { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 376 | public: |
| 377 | enum ReductionKind { |
| 378 | kSum = 1, |
| 379 | kMin = 2, |
| 380 | kMax = 3 |
| 381 | }; |
| 382 | |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 383 | HVecReduce(ArenaAllocator* allocator, |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 384 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 385 | DataType::Type packed_type, |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 386 | size_t vector_length, |
Vladimir Marko | 4e3734a | 2018-11-14 15:45:28 +0000 | [diff] [blame] | 387 | ReductionKind reduction_kind, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 388 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 389 | : HVecUnaryOperation(kVecReduce, allocator, input, packed_type, vector_length, dex_pc), |
Vladimir Marko | 4e3734a | 2018-11-14 15:45:28 +0000 | [diff] [blame] | 390 | reduction_kind_(reduction_kind) { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 391 | DCHECK(HasConsistentPackedTypes(input, packed_type)); |
Aart Bik | cfa59b4 | 2017-08-31 09:08:13 -0700 | [diff] [blame] | 392 | } |
| 393 | |
Vladimir Marko | 4e3734a | 2018-11-14 15:45:28 +0000 | [diff] [blame] | 394 | ReductionKind GetReductionKind() const { return reduction_kind_; } |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 395 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 396 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 397 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 398 | bool InstructionDataEquals(const HInstruction* other) const override { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 399 | DCHECK(other->IsVecReduce()); |
| 400 | const HVecReduce* o = other->AsVecReduce(); |
Vladimir Marko | 4e3734a | 2018-11-14 15:45:28 +0000 | [diff] [blame] | 401 | return HVecOperation::InstructionDataEquals(o) && GetReductionKind() == o->GetReductionKind(); |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | DECLARE_INSTRUCTION(VecReduce); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 405 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 406 | protected: |
| 407 | DEFAULT_COPY_CONSTRUCTOR(VecReduce); |
| 408 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 409 | private: |
Vladimir Marko | 4e3734a | 2018-11-14 15:45:28 +0000 | [diff] [blame] | 410 | const ReductionKind reduction_kind_; |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 411 | }; |
| 412 | |
| 413 | // Converts every component in the vector, |
| 414 | // viz. cnv[ x1, .. , xn ] = [ cnv(x1), .. , cnv(xn) ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 415 | class HVecCnv final : public HVecUnaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 416 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 417 | HVecCnv(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 418 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 419 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 420 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 421 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 422 | : HVecUnaryOperation(kVecCnv, allocator, input, packed_type, vector_length, dex_pc) { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 423 | DCHECK(input->IsVecOperation()); |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 424 | DCHECK_NE(GetInputType(), GetResultType()); // actual convert |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 425 | } |
| 426 | |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 427 | DataType::Type GetInputType() const { return InputAt(0)->AsVecOperation()->GetPackedType(); } |
| 428 | DataType::Type GetResultType() const { return GetPackedType(); } |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 429 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 430 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 431 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 432 | DECLARE_INSTRUCTION(VecCnv); |
| 433 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 434 | protected: |
| 435 | DEFAULT_COPY_CONSTRUCTOR(VecCnv); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 436 | }; |
| 437 | |
| 438 | // Negates every component in the vector, |
| 439 | // viz. neg[ x1, .. , xn ] = [ -x1, .. , -xn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 440 | class HVecNeg final : public HVecUnaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 441 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 442 | HVecNeg(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 443 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 444 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 445 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 446 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 447 | : HVecUnaryOperation(kVecNeg, allocator, input, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 448 | DCHECK(HasConsistentPackedTypes(input, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 449 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 450 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 451 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 452 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 453 | DECLARE_INSTRUCTION(VecNeg); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 454 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 455 | protected: |
| 456 | DEFAULT_COPY_CONSTRUCTOR(VecNeg); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 457 | }; |
| 458 | |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 459 | // Takes absolute value of every component in the vector, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 460 | // viz. abs[ x1, .. , xn ] = [ |x1|, .. , |xn| ] |
| 461 | // for signed operand x. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 462 | class HVecAbs final : public HVecUnaryOperation { |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 463 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 464 | HVecAbs(ArenaAllocator* allocator, |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 465 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 466 | DataType::Type packed_type, |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 467 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 468 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 469 | : HVecUnaryOperation(kVecAbs, allocator, input, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 470 | DCHECK(HasConsistentPackedTypes(input, packed_type)); |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 471 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 472 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 473 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 474 | |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 475 | DECLARE_INSTRUCTION(VecAbs); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 476 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 477 | protected: |
| 478 | DEFAULT_COPY_CONSTRUCTOR(VecAbs); |
Aart Bik | 6daebeb | 2017-04-03 14:35:41 -0700 | [diff] [blame] | 479 | }; |
| 480 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 481 | // Bitwise- or boolean-nots every component in the vector, |
| 482 | // viz. not[ x1, .. , xn ] = [ ~x1, .. , ~xn ], or |
| 483 | // not[ x1, .. , xn ] = [ !x1, .. , !xn ] for boolean. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 484 | class HVecNot final : public HVecUnaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 485 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 486 | HVecNot(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 487 | HInstruction* input, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 488 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 489 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 490 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 491 | : HVecUnaryOperation(kVecNot, allocator, input, packed_type, vector_length, dex_pc) { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 492 | DCHECK(input->IsVecOperation()); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 493 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 494 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 495 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 496 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 497 | DECLARE_INSTRUCTION(VecNot); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 498 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 499 | protected: |
| 500 | DEFAULT_COPY_CONSTRUCTOR(VecNot); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 501 | }; |
| 502 | |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 503 | // |
| 504 | // Definitions of concrete binary vector operations in HIR. |
| 505 | // |
| 506 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 507 | // Adds every component in the two vectors, |
| 508 | // viz. [ x1, .. , xn ] + [ y1, .. , yn ] = [ x1 + y1, .. , xn + yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 509 | class HVecAdd final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 510 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 511 | HVecAdd(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 512 | HInstruction* left, |
| 513 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 514 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 515 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 516 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 517 | : HVecBinaryOperation(kVecAdd, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 518 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 519 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 520 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 521 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 522 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 523 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 524 | DECLARE_INSTRUCTION(VecAdd); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 525 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 526 | protected: |
| 527 | DEFAULT_COPY_CONSTRUCTOR(VecAdd); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 528 | }; |
| 529 | |
Aart Bik | 29aa082 | 2018-03-08 11:28:00 -0800 | [diff] [blame] | 530 | // Adds every component in the two vectors using saturation arithmetic, |
| 531 | // viz. [ x1, .. , xn ] + [ y1, .. , yn ] = [ x1 +_sat y1, .. , xn +_sat yn ] |
| 532 | // for either both signed or both unsigned operands x, y (reflected in packed_type). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 533 | class HVecSaturationAdd final : public HVecBinaryOperation { |
Aart Bik | 29aa082 | 2018-03-08 11:28:00 -0800 | [diff] [blame] | 534 | public: |
| 535 | HVecSaturationAdd(ArenaAllocator* allocator, |
| 536 | HInstruction* left, |
| 537 | HInstruction* right, |
| 538 | DataType::Type packed_type, |
| 539 | size_t vector_length, |
| 540 | uint32_t dex_pc) |
| 541 | : HVecBinaryOperation( |
| 542 | kVecSaturationAdd, allocator, left, right, packed_type, vector_length, dex_pc) { |
| 543 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 544 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
| 545 | } |
| 546 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 547 | bool CanBeMoved() const override { return true; } |
Aart Bik | 29aa082 | 2018-03-08 11:28:00 -0800 | [diff] [blame] | 548 | |
| 549 | DECLARE_INSTRUCTION(VecSaturationAdd); |
| 550 | |
| 551 | protected: |
| 552 | DEFAULT_COPY_CONSTRUCTOR(VecSaturationAdd); |
| 553 | }; |
| 554 | |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 555 | // Performs halving add on every component in the two vectors, viz. |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 556 | // rounded [ x1, .. , xn ] hradd [ y1, .. , yn ] = [ (x1 + y1 + 1) >> 1, .. , (xn + yn + 1) >> 1 ] |
| 557 | // truncated [ x1, .. , xn ] hadd [ y1, .. , yn ] = [ (x1 + y1) >> 1, .. , (xn + yn ) >> 1 ] |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 558 | // for either both signed or both unsigned operands x, y (reflected in packed_type). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 559 | class HVecHalvingAdd final : public HVecBinaryOperation { |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 560 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 561 | HVecHalvingAdd(ArenaAllocator* allocator, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 562 | HInstruction* left, |
| 563 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 564 | DataType::Type packed_type, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 565 | size_t vector_length, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 566 | bool is_rounded, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 567 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 568 | : HVecBinaryOperation( |
| 569 | kVecHalvingAdd, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 570 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 571 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 572 | SetPackedFlag<kFieldHAddIsRounded>(is_rounded); |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 573 | } |
| 574 | |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 575 | bool IsRounded() const { return GetPackedFlag<kFieldHAddIsRounded>(); } |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 576 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 577 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 578 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 579 | bool InstructionDataEquals(const HInstruction* other) const override { |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 580 | DCHECK(other->IsVecHalvingAdd()); |
| 581 | const HVecHalvingAdd* o = other->AsVecHalvingAdd(); |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 582 | return HVecOperation::InstructionDataEquals(o) && IsRounded() == o->IsRounded(); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 583 | } |
| 584 | |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 585 | DECLARE_INSTRUCTION(VecHalvingAdd); |
| 586 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 587 | protected: |
| 588 | DEFAULT_COPY_CONSTRUCTOR(VecHalvingAdd); |
| 589 | |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 590 | private: |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 591 | // Additional packed bits. |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 592 | static constexpr size_t kFieldHAddIsRounded = HVecOperation::kNumberOfVectorOpPackedBits; |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 593 | static constexpr size_t kNumberOfHAddPackedBits = kFieldHAddIsRounded + 1; |
| 594 | static_assert(kNumberOfHAddPackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 595 | }; |
| 596 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 597 | // Subtracts every component in the two vectors, |
| 598 | // viz. [ x1, .. , xn ] - [ y1, .. , yn ] = [ x1 - y1, .. , xn - yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 599 | class HVecSub final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 600 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 601 | HVecSub(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 602 | HInstruction* left, |
| 603 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 604 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 605 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 606 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 607 | : HVecBinaryOperation(kVecSub, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 608 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 609 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 610 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 611 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 612 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 613 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 614 | DECLARE_INSTRUCTION(VecSub); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 615 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 616 | protected: |
| 617 | DEFAULT_COPY_CONSTRUCTOR(VecSub); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 618 | }; |
| 619 | |
Aart Bik | 29aa082 | 2018-03-08 11:28:00 -0800 | [diff] [blame] | 620 | // Subtracts every component in the two vectors using saturation arithmetic, |
| 621 | // viz. [ x1, .. , xn ] + [ y1, .. , yn ] = [ x1 -_sat y1, .. , xn -_sat yn ] |
| 622 | // for either both signed or both unsigned operands x, y (reflected in packed_type). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 623 | class HVecSaturationSub final : public HVecBinaryOperation { |
Aart Bik | 29aa082 | 2018-03-08 11:28:00 -0800 | [diff] [blame] | 624 | public: |
| 625 | HVecSaturationSub(ArenaAllocator* allocator, |
| 626 | HInstruction* left, |
| 627 | HInstruction* right, |
| 628 | DataType::Type packed_type, |
| 629 | size_t vector_length, |
| 630 | uint32_t dex_pc) |
| 631 | : HVecBinaryOperation( |
| 632 | kVecSaturationSub, allocator, left, right, packed_type, vector_length, dex_pc) { |
| 633 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 634 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
| 635 | } |
| 636 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 637 | bool CanBeMoved() const override { return true; } |
Aart Bik | 29aa082 | 2018-03-08 11:28:00 -0800 | [diff] [blame] | 638 | |
| 639 | DECLARE_INSTRUCTION(VecSaturationSub); |
| 640 | |
| 641 | protected: |
| 642 | DEFAULT_COPY_CONSTRUCTOR(VecSaturationSub); |
| 643 | }; |
| 644 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 645 | // Multiplies every component in the two vectors, |
| 646 | // viz. [ x1, .. , xn ] * [ y1, .. , yn ] = [ x1 * y1, .. , xn * yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 647 | class HVecMul final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 648 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 649 | HVecMul(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 650 | HInstruction* left, |
| 651 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 652 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 653 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 654 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 655 | : HVecBinaryOperation(kVecMul, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 656 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 657 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 658 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 659 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 660 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 661 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 662 | DECLARE_INSTRUCTION(VecMul); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 663 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 664 | protected: |
| 665 | DEFAULT_COPY_CONSTRUCTOR(VecMul); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 666 | }; |
| 667 | |
| 668 | // Divides every component in the two vectors, |
| 669 | // viz. [ x1, .. , xn ] / [ y1, .. , yn ] = [ x1 / y1, .. , xn / yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 670 | class HVecDiv final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 671 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 672 | HVecDiv(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 673 | HInstruction* left, |
| 674 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 675 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 676 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 677 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 678 | : HVecBinaryOperation(kVecDiv, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 679 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 680 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 681 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 682 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 683 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 684 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 685 | DECLARE_INSTRUCTION(VecDiv); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 686 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 687 | protected: |
| 688 | DEFAULT_COPY_CONSTRUCTOR(VecDiv); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 689 | }; |
| 690 | |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 691 | // Takes minimum of every component in the two vectors, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 692 | // viz. MIN( [ x1, .. , xn ] , [ y1, .. , yn ]) = [ min(x1, y1), .. , min(xn, yn) ] |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 693 | // for either both signed or both unsigned operands x, y (reflected in packed_type). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 694 | class HVecMin final : public HVecBinaryOperation { |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 695 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 696 | HVecMin(ArenaAllocator* allocator, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 697 | HInstruction* left, |
| 698 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 699 | DataType::Type packed_type, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 700 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 701 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 702 | : HVecBinaryOperation(kVecMin, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 703 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 704 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 705 | } |
Aart Bik | c8e93c7 | 2017-05-10 10:49:22 -0700 | [diff] [blame] | 706 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 707 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 708 | |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 709 | DECLARE_INSTRUCTION(VecMin); |
Aart Bik | c8e93c7 | 2017-05-10 10:49:22 -0700 | [diff] [blame] | 710 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 711 | protected: |
| 712 | DEFAULT_COPY_CONSTRUCTOR(VecMin); |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 713 | }; |
| 714 | |
| 715 | // Takes maximum of every component in the two vectors, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 716 | // viz. MAX( [ x1, .. , xn ] , [ y1, .. , yn ]) = [ max(x1, y1), .. , max(xn, yn) ] |
Aart Bik | 66c158e | 2018-01-31 12:55:04 -0800 | [diff] [blame] | 717 | // for either both signed or both unsigned operands x, y (reflected in packed_type). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 718 | class HVecMax final : public HVecBinaryOperation { |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 719 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 720 | HVecMax(ArenaAllocator* allocator, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 721 | HInstruction* left, |
| 722 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 723 | DataType::Type packed_type, |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 724 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 725 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 726 | : HVecBinaryOperation(kVecMax, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 727 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
| 728 | DCHECK(HasConsistentPackedTypes(right, packed_type)); |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 729 | } |
Aart Bik | c8e93c7 | 2017-05-10 10:49:22 -0700 | [diff] [blame] | 730 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 731 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 732 | |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 733 | DECLARE_INSTRUCTION(VecMax); |
Aart Bik | c8e93c7 | 2017-05-10 10:49:22 -0700 | [diff] [blame] | 734 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 735 | protected: |
| 736 | DEFAULT_COPY_CONSTRUCTOR(VecMax); |
Aart Bik | f3e61ee | 2017-04-12 17:09:20 -0700 | [diff] [blame] | 737 | }; |
| 738 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 739 | // Bitwise-ands every component in the two vectors, |
| 740 | // viz. [ x1, .. , xn ] & [ y1, .. , yn ] = [ x1 & y1, .. , xn & yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 741 | class HVecAnd final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 742 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 743 | HVecAnd(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 744 | HInstruction* left, |
| 745 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 746 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 747 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 748 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 749 | : HVecBinaryOperation(kVecAnd, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 750 | DCHECK(left->IsVecOperation() && right->IsVecOperation()); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 751 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 752 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 753 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 754 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 755 | DECLARE_INSTRUCTION(VecAnd); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 756 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 757 | protected: |
| 758 | DEFAULT_COPY_CONSTRUCTOR(VecAnd); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 759 | }; |
| 760 | |
| 761 | // Bitwise-and-nots every component in the two vectors, |
| 762 | // viz. [ x1, .. , xn ] and-not [ y1, .. , yn ] = [ ~x1 & y1, .. , ~xn & yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 763 | class HVecAndNot final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 764 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 765 | HVecAndNot(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 766 | HInstruction* left, |
| 767 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 768 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 769 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 770 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 771 | : HVecBinaryOperation( |
| 772 | kVecAndNot, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 773 | DCHECK(left->IsVecOperation() && right->IsVecOperation()); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 774 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 775 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 776 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 777 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 778 | DECLARE_INSTRUCTION(VecAndNot); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 779 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 780 | protected: |
| 781 | DEFAULT_COPY_CONSTRUCTOR(VecAndNot); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 782 | }; |
| 783 | |
| 784 | // Bitwise-ors every component in the two vectors, |
| 785 | // viz. [ x1, .. , xn ] | [ y1, .. , yn ] = [ x1 | y1, .. , xn | yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 786 | class HVecOr final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 787 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 788 | HVecOr(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 789 | HInstruction* left, |
| 790 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 791 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 792 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 793 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 794 | : HVecBinaryOperation(kVecOr, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 795 | DCHECK(left->IsVecOperation() && right->IsVecOperation()); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 796 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 797 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 798 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 799 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 800 | DECLARE_INSTRUCTION(VecOr); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 801 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 802 | protected: |
| 803 | DEFAULT_COPY_CONSTRUCTOR(VecOr); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 804 | }; |
| 805 | |
| 806 | // Bitwise-xors every component in the two vectors, |
| 807 | // viz. [ x1, .. , xn ] ^ [ y1, .. , yn ] = [ x1 ^ y1, .. , xn ^ yn ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 808 | class HVecXor final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 809 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 810 | HVecXor(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 811 | HInstruction* left, |
| 812 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 813 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 814 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 815 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 816 | : HVecBinaryOperation(kVecXor, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 817 | DCHECK(left->IsVecOperation() && right->IsVecOperation()); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 818 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 819 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 820 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 821 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 822 | DECLARE_INSTRUCTION(VecXor); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 823 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 824 | protected: |
| 825 | DEFAULT_COPY_CONSTRUCTOR(VecXor); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 826 | }; |
| 827 | |
| 828 | // Logically shifts every component in the vector left by the given distance, |
| 829 | // viz. [ x1, .. , xn ] << d = [ x1 << d, .. , xn << d ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 830 | class HVecShl final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 831 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 832 | HVecShl(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 833 | HInstruction* left, |
| 834 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 835 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 836 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 837 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 838 | : HVecBinaryOperation(kVecShl, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 839 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 840 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 841 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 842 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 843 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 844 | DECLARE_INSTRUCTION(VecShl); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 845 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 846 | protected: |
| 847 | DEFAULT_COPY_CONSTRUCTOR(VecShl); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 848 | }; |
| 849 | |
| 850 | // Arithmetically shifts every component in the vector right by the given distance, |
| 851 | // viz. [ x1, .. , xn ] >> d = [ x1 >> d, .. , xn >> d ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 852 | class HVecShr final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 853 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 854 | HVecShr(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 855 | HInstruction* left, |
| 856 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 857 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 858 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 859 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 860 | : HVecBinaryOperation(kVecShr, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 861 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 862 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 863 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 864 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 865 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 866 | DECLARE_INSTRUCTION(VecShr); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 867 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 868 | protected: |
| 869 | DEFAULT_COPY_CONSTRUCTOR(VecShr); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 870 | }; |
| 871 | |
| 872 | // Logically shifts every component in the vector right by the given distance, |
| 873 | // viz. [ x1, .. , xn ] >>> d = [ x1 >>> d, .. , xn >>> d ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 874 | class HVecUShr final : public HVecBinaryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 875 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 876 | HVecUShr(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 877 | HInstruction* left, |
| 878 | HInstruction* right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 879 | DataType::Type packed_type, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 880 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 881 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 882 | : HVecBinaryOperation(kVecUShr, allocator, left, right, packed_type, vector_length, dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 883 | DCHECK(HasConsistentPackedTypes(left, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 884 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 885 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 886 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 887 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 888 | DECLARE_INSTRUCTION(VecUShr); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 889 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 890 | protected: |
| 891 | DEFAULT_COPY_CONSTRUCTOR(VecUShr); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 892 | }; |
| 893 | |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 894 | // |
| 895 | // Definitions of concrete miscellaneous vector operations in HIR. |
| 896 | // |
| 897 | |
| 898 | // Assigns the given scalar elements to a vector, |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 899 | // viz. set( array(x1, .. , xn) ) = [ x1, .. , xn ] if n == m, |
| 900 | // set( array(x1, .. , xm) ) = [ x1, .. , xm, 0, .. , 0 ] if m < n. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 901 | class HVecSetScalars final : public HVecOperation { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 902 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 903 | HVecSetScalars(ArenaAllocator* allocator, |
Aart Bik | 5e3afa9 | 2017-09-20 14:11:11 -0700 | [diff] [blame] | 904 | HInstruction* scalars[], |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 905 | DataType::Type packed_type, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 906 | size_t vector_length, |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 907 | size_t number_of_scalars, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 908 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 909 | : HVecOperation(kVecSetScalars, |
| 910 | allocator, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 911 | packed_type, |
| 912 | SideEffects::None(), |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 913 | number_of_scalars, |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 914 | vector_length, |
| 915 | dex_pc) { |
Aart Bik | 0148de4 | 2017-09-05 09:25:01 -0700 | [diff] [blame] | 916 | for (size_t i = 0; i < number_of_scalars; i++) { |
Aart Bik | 2dd7b67 | 2017-12-07 11:11:22 -0800 | [diff] [blame] | 917 | DCHECK(!ReturnsSIMDValue(scalars[i])); |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 918 | SetRawInputAt(0, scalars[i]); |
| 919 | } |
| 920 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 921 | |
| 922 | // Setting scalars needs to stay in place, since SIMD registers are not |
| 923 | // kept alive across vector loop boundaries (yet). |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 924 | bool CanBeMoved() const override { return false; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 925 | |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 926 | DECLARE_INSTRUCTION(VecSetScalars); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 927 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 928 | protected: |
| 929 | DEFAULT_COPY_CONSTRUCTOR(VecSetScalars); |
Aart Bik | 8de5916 | 2017-04-21 09:42:01 -0700 | [diff] [blame] | 930 | }; |
| 931 | |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 932 | // Multiplies every component in the two vectors, adds the result vector to the accumulator vector, |
| 933 | // viz. [ a1, .. , an ] + [ x1, .. , xn ] * [ y1, .. , yn ] = [ a1 + x1 * y1, .. , an + xn * yn ]. |
Hans Boehm | 9434487 | 2018-07-13 09:57:50 -0700 | [diff] [blame] | 934 | // For floating point types, Java rounding behavior must be preserved; the products are rounded to |
| 935 | // the proper precision before being added. "Fused" multiply-add operations available on several |
| 936 | // architectures are not usable since they would violate Java language rules. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 937 | class HVecMultiplyAccumulate final : public HVecOperation { |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 938 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 939 | HVecMultiplyAccumulate(ArenaAllocator* allocator, |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 940 | InstructionKind op, |
| 941 | HInstruction* accumulator, |
| 942 | HInstruction* mul_left, |
| 943 | HInstruction* mul_right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 944 | DataType::Type packed_type, |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 945 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 946 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 947 | : HVecOperation(kVecMultiplyAccumulate, |
| 948 | allocator, |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 949 | packed_type, |
| 950 | SideEffects::None(), |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 951 | /* number_of_inputs= */ 3, |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 952 | vector_length, |
| 953 | dex_pc), |
| 954 | op_kind_(op) { |
| 955 | DCHECK(op == InstructionKind::kAdd || op == InstructionKind::kSub); |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 956 | DCHECK(HasConsistentPackedTypes(accumulator, packed_type)); |
| 957 | DCHECK(HasConsistentPackedTypes(mul_left, packed_type)); |
| 958 | DCHECK(HasConsistentPackedTypes(mul_right, packed_type)); |
Hans Boehm | 9434487 | 2018-07-13 09:57:50 -0700 | [diff] [blame] | 959 | // Remove the following if we add an architecture that supports floating point multiply-add |
| 960 | // with Java-compatible rounding. |
| 961 | DCHECK(DataType::IsIntegralType(packed_type)); |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 962 | SetRawInputAt(0, accumulator); |
| 963 | SetRawInputAt(1, mul_left); |
| 964 | SetRawInputAt(2, mul_right); |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 965 | } |
| 966 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 967 | bool CanBeMoved() const override { return true; } |
Nicolas Geoffray | 9858bf7 | 2017-07-08 12:34:55 +0000 | [diff] [blame] | 968 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 969 | bool InstructionDataEquals(const HInstruction* other) const override { |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 970 | DCHECK(other->IsVecMultiplyAccumulate()); |
| 971 | const HVecMultiplyAccumulate* o = other->AsVecMultiplyAccumulate(); |
| 972 | return HVecOperation::InstructionDataEquals(o) && GetOpKind() == o->GetOpKind(); |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 973 | } |
| 974 | |
| 975 | InstructionKind GetOpKind() const { return op_kind_; } |
| 976 | |
| 977 | DECLARE_INSTRUCTION(VecMultiplyAccumulate); |
| 978 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 979 | protected: |
| 980 | DEFAULT_COPY_CONSTRUCTOR(VecMultiplyAccumulate); |
| 981 | |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 982 | private: |
| 983 | // Indicates if this is a MADD or MSUB. |
| 984 | const InstructionKind op_kind_; |
Artem Serov | f34dd20 | 2017-04-10 17:41:46 +0100 | [diff] [blame] | 985 | }; |
| 986 | |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 987 | // Takes the absolute difference of two vectors, and adds the results to |
| 988 | // same-precision or wider-precision components in the accumulator, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 989 | // viz. SAD([ a1, .. , am ], [ x1, .. , xn ], [ y1, .. , yn ]) = |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 990 | // [ a1 + sum abs(xi-yi), .. , am + sum abs(xj-yj) ], |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 991 | // for m <= n, non-overlapping sums, and signed operands x, y. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 992 | class HVecSADAccumulate final : public HVecOperation { |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 993 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 994 | HVecSADAccumulate(ArenaAllocator* allocator, |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 995 | HInstruction* accumulator, |
| 996 | HInstruction* sad_left, |
| 997 | HInstruction* sad_right, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 998 | DataType::Type packed_type, |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 999 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 1000 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 1001 | : HVecOperation(kVecSADAccumulate, |
| 1002 | allocator, |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 1003 | packed_type, |
| 1004 | SideEffects::None(), |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 1005 | /* number_of_inputs= */ 3, |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 1006 | vector_length, |
| 1007 | dex_pc) { |
| 1008 | DCHECK(HasConsistentPackedTypes(accumulator, packed_type)); |
| 1009 | DCHECK(sad_left->IsVecOperation()); |
| 1010 | DCHECK(sad_right->IsVecOperation()); |
Vladimir Marko | 61b9228 | 2017-10-11 13:23:17 +0100 | [diff] [blame] | 1011 | DCHECK_EQ(ToSignedType(sad_left->AsVecOperation()->GetPackedType()), |
| 1012 | ToSignedType(sad_right->AsVecOperation()->GetPackedType())); |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 1013 | SetRawInputAt(0, accumulator); |
| 1014 | SetRawInputAt(1, sad_left); |
| 1015 | SetRawInputAt(2, sad_right); |
| 1016 | } |
| 1017 | |
| 1018 | DECLARE_INSTRUCTION(VecSADAccumulate); |
| 1019 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 1020 | protected: |
| 1021 | DEFAULT_COPY_CONSTRUCTOR(VecSADAccumulate); |
Aart Bik | dbbac8f | 2017-09-01 13:06:08 -0700 | [diff] [blame] | 1022 | }; |
| 1023 | |
Artem Serov | aaac0e3 | 2018-08-07 00:52:22 +0100 | [diff] [blame] | 1024 | // Performs dot product of two vectors and adds the result to wider precision components in |
| 1025 | // the accumulator. |
| 1026 | // |
| 1027 | // viz. DOT_PRODUCT([ a1, .. , am], [ x1, .. , xn ], [ y1, .. , yn ]) = |
| 1028 | // [ a1 + sum(xi * yi), .. , am + sum(xj * yj) ], |
| 1029 | // for m <= n, non-overlapping sums, |
| 1030 | // for either both signed or both unsigned operands x, y. |
| 1031 | // |
| 1032 | // Notes: |
| 1033 | // - packed type reflects the type of sum reduction, not the type of the operands. |
| 1034 | // - IsZeroExtending() is used to determine the kind of signed/zero extension to be |
| 1035 | // performed for the operands. |
| 1036 | // |
| 1037 | // TODO: Support types other than kInt32 for packed type. |
| 1038 | class HVecDotProd final : public HVecOperation { |
| 1039 | public: |
| 1040 | HVecDotProd(ArenaAllocator* allocator, |
| 1041 | HInstruction* accumulator, |
| 1042 | HInstruction* left, |
| 1043 | HInstruction* right, |
| 1044 | DataType::Type packed_type, |
| 1045 | bool is_zero_extending, |
| 1046 | size_t vector_length, |
| 1047 | uint32_t dex_pc) |
| 1048 | : HVecOperation(kVecDotProd, |
| 1049 | allocator, |
| 1050 | packed_type, |
| 1051 | SideEffects::None(), |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 1052 | /* number_of_inputs= */ 3, |
Artem Serov | aaac0e3 | 2018-08-07 00:52:22 +0100 | [diff] [blame] | 1053 | vector_length, |
| 1054 | dex_pc) { |
| 1055 | DCHECK(HasConsistentPackedTypes(accumulator, packed_type)); |
| 1056 | DCHECK(DataType::IsIntegralType(packed_type)); |
| 1057 | DCHECK(left->IsVecOperation()); |
| 1058 | DCHECK(right->IsVecOperation()); |
| 1059 | DCHECK_EQ(ToSignedType(left->AsVecOperation()->GetPackedType()), |
| 1060 | ToSignedType(right->AsVecOperation()->GetPackedType())); |
| 1061 | SetRawInputAt(0, accumulator); |
| 1062 | SetRawInputAt(1, left); |
| 1063 | SetRawInputAt(2, right); |
| 1064 | SetPackedFlag<kFieldHDotProdIsZeroExtending>(is_zero_extending); |
| 1065 | } |
| 1066 | |
| 1067 | bool IsZeroExtending() const { return GetPackedFlag<kFieldHDotProdIsZeroExtending>(); } |
| 1068 | |
| 1069 | bool CanBeMoved() const override { return true; } |
| 1070 | |
| 1071 | DECLARE_INSTRUCTION(VecDotProd); |
| 1072 | |
| 1073 | protected: |
| 1074 | DEFAULT_COPY_CONSTRUCTOR(VecDotProd); |
| 1075 | |
| 1076 | private: |
| 1077 | // Additional packed bits. |
| 1078 | static constexpr size_t kFieldHDotProdIsZeroExtending = |
| 1079 | HVecOperation::kNumberOfVectorOpPackedBits; |
| 1080 | static constexpr size_t kNumberOfHDotProdPackedBits = kFieldHDotProdIsZeroExtending + 1; |
| 1081 | static_assert(kNumberOfHDotProdPackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); |
| 1082 | }; |
| 1083 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1084 | // Loads a vector from memory, viz. load(mem, 1) |
| 1085 | // yield the vector [ mem(1), .. , mem(n) ]. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 1086 | class HVecLoad final : public HVecMemoryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1087 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 1088 | HVecLoad(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1089 | HInstruction* base, |
| 1090 | HInstruction* index, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 1091 | DataType::Type packed_type, |
Vladimir Marko | d5d2f2c | 2017-09-26 12:37:26 +0100 | [diff] [blame] | 1092 | SideEffects side_effects, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1093 | size_t vector_length, |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 1094 | bool is_string_char_at, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 1095 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 1096 | : HVecMemoryOperation(kVecLoad, |
| 1097 | allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1098 | packed_type, |
Vladimir Marko | d5d2f2c | 2017-09-26 12:37:26 +0100 | [diff] [blame] | 1099 | side_effects, |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 1100 | /* number_of_inputs= */ 2, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1101 | vector_length, |
| 1102 | dex_pc) { |
| 1103 | SetRawInputAt(0, base); |
| 1104 | SetRawInputAt(1, index); |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 1105 | SetPackedFlag<kFieldIsStringCharAt>(is_string_char_at); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1106 | } |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 1107 | |
| 1108 | bool IsStringCharAt() const { return GetPackedFlag<kFieldIsStringCharAt>(); } |
| 1109 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 1110 | bool CanBeMoved() const override { return true; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 1111 | |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 1112 | bool InstructionDataEquals(const HInstruction* other) const override { |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 1113 | DCHECK(other->IsVecLoad()); |
| 1114 | const HVecLoad* o = other->AsVecLoad(); |
| 1115 | return HVecMemoryOperation::InstructionDataEquals(o) && IsStringCharAt() == o->IsStringCharAt(); |
| 1116 | } |
| 1117 | |
| 1118 | DECLARE_INSTRUCTION(VecLoad); |
| 1119 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 1120 | protected: |
| 1121 | DEFAULT_COPY_CONSTRUCTOR(VecLoad); |
| 1122 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1123 | private: |
Aart Bik | db14fcf | 2017-04-25 15:53:58 -0700 | [diff] [blame] | 1124 | // Additional packed bits. |
| 1125 | static constexpr size_t kFieldIsStringCharAt = HVecOperation::kNumberOfVectorOpPackedBits; |
| 1126 | static constexpr size_t kNumberOfVecLoadPackedBits = kFieldIsStringCharAt + 1; |
| 1127 | static_assert(kNumberOfVecLoadPackedBits <= kMaxNumberOfPackedBits, "Too many packed fields."); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1128 | }; |
| 1129 | |
| 1130 | // Stores a vector to memory, viz. store(m, 1, [x1, .. , xn] ) |
| 1131 | // sets mem(1) = x1, .. , mem(n) = xn. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 1132 | class HVecStore final : public HVecMemoryOperation { |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1133 | public: |
Vladimir Marko | e764d2e | 2017-10-05 14:35:55 +0100 | [diff] [blame] | 1134 | HVecStore(ArenaAllocator* allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1135 | HInstruction* base, |
| 1136 | HInstruction* index, |
| 1137 | HInstruction* value, |
Vladimir Marko | 0ebe0d8 | 2017-09-21 22:50:39 +0100 | [diff] [blame] | 1138 | DataType::Type packed_type, |
Vladimir Marko | d5d2f2c | 2017-09-26 12:37:26 +0100 | [diff] [blame] | 1139 | SideEffects side_effects, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1140 | size_t vector_length, |
Aart Bik | 46b6dbc | 2017-10-03 11:37:37 -0700 | [diff] [blame] | 1141 | uint32_t dex_pc) |
Gupta Kumar, Sanjiv | d9e4d73 | 2018-02-05 13:35:03 +0530 | [diff] [blame] | 1142 | : HVecMemoryOperation(kVecStore, |
| 1143 | allocator, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1144 | packed_type, |
Vladimir Marko | d5d2f2c | 2017-09-26 12:37:26 +0100 | [diff] [blame] | 1145 | side_effects, |
Andreas Gampe | 3db7068 | 2018-12-26 15:12:03 -0800 | [diff] [blame] | 1146 | /* number_of_inputs= */ 3, |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1147 | vector_length, |
| 1148 | dex_pc) { |
Aart Bik | d58bc32 | 2017-05-01 14:49:18 -0700 | [diff] [blame] | 1149 | DCHECK(HasConsistentPackedTypes(value, packed_type)); |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1150 | SetRawInputAt(0, base); |
| 1151 | SetRawInputAt(1, index); |
| 1152 | SetRawInputAt(2, value); |
| 1153 | } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 1154 | |
| 1155 | // A store needs to stay in place. |
Roland Levillain | bbc6e7e | 2018-08-24 16:58:47 +0100 | [diff] [blame] | 1156 | bool CanBeMoved() const override { return false; } |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 1157 | |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1158 | DECLARE_INSTRUCTION(VecStore); |
Aart Bik | b79f4ac | 2017-07-10 10:10:37 -0700 | [diff] [blame] | 1159 | |
Artem Serov | cced8ba | 2017-07-19 18:18:09 +0100 | [diff] [blame] | 1160 | protected: |
| 1161 | DEFAULT_COPY_CONSTRUCTOR(VecStore) |
Aart Bik | f8f5a16 | 2017-02-06 15:35:29 -0800 | [diff] [blame] | 1162 | }; |
| 1163 | |
| 1164 | } // namespace art |
| 1165 | |
| 1166 | #endif // ART_COMPILER_OPTIMIZING_NODES_VECTOR_H_ |