
#15094: unknown symbol `___divmoddi4' error with clock on 32-bit windows
---------------------------------+------------------------------
Reporter: simonmic | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.2
Resolution: | Keywords:
Operating System: Windows | Architecture: x86
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
---------------------------------+------------------------------
Comment (by Phyx-):
It does. It's right there in
{{{
void hs_clock_win32_gettime_monotonic(long long* t)
{
LARGE_INTEGER time;
LARGE_INTEGER frequency;
QueryPerformanceCounter(&time);
QueryPerformanceFrequency(&frequency);
// seconds
t[0] = time.QuadPart / frequency.QuadPart;
// nanos =
t[1] = ticks_to_nanos(time.QuadPart % frequency.QuadPart,
frequency.QuadPart);
}
}}}
At the optimization level `clock` is requesting, namely `-O3` GCC will do
multiplication widening optimizations. This optimize `time.QuadPart /
frequency.QuadPart` and `time.QuadPart % frequency.QuadPart` into a single
`divmod`.
It even says so
{{{
Pass statistics of "widening_mul": ----------------
divmod calls inserted: 1
hs_clock_win32_gettime_monotonic (long long intD.8 * tD.60113)
{
# PT = nonlocal null
long long intD.8 * t_9(D) = tD.60113;
union LARGE_INTEGERD.2224 frequencyD.60117;
union LARGE_INTEGERD.2224 timeD.60116;
long long intD.8 _1;
long long intD.8 _2;
long long intD.8 _3;
long long intD.8 _4;
long long intD.8 _5;
doubleD.23 _11;
doubleD.23 _15;
doubleD.23 _16;
doubleD.23 _17;
long intD.3 _18;
__complex__ long long intD.8 divmod_tmp_19;
;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot
;; prev block 0, next block 1, flags: (NEW, REACHABLE, VISITED)
;; pred: ENTRY [100.0%] (FALLTHRU,EXECUTABLE)
# .MEM_7 = VDEF <.MEM_6(D)>
# USE = nonlocal { D.60116 D.60117 } (escaped)
# CLB = nonlocal { D.60116 D.60117 } (escaped)
QueryPerformanceCounter@4D.8347 (&timeD.60116);
# .MEM_8 = VDEF <.MEM_7>
# USE = nonlocal { D.60116 D.60117 } (escaped)
# CLB = nonlocal { D.60116 D.60117 } (escaped)
QueryPerformanceFrequency@4D.8349 (&frequencyD.60117);
# VUSE <.MEM_8>
_1 = timeD.60116.QuadPartD.2223;
# VUSE <.MEM_8>
_2 = frequencyD.60117.QuadPartD.2223;
divmod_tmp_19 = DIVMOD (_1, _2); <---- divmod inserted here. - Phyx
_3 = REALPART_EXPR