blob: 85c2bbfd040bdb7b7d8993a93c509cb58506af5b (
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
32
33
34
35
36
37
38
39
|
// This test checks that comparison operation
// generated by #[derive(PartialOrd)]
// doesn't contain jumps for C enums
// compile-flags: -Copt-level=3
#![crate_type="lib"]
#[repr(u32)]
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd)]
pub enum Foo {
Zero,
One,
Two,
}
#[no_mangle]
pub fn compare_less(a: Foo, b: Foo)->bool{
// CHECK-NOT: br {{.*}}
a < b
}
#[no_mangle]
pub fn compare_le(a: Foo, b: Foo)->bool{
// CHECK-NOT: br {{.*}}
a <= b
}
#[no_mangle]
pub fn compare_ge(a: Foo, b: Foo)->bool{
// CHECK-NOT: br {{.*}}
a >= b
}
#[no_mangle]
pub fn compare_greater(a: Foo, b: Foo)->bool{
// CHECK-NOT: br {{.*}}
a > b
}
|