8248870: AARCH64: I2L/L2I conversions can be skipped for masked positive values
Reviewed-by: aph
This commit is contained in:
parent
f79b7e62db
commit
4a1d4be729
@ -12171,6 +12171,21 @@ instruct ubfizIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI lshift, immI_bitmask
|
||||
ins_pipe(ialu_reg_shift);
|
||||
%}
|
||||
|
||||
// This pattern is automatically generated from aarch64_ad.m4
|
||||
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
|
||||
|
||||
// Can skip int2long conversions after AND with small bitmask
|
||||
instruct ubfizIConvI2LAndI(iRegLNoSp dst, iRegI src, immI_bitmask msk)
|
||||
%{
|
||||
match(Set dst (ConvI2L (AndI src msk)));
|
||||
ins_cost(INSN_COST);
|
||||
format %{ "ubfiz $dst, $src, 0, exact_log2($msk + 1) " %}
|
||||
ins_encode %{
|
||||
__ ubfiz(as_Register($dst$$reg), as_Register($src$$reg), 0, exact_log2($msk$$constant + 1));
|
||||
%}
|
||||
ins_pipe(ialu_reg_shift);
|
||||
%}
|
||||
|
||||
|
||||
// Rotations
|
||||
// This pattern is automatically generated from aarch64_ad.m4
|
||||
|
@ -278,6 +278,21 @@ instruct ubfizIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI lshift, immI_bitmask
|
||||
ins_pipe(ialu_reg_shift);
|
||||
%}
|
||||
|
||||
// This pattern is automatically generated from aarch64_ad.m4
|
||||
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
|
||||
|
||||
// Can skip int2long conversions after AND with small bitmask
|
||||
instruct ubfizIConvI2LAndI(iRegLNoSp dst, iRegI src, immI_bitmask msk)
|
||||
%{
|
||||
match(Set dst (ConvI2L (AndI src msk)));
|
||||
ins_cost(INSN_COST);
|
||||
format %{ "ubfiz $dst, $src, 0, exact_log2($msk + 1) " %}
|
||||
ins_encode %{
|
||||
__ ubfiz(as_Register($dst$$reg), as_Register($src$$reg), 0, exact_log2($msk$$constant + 1));
|
||||
%}
|
||||
ins_pipe(ialu_reg_shift);
|
||||
%}
|
||||
|
||||
|
||||
// Rotations dnl
|
||||
define(`EXTRACT_INSN',`
|
||||
|
@ -47,6 +47,7 @@ public class SkipIntToLongCast {
|
||||
private static final long ARRAYSIZE_L = 40L;
|
||||
|
||||
public int[] intValues;
|
||||
public int intValue;
|
||||
|
||||
@Setup
|
||||
public void setup() {
|
||||
@ -76,4 +77,13 @@ public class SkipIntToLongCast {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public long skipMaskedSmallPositiveCast() {
|
||||
int value = intValue;
|
||||
return (long)(value & 0x1) ^ (long)(value & 0x3) ^ (long)(value & 0x7) ^ (long)(value & 0xF) ^
|
||||
(long)(value & 0x1F) ^ (long)(value & 0x3F) ^ (long)(value & 0x7F) ^ (long)(value & 0xFF) ^
|
||||
(long)(value & 0x1FF) ^ (long)(value & 0x3FF) ^ (long)(value & 0x7FF) ^ (long)(value & 0xFFF) ^
|
||||
(long)(value & 0x1FFF) ^ (long)(value & 0x3FFF) ^ (long)(value & 0x7FFF) ^ (long)(value & 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user