Skip to content

Commit 2109b70

Browse files
committed
Enable crypto and crc feature for intrinsic testing
1 parent 0acc0d3 commit 2109b70

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

crates/intrinsic-test/src/main.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ pub enum Language {
2323
C,
2424
}
2525

26-
fn generate_c_program(header_file: &str, intrinsic: &Intrinsic) -> String {
26+
fn generate_c_program(header_files: &[&str], intrinsic: &Intrinsic) -> String {
2727
format!(
28-
r#"#include <{header_file}>
28+
r#"{header_files}
2929
#include <iostream>
3030
#include <cstring>
3131
#include <iomanip>
@@ -52,7 +52,11 @@ int main(int argc, char **argv) {{
5252
{passes}
5353
return 0;
5454
}}"#,
55-
header_file = header_file,
55+
header_files = header_files
56+
.iter()
57+
.map(|header| format!("#include <{}>", header))
58+
.collect::<Vec<_>>()
59+
.join("\n"),
5660
passes = (1..20)
5761
.map(|idx| intrinsic.generate_pass_c(idx))
5862
.collect::<Vec<_>>()
@@ -85,8 +89,9 @@ fn compile_c(c_filename: &str, intrinsic: &Intrinsic, compiler: &str) -> bool {
8589
let output = Command::new("sh")
8690
.arg("-c")
8791
.arg(format!(
88-
"{cpp} {cppflags} -Wno-narrowing -O2 -target {target} -o c_programs/{intrinsic} {filename}",
92+
"{cpp} {cppflags} {arch_flags} -Wno-narrowing -O2 -target {target} -o c_programs/{intrinsic} {filename}",
8993
target = "aarch64-unknown-linux-gnu",
94+
arch_flags = "-march=armv8-a+crypto+crc",
9095
filename = c_filename,
9196
intrinsic = intrinsic.name,
9297
cpp = compiler,
@@ -125,7 +130,7 @@ fn build_c(intrinsics: &Vec<Intrinsic>, compiler: &str) -> bool {
125130
let c_filename = format!(r#"c_programs/{}.cpp"#, i.name);
126131
let mut file = File::create(&c_filename).unwrap();
127132

128-
let c_code = generate_c_program("arm_neon.h", &i);
133+
let c_code = generate_c_program(&["arm_neon.h", "arm_acle.h"], &i);
129134
file.write_all(c_code.into_bytes().as_slice()).unwrap();
130135
compile_c(&c_filename, &i, compiler)
131136
})

0 commit comments

Comments
 (0)