mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add builtins for basic float operations (#3897)
Adds support for unary `-` and binary `+`, `-`, `*`, `/` for floating point types. Real literals are now transformed to `llvm::APFloat`s during the check phase into the `FloatLiteral` instruction. This PR likely collides a bit with #3892 and might need to be updated when that one is merged.
This commit is contained in:
@@ -103,7 +103,7 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
|
||||
// CHECK:STDOUT: %.4: bool = bool_literal true [template]
|
||||
// CHECK:STDOUT: %.5: type = ptr_type bool [template]
|
||||
// CHECK:STDOUT: %.6: f64 = real_literal 10e-1 [template]
|
||||
// CHECK:STDOUT: %.6: f64 = float_literal 1 [template]
|
||||
// CHECK:STDOUT: %.7: type = ptr_type f64 [template]
|
||||
// CHECK:STDOUT: %.8: type = ptr_type String [template]
|
||||
// CHECK:STDOUT: %.9: String = string_literal "Hello" [template]
|
||||
@@ -161,7 +161,7 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT: %.loc16_3: i32* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc21_4: bool = bool_literal true [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc21_3: bool* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc26_4: f64 = real_literal 10e-1 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc26_4: f64 = float_literal 1 [template = constants.%.6]
|
||||
// CHECK:STDOUT: %.loc26_3: f64* = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: %.loc31_4: String = string_literal "Hello" [template = constants.%.9]
|
||||
// CHECK:STDOUT: %.loc31_3: String* = addr_of <error> [template = <error>]
|
||||
|
||||
Reference in New Issue
Block a user