Skip to content

Commit

Permalink
Merge #2224
Browse files Browse the repository at this point in the history
2224: Cranelift: enable SIMD based on actual Wasm features r=syrusakbary a=jubianchi

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: jubianchi <[email protected]>
Co-authored-by: Syrus Akbary <[email protected]>
Co-authored-by: Mark McCaskey <[email protected]>
  • Loading branch information
4 people authored May 15, 2021
2 parents 43dd1fa + cc05cf1 commit 470f691
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 157 deletions.
30 changes: 9 additions & 21 deletions lib/compiler-cranelift/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub enum CraneliftOptLevel {
pub struct Cranelift {
enable_nan_canonicalization: bool,
enable_verifier: bool,
enable_simd: bool,
enable_pic: bool,
opt_level: CraneliftOptLevel,
/// The middleware chain.
Expand All @@ -48,7 +47,6 @@ impl Cranelift {
enable_verifier: false,
opt_level: CraneliftOptLevel::Speed,
enable_pic: false,
enable_simd: true,
middlewares: vec![],
}
}
Expand All @@ -62,12 +60,6 @@ impl Cranelift {
self
}

/// Enable SIMD support.
pub fn enable_simd(&mut self, enable: bool) -> &mut Self {
self.enable_simd = enable;
self
}

/// The optimization levels when optimizing the IR.
pub fn opt_level(&mut self, opt_level: CraneliftOptLevel) -> &mut Self {
self.opt_level = opt_level;
Expand Down Expand Up @@ -156,23 +148,19 @@ impl Cranelift {
.set("enable_safepoints", "true")
.expect("should be valid flag");

let opt_level = if self.enable_simd {
"none"
} else {
match self.opt_level {
CraneliftOptLevel::None => "none",
CraneliftOptLevel::Speed => "speed",
CraneliftOptLevel::SpeedAndSize => "speed_and_size",
}
};

flags
.set("opt_level", opt_level)
.set(
"opt_level",
match self.opt_level {
CraneliftOptLevel::None => "none",
CraneliftOptLevel::Speed => "speed",
CraneliftOptLevel::SpeedAndSize => "speed_and_size",
},
)
.expect("should be valid flag");

let enable_simd = if self.enable_simd { "true" } else { "false" };
flags
.set("enable_simd", enable_simd)
.set("enable_simd", "true")
.expect("should be valid flag");

let enable_nan_canonicalization = if self.enable_nan_canonicalization {
Expand Down
28 changes: 14 additions & 14 deletions lib/deprecated/runtime-core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 470f691

Please sign in to comment.