1 #!/bin/sh
   2 # 
   3 # Copyright (c) 2012, 2014, 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 ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+PrintCompilation -XX:+TraceNewVectors TestIntVect > test.out 2>&1
  59 
  60 COUNT=`grep AddVI test.out | wc -l | awk '{print $1}'`
  61 if [ $COUNT -lt 4 ]
  62 then
  63     echo "Test Failed: AddVI $COUNT < 4"
  64     exit 1
  65 fi
  66 
  67 # AddVI is generated for test_subc
  68 COUNT=`grep SubVI test.out | wc -l | awk '{print $1}'`
  69 if [ $COUNT -lt 4 ]
  70 then
  71     echo "Test Failed: SubVI $COUNT < 4"
  72     exit 1
  73 fi
  74 
  75 # MulVI is only supported with SSE4.1.
  76 if [ $SSE -gt 3 ]
  77 then
  78 # LShiftVI+SubVI is generated for test_mulc
  79 COUNT=`grep MulVI test.out | wc -l | awk '{print $1}'`
  80 if [ $COUNT -lt 2 ]
  81 then
  82     echo "Test Failed: MulVI $COUNT < 2"
  83     exit 1
  84 fi
  85 fi
  86 
  87 COUNT=`grep AndV test.out | wc -l | awk '{print $1}'`
  88 if [ $COUNT -lt 3 ]
  89 then
  90     echo "Test Failed: AndV $COUNT < 3"
  91     exit 1
  92 fi
  93 
  94 COUNT=`grep OrV test.out | wc -l | awk '{print $1}'`
  95 if [ $COUNT -lt 3 ]
  96 then
  97     echo "Test Failed: OrV $COUNT < 3"
  98     exit 1
  99 fi
 100 
 101 COUNT=`grep XorV test.out | wc -l | awk '{print $1}'`
 102 if [ $COUNT -lt 3 ]
 103 then
 104     echo "Test Failed: XorV $COUNT < 3"
 105     exit 1
 106 fi
 107 
 108 # LShiftVI+SubVI is generated for test_mulc
 109 COUNT=`grep LShiftVI test.out | wc -l | awk '{print $1}'`
 110 if [ $COUNT -lt 5 ]
 111 then
 112     echo "Test Failed: LShiftVI $COUNT < 5"
 113     exit 1
 114 fi
 115 
 116 COUNT=`grep RShiftVI test.out | sed '/URShiftVI/d' | wc -l | awk '{print $1}'`
 117 if [ $COUNT -lt 3 ]
 118 then
 119     echo "Test Failed: RShiftVI $COUNT < 3"
 120     exit 1
 121 fi
 122 
 123 COUNT=`grep URShiftVI test.out | wc -l | awk '{print $1}'`
 124 if [ $COUNT -lt 3 ]
 125 then
 126     echo "Test Failed: URShiftVI $COUNT < 3"
 127     exit 1
 128 fi
 129