OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return le; | 387 return le; |
388 case kFloatGreaterThan: | 388 case kFloatGreaterThan: |
389 return gt; | 389 return gt; |
390 case kOverflow: | 390 case kOverflow: |
391 return vs; | 391 return vs; |
392 case kNotOverflow: | 392 case kNotOverflow: |
393 return vc; | 393 return vc; |
394 case kUnorderedEqual: | 394 case kUnorderedEqual: |
395 case kUnorderedNotEqual: | 395 case kUnorderedNotEqual: |
396 break; | 396 break; |
| 397 case kPositiveOrZero: |
| 398 return pl; |
| 399 case kNegative: |
| 400 return mi; |
397 } | 401 } |
398 UNREACHABLE(); | 402 UNREACHABLE(); |
399 return nv; | 403 return nv; |
400 } | 404 } |
401 | 405 |
402 } // namespace | 406 } // namespace |
403 | 407 |
404 #define ASSEMBLE_BOUNDS_CHECK(offset, length, out_of_bounds) \ | 408 #define ASSEMBLE_BOUNDS_CHECK(offset, length, out_of_bounds) \ |
405 do { \ | 409 do { \ |
406 if (length.IsImmediate() && \ | 410 if (length.IsImmediate() && \ |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 case kArm64Add32: | 894 case kArm64Add32: |
891 if (FlagsModeField::decode(opcode) != kFlags_none) { | 895 if (FlagsModeField::decode(opcode) != kFlags_none) { |
892 __ Adds(i.OutputRegister32(), i.InputOrZeroRegister32(0), | 896 __ Adds(i.OutputRegister32(), i.InputOrZeroRegister32(0), |
893 i.InputOperand2_32(1)); | 897 i.InputOperand2_32(1)); |
894 } else { | 898 } else { |
895 __ Add(i.OutputRegister32(), i.InputOrZeroRegister32(0), | 899 __ Add(i.OutputRegister32(), i.InputOrZeroRegister32(0), |
896 i.InputOperand2_32(1)); | 900 i.InputOperand2_32(1)); |
897 } | 901 } |
898 break; | 902 break; |
899 case kArm64And: | 903 case kArm64And: |
900 __ And(i.OutputRegister(), i.InputOrZeroRegister64(0), | 904 if (FlagsModeField::decode(opcode) != kFlags_none) { |
901 i.InputOperand2_64(1)); | 905 // The ands instruction only sets N and Z, so only the following |
| 906 // conditions make sense. |
| 907 DCHECK(FlagsConditionField::decode(opcode) == kEqual || |
| 908 FlagsConditionField::decode(opcode) == kNotEqual || |
| 909 FlagsConditionField::decode(opcode) == kPositiveOrZero || |
| 910 FlagsConditionField::decode(opcode) == kNegative); |
| 911 __ Ands(i.OutputRegister(), i.InputOrZeroRegister64(0), |
| 912 i.InputOperand2_64(1)); |
| 913 } else { |
| 914 __ And(i.OutputRegister(), i.InputOrZeroRegister64(0), |
| 915 i.InputOperand2_64(1)); |
| 916 } |
902 break; | 917 break; |
903 case kArm64And32: | 918 case kArm64And32: |
904 __ And(i.OutputRegister32(), i.InputOrZeroRegister32(0), | 919 if (FlagsModeField::decode(opcode) != kFlags_none) { |
905 i.InputOperand2_32(1)); | 920 // The ands instruction only sets N and Z, so only the following |
| 921 // conditions make sense. |
| 922 DCHECK(FlagsConditionField::decode(opcode) == kEqual || |
| 923 FlagsConditionField::decode(opcode) == kNotEqual || |
| 924 FlagsConditionField::decode(opcode) == kPositiveOrZero || |
| 925 FlagsConditionField::decode(opcode) == kNegative); |
| 926 __ Ands(i.OutputRegister32(), i.InputOrZeroRegister32(0), |
| 927 i.InputOperand2_32(1)); |
| 928 } else { |
| 929 __ And(i.OutputRegister32(), i.InputOrZeroRegister32(0), |
| 930 i.InputOperand2_32(1)); |
| 931 } |
906 break; | 932 break; |
907 case kArm64Bic: | 933 case kArm64Bic: |
908 __ Bic(i.OutputRegister(), i.InputOrZeroRegister64(0), | 934 __ Bic(i.OutputRegister(), i.InputOrZeroRegister64(0), |
909 i.InputOperand2_64(1)); | 935 i.InputOperand2_64(1)); |
910 break; | 936 break; |
911 case kArm64Bic32: | 937 case kArm64Bic32: |
912 __ Bic(i.OutputRegister32(), i.InputOrZeroRegister32(0), | 938 __ Bic(i.OutputRegister32(), i.InputOrZeroRegister32(0), |
913 i.InputOperand2_32(1)); | 939 i.InputOperand2_32(1)); |
914 break; | 940 break; |
915 case kArm64Mul: | 941 case kArm64Mul: |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 case kArm64Cmp32: | 1224 case kArm64Cmp32: |
1199 __ Cmp(i.InputOrZeroRegister32(0), i.InputOperand2_32(1)); | 1225 __ Cmp(i.InputOrZeroRegister32(0), i.InputOperand2_32(1)); |
1200 break; | 1226 break; |
1201 case kArm64Cmn: | 1227 case kArm64Cmn: |
1202 __ Cmn(i.InputOrZeroRegister64(0), i.InputOperand(1)); | 1228 __ Cmn(i.InputOrZeroRegister64(0), i.InputOperand(1)); |
1203 break; | 1229 break; |
1204 case kArm64Cmn32: | 1230 case kArm64Cmn32: |
1205 __ Cmn(i.InputOrZeroRegister32(0), i.InputOperand2_32(1)); | 1231 __ Cmn(i.InputOrZeroRegister32(0), i.InputOperand2_32(1)); |
1206 break; | 1232 break; |
1207 case kArm64Tst: | 1233 case kArm64Tst: |
1208 __ Tst(i.InputRegister(0), i.InputOperand(1)); | 1234 __ Tst(i.InputOrZeroRegister64(0), i.InputOperand(1)); |
1209 break; | 1235 break; |
1210 case kArm64Tst32: | 1236 case kArm64Tst32: |
1211 __ Tst(i.InputRegister32(0), i.InputOperand32(1)); | 1237 __ Tst(i.InputOrZeroRegister32(0), i.InputOperand32(1)); |
1212 break; | 1238 break; |
1213 case kArm64Float32Cmp: | 1239 case kArm64Float32Cmp: |
1214 if (instr->InputAt(1)->IsFPRegister()) { | 1240 if (instr->InputAt(1)->IsFPRegister()) { |
1215 __ Fcmp(i.InputFloat32Register(0), i.InputFloat32Register(1)); | 1241 __ Fcmp(i.InputFloat32Register(0), i.InputFloat32Register(1)); |
1216 } else { | 1242 } else { |
1217 DCHECK(instr->InputAt(1)->IsImmediate()); | 1243 DCHECK(instr->InputAt(1)->IsImmediate()); |
1218 // 0.0 is the only immediate supported by fcmp instructions. | 1244 // 0.0 is the only immediate supported by fcmp instructions. |
1219 DCHECK(i.InputFloat32(1) == 0.0f); | 1245 DCHECK(i.InputFloat32(1) == 0.0f); |
1220 __ Fcmp(i.InputFloat32Register(0), i.InputFloat32(1)); | 1246 __ Fcmp(i.InputFloat32Register(0), i.InputFloat32(1)); |
1221 } | 1247 } |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 padding_size -= kInstructionSize; | 2013 padding_size -= kInstructionSize; |
1988 } | 2014 } |
1989 } | 2015 } |
1990 } | 2016 } |
1991 | 2017 |
1992 #undef __ | 2018 #undef __ |
1993 | 2019 |
1994 } // namespace compiler | 2020 } // namespace compiler |
1995 } // namespace internal | 2021 } // namespace internal |
1996 } // namespace v8 | 2022 } // namespace v8 |
OLD | NEW |