| ... | @@ -4482,21 +4482,7 @@ fn floatNeg(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { | ... | @@ -4482,21 +4482,7 @@ fn floatNeg(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { |
| 4482 | try cg.addTag(.f64_neg); | 4482 | try cg.addTag(.f64_neg); |
| 4483 | return .stack; | 4483 | return .stack; |
| 4484 | }, | 4484 | }, |
| 4485 | .f80 => { | 4485 | .f80, .f128 => { |
| 4486 | const result = try cg.allocStack(Type.f80); | | |
| 4487 | try cg.emitWValue(result); | | |
| 4488 | try cg.emitWValue(arg); | | |
| 4489 | try cg.addMemArg(.i64_load, .{ .offset = 0 + arg.offset(), .alignment = 2 }); | | |
| 4490 | try cg.addMemArg(.i64_store, .{ .offset = 0 + result.offset(), .alignment = 2 }); | | |
| 4491 | try cg.emitWValue(result); | | |
| 4492 | try cg.emitWValue(arg); | | |
| 4493 | try cg.addMemArg(.i64_load, .{ .offset = 8 + arg.offset(), .alignment = 2 }); | | |
| 4494 | try cg.addImm64(0x8000); | | |
| 4495 | try cg.addTag(.i64_xor); | | |
| 4496 | try cg.addMemArg(.i64_store, .{ .offset = 8 + result.offset(), .alignment = 2 }); | | |
| 4497 | return result; | | |
| 4498 | }, | | |
| 4499 | .f128 => { | | |
| 4500 | const result = try cg.allocStack(Type.f128); | 4486 | const result = try cg.allocStack(Type.f128); |
| 4501 | try cg.emitWValue(result); | 4487 | try cg.emitWValue(result); |
| 4502 | try cg.emitWValue(arg); | 4488 | try cg.emitWValue(arg); |
| ... | @@ -4505,7 +4491,11 @@ fn floatNeg(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { | ... | @@ -4505,7 +4491,11 @@ fn floatNeg(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { |
| 4505 | try cg.emitWValue(result); | 4491 | try cg.emitWValue(result); |
| 4506 | try cg.emitWValue(arg); | 4492 | try cg.emitWValue(arg); |
| 4507 | try cg.addMemArg(.i64_load, .{ .offset = 8 + arg.offset(), .alignment = 2 }); | 4493 | try cg.addMemArg(.i64_load, .{ .offset = 8 + arg.offset(), .alignment = 2 }); |
| 4508 | try cg.addImm64(0x8000000000000000); | 4494 | if (ty == .f80) { |
| | 4495 | try cg.addImm64(0x8000); |
| | 4496 | } else { |
| | 4497 | try cg.addImm64(0x8000000000000000); |
| | 4498 | } |
| 4509 | try cg.addTag(.i64_xor); | 4499 | try cg.addTag(.i64_xor); |
| 4510 | try cg.addMemArg(.i64_store, .{ .offset = 8 + result.offset(), .alignment = 2 }); | 4500 | try cg.addMemArg(.i64_store, .{ .offset = 8 + result.offset(), .alignment = 2 }); |
| 4511 | return result; | 4501 | return result; |
| ... | @@ -4515,7 +4505,12 @@ fn floatNeg(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { | ... | @@ -4515,7 +4505,12 @@ fn floatNeg(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { |
| 4515 | | 4505 | |
| 4516 | fn floatAbs(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { | 4506 | fn floatAbs(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { |
| 4517 | switch (ty) { | 4507 | switch (ty) { |
| 4518 | .f16 => return cg.callIntrinsic(.__fabsh, &.{.f16_type}, Type.f16, &.{arg}), | 4508 | .f16 => { |
| | 4509 | try cg.emitWValue(arg); |
| | 4510 | try cg.addImm32(0x7FFF); |
| | 4511 | try cg.addTag(.i32_and); |
| | 4512 | return .stack; |
| | 4513 | }, |
| 4519 | .f32 => { | 4514 | .f32 => { |
| 4520 | try cg.emitWValue(arg); | 4515 | try cg.emitWValue(arg); |
| 4521 | try cg.addTag(.f32_abs); | 4516 | try cg.addTag(.f32_abs); |
| ... | @@ -4526,8 +4521,24 @@ fn floatAbs(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { | ... | @@ -4526,8 +4521,24 @@ fn floatAbs(cg: *CodeGen, ty: FloatType, arg: WValue) InnerError!WValue { |
| 4526 | try cg.addTag(.f64_abs); | 4521 | try cg.addTag(.f64_abs); |
| 4527 | return .stack; | 4522 | return .stack; |
| 4528 | }, | 4523 | }, |
| 4529 | .f80 => return cg.callIntrinsic(.__fabsx, &.{.f80_type}, Type.f80, &.{arg}), | 4524 | .f80, .f128 => { |
| 4530 | .f128 => return cg.callIntrinsic(.fabsq, &.{.f128_type}, Type.f128, &.{arg}), | 4525 | const result = try cg.allocStack(Type.f128); |
| | 4526 | try cg.emitWValue(result); |
| | 4527 | try cg.emitWValue(arg); |
| | 4528 | try cg.addMemArg(.i64_load, .{ .offset = 0 + arg.offset(), .alignment = 2 }); |
| | 4529 | try cg.addMemArg(.i64_store, .{ .offset = 0 + result.offset(), .alignment = 2 }); |
| | 4530 | try cg.emitWValue(result); |
| | 4531 | try cg.emitWValue(arg); |
| | 4532 | try cg.addMemArg(.i64_load, .{ .offset = 8 + arg.offset(), .alignment = 2 }); |
| | 4533 | if (ty == .f80) { |
| | 4534 | try cg.addImm64(0x7FFF); |
| | 4535 | } else { |
| | 4536 | try cg.addImm64(0x7FFFFFFFFFFFFFFF); |
| | 4537 | } |
| | 4538 | try cg.addTag(.i64_and); |
| | 4539 | try cg.addMemArg(.i64_store, .{ .offset = 8 + result.offset(), .alignment = 2 }); |
| | 4540 | return result; |
| | 4541 | }, |
| 4531 | } | 4542 | } |
| 4532 | } | 4543 | } |
| 4533 | | 4544 | |