Make SSE inclusion conditional for target features (#526)

master
Marcel Bargull 3 years ago committed by GitHub
parent db377fd1e3
commit 81a9edea83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 12
      librocksdb-sys/build.rs

@ -2,6 +2,9 @@
## [Unreleased] ## [Unreleased]
* Bump `librocksdb-sys` up to 6.19.3 (olegnn)
* Make SSE inclusion conditional for target features.
RocksDB is not compiled with SSE4 instructions anymore unless the corresponding features are enabled in rustc (mbargull)
* Bump `librocksdb-sys` up to 6.20.3 (olegnn, akrylysov) * Bump `librocksdb-sys` up to 6.20.3 (olegnn, akrylysov)
* Add `DB::key_may_exist_cf_opt` method (stanislav-tkach) * Add `DB::key_may_exist_cf_opt` method (stanislav-tkach)
* Add `Options::set_zstd_max_train_bytes` method (stanislav-tkach) * Add `Options::set_zstd_max_train_bytes` method (stanislav-tkach)

@ -103,16 +103,26 @@ fn build_rocksdb() {
// This is needed to enable hardware CRC32C. Technically, SSE 4.2 is // This is needed to enable hardware CRC32C. Technically, SSE 4.2 is
// only available since Intel Nehalem (about 2010) and AMD Bulldozer // only available since Intel Nehalem (about 2010) and AMD Bulldozer
// (about 2011). // (about 2011).
config.define("HAVE_SSE42", Some("1")); let target_feature = env::var("CARGO_CFG_TARGET_FEATURE").unwrap();
let target_features: Vec<_> = target_feature.split(",").collect();
if target_features.contains(&"sse2") {
config.flag_if_supported("-msse2"); config.flag_if_supported("-msse2");
}
if target_features.contains(&"sse4.1") {
config.flag_if_supported("-msse4.1"); config.flag_if_supported("-msse4.1");
}
if target_features.contains(&"sse4.2") {
config.flag_if_supported("-msse4.2"); config.flag_if_supported("-msse4.2");
config.define("HAVE_SSE42", Some("1"));
}
if !target.contains("android") { if !target.contains("android") {
if target_features.contains(&"pclmulqdq") {
config.define("HAVE_PCLMUL", Some("1")); config.define("HAVE_PCLMUL", Some("1"));
config.flag_if_supported("-mpclmul"); config.flag_if_supported("-mpclmul");
} }
} }
}
if target.contains("aarch64") { if target.contains("aarch64") {
lib_sources.push("util/crc32c_arm64.cc") lib_sources.push("util/crc32c_arm64.cc")

Loading…
Cancel
Save