File tree Expand file tree Collapse file tree 16 files changed +425
-0
lines changed
gcc/testsuite/rust/execute/torture Expand file tree Collapse file tree 16 files changed +425
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ if ctlz ( 0i16 ) != 16 {
16+ abort ( ) ;
17+ }
18+ // 1i16 = 0x0001: 15 leading zeros
19+ if ctlz ( 1i16 ) != 15 {
20+ abort ( ) ;
21+ }
22+ // -1i16 = 0xFFFF: 0 leading zeros
23+ if ctlz ( -1i16 ) != 0 {
24+ abort ( ) ;
25+ }
26+
27+ 0
28+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ if ctlz ( 0i32 ) != 32 {
16+ abort ( ) ;
17+ }
18+ // 1i32 = 0x00000001: 31 leading zeros
19+ if ctlz ( 1i32 ) != 31 {
20+ abort ( ) ;
21+ }
22+ // -1i32 = 0xFFFFFFFF: 0 leading zeros
23+ if ctlz ( -1i32 ) != 0 {
24+ abort ( ) ;
25+ }
26+
27+ 0
28+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ if ctlz ( 0i64 ) != 64 {
16+ abort ( ) ;
17+ }
18+ // 1i64 = 0x0000000000000001: 63 leading zeros
19+ if ctlz ( 1i64 ) != 63 {
20+ abort ( ) ;
21+ }
22+ // -1i64 = 0xFFFFFFFFFFFFFFFF: 0 leading zeros
23+ if ctlz ( -1i64 ) != 0 {
24+ abort ( ) ;
25+ }
26+
27+ 0
28+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ // 0i8 has all 8 bits zero
16+ if ctlz ( 0i8 ) != 8 {
17+ abort ( ) ;
18+ }
19+ // 1i8 = 0x01: 7 leading zeros
20+ if ctlz ( 1i8 ) != 7 {
21+ abort ( ) ;
22+ }
23+ // -1i8 = 0xFF in two's complement: all bits set, 0 leading zeros
24+ if ctlz ( -1i8 ) != 0 {
25+ abort ( ) ;
26+ }
27+
28+ 0
29+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz_nonzero < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ unsafe {
16+ // 1i16 = 0x0001: 15 leading zeros
17+ if ctlz_nonzero ( 1i16 ) != 15 {
18+ abort ( ) ;
19+ }
20+ // -1i16 = 0xFFFF: 0 leading zeros
21+ if ctlz_nonzero ( -1i16 ) != 0 {
22+ abort ( ) ;
23+ }
24+ }
25+
26+ 0
27+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz_nonzero < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ unsafe {
16+ // 1i32 = 0x00000001: 31 leading zeros
17+ if ctlz_nonzero ( 1i32 ) != 31 {
18+ abort ( ) ;
19+ }
20+ // -1i32 = 0xFFFFFFFF: 0 leading zeros
21+ if ctlz_nonzero ( -1i32 ) != 0 {
22+ abort ( ) ;
23+ }
24+ }
25+
26+ 0
27+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz_nonzero < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ unsafe {
16+ // 1i64 = 0x0000000000000001: 63 leading zeros
17+ if ctlz_nonzero ( 1i64 ) != 63 {
18+ abort ( ) ;
19+ }
20+ // -1i64 = 0xFFFFFFFFFFFFFFFF: 0 leading zeros
21+ if ctlz_nonzero ( -1i64 ) != 0 {
22+ abort ( ) ;
23+ }
24+ }
25+
26+ 0
27+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz_nonzero < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ unsafe {
16+ // 1i8 = 0x01: 7 leading zeros
17+ if ctlz_nonzero ( 1i8 ) != 7 {
18+ abort ( ) ;
19+ }
20+ // -1i8 = 0xFF: 0 leading zeros
21+ if ctlz_nonzero ( -1i8 ) != 0 {
22+ abort ( ) ;
23+ }
24+ }
25+
26+ 0
27+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz_nonzero < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ unsafe {
16+ if ctlz_nonzero ( 1u16 ) != 15 {
17+ abort ( ) ;
18+ }
19+ if ctlz_nonzero ( 0xFFFFu16 ) != 0 {
20+ abort ( ) ;
21+ }
22+ }
23+
24+ 0
25+ }
Original file line number Diff line number Diff line change 1+ #![ feature( no_core) ]
2+ #![ no_core]
3+ #![ feature( intrinsics) ]
4+ #![ feature( lang_items) ]
5+
6+ #[ lang = "sized" ]
7+ pub trait Sized { }
8+
9+ extern "rust-intrinsic" {
10+ pub fn ctlz_nonzero < T > ( x : T ) -> u32 ;
11+ pub fn abort ( ) -> !;
12+ }
13+
14+ fn main ( ) -> i32 {
15+ unsafe {
16+ if ctlz_nonzero ( 1u32 ) != 31 {
17+ abort ( ) ;
18+ }
19+ if ctlz_nonzero ( 0xFFFFFFFFu32 ) != 0 {
20+ abort ( ) ;
21+ }
22+ }
23+
24+ 0
25+ }
You can’t perform that action at this time.
0 commit comments