diff --git a/src/hotspot/cpu/s390/s390.ad b/src/hotspot/cpu/s390/s390.ad index 7d3e963a108..19bd3620228 100644 --- a/src/hotspot/cpu/s390/s390.ad +++ b/src/hotspot/cpu/s390/s390.ad @@ -1715,6 +1715,8 @@ bool Matcher::match_rule_supported(int opcode) { switch (opcode) { case Op_ReverseBytesI: case Op_ReverseBytesL: + case Op_ReverseBytesS: + case Op_ReverseBytesUS: return UseByteReverseInstruction; case Op_PopCountI: case Op_PopCountL: @@ -11615,6 +11617,38 @@ instruct vround2D_reg(vecX dst, vecX src, immI8 rmode) %{ // Byte reverse +instruct bytes_reverse_short(iRegI dst, iRegI src) %{ + match(Set dst (ReverseBytesS src)); + predicate(UseByteReverseInstruction); + ins_cost(2 * DEFAULT_COST); + size(8); + + format %{ "LRVR $dst, $src\n\t # byte reverse int" + "SRA $dst, 0x0010\t # right shift by 16, sign extended" %} + + ins_encode %{ + __ z_lrvr($dst$$Register, $src$$Register); + __ z_sra($dst$$Register, 0x0010); + %} + ins_pipe(pipe_class_dummy); +%} + +instruct bytes_reverse_unsigned_short(iRegI dst, iRegI src) %{ + match(Set dst (ReverseBytesUS src)); + predicate(UseByteReverseInstruction); + ins_cost(2 * DEFAULT_COST); + size(8); + + format %{ "LRVR $dst, $src\n\t # byte reverse int" + "SRL $dst, 0x0010\t # right shift by 16, zero extended" %} + + ins_encode %{ + __ z_lrvr($dst$$Register, $src$$Register); + __ z_srl($dst$$Register, 0x0010); + %} + ins_pipe(pipe_class_dummy); +%} + instruct bytes_reverse_int(iRegI dst, iRegI src) %{ match(Set dst (ReverseBytesI src)); predicate(UseByteReverseInstruction); // See Matcher::match_rule_supported