HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Android 10
|
10.0.0_r6
下载
查看原文件
收藏
根目录
art
test
684-checker-simd-dotprod
src
other
TestVarious.java
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package other; /** * Tests for dot product idiom vectorization. */ public class TestVarious { /// CHECK-START: int other.TestVarious.testDotProdConstRight(byte[]) loop_optimization (before) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 89 loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Mul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-START-{ARM64}: int other.TestVarious.testDotProdConstRight(byte[]) loop_optimization (after) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 16 loop:none /// CHECK-DAG: <
> IntConstant 89 loop:none /// CHECK-DAG: <
> VecSetScalars [<
>] loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{d\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecDotProd [<
>,<
>,<
>] type:Int8 loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-DAG: <
> VecReduce [<
>] loop:none /// CHECK-DAG: VecExtractScalar [<
>] loop:none public static final int testDotProdConstRight(byte[] b) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = b[i] * 89; s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdConstLeft(byte[]) loop_optimization (before) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 89 loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Mul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-START-{ARM64}: int other.TestVarious.testDotProdConstLeft(byte[]) loop_optimization (after) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 16 loop:none /// CHECK-DAG: <
> IntConstant 89 loop:none /// CHECK-DAG: <
> VecSetScalars [<
>] loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{d\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecDotProd [<
>,<
>,<
>] type:Uint8 loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-DAG: <
> VecReduce [<
>] loop:none /// CHECK-DAG: VecExtractScalar [<
>] loop:none public static final int testDotProdConstLeft(byte[] b) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = 89 * (b[i] & 0xff); s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdLoopInvariantConvRight(byte[], int) loop_optimization (before) /// CHECK-DAG: <
> ParameterValue loop:none /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 129 loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:none /// CHECK-DAG: <
> TypeConversion [<
>] loop:none // /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Mul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-START-{ARM64}: int other.TestVarious.testDotProdLoopInvariantConvRight(byte[], int) loop_optimization (after) /// CHECK-DAG: <
> ParameterValue loop:none /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 16 loop:none /// CHECK-DAG: <
> IntConstant 129 loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:none /// CHECK-DAG: <
> TypeConversion [<
>] loop:none /// CHECK-DAG: <
> VecSetScalars [<
>] loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none // /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{d\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecDotProd [<
>,<
>,<
>] type:Int8 loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-DAG: <
> VecReduce [<
>] loop:none /// CHECK-DAG: VecExtractScalar [<
>] loop:none public static final int testDotProdLoopInvariantConvRight(byte[] b, int param) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = b[i] * ((byte)(param + 129)); s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdByteToChar(char[], char[]) loop_optimization (after) /// CHECK-NOT: VecDotProd public static final int testDotProdByteToChar(char[] a, char[] b) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = ((char)((byte)(a[i] + 129))) * b[i]; s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdMixedSize(byte[], short[]) loop_optimization (after) /// CHECK-NOT: VecDotProd public static final int testDotProdMixedSize(byte[] a, short[] b) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = a[i] * b[i]; s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdMixedSizeAndSign(byte[], char[]) loop_optimization (after) /// CHECK-NOT: VecDotProd public static final int testDotProdMixedSizeAndSign(byte[] a, char[] b) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = a[i] * b[i]; s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdInt32(int[], int[]) loop_optimization (before) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Mul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-START-{ARM64}: int other.TestVarious.testDotProdInt32(int[], int[]) loop_optimization (after) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> VecSetScalars [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{d\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecMul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecAdd [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-DAG: <
> VecReduce [<
>] loop:none /// CHECK-DAG: VecExtractScalar [<
>] loop:none public static final int testDotProdInt32(int[] a, int[] b) { int s = 1; for (int i = 0; i < b.length; i++) { int temp = a[i] * b[i]; s += temp; } return s; } /// CHECK-START: int other.TestVarious.testDotProdBothSignedUnsigned1(byte[], byte[]) loop_optimization (before) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 2 loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,{{i\d+}}] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [{{l\d+}},<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Mul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> TypeConversion [<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> TypeConversion [<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Mul [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-START-{ARM64}: int other.TestVarious.testDotProdBothSignedUnsigned1(byte[], byte[]) loop_optimization (after) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 2 loop:none /// CHECK-DAG: <
> IntConstant 16 loop:none /// CHECK-DAG: <
> VecSetScalars [<