From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=NO_REAL_NAME autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 49E93BBAF for ; Tue, 11 Aug 2009 01:08:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMBAPJEgErUGyoFkWdsb2JhbACaTQEBAQEJCwoHEwO1W4QYBYFMWw X-IronPort-AV: E=Sophos;i="4.43,356,1246831200"; d="scan'208";a="34255577" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail1-smtp-roc.national.inria.fr with ESMTP; 11 Aug 2009 01:08:15 +0200 Received: from smtp5-g21.free.fr (localhost [127.0.0.1]) by smtp5-g21.free.fr (Postfix) with ESMTP id ABA91D48042 for ; Tue, 11 Aug 2009 01:08:10 +0200 (CEST) Received: from apc.happyleptic.org (happyleptic.org [82.67.194.89]) by smtp5-g21.free.fr (Postfix) with ESMTP id 72E21D4803C for ; Tue, 11 Aug 2009 01:08:07 +0200 (CEST) Received: from yeeloong (unknown [82.229.213.209]) by apc.happyleptic.org (Postfix) with ESMTP id B3133334EF for ; Tue, 11 Aug 2009 01:08:06 +0200 (CEST) Received: from rixed by yeeloong with local (Exim 4.69) (envelope-from ) id 1MadyG-00061H-LE for caml-list@inria.fr; Tue, 11 Aug 2009 01:08:04 +0200 Date: Tue, 11 Aug 2009 01:08:04 +0200 From: rixed@happyleptic.org To: caml-list@inria.fr Subject: Re: [Caml-list] Native compilation for today's MIPS Message-ID: <20090810230804.GA23104@happyleptic.org> References: <20090810173413.GA7442@fp-desktop.fr.evistel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090810173413.GA7442@fp-desktop.fr.evistel.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam: no; 0.00; compilation:01 mips:01 util:01 util:01 desc:01 desc:01 prerr:01 endline:01 addiu:01 addiu:01 jal:01 jal:01 beq:01 beq:01 prerr:01 I managed to spot a problem with this small piece of code, which is the last function of unison's fileinfo module : let unchanged fspath path info = (* The call to [Util.time] must be before the call to [get] *) let t0 = Util.time () in let info' = get true fspath path in let dataUnchanged = Props.same_time info.desc info'.desc && stamp info = stamp info' && if Props.time info'.desc = t0 then begin prerr_endline ("infotime="^(string_of_float (Props.time info'.desc))^" et t0="^(string_of_float t0)); (* THIS POOR STYLE LINE IS FROM ME *) Unix.sleep 1; false end else true in ... As is, the generated code does not work as intended : although Props.time infos'.desc and t0 are two distinct floats, the = test behave like the values were equal and this function loop while it shouldn't. The corresponding code is : 1004b608 : 1004b608: 27bdffe0 addiu sp,sp,-32 1004b60c: afbf001c sw ra,28(sp) 1004b610: afbc0018 sw gp,24(sp) 1004b614: 3c180011 lui t8,0x11 1004b618: 27187eb8 addiu t8,t8,32440 1004b61c: 0338e02d daddu gp,t9,t8 1004b620 <$180>: 1004b620: afa80000 sw a4,0(sp) 1004b624: afa90004 sw a5,4(sp) 1004b628: afaa0008 sw a6,8(sp) 1004b62c: 0c01c5a5 jal 10071694 1004b630: 24080001 li a4,1 1004b634 <$181>: 1004b634: afa2000c sw v0,12(sp) 1004b638: 24080003 li a4,3 1004b63c: 8fa90000 lw a5,0(sp) 1004b640: 0c012c9e jal 1004b278 1004b644: 8faa0004 lw a6,4(sp) 1004b648 <$182>: 1004b648: afa20004 sw v0,4(sp) 1004b64c: 8c52000c lw s2,12(v0) 1004b650: 8fae0008 lw t2,8(sp) 1004b654: 8dd1000c lw s1,12(t2) 1004b658: 3c101015 lui s0,0x1015 1004b65c: 8e10f0a4 lw s0,-3932(s0) 1004b660: 8e0a002c lw a6,44(s0) 1004b664: 8e49000c lw a5,12(s2) 1004b668: 0c013889 jal 1004e224 1004b66c: 8e28000c lw a4,12(s1) 1004b670 <$183>: 1004b670: 24010001 li at,1 1004b674: 10410051 beq v0,at,1004b7bc <$173> 1004b678: 00000000 nop 1004b67c: 0c012d44 jal 1004b510 1004b680: 8fa80004 lw a4,4(sp) 1004b684 <$184>: 1004b684: afa20000 sw v0,0(sp) 1004b688: 0c012d44 jal 1004b510 1004b68c: 8fa80008 lw a4,8(sp) 1004b690 <$185>: 1004b690: 0040202d move a0,v0 1004b694: 8fa50000 lw a1,0(sp) 1004b698: 3c18100c lui t8,0x100c 1004b69c: 0c033a96 jal 100cea58 1004b6a0: 271808a4 addiu t8,t8,2212 1004b6a4 <$186>: 1004b6a4: 24010001 li at,1 1004b6a8: 10410041 beq v0,at,1004b7b0 <$174> 1004b6ac: 00000000 nop 1004b6b0: 8faa0004 lw a6,4(sp) 1004b6b4: 8d48000c lw a4,12(a6) 1004b6b8: 8d07000c lw a3,12(a4) 1004b6bc: 90e6fffc lbu a2,-4(a3) 1004b6c0: 10c00007 beqz a2,1004b6e0 <$179> 1004b6c4: 00000000 nop 1004b6c8: 8ce50000 lw a1,0(a3) 1004b6cc: 68b80000 ldl t8,0(a1) 1004b6d0: 6cb80007 ldr t8,7(a1) 1004b6d4: 44b80800 dmtc1 t8,$f1 1004b6d8: 10000005 b 1004b6f0 <$178> 1004b6dc: 00000000 nop 1004b6e0 <$179>: 1004b6e0: 8ce40000 lw a0,0(a3) 1004b6e4: 68980000 ldl t8,0(a0) 1004b6e8: 6c980007 ldr t8,7(a0) 1004b6ec: 44b80800 dmtc1 t8,$f1 1004b6f0 <$178>: 1004b6f0: 8fa8000c lw a4,12(sp) 1004b6f4: 69180000 ldl t8,0(a4) 1004b6f8: 6d180007 ldr t8,7(a4) 1004b6fc: 44b80000 dmtc1 t8,$f0 1004b700: 00000000 nop 1004b704: 46200832 c.eq.d $f1,$f0 1004b708: 00000000 nop 1004b70c: 45000025 bc1f 1004b7a4 <$175> 1004b710: 00000000 nop 1004b714: 0c020d9d jal 10083674 1004b718: 00000000 nop 1004b71c <$187>: 1004b71c: 0040482d move a5,v0 1004b720: 3c081015 lui a4,0x1015 1004b724: 0c020cde jal 10083378 1004b728: 2508ef1c addiu a4,a4,-4324 1004b72c <$188>: 1004b72c: afa20000 sw v0,0(sp) 1004b730: 8fa80004 lw a4,4(sp) 1004b734: 8d14000c lw s4,12(a4) 1004b738: 8e93000c lw s3,12(s4) 1004b73c: 9272fffc lbu s2,-4(s3) 1004b740: 12400004 beqz s2,1004b754 <$177> 1004b744: 00000000 nop 1004b748: 8e710000 lw s1,0(s3) 1004b74c: 10000003 b 1004b75c <$176> 1004b750: 0220402d move a4,s1 1004b754 <$177>: 1004b754: 8e700000 lw s0,0(s3) 1004b758: 0200402d move a4,s0 1004b75c <$176>: 1004b75c: 0c020d9d jal 10083674 1004b760: 00000000 nop 1004b764 <$189>: 1004b764: 0040402d move a4,v0 1004b768: 0c020cde jal 10083378 1004b76c: 8fa90000 lw a5,0(sp) 1004b770 <$190>: 1004b770: 3c081015 lui a4,0x1015 1004b774: 2508ef0c addiu a4,a4,-4340 1004b778: 0c020cde jal 10083378 1004b77c: 0040482d move a5,v0 1004b780 <$191>: 1004b780: 0c021067 jal 1008419c 1004b784: 0040402d move a4,v0 1004b788 <$192>: 1004b788: 24040003 li a0,3 1004b78c: 3c18100b lui t8,0x100b 1004b790: 0c033a96 jal 100cea58 1004b794: 27186e10 addiu t8,t8,28176 1004b798 <$193>: 1004b798: 240b0001 li a7,1 1004b79c: 10000009 b 1004b7c4 <$172> 1004b7a0: afab0000 sw a7,0(sp) 1004b7a4 <$175>: 1004b7a4: 240b0003 li a7,3 1004b7a8: 10000006 b 1004b7c4 <$172> 1004b7ac: afab0000 sw a7,0(sp) This last caml_c_call being for the Unix.sleep if Im not mistaken. Notice how floating point registers $f0 and $f1 are used and compared together for equality, jumping if they are not equal to <$175> (which sets a7 to true and leaves this part of the code. I'm googling for mips instructions while reading so I migh be wrong, but the test looks OK to me. So certainly f0 and/or f1 are wrong, despite the correct values being displayed by prerr_endline. Now, lets change a little how the test is done : let unchanged fspath path info = (* The call to [Util.time] must be before the call to [get] *) let t0 = Util.time () in let info' = get true fspath path in let are_the_same a b = a = b in (* I ADDED THIS MASTERPIECE *) let dataUnchanged = Props.same_time info.desc info'.desc && stamp info = stamp info' && if are_the_same (Props.time info'.desc) t0 then begin prerr_endline ("infotime="^(string_of_float (Props.time info'.desc))^" et t0="^(string_of_float t0)); Unix.sleep 1; false end else true in With the addition if this gratuitous complication of the code, unison works (at least it does no longer loop forever here and do copy some files). The generated code is here and, abracadabra!, all the floating point code is gone : 1004b644 : 1004b644: 27bdffe0 addiu sp,sp,-32 1004b648: afbf001c sw ra,28(sp) 1004b64c: afbc0018 sw gp,24(sp) 1004b650: 3c180011 lui t8,0x11 1004b654: 27187e8c addiu t8,t8,32396 1004b658: 0338e02d daddu gp,t9,t8 1004b65c <$182>: 1004b65c: afa80000 sw a4,0(sp) 1004b660: afa90004 sw a5,4(sp) 1004b664: afaa0008 sw a6,8(sp) 1004b668: 0c01c5ad jal 100716b4 1004b66c: 24080001 li a4,1 1004b670 <$183>: 1004b670: afa2000c sw v0,12(sp) 1004b674: 24080003 li a4,3 1004b678: 8fa90000 lw a5,0(sp) 1004b67c: 0c012cad jal 1004b2b4 1004b680: 8faa0004 lw a6,4(sp) # LOOK AT THESE TWO NEW INSTRUCTIONS HERE (lui and addiu) # TO CHANGE v1. WHAT IS IN v1 ? 1004b684 <$184>: 1004b684: afa20004 sw v0,4(sp) 1004b688: 3c031015 lui v1,0x1015 1004b68c: 2463ecc4 addiu v1,v1,-4924 1004b690: 8c55000c lw s5,12(v0) 1004b694: 8faf0008 lw t3,8(sp) 1004b698: 8df4000c lw s4,12(t3) 1004b69c: 3c131015 lui s3,0x1015 1004b6a0: 8e73f0b4 lw s3,-3916(s3) 1004b6a4: 8e6a002c lw a6,44(s3) 1004b6a8: 8ea9000c lw a5,12(s5) 1004b6ac: 0c013891 jal 1004e244 1004b6b0: 8e88000c lw a4,12(s4) 1004b6b4 <$185>: 1004b6b4: 24010001 li at,1 1004b6b8: 10410048 beq v0,at,1004b7dc <$175> 1004b6bc: 00000000 nop 1004b6c0: 0c012d53 jal 1004b54c 1004b6c4: 8fa80004 lw a4,4(sp) 1004b6c8 <$186>: 1004b6c8: afa20000 sw v0,0(sp) 1004b6cc: 0c012d53 jal 1004b54c 1004b6d0: 8fa80008 lw a4,8(sp) 1004b6d4 <$187>: 1004b6d4: 0040202d move a0,v0 1004b6d8: 8fa50000 lw a1,0(sp) 1004b6dc: 3c18100c lui t8,0x100c 1004b6e0: 0c033a9e jal 100cea78 1004b6e4: 271808c4 addiu t8,t8,2244 1004b6e8 <$188>: 1004b6e8: 24010001 li at,1 1004b6ec: 10410038 beq v0,at,1004b7d0 <$176> 1004b6f0: 00000000 nop 1004b6f4: 8fab0004 lw a7,4(sp) 1004b6f8: 8d6b000c lw a7,12(a7) 1004b6fc: 8d6a000c lw a6,12(a7) 1004b700: 9149fffc lbu a5,-4(a6) 1004b704: 11200003 beqz a5,1004b714 <$181> 1004b708: 00000000 nop 1004b70c: 10000002 b 1004b718 <$180> 1004b710: 8d440000 lw a0,0(a6) 1004b714 <$181>: 1004b714: 8d440000 lw a0,0(a6) # HERE IT'S COMPLETELY DIFFERENT FROM ABOVE # THE FP CODE IS GONE ?? 1004b718 <$180>: 1004b718: 8fa5000c lw a1,12(sp) 1004b71c: 3c18100c lui t8,0x100c 1004b720: 0c033a9e jal 100cea78 1004b724: 271808c4 addiu t8,t8,2244 1004b728 <$189>: 1004b728: 24010001 li at,1 1004b72c: 10410025 beq v0,at,1004b7c4 <$177> 1004b730: 00000000 nop 1004b734: 0c020da5 jal 10083694 1004b738: 8fa8000c lw a4,12(sp) 1004b73c <$190>: 1004b73c: 0040482d move a5,v0 1004b740: 3c081015 lui a4,0x1015 1004b744: 0c020ce6 jal 10083398 1004b748: 2508ef2c addiu a4,a4,-4308 1004b74c <$191>: 1004b74c: afa20000 sw v0,0(sp) 1004b750: 8fa80004 lw a4,4(sp) 1004b754: 8d15000c lw s5,12(a4) 1004b758: 8eb4000c lw s4,12(s5) 1004b75c: 9293fffc lbu s3,-4(s4) 1004b760: 12600004 beqz s3,1004b774 <$179> 1004b764: 00000000 nop 1004b768: 8e920000 lw s2,0(s4) 1004b76c: 10000003 b 1004b77c <$178> 1004b770: 0240402d move a4,s2 1004b774 <$179>: 1004b774: 8e910000 lw s1,0(s4) 1004b778: 0220402d move a4,s1 1004b77c <$178>: 1004b77c: 0c020da5 jal 10083694 1004b780: 00000000 nop 1004b784 <$192>: 1004b784: 0040402d move a4,v0 1004b788: 0c020ce6 jal 10083398 1004b78c: 8fa90000 lw a5,0(sp) 1004b790 <$193>: 1004b790: 3c081015 lui a4,0x1015 1004b794: 2508ef1c addiu a4,a4,-4324 1004b798: 0c020ce6 jal 10083398 1004b79c: 0040482d move a5,v0 1004b7a0 <$194>: 1004b7a0: 0c02106f jal 100841bc 1004b7a4: 0040402d move a4,v0 1004b7a8 <$195>: 1004b7a8: 24040003 li a0,3 1004b7ac: 3c18100b lui t8,0x100b 1004b7b0: 0c033a9e jal 100cea78 1004b7b4: 27186e30 addiu t8,t8,28208 1004b7b8 <$196>: 1004b7b8: 240b0001 li a7,1 1004b7bc: 10000009 b 1004b7e4 <$174> 1004b7c0: afab0000 sw a7,0(sp) 1004b7c4 <$177>: 1004b7c4: 240b0003 li a7,3 1004b7c8: 10000006 b 1004b7e4 <$174> 1004b7cc: afab0000 sw a7,0(sp) So what's happening there ? Why no more FP registers ? I'm still in the dark but I wanted to share these questions with the list in the hope that a Mips guru would see this and recognize at first sight the stupid mistake I did and point me in the right direction. If all the gurus are in hollidays, well, it's fun anyway :) Sory to waste the bandwidth.