Skip to content

Commit 80661bf

Browse files
committed
added a few new unit tests
1 parent 21589cb commit 80661bf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test: cir.cast (integral to pointer)
2+
module {
3+
cir.func @test_int_to_ptr() -> !cir.ptr<!cir.int<s, 32>> {
4+
%0 = cir.const #cir.int<1024> : !cir.int<u, 64>
5+
%1 = cir.cast int_to_ptr %0 : !cir.int<u, 64> -> !cir.ptr<!cir.int<s, 32>>
6+
cir.return %1 : !cir.ptr<!cir.int<s, 32>>
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test: cir.cast (floating to integral)
2+
module {
3+
cir.func @test_float_to_int() -> !cir.int<s, 32> {
4+
%0 = cir.const #cir.fp<2.7> : !cir.float
5+
%1 = cir.cast float_to_int %0 : !cir.float -> !cir.int<s, 32>
6+
cir.return %1 : !cir.int<s, 32>
7+
}
8+
}

0 commit comments

Comments
 (0)