[aarch64-port-dev ] RFR: 8221658: aarch64: add necessary predicate for ubfx patterns

Yangfei (Felix) felix.yang at huawei.com
Tue Apr 9 01:36:02 UTC 2019


Hi,

    This can pass the fuzz test and we got the same output as when the test is executed on the x86 platform.  
    New webrev: http://cr.openjdk.java.net/~fyang/8221658/webrev.02/
    This also incorporates the following two constraints:  
    2. mask != 0
    3. rshift + width <= 32/64  (width = exact_log2(mask+1))

    JTreg tested with a fastdebug build, OK? 

Thanks,
Felix

> 
> Try this:
> 
> diff -r c763810a9bf5 src/cpu/aarch64/vm/aarch64.ad
> --- a/src/cpu/aarch64/vm/aarch64.ad	Fri Sep 28 08:48:26 2018 +0800
> +++ b/src/cpu/aarch64/vm/aarch64.ad	Thu Apr 04 13:47:03 2019 -0400
> @@ -12340,7 +12340,7 @@
>    ins_cost(INSN_COST);
>    format %{ "ubfxw $dst, $src, $mask" %}
>    ins_encode %{
> -    int rshift = $rshift$$constant;
> +    int rshift = $rshift$$constant & 31;
>      long mask = $mask$$constant;
>      int width = exact_log2(mask+1);
>      __ ubfxw(as_Register($dst$$reg),
> @@ -12355,7 +12355,7 @@
>    ins_cost(INSN_COST);
>    format %{ "ubfx $dst, $src, $mask" %}
>    ins_encode %{
> -    int rshift = $rshift$$constant;
> +    int rshift = $rshift$$constant & 63;
>      long mask = $mask$$constant;
>      int width = exact_log2(mask+1);
>      __ ubfx(as_Register($dst$$reg),
> @@ -12373,7 +12373,7 @@
>    ins_cost(INSN_COST * 2);
>    format %{ "ubfx $dst, $src, $mask" %}
>    ins_encode %{
> -    int rshift = $rshift$$constant;
> +    int rshift = $rshift$$constant & 31;
>      long mask = $mask$$constant;
>      int width = exact_log2(mask+1);
>      __ ubfx(as_Register($dst$$reg),
> diff -r c763810a9bf5 src/cpu/aarch64/vm/aarch64_ad.m4
> --- a/src/cpu/aarch64/vm/aarch64_ad.m4	Fri Sep 28 08:48:26 2018 +0800
> +++ b/src/cpu/aarch64/vm/aarch64_ad.m4	Thu Apr 04 13:47:03 2019 -0400
> @@ -185,7 +185,7 @@
>    ins_cost(INSN_COST);
>    format %{ "$3 $dst, $src, $mask" %}
>    ins_encode %{
> -    int rshift = $rshift$$constant;
> +    int rshift = $rshift$$constant & $4;
>      long mask = $mask$$constant;
>      int width = exact_log2(mask+1);
>      __ $3(as_Register($dst$$reg),
> @@ -193,8 +193,8 @@
>    %}
>    ins_pipe(ialu_reg_shift);
>  %}')
> -BFX_INSN(I,URShift,ubfxw)
> -BFX_INSN(L,URShift,ubfx)
> +BFX_INSN(I,URShift,ubfxw,31)
> +BFX_INSN(L,URShift,ubfx,63)
> 
>  // We can use ubfx when extending an And with a mask when we know mask
>  // is positive.  We know that because immI_bitmask guarantees it.
> @@ -205,7 +205,7 @@
>    ins_cost(INSN_COST * 2);
>    format %{ "ubfx $dst, $src, $mask" %}
>    ins_encode %{
> -    int rshift = $rshift$$constant;
> +    int rshift = $rshift$$constant & 31;
>      long mask = $mask$$constant;
>      int width = exact_log2(mask+1);
>      __ ubfx(as_Register($dst$$reg),
> 
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the hotspot-compiler-dev mailing list