diff options
author | Roland Levillain <rpl@google.com> | 2014-11-13 14:11:42 +0000 |
---|---|---|
committer | Roland Levillain <rpl@google.com> | 2014-11-13 17:30:06 +0000 |
commit | 51d3fc40637fc73d4156ad617cd451b844cbb75e (patch) | |
tree | 21669a66124a23dfc78a8c3f1d8b89415bfb0271 /compiler/optimizing/code_generator_arm.cc | |
parent | d94a0a1d2868baaab49f4d2835bca086d98cf763 (diff) | |
download | art-51d3fc40637fc73d4156ad617cd451b844cbb75e.tar.gz art-51d3fc40637fc73d4156ad617cd451b844cbb75e.tar.bz2 art-51d3fc40637fc73d4156ad617cd451b844cbb75e.zip |
Add support for int-to-byte in the optimizing compiler.
- Add support for the int-to-byte Dex instruction in the
optimizing compiler.
- Implement the ARM and Thumb-2 SBFX instructions.
- Generate x86, x86-64 and ARM (but not ARM64) code for
char to byte, short to byte and int to byte
HTypeConversion nodes.
- Add related tests to test/422-type-conversion.
Change-Id: Ic8b8911b90d4b5281fad15bcee96bc3ee85dc577
Diffstat (limited to 'compiler/optimizing/code_generator_arm.cc')
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index be326dcece..0403c5e666 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -1348,6 +1348,22 @@ void LocationsBuilderARM::VisitTypeConversion(HTypeConversion* conversion) { Primitive::Type result_type = conversion->GetResultType(); Primitive::Type input_type = conversion->GetInputType(); switch (result_type) { + case Primitive::kPrimByte: + switch (input_type) { + case Primitive::kPrimShort: + case Primitive::kPrimInt: + case Primitive::kPrimChar: + // int-to-byte conversion. + locations->SetInAt(0, Location::RequiresRegister()); + locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap); + break; + + default: + LOG(FATAL) << "Unexpected type conversion from " << input_type + << " to " << result_type; + } + break; + case Primitive::kPrimInt: switch (input_type) { case Primitive::kPrimLong: @@ -1410,6 +1426,21 @@ void InstructionCodeGeneratorARM::VisitTypeConversion(HTypeConversion* conversio Primitive::Type result_type = conversion->GetResultType(); Primitive::Type input_type = conversion->GetInputType(); switch (result_type) { + case Primitive::kPrimByte: + switch (input_type) { + case Primitive::kPrimShort: + case Primitive::kPrimInt: + case Primitive::kPrimChar: + // int-to-byte conversion. + __ sbfx(out.As<Register>(), in.As<Register>(), 0, 8); + break; + + default: + LOG(FATAL) << "Unexpected type conversion from " << input_type + << " to " << result_type; + } + break; + case Primitive::kPrimInt: switch (input_type) { case Primitive::kPrimLong: |