mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-15 23:52:54 +00:00
glasm: Fix INeg32 on negative immediates
This commit is contained in:
parent
75fd0079db
commit
70c9281fbf
|
@ -67,8 +67,12 @@ 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) {
|
||||||
ctx.LongAdd("MOV.S64 {},-{};", inst, value);
|
ctx.LongAdd("MOV.S64 {},-{};", inst, value);
|
||||||
|
|
Loading…
Reference in a new issue