-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#![crate_type = "lib"] | ||
#![feature(core_intrinsics)] | ||
|
||
use std::intrinsics::*; | ||
|
||
// CHECK-LABEL: @unchecked_add_signed | ||
#[no_mangle] | ||
pub unsafe fn unchecked_add_signed(a: i32, b: i32) -> i32 { | ||
// CHECK: add nsw | ||
unchecked_add(a, b) | ||
} | ||
|
||
// CHECK-LABEL: @unchecked_add_unsigned | ||
#[no_mangle] | ||
pub unsafe fn unchecked_add_unsigned(a: u32, b: u32) -> u32 { | ||
// CHECK: add nuw | ||
unchecked_add(a, b) | ||
} | ||
|
||
// CHECK-LABEL: @unchecked_sub_signed | ||
#[no_mangle] | ||
pub unsafe fn unchecked_sub_signed(a: i32, b: i32) -> i32 { | ||
// CHECK: sub nsw | ||
unchecked_sub(a, b) | ||
} | ||
|
||
// CHECK-LABEL: @unchecked_sub_unsigned | ||
#[no_mangle] | ||
pub unsafe fn unchecked_sub_unsigned(a: u32, b: u32) -> u32 { | ||
// CHECK: sub nuw | ||
unchecked_sub(a, b) | ||
} | ||
|
||
// CHECK-LABEL: @unchecked_mul_signed | ||
#[no_mangle] | ||
pub unsafe fn unchecked_mul_signed(a: i32, b: i32) -> i32 { | ||
// CHECK: mul nsw | ||
unchecked_mul(a, b) | ||
} | ||
|
||
// CHECK-LABEL: @unchecked_mul_unsigned | ||
#[no_mangle] | ||
pub unsafe fn unchecked_mul_unsigned(a: u32, b: u32) -> u32 { | ||
// CHECK: mul nuw | ||
unchecked_mul(a, b) | ||
} |