1 /*
2 * Copyright (C) 2024 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 "nodes.h"
18
19 namespace art HIDDEN {
20
Create(HGraph * graph,IfCondition cond,HInstruction * lhs,HInstruction * rhs,DataType::Type packed_type,size_t vector_length,uint32_t dex_pc)21 HVecCondition* HVecCondition::Create(HGraph* graph,
22 IfCondition cond,
23 HInstruction* lhs,
24 HInstruction* rhs,
25 DataType::Type packed_type,
26 size_t vector_length,
27 uint32_t dex_pc) {
28 ArenaAllocator* allocator = graph->GetAllocator();
29 switch (cond) {
30 case kCondEQ: return new (allocator) HVecEqual(allocator,
31 lhs,
32 rhs,
33 packed_type,
34 vector_length,
35 dex_pc);
36 case kCondNE: return new (allocator) HVecNotEqual(allocator,
37 lhs,
38 rhs,
39 packed_type,
40 vector_length,
41 dex_pc);
42 case kCondLT: return new (allocator) HVecLessThan(allocator,
43 lhs,
44 rhs,
45 packed_type,
46 vector_length,
47 dex_pc);
48 case kCondLE: return new (allocator) HVecLessThanOrEqual(allocator,
49 lhs,
50 rhs,
51 packed_type,
52 vector_length,
53 dex_pc);
54 case kCondGT: return new (allocator) HVecGreaterThan(allocator,
55 lhs,
56 rhs,
57 packed_type,
58 vector_length,
59 dex_pc);
60 case kCondGE: return new (allocator) HVecGreaterThanOrEqual(allocator,
61 lhs,
62 rhs,
63 packed_type,
64 vector_length,
65 dex_pc);
66 case kCondB: return new (allocator) HVecBelow(allocator,
67 lhs,
68 rhs,
69 packed_type,
70 vector_length,
71 dex_pc);
72 case kCondBE: return new (allocator) HVecBelowOrEqual(allocator,
73 lhs,
74 rhs,
75 packed_type,
76 vector_length,
77 dex_pc);
78 case kCondA: return new (allocator) HVecAbove(allocator,
79 lhs,
80 rhs,
81 packed_type,
82 vector_length,
83 dex_pc);
84 case kCondAE: return new (allocator) HVecAboveOrEqual(allocator,
85 lhs,
86 rhs,
87 packed_type,
88 vector_length,
89 dex_pc);
90 }
91 LOG(FATAL) << "Unexpected condition " << cond;
92 UNREACHABLE();
93 }
94
95 } // namespace art
96