Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: test/cctest/test-code-stubs.cc

Issue 160423002: A64 support for DoubleToIStub (truncating). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test cases Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-assembler-a64.cc ('k') | test/cctest/test-code-stubs-a64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 43
44 int STDCALL ConvertDToICVersion(double d) { 44 int STDCALL ConvertDToICVersion(double d) {
45 union { double d; uint32_t u[2]; } dbl; 45 union { double d; uint32_t u[2]; } dbl;
46 dbl.d = d; 46 dbl.d = d;
47 uint32_t exponent_bits = dbl.u[1]; 47 uint32_t exponent_bits = dbl.u[1];
48 int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32); 48 int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32);
49 int32_t exponent = (((exponent_bits & shifted_mask) >> 49 int32_t exponent = (((exponent_bits & shifted_mask) >>
50 (Double::kPhysicalSignificandSize - 32)) - 50 (Double::kPhysicalSignificandSize - 32)) -
51 HeapNumber::kExponentBias); 51 HeapNumber::kExponentBias);
52 if (exponent < 0) {
53 return 0;
54 }
52 uint32_t unsigned_exponent = static_cast<uint32_t>(exponent); 55 uint32_t unsigned_exponent = static_cast<uint32_t>(exponent);
53 int result = 0; 56 int result = 0;
54 uint32_t max_exponent = 57 uint32_t max_exponent =
55 static_cast<uint32_t>(Double::kPhysicalSignificandSize); 58 static_cast<uint32_t>(Double::kPhysicalSignificandSize);
56 if (unsigned_exponent >= max_exponent) { 59 if (unsigned_exponent >= max_exponent) {
57 if ((exponent - Double::kPhysicalSignificandSize) < 32) { 60 if ((exponent - Double::kPhysicalSignificandSize) < 32) {
58 result = dbl.u[0] << (exponent - Double::kPhysicalSignificandSize); 61 result = dbl.u[0] << (exponent - Double::kPhysicalSignificandSize);
59 } 62 }
60 } else { 63 } else {
61 uint64_t big_result = 64 uint64_t big_result =
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 RunOneTruncationTest(0.5, 0); 109 RunOneTruncationTest(0.5, 0);
107 RunOneTruncationTest(-0.5, 0); 110 RunOneTruncationTest(-0.5, 0);
108 RunOneTruncationTest(1.5, 1); 111 RunOneTruncationTest(1.5, 1);
109 RunOneTruncationTest(-1.5, -1); 112 RunOneTruncationTest(-1.5, -1);
110 RunOneTruncationTest(5.5, 5); 113 RunOneTruncationTest(5.5, 5);
111 RunOneTruncationTest(-5.0, -5); 114 RunOneTruncationTest(-5.0, -5);
112 RunOneTruncationTest(NaN, 0); 115 RunOneTruncationTest(NaN, 0);
113 RunOneTruncationTest(Infinity, 0); 116 RunOneTruncationTest(Infinity, 0);
114 RunOneTruncationTest(-NaN, 0); 117 RunOneTruncationTest(-NaN, 0);
115 RunOneTruncationTest(-Infinity, 0); 118 RunOneTruncationTest(-Infinity, 0);
119 RunOneTruncationTest(4.94065645841e-324, 0);
120 RunOneTruncationTest(-4.94065645841e-324, 0);
116 121
117 RunOneTruncationTest(4.5036e+15, 0x1635E000); 122 RunOneTruncationTest(0.9999999999999999, 0);
123 RunOneTruncationTest(-0.9999999999999999, 0);
124 RunOneTruncationTest(4294967296.0, 0);
125 RunOneTruncationTest(-4294967296.0, 0);
126 RunOneTruncationTest(9223372036854775000.0, 4294966272.0);
127 RunOneTruncationTest(-9223372036854775000.0, -4294966272.0);
128 RunOneTruncationTest(4.5036e+15, 372629504);
118 RunOneTruncationTest(-4.5036e+15, -372629504); 129 RunOneTruncationTest(-4.5036e+15, -372629504);
119 130
131 RunOneTruncationTest(287524199.5377777, 0x11234567);
132 RunOneTruncationTest(-287524199.5377777, -0x11234567);
133 RunOneTruncationTest(2300193596.302222, 2300193596.0);
134 RunOneTruncationTest(-2300193596.302222, -2300193596.0);
135 RunOneTruncationTest(4600387192.604444, 305419896);
136 RunOneTruncationTest(-4600387192.604444, -305419896);
137 RunOneTruncationTest(4823855600872397.0, 1737075661);
138 RunOneTruncationTest(-4823855600872397.0, -1737075661);
139
120 RunOneTruncationTest(4503603922337791.0, -1); 140 RunOneTruncationTest(4503603922337791.0, -1);
121 RunOneTruncationTest(-4503603922337791.0, 1); 141 RunOneTruncationTest(-4503603922337791.0, 1);
122 RunOneTruncationTest(4503601774854143.0, 2147483647); 142 RunOneTruncationTest(4503601774854143.0, 2147483647);
123 RunOneTruncationTest(-4503601774854143.0, -2147483647); 143 RunOneTruncationTest(-4503601774854143.0, -2147483647);
124 RunOneTruncationTest(9007207844675582.0, -2); 144 RunOneTruncationTest(9007207844675582.0, -2);
125 RunOneTruncationTest(-9007207844675582.0, 2); 145 RunOneTruncationTest(-9007207844675582.0, 2);
126 146
127 RunOneTruncationTest(2.4178527921507624e+24, -536870912); 147 RunOneTruncationTest(2.4178527921507624e+24, -536870912);
128 RunOneTruncationTest(-2.4178527921507624e+24, 536870912); 148 RunOneTruncationTest(-2.4178527921507624e+24, 536870912);
129 RunOneTruncationTest(2.417853945072267e+24, -536870912); 149 RunOneTruncationTest(2.417853945072267e+24, -536870912);
130 RunOneTruncationTest(-2.417853945072267e+24, 536870912); 150 RunOneTruncationTest(-2.417853945072267e+24, 536870912);
131 151
132 RunOneTruncationTest(4.8357055843015248e+24, -1073741824); 152 RunOneTruncationTest(4.8357055843015248e+24, -1073741824);
133 RunOneTruncationTest(-4.8357055843015248e+24, 1073741824); 153 RunOneTruncationTest(-4.8357055843015248e+24, 1073741824);
134 RunOneTruncationTest(4.8357078901445341e+24, -1073741824); 154 RunOneTruncationTest(4.8357078901445341e+24, -1073741824);
135 RunOneTruncationTest(-4.8357078901445341e+24, 1073741824); 155 RunOneTruncationTest(-4.8357078901445341e+24, 1073741824);
136 156
157 RunOneTruncationTest(2147483647.0, 2147483647.0);
158 RunOneTruncationTest(-2147483648.0, -2147483648.0);
137 RunOneTruncationTest(9.6714111686030497e+24, -2147483648.0); 159 RunOneTruncationTest(9.6714111686030497e+24, -2147483648.0);
138 RunOneTruncationTest(-9.6714111686030497e+24, -2147483648.0); 160 RunOneTruncationTest(-9.6714111686030497e+24, -2147483648.0);
139 RunOneTruncationTest(9.6714157802890681e+24, -2147483648.0); 161 RunOneTruncationTest(9.6714157802890681e+24, -2147483648.0);
140 RunOneTruncationTest(-9.6714157802890681e+24, -2147483648.0); 162 RunOneTruncationTest(-9.6714157802890681e+24, -2147483648.0);
163 RunOneTruncationTest(1.9342813113834065e+25, 2147483648.0);
164 RunOneTruncationTest(-1.9342813113834065e+25, 2147483648.0);
165
166 RunOneTruncationTest(3.868562622766813e+25, 0);
167 RunOneTruncationTest(-3.868562622766813e+25, 0);
168 RunOneTruncationTest(1.7976931348623157e+308, 0);
169 RunOneTruncationTest(-1.7976931348623157e+308, 0);
141 } 170 }
142 171
143 #undef NaN 172 #undef NaN
144 #undef Infinity 173 #undef Infinity
145 #undef RunOneTruncationTest 174 #undef RunOneTruncationTest
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-a64.cc ('k') | test/cctest/test-code-stubs-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698