[aarch64-port-dev ] [aarch64-port-dev] [10] RFR: 8184049 : Matching rule for ubfiz

Daniel Stewart daniel.stewart at linaro.org
Mon Jul 24 14:10:03 UTC 2017


Andrew,

Find below the java program I used to test the patch.

Daniel

--

public class Test {
    static int ia[] = {0xabcd1234, 1};
    static long la[] = {0xabcd1234abcd1234L, 1};
    static short sa[] = {(short)0xabcd1234, 1};
    public static int testI() {
        return (ia[0] & 0xf) << 3;      // ubfiz wa,wb, #3, #4
    }
    public static int testI2() {
        return (ia[0] & 0xf) << 33; // Shouldn't use ubfiz because shift >
31, *NOT* ubfiz wa,wb, #1, #4
    }
    public static int testI3() {
        return (ia[0] & 0x8) << 5;  // neg, Shouldn't use ubfiz because
lower bits are not contiguous, *NOT* ubfiz wa,wb, #5, #4
    }
    public static int testI4() {
        return (ia[0] & 0x7) << 3; // ubfiz wa, wb, #3, #3
    }
    public static int testI5() {
                return(ia[0] & 0x7fff) << 16;   // ubfiz wa,wb, #16, #15
        }
    public static long testL() {
        return (la[0] & 0xf) << 2;      // ubfiz xa, xb, #2, #4
    }
    public static long testL2() {
        return (la[0] & 0xf) << 32;     // ubfiz xa, xb, #32, #4
    }
    public static long testL3() {
        return (la[0] & 0xfff) << 48;   // ubfiz xa, xb, #48, #12
    }
    public static long testL4() {
        return (la[0] & 0xffff) << 48;  // Shouldn't match because there is
no need for an ANDL or ANDI in the IR graph when masking 16-bits, just a
LOADL. *NOT* ubfiz xa, xb, #48, #16
    }
    public static long testConv() {
        return ((long)(ia[0] & 0x3)) << 3;  // ubfiz wa, wb, #3, #2
    }
    public static short testConv2() {
        return (short)((sa[0] & 0x7) << 4);     // ubfiz wa, wb, #4, #3
    }
    public static long testConv3() {
        return (((long)ia[0]) & 0x1f) << 3; // ubfiz    w0, w0, #3, #5
    }
    public static void main(String [] args) {
        long sum = 0;
        for (int i = 0; i < 10000000; i++) {
            //System.out.println((int)Math.random());
            sum += testI();
            sum += testI2();
            sum += testI3();
            sum += testI4();
            sum += testI5();
            sum += testL();
            sum += testL2();
            sum += testL3();
            sum += testL4();
            sum += testConv();
            sum += testConv2();
            sum += testConv3();
        }
        System.out.println(sum);
    }
}



On Mon, Jul 24, 2017 at 9:37 AM, Andrew Haley <aph at redhat.com> wrote:

> On 24/07/17 14:33, Daniel Stewart wrote:
> > Please see the webrev [1] for adding some matching rules to ubfiz [2].
> >
> > [1]: http://cr.openjdk.java.net/~njian/8184049/webrev.00/
> > [2]: https://bugs.openjdk.java.net/browse/JDK-8184049
>
> Looks very cool.  Send me a test case which exercises these patterns and
> I'll approve the patch.
>
> Thanks.
>
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>



-- 
Daniel Stewart


More information about the aarch64-port-dev mailing list