mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 18:32:49 -06:00
glasm: Fix INeg32 on negative immediates
This commit is contained in:
parent
75fd0079db
commit
70c9281fbf
1 changed files with 5 additions and 1 deletions
|
@ -67,7 +67,11 @@ void EmitIMul32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitINeg32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value) {
|
void EmitINeg32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value) {
|
||||||
ctx.Add("MOV.S {},-{};", inst, value);
|
if (value.type != Type::Register && static_cast<s32>(value.imm_u32) < 0) {
|
||||||
|
ctx.Add("MOV.S {},{};", inst, -static_cast<s32>(value.imm_u32));
|
||||||
|
} else {
|
||||||
|
ctx.Add("MOV.S {},-{};", inst, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitINeg64(EmitContext& ctx, IR::Inst& inst, Register value) {
|
void EmitINeg64(EmitContext& ctx, IR::Inst& inst, Register value) {
|
||||||
|
|
Loading…
Reference in a new issue