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