History

x86_64/i386: Add missing fetch CPU flag

In x86_64-gen.c/i386-gen.c, gfunc_call will generate structure store for bt == VT_STRUCT. Before generating any code, it is needed fetch cpu flag. As #ifdef TCC_TARGET_PE, gfunc_call() forgot to do this.

kbkpbot committed 1 year ago

Commit 90ae3831 parent af1cfd92 files · +7 −7Browse files

Unified · Split

2 files
  1. i386-gen.c +3 −3
  2. x86_64-gen.c +4 −4
i386-gen.c+3−3
@@ -409,9 +409,9 @@ ST_FUNC void gfunc_call(int nb_args) · 408 unmodified lines
409 args_size = 0;409 args_size = 0;
410 for(i = 0;i < nb_args; i++) {410 for(i = 0;i < nb_args; i++) {
411 if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {411 if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
412 /* fetch cpu flag before generating any code */412 /* fetch cpu flag before generating any code */
413 if ((vtop->r & VT_VALMASK) == VT_CMP)413 if ((vtop->r & VT_VALMASK) == VT_CMP)
414 gv(RC_INT);414 gv(RC_INT);
415 size = type_size(&vtop->type, &align);415 size = type_size(&vtop->type, &align);
416 /* align to stack align size */416 /* align to stack align size */
417 size = (size + 3) & ~3;417 size = (size + 3) & ~3;
x86_64-gen.c+4−4
@@ -828,10 +828,10 @@ void gfunc_call(int nb_args) · 827 unmodified lines
828 continue; /* arguments smaller than 8 bytes passed in registers or on stack */828 continue; /* arguments smaller than 8 bytes passed in registers or on stack */
829 829
830 if (bt == VT_STRUCT) {830 if (bt == VT_STRUCT) {
831 /* fetch cpu flag before generating any code */831 /* fetch cpu flag before generating any code */
832 if ((vtop->r & VT_VALMASK) == VT_CMP)832 if ((vtop->r & VT_VALMASK) == VT_CMP)
833 gv(RC_INT);833 gv(RC_INT);
834 /* align to stack align size */834 /* align to stack align size */
835 size = (size + 15) & ~15;835 size = (size + 15) & ~15;
836 /* generate structure store */836 /* generate structure store */
837 r = get_reg(RC_INT);837 r = get_reg(RC_INT);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t