1 #!/bin/sh
   2 # 
   3 # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 # 
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 # 
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 # 
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 # 
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 # 
  24 # 
  25 
  26 ## some tests require path to find test source dir
  27 if [ "${TESTSRC}" = "" ]
  28 then
  29   TESTSRC=${PWD}
  30   echo "TESTSRC not set.  Using "${TESTSRC}" as default"
  31 fi
  32 echo "TESTSRC=${TESTSRC}"
  33 ## Adding common setup Variables for running shell tests.
  34 . ${TESTSRC}/../../../test_env.sh
  35 
  36 ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xinternalversion | sed 's/amd64/x86/' | grep "x86" | grep "Server VM" | grep "debug"
  37 
  38 # Only test fastdebug Server VM on x86
  39 if [ $? != 0 ]
  40 then
  41     echo "Test Passed"
  42     exit 0
  43 fi
  44 
  45 # grep for support integer multiply vectors (cpu with SSE4.1)
  46 ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -XX:+PrintMiscellaneous -XX:+Verbose -version | grep "cores per cpu" | grep "sse4.1"
  47 
  48 if [ $? != 0 ]
  49 then
  50     SSE=2
  51 else
  52     SSE=4
  53 fi
  54 
  55 cp ${TESTSRC}${FS}TestIntVect.java .
  56 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} -d . TestIntVect.java
  57 
  58 # CICompilerCount must be at least 2 with -TieredCompilation
  59 ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xbatch -XX:-TieredCompilation  \
  60         -XX:CICompilerCount=2 -XX:+PrintCompilation -XX:+TraceNewVectors \
  61         compiler.c2.cr7200264.TestIntVect > test.out 2>&1
  62 
  63 COUNT=`grep AddVI test.out | wc -l | awk '{print $1}'`
  64 if [ $COUNT -lt 4 ]
  65 then
  66     echo "Test Failed: AddVI $COUNT < 4"
  67     exit 1
  68 fi
  69 
  70 # AddVI is generated for test_subc
  71 COUNT=`grep SubVI test.out | wc -l | awk '{print $1}'`
  72 if [ $COUNT -lt 4 ]
  73 then
  74     echo "Test Failed: SubVI $COUNT < 4"
  75     exit 1
  76 fi
  77 
  78 # MulVI is only supported with SSE4.1.
  79 if [ $SSE -gt 3 ]
  80 then
  81 # LShiftVI+SubVI is generated for test_mulc
  82 COUNT=`grep MulVI test.out | wc -l | awk '{print $1}'`
  83 if [ $COUNT -lt 2 ]
  84 then
  85     echo "Test Failed: MulVI $COUNT < 2"
  86     exit 1
  87 fi
  88 fi
  89 
  90 COUNT=`grep AndV test.out | wc -l | awk '{print $1}'`
  91 if [ $COUNT -lt 3 ]
  92 then
  93     echo "Test Failed: AndV $COUNT < 3"
  94     exit 1
  95 fi
  96 
  97 COUNT=`grep OrV test.out | wc -l | awk '{print $1}'`
  98 if [ $COUNT -lt 3 ]
  99 then
 100     echo "Test Failed: OrV $COUNT < 3"
 101     exit 1
 102 fi
 103 
 104 COUNT=`grep XorV test.out | wc -l | awk '{print $1}'`
 105 if [ $COUNT -lt 3 ]
 106 then
 107     echo "Test Failed: XorV $COUNT < 3"
 108     exit 1
 109 fi
 110 
 111 # LShiftVI+SubVI is generated for test_mulc
 112 COUNT=`grep LShiftVI test.out | wc -l | awk '{print $1}'`
 113 if [ $COUNT -lt 5 ]
 114 then
 115     echo "Test Failed: LShiftVI $COUNT < 5"
 116     exit 1
 117 fi
 118 
 119 COUNT=`grep RShiftVI test.out | sed '/URShiftVI/d' | wc -l | awk '{print $1}'`
 120 if [ $COUNT -lt 3 ]
 121 then
 122     echo "Test Failed: RShiftVI $COUNT < 3"
 123     exit 1
 124 fi
 125 
 126 COUNT=`grep URShiftVI test.out | wc -l | awk '{print $1}'`
 127 if [ $COUNT -lt 3 ]
 128 then
 129     echo "Test Failed: URShiftVI $COUNT < 3"
 130     exit 1
 131 fi
 132