File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ crate_type = "lib" ]
2
+ #![ feature( core_intrinsics) ]
3
+
4
+ use std:: intrinsics:: * ;
5
+
6
+ // CHECK-LABEL: @unchecked_add_signed
7
+ #[ no_mangle]
8
+ pub unsafe fn unchecked_add_signed ( a : i32 , b : i32 ) -> i32 {
9
+ // CHECK: add nsw
10
+ unchecked_add ( a, b)
11
+ }
12
+
13
+ // CHECK-LABEL: @unchecked_add_unsigned
14
+ #[ no_mangle]
15
+ pub unsafe fn unchecked_add_unsigned ( a : u32 , b : u32 ) -> u32 {
16
+ // CHECK: add nuw
17
+ unchecked_add ( a, b)
18
+ }
19
+
20
+ // CHECK-LABEL: @unchecked_sub_signed
21
+ #[ no_mangle]
22
+ pub unsafe fn unchecked_sub_signed ( a : i32 , b : i32 ) -> i32 {
23
+ // CHECK: sub nsw
24
+ unchecked_sub ( a, b)
25
+ }
26
+
27
+ // CHECK-LABEL: @unchecked_sub_unsigned
28
+ #[ no_mangle]
29
+ pub unsafe fn unchecked_sub_unsigned ( a : u32 , b : u32 ) -> u32 {
30
+ // CHECK: sub nuw
31
+ unchecked_sub ( a, b)
32
+ }
33
+
34
+ // CHECK-LABEL: @unchecked_mul_signed
35
+ #[ no_mangle]
36
+ pub unsafe fn unchecked_mul_signed ( a : i32 , b : i32 ) -> i32 {
37
+ // CHECK: mul nsw
38
+ unchecked_mul ( a, b)
39
+ }
40
+
41
+ // CHECK-LABEL: @unchecked_mul_unsigned
42
+ #[ no_mangle]
43
+ pub unsafe fn unchecked_mul_unsigned ( a : u32 , b : u32 ) -> u32 {
44
+ // CHECK: mul nuw
45
+ unchecked_mul ( a, b)
46
+ }
You can’t perform that action at this time.
0 commit comments