about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-04 00:03:44 +0000
committerbors <bors@rust-lang.org>2017-09-04 00:03:44 +0000
commita3beb8fe61cb73c2eb3a2d47c87d3945a6f52865 (patch)
tree49fbc1655e322b09a77a49da3f17661a101c6724 /src/test/codegen
parent0006d3e01c5c4e4a90c59e85e2564f2440f1e8b1 (diff)
parent94a9a300d059a534d6070dab4759abb67ab7c1dd (diff)
downloadrust-a3beb8fe61cb73c2eb3a2d47c87d3945a6f52865.tar.gz
rust-a3beb8fe61cb73c2eb3a2d47c87d3945a6f52865.zip
Auto merge of #44272 - Dushistov:master, r=alexcrichton
add test for not optimized `pow` with constant power

Closes #34947
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/issue-34947-pow-i32.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/codegen/issue-34947-pow-i32.rs b/src/test/codegen/issue-34947-pow-i32.rs
new file mode 100644
index 00000000000..0564cd2e501
--- /dev/null
+++ b/src/test/codegen/issue-34947-pow-i32.rs
@@ -0,0 +1,23 @@
+// Copyright 2017 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.
+
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @issue_34947
+#[no_mangle]
+pub fn issue_34947(x: i32) -> i32 {
+    // CHECK: mul
+    // CHECK-NEXT: mul
+    // CHECK-NEXT: mul
+    // CHECK-NEXT: ret
+    x.pow(5)
+}