< prev index next >

src/cpu/x86/vm/x86_64.ad

Print this page




7323 %{
7324   match(Set res (CompareAndSwapI mem_ptr (Binary oldval newval)));
7325   match(Set res (WeakCompareAndSwapI mem_ptr (Binary oldval newval)));
7326   effect(KILL cr, KILL oldval);
7327 
7328   format %{ "cmpxchgl $mem_ptr,$newval\t# "
7329             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
7330             "sete    $res\n\t"
7331             "movzbl  $res, $res" %}
7332   opcode(0x0F, 0xB1);
7333   ins_encode(lock_prefix,
7334              REX_reg_mem(newval, mem_ptr),
7335              OpcP, OpcS,
7336              reg_mem(newval, mem_ptr),
7337              REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
7338              REX_reg_breg(res, res), // movzbl
7339              Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
7340   ins_pipe( pipe_cmpxchg );
7341 %}
7342 
















































7343 
7344 instruct compareAndSwapN(rRegI res,
7345                           memory mem_ptr,
7346                           rax_RegN oldval, rRegN newval,
7347                           rFlagsReg cr) %{
7348   match(Set res (CompareAndSwapN mem_ptr (Binary oldval newval)));
7349   match(Set res (WeakCompareAndSwapN mem_ptr (Binary oldval newval)));
7350   effect(KILL cr, KILL oldval);
7351 
7352   format %{ "cmpxchgl $mem_ptr,$newval\t# "
7353             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
7354             "sete    $res\n\t"
7355             "movzbl  $res, $res" %}
7356   opcode(0x0F, 0xB1);
7357   ins_encode(lock_prefix,
7358              REX_reg_mem(newval, mem_ptr),
7359              OpcP, OpcS,
7360              reg_mem(newval, mem_ptr),
7361              REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
7362              REX_reg_breg(res, res), // movzbl
7363              Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
7364   ins_pipe( pipe_cmpxchg );
7365 %}
7366 







































7367 instruct compareAndExchangeI(
7368                          memory mem_ptr,
7369                          rax_RegI oldval, rRegI newval,
7370                          rFlagsReg cr)
7371 %{
7372   match(Set oldval (CompareAndExchangeI mem_ptr (Binary oldval newval)));
7373   effect(KILL cr);
7374 
7375   format %{ "cmpxchgl $mem_ptr,$newval\t# "
7376             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"  %}
7377   opcode(0x0F, 0xB1);
7378   ins_encode(lock_prefix,
7379              REX_reg_mem(newval, mem_ptr),
7380              OpcP, OpcS,
7381              reg_mem(newval, mem_ptr) // lock cmpxchg
7382              );
7383   ins_pipe( pipe_cmpxchg );
7384 %}
7385 
7386 instruct compareAndExchangeL(


7424 instruct compareAndExchangeP(
7425                          memory mem_ptr,
7426                          rax_RegP oldval, rRegP newval,
7427                          rFlagsReg cr)
7428 %{
7429   predicate(VM_Version::supports_cx8());
7430   match(Set oldval (CompareAndExchangeP mem_ptr (Binary oldval newval)));
7431   effect(KILL cr);
7432 
7433   format %{ "cmpxchgq $mem_ptr,$newval\t# "
7434             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t" %}
7435   opcode(0x0F, 0xB1);
7436   ins_encode(lock_prefix,
7437              REX_reg_mem_wide(newval, mem_ptr),
7438              OpcP, OpcS,
7439              reg_mem(newval, mem_ptr)  // lock cmpxchg
7440           );
7441   ins_pipe( pipe_cmpxchg );
7442 %}
7443 














































7444 instruct xaddI_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
7445   predicate(n->as_LoadStore()->result_not_used());
7446   match(Set dummy (GetAndAddI mem add));
7447   effect(KILL cr);
7448   format %{ "ADDL  [$mem],$add" %}
7449   ins_encode %{
7450     if (os::is_MP()) { __ lock(); }
7451     __ addl($mem$$Address, $add$$constant);
7452   %}
7453   ins_pipe( pipe_cmpxchg );
7454 %}
7455 
7456 instruct xaddI( memory mem, rRegI newval, rFlagsReg cr) %{
7457   match(Set newval (GetAndAddI mem newval));
7458   effect(KILL cr);
7459   format %{ "XADDL  [$mem],$newval" %}
7460   ins_encode %{
7461     if (os::is_MP()) { __ lock(); }
7462     __ xaddl($mem$$Address, $newval$$Register);
7463   %}


7466 
7467 instruct xaddL_no_res( memory mem, Universe dummy, immL32 add, rFlagsReg cr) %{
7468   predicate(n->as_LoadStore()->result_not_used());
7469   match(Set dummy (GetAndAddL mem add));
7470   effect(KILL cr);
7471   format %{ "ADDQ  [$mem],$add" %}
7472   ins_encode %{
7473     if (os::is_MP()) { __ lock(); }
7474     __ addq($mem$$Address, $add$$constant);
7475   %}
7476   ins_pipe( pipe_cmpxchg );
7477 %}
7478 
7479 instruct xaddL( memory mem, rRegL newval, rFlagsReg cr) %{
7480   match(Set newval (GetAndAddL mem newval));
7481   effect(KILL cr);
7482   format %{ "XADDQ  [$mem],$newval" %}
7483   ins_encode %{
7484     if (os::is_MP()) { __ lock(); }
7485     __ xaddq($mem$$Address, $newval$$Register);


















7486   %}
7487   ins_pipe( pipe_cmpxchg );
7488 %}
7489 
7490 instruct xchgI( memory mem, rRegI newval) %{
7491   match(Set newval (GetAndSetI mem newval));
7492   format %{ "XCHGL  $newval,[$mem]" %}
7493   ins_encode %{
7494     __ xchgl($newval$$Register, $mem$$Address);
7495   %}
7496   ins_pipe( pipe_cmpxchg );
7497 %}
7498 
7499 instruct xchgL( memory mem, rRegL newval) %{
7500   match(Set newval (GetAndSetL mem newval));
7501   format %{ "XCHGL  $newval,[$mem]" %}
7502   ins_encode %{
7503     __ xchgq($newval$$Register, $mem$$Address);
7504   %}
7505   ins_pipe( pipe_cmpxchg );




7323 %{
7324   match(Set res (CompareAndSwapI mem_ptr (Binary oldval newval)));
7325   match(Set res (WeakCompareAndSwapI mem_ptr (Binary oldval newval)));
7326   effect(KILL cr, KILL oldval);
7327 
7328   format %{ "cmpxchgl $mem_ptr,$newval\t# "
7329             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
7330             "sete    $res\n\t"
7331             "movzbl  $res, $res" %}
7332   opcode(0x0F, 0xB1);
7333   ins_encode(lock_prefix,
7334              REX_reg_mem(newval, mem_ptr),
7335              OpcP, OpcS,
7336              reg_mem(newval, mem_ptr),
7337              REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
7338              REX_reg_breg(res, res), // movzbl
7339              Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
7340   ins_pipe( pipe_cmpxchg );
7341 %}
7342 
7343 instruct compareAndSwapB(rRegI res,
7344                          memory mem_ptr,
7345                          rax_RegI oldval, rRegI newval,
7346                          rFlagsReg cr)
7347 %{
7348   match(Set res (CompareAndSwapB mem_ptr (Binary oldval newval)));
7349   match(Set res (WeakCompareAndSwapB mem_ptr (Binary oldval newval)));
7350   effect(KILL cr, KILL oldval);
7351 
7352   format %{ "cmpxchgb $mem_ptr,$newval\t# "
7353             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
7354             "sete    $res\n\t"
7355             "movzbl  $res, $res" %}
7356   opcode(0x0F, 0xB0);
7357   ins_encode(lock_prefix,
7358              REX_reg_mem(newval, mem_ptr),
7359              OpcP, OpcS,
7360              reg_mem(newval, mem_ptr),
7361              REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
7362              REX_reg_breg(res, res), // movzbl
7363              Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
7364   ins_pipe( pipe_cmpxchg );
7365 %}
7366 
7367 instruct compareAndSwapS(rRegI res,
7368                          memory mem_ptr,
7369                          rax_RegI oldval, rRegI newval,
7370                          rFlagsReg cr)
7371 %{
7372   match(Set res (CompareAndSwapS mem_ptr (Binary oldval newval)));
7373   match(Set res (WeakCompareAndSwapS mem_ptr (Binary oldval newval)));
7374   effect(KILL cr, KILL oldval);
7375 
7376   format %{ "cmpxchgw $mem_ptr,$newval\t# "
7377             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
7378             "sete    $res\n\t"
7379             "movzbl  $res, $res" %}
7380   opcode(0x0F, 0xB1);
7381   ins_encode(lock_prefix,
7382              SizePrefix,
7383              REX_reg_mem(newval, mem_ptr),          
7384              OpcP, OpcS,
7385              reg_mem(newval, mem_ptr),
7386              REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
7387              REX_reg_breg(res, res), // movzbl
7388              Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
7389   ins_pipe( pipe_cmpxchg );
7390 %}
7391 
7392 instruct compareAndSwapN(rRegI res,
7393                           memory mem_ptr,
7394                           rax_RegN oldval, rRegN newval,
7395                           rFlagsReg cr) %{
7396   match(Set res (CompareAndSwapN mem_ptr (Binary oldval newval)));
7397   match(Set res (WeakCompareAndSwapN mem_ptr (Binary oldval newval)));
7398   effect(KILL cr, KILL oldval);
7399 
7400   format %{ "cmpxchgl $mem_ptr,$newval\t# "
7401             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
7402             "sete    $res\n\t"
7403             "movzbl  $res, $res" %}
7404   opcode(0x0F, 0xB1);
7405   ins_encode(lock_prefix,
7406              REX_reg_mem(newval, mem_ptr),
7407              OpcP, OpcS,
7408              reg_mem(newval, mem_ptr),
7409              REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
7410              REX_reg_breg(res, res), // movzbl
7411              Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
7412   ins_pipe( pipe_cmpxchg );
7413 %}
7414 
7415 instruct compareAndExchangeB(
7416                          memory mem_ptr,
7417                          rax_RegI oldval, rRegI newval,
7418                          rFlagsReg cr)
7419 %{
7420   match(Set oldval (CompareAndExchangeB mem_ptr (Binary oldval newval)));
7421   effect(KILL cr);
7422 
7423   format %{ "cmpxchgb $mem_ptr,$newval\t# "
7424             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"  %}
7425   opcode(0x0F, 0xB0);
7426   ins_encode(lock_prefix,
7427              REX_reg_mem(newval, mem_ptr),
7428              OpcP, OpcS,
7429              reg_mem(newval, mem_ptr) // lock cmpxchg
7430              );
7431   ins_pipe( pipe_cmpxchg );
7432 %}
7433 
7434 instruct compareAndExchangeS(
7435                          memory mem_ptr,
7436                          rax_RegI oldval, rRegI newval,
7437                          rFlagsReg cr)
7438 %{
7439   match(Set oldval (CompareAndExchangeS mem_ptr (Binary oldval newval)));
7440   effect(KILL cr);
7441 
7442   format %{ "cmpxchgw $mem_ptr,$newval\t# "
7443             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"  %}
7444   opcode(0x0F, 0xB1);
7445   ins_encode(lock_prefix,
7446              SizePrefix,
7447              REX_reg_mem(newval, mem_ptr),
7448              OpcP, OpcS,
7449              reg_mem(newval, mem_ptr) // lock cmpxchg
7450              );
7451   ins_pipe( pipe_cmpxchg );
7452 %}
7453 
7454 instruct compareAndExchangeI(
7455                          memory mem_ptr,
7456                          rax_RegI oldval, rRegI newval,
7457                          rFlagsReg cr)
7458 %{
7459   match(Set oldval (CompareAndExchangeI mem_ptr (Binary oldval newval)));
7460   effect(KILL cr);
7461 
7462   format %{ "cmpxchgl $mem_ptr,$newval\t# "
7463             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"  %}
7464   opcode(0x0F, 0xB1);
7465   ins_encode(lock_prefix,
7466              REX_reg_mem(newval, mem_ptr),
7467              OpcP, OpcS,
7468              reg_mem(newval, mem_ptr) // lock cmpxchg
7469              );
7470   ins_pipe( pipe_cmpxchg );
7471 %}
7472 
7473 instruct compareAndExchangeL(


7511 instruct compareAndExchangeP(
7512                          memory mem_ptr,
7513                          rax_RegP oldval, rRegP newval,
7514                          rFlagsReg cr)
7515 %{
7516   predicate(VM_Version::supports_cx8());
7517   match(Set oldval (CompareAndExchangeP mem_ptr (Binary oldval newval)));
7518   effect(KILL cr);
7519 
7520   format %{ "cmpxchgq $mem_ptr,$newval\t# "
7521             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t" %}
7522   opcode(0x0F, 0xB1);
7523   ins_encode(lock_prefix,
7524              REX_reg_mem_wide(newval, mem_ptr),
7525              OpcP, OpcS,
7526              reg_mem(newval, mem_ptr)  // lock cmpxchg
7527           );
7528   ins_pipe( pipe_cmpxchg );
7529 %}
7530 
7531 instruct xaddB_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
7532   predicate(n->as_LoadStore()->result_not_used());
7533   match(Set dummy (GetAndAddB mem add));
7534   effect(KILL cr);
7535   format %{ "ADDB  [$mem],$add" %}
7536   ins_encode %{
7537     if (os::is_MP()) { __ lock(); }
7538     __ addb($mem$$Address, $add$$constant);
7539   %}
7540   ins_pipe( pipe_cmpxchg );
7541 %}
7542 
7543 instruct xaddB( memory mem, rRegI newval, rFlagsReg cr) %{
7544   match(Set newval (GetAndAddB mem newval));
7545   effect(KILL cr);
7546   format %{ "XADDB  [$mem],$newval" %}
7547   ins_encode %{
7548     if (os::is_MP()) { __ lock(); }
7549     __ xaddb($mem$$Address, $newval$$Register);
7550   %}
7551   ins_pipe( pipe_cmpxchg );
7552 %}
7553 
7554 instruct xaddS_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
7555   predicate(n->as_LoadStore()->result_not_used());
7556   match(Set dummy (GetAndAddS mem add));
7557   effect(KILL cr);
7558   format %{ "ADDW  [$mem],$add" %}
7559   ins_encode %{
7560     if (os::is_MP()) { __ lock(); }
7561     __ addw($mem$$Address, $add$$constant);
7562   %}
7563   ins_pipe( pipe_cmpxchg );
7564 %}
7565 
7566 instruct xaddS( memory mem, rRegI newval, rFlagsReg cr) %{
7567   match(Set newval (GetAndAddS mem newval));
7568   effect(KILL cr);
7569   format %{ "XADDW  [$mem],$newval" %}
7570   ins_encode %{
7571     if (os::is_MP()) { __ lock(); }
7572     __ xaddw($mem$$Address, $newval$$Register);
7573   %}
7574   ins_pipe( pipe_cmpxchg );
7575 %}
7576 
7577 instruct xaddI_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
7578   predicate(n->as_LoadStore()->result_not_used());
7579   match(Set dummy (GetAndAddI mem add));
7580   effect(KILL cr);
7581   format %{ "ADDL  [$mem],$add" %}
7582   ins_encode %{
7583     if (os::is_MP()) { __ lock(); }
7584     __ addl($mem$$Address, $add$$constant);
7585   %}
7586   ins_pipe( pipe_cmpxchg );
7587 %}
7588 
7589 instruct xaddI( memory mem, rRegI newval, rFlagsReg cr) %{
7590   match(Set newval (GetAndAddI mem newval));
7591   effect(KILL cr);
7592   format %{ "XADDL  [$mem],$newval" %}
7593   ins_encode %{
7594     if (os::is_MP()) { __ lock(); }
7595     __ xaddl($mem$$Address, $newval$$Register);
7596   %}


7599 
7600 instruct xaddL_no_res( memory mem, Universe dummy, immL32 add, rFlagsReg cr) %{
7601   predicate(n->as_LoadStore()->result_not_used());
7602   match(Set dummy (GetAndAddL mem add));
7603   effect(KILL cr);
7604   format %{ "ADDQ  [$mem],$add" %}
7605   ins_encode %{
7606     if (os::is_MP()) { __ lock(); }
7607     __ addq($mem$$Address, $add$$constant);
7608   %}
7609   ins_pipe( pipe_cmpxchg );
7610 %}
7611 
7612 instruct xaddL( memory mem, rRegL newval, rFlagsReg cr) %{
7613   match(Set newval (GetAndAddL mem newval));
7614   effect(KILL cr);
7615   format %{ "XADDQ  [$mem],$newval" %}
7616   ins_encode %{
7617     if (os::is_MP()) { __ lock(); }
7618     __ xaddq($mem$$Address, $newval$$Register);
7619   %}
7620   ins_pipe( pipe_cmpxchg );
7621 %}
7622 
7623 instruct xchgB( memory mem, rRegI newval) %{
7624   match(Set newval (GetAndSetB mem newval));
7625   format %{ "XCHGB  $newval,[$mem]" %}
7626   ins_encode %{
7627     __ xchgb($newval$$Register, $mem$$Address);
7628   %}
7629   ins_pipe( pipe_cmpxchg );
7630 %}
7631 
7632 instruct xchgS( memory mem, rRegI newval) %{
7633   match(Set newval (GetAndSetS mem newval));
7634   format %{ "XCHGW  $newval,[$mem]" %}
7635   ins_encode %{
7636     __ xchgw($newval$$Register, $mem$$Address);
7637   %}
7638   ins_pipe( pipe_cmpxchg );
7639 %}
7640 
7641 instruct xchgI( memory mem, rRegI newval) %{
7642   match(Set newval (GetAndSetI mem newval));
7643   format %{ "XCHGL  $newval,[$mem]" %}
7644   ins_encode %{
7645     __ xchgl($newval$$Register, $mem$$Address);
7646   %}
7647   ins_pipe( pipe_cmpxchg );
7648 %}
7649 
7650 instruct xchgL( memory mem, rRegL newval) %{
7651   match(Set newval (GetAndSetL mem newval));
7652   format %{ "XCHGL  $newval,[$mem]" %}
7653   ins_encode %{
7654     __ xchgq($newval$$Register, $mem$$Address);
7655   %}
7656   ins_pipe( pipe_cmpxchg );


< prev index next >