-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from Wodann/feature/all-operators
feat: add assignment, bit, and boolean operators
- Loading branch information
Showing
127 changed files
with
6,270 additions
and
431 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
53 changes: 53 additions & 0 deletions
53
crates/mun_codegen/src/snapshots/test__arithmetic_op_f32.snap
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,53 @@ | ||
--- | ||
source: crates/mun_codegen/src/test.rs | ||
expression: "pub fn add(a: f32, b: f32) -> f32 { a + b }\npub fn subtract(a: f32, b: f32) -> f32 { a - b }\npub fn multiply(a: f32, b: f32) -> f32 { a * b }\npub fn divide(a: f32, b: f32) -> f32 { a / b }\npub fn remainder(a: f32, b: f32) -> f32 { a % b }" | ||
--- | ||
; == FILE IR ===================================== | ||
; ModuleID = 'main.mun' | ||
source_filename = "main.mun" | ||
|
||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@global_type_table = external global [1 x %struct.MunTypeInfo addrspace(4)*] | ||
|
||
define float @add(float, float) { | ||
body: | ||
%add = fadd float %0, %1 | ||
ret float %add | ||
} | ||
|
||
define float @subtract(float, float) { | ||
body: | ||
%sub = fsub float %0, %1 | ||
ret float %sub | ||
} | ||
|
||
define float @multiply(float, float) { | ||
body: | ||
%mul = fmul float %0, %1 | ||
ret float %mul | ||
} | ||
|
||
define float @divide(float, float) { | ||
body: | ||
%div = fdiv float %0, %1 | ||
ret float %div | ||
} | ||
|
||
define float @remainder(float, float) { | ||
body: | ||
%rem = frem float %0, %1 | ||
ret float %rem | ||
} | ||
|
||
|
||
; == GROUP IR ==================================== | ||
; ModuleID = 'group_name' | ||
source_filename = "group_name" | ||
|
||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@"type_info::<core::f32>::name" = private unnamed_addr constant [10 x i8] c"core::f32\00" | ||
@"type_info::<core::f32>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"P\19b7\A8k\F2\81P\FB\83\F5P\B0\82!", [10 x i8]* @"type_info::<core::f32>::name", i32 32, i8 4, i8 0 } | ||
@global_type_table = global [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::f32>"] | ||
|
53 changes: 53 additions & 0 deletions
53
crates/mun_codegen/src/snapshots/test__arithmetic_op_f64.snap
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,53 @@ | ||
--- | ||
source: crates/mun_codegen/src/test.rs | ||
expression: "pub fn add(a: f64, b: f64) -> f64 { a + b }\npub fn subtract(a: f64, b: f64) -> f64 { a - b }\npub fn multiply(a: f64, b: f64) -> f64 { a * b }\npub fn divide(a: f64, b: f64) -> f64 { a / b }\npub fn remainder(a: f64, b: f64) -> f64 { a % b }" | ||
--- | ||
; == FILE IR ===================================== | ||
; ModuleID = 'main.mun' | ||
source_filename = "main.mun" | ||
|
||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@global_type_table = external global [1 x %struct.MunTypeInfo addrspace(4)*] | ||
|
||
define double @add(double, double) { | ||
body: | ||
%add = fadd double %0, %1 | ||
ret double %add | ||
} | ||
|
||
define double @subtract(double, double) { | ||
body: | ||
%sub = fsub double %0, %1 | ||
ret double %sub | ||
} | ||
|
||
define double @multiply(double, double) { | ||
body: | ||
%mul = fmul double %0, %1 | ||
ret double %mul | ||
} | ||
|
||
define double @divide(double, double) { | ||
body: | ||
%div = fdiv double %0, %1 | ||
ret double %div | ||
} | ||
|
||
define double @remainder(double, double) { | ||
body: | ||
%rem = frem double %0, %1 | ||
ret double %rem | ||
} | ||
|
||
|
||
; == GROUP IR ==================================== | ||
; ModuleID = 'group_name' | ||
source_filename = "group_name" | ||
|
||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@"type_info::<core::f64>::name" = private unnamed_addr constant [10 x i8] c"core::f64\00" | ||
@"type_info::<core::f64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"`\DBF\9C?YJ%G\AD4\9F\D5\92%A", [10 x i8]* @"type_info::<core::f64>::name", i32 64, i8 8, i8 0 } | ||
@global_type_table = global [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::f64>"] | ||
|
53 changes: 53 additions & 0 deletions
53
crates/mun_codegen/src/snapshots/test__arithmetic_op_float.snap
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,53 @@ | ||
--- | ||
source: crates/mun_codegen/src/test.rs | ||
expression: "pub fn add(a: float, b: float) -> float { a + b }\npub fn subtract(a: float, b: float) -> float { a - b }\npub fn multiply(a: float, b: float) -> float { a * b }\npub fn divide(a: float, b: float) -> float { a / b }\npub fn remainder(a: float, b: float) -> float { a % b }" | ||
--- | ||
; == FILE IR ===================================== | ||
; ModuleID = 'main.mun' | ||
source_filename = "main.mun" | ||
|
||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@global_type_table = external global [1 x %struct.MunTypeInfo addrspace(4)*] | ||
|
||
define double @add(double, double) { | ||
body: | ||
%add = fadd double %0, %1 | ||
ret double %add | ||
} | ||
|
||
define double @subtract(double, double) { | ||
body: | ||
%sub = fsub double %0, %1 | ||
ret double %sub | ||
} | ||
|
||
define double @multiply(double, double) { | ||
body: | ||
%mul = fmul double %0, %1 | ||
ret double %mul | ||
} | ||
|
||
define double @divide(double, double) { | ||
body: | ||
%div = fdiv double %0, %1 | ||
ret double %div | ||
} | ||
|
||
define double @remainder(double, double) { | ||
body: | ||
%rem = frem double %0, %1 | ||
ret double %rem | ||
} | ||
|
||
|
||
; == GROUP IR ==================================== | ||
; ModuleID = 'group_name' | ||
source_filename = "group_name" | ||
|
||
%struct.MunTypeInfo = type { [16 x i8], i8 addrspace(4)*, i32, i8, i8 } | ||
|
||
@"type_info::<core::f64>::name" = private unnamed_addr constant [10 x i8] c"core::f64\00" | ||
@"type_info::<core::f64>" = private unnamed_addr constant %struct.MunTypeInfo { [16 x i8] c"`\DBF\9C?YJ%G\AD4\9F\D5\92%A", [10 x i8]* @"type_info::<core::f64>::name", i32 64, i8 8, i8 0 } | ||
@global_type_table = global [1 x %struct.MunTypeInfo addrspace(4)*] [%struct.MunTypeInfo addrspace(4)* @"type_info::<core::f64>"] | ||
|
Oops, something went wrong.