Add separate Polynomial Multiply feature test on POWER8 (GH#742)

pull/748/head
Jeffrey Walton 2018-11-19 18:31:45 -05:00
parent 215f9dc164
commit f52a141f6e
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 28 additions and 10 deletions

View File

@ -626,7 +626,7 @@ ifeq ($(DETECT_FEATURES),1)
#endif #endif
##################################################################### #####################################################################
# AES is a separate submodule of POWER8 due to possible export # Crypto is a separate submodule of POWER8 due to possible export
# restrictions by the government. It is the reason LLVM choose # restrictions by the government. It is the reason LLVM choose
# different intrinsics than GCC and XLC. # different intrinsics than GCC and XLC.
@ -644,6 +644,20 @@ ifeq ($(DETECT_FEATURES),1)
AES_FLAG = $(POWER8_FLAG) AES_FLAG = $(POWER8_FLAG)
endif endif
TPROG = TestPrograms/test_ppc_vmull.cxx
TOPT = $(POWER9_FLAG)
HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(POWER9_FLAG)
endif
TPROG = TestPrograms/test_ppc_vmull.cxx
TOPT = $(POWER8_FLAG)
HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(POWER8_FLAG)
endif
TPROG = TestPrograms/test_ppc_sha.cxx TPROG = TestPrograms/test_ppc_sha.cxx
TOPT = $(POWER9_FLAG) TOPT = $(POWER9_FLAG)
HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
@ -669,7 +683,6 @@ ifeq ($(DETECT_FEATURES),1)
BLAKE2B_FLAG = $(POWER9_FLAG) BLAKE2B_FLAG = $(POWER9_FLAG)
BLAKE2S_FLAG = $(POWER9_FLAG) BLAKE2S_FLAG = $(POWER9_FLAG)
CHACHA_FLAG = $(POWER9_FLAG) CHACHA_FLAG = $(POWER9_FLAG)
GCM_FLAG = $(POWER9_FLAG)
SM4_FLAG = $(POWER9_FLAG) SM4_FLAG = $(POWER9_FLAG)
SIMON64_FLAG = $(POWER9_FLAG) SIMON64_FLAG = $(POWER9_FLAG)
SIMON128_FLAG = $(POWER9_FLAG) SIMON128_FLAG = $(POWER9_FLAG)
@ -687,7 +700,6 @@ ifeq ($(DETECT_FEATURES),1)
BLAKE2B_FLAG = $(POWER8_FLAG) BLAKE2B_FLAG = $(POWER8_FLAG)
BLAKE2S_FLAG = $(POWER8_FLAG) BLAKE2S_FLAG = $(POWER8_FLAG)
CHACHA_FLAG = $(POWER8_FLAG) CHACHA_FLAG = $(POWER8_FLAG)
GCM_FLAG = $(POWER8_FLAG)
SM4_FLAG = $(POWER8_FLAG) SM4_FLAG = $(POWER8_FLAG)
SIMON64_FLAG = $(POWER8_FLAG) SIMON64_FLAG = $(POWER8_FLAG)
SIMON128_FLAG = $(POWER8_FLAG) SIMON128_FLAG = $(POWER8_FLAG)
@ -787,13 +799,19 @@ ifeq ($(DETECT_FEATURES),1)
# Fixups for missing crypto # Fixups for missing crypto
ifneq ($(POWER9_FLAG)$(POWER8_FLAG),) ifneq ($(POWER9_FLAG)$(POWER8_FLAG),)
ifeq ($(AES_FLAG),) ifeq ($(AES_FLAG)$(GCM_FLAG)$(SHA_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_AES CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_CRYPTO
else
ifeq ($(AES_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_AES
endif
ifeq ($(GCM_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_VMULL
endif
ifeq ($(SHA_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_SHA
endif
endif endif
ifeq ($(SHA_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_SHA
endif
# CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8_VMULL
endif endif
# DETECT_FEATURES # DETECT_FEATURES

View File

@ -756,7 +756,7 @@ void GCM_Xor16_POWER7(byte *a, const byte *b, const byte *c)
{ {
VecStore(VecXor(VecLoad(b), VecLoad(c)), a); VecStore(VecXor(VecLoad(b), VecLoad(c)), a);
} }
#endif // CRYPTOPP_ALTIVEC_AVAILABLE #endif // CRYPTOPP_POWER7_AVAILABLE
#if CRYPTOPP_POWER8_VMULL_AVAILABLE #if CRYPTOPP_POWER8_VMULL_AVAILABLE