Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 public class Main {
     18 
     19   boolean b00;
     20   boolean b01;
     21   boolean b02;
     22   boolean b03;
     23   boolean b04;
     24   boolean b05;
     25   boolean b06;
     26   boolean b07;
     27   boolean b08;
     28   boolean b09;
     29   boolean b10;
     30   boolean b11;
     31   boolean b12;
     32   boolean b13;
     33   boolean b14;
     34   boolean b15;
     35   boolean b16;
     36   boolean b17;
     37   boolean b18;
     38   boolean b19;
     39   boolean b20;
     40   boolean b21;
     41   boolean b22;
     42   boolean b23;
     43   boolean b24;
     44   boolean b25;
     45   boolean b26;
     46   boolean b27;
     47   boolean b28;
     48   boolean b29;
     49   boolean b30;
     50   boolean b31;
     51   boolean b32;
     52   boolean b33;
     53   boolean b34;
     54   boolean b35;
     55   boolean b36;
     56 
     57   boolean conditionA;
     58   boolean conditionB;
     59   boolean conditionC;
     60 
     61   /// CHECK-START-ARM64: void Main.test() register (after)
     62   /// CHECK: begin_block
     63   /// CHECK:   name "B0"
     64   /// CHECK:       <<This:l\d+>>  ParameterValue
     65   /// CHECK: end_block
     66   /// CHECK: begin_block
     67   /// CHECK:   successors "<<ThenBlock:B\d+>>" "<<ElseBlock:B\d+>>"
     68   /// CHECK:       <<CondB:z\d+>>  InstanceFieldGet [<<This>>] field_name:Main.conditionB
     69   /// CHECK:                       If [<<CondB>>]
     70   /// CHECK:  end_block
     71   /// CHECK: begin_block
     72   /// CHECK:   name "<<ElseBlock>>"
     73   /// CHECK:                      ParallelMove moves:[40(sp)->d0,24(sp)->32(sp),28(sp)->36(sp),d0->d3,d3->d4,d2->d5,d4->d6,d5->d7,d6->d18,d7->d19,d18->d20,d19->d21,d20->d22,d21->d23,d22->d10,d23->d11,16(sp)->24(sp),20(sp)->28(sp),d10->d14,d11->d12,d12->d13,d13->d1,d14->d2,32(sp)->16(sp),36(sp)->20(sp)]
     74   /// CHECK: end_block
     75 
     76   /// CHECK-START-ARM64: void Main.test() disassembly (after)
     77   /// CHECK: begin_block
     78   /// CHECK:   name "B0"
     79   /// CHECK:       <<This:l\d+>>  ParameterValue
     80   /// CHECK: end_block
     81   /// CHECK: begin_block
     82   /// CHECK:   successors "<<ThenBlock:B\d+>>" "<<ElseBlock:B\d+>>"
     83   /// CHECK:       <<CondB:z\d+>>  InstanceFieldGet [<<This>>] field_name:Main.conditionB
     84   /// CHECK:                       If [<<CondB>>]
     85   /// CHECK:  end_block
     86   /// CHECK: begin_block
     87   /// CHECK:   name "<<ElseBlock>>"
     88   /// CHECK:                      ParallelMove moves:[invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid,invalid->invalid]
     89   /// CHECK:                        fmov d31, d2
     90   /// CHECK:                        ldr s2, [sp, #36]
     91   /// CHECK:                        ldr w16, [sp, #16]
     92   /// CHECK:                        str w16, [sp, #36]
     93   /// CHECK:                        str s14, [sp, #16]
     94   /// CHECK:                        ldr s14, [sp, #28]
     95   /// CHECK:                        str s1, [sp, #28]
     96   /// CHECK:                        ldr s1, [sp, #32]
     97   /// CHECK:                        str s31, [sp, #32]
     98   /// CHECK:                        ldr s31, [sp, #20]
     99   /// CHECK:                        str s31, [sp, #40]
    100   /// CHECK:                        str s12, [sp, #20]
    101   /// CHECK:                        fmov d12, d11
    102   /// CHECK:                        fmov d11, d10
    103   /// CHECK:                        fmov d10, d23
    104   /// CHECK:                        fmov d23, d22
    105   /// CHECK:                        fmov d22, d21
    106   /// CHECK:                        fmov d21, d20
    107   /// CHECK:                        fmov d20, d19
    108   /// CHECK:                        fmov d19, d18
    109   /// CHECK:                        fmov d18, d7
    110   /// CHECK:                        fmov d7, d6
    111   /// CHECK:                        fmov d6, d5
    112   /// CHECK:                        fmov d5, d4
    113   /// CHECK:                        fmov d4, d3
    114   /// CHECK:                        fmov d3, d13
    115   /// CHECK:                        ldr s13, [sp, #24]
    116   /// CHECK:                        str s3, [sp, #24]
    117   /// CHECK:                        ldr s3, pc+{{\d+}} (addr {{0x[0-9a-f]+}}) (100)
    118   /// CHECK: end_block
    119 
    120   public void test() {
    121     String r = "";
    122 
    123     // For the purpose of this regression test, the order of
    124     // definition of these float variable matters.  Likewise with the
    125     // order of the instructions where these variables are used below.
    126     // Reordering these lines make make the original (b/32545705)
    127     // issue vanish.
    128     float f17 = b17 ? 0.0f : 1.0f;
    129     float f16 = b16 ? 0.0f : 1.0f;
    130     float f18 = b18 ? 0.0f : 1.0f;
    131     float f19 = b19 ? 0.0f : 1.0f;
    132     float f20 = b20 ? 0.0f : 1.0f;
    133     float f21 = b21 ? 0.0f : 1.0f;
    134     float f15 = b15 ? 0.0f : 1.0f;
    135     float f00 = b00 ? 0.0f : 1.0f;
    136     float f22 = b22 ? 0.0f : 1.0f;
    137     float f23 = b23 ? 0.0f : 1.0f;
    138     float f24 = b24 ? 0.0f : 1.0f;
    139     float f25 = b25 ? 0.0f : 1.0f;
    140     float f26 = b26 ? 0.0f : 1.0f;
    141     float f27 = b27 ? 0.0f : 1.0f;
    142     float f29 = b29 ? 0.0f : 1.0f;
    143     float f28 = b28 ? 0.0f : 1.0f;
    144     float f01 = b01 ? 0.0f : 1.0f;
    145     float f02 = b02 ? 0.0f : 1.0f;
    146     float f03 = b03 ? 0.0f : 1.0f;
    147     float f04 = b04 ? 0.0f : 1.0f;
    148     float f05 = b05 ? 0.0f : 1.0f;
    149     float f07 = b07 ? 0.0f : 1.0f;
    150     float f06 = b06 ? 0.0f : 1.0f;
    151     float f30 = b30 ? 0.0f : 1.0f;
    152     float f31 = b31 ? 0.0f : 1.0f;
    153     float f32 = b32 ? 0.0f : 1.0f;
    154     float f33 = b33 ? 0.0f : 1.0f;
    155     float f34 = b34 ? 0.0f : 1.0f;
    156     float f36 = b36 ? 0.0f : 1.0f;
    157     float f35 = b35 ? 0.0f : 1.0f;
    158     float f08 = b08 ? 0.0f : 1.0f;
    159     float f09 = b09 ? 0.0f : 1.0f;
    160     float f10 = b10 ? 0.0f : 1.0f;
    161     float f11 = b11 ? 0.0f : 1.0f;
    162     float f12 = b12 ? 0.0f : 1.0f;
    163     float f14 = b14 ? 0.0f : 1.0f;
    164     float f13 = b13 ? 0.0f : 1.0f;
    165 
    166     if (conditionA) {
    167       f16 /= 1000.0f;
    168       f17 /= 1000.0f;
    169       f18 /= 1000.0f;
    170       f19 /= 1000.0f;
    171       f20 /= 1000.0f;
    172       f21 /= 1000.0f;
    173       f15 /= 1000.0f;
    174       f08 /= 1000.0f;
    175       f09 /= 1000.0f;
    176       f10 /= 1000.0f;
    177       f11 /= 1000.0f;
    178       f12 /= 1000.0f;
    179       f30 /= 1000.0f;
    180       f31 /= 1000.0f;
    181       f32 /= 1000.0f;
    182       f33 /= 1000.0f;
    183       f34 /= 1000.0f;
    184       f01 /= 1000.0f;
    185       f02 /= 1000.0f;
    186       f03 /= 1000.0f;
    187       f04 /= 1000.0f;
    188       f05 /= 1000.0f;
    189       f23 /= 1000.0f;
    190       f24 /= 1000.0f;
    191       f25 /= 1000.0f;
    192       f26 /= 1000.0f;
    193       f27 /= 1000.0f;
    194       f22 /= 1000.0f;
    195       f00 /= 1000.0f;
    196       f14 /= 1000.0f;
    197       f13 /= 1000.0f;
    198       f36 /= 1000.0f;
    199       f35 /= 1000.0f;
    200       f07 /= 1000.0f;
    201       f06 /= 1000.0f;
    202       f29 /= 1000.0f;
    203       f28 /= 1000.0f;
    204     }
    205     // The parallel move that used to exhaust the ARM64 parallel move
    206     // resolver's scratch register pool (provided by VIXL) was in the
    207     // "else" branch of the following condition generated by ART's
    208     // compiler.
    209     if (conditionB) {
    210       f16 /= 100.0f;
    211       f17 /= 100.0f;
    212       f18 /= 100.0f;
    213       f19 /= 100.0f;
    214       f20 /= 100.0f;
    215       f21 /= 100.0f;
    216       f15 /= 100.0f;
    217       f08 /= 100.0f;
    218       f09 /= 100.0f;
    219       f10 /= 100.0f;
    220       f11 /= 100.0f;
    221       f12 /= 100.0f;
    222       f30 /= 100.0f;
    223       f31 /= 100.0f;
    224       f32 /= 100.0f;
    225       f33 /= 100.0f;
    226       f34 /= 100.0f;
    227       f01 /= 100.0f;
    228       f02 /= 100.0f;
    229       f03 /= 100.0f;
    230       f04 /= 100.0f;
    231       f05 /= 100.0f;
    232       f23 /= 100.0f;
    233       f24 /= 100.0f;
    234       f25 /= 100.0f;
    235       f26 /= 100.0f;
    236       f27 /= 100.0f;
    237       f22 /= 100.0f;
    238       f00 /= 100.0f;
    239       f14 /= 100.0f;
    240       f13 /= 100.0f;
    241       f36 /= 100.0f;
    242       f35 /= 100.0f;
    243       f07 /= 100.0f;
    244       f06 /= 100.0f;
    245       f29 /= 100.0f;
    246       f28 /= 100.0f;
    247     }
    248     if (conditionC) {
    249       f16 /= 12.0f;
    250       f17 /= 12.0f;
    251       f18 /= 12.0f;
    252       f19 /= 12.0f;
    253       f20 /= 12.0f;
    254       f21 /= 12.0f;
    255       f15 /= 12.0f;
    256       f08 /= 12.0f;
    257       f09 /= 12.0f;
    258       f10 /= 12.0f;
    259       f11 /= 12.0f;
    260       f12 /= 12.0f;
    261       f30 /= 12.0f;
    262       f31 /= 12.0f;
    263       f32 /= 12.0f;
    264       f33 /= 12.0f;
    265       f34 /= 12.0f;
    266       f01 /= 12.0f;
    267       f02 /= 12.0f;
    268       f03 /= 12.0f;
    269       f04 /= 12.0f;
    270       f05 /= 12.0f;
    271       f23 /= 12.0f;
    272       f24 /= 12.0f;
    273       f25 /= 12.0f;
    274       f26 /= 12.0f;
    275       f27 /= 12.0f;
    276       f22 /= 12.0f;
    277       f00 /= 12.0f;
    278       f14 /= 12.0f;
    279       f13 /= 12.0f;
    280       f36 /= 12.0f;
    281       f35 /= 12.0f;
    282       f07 /= 12.0f;
    283       f06 /= 12.0f;
    284       f29 /= 12.0f;
    285       f28 /= 12.0f;
    286     }
    287     float s = 0.0f;
    288     s = ((float) Math.round(100.0f * s)) / 100.0f;
    289     String res = s + r;
    290   }
    291 
    292   public static void main(String[] args) {
    293     Main main = new Main();
    294     main.test();
    295     System.out.println("passed");
    296   }
    297 }
    298