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 #include "code_generator_arm.h"
18 
19 namespace art {
20 namespace arm {
21 
22 // NOLINT on __ macro to suppress wrong warning/fix (misc-macro-parentheses) from clang-tidy.
23 #define __ down_cast<ArmAssembler*>(GetAssembler())->  // NOLINT
24 
VisitVecReplicateScalar(HVecReplicateScalar * instruction)25 void LocationsBuilderARM::VisitVecReplicateScalar(HVecReplicateScalar* instruction) {
26   LOG(FATAL) << "No SIMD for " << instruction->GetId();
27 }
28 
VisitVecReplicateScalar(HVecReplicateScalar * instruction)29 void InstructionCodeGeneratorARM::VisitVecReplicateScalar(HVecReplicateScalar* instruction) {
30   LOG(FATAL) << "No SIMD for " << instruction->GetId();
31 }
32 
VisitVecSetScalars(HVecSetScalars * instruction)33 void LocationsBuilderARM::VisitVecSetScalars(HVecSetScalars* instruction) {
34   LOG(FATAL) << "No SIMD for " << instruction->GetId();
35 }
36 
VisitVecSetScalars(HVecSetScalars * instruction)37 void InstructionCodeGeneratorARM::VisitVecSetScalars(HVecSetScalars* instruction) {
38   LOG(FATAL) << "No SIMD for " << instruction->GetId();
39 }
40 
VisitVecSumReduce(HVecSumReduce * instruction)41 void LocationsBuilderARM::VisitVecSumReduce(HVecSumReduce* instruction) {
42   LOG(FATAL) << "No SIMD for " << instruction->GetId();
43 }
44 
VisitVecSumReduce(HVecSumReduce * instruction)45 void InstructionCodeGeneratorARM::VisitVecSumReduce(HVecSumReduce* instruction) {
46   LOG(FATAL) << "No SIMD for " << instruction->GetId();
47 }
48 
49 // Helper to set up locations for vector unary operations.
CreateVecUnOpLocations(ArenaAllocator * arena,HVecUnaryOperation * instruction)50 static void CreateVecUnOpLocations(ArenaAllocator* arena, HVecUnaryOperation* instruction) {
51   LocationSummary* locations = new (arena) LocationSummary(instruction);
52   switch (instruction->GetPackedType()) {
53     case Primitive::kPrimBoolean:
54     case Primitive::kPrimByte:
55     case Primitive::kPrimChar:
56     case Primitive::kPrimShort:
57     case Primitive::kPrimInt:
58     case Primitive::kPrimFloat:
59     case Primitive::kPrimDouble:
60       DCHECK(locations);
61       break;
62     default:
63       LOG(FATAL) << "Unsupported SIMD type";
64       UNREACHABLE();
65   }
66 }
67 
VisitVecCnv(HVecCnv * instruction)68 void LocationsBuilderARM::VisitVecCnv(HVecCnv* instruction) {
69   CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
70 }
71 
VisitVecCnv(HVecCnv * instruction)72 void InstructionCodeGeneratorARM::VisitVecCnv(HVecCnv* instruction) {
73   LOG(FATAL) << "No SIMD for " << instruction->GetId();
74 }
75 
VisitVecNeg(HVecNeg * instruction)76 void LocationsBuilderARM::VisitVecNeg(HVecNeg* instruction) {
77   CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
78 }
79 
VisitVecNeg(HVecNeg * instruction)80 void InstructionCodeGeneratorARM::VisitVecNeg(HVecNeg* instruction) {
81   LOG(FATAL) << "No SIMD for " << instruction->GetId();
82 }
83 
VisitVecAbs(HVecAbs * instruction)84 void LocationsBuilderARM::VisitVecAbs(HVecAbs* instruction) {
85   CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
86 }
87 
VisitVecAbs(HVecAbs * instruction)88 void InstructionCodeGeneratorARM::VisitVecAbs(HVecAbs* instruction) {
89   LOG(FATAL) << "No SIMD for " << instruction->GetId();
90 }
91 
VisitVecNot(HVecNot * instruction)92 void LocationsBuilderARM::VisitVecNot(HVecNot* instruction) {
93   CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
94 }
95 
VisitVecNot(HVecNot * instruction)96 void InstructionCodeGeneratorARM::VisitVecNot(HVecNot* instruction) {
97   LOG(FATAL) << "No SIMD for " << instruction->GetId();
98 }
99 
100 // Helper to set up locations for vector binary operations.
CreateVecBinOpLocations(ArenaAllocator * arena,HVecBinaryOperation * instruction)101 static void CreateVecBinOpLocations(ArenaAllocator* arena, HVecBinaryOperation* instruction) {
102   LocationSummary* locations = new (arena) LocationSummary(instruction);
103   switch (instruction->GetPackedType()) {
104     case Primitive::kPrimBoolean:
105     case Primitive::kPrimByte:
106     case Primitive::kPrimChar:
107     case Primitive::kPrimShort:
108     case Primitive::kPrimInt:
109     case Primitive::kPrimFloat:
110     case Primitive::kPrimDouble:
111       DCHECK(locations);
112       break;
113     default:
114       LOG(FATAL) << "Unsupported SIMD type";
115       UNREACHABLE();
116   }
117 }
118 
VisitVecAdd(HVecAdd * instruction)119 void LocationsBuilderARM::VisitVecAdd(HVecAdd* instruction) {
120   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
121 }
122 
VisitVecAdd(HVecAdd * instruction)123 void InstructionCodeGeneratorARM::VisitVecAdd(HVecAdd* instruction) {
124   LOG(FATAL) << "No SIMD for " << instruction->GetId();
125 }
126 
VisitVecHalvingAdd(HVecHalvingAdd * instruction)127 void LocationsBuilderARM::VisitVecHalvingAdd(HVecHalvingAdd* instruction) {
128   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
129 }
130 
VisitVecHalvingAdd(HVecHalvingAdd * instruction)131 void InstructionCodeGeneratorARM::VisitVecHalvingAdd(HVecHalvingAdd* instruction) {
132   LOG(FATAL) << "No SIMD for " << instruction->GetId();
133 }
134 
VisitVecSub(HVecSub * instruction)135 void LocationsBuilderARM::VisitVecSub(HVecSub* instruction) {
136   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
137 }
138 
VisitVecSub(HVecSub * instruction)139 void InstructionCodeGeneratorARM::VisitVecSub(HVecSub* instruction) {
140   LOG(FATAL) << "No SIMD for " << instruction->GetId();
141 }
142 
VisitVecMul(HVecMul * instruction)143 void LocationsBuilderARM::VisitVecMul(HVecMul* instruction) {
144   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
145 }
146 
VisitVecMul(HVecMul * instruction)147 void InstructionCodeGeneratorARM::VisitVecMul(HVecMul* instruction) {
148   LOG(FATAL) << "No SIMD for " << instruction->GetId();
149 }
150 
VisitVecDiv(HVecDiv * instruction)151 void LocationsBuilderARM::VisitVecDiv(HVecDiv* instruction) {
152   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
153 }
154 
VisitVecDiv(HVecDiv * instruction)155 void InstructionCodeGeneratorARM::VisitVecDiv(HVecDiv* instruction) {
156   LOG(FATAL) << "No SIMD for " << instruction->GetId();
157 }
158 
VisitVecMin(HVecMin * instruction)159 void LocationsBuilderARM::VisitVecMin(HVecMin* instruction) {
160   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
161 }
162 
VisitVecMin(HVecMin * instruction)163 void InstructionCodeGeneratorARM::VisitVecMin(HVecMin* instruction) {
164   LOG(FATAL) << "No SIMD for " << instruction->GetId();
165 }
166 
VisitVecMax(HVecMax * instruction)167 void LocationsBuilderARM::VisitVecMax(HVecMax* instruction) {
168   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
169 }
170 
VisitVecMax(HVecMax * instruction)171 void InstructionCodeGeneratorARM::VisitVecMax(HVecMax* instruction) {
172   LOG(FATAL) << "No SIMD for " << instruction->GetId();
173 }
174 
VisitVecAnd(HVecAnd * instruction)175 void LocationsBuilderARM::VisitVecAnd(HVecAnd* instruction) {
176   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
177 }
178 
VisitVecAnd(HVecAnd * instruction)179 void InstructionCodeGeneratorARM::VisitVecAnd(HVecAnd* instruction) {
180   LOG(FATAL) << "No SIMD for " << instruction->GetId();
181 }
182 
VisitVecAndNot(HVecAndNot * instruction)183 void LocationsBuilderARM::VisitVecAndNot(HVecAndNot* instruction) {
184   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
185 }
186 
VisitVecAndNot(HVecAndNot * instruction)187 void InstructionCodeGeneratorARM::VisitVecAndNot(HVecAndNot* instruction) {
188   LOG(FATAL) << "No SIMD for " << instruction->GetId();
189 }
190 
VisitVecOr(HVecOr * instruction)191 void LocationsBuilderARM::VisitVecOr(HVecOr* instruction) {
192   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
193 }
194 
VisitVecOr(HVecOr * instruction)195 void InstructionCodeGeneratorARM::VisitVecOr(HVecOr* instruction) {
196   LOG(FATAL) << "No SIMD for " << instruction->GetId();
197 }
198 
VisitVecXor(HVecXor * instruction)199 void LocationsBuilderARM::VisitVecXor(HVecXor* instruction) {
200   CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
201 }
202 
VisitVecXor(HVecXor * instruction)203 void InstructionCodeGeneratorARM::VisitVecXor(HVecXor* instruction) {
204   LOG(FATAL) << "No SIMD for " << instruction->GetId();
205 }
206 
207 // Helper to set up locations for vector shift operations.
CreateVecShiftLocations(ArenaAllocator * arena,HVecBinaryOperation * instruction)208 static void CreateVecShiftLocations(ArenaAllocator* arena, HVecBinaryOperation* instruction) {
209   LocationSummary* locations = new (arena) LocationSummary(instruction);
210   switch (instruction->GetPackedType()) {
211     case Primitive::kPrimByte:
212     case Primitive::kPrimChar:
213     case Primitive::kPrimShort:
214     case Primitive::kPrimInt:
215     case Primitive::kPrimLong:
216       DCHECK(locations);
217       break;
218     default:
219       LOG(FATAL) << "Unsupported SIMD type";
220       UNREACHABLE();
221   }
222 }
223 
VisitVecShl(HVecShl * instruction)224 void LocationsBuilderARM::VisitVecShl(HVecShl* instruction) {
225   CreateVecShiftLocations(GetGraph()->GetArena(), instruction);
226 }
227 
VisitVecShl(HVecShl * instruction)228 void InstructionCodeGeneratorARM::VisitVecShl(HVecShl* instruction) {
229   LOG(FATAL) << "No SIMD for " << instruction->GetId();
230 }
231 
VisitVecShr(HVecShr * instruction)232 void LocationsBuilderARM::VisitVecShr(HVecShr* instruction) {
233   CreateVecShiftLocations(GetGraph()->GetArena(), instruction);
234 }
235 
VisitVecShr(HVecShr * instruction)236 void InstructionCodeGeneratorARM::VisitVecShr(HVecShr* instruction) {
237   LOG(FATAL) << "No SIMD for " << instruction->GetId();
238 }
239 
VisitVecUShr(HVecUShr * instruction)240 void LocationsBuilderARM::VisitVecUShr(HVecUShr* instruction) {
241   CreateVecShiftLocations(GetGraph()->GetArena(), instruction);
242 }
243 
VisitVecUShr(HVecUShr * instruction)244 void InstructionCodeGeneratorARM::VisitVecUShr(HVecUShr* instruction) {
245   LOG(FATAL) << "No SIMD for " << instruction->GetId();
246 }
247 
VisitVecMultiplyAccumulate(HVecMultiplyAccumulate * instr)248 void LocationsBuilderARM::VisitVecMultiplyAccumulate(HVecMultiplyAccumulate* instr) {
249   LOG(FATAL) << "No SIMD for " << instr->GetId();
250 }
251 
VisitVecMultiplyAccumulate(HVecMultiplyAccumulate * instr)252 void InstructionCodeGeneratorARM::VisitVecMultiplyAccumulate(HVecMultiplyAccumulate* instr) {
253   LOG(FATAL) << "No SIMD for " << instr->GetId();
254 }
255 
VisitVecLoad(HVecLoad * instruction)256 void LocationsBuilderARM::VisitVecLoad(HVecLoad* instruction) {
257   LOG(FATAL) << "No SIMD for " << instruction->GetId();
258 }
259 
VisitVecLoad(HVecLoad * instruction)260 void InstructionCodeGeneratorARM::VisitVecLoad(HVecLoad* instruction) {
261   LOG(FATAL) << "No SIMD for " << instruction->GetId();
262 }
263 
VisitVecStore(HVecStore * instruction)264 void LocationsBuilderARM::VisitVecStore(HVecStore* instruction) {
265   LOG(FATAL) << "No SIMD for " << instruction->GetId();
266 }
267 
VisitVecStore(HVecStore * instruction)268 void InstructionCodeGeneratorARM::VisitVecStore(HVecStore* instruction) {
269   LOG(FATAL) << "No SIMD for " << instruction->GetId();
270 }
271 
272 #undef __
273 
274 }  // namespace arm
275 }  // namespace art
276