aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-09-09 13:25:46 +0200
committerThomas Schwinge <thomas@codesourcery.com>2021-09-09 14:17:57 +0200
commit4faa7d7765f5840779c542430ca6aa9118008a5b (patch)
treec208f6902c3cc4ef1f5b75908bdafa4817b8e7d5 /gcc
parente17824d3c307376ac79041836dc3eea6ffcb6046 (diff)
downloadgcc-4faa7d7765f5840779c542430ca6aa9118008a5b.zip
gcc-4faa7d7765f5840779c542430ca6aa9118008a5b.tar.gz
gcc-4faa7d7765f5840779c542430ca6aa9118008a5b.tar.bz2
Turn 'rust/execute/torture/sinf32.rs', 'rust/execute/torture/sqrtf32.rs' into 'rust/compile/torture/intrinsics-1.rs'
Avoid proliferation of such execution tests: such builtins typically are mapped to regular function calls (which we already do have confidence that they work correctly), so it ought to suffice to just scan '-fdump-tree-original'.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/rust/compile/torture/intrinsics-1.rs16
-rw-r--r--gcc/testsuite/rust/execute/torture/sinf32.rs22
-rw-r--r--gcc/testsuite/rust/execute/torture/sqrtf32.rs22
3 files changed, 16 insertions, 44 deletions
diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-1.rs b/gcc/testsuite/rust/compile/torture/intrinsics-1.rs
new file mode 100644
index 0000000..3c604df
--- /dev/null
+++ b/gcc/testsuite/rust/compile/torture/intrinsics-1.rs
@@ -0,0 +1,16 @@
+// { dg-additional-options -fdump-tree-original }
+
+extern "rust-intrinsic" {
+ pub fn sqrtf32(x: f32) -> f32;
+ pub fn sinf32(x: f32) -> f32;
+}
+
+fn main() {
+ let mut f32;
+
+ f32 = sqrtf32(5f32);
+ // { dg-final { scan-tree-dump-times {(?n)f32 = __builtin_sqrtf \(5\.0e\+0\);$} 1 original } }
+
+ f32 = sinf32(39f32);
+ // { dg-final { scan-tree-dump-times {(?n)f32 = __builtin_sinf \(3\.9e\+1\);$} 1 original } }
+}
diff --git a/gcc/testsuite/rust/execute/torture/sinf32.rs b/gcc/testsuite/rust/execute/torture/sinf32.rs
deleted file mode 100644
index fa825ae..0000000
--- a/gcc/testsuite/rust/execute/torture/sinf32.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-output "0.893" }*/
-extern "rust-intrinsic" {
- pub fn sinf32(x: f32) -> f32;
-}
-
-extern "C" {
- fn printf(s: *const i8, ...);
-}
-
-fn main() -> i32 {
- unsafe {
- let res;
- res = sinf32(90f32);
-
- let a = "%f\n\0";
- let b = a as *const str;
- let c = b as *const i8;
-
- printf(c, res as f64);
- }
- 0
-}
diff --git a/gcc/testsuite/rust/execute/torture/sqrtf32.rs b/gcc/testsuite/rust/execute/torture/sqrtf32.rs
deleted file mode 100644
index 3a53a7c..0000000
--- a/gcc/testsuite/rust/execute/torture/sqrtf32.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-/* { dg-output "6" }*/
-extern "rust-intrinsic" {
- pub fn sqrtf32(x: f32) -> f32;
-}
-
-extern "C" {
- fn printf(s: *const i8, ...);
-}
-
-fn main() -> i32 {
- unsafe {
- let res;
- res = sqrtf32(36f32);
-
- let a = "%f\n\0";
- let b = a as *const str;
- let c = b as *const i8;
-
- printf(c, res as f64);
- }
- 0
-}