Use separate builtins for signed / unsigned arithmetic. (#3892)

Per offline discussion with chandlerc and jonmeow, use different
builtins for signed versus unsigned integer ops instead of looking at
the type. In this commit, the arithmetic builtins (add, sub, negate,
mul, div, mod) are split. I'll apply the same change to comparisons and
to right shift in separate PRs.
This commit is contained in:
Richard Smith
2024-04-19 01:42:35 +00:00
committed by GitHub
parent 594f6d781e
commit 5964795f34
39 changed files with 1757 additions and 207 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
// --- int_greater_eq.carbon
fn GreaterEq(a: i32, b: i32) -> bool = "int.greater_eq";
fn Negate(a: i32) -> i32 = "int.negate";
fn Negate(a: i32) -> i32 = "int.snegate";
class True {}
class False {}
@@ -94,7 +94,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @GreaterEq(%a: i32, %b: i32) -> bool = "int.greater_eq";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.negate";
// CHECK:STDOUT: fn @Negate(%a: i32) -> i32 = "int.snegate";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%true_: True, %false_: False) {
// CHECK:STDOUT: !entry: