Skip to content

Commit 85ba3ae

Browse files
committed
{arm,i386,riscv64}-asm.c: fix generic operand modifier 'n' not negating
1 parent d9d02c5 commit 85ba3ae

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

arm-asm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,7 @@ ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier)
26312631
val = sv->c.i;
26322632
if (modifier == 'n')
26332633
val = -val;
2634-
cstr_printf(add_str, "%d", (int) sv->c.i);
2634+
cstr_printf(add_str, "%d", val);
26352635
no_offset:;
26362636
} else if ((r & VT_VALMASK) == VT_LOCAL) {
26372637
cstr_printf(add_str, "[fp,#%d]", (int) sv->c.i);

i386-asm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ ST_FUNC void subst_asm_operand(CString *add_str,
15361536
val = sv->c.i;
15371537
if (modifier == 'n')
15381538
val = -val;
1539-
cstr_printf(add_str, "%d", (int)sv->c.i);
1539+
cstr_printf(add_str, "%d", val);
15401540
no_offset:;
15411541
#ifdef TCC_TARGET_X86_64
15421542
if (r & VT_LVAL)

riscv64-asm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,10 +2158,10 @@ ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier)
21582158
val = sv->c.i;
21592159
if (modifier == 'n')
21602160
val = -val;
2161-
if (modifier == 'z' && sv->c.i == 0) {
2161+
if (modifier == 'z' && val == 0) {
21622162
cstr_cat(add_str, "zero", -1);
21632163
} else {
2164-
cstr_printf(add_str, "%d", (int) sv->c.i);
2164+
cstr_printf(add_str, "%d", val);
21652165
}
21662166
no_offset:;
21672167
} else if ((r & VT_VALMASK) == VT_LOCAL) {

0 commit comments

Comments
 (0)