about summary refs log tree commit diff
path: root/src/test/codegen/tune-cpu-on-functions.rs
diff options
context:
space:
mode:
authorMingye Wang <arthur200126@gmail.com>2020-09-17 17:39:26 +0800
committerMingye Wang <arthur2e5@aosc.io>2020-10-05 07:50:44 +0800
commita35a93f09cc111a53d00efc567ad678583dd5ac7 (patch)
tree943360a4a63ea2f050f5e53e691afb5c8a11d2bc /src/test/codegen/tune-cpu-on-functions.rs
parent285fc7d704fcdd7b2a37d475d04d5d955490e000 (diff)
downloadrust-a35a93f09cc111a53d00efc567ad678583dd5ac7.tar.gz
rust-a35a93f09cc111a53d00efc567ad678583dd5ac7.zip
Pass tune-cpu to LLVM
I think this is how it should work...
Diffstat (limited to 'src/test/codegen/tune-cpu-on-functions.rs')
-rw-r--r--src/test/codegen/tune-cpu-on-functions.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/codegen/tune-cpu-on-functions.rs b/src/test/codegen/tune-cpu-on-functions.rs
new file mode 100644
index 00000000000..9121799cdbf
--- /dev/null
+++ b/src/test/codegen/tune-cpu-on-functions.rs
@@ -0,0 +1,21 @@
+// This test makes sure that functions get annotated with the proper
+// "tune-cpu" attribute in LLVM.
+
+// no-prefer-dynamic
+// ignore-tidy-linelength
+// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals -Z tune-cpu=generic
+
+#![crate_type = "staticlib"]
+
+// CHECK-LABEL: define {{.*}} @exported() {{.*}} #0
+#[no_mangle]
+pub extern fn exported() {
+    not_exported();
+}
+
+// CHECK-LABEL: ; tune_cpu_on_functions::not_exported
+// CHECK-NEXT: ; Function Attrs:
+// CHECK-NEXT: define {{.*}}() {{.*}} #0
+fn not_exported() {}
+
+// CHECK: attributes #0 = {{.*}} "tune-cpu"="{{.*}}"