Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 "intrinsics_arm64.h" |
| 18 | |
Serban Constantinescu | 579885a | 2015-02-22 20:51:33 +0000 | [diff] [blame] | 19 | #include "arch/arm64/instruction_set_features_arm64.h" |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 20 | #include "art_method.h" |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 21 | #include "code_generator_arm64.h" |
| 22 | #include "common_arm64.h" |
| 23 | #include "entrypoints/quick/quick_entrypoints.h" |
| 24 | #include "intrinsics.h" |
| 25 | #include "mirror/array-inl.h" |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 26 | #include "mirror/string.h" |
| 27 | #include "thread.h" |
| 28 | #include "utils/arm64/assembler_arm64.h" |
| 29 | #include "utils/arm64/constants_arm64.h" |
| 30 | |
Serban Constantinescu | 82e52ce | 2015-03-26 16:50:57 +0000 | [diff] [blame] | 31 | #include "vixl/a64/disasm-a64.h" |
| 32 | #include "vixl/a64/macro-assembler-a64.h" |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 33 | |
| 34 | using namespace vixl; // NOLINT(build/namespaces) |
| 35 | |
| 36 | namespace art { |
| 37 | |
| 38 | namespace arm64 { |
| 39 | |
| 40 | using helpers::DRegisterFrom; |
| 41 | using helpers::FPRegisterFrom; |
| 42 | using helpers::HeapOperand; |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 43 | using helpers::LocationFrom; |
Scott Wakeling | 9ee23f4 | 2015-07-23 10:44:35 +0100 | [diff] [blame] | 44 | using helpers::OperandFrom; |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 45 | using helpers::RegisterFrom; |
| 46 | using helpers::SRegisterFrom; |
| 47 | using helpers::WRegisterFrom; |
| 48 | using helpers::XRegisterFrom; |
| 49 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 50 | namespace { |
| 51 | |
| 52 | ALWAYS_INLINE inline MemOperand AbsoluteHeapOperandFrom(Location location, size_t offset = 0) { |
| 53 | return MemOperand(XRegisterFrom(location), offset); |
| 54 | } |
| 55 | |
| 56 | } // namespace |
| 57 | |
| 58 | vixl::MacroAssembler* IntrinsicCodeGeneratorARM64::GetVIXLAssembler() { |
| 59 | return codegen_->GetAssembler()->vixl_masm_; |
| 60 | } |
| 61 | |
| 62 | ArenaAllocator* IntrinsicCodeGeneratorARM64::GetAllocator() { |
| 63 | return codegen_->GetGraph()->GetArena(); |
| 64 | } |
| 65 | |
| 66 | #define __ codegen->GetAssembler()->vixl_masm_-> |
| 67 | |
| 68 | static void MoveFromReturnRegister(Location trg, |
| 69 | Primitive::Type type, |
| 70 | CodeGeneratorARM64* codegen) { |
| 71 | if (!trg.IsValid()) { |
| 72 | DCHECK(type == Primitive::kPrimVoid); |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | DCHECK_NE(type, Primitive::kPrimVoid); |
| 77 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 78 | if (Primitive::IsIntegralType(type) || type == Primitive::kPrimNot) { |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 79 | Register trg_reg = RegisterFrom(trg, type); |
| 80 | Register res_reg = RegisterFrom(ARM64ReturnLocation(type), type); |
| 81 | __ Mov(trg_reg, res_reg, kDiscardForSameWReg); |
| 82 | } else { |
| 83 | FPRegister trg_reg = FPRegisterFrom(trg, type); |
| 84 | FPRegister res_reg = FPRegisterFrom(ARM64ReturnLocation(type), type); |
| 85 | __ Fmov(trg_reg, res_reg); |
| 86 | } |
| 87 | } |
| 88 | |
Roland Levillain | ec525fc | 2015-04-28 15:50:20 +0100 | [diff] [blame] | 89 | static void MoveArguments(HInvoke* invoke, CodeGeneratorARM64* codegen) { |
Roland Levillain | 2d27c8e | 2015-04-28 15:48:45 +0100 | [diff] [blame] | 90 | InvokeDexCallingConventionVisitorARM64 calling_convention_visitor; |
Roland Levillain | ec525fc | 2015-04-28 15:50:20 +0100 | [diff] [blame] | 91 | IntrinsicVisitor::MoveArguments(invoke, codegen, &calling_convention_visitor); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | // Slow-path for fallback (calling the managed code to handle the intrinsic) in an intrinsified |
| 95 | // call. This will copy the arguments into the positions for a regular call. |
| 96 | // |
| 97 | // Note: The actual parameters are required to be in the locations given by the invoke's location |
| 98 | // summary. If an intrinsic modifies those locations before a slowpath call, they must be |
| 99 | // restored! |
| 100 | class IntrinsicSlowPathARM64 : public SlowPathCodeARM64 { |
| 101 | public: |
David Srbecky | 9cd6d37 | 2016-02-09 15:24:47 +0000 | [diff] [blame] | 102 | explicit IntrinsicSlowPathARM64(HInvoke* invoke) |
| 103 | : SlowPathCodeARM64(invoke), invoke_(invoke) { } |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 104 | |
| 105 | void EmitNativeCode(CodeGenerator* codegen_in) OVERRIDE { |
| 106 | CodeGeneratorARM64* codegen = down_cast<CodeGeneratorARM64*>(codegen_in); |
| 107 | __ Bind(GetEntryLabel()); |
| 108 | |
Nicolas Geoffray | a8ac913 | 2015-03-13 16:36:36 +0000 | [diff] [blame] | 109 | SaveLiveRegisters(codegen, invoke_->GetLocations()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 110 | |
Roland Levillain | ec525fc | 2015-04-28 15:50:20 +0100 | [diff] [blame] | 111 | MoveArguments(invoke_, codegen); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 112 | |
| 113 | if (invoke_->IsInvokeStaticOrDirect()) { |
Nicolas Geoffray | 94015b9 | 2015-06-04 18:21:04 +0100 | [diff] [blame] | 114 | codegen->GenerateStaticOrDirectCall(invoke_->AsInvokeStaticOrDirect(), |
| 115 | LocationFrom(kArtMethodRegister)); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 116 | } else { |
Andreas Gampe | bfb5ba9 | 2015-09-01 15:45:02 +0000 | [diff] [blame] | 117 | codegen->GenerateVirtualCall(invoke_->AsInvokeVirtual(), LocationFrom(kArtMethodRegister)); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 118 | } |
Andreas Gampe | bfb5ba9 | 2015-09-01 15:45:02 +0000 | [diff] [blame] | 119 | codegen->RecordPcInfo(invoke_, invoke_->GetDexPc(), this); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 120 | |
| 121 | // Copy the result back to the expected output. |
| 122 | Location out = invoke_->GetLocations()->Out(); |
| 123 | if (out.IsValid()) { |
| 124 | DCHECK(out.IsRegister()); // TODO: Replace this when we support output in memory. |
| 125 | DCHECK(!invoke_->GetLocations()->GetLiveRegisters()->ContainsCoreRegister(out.reg())); |
| 126 | MoveFromReturnRegister(out, invoke_->GetType(), codegen); |
| 127 | } |
| 128 | |
Nicolas Geoffray | a8ac913 | 2015-03-13 16:36:36 +0000 | [diff] [blame] | 129 | RestoreLiveRegisters(codegen, invoke_->GetLocations()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 130 | __ B(GetExitLabel()); |
| 131 | } |
| 132 | |
Alexandre Rames | 9931f31 | 2015-06-19 14:47:01 +0100 | [diff] [blame] | 133 | const char* GetDescription() const OVERRIDE { return "IntrinsicSlowPathARM64"; } |
| 134 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 135 | private: |
| 136 | // The instruction where this slow path is happening. |
| 137 | HInvoke* const invoke_; |
| 138 | |
| 139 | DISALLOW_COPY_AND_ASSIGN(IntrinsicSlowPathARM64); |
| 140 | }; |
| 141 | |
| 142 | #undef __ |
| 143 | |
| 144 | bool IntrinsicLocationsBuilderARM64::TryDispatch(HInvoke* invoke) { |
| 145 | Dispatch(invoke); |
| 146 | LocationSummary* res = invoke->GetLocations(); |
Roland Levillain | 22ccc3a | 2015-11-24 13:10:05 +0000 | [diff] [blame] | 147 | if (res == nullptr) { |
| 148 | return false; |
| 149 | } |
| 150 | if (kEmitCompilerReadBarrier && res->CanCall()) { |
| 151 | // Generating an intrinsic for this HInvoke may produce an |
| 152 | // IntrinsicSlowPathARM64 slow path. Currently this approach |
| 153 | // does not work when using read barriers, as the emitted |
| 154 | // calling sequence will make use of another slow path |
| 155 | // (ReadBarrierForRootSlowPathARM64 for HInvokeStaticOrDirect, |
| 156 | // ReadBarrierSlowPathARM64 for HInvokeVirtual). So we bail |
| 157 | // out in this case. |
| 158 | // |
| 159 | // TODO: Find a way to have intrinsics work with read barriers. |
| 160 | invoke->SetLocations(nullptr); |
| 161 | return false; |
| 162 | } |
| 163 | return res->Intrinsified(); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | #define __ masm-> |
| 167 | |
| 168 | static void CreateFPToIntLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 169 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 170 | LocationSummary::kNoCall, |
| 171 | kIntrinsified); |
| 172 | locations->SetInAt(0, Location::RequiresFpuRegister()); |
| 173 | locations->SetOut(Location::RequiresRegister()); |
| 174 | } |
| 175 | |
| 176 | static void CreateIntToFPLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 177 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 178 | LocationSummary::kNoCall, |
| 179 | kIntrinsified); |
| 180 | locations->SetInAt(0, Location::RequiresRegister()); |
| 181 | locations->SetOut(Location::RequiresFpuRegister()); |
| 182 | } |
| 183 | |
| 184 | static void MoveFPToInt(LocationSummary* locations, bool is64bit, vixl::MacroAssembler* masm) { |
| 185 | Location input = locations->InAt(0); |
| 186 | Location output = locations->Out(); |
| 187 | __ Fmov(is64bit ? XRegisterFrom(output) : WRegisterFrom(output), |
| 188 | is64bit ? DRegisterFrom(input) : SRegisterFrom(input)); |
| 189 | } |
| 190 | |
| 191 | static void MoveIntToFP(LocationSummary* locations, bool is64bit, vixl::MacroAssembler* masm) { |
| 192 | Location input = locations->InAt(0); |
| 193 | Location output = locations->Out(); |
| 194 | __ Fmov(is64bit ? DRegisterFrom(output) : SRegisterFrom(output), |
| 195 | is64bit ? XRegisterFrom(input) : WRegisterFrom(input)); |
| 196 | } |
| 197 | |
| 198 | void IntrinsicLocationsBuilderARM64::VisitDoubleDoubleToRawLongBits(HInvoke* invoke) { |
| 199 | CreateFPToIntLocations(arena_, invoke); |
| 200 | } |
| 201 | void IntrinsicLocationsBuilderARM64::VisitDoubleLongBitsToDouble(HInvoke* invoke) { |
| 202 | CreateIntToFPLocations(arena_, invoke); |
| 203 | } |
| 204 | |
| 205 | void IntrinsicCodeGeneratorARM64::VisitDoubleDoubleToRawLongBits(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 206 | MoveFPToInt(invoke->GetLocations(), /* is64bit */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 207 | } |
| 208 | void IntrinsicCodeGeneratorARM64::VisitDoubleLongBitsToDouble(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 209 | MoveIntToFP(invoke->GetLocations(), /* is64bit */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | void IntrinsicLocationsBuilderARM64::VisitFloatFloatToRawIntBits(HInvoke* invoke) { |
| 213 | CreateFPToIntLocations(arena_, invoke); |
| 214 | } |
| 215 | void IntrinsicLocationsBuilderARM64::VisitFloatIntBitsToFloat(HInvoke* invoke) { |
| 216 | CreateIntToFPLocations(arena_, invoke); |
| 217 | } |
| 218 | |
| 219 | void IntrinsicCodeGeneratorARM64::VisitFloatFloatToRawIntBits(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 220 | MoveFPToInt(invoke->GetLocations(), /* is64bit */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 221 | } |
| 222 | void IntrinsicCodeGeneratorARM64::VisitFloatIntBitsToFloat(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 223 | MoveIntToFP(invoke->GetLocations(), /* is64bit */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | static void CreateIntToIntLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 227 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 228 | LocationSummary::kNoCall, |
| 229 | kIntrinsified); |
| 230 | locations->SetInAt(0, Location::RequiresRegister()); |
| 231 | locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); |
| 232 | } |
| 233 | |
| 234 | static void GenReverseBytes(LocationSummary* locations, |
| 235 | Primitive::Type type, |
| 236 | vixl::MacroAssembler* masm) { |
| 237 | Location in = locations->InAt(0); |
| 238 | Location out = locations->Out(); |
| 239 | |
| 240 | switch (type) { |
| 241 | case Primitive::kPrimShort: |
| 242 | __ Rev16(WRegisterFrom(out), WRegisterFrom(in)); |
| 243 | __ Sxth(WRegisterFrom(out), WRegisterFrom(out)); |
| 244 | break; |
| 245 | case Primitive::kPrimInt: |
| 246 | case Primitive::kPrimLong: |
| 247 | __ Rev(RegisterFrom(out, type), RegisterFrom(in, type)); |
| 248 | break; |
| 249 | default: |
| 250 | LOG(FATAL) << "Unexpected size for reverse-bytes: " << type; |
| 251 | UNREACHABLE(); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | void IntrinsicLocationsBuilderARM64::VisitIntegerReverseBytes(HInvoke* invoke) { |
| 256 | CreateIntToIntLocations(arena_, invoke); |
| 257 | } |
| 258 | |
| 259 | void IntrinsicCodeGeneratorARM64::VisitIntegerReverseBytes(HInvoke* invoke) { |
| 260 | GenReverseBytes(invoke->GetLocations(), Primitive::kPrimInt, GetVIXLAssembler()); |
| 261 | } |
| 262 | |
| 263 | void IntrinsicLocationsBuilderARM64::VisitLongReverseBytes(HInvoke* invoke) { |
| 264 | CreateIntToIntLocations(arena_, invoke); |
| 265 | } |
| 266 | |
| 267 | void IntrinsicCodeGeneratorARM64::VisitLongReverseBytes(HInvoke* invoke) { |
| 268 | GenReverseBytes(invoke->GetLocations(), Primitive::kPrimLong, GetVIXLAssembler()); |
| 269 | } |
| 270 | |
| 271 | void IntrinsicLocationsBuilderARM64::VisitShortReverseBytes(HInvoke* invoke) { |
| 272 | CreateIntToIntLocations(arena_, invoke); |
| 273 | } |
| 274 | |
| 275 | void IntrinsicCodeGeneratorARM64::VisitShortReverseBytes(HInvoke* invoke) { |
| 276 | GenReverseBytes(invoke->GetLocations(), Primitive::kPrimShort, GetVIXLAssembler()); |
| 277 | } |
| 278 | |
Aart Bik | 7b56502 | 2016-01-28 14:36:22 -0800 | [diff] [blame] | 279 | static void CreateIntIntToIntLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 280 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 281 | LocationSummary::kNoCall, |
| 282 | kIntrinsified); |
| 283 | locations->SetInAt(0, Location::RequiresRegister()); |
| 284 | locations->SetInAt(1, Location::RequiresRegister()); |
| 285 | locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); |
| 286 | } |
| 287 | |
Scott Wakeling | 611d339 | 2015-07-10 11:42:06 +0100 | [diff] [blame] | 288 | static void GenNumberOfLeadingZeros(LocationSummary* locations, |
| 289 | Primitive::Type type, |
| 290 | vixl::MacroAssembler* masm) { |
| 291 | DCHECK(type == Primitive::kPrimInt || type == Primitive::kPrimLong); |
| 292 | |
| 293 | Location in = locations->InAt(0); |
| 294 | Location out = locations->Out(); |
| 295 | |
| 296 | __ Clz(RegisterFrom(out, type), RegisterFrom(in, type)); |
| 297 | } |
| 298 | |
| 299 | void IntrinsicLocationsBuilderARM64::VisitIntegerNumberOfLeadingZeros(HInvoke* invoke) { |
| 300 | CreateIntToIntLocations(arena_, invoke); |
| 301 | } |
| 302 | |
| 303 | void IntrinsicCodeGeneratorARM64::VisitIntegerNumberOfLeadingZeros(HInvoke* invoke) { |
| 304 | GenNumberOfLeadingZeros(invoke->GetLocations(), Primitive::kPrimInt, GetVIXLAssembler()); |
| 305 | } |
| 306 | |
| 307 | void IntrinsicLocationsBuilderARM64::VisitLongNumberOfLeadingZeros(HInvoke* invoke) { |
| 308 | CreateIntToIntLocations(arena_, invoke); |
| 309 | } |
| 310 | |
| 311 | void IntrinsicCodeGeneratorARM64::VisitLongNumberOfLeadingZeros(HInvoke* invoke) { |
| 312 | GenNumberOfLeadingZeros(invoke->GetLocations(), Primitive::kPrimLong, GetVIXLAssembler()); |
| 313 | } |
| 314 | |
Scott Wakeling | 9ee23f4 | 2015-07-23 10:44:35 +0100 | [diff] [blame] | 315 | static void GenNumberOfTrailingZeros(LocationSummary* locations, |
| 316 | Primitive::Type type, |
| 317 | vixl::MacroAssembler* masm) { |
| 318 | DCHECK(type == Primitive::kPrimInt || type == Primitive::kPrimLong); |
| 319 | |
| 320 | Location in = locations->InAt(0); |
| 321 | Location out = locations->Out(); |
| 322 | |
| 323 | __ Rbit(RegisterFrom(out, type), RegisterFrom(in, type)); |
| 324 | __ Clz(RegisterFrom(out, type), RegisterFrom(out, type)); |
| 325 | } |
| 326 | |
| 327 | void IntrinsicLocationsBuilderARM64::VisitIntegerNumberOfTrailingZeros(HInvoke* invoke) { |
| 328 | CreateIntToIntLocations(arena_, invoke); |
| 329 | } |
| 330 | |
| 331 | void IntrinsicCodeGeneratorARM64::VisitIntegerNumberOfTrailingZeros(HInvoke* invoke) { |
| 332 | GenNumberOfTrailingZeros(invoke->GetLocations(), Primitive::kPrimInt, GetVIXLAssembler()); |
| 333 | } |
| 334 | |
| 335 | void IntrinsicLocationsBuilderARM64::VisitLongNumberOfTrailingZeros(HInvoke* invoke) { |
| 336 | CreateIntToIntLocations(arena_, invoke); |
| 337 | } |
| 338 | |
| 339 | void IntrinsicCodeGeneratorARM64::VisitLongNumberOfTrailingZeros(HInvoke* invoke) { |
| 340 | GenNumberOfTrailingZeros(invoke->GetLocations(), Primitive::kPrimLong, GetVIXLAssembler()); |
| 341 | } |
| 342 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 343 | static void GenReverse(LocationSummary* locations, |
| 344 | Primitive::Type type, |
| 345 | vixl::MacroAssembler* masm) { |
| 346 | DCHECK(type == Primitive::kPrimInt || type == Primitive::kPrimLong); |
| 347 | |
| 348 | Location in = locations->InAt(0); |
| 349 | Location out = locations->Out(); |
| 350 | |
| 351 | __ Rbit(RegisterFrom(out, type), RegisterFrom(in, type)); |
| 352 | } |
| 353 | |
| 354 | void IntrinsicLocationsBuilderARM64::VisitIntegerReverse(HInvoke* invoke) { |
| 355 | CreateIntToIntLocations(arena_, invoke); |
| 356 | } |
| 357 | |
| 358 | void IntrinsicCodeGeneratorARM64::VisitIntegerReverse(HInvoke* invoke) { |
| 359 | GenReverse(invoke->GetLocations(), Primitive::kPrimInt, GetVIXLAssembler()); |
| 360 | } |
| 361 | |
| 362 | void IntrinsicLocationsBuilderARM64::VisitLongReverse(HInvoke* invoke) { |
| 363 | CreateIntToIntLocations(arena_, invoke); |
| 364 | } |
| 365 | |
| 366 | void IntrinsicCodeGeneratorARM64::VisitLongReverse(HInvoke* invoke) { |
| 367 | GenReverse(invoke->GetLocations(), Primitive::kPrimLong, GetVIXLAssembler()); |
| 368 | } |
| 369 | |
| 370 | static void CreateFPToFPLocations(ArenaAllocator* arena, HInvoke* invoke) { |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 371 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 372 | LocationSummary::kNoCall, |
| 373 | kIntrinsified); |
| 374 | locations->SetInAt(0, Location::RequiresFpuRegister()); |
| 375 | locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); |
| 376 | } |
| 377 | |
| 378 | static void MathAbsFP(LocationSummary* locations, bool is64bit, vixl::MacroAssembler* masm) { |
| 379 | Location in = locations->InAt(0); |
| 380 | Location out = locations->Out(); |
| 381 | |
| 382 | FPRegister in_reg = is64bit ? DRegisterFrom(in) : SRegisterFrom(in); |
| 383 | FPRegister out_reg = is64bit ? DRegisterFrom(out) : SRegisterFrom(out); |
| 384 | |
| 385 | __ Fabs(out_reg, in_reg); |
| 386 | } |
| 387 | |
| 388 | void IntrinsicLocationsBuilderARM64::VisitMathAbsDouble(HInvoke* invoke) { |
| 389 | CreateFPToFPLocations(arena_, invoke); |
| 390 | } |
| 391 | |
| 392 | void IntrinsicCodeGeneratorARM64::VisitMathAbsDouble(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 393 | MathAbsFP(invoke->GetLocations(), /* is64bit */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | void IntrinsicLocationsBuilderARM64::VisitMathAbsFloat(HInvoke* invoke) { |
| 397 | CreateFPToFPLocations(arena_, invoke); |
| 398 | } |
| 399 | |
| 400 | void IntrinsicCodeGeneratorARM64::VisitMathAbsFloat(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 401 | MathAbsFP(invoke->GetLocations(), /* is64bit */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | static void CreateIntToInt(ArenaAllocator* arena, HInvoke* invoke) { |
| 405 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 406 | LocationSummary::kNoCall, |
| 407 | kIntrinsified); |
| 408 | locations->SetInAt(0, Location::RequiresRegister()); |
| 409 | locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); |
| 410 | } |
| 411 | |
| 412 | static void GenAbsInteger(LocationSummary* locations, |
| 413 | bool is64bit, |
| 414 | vixl::MacroAssembler* masm) { |
| 415 | Location in = locations->InAt(0); |
| 416 | Location output = locations->Out(); |
| 417 | |
| 418 | Register in_reg = is64bit ? XRegisterFrom(in) : WRegisterFrom(in); |
| 419 | Register out_reg = is64bit ? XRegisterFrom(output) : WRegisterFrom(output); |
| 420 | |
| 421 | __ Cmp(in_reg, Operand(0)); |
| 422 | __ Cneg(out_reg, in_reg, lt); |
| 423 | } |
| 424 | |
| 425 | void IntrinsicLocationsBuilderARM64::VisitMathAbsInt(HInvoke* invoke) { |
| 426 | CreateIntToInt(arena_, invoke); |
| 427 | } |
| 428 | |
| 429 | void IntrinsicCodeGeneratorARM64::VisitMathAbsInt(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 430 | GenAbsInteger(invoke->GetLocations(), /* is64bit */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | void IntrinsicLocationsBuilderARM64::VisitMathAbsLong(HInvoke* invoke) { |
| 434 | CreateIntToInt(arena_, invoke); |
| 435 | } |
| 436 | |
| 437 | void IntrinsicCodeGeneratorARM64::VisitMathAbsLong(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 438 | GenAbsInteger(invoke->GetLocations(), /* is64bit */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | static void GenMinMaxFP(LocationSummary* locations, |
| 442 | bool is_min, |
| 443 | bool is_double, |
| 444 | vixl::MacroAssembler* masm) { |
| 445 | Location op1 = locations->InAt(0); |
| 446 | Location op2 = locations->InAt(1); |
| 447 | Location out = locations->Out(); |
| 448 | |
| 449 | FPRegister op1_reg = is_double ? DRegisterFrom(op1) : SRegisterFrom(op1); |
| 450 | FPRegister op2_reg = is_double ? DRegisterFrom(op2) : SRegisterFrom(op2); |
| 451 | FPRegister out_reg = is_double ? DRegisterFrom(out) : SRegisterFrom(out); |
| 452 | if (is_min) { |
| 453 | __ Fmin(out_reg, op1_reg, op2_reg); |
| 454 | } else { |
| 455 | __ Fmax(out_reg, op1_reg, op2_reg); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | static void CreateFPFPToFPLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 460 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 461 | LocationSummary::kNoCall, |
| 462 | kIntrinsified); |
| 463 | locations->SetInAt(0, Location::RequiresFpuRegister()); |
| 464 | locations->SetInAt(1, Location::RequiresFpuRegister()); |
| 465 | locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap); |
| 466 | } |
| 467 | |
| 468 | void IntrinsicLocationsBuilderARM64::VisitMathMinDoubleDouble(HInvoke* invoke) { |
| 469 | CreateFPFPToFPLocations(arena_, invoke); |
| 470 | } |
| 471 | |
| 472 | void IntrinsicCodeGeneratorARM64::VisitMathMinDoubleDouble(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 473 | GenMinMaxFP(invoke->GetLocations(), /* is_min */ true, /* is_double */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | void IntrinsicLocationsBuilderARM64::VisitMathMinFloatFloat(HInvoke* invoke) { |
| 477 | CreateFPFPToFPLocations(arena_, invoke); |
| 478 | } |
| 479 | |
| 480 | void IntrinsicCodeGeneratorARM64::VisitMathMinFloatFloat(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 481 | GenMinMaxFP(invoke->GetLocations(), /* is_min */ true, /* is_double */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | void IntrinsicLocationsBuilderARM64::VisitMathMaxDoubleDouble(HInvoke* invoke) { |
| 485 | CreateFPFPToFPLocations(arena_, invoke); |
| 486 | } |
| 487 | |
| 488 | void IntrinsicCodeGeneratorARM64::VisitMathMaxDoubleDouble(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 489 | GenMinMaxFP(invoke->GetLocations(), /* is_min */ false, /* is_double */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | void IntrinsicLocationsBuilderARM64::VisitMathMaxFloatFloat(HInvoke* invoke) { |
| 493 | CreateFPFPToFPLocations(arena_, invoke); |
| 494 | } |
| 495 | |
| 496 | void IntrinsicCodeGeneratorARM64::VisitMathMaxFloatFloat(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 497 | GenMinMaxFP( |
| 498 | invoke->GetLocations(), /* is_min */ false, /* is_double */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | static void GenMinMax(LocationSummary* locations, |
| 502 | bool is_min, |
| 503 | bool is_long, |
| 504 | vixl::MacroAssembler* masm) { |
| 505 | Location op1 = locations->InAt(0); |
| 506 | Location op2 = locations->InAt(1); |
| 507 | Location out = locations->Out(); |
| 508 | |
| 509 | Register op1_reg = is_long ? XRegisterFrom(op1) : WRegisterFrom(op1); |
| 510 | Register op2_reg = is_long ? XRegisterFrom(op2) : WRegisterFrom(op2); |
| 511 | Register out_reg = is_long ? XRegisterFrom(out) : WRegisterFrom(out); |
| 512 | |
| 513 | __ Cmp(op1_reg, op2_reg); |
| 514 | __ Csel(out_reg, op1_reg, op2_reg, is_min ? lt : gt); |
| 515 | } |
| 516 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 517 | void IntrinsicLocationsBuilderARM64::VisitMathMinIntInt(HInvoke* invoke) { |
| 518 | CreateIntIntToIntLocations(arena_, invoke); |
| 519 | } |
| 520 | |
| 521 | void IntrinsicCodeGeneratorARM64::VisitMathMinIntInt(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 522 | GenMinMax(invoke->GetLocations(), /* is_min */ true, /* is_long */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | void IntrinsicLocationsBuilderARM64::VisitMathMinLongLong(HInvoke* invoke) { |
| 526 | CreateIntIntToIntLocations(arena_, invoke); |
| 527 | } |
| 528 | |
| 529 | void IntrinsicCodeGeneratorARM64::VisitMathMinLongLong(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 530 | GenMinMax(invoke->GetLocations(), /* is_min */ true, /* is_long */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 531 | } |
| 532 | |
| 533 | void IntrinsicLocationsBuilderARM64::VisitMathMaxIntInt(HInvoke* invoke) { |
| 534 | CreateIntIntToIntLocations(arena_, invoke); |
| 535 | } |
| 536 | |
| 537 | void IntrinsicCodeGeneratorARM64::VisitMathMaxIntInt(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 538 | GenMinMax(invoke->GetLocations(), /* is_min */ false, /* is_long */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 539 | } |
| 540 | |
| 541 | void IntrinsicLocationsBuilderARM64::VisitMathMaxLongLong(HInvoke* invoke) { |
| 542 | CreateIntIntToIntLocations(arena_, invoke); |
| 543 | } |
| 544 | |
| 545 | void IntrinsicCodeGeneratorARM64::VisitMathMaxLongLong(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 546 | GenMinMax(invoke->GetLocations(), /* is_min */ false, /* is_long */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | void IntrinsicLocationsBuilderARM64::VisitMathSqrt(HInvoke* invoke) { |
| 550 | CreateFPToFPLocations(arena_, invoke); |
| 551 | } |
| 552 | |
| 553 | void IntrinsicCodeGeneratorARM64::VisitMathSqrt(HInvoke* invoke) { |
| 554 | LocationSummary* locations = invoke->GetLocations(); |
| 555 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 556 | __ Fsqrt(DRegisterFrom(locations->Out()), DRegisterFrom(locations->InAt(0))); |
| 557 | } |
| 558 | |
| 559 | void IntrinsicLocationsBuilderARM64::VisitMathCeil(HInvoke* invoke) { |
| 560 | CreateFPToFPLocations(arena_, invoke); |
| 561 | } |
| 562 | |
| 563 | void IntrinsicCodeGeneratorARM64::VisitMathCeil(HInvoke* invoke) { |
| 564 | LocationSummary* locations = invoke->GetLocations(); |
| 565 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 566 | __ Frintp(DRegisterFrom(locations->Out()), DRegisterFrom(locations->InAt(0))); |
| 567 | } |
| 568 | |
| 569 | void IntrinsicLocationsBuilderARM64::VisitMathFloor(HInvoke* invoke) { |
| 570 | CreateFPToFPLocations(arena_, invoke); |
| 571 | } |
| 572 | |
| 573 | void IntrinsicCodeGeneratorARM64::VisitMathFloor(HInvoke* invoke) { |
| 574 | LocationSummary* locations = invoke->GetLocations(); |
| 575 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 576 | __ Frintm(DRegisterFrom(locations->Out()), DRegisterFrom(locations->InAt(0))); |
| 577 | } |
| 578 | |
| 579 | void IntrinsicLocationsBuilderARM64::VisitMathRint(HInvoke* invoke) { |
| 580 | CreateFPToFPLocations(arena_, invoke); |
| 581 | } |
| 582 | |
| 583 | void IntrinsicCodeGeneratorARM64::VisitMathRint(HInvoke* invoke) { |
| 584 | LocationSummary* locations = invoke->GetLocations(); |
| 585 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 586 | __ Frintn(DRegisterFrom(locations->Out()), DRegisterFrom(locations->InAt(0))); |
| 587 | } |
| 588 | |
| 589 | static void CreateFPToIntPlusTempLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 590 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 591 | LocationSummary::kNoCall, |
| 592 | kIntrinsified); |
| 593 | locations->SetInAt(0, Location::RequiresFpuRegister()); |
| 594 | locations->SetOut(Location::RequiresRegister()); |
| 595 | } |
| 596 | |
| 597 | static void GenMathRound(LocationSummary* locations, |
| 598 | bool is_double, |
| 599 | vixl::MacroAssembler* masm) { |
| 600 | FPRegister in_reg = is_double ? |
| 601 | DRegisterFrom(locations->InAt(0)) : SRegisterFrom(locations->InAt(0)); |
| 602 | Register out_reg = is_double ? |
| 603 | XRegisterFrom(locations->Out()) : WRegisterFrom(locations->Out()); |
| 604 | UseScratchRegisterScope temps(masm); |
| 605 | FPRegister temp1_reg = temps.AcquireSameSizeAs(in_reg); |
| 606 | |
| 607 | // 0.5 can be encoded as an immediate, so use fmov. |
| 608 | if (is_double) { |
| 609 | __ Fmov(temp1_reg, static_cast<double>(0.5)); |
| 610 | } else { |
| 611 | __ Fmov(temp1_reg, static_cast<float>(0.5)); |
| 612 | } |
| 613 | __ Fadd(temp1_reg, in_reg, temp1_reg); |
| 614 | __ Fcvtms(out_reg, temp1_reg); |
| 615 | } |
| 616 | |
| 617 | void IntrinsicLocationsBuilderARM64::VisitMathRoundDouble(HInvoke* invoke) { |
Andreas Gampe | e6d0d8d | 2015-12-28 09:54:29 -0800 | [diff] [blame] | 618 | // See intrinsics.h. |
| 619 | if (kRoundIsPlusPointFive) { |
| 620 | CreateFPToIntPlusTempLocations(arena_, invoke); |
| 621 | } |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | void IntrinsicCodeGeneratorARM64::VisitMathRoundDouble(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 625 | GenMathRound(invoke->GetLocations(), /* is_double */ true, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | void IntrinsicLocationsBuilderARM64::VisitMathRoundFloat(HInvoke* invoke) { |
Andreas Gampe | e6d0d8d | 2015-12-28 09:54:29 -0800 | [diff] [blame] | 629 | // See intrinsics.h. |
| 630 | if (kRoundIsPlusPointFive) { |
| 631 | CreateFPToIntPlusTempLocations(arena_, invoke); |
| 632 | } |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 633 | } |
| 634 | |
| 635 | void IntrinsicCodeGeneratorARM64::VisitMathRoundFloat(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 636 | GenMathRound(invoke->GetLocations(), /* is_double */ false, GetVIXLAssembler()); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 637 | } |
| 638 | |
| 639 | void IntrinsicLocationsBuilderARM64::VisitMemoryPeekByte(HInvoke* invoke) { |
| 640 | CreateIntToIntLocations(arena_, invoke); |
| 641 | } |
| 642 | |
| 643 | void IntrinsicCodeGeneratorARM64::VisitMemoryPeekByte(HInvoke* invoke) { |
| 644 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 645 | __ Ldrsb(WRegisterFrom(invoke->GetLocations()->Out()), |
| 646 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 647 | } |
| 648 | |
| 649 | void IntrinsicLocationsBuilderARM64::VisitMemoryPeekIntNative(HInvoke* invoke) { |
| 650 | CreateIntToIntLocations(arena_, invoke); |
| 651 | } |
| 652 | |
| 653 | void IntrinsicCodeGeneratorARM64::VisitMemoryPeekIntNative(HInvoke* invoke) { |
| 654 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 655 | __ Ldr(WRegisterFrom(invoke->GetLocations()->Out()), |
| 656 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 657 | } |
| 658 | |
| 659 | void IntrinsicLocationsBuilderARM64::VisitMemoryPeekLongNative(HInvoke* invoke) { |
| 660 | CreateIntToIntLocations(arena_, invoke); |
| 661 | } |
| 662 | |
| 663 | void IntrinsicCodeGeneratorARM64::VisitMemoryPeekLongNative(HInvoke* invoke) { |
| 664 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 665 | __ Ldr(XRegisterFrom(invoke->GetLocations()->Out()), |
| 666 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 667 | } |
| 668 | |
| 669 | void IntrinsicLocationsBuilderARM64::VisitMemoryPeekShortNative(HInvoke* invoke) { |
| 670 | CreateIntToIntLocations(arena_, invoke); |
| 671 | } |
| 672 | |
| 673 | void IntrinsicCodeGeneratorARM64::VisitMemoryPeekShortNative(HInvoke* invoke) { |
| 674 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 675 | __ Ldrsh(WRegisterFrom(invoke->GetLocations()->Out()), |
| 676 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 677 | } |
| 678 | |
| 679 | static void CreateIntIntToVoidLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 680 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 681 | LocationSummary::kNoCall, |
| 682 | kIntrinsified); |
| 683 | locations->SetInAt(0, Location::RequiresRegister()); |
| 684 | locations->SetInAt(1, Location::RequiresRegister()); |
| 685 | } |
| 686 | |
| 687 | void IntrinsicLocationsBuilderARM64::VisitMemoryPokeByte(HInvoke* invoke) { |
| 688 | CreateIntIntToVoidLocations(arena_, invoke); |
| 689 | } |
| 690 | |
| 691 | void IntrinsicCodeGeneratorARM64::VisitMemoryPokeByte(HInvoke* invoke) { |
| 692 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 693 | __ Strb(WRegisterFrom(invoke->GetLocations()->InAt(1)), |
| 694 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 695 | } |
| 696 | |
| 697 | void IntrinsicLocationsBuilderARM64::VisitMemoryPokeIntNative(HInvoke* invoke) { |
| 698 | CreateIntIntToVoidLocations(arena_, invoke); |
| 699 | } |
| 700 | |
| 701 | void IntrinsicCodeGeneratorARM64::VisitMemoryPokeIntNative(HInvoke* invoke) { |
| 702 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 703 | __ Str(WRegisterFrom(invoke->GetLocations()->InAt(1)), |
| 704 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 705 | } |
| 706 | |
| 707 | void IntrinsicLocationsBuilderARM64::VisitMemoryPokeLongNative(HInvoke* invoke) { |
| 708 | CreateIntIntToVoidLocations(arena_, invoke); |
| 709 | } |
| 710 | |
| 711 | void IntrinsicCodeGeneratorARM64::VisitMemoryPokeLongNative(HInvoke* invoke) { |
| 712 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 713 | __ Str(XRegisterFrom(invoke->GetLocations()->InAt(1)), |
| 714 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 715 | } |
| 716 | |
| 717 | void IntrinsicLocationsBuilderARM64::VisitMemoryPokeShortNative(HInvoke* invoke) { |
| 718 | CreateIntIntToVoidLocations(arena_, invoke); |
| 719 | } |
| 720 | |
| 721 | void IntrinsicCodeGeneratorARM64::VisitMemoryPokeShortNative(HInvoke* invoke) { |
| 722 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 723 | __ Strh(WRegisterFrom(invoke->GetLocations()->InAt(1)), |
| 724 | AbsoluteHeapOperandFrom(invoke->GetLocations()->InAt(0), 0)); |
| 725 | } |
| 726 | |
| 727 | void IntrinsicLocationsBuilderARM64::VisitThreadCurrentThread(HInvoke* invoke) { |
| 728 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 729 | LocationSummary::kNoCall, |
| 730 | kIntrinsified); |
| 731 | locations->SetOut(Location::RequiresRegister()); |
| 732 | } |
| 733 | |
| 734 | void IntrinsicCodeGeneratorARM64::VisitThreadCurrentThread(HInvoke* invoke) { |
| 735 | codegen_->Load(Primitive::kPrimNot, WRegisterFrom(invoke->GetLocations()->Out()), |
| 736 | MemOperand(tr, Thread::PeerOffset<8>().Int32Value())); |
| 737 | } |
| 738 | |
| 739 | static void GenUnsafeGet(HInvoke* invoke, |
| 740 | Primitive::Type type, |
| 741 | bool is_volatile, |
| 742 | CodeGeneratorARM64* codegen) { |
| 743 | LocationSummary* locations = invoke->GetLocations(); |
| 744 | DCHECK((type == Primitive::kPrimInt) || |
| 745 | (type == Primitive::kPrimLong) || |
| 746 | (type == Primitive::kPrimNot)); |
| 747 | vixl::MacroAssembler* masm = codegen->GetAssembler()->vixl_masm_; |
Roland Levillain | 22ccc3a | 2015-11-24 13:10:05 +0000 | [diff] [blame] | 748 | Location base_loc = locations->InAt(1); |
| 749 | Register base = WRegisterFrom(base_loc); // Object pointer. |
| 750 | Location offset_loc = locations->InAt(2); |
| 751 | Register offset = XRegisterFrom(offset_loc); // Long offset. |
| 752 | Location trg_loc = locations->Out(); |
| 753 | Register trg = RegisterFrom(trg_loc, type); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 754 | |
Roland Levillain | 4401586 | 2016-01-22 11:47:17 +0000 | [diff] [blame] | 755 | if (type == Primitive::kPrimNot && kEmitCompilerReadBarrier && kUseBakerReadBarrier) { |
| 756 | // UnsafeGetObject/UnsafeGetObjectVolatile with Baker's read barrier case. |
| 757 | UseScratchRegisterScope temps(masm); |
| 758 | Register temp = temps.AcquireW(); |
| 759 | codegen->GenerateArrayLoadWithBakerReadBarrier( |
| 760 | invoke, trg_loc, base, 0U, offset_loc, temp, /* needs_null_check */ false); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 761 | } else { |
Roland Levillain | 4401586 | 2016-01-22 11:47:17 +0000 | [diff] [blame] | 762 | // Other cases. |
| 763 | MemOperand mem_op(base.X(), offset); |
| 764 | if (is_volatile) { |
Serban Constantinescu | 4a6a67c | 2016-01-27 09:19:56 +0000 | [diff] [blame] | 765 | codegen->LoadAcquire(invoke, trg, mem_op, /* needs_null_check */ true); |
Roland Levillain | 4401586 | 2016-01-22 11:47:17 +0000 | [diff] [blame] | 766 | } else { |
| 767 | codegen->Load(type, trg, mem_op); |
| 768 | } |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 769 | |
Roland Levillain | 4401586 | 2016-01-22 11:47:17 +0000 | [diff] [blame] | 770 | if (type == Primitive::kPrimNot) { |
| 771 | DCHECK(trg.IsW()); |
| 772 | codegen->MaybeGenerateReadBarrierSlow(invoke, trg_loc, trg_loc, base_loc, 0U, offset_loc); |
| 773 | } |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 774 | } |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 775 | } |
| 776 | |
| 777 | static void CreateIntIntIntToIntLocations(ArenaAllocator* arena, HInvoke* invoke) { |
Roland Levillain | 22ccc3a | 2015-11-24 13:10:05 +0000 | [diff] [blame] | 778 | bool can_call = kEmitCompilerReadBarrier && |
| 779 | (invoke->GetIntrinsic() == Intrinsics::kUnsafeGetObject || |
| 780 | invoke->GetIntrinsic() == Intrinsics::kUnsafeGetObjectVolatile); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 781 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
Roland Levillain | 22ccc3a | 2015-11-24 13:10:05 +0000 | [diff] [blame] | 782 | can_call ? |
| 783 | LocationSummary::kCallOnSlowPath : |
| 784 | LocationSummary::kNoCall, |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 785 | kIntrinsified); |
| 786 | locations->SetInAt(0, Location::NoLocation()); // Unused receiver. |
| 787 | locations->SetInAt(1, Location::RequiresRegister()); |
| 788 | locations->SetInAt(2, Location::RequiresRegister()); |
| 789 | locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); |
| 790 | } |
| 791 | |
| 792 | void IntrinsicLocationsBuilderARM64::VisitUnsafeGet(HInvoke* invoke) { |
| 793 | CreateIntIntIntToIntLocations(arena_, invoke); |
| 794 | } |
| 795 | void IntrinsicLocationsBuilderARM64::VisitUnsafeGetVolatile(HInvoke* invoke) { |
| 796 | CreateIntIntIntToIntLocations(arena_, invoke); |
| 797 | } |
| 798 | void IntrinsicLocationsBuilderARM64::VisitUnsafeGetLong(HInvoke* invoke) { |
| 799 | CreateIntIntIntToIntLocations(arena_, invoke); |
| 800 | } |
| 801 | void IntrinsicLocationsBuilderARM64::VisitUnsafeGetLongVolatile(HInvoke* invoke) { |
| 802 | CreateIntIntIntToIntLocations(arena_, invoke); |
| 803 | } |
| 804 | void IntrinsicLocationsBuilderARM64::VisitUnsafeGetObject(HInvoke* invoke) { |
| 805 | CreateIntIntIntToIntLocations(arena_, invoke); |
| 806 | } |
| 807 | void IntrinsicLocationsBuilderARM64::VisitUnsafeGetObjectVolatile(HInvoke* invoke) { |
| 808 | CreateIntIntIntToIntLocations(arena_, invoke); |
| 809 | } |
| 810 | |
| 811 | void IntrinsicCodeGeneratorARM64::VisitUnsafeGet(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 812 | GenUnsafeGet(invoke, Primitive::kPrimInt, /* is_volatile */ false, codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 813 | } |
| 814 | void IntrinsicCodeGeneratorARM64::VisitUnsafeGetVolatile(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 815 | GenUnsafeGet(invoke, Primitive::kPrimInt, /* is_volatile */ true, codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 816 | } |
| 817 | void IntrinsicCodeGeneratorARM64::VisitUnsafeGetLong(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 818 | GenUnsafeGet(invoke, Primitive::kPrimLong, /* is_volatile */ false, codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 819 | } |
| 820 | void IntrinsicCodeGeneratorARM64::VisitUnsafeGetLongVolatile(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 821 | GenUnsafeGet(invoke, Primitive::kPrimLong, /* is_volatile */ true, codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 822 | } |
| 823 | void IntrinsicCodeGeneratorARM64::VisitUnsafeGetObject(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 824 | GenUnsafeGet(invoke, Primitive::kPrimNot, /* is_volatile */ false, codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 825 | } |
| 826 | void IntrinsicCodeGeneratorARM64::VisitUnsafeGetObjectVolatile(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 827 | GenUnsafeGet(invoke, Primitive::kPrimNot, /* is_volatile */ true, codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 828 | } |
| 829 | |
| 830 | static void CreateIntIntIntIntToVoid(ArenaAllocator* arena, HInvoke* invoke) { |
| 831 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 832 | LocationSummary::kNoCall, |
| 833 | kIntrinsified); |
| 834 | locations->SetInAt(0, Location::NoLocation()); // Unused receiver. |
| 835 | locations->SetInAt(1, Location::RequiresRegister()); |
| 836 | locations->SetInAt(2, Location::RequiresRegister()); |
| 837 | locations->SetInAt(3, Location::RequiresRegister()); |
| 838 | } |
| 839 | |
| 840 | void IntrinsicLocationsBuilderARM64::VisitUnsafePut(HInvoke* invoke) { |
| 841 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 842 | } |
| 843 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutOrdered(HInvoke* invoke) { |
| 844 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 845 | } |
| 846 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutVolatile(HInvoke* invoke) { |
| 847 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 848 | } |
| 849 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutObject(HInvoke* invoke) { |
| 850 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 851 | } |
| 852 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutObjectOrdered(HInvoke* invoke) { |
| 853 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 854 | } |
| 855 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutObjectVolatile(HInvoke* invoke) { |
| 856 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 857 | } |
| 858 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutLong(HInvoke* invoke) { |
| 859 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 860 | } |
| 861 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutLongOrdered(HInvoke* invoke) { |
| 862 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 863 | } |
| 864 | void IntrinsicLocationsBuilderARM64::VisitUnsafePutLongVolatile(HInvoke* invoke) { |
| 865 | CreateIntIntIntIntToVoid(arena_, invoke); |
| 866 | } |
| 867 | |
| 868 | static void GenUnsafePut(LocationSummary* locations, |
| 869 | Primitive::Type type, |
| 870 | bool is_volatile, |
| 871 | bool is_ordered, |
| 872 | CodeGeneratorARM64* codegen) { |
| 873 | vixl::MacroAssembler* masm = codegen->GetAssembler()->vixl_masm_; |
| 874 | |
| 875 | Register base = WRegisterFrom(locations->InAt(1)); // Object pointer. |
| 876 | Register offset = XRegisterFrom(locations->InAt(2)); // Long offset. |
| 877 | Register value = RegisterFrom(locations->InAt(3), type); |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 878 | Register source = value; |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 879 | MemOperand mem_op(base.X(), offset); |
| 880 | |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 881 | { |
| 882 | // We use a block to end the scratch scope before the write barrier, thus |
| 883 | // freeing the temporary registers so they can be used in `MarkGCCard`. |
| 884 | UseScratchRegisterScope temps(masm); |
| 885 | |
| 886 | if (kPoisonHeapReferences && type == Primitive::kPrimNot) { |
| 887 | DCHECK(value.IsW()); |
| 888 | Register temp = temps.AcquireW(); |
| 889 | __ Mov(temp.W(), value.W()); |
| 890 | codegen->GetAssembler()->PoisonHeapReference(temp.W()); |
| 891 | source = temp; |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 892 | } |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 893 | |
| 894 | if (is_volatile || is_ordered) { |
Serban Constantinescu | 4a6a67c | 2016-01-27 09:19:56 +0000 | [diff] [blame] | 895 | codegen->StoreRelease(type, source, mem_op); |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 896 | } else { |
| 897 | codegen->Store(type, source, mem_op); |
| 898 | } |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 899 | } |
| 900 | |
| 901 | if (type == Primitive::kPrimNot) { |
Nicolas Geoffray | 07276db | 2015-05-18 14:22:09 +0100 | [diff] [blame] | 902 | bool value_can_be_null = true; // TODO: Worth finding out this information? |
| 903 | codegen->MarkGCCard(base, value, value_can_be_null); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 904 | } |
| 905 | } |
| 906 | |
| 907 | void IntrinsicCodeGeneratorARM64::VisitUnsafePut(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 908 | GenUnsafePut(invoke->GetLocations(), |
| 909 | Primitive::kPrimInt, |
| 910 | /* is_volatile */ false, |
| 911 | /* is_ordered */ false, |
| 912 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 913 | } |
| 914 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutOrdered(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 915 | GenUnsafePut(invoke->GetLocations(), |
| 916 | Primitive::kPrimInt, |
| 917 | /* is_volatile */ false, |
| 918 | /* is_ordered */ true, |
| 919 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 920 | } |
| 921 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutVolatile(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 922 | GenUnsafePut(invoke->GetLocations(), |
| 923 | Primitive::kPrimInt, |
| 924 | /* is_volatile */ true, |
| 925 | /* is_ordered */ false, |
| 926 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 927 | } |
| 928 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutObject(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 929 | GenUnsafePut(invoke->GetLocations(), |
| 930 | Primitive::kPrimNot, |
| 931 | /* is_volatile */ false, |
| 932 | /* is_ordered */ false, |
| 933 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 934 | } |
| 935 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutObjectOrdered(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 936 | GenUnsafePut(invoke->GetLocations(), |
| 937 | Primitive::kPrimNot, |
| 938 | /* is_volatile */ false, |
| 939 | /* is_ordered */ true, |
| 940 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 941 | } |
| 942 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutObjectVolatile(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 943 | GenUnsafePut(invoke->GetLocations(), |
| 944 | Primitive::kPrimNot, |
| 945 | /* is_volatile */ true, |
| 946 | /* is_ordered */ false, |
| 947 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 948 | } |
| 949 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutLong(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 950 | GenUnsafePut(invoke->GetLocations(), |
| 951 | Primitive::kPrimLong, |
| 952 | /* is_volatile */ false, |
| 953 | /* is_ordered */ false, |
| 954 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 955 | } |
| 956 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutLongOrdered(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 957 | GenUnsafePut(invoke->GetLocations(), |
| 958 | Primitive::kPrimLong, |
| 959 | /* is_volatile */ false, |
| 960 | /* is_ordered */ true, |
| 961 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 962 | } |
| 963 | void IntrinsicCodeGeneratorARM64::VisitUnsafePutLongVolatile(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 964 | GenUnsafePut(invoke->GetLocations(), |
| 965 | Primitive::kPrimLong, |
| 966 | /* is_volatile */ true, |
| 967 | /* is_ordered */ false, |
| 968 | codegen_); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 969 | } |
| 970 | |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 971 | static void CreateIntIntIntIntIntToInt(ArenaAllocator* arena, |
| 972 | HInvoke* invoke, |
| 973 | Primitive::Type type) { |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 974 | LocationSummary* locations = new (arena) LocationSummary(invoke, |
| 975 | LocationSummary::kNoCall, |
| 976 | kIntrinsified); |
| 977 | locations->SetInAt(0, Location::NoLocation()); // Unused receiver. |
| 978 | locations->SetInAt(1, Location::RequiresRegister()); |
| 979 | locations->SetInAt(2, Location::RequiresRegister()); |
| 980 | locations->SetInAt(3, Location::RequiresRegister()); |
| 981 | locations->SetInAt(4, Location::RequiresRegister()); |
| 982 | |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 983 | // If heap poisoning is enabled, we don't want the unpoisoning |
| 984 | // operations to potentially clobber the output. |
| 985 | Location::OutputOverlap overlaps = (kPoisonHeapReferences && type == Primitive::kPrimNot) |
| 986 | ? Location::kOutputOverlap |
| 987 | : Location::kNoOutputOverlap; |
| 988 | locations->SetOut(Location::RequiresRegister(), overlaps); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 989 | } |
| 990 | |
| 991 | static void GenCas(LocationSummary* locations, Primitive::Type type, CodeGeneratorARM64* codegen) { |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 992 | vixl::MacroAssembler* masm = codegen->GetAssembler()->vixl_masm_; |
| 993 | |
| 994 | Register out = WRegisterFrom(locations->Out()); // Boolean result. |
| 995 | |
| 996 | Register base = WRegisterFrom(locations->InAt(1)); // Object pointer. |
| 997 | Register offset = XRegisterFrom(locations->InAt(2)); // Long offset. |
| 998 | Register expected = RegisterFrom(locations->InAt(3), type); // Expected. |
| 999 | Register value = RegisterFrom(locations->InAt(4), type); // Value. |
| 1000 | |
| 1001 | // This needs to be before the temp registers, as MarkGCCard also uses VIXL temps. |
| 1002 | if (type == Primitive::kPrimNot) { |
| 1003 | // Mark card for object assuming new value is stored. |
Nicolas Geoffray | 07276db | 2015-05-18 14:22:09 +0100 | [diff] [blame] | 1004 | bool value_can_be_null = true; // TODO: Worth finding out this information? |
| 1005 | codegen->MarkGCCard(base, value, value_can_be_null); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | UseScratchRegisterScope temps(masm); |
| 1009 | Register tmp_ptr = temps.AcquireX(); // Pointer to actual memory. |
| 1010 | Register tmp_value = temps.AcquireSameSizeAs(value); // Value in memory. |
| 1011 | |
| 1012 | Register tmp_32 = tmp_value.W(); |
| 1013 | |
| 1014 | __ Add(tmp_ptr, base.X(), Operand(offset)); |
| 1015 | |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 1016 | if (kPoisonHeapReferences && type == Primitive::kPrimNot) { |
| 1017 | codegen->GetAssembler()->PoisonHeapReference(expected); |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 1018 | if (value.Is(expected)) { |
| 1019 | // Do not poison `value`, as it is the same register as |
| 1020 | // `expected`, which has just been poisoned. |
| 1021 | } else { |
| 1022 | codegen->GetAssembler()->PoisonHeapReference(value); |
| 1023 | } |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 1024 | } |
| 1025 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1026 | // do { |
| 1027 | // tmp_value = [tmp_ptr] - expected; |
| 1028 | // } while (tmp_value == 0 && failure([tmp_ptr] <- r_new_value)); |
| 1029 | // result = tmp_value != 0; |
| 1030 | |
| 1031 | vixl::Label loop_head, exit_loop; |
Serban Constantinescu | 4a6a67c | 2016-01-27 09:19:56 +0000 | [diff] [blame] | 1032 | __ Bind(&loop_head); |
| 1033 | // TODO: When `type == Primitive::kPrimNot`, add a read barrier for |
| 1034 | // the reference stored in the object before attempting the CAS, |
| 1035 | // similar to the one in the art::Unsafe_compareAndSwapObject JNI |
| 1036 | // implementation. |
| 1037 | // |
| 1038 | // Note that this code is not (yet) used when read barriers are |
| 1039 | // enabled (see IntrinsicLocationsBuilderARM64::VisitUnsafeCASObject). |
| 1040 | DCHECK(!(type == Primitive::kPrimNot && kEmitCompilerReadBarrier)); |
| 1041 | __ Ldaxr(tmp_value, MemOperand(tmp_ptr)); |
| 1042 | __ Cmp(tmp_value, expected); |
| 1043 | __ B(&exit_loop, ne); |
| 1044 | __ Stlxr(tmp_32, value, MemOperand(tmp_ptr)); |
| 1045 | __ Cbnz(tmp_32, &loop_head); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1046 | __ Bind(&exit_loop); |
| 1047 | __ Cset(out, eq); |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 1048 | |
| 1049 | if (kPoisonHeapReferences && type == Primitive::kPrimNot) { |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 1050 | codegen->GetAssembler()->UnpoisonHeapReference(expected); |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 1051 | if (value.Is(expected)) { |
| 1052 | // Do not unpoison `value`, as it is the same register as |
| 1053 | // `expected`, which has just been unpoisoned. |
| 1054 | } else { |
| 1055 | codegen->GetAssembler()->UnpoisonHeapReference(value); |
| 1056 | } |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 1057 | } |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | void IntrinsicLocationsBuilderARM64::VisitUnsafeCASInt(HInvoke* invoke) { |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 1061 | CreateIntIntIntIntIntToInt(arena_, invoke, Primitive::kPrimInt); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1062 | } |
| 1063 | void IntrinsicLocationsBuilderARM64::VisitUnsafeCASLong(HInvoke* invoke) { |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 1064 | CreateIntIntIntIntIntToInt(arena_, invoke, Primitive::kPrimLong); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1065 | } |
| 1066 | void IntrinsicLocationsBuilderARM64::VisitUnsafeCASObject(HInvoke* invoke) { |
Roland Levillain | 391b866 | 2015-12-18 11:43:38 +0000 | [diff] [blame] | 1067 | // The UnsafeCASObject intrinsic is missing a read barrier, and |
| 1068 | // therefore sometimes does not work as expected (b/25883050). |
| 1069 | // Turn it off temporarily as a quick fix, until the read barrier is |
| 1070 | // implemented (see TODO in GenCAS below). |
| 1071 | // |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 1072 | // TODO(rpl): Fix this issue and re-enable this intrinsic with read barriers. |
| 1073 | if (kEmitCompilerReadBarrier) { |
Roland Levillain | 985ff70 | 2015-10-23 13:25:35 +0100 | [diff] [blame] | 1074 | return; |
| 1075 | } |
| 1076 | |
Roland Levillain | 2e50ecb | 2016-01-27 14:08:33 +0000 | [diff] [blame] | 1077 | CreateIntIntIntIntIntToInt(arena_, invoke, Primitive::kPrimNot); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1078 | } |
| 1079 | |
| 1080 | void IntrinsicCodeGeneratorARM64::VisitUnsafeCASInt(HInvoke* invoke) { |
| 1081 | GenCas(invoke->GetLocations(), Primitive::kPrimInt, codegen_); |
| 1082 | } |
| 1083 | void IntrinsicCodeGeneratorARM64::VisitUnsafeCASLong(HInvoke* invoke) { |
| 1084 | GenCas(invoke->GetLocations(), Primitive::kPrimLong, codegen_); |
| 1085 | } |
| 1086 | void IntrinsicCodeGeneratorARM64::VisitUnsafeCASObject(HInvoke* invoke) { |
| 1087 | GenCas(invoke->GetLocations(), Primitive::kPrimNot, codegen_); |
| 1088 | } |
| 1089 | |
| 1090 | void IntrinsicLocationsBuilderARM64::VisitStringCharAt(HInvoke* invoke) { |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1091 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1092 | LocationSummary::kCallOnSlowPath, |
| 1093 | kIntrinsified); |
| 1094 | locations->SetInAt(0, Location::RequiresRegister()); |
| 1095 | locations->SetInAt(1, Location::RequiresRegister()); |
Nicolas Geoffray | 82f3449 | 2015-02-04 10:44:23 +0000 | [diff] [blame] | 1096 | // In case we need to go in the slow path, we can't have the output be the same |
| 1097 | // as the input: the current liveness analysis considers the input to be live |
| 1098 | // at the point of the call. |
| 1099 | locations->SetOut(Location::RequiresRegister(), Location::kOutputOverlap); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1100 | } |
| 1101 | |
| 1102 | void IntrinsicCodeGeneratorARM64::VisitStringCharAt(HInvoke* invoke) { |
| 1103 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1104 | LocationSummary* locations = invoke->GetLocations(); |
| 1105 | |
| 1106 | // Location of reference to data array |
| 1107 | const MemberOffset value_offset = mirror::String::ValueOffset(); |
| 1108 | // Location of count |
| 1109 | const MemberOffset count_offset = mirror::String::CountOffset(); |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1110 | |
| 1111 | Register obj = WRegisterFrom(locations->InAt(0)); // String object pointer. |
| 1112 | Register idx = WRegisterFrom(locations->InAt(1)); // Index of character. |
| 1113 | Register out = WRegisterFrom(locations->Out()); // Result character. |
| 1114 | |
| 1115 | UseScratchRegisterScope temps(masm); |
| 1116 | Register temp = temps.AcquireW(); |
| 1117 | Register array_temp = temps.AcquireW(); // We can trade this for worse scheduling. |
| 1118 | |
| 1119 | // TODO: Maybe we can support range check elimination. Overall, though, I think it's not worth |
| 1120 | // the cost. |
| 1121 | // TODO: For simplicity, the index parameter is requested in a register, so different from Quick |
| 1122 | // we will not optimize the code for constants (which would save a register). |
| 1123 | |
| 1124 | SlowPathCodeARM64* slow_path = new (GetAllocator()) IntrinsicSlowPathARM64(invoke); |
| 1125 | codegen_->AddSlowPath(slow_path); |
| 1126 | |
| 1127 | __ Ldr(temp, HeapOperand(obj, count_offset)); // temp = str.length. |
| 1128 | codegen_->MaybeRecordImplicitNullCheck(invoke); |
| 1129 | __ Cmp(idx, temp); |
| 1130 | __ B(hs, slow_path->GetEntryLabel()); |
| 1131 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 1132 | __ Add(array_temp, obj, Operand(value_offset.Int32Value())); // array_temp := str.value. |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1133 | |
| 1134 | // Load the value. |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 1135 | __ Ldrh(out, MemOperand(array_temp.X(), idx, UXTW, 1)); // out := array_temp[idx]. |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1136 | |
| 1137 | __ Bind(slow_path->GetExitLabel()); |
| 1138 | } |
| 1139 | |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 1140 | void IntrinsicLocationsBuilderARM64::VisitStringCompareTo(HInvoke* invoke) { |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 1141 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1142 | LocationSummary::kCall, |
| 1143 | kIntrinsified); |
| 1144 | InvokeRuntimeCallingConvention calling_convention; |
| 1145 | locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(0))); |
| 1146 | locations->SetInAt(1, LocationFrom(calling_convention.GetRegisterAt(1))); |
| 1147 | locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimInt)); |
| 1148 | } |
| 1149 | |
| 1150 | void IntrinsicCodeGeneratorARM64::VisitStringCompareTo(HInvoke* invoke) { |
| 1151 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1152 | LocationSummary* locations = invoke->GetLocations(); |
| 1153 | |
Nicolas Geoffray | 512e04d | 2015-03-27 17:21:24 +0000 | [diff] [blame] | 1154 | // Note that the null check must have been done earlier. |
Calin Juravle | 641547a | 2015-04-21 22:08:51 +0100 | [diff] [blame] | 1155 | DCHECK(!invoke->CanDoImplicitNullCheckOn(invoke->InputAt(0))); |
Nicolas Geoffray | d75948a | 2015-03-27 09:53:16 +0000 | [diff] [blame] | 1156 | |
| 1157 | Register argument = WRegisterFrom(locations->InAt(1)); |
| 1158 | __ Cmp(argument, 0); |
| 1159 | SlowPathCodeARM64* slow_path = new (GetAllocator()) IntrinsicSlowPathARM64(invoke); |
| 1160 | codegen_->AddSlowPath(slow_path); |
| 1161 | __ B(eq, slow_path->GetEntryLabel()); |
| 1162 | |
| 1163 | __ Ldr( |
| 1164 | lr, MemOperand(tr, QUICK_ENTRYPOINT_OFFSET(kArm64WordSize, pStringCompareTo).Int32Value())); |
| 1165 | __ Blr(lr); |
| 1166 | __ Bind(slow_path->GetExitLabel()); |
| 1167 | } |
| 1168 | |
Agi Csaki | ea34b40 | 2015-08-13 17:51:19 -0700 | [diff] [blame] | 1169 | void IntrinsicLocationsBuilderARM64::VisitStringEquals(HInvoke* invoke) { |
| 1170 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1171 | LocationSummary::kNoCall, |
| 1172 | kIntrinsified); |
| 1173 | locations->SetInAt(0, Location::RequiresRegister()); |
| 1174 | locations->SetInAt(1, Location::RequiresRegister()); |
| 1175 | // Temporary registers to store lengths of strings and for calculations. |
| 1176 | locations->AddTemp(Location::RequiresRegister()); |
| 1177 | locations->AddTemp(Location::RequiresRegister()); |
| 1178 | |
| 1179 | locations->SetOut(Location::RequiresRegister(), Location::kOutputOverlap); |
| 1180 | } |
| 1181 | |
| 1182 | void IntrinsicCodeGeneratorARM64::VisitStringEquals(HInvoke* invoke) { |
| 1183 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1184 | LocationSummary* locations = invoke->GetLocations(); |
| 1185 | |
| 1186 | Register str = WRegisterFrom(locations->InAt(0)); |
| 1187 | Register arg = WRegisterFrom(locations->InAt(1)); |
| 1188 | Register out = XRegisterFrom(locations->Out()); |
| 1189 | |
| 1190 | UseScratchRegisterScope scratch_scope(masm); |
| 1191 | Register temp = scratch_scope.AcquireW(); |
| 1192 | Register temp1 = WRegisterFrom(locations->GetTemp(0)); |
| 1193 | Register temp2 = WRegisterFrom(locations->GetTemp(1)); |
| 1194 | |
| 1195 | vixl::Label loop; |
| 1196 | vixl::Label end; |
| 1197 | vixl::Label return_true; |
| 1198 | vixl::Label return_false; |
| 1199 | |
| 1200 | // Get offsets of count, value, and class fields within a string object. |
| 1201 | const int32_t count_offset = mirror::String::CountOffset().Int32Value(); |
| 1202 | const int32_t value_offset = mirror::String::ValueOffset().Int32Value(); |
| 1203 | const int32_t class_offset = mirror::Object::ClassOffset().Int32Value(); |
| 1204 | |
| 1205 | // Note that the null check must have been done earlier. |
| 1206 | DCHECK(!invoke->CanDoImplicitNullCheckOn(invoke->InputAt(0))); |
| 1207 | |
| 1208 | // Check if input is null, return false if it is. |
| 1209 | __ Cbz(arg, &return_false); |
| 1210 | |
| 1211 | // Reference equality check, return true if same reference. |
| 1212 | __ Cmp(str, arg); |
| 1213 | __ B(&return_true, eq); |
| 1214 | |
| 1215 | // Instanceof check for the argument by comparing class fields. |
| 1216 | // All string objects must have the same type since String cannot be subclassed. |
| 1217 | // Receiver must be a string object, so its class field is equal to all strings' class fields. |
| 1218 | // If the argument is a string object, its class field must be equal to receiver's class field. |
| 1219 | __ Ldr(temp, MemOperand(str.X(), class_offset)); |
| 1220 | __ Ldr(temp1, MemOperand(arg.X(), class_offset)); |
| 1221 | __ Cmp(temp, temp1); |
| 1222 | __ B(&return_false, ne); |
| 1223 | |
| 1224 | // Load lengths of this and argument strings. |
| 1225 | __ Ldr(temp, MemOperand(str.X(), count_offset)); |
| 1226 | __ Ldr(temp1, MemOperand(arg.X(), count_offset)); |
| 1227 | // Check if lengths are equal, return false if they're not. |
| 1228 | __ Cmp(temp, temp1); |
| 1229 | __ B(&return_false, ne); |
| 1230 | // Store offset of string value in preparation for comparison loop |
| 1231 | __ Mov(temp1, value_offset); |
| 1232 | // Return true if both strings are empty. |
| 1233 | __ Cbz(temp, &return_true); |
| 1234 | |
| 1235 | // Assertions that must hold in order to compare strings 4 characters at a time. |
| 1236 | DCHECK_ALIGNED(value_offset, 8); |
| 1237 | static_assert(IsAligned<8>(kObjectAlignment), "String of odd length is not zero padded"); |
| 1238 | |
| 1239 | temp1 = temp1.X(); |
| 1240 | temp2 = temp2.X(); |
| 1241 | |
| 1242 | // Loop to compare strings 4 characters at a time starting at the beginning of the string. |
| 1243 | // Ok to do this because strings are zero-padded to be 8-byte aligned. |
| 1244 | __ Bind(&loop); |
| 1245 | __ Ldr(out, MemOperand(str.X(), temp1)); |
| 1246 | __ Ldr(temp2, MemOperand(arg.X(), temp1)); |
| 1247 | __ Add(temp1, temp1, Operand(sizeof(uint64_t))); |
| 1248 | __ Cmp(out, temp2); |
| 1249 | __ B(&return_false, ne); |
| 1250 | __ Sub(temp, temp, Operand(4), SetFlags); |
| 1251 | __ B(&loop, gt); |
| 1252 | |
| 1253 | // Return true and exit the function. |
| 1254 | // If loop does not result in returning false, we return true. |
| 1255 | __ Bind(&return_true); |
| 1256 | __ Mov(out, 1); |
| 1257 | __ B(&end); |
| 1258 | |
| 1259 | // Return false and exit the function. |
| 1260 | __ Bind(&return_false); |
| 1261 | __ Mov(out, 0); |
| 1262 | __ Bind(&end); |
| 1263 | } |
| 1264 | |
Andreas Gampe | ba6fdbc | 2015-05-07 22:31:55 -0700 | [diff] [blame] | 1265 | static void GenerateVisitStringIndexOf(HInvoke* invoke, |
| 1266 | vixl::MacroAssembler* masm, |
| 1267 | CodeGeneratorARM64* codegen, |
| 1268 | ArenaAllocator* allocator, |
| 1269 | bool start_at_zero) { |
| 1270 | LocationSummary* locations = invoke->GetLocations(); |
| 1271 | Register tmp_reg = WRegisterFrom(locations->GetTemp(0)); |
| 1272 | |
| 1273 | // Note that the null check must have been done earlier. |
| 1274 | DCHECK(!invoke->CanDoImplicitNullCheckOn(invoke->InputAt(0))); |
| 1275 | |
| 1276 | // Check for code points > 0xFFFF. Either a slow-path check when we don't know statically, |
| 1277 | // or directly dispatch if we have a constant. |
| 1278 | SlowPathCodeARM64* slow_path = nullptr; |
| 1279 | if (invoke->InputAt(1)->IsIntConstant()) { |
| 1280 | if (static_cast<uint32_t>(invoke->InputAt(1)->AsIntConstant()->GetValue()) > 0xFFFFU) { |
| 1281 | // Always needs the slow-path. We could directly dispatch to it, but this case should be |
| 1282 | // rare, so for simplicity just put the full slow-path down and branch unconditionally. |
| 1283 | slow_path = new (allocator) IntrinsicSlowPathARM64(invoke); |
| 1284 | codegen->AddSlowPath(slow_path); |
| 1285 | __ B(slow_path->GetEntryLabel()); |
| 1286 | __ Bind(slow_path->GetExitLabel()); |
| 1287 | return; |
| 1288 | } |
| 1289 | } else { |
| 1290 | Register char_reg = WRegisterFrom(locations->InAt(1)); |
| 1291 | __ Mov(tmp_reg, 0xFFFF); |
| 1292 | __ Cmp(char_reg, Operand(tmp_reg)); |
| 1293 | slow_path = new (allocator) IntrinsicSlowPathARM64(invoke); |
| 1294 | codegen->AddSlowPath(slow_path); |
| 1295 | __ B(hi, slow_path->GetEntryLabel()); |
| 1296 | } |
| 1297 | |
| 1298 | if (start_at_zero) { |
| 1299 | // Start-index = 0. |
| 1300 | __ Mov(tmp_reg, 0); |
| 1301 | } |
| 1302 | |
| 1303 | __ Ldr(lr, MemOperand(tr, QUICK_ENTRYPOINT_OFFSET(kArm64WordSize, pIndexOf).Int32Value())); |
| 1304 | __ Blr(lr); |
| 1305 | |
| 1306 | if (slow_path != nullptr) { |
| 1307 | __ Bind(slow_path->GetExitLabel()); |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | void IntrinsicLocationsBuilderARM64::VisitStringIndexOf(HInvoke* invoke) { |
| 1312 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1313 | LocationSummary::kCall, |
| 1314 | kIntrinsified); |
| 1315 | // We have a hand-crafted assembly stub that follows the runtime calling convention. So it's |
| 1316 | // best to align the inputs accordingly. |
| 1317 | InvokeRuntimeCallingConvention calling_convention; |
| 1318 | locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(0))); |
| 1319 | locations->SetInAt(1, LocationFrom(calling_convention.GetRegisterAt(1))); |
| 1320 | locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimInt)); |
| 1321 | |
| 1322 | // Need a temp for slow-path codepoint compare, and need to send start_index=0. |
| 1323 | locations->AddTemp(LocationFrom(calling_convention.GetRegisterAt(2))); |
| 1324 | } |
| 1325 | |
| 1326 | void IntrinsicCodeGeneratorARM64::VisitStringIndexOf(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 1327 | GenerateVisitStringIndexOf( |
| 1328 | invoke, GetVIXLAssembler(), codegen_, GetAllocator(), /* start_at_zero */ true); |
Andreas Gampe | ba6fdbc | 2015-05-07 22:31:55 -0700 | [diff] [blame] | 1329 | } |
| 1330 | |
| 1331 | void IntrinsicLocationsBuilderARM64::VisitStringIndexOfAfter(HInvoke* invoke) { |
| 1332 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1333 | LocationSummary::kCall, |
| 1334 | kIntrinsified); |
| 1335 | // We have a hand-crafted assembly stub that follows the runtime calling convention. So it's |
| 1336 | // best to align the inputs accordingly. |
| 1337 | InvokeRuntimeCallingConvention calling_convention; |
| 1338 | locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(0))); |
| 1339 | locations->SetInAt(1, LocationFrom(calling_convention.GetRegisterAt(1))); |
| 1340 | locations->SetInAt(2, LocationFrom(calling_convention.GetRegisterAt(2))); |
| 1341 | locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimInt)); |
| 1342 | |
| 1343 | // Need a temp for slow-path codepoint compare. |
| 1344 | locations->AddTemp(Location::RequiresRegister()); |
| 1345 | } |
| 1346 | |
| 1347 | void IntrinsicCodeGeneratorARM64::VisitStringIndexOfAfter(HInvoke* invoke) { |
Roland Levillain | bf84a3d | 2015-12-04 14:33:02 +0000 | [diff] [blame] | 1348 | GenerateVisitStringIndexOf( |
| 1349 | invoke, GetVIXLAssembler(), codegen_, GetAllocator(), /* start_at_zero */ false); |
Andreas Gampe | ba6fdbc | 2015-05-07 22:31:55 -0700 | [diff] [blame] | 1350 | } |
| 1351 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 1352 | void IntrinsicLocationsBuilderARM64::VisitStringNewStringFromBytes(HInvoke* invoke) { |
| 1353 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1354 | LocationSummary::kCall, |
| 1355 | kIntrinsified); |
| 1356 | InvokeRuntimeCallingConvention calling_convention; |
| 1357 | locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(0))); |
| 1358 | locations->SetInAt(1, LocationFrom(calling_convention.GetRegisterAt(1))); |
| 1359 | locations->SetInAt(2, LocationFrom(calling_convention.GetRegisterAt(2))); |
| 1360 | locations->SetInAt(3, LocationFrom(calling_convention.GetRegisterAt(3))); |
| 1361 | locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimNot)); |
| 1362 | } |
| 1363 | |
| 1364 | void IntrinsicCodeGeneratorARM64::VisitStringNewStringFromBytes(HInvoke* invoke) { |
| 1365 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1366 | LocationSummary* locations = invoke->GetLocations(); |
| 1367 | |
| 1368 | Register byte_array = WRegisterFrom(locations->InAt(0)); |
| 1369 | __ Cmp(byte_array, 0); |
| 1370 | SlowPathCodeARM64* slow_path = new (GetAllocator()) IntrinsicSlowPathARM64(invoke); |
| 1371 | codegen_->AddSlowPath(slow_path); |
| 1372 | __ B(eq, slow_path->GetEntryLabel()); |
| 1373 | |
| 1374 | __ Ldr(lr, |
| 1375 | MemOperand(tr, QUICK_ENTRYPOINT_OFFSET(kArm64WordSize, pAllocStringFromBytes).Int32Value())); |
| 1376 | codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); |
| 1377 | __ Blr(lr); |
| 1378 | __ Bind(slow_path->GetExitLabel()); |
| 1379 | } |
| 1380 | |
| 1381 | void IntrinsicLocationsBuilderARM64::VisitStringNewStringFromChars(HInvoke* invoke) { |
| 1382 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1383 | LocationSummary::kCall, |
| 1384 | kIntrinsified); |
| 1385 | InvokeRuntimeCallingConvention calling_convention; |
| 1386 | locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(0))); |
| 1387 | locations->SetInAt(1, LocationFrom(calling_convention.GetRegisterAt(1))); |
| 1388 | locations->SetInAt(2, LocationFrom(calling_convention.GetRegisterAt(2))); |
| 1389 | locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimNot)); |
| 1390 | } |
| 1391 | |
| 1392 | void IntrinsicCodeGeneratorARM64::VisitStringNewStringFromChars(HInvoke* invoke) { |
| 1393 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1394 | |
Roland Levillain | cc3839c | 2016-02-29 16:23:48 +0000 | [diff] [blame^] | 1395 | // No need to emit code checking whether `locations->InAt(2)` is a null |
| 1396 | // pointer, as callers of the native method |
| 1397 | // |
| 1398 | // java.lang.StringFactory.newStringFromChars(int offset, int charCount, char[] data) |
| 1399 | // |
| 1400 | // all include a null check on `data` before calling that method. |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 1401 | __ Ldr(lr, |
| 1402 | MemOperand(tr, QUICK_ENTRYPOINT_OFFSET(kArm64WordSize, pAllocStringFromChars).Int32Value())); |
| 1403 | codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); |
| 1404 | __ Blr(lr); |
| 1405 | } |
| 1406 | |
| 1407 | void IntrinsicLocationsBuilderARM64::VisitStringNewStringFromString(HInvoke* invoke) { |
| 1408 | // The inputs plus one temp. |
| 1409 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1410 | LocationSummary::kCall, |
| 1411 | kIntrinsified); |
| 1412 | InvokeRuntimeCallingConvention calling_convention; |
| 1413 | locations->SetInAt(0, LocationFrom(calling_convention.GetRegisterAt(0))); |
| 1414 | locations->SetInAt(1, LocationFrom(calling_convention.GetRegisterAt(1))); |
| 1415 | locations->SetInAt(2, LocationFrom(calling_convention.GetRegisterAt(2))); |
| 1416 | locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimNot)); |
| 1417 | } |
| 1418 | |
| 1419 | void IntrinsicCodeGeneratorARM64::VisitStringNewStringFromString(HInvoke* invoke) { |
| 1420 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1421 | LocationSummary* locations = invoke->GetLocations(); |
| 1422 | |
| 1423 | Register string_to_copy = WRegisterFrom(locations->InAt(0)); |
| 1424 | __ Cmp(string_to_copy, 0); |
| 1425 | SlowPathCodeARM64* slow_path = new (GetAllocator()) IntrinsicSlowPathARM64(invoke); |
| 1426 | codegen_->AddSlowPath(slow_path); |
| 1427 | __ B(eq, slow_path->GetEntryLabel()); |
| 1428 | |
| 1429 | __ Ldr(lr, |
| 1430 | MemOperand(tr, QUICK_ENTRYPOINT_OFFSET(kArm64WordSize, pAllocStringFromString).Int32Value())); |
| 1431 | codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); |
| 1432 | __ Blr(lr); |
| 1433 | __ Bind(slow_path->GetExitLabel()); |
| 1434 | } |
| 1435 | |
Anton Kirilov | 02fc24e | 2016-01-20 16:48:19 +0000 | [diff] [blame] | 1436 | static void CreateFPToFPCallLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 1437 | DCHECK_EQ(invoke->GetNumberOfArguments(), 1U); |
| 1438 | DCHECK(Primitive::IsFloatingPointType(invoke->InputAt(0)->GetType())); |
| 1439 | DCHECK(Primitive::IsFloatingPointType(invoke->GetType())); |
| 1440 | |
| 1441 | LocationSummary* const locations = new (arena) LocationSummary(invoke, |
| 1442 | LocationSummary::kCall, |
| 1443 | kIntrinsified); |
| 1444 | InvokeRuntimeCallingConvention calling_convention; |
| 1445 | |
| 1446 | locations->SetInAt(0, LocationFrom(calling_convention.GetFpuRegisterAt(0))); |
| 1447 | locations->SetOut(calling_convention.GetReturnLocation(invoke->GetType())); |
| 1448 | } |
| 1449 | |
| 1450 | static void CreateFPFPToFPCallLocations(ArenaAllocator* arena, HInvoke* invoke) { |
| 1451 | DCHECK_EQ(invoke->GetNumberOfArguments(), 2U); |
| 1452 | DCHECK(Primitive::IsFloatingPointType(invoke->InputAt(0)->GetType())); |
| 1453 | DCHECK(Primitive::IsFloatingPointType(invoke->InputAt(1)->GetType())); |
| 1454 | DCHECK(Primitive::IsFloatingPointType(invoke->GetType())); |
| 1455 | |
| 1456 | LocationSummary* const locations = new (arena) LocationSummary(invoke, |
| 1457 | LocationSummary::kCall, |
| 1458 | kIntrinsified); |
| 1459 | InvokeRuntimeCallingConvention calling_convention; |
| 1460 | |
| 1461 | locations->SetInAt(0, LocationFrom(calling_convention.GetFpuRegisterAt(0))); |
| 1462 | locations->SetInAt(1, LocationFrom(calling_convention.GetFpuRegisterAt(1))); |
| 1463 | locations->SetOut(calling_convention.GetReturnLocation(invoke->GetType())); |
| 1464 | } |
| 1465 | |
| 1466 | static void GenFPToFPCall(HInvoke* invoke, |
| 1467 | vixl::MacroAssembler* masm, |
| 1468 | CodeGeneratorARM64* codegen, |
| 1469 | QuickEntrypointEnum entry) { |
| 1470 | __ Ldr(lr, MemOperand(tr, GetThreadOffset<kArm64WordSize>(entry).Int32Value())); |
| 1471 | __ Blr(lr); |
| 1472 | codegen->RecordPcInfo(invoke, invoke->GetDexPc()); |
| 1473 | } |
| 1474 | |
| 1475 | void IntrinsicLocationsBuilderARM64::VisitMathCos(HInvoke* invoke) { |
| 1476 | CreateFPToFPCallLocations(arena_, invoke); |
| 1477 | } |
| 1478 | |
| 1479 | void IntrinsicCodeGeneratorARM64::VisitMathCos(HInvoke* invoke) { |
| 1480 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickCos); |
| 1481 | } |
| 1482 | |
| 1483 | void IntrinsicLocationsBuilderARM64::VisitMathSin(HInvoke* invoke) { |
| 1484 | CreateFPToFPCallLocations(arena_, invoke); |
| 1485 | } |
| 1486 | |
| 1487 | void IntrinsicCodeGeneratorARM64::VisitMathSin(HInvoke* invoke) { |
| 1488 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickSin); |
| 1489 | } |
| 1490 | |
| 1491 | void IntrinsicLocationsBuilderARM64::VisitMathAcos(HInvoke* invoke) { |
| 1492 | CreateFPToFPCallLocations(arena_, invoke); |
| 1493 | } |
| 1494 | |
| 1495 | void IntrinsicCodeGeneratorARM64::VisitMathAcos(HInvoke* invoke) { |
| 1496 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickAcos); |
| 1497 | } |
| 1498 | |
| 1499 | void IntrinsicLocationsBuilderARM64::VisitMathAsin(HInvoke* invoke) { |
| 1500 | CreateFPToFPCallLocations(arena_, invoke); |
| 1501 | } |
| 1502 | |
| 1503 | void IntrinsicCodeGeneratorARM64::VisitMathAsin(HInvoke* invoke) { |
| 1504 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickAsin); |
| 1505 | } |
| 1506 | |
| 1507 | void IntrinsicLocationsBuilderARM64::VisitMathAtan(HInvoke* invoke) { |
| 1508 | CreateFPToFPCallLocations(arena_, invoke); |
| 1509 | } |
| 1510 | |
| 1511 | void IntrinsicCodeGeneratorARM64::VisitMathAtan(HInvoke* invoke) { |
| 1512 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickAtan); |
| 1513 | } |
| 1514 | |
| 1515 | void IntrinsicLocationsBuilderARM64::VisitMathCbrt(HInvoke* invoke) { |
| 1516 | CreateFPToFPCallLocations(arena_, invoke); |
| 1517 | } |
| 1518 | |
| 1519 | void IntrinsicCodeGeneratorARM64::VisitMathCbrt(HInvoke* invoke) { |
| 1520 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickCbrt); |
| 1521 | } |
| 1522 | |
| 1523 | void IntrinsicLocationsBuilderARM64::VisitMathCosh(HInvoke* invoke) { |
| 1524 | CreateFPToFPCallLocations(arena_, invoke); |
| 1525 | } |
| 1526 | |
| 1527 | void IntrinsicCodeGeneratorARM64::VisitMathCosh(HInvoke* invoke) { |
| 1528 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickCosh); |
| 1529 | } |
| 1530 | |
| 1531 | void IntrinsicLocationsBuilderARM64::VisitMathExp(HInvoke* invoke) { |
| 1532 | CreateFPToFPCallLocations(arena_, invoke); |
| 1533 | } |
| 1534 | |
| 1535 | void IntrinsicCodeGeneratorARM64::VisitMathExp(HInvoke* invoke) { |
| 1536 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickExp); |
| 1537 | } |
| 1538 | |
| 1539 | void IntrinsicLocationsBuilderARM64::VisitMathExpm1(HInvoke* invoke) { |
| 1540 | CreateFPToFPCallLocations(arena_, invoke); |
| 1541 | } |
| 1542 | |
| 1543 | void IntrinsicCodeGeneratorARM64::VisitMathExpm1(HInvoke* invoke) { |
| 1544 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickExpm1); |
| 1545 | } |
| 1546 | |
| 1547 | void IntrinsicLocationsBuilderARM64::VisitMathLog(HInvoke* invoke) { |
| 1548 | CreateFPToFPCallLocations(arena_, invoke); |
| 1549 | } |
| 1550 | |
| 1551 | void IntrinsicCodeGeneratorARM64::VisitMathLog(HInvoke* invoke) { |
| 1552 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickLog); |
| 1553 | } |
| 1554 | |
| 1555 | void IntrinsicLocationsBuilderARM64::VisitMathLog10(HInvoke* invoke) { |
| 1556 | CreateFPToFPCallLocations(arena_, invoke); |
| 1557 | } |
| 1558 | |
| 1559 | void IntrinsicCodeGeneratorARM64::VisitMathLog10(HInvoke* invoke) { |
| 1560 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickLog10); |
| 1561 | } |
| 1562 | |
| 1563 | void IntrinsicLocationsBuilderARM64::VisitMathSinh(HInvoke* invoke) { |
| 1564 | CreateFPToFPCallLocations(arena_, invoke); |
| 1565 | } |
| 1566 | |
| 1567 | void IntrinsicCodeGeneratorARM64::VisitMathSinh(HInvoke* invoke) { |
| 1568 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickSinh); |
| 1569 | } |
| 1570 | |
| 1571 | void IntrinsicLocationsBuilderARM64::VisitMathTan(HInvoke* invoke) { |
| 1572 | CreateFPToFPCallLocations(arena_, invoke); |
| 1573 | } |
| 1574 | |
| 1575 | void IntrinsicCodeGeneratorARM64::VisitMathTan(HInvoke* invoke) { |
| 1576 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickTan); |
| 1577 | } |
| 1578 | |
| 1579 | void IntrinsicLocationsBuilderARM64::VisitMathTanh(HInvoke* invoke) { |
| 1580 | CreateFPToFPCallLocations(arena_, invoke); |
| 1581 | } |
| 1582 | |
| 1583 | void IntrinsicCodeGeneratorARM64::VisitMathTanh(HInvoke* invoke) { |
| 1584 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickTanh); |
| 1585 | } |
| 1586 | |
| 1587 | void IntrinsicLocationsBuilderARM64::VisitMathAtan2(HInvoke* invoke) { |
| 1588 | CreateFPFPToFPCallLocations(arena_, invoke); |
| 1589 | } |
| 1590 | |
| 1591 | void IntrinsicCodeGeneratorARM64::VisitMathAtan2(HInvoke* invoke) { |
| 1592 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickAtan2); |
| 1593 | } |
| 1594 | |
| 1595 | void IntrinsicLocationsBuilderARM64::VisitMathHypot(HInvoke* invoke) { |
| 1596 | CreateFPFPToFPCallLocations(arena_, invoke); |
| 1597 | } |
| 1598 | |
| 1599 | void IntrinsicCodeGeneratorARM64::VisitMathHypot(HInvoke* invoke) { |
| 1600 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickHypot); |
| 1601 | } |
| 1602 | |
| 1603 | void IntrinsicLocationsBuilderARM64::VisitMathNextAfter(HInvoke* invoke) { |
| 1604 | CreateFPFPToFPCallLocations(arena_, invoke); |
| 1605 | } |
| 1606 | |
| 1607 | void IntrinsicCodeGeneratorARM64::VisitMathNextAfter(HInvoke* invoke) { |
| 1608 | GenFPToFPCall(invoke, GetVIXLAssembler(), codegen_, kQuickNextAfter); |
| 1609 | } |
| 1610 | |
Tim Zhang | 25abd6c | 2016-01-19 23:39:24 +0800 | [diff] [blame] | 1611 | void IntrinsicLocationsBuilderARM64::VisitStringGetCharsNoCheck(HInvoke* invoke) { |
| 1612 | LocationSummary* locations = new (arena_) LocationSummary(invoke, |
| 1613 | LocationSummary::kNoCall, |
| 1614 | kIntrinsified); |
| 1615 | locations->SetInAt(0, Location::RequiresRegister()); |
| 1616 | locations->SetInAt(1, Location::RequiresRegister()); |
| 1617 | locations->SetInAt(2, Location::RequiresRegister()); |
| 1618 | locations->SetInAt(3, Location::RequiresRegister()); |
| 1619 | locations->SetInAt(4, Location::RequiresRegister()); |
| 1620 | |
| 1621 | locations->AddTemp(Location::RequiresRegister()); |
| 1622 | locations->AddTemp(Location::RequiresRegister()); |
| 1623 | } |
| 1624 | |
| 1625 | void IntrinsicCodeGeneratorARM64::VisitStringGetCharsNoCheck(HInvoke* invoke) { |
| 1626 | vixl::MacroAssembler* masm = GetVIXLAssembler(); |
| 1627 | LocationSummary* locations = invoke->GetLocations(); |
| 1628 | |
| 1629 | // Check assumption that sizeof(Char) is 2 (used in scaling below). |
| 1630 | const size_t char_size = Primitive::ComponentSize(Primitive::kPrimChar); |
| 1631 | DCHECK_EQ(char_size, 2u); |
| 1632 | |
| 1633 | // Location of data in char array buffer. |
| 1634 | const uint32_t data_offset = mirror::Array::DataOffset(char_size).Uint32Value(); |
| 1635 | |
| 1636 | // Location of char array data in string. |
| 1637 | const uint32_t value_offset = mirror::String::ValueOffset().Uint32Value(); |
| 1638 | |
| 1639 | // void getCharsNoCheck(int srcBegin, int srcEnd, char[] dst, int dstBegin); |
| 1640 | // Since getChars() calls getCharsNoCheck() - we use registers rather than constants. |
| 1641 | Register srcObj = XRegisterFrom(locations->InAt(0)); |
| 1642 | Register srcBegin = XRegisterFrom(locations->InAt(1)); |
| 1643 | Register srcEnd = XRegisterFrom(locations->InAt(2)); |
| 1644 | Register dstObj = XRegisterFrom(locations->InAt(3)); |
| 1645 | Register dstBegin = XRegisterFrom(locations->InAt(4)); |
| 1646 | |
| 1647 | Register src_ptr = XRegisterFrom(locations->GetTemp(0)); |
| 1648 | Register src_ptr_end = XRegisterFrom(locations->GetTemp(1)); |
| 1649 | |
| 1650 | UseScratchRegisterScope temps(masm); |
| 1651 | Register dst_ptr = temps.AcquireX(); |
| 1652 | Register tmp = temps.AcquireW(); |
| 1653 | |
| 1654 | // src range to copy. |
| 1655 | __ Add(src_ptr, srcObj, Operand(value_offset)); |
| 1656 | __ Add(src_ptr_end, src_ptr, Operand(srcEnd, LSL, 1)); |
| 1657 | __ Add(src_ptr, src_ptr, Operand(srcBegin, LSL, 1)); |
| 1658 | |
| 1659 | // dst to be copied. |
| 1660 | __ Add(dst_ptr, dstObj, Operand(data_offset)); |
| 1661 | __ Add(dst_ptr, dst_ptr, Operand(dstBegin, LSL, 1)); |
| 1662 | |
| 1663 | // Do the copy. |
| 1664 | vixl::Label loop, done; |
| 1665 | __ Bind(&loop); |
| 1666 | __ Cmp(src_ptr, src_ptr_end); |
| 1667 | __ B(&done, eq); |
| 1668 | __ Ldrh(tmp, MemOperand(src_ptr, char_size, vixl::PostIndex)); |
| 1669 | __ Strh(tmp, MemOperand(dst_ptr, char_size, vixl::PostIndex)); |
| 1670 | __ B(&loop); |
| 1671 | __ Bind(&done); |
| 1672 | } |
| 1673 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1674 | // Unimplemented intrinsics. |
| 1675 | |
| 1676 | #define UNIMPLEMENTED_INTRINSIC(Name) \ |
| 1677 | void IntrinsicLocationsBuilderARM64::Visit ## Name(HInvoke* invoke ATTRIBUTE_UNUSED) { \ |
| 1678 | } \ |
| 1679 | void IntrinsicCodeGeneratorARM64::Visit ## Name(HInvoke* invoke ATTRIBUTE_UNUSED) { \ |
| 1680 | } |
| 1681 | |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 1682 | UNIMPLEMENTED_INTRINSIC(IntegerBitCount) |
Aart Bik | 3f67e69 | 2016-01-15 14:35:12 -0800 | [diff] [blame] | 1683 | UNIMPLEMENTED_INTRINSIC(LongBitCount) |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1684 | UNIMPLEMENTED_INTRINSIC(SystemArrayCopyChar) |
Nicolas Geoffray | ee3cf07 | 2015-10-06 11:45:02 +0100 | [diff] [blame] | 1685 | UNIMPLEMENTED_INTRINSIC(SystemArrayCopy) |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1686 | UNIMPLEMENTED_INTRINSIC(ReferenceGetReferent) |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1687 | |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1688 | UNIMPLEMENTED_INTRINSIC(FloatIsInfinite) |
| 1689 | UNIMPLEMENTED_INTRINSIC(DoubleIsInfinite) |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1690 | |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1691 | UNIMPLEMENTED_INTRINSIC(IntegerHighestOneBit) |
| 1692 | UNIMPLEMENTED_INTRINSIC(LongHighestOneBit) |
| 1693 | UNIMPLEMENTED_INTRINSIC(IntegerLowestOneBit) |
| 1694 | UNIMPLEMENTED_INTRINSIC(LongLowestOneBit) |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1695 | |
Aart Bik | a19616e | 2016-02-01 18:57:58 -0800 | [diff] [blame] | 1696 | // Handled as HIR instructions. |
Aart Bik | 2a6aad9 | 2016-02-25 11:32:32 -0800 | [diff] [blame] | 1697 | UNIMPLEMENTED_INTRINSIC(FloatFloatToIntBits) |
| 1698 | UNIMPLEMENTED_INTRINSIC(DoubleDoubleToLongBits) |
Aart Bik | 75a38b2 | 2016-02-17 10:41:50 -0800 | [diff] [blame] | 1699 | UNIMPLEMENTED_INTRINSIC(FloatIsNaN) |
| 1700 | UNIMPLEMENTED_INTRINSIC(DoubleIsNaN) |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1701 | UNIMPLEMENTED_INTRINSIC(IntegerRotateLeft) |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1702 | UNIMPLEMENTED_INTRINSIC(LongRotateLeft) |
Aart Bik | a19616e | 2016-02-01 18:57:58 -0800 | [diff] [blame] | 1703 | UNIMPLEMENTED_INTRINSIC(IntegerRotateRight) |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1704 | UNIMPLEMENTED_INTRINSIC(LongRotateRight) |
Aart Bik | a19616e | 2016-02-01 18:57:58 -0800 | [diff] [blame] | 1705 | UNIMPLEMENTED_INTRINSIC(IntegerCompare) |
| 1706 | UNIMPLEMENTED_INTRINSIC(LongCompare) |
| 1707 | UNIMPLEMENTED_INTRINSIC(IntegerSignum) |
| 1708 | UNIMPLEMENTED_INTRINSIC(LongSignum) |
Aart Bik | 59c9454 | 2016-01-25 14:20:58 -0800 | [diff] [blame] | 1709 | |
Roland Levillain | 4d02711 | 2015-07-01 15:41:14 +0100 | [diff] [blame] | 1710 | #undef UNIMPLEMENTED_INTRINSIC |
| 1711 | |
| 1712 | #undef __ |
| 1713 | |
Andreas Gampe | 878d58c | 2015-01-15 23:24:00 -0800 | [diff] [blame] | 1714 | } // namespace arm64 |
| 1715 | } // namespace art |