HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Android 10
|
10.0.0_r6
下载
查看原文件
收藏
根目录
art
test
667-checker-simd-alignment
src
Main.java
/* * Copyright (C) 2017 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. */ /** * Tests for zero vectorization. */ public class Main { /// CHECK-START: void Main.staticallyAligned(int[]) loop_optimization (before) /// CHECK-DAG: <
> ParameterValue loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-START-ARM: void Main.staticallyAligned(int[]) loop_optimization (after) /// CHECK-DAG: <
> ParameterValue loop:none /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 2 loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [<
>,<
>] alignment:ALIGN(8,0) loop:<
> outer_loop:none /// CHECK-DAG: <
> VecAdd [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecStore [<
>,<
>,<
>] alignment:ALIGN(8,0) loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-NOT: ArrayGet /// CHECK-NOT: ArraySet static void staticallyAligned(int[] a) { // Starts at offset 12 (hidden) + 1 * 4 relative to base alignment. // So no peeling, aligned vector, no cleanup. for (int i = 1; i < 9; i++) { a[i] += 1; } } /// CHECK-START: void Main.staticallyAlignedN(int[]) loop_optimization (before) /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> NullCheck loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-START-ARM: void Main.staticallyAlignedN(int[]) loop_optimization (after) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 2 loop:none /// CHECK-DAG: <
> NullCheck loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [<
>,<
>] alignment:ALIGN(8,0) loop:<
> outer_loop:none /// CHECK-DAG: <
> VecAdd [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecStore [<
>,<
>,<
>] alignment:ALIGN(8,0) loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none static void staticallyAlignedN(int[] a) { // Starts at offset 12 (hidden) + 1 * 4 relative to base alignment. // So no peeling, aligned vector, cleanup. for (int i = 1; i < a.length; i++) { a[i] += 1; } } /// CHECK-START: void Main.staticallyMisaligned(int[]) loop_optimization (before) /// CHECK-DAG: <
> ParameterValue loop:none /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-START-ARM: void Main.staticallyMisaligned(int[]) loop_optimization (after) /// CHECK-DAG: <
> ParameterValue loop:none /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 2 loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [<
>,<
>] alignment:ALIGN(8,0) loop:<
> outer_loop:none /// CHECK-DAG: <
> VecAdd [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: VecStore [<
>,<
>,<
>] alignment:ALIGN(8,0) loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-NOT: ArrayGet /// CHECK-NOT: ArraySet static void staticallyMisaligned(int[] a) { // Starts at offset 12 (hidden) + 0 * 4 relative to base alignment. // Yes, Art runtime misaligns the most common access pattern :-( // Static peeling to the rescue, aligned vector, no cleanup. for (int i = 0; i < 9; i++) { a[i] += 1; } } /// CHECK-START: void Main.staticallyMisalignedN(int[]) loop_optimization (before) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> NullCheck loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none // /// CHECK-START-ARM: void Main.staticallyMisalignedN(int[]) loop_optimization (after) /// CHECK-DAG: <
> IntConstant 0 loop:none /// CHECK-DAG: <
> IntConstant 1 loop:none /// CHECK-DAG: <
> IntConstant 2 loop:none /// CHECK-DAG: <
> NullCheck loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> ArrayGet [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: ArraySet [<
>,<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> Add [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecReplicateScalar [<
>] loop:none /// CHECK-DAG: <
> Phi [<
>,<
>] loop:<
> outer_loop:none /// CHECK-DAG: <
> VecLoad [<
>,<
>] alignment:ALIGN(8,0) loop:<