src/cpu/x86/vm/x86.ad

Print this page
rev 10271 : 8147844: new method j.l.Runtime.onSpinWait() and the corresponding x86 hotspot instrinsic
Summary: adds c1 & c2 x86 intrinsics for j.l.Runtime.onSpinWait() that utilize the PAUSE instruction
Reviewed-by: iveresov, kvn, vlivanov
Contributed-by: Ivan Krylov <ivan@azul.com>, Yuri Gaevsky <ygaevsky@azul.com>

*** 1717,1726 **** --- 1717,1730 ---- break; case Op_StrIndexOfChar: if (!(UseSSE > 4)) ret_value = false; break; + case Op_OnSpinWait: + if (VM_Version::supports_on_spin_wait() == false) + ret_value = false; + break; } return ret_value; // Per default match rules are supported. }
*** 2994,3003 **** --- 2998,3025 ---- __ sqrtsd($dst$$XMMRegister, $constantaddress($con)); %} ins_pipe(pipe_slow); %} + instruct onspinwait() %{ + match(OnSpinWait); + ins_cost(200); + + format %{ + $$template + if (os::is_MP()) { + $$emit$$"pause\t! membar_onspinwait" + } else { + $$emit$$"MEMBAR-onspinwait ! (empty encoding)" + } + %} + ins_encode %{ + __ pause(); + %} + ins_pipe(pipe_slow); + %} + // ====================VECTOR INSTRUCTIONS===================================== // Load vectors (4 bytes long) instruct loadV4(vecS dst, memory mem) %{ predicate(n->as_LoadVector()->memory_size() == 4);