about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorEvgeniy A. Dushistov <dushistov@mail.ru>2017-09-02 19:10:00 +0300
committerEvgeniy A. Dushistov <dushistov@mail.ru>2017-09-02 19:10:00 +0300
commit94a9a300d059a534d6070dab4759abb67ab7c1dd (patch)
tree8b5258403ce1a12e3707726673d9e88a39a9d2b0 /src/test/codegen
parentcc1fc8894ba5f7403a73fcf97f47a847d3be6bf9 (diff)
downloadrust-94a9a300d059a534d6070dab4759abb67ab7c1dd.tar.gz
rust-94a9a300d059a534d6070dab4759abb67ab7c1dd.zip
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)
+}