hotspot/test/compiler/loopopts/superword/ReductionPerf.java
author thartmann
Wed, 10 Feb 2016 15:24:22 +0100
changeset 36057 867e857daf84
parent 30588 24fc4b3a964e
child 40059 c2304140ed64
permissions -rw-r--r--
8149123: [TESTBUG] compiler/loopopts/superword/SumRed* tests running on non-x86 platforms Summary: Restricted test execution to supported archs. Reviewed-by: kvn Contributed-by: Jamsheed Mohammed <jamsheed.c.m@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30588
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     1
/*
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     4
 *
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     8
 *
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    13
 * accompanied this code).
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    14
 *
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    18
 *
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    21
 * questions.
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    22
 *
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    23
 */
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    24
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    25
/**
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    26
 * @test
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    27
 * @bug 8074981
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    28
 * @summary Add C2 x86 Superword support for scalar product reduction optimizations : int test
36057
867e857daf84 8149123: [TESTBUG] compiler/loopopts/superword/SumRed* tests running on non-x86 platforms
thartmann
parents: 30588
diff changeset
    29
 * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
30588
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    30
 *
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    31
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 -XX:CompileCommand=exclude,ReductionPerf::main ReductionPerf
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    32
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:CompileThresholdScaling=0.1 -XX:CompileCommand=exclude,ReductionPerf::main ReductionPerf
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    33
 */
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    34
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    35
public class ReductionPerf {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    36
  public static void main(String[] args) throws Exception {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    37
    int[] a1 = new int[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    38
    int[] a2 = new int[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    39
    int[] a3 = new int[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    40
    long[] b1 = new long[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    41
    long[] b2 = new long[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    42
    long[] b3 = new long[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    43
    float[] c1 = new float[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    44
    float[] c2 = new float[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    45
    float[] c3 = new float[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    46
    double[] d1 = new double[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    47
    double[] d2 = new double[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    48
    double[] d3 = new double[8*1024];
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    49
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    50
    ReductionInit(a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    51
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    52
    int    sumIv = sumInt(a1,a2,a3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    53
    long   sumLv = sumLong(b1,b2,b3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    54
    float  sumFv = sumFloat(c1,c2,c3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    55
    double sumDv = sumDouble(d1,d2,d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    56
    int    mulIv = prodInt(a1,a2,a3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    57
    long   mulLv = prodLong(b1,b2,b3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    58
    float  mulFv = prodFloat(c1,c2,c3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    59
    double mulDv = prodDouble(d1,d2,d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    60
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    61
    int    sumI = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    62
    long   sumL = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    63
    float  sumF = 0.f;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    64
    double sumD = 0.;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    65
    int    mulI = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    66
    long   mulL = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    67
    float  mulF = 0.f;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    68
    double mulD = 0.;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    69
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    70
    System.out.println("Warmup ...");
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    71
    long  start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    72
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    73
    for(int j = 0; j < 2000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    74
      sumI = sumInt(a1,a2,a3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    75
      sumL = sumLong(b1,b2,b3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    76
      sumF = sumFloat(c1,c2,c3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    77
      sumD = sumDouble(d1,d2,d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    78
      mulI = prodInt(a1,a2,a3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    79
      mulL = prodLong(b1,b2,b3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    80
      mulF = prodFloat(c1,c2,c3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    81
      mulD = prodDouble(d1,d2,d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    82
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    83
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    84
    long stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    85
    System.out.println(" Warmup is done in " + (stop - start) + " msec");
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    86
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    87
    if (sumIv != sumI) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    88
      System.out.println("sum int:    " + sumIv + " != " + sumI);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    89
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    90
    if (sumLv != sumL) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    91
      System.out.println("sum long:   " + sumLv + " != " + sumL);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    92
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    93
    if (sumFv != sumF) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    94
      System.out.println("sum float:  " + sumFv + " != " + sumF);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    95
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    96
    if (sumDv != sumD) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    97
      System.out.println("sum double: " + sumDv + " != " + sumD);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    98
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
    99
    if (mulIv != mulI) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   100
      System.out.println("prod int:    " + mulIv + " != " + mulI);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   101
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   102
    if (mulLv != mulL) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   103
      System.out.println("prod long:   " + mulLv + " != " + mulL);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   104
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   105
    if (mulFv != mulF) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   106
      System.out.println("prod float:  " + mulFv + " != " + mulF);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   107
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   108
    if (mulDv != mulD) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   109
      System.out.println("prod double: " + mulDv + " != " + mulD);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   110
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   111
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   112
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   113
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   114
      sumI = sumInt(a1, a2 ,a3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   115
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   116
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   117
    System.out.println("sum int:    " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   118
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   119
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   120
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   121
      sumL = sumLong(b1, b2, b3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   122
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   123
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   124
    System.out.println("sum long:   " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   125
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   126
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   127
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   128
      sumF = sumFloat(c1, c2, c3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   129
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   130
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   131
    System.out.println("sum float:  " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   132
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   133
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   134
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   135
      sumD = sumDouble(d1, d2, d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   136
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   137
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   138
    System.out.println("sum double: " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   139
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   140
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   141
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   142
      mulI = prodInt(a1, a2, a3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   143
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   144
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   145
    System.out.println("prod int:    " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   146
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   147
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   148
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   149
      mulL = prodLong(b1, b2 ,b3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   150
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   151
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   152
    System.out.println("prod long:   " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   153
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   154
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   155
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   156
      mulF = prodFloat(c1, c2, c3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   157
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   158
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   159
    System.out.println("prod float:  " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   160
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   161
    start = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   162
    for (int j = 0; j < 5000; j++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   163
      mulD = prodDouble(d1, d2, d3);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   164
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   165
    stop = System.currentTimeMillis();
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   166
    System.out.println("prod double: " + (stop - start));
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   167
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   168
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   169
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   170
  public static void ReductionInit(int[]    a1, int[]    a2, int[]    a3,
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   171
                                   long[]   b1, long[]   b2, long[]   b3,
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   172
                                   float[]  c1, float[]  c2, float[]  c3,
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   173
                                   double[] d1, double[] d2, double[] d3 ) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   174
    for(int i = 0; i < a1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   175
      a1[i] =          (i + 0);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   176
      a2[i] =          (i + 1);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   177
      a3[i] =          (i + 2);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   178
      b1[i] =   (long) (i + 0);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   179
      b2[i] =   (long) (i + 1);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   180
      b3[i] =   (long) (i + 2);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   181
      c1[i] =  (float) (i + 0);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   182
      c2[i] =  (float) (i + 1);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   183
      c3[i] =  (float) (i + 2);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   184
      d1[i] = (double) (i + 0);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   185
      d2[i] = (double) (i + 1);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   186
      d3[i] = (double) (i + 2);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   187
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   188
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   189
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   190
  public static int sumInt(int[] a1, int[] a2, int[] a3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   191
    int total = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   192
    for(int i = 0; i < a1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   193
      total += (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   194
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   195
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   196
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   197
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   198
  public static long sumLong(long[] b1, long[] b2, long[] b3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   199
    long total = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   200
    for(int i = 0; i < b1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   201
      total += (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   202
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   203
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   204
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   205
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   206
  public static float sumFloat(float[] c1, float[] c2, float[] c3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   207
    float total = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   208
    for(int i = 0; i < c1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   209
      total += (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   210
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   211
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   212
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   213
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   214
  public static double sumDouble(double[] d1, double[] d2, double[] d3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   215
    double total = 0;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   216
    for(int i = 0; i < d1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   217
      total += (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   218
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   219
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   220
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   221
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   222
  public static int prodInt(int[] a1, int[] a2, int[] a3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   223
    int total = 1;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   224
    for(int i = 0; i < a1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   225
      total *= (a1[i] * a2[i]) + (a1[i] * a3[i]) + (a2[i] * a3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   226
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   227
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   228
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   229
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   230
  public static long prodLong(long[] b1, long[] b2, long[] b3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   231
    long total = 1;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   232
    for(int i = 0; i < b1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   233
      total *= (b1[i] * b2[i]) + (b1[i] * b3[i]) + (b2[i] * b3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   234
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   235
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   236
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   237
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   238
  public static float prodFloat(float[] c1, float[] c2, float[] c3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   239
    float total = 1;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   240
    for(int i = 0; i < c1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   241
      total *= (c1[i] * c2[i]) + (c1[i] * c3[i]) + (c2[i] * c3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   242
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   243
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   244
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   245
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   246
  public static double prodDouble(double[] d1, double[] d2, double[] d3) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   247
    double total = 1;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   248
    for(int i = 0; i < d1.length; i++) {
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   249
      total *= (d1[i] * d2[i]) + (d1[i] * d3[i]) + (d2[i] * d3[i]);
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   250
    }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   251
    return total;
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   252
  }
24fc4b3a964e 8078563: Restrict reduction optimization
kvn
parents:
diff changeset
   253
}