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_mips64.h"
18
19namespace art {
20namespace mips64 {
21
22// NOLINT on __ macro to suppress wrong warning/fix (misc-macro-parentheses) from clang-tidy.
23#define __ down_cast<Mips64Assembler*>(GetAssembler())->  // NOLINT
24
25void LocationsBuilderMIPS64::VisitVecReplicateScalar(HVecReplicateScalar* instruction) {
26  LOG(FATAL) << "No SIMD for " << instruction->GetId();
27}
28
29void InstructionCodeGeneratorMIPS64::VisitVecReplicateScalar(HVecReplicateScalar* instruction) {
30  LOG(FATAL) << "No SIMD for " << instruction->GetId();
31}
32
33void LocationsBuilderMIPS64::VisitVecSetScalars(HVecSetScalars* instruction) {
34  LOG(FATAL) << "No SIMD for " << instruction->GetId();
35}
36
37void InstructionCodeGeneratorMIPS64::VisitVecSetScalars(HVecSetScalars* instruction) {
38  LOG(FATAL) << "No SIMD for " << instruction->GetId();
39}
40
41void LocationsBuilderMIPS64::VisitVecSumReduce(HVecSumReduce* instruction) {
42  LOG(FATAL) << "No SIMD for " << instruction->GetId();
43}
44
45void InstructionCodeGeneratorMIPS64::VisitVecSumReduce(HVecSumReduce* instruction) {
46  LOG(FATAL) << "No SIMD for " << instruction->GetId();
47}
48
49// Helper to set up locations for vector unary operations.
50static 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
68void LocationsBuilderMIPS64::VisitVecCnv(HVecCnv* instruction) {
69  CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
70}
71
72void InstructionCodeGeneratorMIPS64::VisitVecCnv(HVecCnv* instruction) {
73  LOG(FATAL) << "No SIMD for " << instruction->GetId();
74}
75
76void LocationsBuilderMIPS64::VisitVecNeg(HVecNeg* instruction) {
77  CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
78}
79
80void InstructionCodeGeneratorMIPS64::VisitVecNeg(HVecNeg* instruction) {
81  LOG(FATAL) << "No SIMD for " << instruction->GetId();
82}
83
84void LocationsBuilderMIPS64::VisitVecAbs(HVecAbs* instruction) {
85  CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
86}
87
88void InstructionCodeGeneratorMIPS64::VisitVecAbs(HVecAbs* instruction) {
89  LOG(FATAL) << "No SIMD for " << instruction->GetId();
90}
91
92void LocationsBuilderMIPS64::VisitVecNot(HVecNot* instruction) {
93  CreateVecUnOpLocations(GetGraph()->GetArena(), instruction);
94}
95
96void InstructionCodeGeneratorMIPS64::VisitVecNot(HVecNot* instruction) {
97  LOG(FATAL) << "No SIMD for " << instruction->GetId();
98}
99
100// Helper to set up locations for vector binary operations.
101static 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
119void LocationsBuilderMIPS64::VisitVecAdd(HVecAdd* instruction) {
120  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
121}
122
123void InstructionCodeGeneratorMIPS64::VisitVecAdd(HVecAdd* instruction) {
124  LOG(FATAL) << "No SIMD for " << instruction->GetId();
125}
126
127void LocationsBuilderMIPS64::VisitVecHalvingAdd(HVecHalvingAdd* instruction) {
128  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
129}
130
131void InstructionCodeGeneratorMIPS64::VisitVecHalvingAdd(HVecHalvingAdd* instruction) {
132  LOG(FATAL) << "No SIMD for " << instruction->GetId();
133}
134
135void LocationsBuilderMIPS64::VisitVecSub(HVecSub* instruction) {
136  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
137}
138
139void InstructionCodeGeneratorMIPS64::VisitVecSub(HVecSub* instruction) {
140  LOG(FATAL) << "No SIMD for " << instruction->GetId();
141}
142
143void LocationsBuilderMIPS64::VisitVecMul(HVecMul* instruction) {
144  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
145}
146
147void InstructionCodeGeneratorMIPS64::VisitVecMul(HVecMul* instruction) {
148  LOG(FATAL) << "No SIMD for " << instruction->GetId();
149}
150
151void LocationsBuilderMIPS64::VisitVecDiv(HVecDiv* instruction) {
152  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
153}
154
155void InstructionCodeGeneratorMIPS64::VisitVecDiv(HVecDiv* instruction) {
156  LOG(FATAL) << "No SIMD for " << instruction->GetId();
157}
158
159void LocationsBuilderMIPS64::VisitVecMin(HVecMin* instruction) {
160  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
161}
162
163void InstructionCodeGeneratorMIPS64::VisitVecMin(HVecMin* instruction) {
164  LOG(FATAL) << "No SIMD for " << instruction->GetId();
165}
166
167void LocationsBuilderMIPS64::VisitVecMax(HVecMax* instruction) {
168  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
169}
170
171void InstructionCodeGeneratorMIPS64::VisitVecMax(HVecMax* instruction) {
172  LOG(FATAL) << "No SIMD for " << instruction->GetId();
173}
174
175void LocationsBuilderMIPS64::VisitVecAnd(HVecAnd* instruction) {
176  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
177}
178
179void InstructionCodeGeneratorMIPS64::VisitVecAnd(HVecAnd* instruction) {
180  LOG(FATAL) << "No SIMD for " << instruction->GetId();
181}
182
183void LocationsBuilderMIPS64::VisitVecAndNot(HVecAndNot* instruction) {
184  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
185}
186
187void InstructionCodeGeneratorMIPS64::VisitVecAndNot(HVecAndNot* instruction) {
188  LOG(FATAL) << "No SIMD for " << instruction->GetId();
189}
190
191void LocationsBuilderMIPS64::VisitVecOr(HVecOr* instruction) {
192  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
193}
194
195void InstructionCodeGeneratorMIPS64::VisitVecOr(HVecOr* instruction) {
196  LOG(FATAL) << "No SIMD for " << instruction->GetId();
197}
198
199void LocationsBuilderMIPS64::VisitVecXor(HVecXor* instruction) {
200  CreateVecBinOpLocations(GetGraph()->GetArena(), instruction);
201}
202
203void InstructionCodeGeneratorMIPS64::VisitVecXor(HVecXor* instruction) {
204  LOG(FATAL) << "No SIMD for " << instruction->GetId();
205}
206
207// Helper to set up locations for vector shift operations.
208static 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
224void LocationsBuilderMIPS64::VisitVecShl(HVecShl* instruction) {
225  CreateVecShiftLocations(GetGraph()->GetArena(), instruction);
226}
227
228void InstructionCodeGeneratorMIPS64::VisitVecShl(HVecShl* instruction) {
229  LOG(FATAL) << "No SIMD for " << instruction->GetId();
230}
231
232void LocationsBuilderMIPS64::VisitVecShr(HVecShr* instruction) {
233  CreateVecShiftLocations(GetGraph()->GetArena(), instruction);
234}
235
236void InstructionCodeGeneratorMIPS64::VisitVecShr(HVecShr* instruction) {
237  LOG(FATAL) << "No SIMD for " << instruction->GetId();
238}
239
240void LocationsBuilderMIPS64::VisitVecUShr(HVecUShr* instruction) {
241  CreateVecShiftLocations(GetGraph()->GetArena(), instruction);
242}
243
244void InstructionCodeGeneratorMIPS64::VisitVecUShr(HVecUShr* instruction) {
245  LOG(FATAL) << "No SIMD for " << instruction->GetId();
246}
247
248void LocationsBuilderMIPS64::VisitVecMultiplyAccumulate(HVecMultiplyAccumulate* instr) {
249  LOG(FATAL) << "No SIMD for " << instr->GetId();
250}
251
252void InstructionCodeGeneratorMIPS64::VisitVecMultiplyAccumulate(HVecMultiplyAccumulate* instr) {
253  LOG(FATAL) << "No SIMD for " << instr->GetId();
254}
255
256void LocationsBuilderMIPS64::VisitVecLoad(HVecLoad* instruction) {
257  LOG(FATAL) << "No SIMD for " << instruction->GetId();
258}
259
260void InstructionCodeGeneratorMIPS64::VisitVecLoad(HVecLoad* instruction) {
261  LOG(FATAL) << "No SIMD for " << instruction->GetId();
262}
263
264void LocationsBuilderMIPS64::VisitVecStore(HVecStore* instruction) {
265  LOG(FATAL) << "No SIMD for " << instruction->GetId();
266}
267
268void InstructionCodeGeneratorMIPS64::VisitVecStore(HVecStore* instruction) {
269  LOG(FATAL) << "No SIMD for " << instruction->GetId();
270}
271
272#undef __
273
274}  // namespace mips64
275}  // namespace art
276