Skip to content

Commit

Permalink
test1
Browse files Browse the repository at this point in the history
  • Loading branch information
hanwenlei committed Mar 24, 2024
1 parent a434f43 commit 094517b
Show file tree
Hide file tree
Showing 279 changed files with 45,578 additions and 163 deletions.
90 changes: 67 additions & 23 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ wasmtime-wast = { path = "crates/wast", version = "=2.0.0" }
wasmtime-wasi = { path = "crates/wasi", version = "2.0.0" }
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "2.0.0", optional = true }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "2.0.0", optional = true }
# dlmalloc = { path = "crates/dlmalloc-rs", version = "0.2.4", features = ['global'] }
clap = { version = "3.2.0", features = ["color", "suggestions", "derive"] }
anyhow = "1.0.19"
target-lexicon = { version = "0.12.0", default-features = false }
libc = "0.2.60"
humantime = "2.0.0"
once_cell = "1.12"
listenfd = "1.0.0"
bitflags = "1.2"

[target.'cfg(unix)'.dependencies]
rustix = { version = "0.35.6", features = ["mm", "param"] }
Expand Down
15 changes: 14 additions & 1 deletion cranelift/codegen/meta/src/isa/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ fn define_settings(shared: &SettingGroup) -> SettingGroup {
false,
);

// Intel-defined CPU features, CPUID level 0x00000007:0 (ecx)
let has_pkru = settings.add_bool(
"has_pkru",
"Has support for PKU.",
"PKU: CPUID.00000007H:ECX=0H[bit 3&4]",
true,
);

let shared_enable_simd = shared.get_bool("enable_simd");

settings.add_predicate("use_ssse3", predicate!(has_ssse3));
Expand Down Expand Up @@ -163,6 +171,7 @@ fn define_settings(shared: &SettingGroup) -> SettingGroup {
settings.add_predicate("use_popcnt", predicate!(has_popcnt && has_sse42));
settings.add_predicate("use_bmi1", predicate!(has_bmi1));
settings.add_predicate("use_lzcnt", predicate!(has_lzcnt));
settings.add_predicate("use_pkru", predicate!(has_pkru));

// Some shared boolean values are used in x86 instruction predicates, so we need to group them
// in the same TargetIsa, for compatibility with code generated by meta-python.
Expand Down Expand Up @@ -195,7 +204,11 @@ fn define_settings(shared: &SettingGroup) -> SettingGroup {
"Broadwell microarchitecture.",
preset!(haswell && has_fma),
);
let skylake = settings.add_preset("skylake", "Skylake microarchitecture.", preset!(broadwell));
let skylake = settings.add_preset(
"skylake",
"Skylake microarchitecture.",
preset!(broadwell && has_pkru),
);
let cannonlake = settings.add_preset(
"cannonlake",
"Canon Lake microarchitecture.",
Expand Down
24 changes: 24 additions & 0 deletions cranelift/codegen/meta/src/shared/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,30 @@ pub(crate) fn define(
.operands_out(vec![a]),
);

ig.push(
Inst::new(
"rdmemkey",
r#"
Reading memory key value.
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![a]),
);

ig.push(
Inst::new(
"wrmemkey",
r#"
Writing memory key value.
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![a]),
);

let I16or32 = &TypeVar::new(
"I16or32",
"A scalar or vector integer type with 16- or 32-bit numbers",
Expand Down
5 changes: 5 additions & 0 deletions cranelift/codegen/src/ir/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ impl GlobalValue {
None
}
}

/// Get a value
pub fn get_number(&self) -> u32 {
self.0
}
}

/// An opaque reference to a constant.
Expand Down
4 changes: 4 additions & 0 deletions cranelift/codegen/src/isa/aarch64/lower_inst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ pub(crate) fn lower_insn_to_regs(
op
)));
}

Opcode::Rdmemkey | Opcode::Wrmemkey => {
panic!("Memory protection key not supported in arm arch!");
}
}

Ok(())
Expand Down
4 changes: 4 additions & 0 deletions cranelift/codegen/src/isa/s390x/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ impl LowerBackend for S390xBackend {
| Opcode::IfcmpImm => {
panic!("ALU+imm and ALU+carry ops should not appear here!");
}

Opcode::Rdmemkey | Opcode::Wrmemkey => {
panic!("Memory protection key not supported in s390x arch!");
}
}
}

Expand Down
Loading

0 comments on commit 094517b

Please sign in to comment.