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) {
|
||||||
|
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);
|
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