https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99658
Bug ID: 99658
Summary: __divmoddi4 calls are generated on i686
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: raj.khem at gmail dot com
Target Milestone: ---
Following is a reduced case from Virtualbox which fails to link because it
expects libgcc function __divmoddi4 which is not available in kernel modules,
gcc 10.x does not generate these calls but gcc 11 does.
void foo(unsigned char *u8Second, unsigned int *u32Nanosecond, long long
timeSpec)
{
long long i64Div;
int i32Div;
int i32Rem;
i64Div = timeSpec;
i32Rem = (int)(i64Div % 1000000000);
i64Div /= 1000000000;
*u32Nanosecond = i32Rem;
i32Rem = (int)(i64Div % 60);
*u8Second = i32Rem;
}
$ i686-yoe-linux-musl-gcc -O3 a.c -S -fverbose-asm
in a.s we see
...
call __divmoddi4@PLT #
movl %edx, %ebx #, divmod_tmp_12
movl %eax, %ecx # tmp163, divmod_tmp_12
...
but when compiled with gcc 10 it uses __moddi3 and __divdi3
is this expected?