Added test for "rotate immediate" code generation using SHA

pull/253/merge
Jeffrey Walton 2016-09-04 12:22:48 -04:00
parent f23314f731
commit cc1fe049cd
1 changed files with 52 additions and 7 deletions

View File

@ -1060,6 +1060,51 @@ echo "Start time: $TEST_BEGIN" | tee -a "$TEST_RESULTS"
# X86 code generation tests
if [[ ("$HAVE_DISASS" -ne "0" && ("$IS_X86" -ne "0" || "$IS_X64" -ne "0")) ]]; then
############################################
# X86 rotate immediate code generation
X86_ROTATE_IMM=1
if [[ ("$X86_ROTATE_IMM" -ne "0") ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: X86 rotate immediate code generation" | tee -a "$TEST_RESULTS"
echo
OBJFILE=sha.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS ${PLATFORM_CXXFLAGS[@]}" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null)
X86_SSE2=$(echo -n "$X86_CPU_FLAGS" | "$GREP" -i -c sse2)
X86_SHA256_HASH_BLOCKS=$(echo -n "$DISASS_TEXT" | "$EGREP" -c 'X86_SHA256_HashBlocks')
if [[ ("$X86_SHA256_HASH_BLOCKS" -ne "0") ]]; then
COUNT=$(echo -n "$DISASS_TEXT" | "$EGREP" -i -c '(rol.*0x|ror.*0x)')
if [[ ("$COUNT" -le "600") ]]; then
FAILED=1
echo "ERROR: failed to generate rotate immediate instruction (X86_SHA256_HashBlocks)" | tee -a "$TEST_RESULTS"
fi
else
COUNT=$(echo -n "$DISASS_TEXT" | "$EGREP" -i -c '(rol.*0x|ror.*0x)')
if [[ ("$COUNT" -le "1000") ]]; then
FAILED=1
echo "ERROR: failed to generate rotate immediate instruction" | tee -a "$TEST_RESULTS"
fi
fi
if [[ ("$X86_SSE2" -ne "0" && "$X86_SHA256_HASH_BLOCKS" -eq "0") ]]; then
echo "ERROR: failed to use X86_SHA256_HashBlocks" | tee -a "$TEST_RESULTS"
if [[ ("$CLANG_COMPILER" -ne "0" && "$CLANG_37_OR_ABOVE" -eq "0") ]]; then
echo "This could be due to Clang and lack of expected support for Intel assembly syntax in some versions of the compiler"
fi
fi
if [[ ("$FAILED" -eq "0" && "$X86_SHA256_HASH_BLOCKS" -ne "0") ]]; then
echo "Verified rotate immediate machine instructions (X86_SHA256_HashBlocks)" | tee -a "$TEST_RESULTS"
elif [[ ("$FAILED" -eq "0") ]]; then
echo "Verified rotate immediate machine instructions" | tee -a "$TEST_RESULTS"
fi
fi
############################################
# Test AES-NI code generation