OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 float inputsf[kTableLength] = {3.0, 2.0, 0.0, -0.0, finf, 42.0, finf, | 1002 float inputsf[kTableLength] = {3.0, 2.0, 0.0, -0.0, finf, 42.0, finf, |
1003 fminf, 3.0, fnan, fnan, finf, fnan}; | 1003 fminf, 3.0, fnan, fnan, finf, fnan}; |
1004 float outputsfmin[kTableLength] = {2.0, 2.0, -0.0, -0.0, 42.0, 42.0, fminf, | 1004 float outputsfmin[kTableLength] = {2.0, 2.0, -0.0, -0.0, 42.0, 42.0, fminf, |
1005 fminf, fnan, fnan, fnan, fnan, fnan}; | 1005 fminf, fnan, fnan, fnan, fnan, fnan}; |
1006 float outputsfmax[kTableLength] = {3.0, 3.0, 0.0, 0.0, finf, finf, finf, | 1006 float outputsfmax[kTableLength] = {3.0, 3.0, 0.0, 0.0, finf, finf, finf, |
1007 finf, fnan, fnan, fnan, fnan, fnan}; | 1007 finf, fnan, fnan, fnan, fnan, fnan}; |
1008 | 1008 |
1009 auto handle_dnan = [masm](FPURegister dst, Label* nan, Label* back) { | 1009 auto handle_dnan = [masm](FPURegister dst, Label* nan, Label* back) { |
1010 __ bind(nan); | 1010 __ bind(nan); |
1011 __ LoadRoot(at, Heap::kNanValueRootIndex); | 1011 __ LoadRoot(at, Heap::kNanValueRootIndex); |
1012 __ ldc1(dst, FieldMemOperand(at, HeapNumber::kValueOffset)); | 1012 __ Ldc1(dst, FieldMemOperand(at, HeapNumber::kValueOffset)); |
1013 __ Branch(back); | 1013 __ Branch(back); |
1014 }; | 1014 }; |
1015 | 1015 |
1016 auto handle_snan = [masm, fnan](FPURegister dst, Label* nan, Label* back) { | 1016 auto handle_snan = [masm, fnan](FPURegister dst, Label* nan, Label* back) { |
1017 __ bind(nan); | 1017 __ bind(nan); |
1018 __ Move(dst, fnan); | 1018 __ Move(dst, fnan); |
1019 __ Branch(back); | 1019 __ Branch(back); |
1020 }; | 1020 }; |
1021 | 1021 |
1022 Label handle_mind_nan, handle_maxd_nan, handle_mins_nan, handle_maxs_nan; | 1022 Label handle_mind_nan, handle_maxd_nan, handle_mins_nan, handle_maxs_nan; |
1023 Label back_mind_nan, back_maxd_nan, back_mins_nan, back_maxs_nan; | 1023 Label back_mind_nan, back_maxd_nan, back_mins_nan, back_maxs_nan; |
1024 | 1024 |
1025 __ push(s6); | 1025 __ push(s6); |
1026 __ InitializeRootRegister(); | 1026 __ InitializeRootRegister(); |
1027 __ ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); | 1027 __ Ldc1(f4, MemOperand(a0, offsetof(TestFloat, a))); |
1028 __ ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); | 1028 __ Ldc1(f8, MemOperand(a0, offsetof(TestFloat, b))); |
1029 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); | 1029 __ lwc1(f2, MemOperand(a0, offsetof(TestFloat, e))); |
1030 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f))); | 1030 __ lwc1(f6, MemOperand(a0, offsetof(TestFloat, f))); |
1031 __ Float64Min(f10, f4, f8, &handle_mind_nan); | 1031 __ Float64Min(f10, f4, f8, &handle_mind_nan); |
1032 __ bind(&back_mind_nan); | 1032 __ bind(&back_mind_nan); |
1033 __ Float64Max(f12, f4, f8, &handle_maxd_nan); | 1033 __ Float64Max(f12, f4, f8, &handle_maxd_nan); |
1034 __ bind(&back_maxd_nan); | 1034 __ bind(&back_maxd_nan); |
1035 __ Float32Min(f14, f2, f6, &handle_mins_nan); | 1035 __ Float32Min(f14, f2, f6, &handle_mins_nan); |
1036 __ bind(&back_mins_nan); | 1036 __ bind(&back_mins_nan); |
1037 __ Float32Max(f16, f2, f6, &handle_maxs_nan); | 1037 __ Float32Max(f16, f2, f6, &handle_maxs_nan); |
1038 __ bind(&back_maxs_nan); | 1038 __ bind(&back_maxs_nan); |
1039 __ sdc1(f10, MemOperand(a0, offsetof(TestFloat, c))); | 1039 __ Sdc1(f10, MemOperand(a0, offsetof(TestFloat, c))); |
1040 __ sdc1(f12, MemOperand(a0, offsetof(TestFloat, d))); | 1040 __ Sdc1(f12, MemOperand(a0, offsetof(TestFloat, d))); |
1041 __ swc1(f14, MemOperand(a0, offsetof(TestFloat, g))); | 1041 __ swc1(f14, MemOperand(a0, offsetof(TestFloat, g))); |
1042 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, h))); | 1042 __ swc1(f16, MemOperand(a0, offsetof(TestFloat, h))); |
1043 __ pop(s6); | 1043 __ pop(s6); |
1044 __ jr(ra); | 1044 __ jr(ra); |
1045 __ nop(); | 1045 __ nop(); |
1046 | 1046 |
1047 handle_dnan(f10, &handle_mind_nan, &back_mind_nan); | 1047 handle_dnan(f10, &handle_mind_nan, &back_mind_nan); |
1048 handle_dnan(f12, &handle_maxd_nan, &back_maxd_nan); | 1048 handle_dnan(f12, &handle_maxd_nan, &back_maxd_nan); |
1049 handle_snan(f14, &handle_mins_nan, &back_mins_nan); | 1049 handle_snan(f14, &handle_mins_nan, &back_mins_nan); |
1050 handle_snan(f16, &handle_maxs_nan, &back_maxs_nan); | 1050 handle_snan(f16, &handle_maxs_nan, &back_maxs_nan); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 T b = T::from_code(6); // f6 | 1514 T b = T::from_code(6); // f6 |
1515 T c = T::from_code(8); // f8 | 1515 T c = T::from_code(8); // f8 |
1516 | 1516 |
1517 Label ool_min_abc, ool_min_aab, ool_min_aba; | 1517 Label ool_min_abc, ool_min_aab, ool_min_aba; |
1518 Label ool_max_abc, ool_max_aab, ool_max_aba; | 1518 Label ool_max_abc, ool_max_aab, ool_max_aba; |
1519 | 1519 |
1520 Label done_min_abc, done_min_aab, done_min_aba; | 1520 Label done_min_abc, done_min_aab, done_min_aba; |
1521 Label done_max_abc, done_max_aab, done_max_aba; | 1521 Label done_max_abc, done_max_aab, done_max_aba; |
1522 | 1522 |
1523 #define FLOAT_MIN_MAX(fminmax, res, x, y, done, ool, res_field) \ | 1523 #define FLOAT_MIN_MAX(fminmax, res, x, y, done, ool, res_field) \ |
1524 __ ldc1(x, MemOperand(a0, offsetof(Inputs, src1_))); \ | 1524 __ Ldc1(x, MemOperand(a0, offsetof(Inputs, src1_))); \ |
1525 __ ldc1(y, MemOperand(a0, offsetof(Inputs, src2_))); \ | 1525 __ Ldc1(y, MemOperand(a0, offsetof(Inputs, src2_))); \ |
1526 __ fminmax(res, x, y, &ool); \ | 1526 __ fminmax(res, x, y, &ool); \ |
1527 __ bind(&done); \ | 1527 __ bind(&done); \ |
1528 __ sdc1(a, MemOperand(a1, offsetof(Results, res_field))) | 1528 __ Sdc1(a, MemOperand(a1, offsetof(Results, res_field))) |
1529 | 1529 |
1530 // a = min(b, c); | 1530 // a = min(b, c); |
1531 FLOAT_MIN_MAX(Float64Min, a, b, c, done_min_abc, ool_min_abc, min_abc_); | 1531 FLOAT_MIN_MAX(Float64Min, a, b, c, done_min_abc, ool_min_abc, min_abc_); |
1532 // a = min(a, b); | 1532 // a = min(a, b); |
1533 FLOAT_MIN_MAX(Float64Min, a, a, b, done_min_aab, ool_min_aab, min_aab_); | 1533 FLOAT_MIN_MAX(Float64Min, a, a, b, done_min_aab, ool_min_aab, min_aab_); |
1534 // a = min(b, a); | 1534 // a = min(b, a); |
1535 FLOAT_MIN_MAX(Float64Min, a, b, a, done_min_aba, ool_min_aba, min_aba_); | 1535 FLOAT_MIN_MAX(Float64Min, a, b, a, done_min_aba, ool_min_aba, min_aba_); |
1536 | 1536 |
1537 // a = max(b, c); | 1537 // a = max(b, c); |
1538 FLOAT_MIN_MAX(Float64Max, a, b, c, done_max_abc, ool_max_abc, max_abc_); | 1538 FLOAT_MIN_MAX(Float64Max, a, b, c, done_max_abc, ool_max_abc, max_abc_); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 | 1645 |
1646 CHECK_MINMAX(0.0, nan_a, nan_a, nan_a); | 1646 CHECK_MINMAX(0.0, nan_a, nan_a, nan_a); |
1647 CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a); | 1647 CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a); |
1648 CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a); | 1648 CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a); |
1649 CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b); | 1649 CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b); |
1650 | 1650 |
1651 #undef CHECK_MINMAX | 1651 #undef CHECK_MINMAX |
1652 } | 1652 } |
1653 | 1653 |
1654 #undef __ | 1654 #undef __ |
OLD | NEW |