33
33
import static jdk .vm .ci .amd64 .AMD64 .rax ;
34
34
import static jdk .vm .ci .amd64 .AMD64 .rcx ;
35
35
import static jdk .vm .ci .amd64 .AMD64 .rdx ;
36
- import static jdk .vm .ci .amd64 .AMD64 .rsp ;
37
36
import static jdk .vm .ci .amd64 .AMD64 .xmm0 ;
38
37
import static jdk .vm .ci .amd64 .AMD64 .xmm1 ;
39
38
import static jdk .vm .ci .amd64 .AMD64 .xmm2 ;
73
72
* </pre>
74
73
*/
75
74
// @formatter:off
76
- @ SyncPort (from = "https://github.com/openjdk/jdk/blob/83cb0c6de5988de526545d0926c2c6ef60efc1c7 /src/hotspot/cpu/x86/stubGenerator_x86_64_cbrt.cpp#L30-L364 " ,
77
- sha1 = "1cf43819053aac54cbe343f9b8a8bfcc3e3dd6c8 " )
75
+ @ SyncPort (from = "https://github.com/openjdk/jdk/blob/38f59f84c98dfd974eec0c05541b2138b149def7 /src/hotspot/cpu/x86/stubGenerator_x86_64_cbrt.cpp#L30-L339 " ,
76
+ sha1 = "ba7a498e0e5dd3aab7f6eacf50753b5e5999911e " )
78
77
// @formatter:on
79
78
public final class AMD64MathCbrtOp extends AMD64MathIntrinsicUnaryOp {
80
79
@@ -85,6 +84,10 @@ public AMD64MathCbrtOp() {
85
84
/* XMM */ xmm1 , xmm2 , xmm3 , xmm4 , xmm5 , xmm6 , xmm7 );
86
85
}
87
86
87
+ private static ArrayDataPointerConstant absMask = pointerConstant (16 , new int []{
88
+ 0xFFFFFFFF , 0x7FFFFFFF , 0x00000000 , 0x00000000
89
+ });
90
+
88
91
private static ArrayDataPointerConstant sigMask = pointerConstant (16 , new int []{
89
92
0x00000000 , 0x000fc000
90
93
});
@@ -113,10 +116,6 @@ public AMD64MathCbrtOp() {
113
116
0x00000000 , 0x7ff00000
114
117
});
115
118
116
- private static ArrayDataPointerConstant negInf = pointerConstant (16 , new int []{
117
- 0x00000000 , 0xfff00000
118
- });
119
-
120
119
private static ArrayDataPointerConstant coeffTable = pointerConstant (16 , new int []{
121
120
0x5c9cc8e7 , 0xbf9036de , 0xd2b3183b , 0xbfa511e8 ,
122
121
});
@@ -226,17 +225,17 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
226
225
Label l2TAGPACKET001 = new Label ();
227
226
Label l2TAGPACKET101 = new Label ();
228
227
Label l2TAGPACKET201 = new Label ();
229
- Label l2TAGPACKET301 = new Label ();
230
- Label l2TAGPACKET401 = new Label ();
231
- Label l2TAGPACKET501 = new Label ();
232
- Label l2TAGPACKET601 = new Label ();
233
228
Label lB11 = new Label ();
234
229
Label lB12 = new Label ();
235
230
Label lB14 = new Label ();
236
231
237
232
masm .bind (lB11 );
238
- masm .subq (rsp , 24 );
239
- masm .movsd (new AMD64Address (rsp ), xmm0 );
233
+ masm .ucomisd (xmm0 , recordExternalAddress (crb , zeron ));
234
+ masm .jcc (ConditionFlag .Equal , l2TAGPACKET101 );
235
+ masm .movq (xmm1 , xmm0 );
236
+ masm .andpd (xmm1 , recordExternalAddress (crb , absMask ));
237
+ masm .ucomisd (xmm1 , recordExternalAddress (crb , inf ));
238
+ masm .jcc (ConditionFlag .Equal , lB14 );
240
239
241
240
masm .bind (lB12 );
242
241
masm .movq (xmm7 , xmm0 );
@@ -255,8 +254,6 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
255
254
masm .andl (rdx , rax );
256
255
// Branch only if |x| is denormalized
257
256
masm .cmplAndJcc (rdx , 0 , ConditionFlag .Equal , l2TAGPACKET001 , false );
258
- // Branch only if |x| is INF or NaN
259
- masm .cmplAndJcc (rdx , 0x7ff00 , ConditionFlag .Equal , l2TAGPACKET101 , false );
260
257
masm .shrl (rdx , 8 );
261
258
masm .shrq (r9 , 8 );
262
259
masm .andpd (xmm2 , xmm0 );
@@ -324,8 +321,6 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
324
321
masm .andl (rdx , rax );
325
322
masm .shrl (rdx , 8 );
326
323
masm .shrq (r9 , 8 );
327
- // Branch only if |x| is zero
328
- masm .cmplAndJcc (rdx , 0 , ConditionFlag .Equal , l2TAGPACKET301 , false );
329
324
masm .andpd (xmm2 , xmm0 );
330
325
masm .andpd (xmm0 , xmm5 );
331
326
masm .orpd (xmm3 , xmm2 );
@@ -349,40 +344,9 @@ public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
349
344
masm .psllq (xmm7 , 52 );
350
345
masm .jmp (l2TAGPACKET201 );
351
346
352
- masm .bind (l2TAGPACKET301 );
353
- // Branch only if x is negative zero
354
- masm .cmpqAndJcc (r9 , 0 , ConditionFlag .NotEqual , l2TAGPACKET401 , false );
355
- masm .xorpd (xmm0 , xmm0 );
356
- masm .jmp (lB14 );
357
-
358
- masm .bind (l2TAGPACKET401 );
359
- masm .movsd (xmm0 , recordExternalAddress (crb , zeron ));
360
- masm .jmp (lB14 );
361
-
362
347
masm .bind (l2TAGPACKET101 );
363
- masm .movl (rax , new AMD64Address (rsp , 4 ));
364
- masm .movl (rdx , new AMD64Address (rsp ));
365
- masm .movl (rcx , rax );
366
- masm .andl (rcx , 0x7fffffff );
367
- // Branch only if |x| is NaN
368
- masm .cmplAndJcc (rcx , 0x7ff00000 , ConditionFlag .Above , l2TAGPACKET501 , false );
369
- // Branch only if |x| is NaN
370
- masm .cmplAndJcc (rdx , 0 , ConditionFlag .NotEqual , l2TAGPACKET501 , false );
371
- // Branch only if x is negative INF
372
- masm .cmplAndJcc (rax , 0x7ff00000 , ConditionFlag .NotEqual , l2TAGPACKET601 , false );
373
- masm .movsd (xmm0 , recordExternalAddress (crb , inf ));
374
- masm .jmp (lB14 );
375
-
376
- masm .bind (l2TAGPACKET601 );
377
- masm .movsd (xmm0 , recordExternalAddress (crb , negInf ));
378
- masm .jmp (lB14 );
379
-
380
- masm .bind (l2TAGPACKET501 );
381
- masm .movsd (xmm0 , new AMD64Address (rsp ));
382
348
masm .addsd (xmm0 , xmm0 );
383
- masm .movq (new AMD64Address (rsp , 8 ), xmm0 );
384
349
385
350
masm .bind (lB14 );
386
- masm .addq (rsp , 24 );
387
351
}
388
352
}
0 commit comments