about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2018-08-12 15:27:03 +0300
committerSimonas Kazlauskas <git@kazlauskas.me>2018-08-12 18:38:46 +0300
commitdc02a6070f899b87249efa8c09bb2b90dbe94b0d (patch)
tree6d4da57979dc2ec303f73dc03c5700916b1e4792 /src/test/codegen
parent0aa8d0320266b5579428312095fe49af05ada972 (diff)
downloadrust-dc02a6070f899b87249efa8c09bb2b90dbe94b0d.tar.gz
rust-dc02a6070f899b87249efa8c09bb2b90dbe94b0d.zip
Do not generate assumes for plain integer casts
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/no-assumes-on-casts.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/codegen/no-assumes-on-casts.rs b/src/test/codegen/no-assumes-on-casts.rs
new file mode 100644
index 00000000000..a5a7d94a553
--- /dev/null
+++ b/src/test/codegen/no-assumes-on-casts.rs
@@ -0,0 +1,29 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "lib"]
+
+// compile-flags: -Cno-prepopulate-passes
+
+// CHECK-LABEL: fna
+#[no_mangle]
+pub fn fna(a: i16) -> i32 {
+    a as i32
+// CHECK-NOT: assume
+// CHECK: sext
+}
+
+// CHECK-LABEL: fnb
+#[no_mangle]
+pub fn fnb(a: u16) -> u32 {
+    a as u32
+// CHECK-NOT: assume
+// CHECK: zext
+}