summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/building/custom/operators.rs
blob: db7a48317d9284896ee36f3148e08e4acaa5881f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// compile-flags: --crate-type=lib
#![feature(custom_mir, core_intrinsics, inline_const)]
use std::intrinsics::mir::*;

// EMIT_MIR operators.f.built.after.mir
#[custom_mir(dialect = "built")]
pub fn f(a: i32, b: bool) -> i32 {
    mir!({
        a = -a;
        b = !b;
        a = a + a;
        a = a - a;
        a = a * a;
        a = a / a;
        a = a % a;
        a = a ^ a;
        a = a & a;
        a = a << a;
        a = a >> a;
        b = a == a;
        b = a < a;
        b = a <= a;
        b = a >= a;
        b = a > a;
        let res = Checked(a + a);
        b = res.1;
        a = res.0;
        RET = a;
        Return()
    })
}