1 // |
1 // |
2 // Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
2 // Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 // |
4 // |
5 // This code is free software; you can redistribute it and/or modify it |
5 // This code is free software; you can redistribute it and/or modify it |
6 // under the terms of the GNU General Public License version 2 only, as |
6 // under the terms of the GNU General Public License version 2 only, as |
7 // published by the Free Software Foundation. |
7 // published by the Free Software Foundation. |
9432 instruct cmpLTMask(rRegI dst, rRegI p, rRegI q, rFlagsReg cr) |
9432 instruct cmpLTMask(rRegI dst, rRegI p, rRegI q, rFlagsReg cr) |
9433 %{ |
9433 %{ |
9434 match(Set dst (CmpLTMask p q)); |
9434 match(Set dst (CmpLTMask p q)); |
9435 effect(KILL cr); |
9435 effect(KILL cr); |
9436 |
9436 |
9437 ins_cost(400); // XXX |
9437 ins_cost(400); |
9438 format %{ "cmpl $p, $q\t# cmpLTMask\n\t" |
9438 format %{ "cmpl $p, $q\t# cmpLTMask\n\t" |
9439 "setlt $dst\n\t" |
9439 "setlt $dst\n\t" |
9440 "movzbl $dst, $dst\n\t" |
9440 "movzbl $dst, $dst\n\t" |
9441 "negl $dst" %} |
9441 "negl $dst" %} |
9442 ins_encode(REX_reg_reg(p, q), opc_reg_reg(0x3B, p, q), // cmpl |
9442 ins_encode(REX_reg_reg(p, q), opc_reg_reg(0x3B, p, q), // cmpl |
9450 instruct cmpLTMask0(rRegI dst, immI0 zero, rFlagsReg cr) |
9450 instruct cmpLTMask0(rRegI dst, immI0 zero, rFlagsReg cr) |
9451 %{ |
9451 %{ |
9452 match(Set dst (CmpLTMask dst zero)); |
9452 match(Set dst (CmpLTMask dst zero)); |
9453 effect(KILL cr); |
9453 effect(KILL cr); |
9454 |
9454 |
9455 ins_cost(100); // XXX |
9455 ins_cost(100); |
9456 format %{ "sarl $dst, #31\t# cmpLTMask0" %} |
9456 format %{ "sarl $dst, #31\t# cmpLTMask0" %} |
9457 opcode(0xC1, 0x7); /* C1 /7 ib */ |
9457 ins_encode %{ |
9458 ins_encode(reg_opc_imm(dst, 0x1F)); |
9458 __ sarl($dst$$Register, 31); |
|
9459 %} |
9459 ins_pipe(ialu_reg); |
9460 ins_pipe(ialu_reg); |
9460 %} |
9461 %} |
9461 |
9462 |
9462 |
9463 /* Better to save a register than avoid a branch */ |
9463 instruct cadd_cmpLTMask(rRegI p, rRegI q, rRegI y, rRegI tmp, rFlagsReg cr) |
9464 instruct cadd_cmpLTMask(rRegI p, rRegI q, rRegI y, rFlagsReg cr) |
9464 %{ |
9465 %{ |
9465 match(Set p (AddI (AndI (CmpLTMask p q) y) (SubI p q))); |
9466 match(Set p (AddI (AndI (CmpLTMask p q) y) (SubI p q))); |
9466 effect(TEMP tmp, KILL cr); |
9467 effect(KILL cr); |
9467 |
9468 ins_cost(300); |
9468 ins_cost(400); // XXX |
9469 format %{ "subl $p,$q\t# cadd_cmpLTMask\n\t" |
9469 format %{ "subl $p, $q\t# cadd_cmpLTMask1\n\t" |
9470 "jge done\n\t" |
9470 "sbbl $tmp, $tmp\n\t" |
9471 "addl $p,$y\n" |
9471 "andl $tmp, $y\n\t" |
9472 "done: " %} |
9472 "addl $p, $tmp" %} |
|
9473 ins_encode %{ |
9473 ins_encode %{ |
9474 Register Rp = $p$$Register; |
9474 Register Rp = $p$$Register; |
9475 Register Rq = $q$$Register; |
9475 Register Rq = $q$$Register; |
9476 Register Ry = $y$$Register; |
9476 Register Ry = $y$$Register; |
9477 Register Rt = $tmp$$Register; |
9477 Label done; |
9478 __ subl(Rp, Rq); |
9478 __ subl(Rp, Rq); |
9479 __ sbbl(Rt, Rt); |
9479 __ jccb(Assembler::greaterEqual, done); |
9480 __ andl(Rt, Ry); |
9480 __ addl(Rp, Ry); |
9481 __ addl(Rp, Rt); |
9481 __ bind(done); |
9482 %} |
9482 %} |
9483 ins_pipe(pipe_cmplt); |
9483 ins_pipe(pipe_cmplt); |
9484 %} |
9484 %} |
|
9485 |
|
9486 /* Better to save a register than avoid a branch */ |
|
9487 instruct and_cmpLTMask(rRegI p, rRegI q, rRegI y, rFlagsReg cr) |
|
9488 %{ |
|
9489 match(Set y (AndI (CmpLTMask p q) y)); |
|
9490 effect(KILL cr); |
|
9491 |
|
9492 ins_cost(300); |
|
9493 |
|
9494 format %{ "cmpl $p, $q\t# and_cmpLTMask\n\t" |
|
9495 "jlt done\n\t" |
|
9496 "xorl $y, $y\n" |
|
9497 "done: " %} |
|
9498 ins_encode %{ |
|
9499 Register Rp = $p$$Register; |
|
9500 Register Rq = $q$$Register; |
|
9501 Register Ry = $y$$Register; |
|
9502 Label done; |
|
9503 __ cmpl(Rp, Rq); |
|
9504 __ jccb(Assembler::less, done); |
|
9505 __ xorl(Ry, Ry); |
|
9506 __ bind(done); |
|
9507 %} |
|
9508 ins_pipe(pipe_cmplt); |
|
9509 %} |
|
9510 |
9485 |
9511 |
9486 //---------- FP Instructions------------------------------------------------ |
9512 //---------- FP Instructions------------------------------------------------ |
9487 |
9513 |
9488 instruct cmpF_cc_reg(rFlagsRegU cr, regF src1, regF src2) |
9514 instruct cmpF_cc_reg(rFlagsRegU cr, regF src1, regF src2) |
9489 %{ |
9515 %{ |