summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/building/shifts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/building/shifts.rs')
-rw-r--r--tests/mir-opt/building/shifts.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs
new file mode 100644
index 000000000..4b63a00a3
--- /dev/null
+++ b/tests/mir-opt/building/shifts.rs
@@ -0,0 +1,20 @@
+// compile-flags: -C debug-assertions=yes
+
+// EMIT_MIR shifts.shift_signed.built.after.mir
+fn shift_signed(small: i8, big: u128, a: i8, b: i32, c: i128) -> ([i8; 3], [u128; 3]) {
+ (
+ [small >> a, small >> b, small >> c],
+ [big << a, big << b, big << c],
+ )
+}
+
+// EMIT_MIR shifts.shift_unsigned.built.after.mir
+fn shift_unsigned(small: u8, big: i128, a: u8, b: u32, c: u128) -> ([u8; 3], [i128; 3]) {
+ (
+ [small >> a, small >> b, small >> c],
+ [big << a, big << b, big << c],
+ )
+}
+
+fn main() {
+}