On Sun, Mar 01, 2020 at 09:50:38PM -0500, George Koehler wrote:
> On Sun, 1 Mar 2020 09:23:45 +0900
> rgc <[email protected]> wrote:
>
> > 'time sleep 1' takes ages. painfully slow. 'date' after rebooting the
> > test kernel is way way off. from the looks of things it never
> > advanced.
>
> ppc_mftb() in /sys/arch/powerpc/include/cpu.h is broken with clang.
>
thank you for the expert opinion! it is very much appreciated.
the clang-built kernel runs much much better now.
BUT there is some weirdness that i noticed.
(macppc/macppc/clock.c)
ppc_mftb() as emited by base-clang before your patch:
-O2 opt no patch
ppc_mftb():
obj/powerpc/cpu.h:339
3b8: 7f 6d 42 a6 mfspr r27,269
3bc: 7f 8c 42 a6 mfspr r28,268
3c0: 7c 6d 42 a6 mfspr r3,269
3c4: 7c 1b 18 00 cmpw r27,r3
3c8: 40 82 ff f0 bne+ 3b8 <decr_intr+0x48>
-Oz opt no patch
ppc_mftb():
obj/powerpc/cpu.h:339
364: 7f 4d 42 a6 mfspr r26,269
368: 7f 6c 42 a6 mfspr r27,268
36c: 7c 6d 42 a6 mfspr r3,269
370: 7c 1a 18 00 cmpw r26,r3
374: 40 82 ff f0 bne+ 364 <decr_intr+0x48>
-Oz (with your patch)
5b0: 7c 6d 42 a6 mfspr r3,269
5b4: 7c 8c 42 a6 mfspr r4,268
5b8: 7c ad 42 a6 mfspr r5,269
5bc: 7c 03 28 00 cmpw r3,r5
5c0: 40 82 ff f0 bne+ 5b0 <ppc_mftb+0xc>
i guess ppc_mftb() was incorrect for the wrong reasons??
i can duplicate the clobbering on a cross-compile (amd64 host, -O2) too.
this the output of a native base-clang (-O2) compile for the exam.c you
included previously.
.Ltmp1:
mfspr 4, 269
mfspr 5, 268
mfspr 5, 269
cmpw 4, 5
bne 0, .Ltmp1
clang weirdness. and maybe something out of my knowledge.
- rgc
PS hope the G3 can be repaired ~