@@ -2745,10 +2745,7 @@ typedef void (MacroAssembler::* mem_vector_insn)(FloatRegister Rt,
27452745 }
27462746
27472747 if (index == -1) {
2748- /* If we get an out-of-range offset it is a bug in the compiler,
2749- so we assert here. */
2750- assert(Address::offset_ok_for_immed(disp, exact_log2(size_in_memory)), "c2 compiler bug");
2751- /* Fix up any out-of-range offsets. */
2748+ // Fix up any out-of-range offsets.
27522749 assert_different_registers(rscratch1, base);
27532750 Address addr = Address(base, disp);
27542751 addr = __ legitimize_address(addr, size_in_memory, rscratch1);
@@ -3348,7 +3345,11 @@ encode %{
33483345 int scale = $mem$$scale;
33493346 int disp = $mem$$disp;
33503347 if (index == -1) {
3351- __ prfm(Address(base, disp), PSTL1KEEP);
3348+ // Fix up any out-of-range offsets.
3349+ assert_different_registers(rscratch1, base);
3350+ Address addr = Address(base, disp);
3351+ addr = __ legitimize_address(addr, 8, rscratch1);
3352+ __ prfm(addr, PSTL1KEEP);
33523353 } else {
33533354 Register index_reg = as_Register(index);
33543355 if (disp == 0) {
@@ -4229,9 +4230,9 @@ operand immIOffset16()
42294230 interface(CONST_INTER);
42304231%}
42314232
4232- operand immLoffset ()
4233+ operand immLOffset ()
42334234%{
4234- predicate(Address::offset_ok_for_immed( n->get_long(), 0) );
4235+ predicate(n->get_long() >= -256 && n->get_long() <= 65520 );
42354236 match(ConL);
42364237
42374238 op_cost(0);
@@ -5341,6 +5342,34 @@ operand indOffL16(iRegP reg, immLoffset16 off)
53415342 %}
53425343%}
53435344
5345+ operand indirectX2P(iRegL reg)
5346+ %{
5347+ constraint(ALLOC_IN_RC(ptr_reg));
5348+ match(CastX2P reg);
5349+ op_cost(0);
5350+ format %{ "[$reg]\t# long -> ptr" %}
5351+ interface(MEMORY_INTER) %{
5352+ base($reg);
5353+ index(0xffffffff);
5354+ scale(0x0);
5355+ disp(0x0);
5356+ %}
5357+ %}
5358+
5359+ operand indOffX2P(iRegL reg, immLOffset off)
5360+ %{
5361+ constraint(ALLOC_IN_RC(ptr_reg));
5362+ match(AddP (CastX2P reg) off);
5363+ op_cost(0);
5364+ format %{ "[$reg, $off]\t# long -> ptr" %}
5365+ interface(MEMORY_INTER) %{
5366+ base($reg);
5367+ index(0xffffffff);
5368+ scale(0x0);
5369+ disp($off);
5370+ %}
5371+ %}
5372+
53445373operand indirectN(iRegN reg)
53455374%{
53465375 predicate(CompressedOops::shift() == 0);
@@ -5431,7 +5460,7 @@ operand indOffIN(iRegN reg, immIOffset off)
54315460 %}
54325461%}
54335462
5434- operand indOffLN(iRegN reg, immLoffset off)
5463+ operand indOffLN(iRegN reg, immLOffset off)
54355464%{
54365465 predicate(CompressedOops::shift() == 0);
54375466 constraint(ALLOC_IN_RC(ptr_reg));
@@ -5664,6 +5693,17 @@ operand iRegL2I(iRegL reg) %{
56645693 interface(REG_INTER)
56655694%}
56665695
5696+ operand iRegL2P(iRegL reg) %{
5697+
5698+ op_cost(0);
5699+
5700+ match(CastX2P reg);
5701+
5702+ format %{ "l2p($reg)" %}
5703+
5704+ interface(REG_INTER)
5705+ %}
5706+
56675707opclass vmem2(indirect, indIndex, indOffI2, indOffL2);
56685708opclass vmem4(indirect, indIndex, indOffI4, indOffL4);
56695709opclass vmem8(indirect, indIndex, indOffI8, indOffL8);
@@ -5680,21 +5720,21 @@ opclass vmem16(indirect, indIndex, indOffI16, indOffL16);
56805720// instruction defs. we can turn a memory op into an Address
56815721
56825722opclass memory1(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indIndex, indOffI1, indOffL1,
5683- indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN);
5723+ indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indirectX2P, indOffX2P );
56845724
56855725opclass memory2(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indIndex, indOffI2, indOffL2,
5686- indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN);
5726+ indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indirectX2P, indOffX2P );
56875727
56885728opclass memory4(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indIndex, indOffI4, indOffL4,
5689- indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN);
5729+ indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN, indirectX2P, indOffX2P );
56905730
56915731opclass memory8(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indIndex, indOffI8, indOffL8,
5692- indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN);
5732+ indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN, indirectX2P, indOffX2P );
56935733
56945734// All of the memory operands. For the pipeline description.
56955735opclass memory(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indIndex,
56965736 indOffI1, indOffL1, indOffI2, indOffL2, indOffI4, indOffL4, indOffI8, indOffL8,
5697- indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN);
5737+ indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN, indirectX2P, indOffX2P );
56985738
56995739
57005740// iRegIorL2I is used for src inputs in rules for 32 bit int (I)
@@ -5711,6 +5751,7 @@ opclass memory(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indInde
57115751// movw is actually redundant but its not too costly.
57125752
57135753opclass iRegIorL2I(iRegI, iRegL2I);
5754+ opclass iRegPorL2P(iRegP, iRegL2P);
57145755
57155756//----------PIPELINE-----------------------------------------------------------
57165757// Rules which define the behavior of the target architectures pipeline.
@@ -9811,7 +9852,7 @@ instruct addI_reg_imm_i2l(iRegINoSp dst, iRegL src1, immIAddSub src2) %{
98119852%}
98129853
98139854// Pointer Addition
9814- instruct addP_reg_reg(iRegPNoSp dst, iRegP src1, iRegL src2) %{
9855+ instruct addP_reg_reg(iRegPNoSp dst, iRegPorL2P src1, iRegL src2) %{
98159856 match(Set dst (AddP src1 src2));
98169857
98179858 ins_cost(INSN_COST);
@@ -9826,7 +9867,7 @@ instruct addP_reg_reg(iRegPNoSp dst, iRegP src1, iRegL src2) %{
98269867 ins_pipe(ialu_reg_reg);
98279868%}
98289869
9829- instruct addP_reg_reg_ext(iRegPNoSp dst, iRegP src1, iRegIorL2I src2) %{
9870+ instruct addP_reg_reg_ext(iRegPNoSp dst, iRegPorL2P src1, iRegIorL2I src2) %{
98309871 match(Set dst (AddP src1 (ConvI2L src2)));
98319872
98329873 ins_cost(1.9 * INSN_COST);
@@ -9841,7 +9882,7 @@ instruct addP_reg_reg_ext(iRegPNoSp dst, iRegP src1, iRegIorL2I src2) %{
98419882 ins_pipe(ialu_reg_reg);
98429883%}
98439884
9844- instruct addP_reg_reg_lsl(iRegPNoSp dst, iRegP src1, iRegL src2, immIScale scale) %{
9885+ instruct addP_reg_reg_lsl(iRegPNoSp dst, iRegPorL2P src1, iRegL src2, immIScale scale) %{
98459886 match(Set dst (AddP src1 (LShiftL src2 scale)));
98469887
98479888 ins_cost(1.9 * INSN_COST);
@@ -9856,7 +9897,7 @@ instruct addP_reg_reg_lsl(iRegPNoSp dst, iRegP src1, iRegL src2, immIScale scale
98569897 ins_pipe(ialu_reg_reg_shift);
98579898%}
98589899
9859- instruct addP_reg_reg_ext_shift(iRegPNoSp dst, iRegP src1, iRegIorL2I src2, immIScale scale) %{
9900+ instruct addP_reg_reg_ext_shift(iRegPNoSp dst, iRegPorL2P src1, iRegIorL2I src2, immIScale scale) %{
98609901 match(Set dst (AddP src1 (LShiftL (ConvI2L src2) scale)));
98619902
98629903 ins_cost(1.9 * INSN_COST);
@@ -9889,7 +9930,7 @@ instruct lshift_ext(iRegLNoSp dst, iRegIorL2I src, immI scale, rFlagsReg cr) %{
98899930// Pointer Immediate Addition
98909931// n.b. this needs to be more expensive than using an indirect memory
98919932// operand
9892- instruct addP_reg_imm(iRegPNoSp dst, iRegP src1, immLAddSub src2) %{
9933+ instruct addP_reg_imm(iRegPNoSp dst, iRegPorL2P src1, immLAddSub src2) %{
98939934 match(Set dst (AddP src1 src2));
98949935
98959936 ins_cost(INSN_COST);
0 commit comments