From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 1A5DD7EEBF for ; Mon, 29 Jun 2015 20:01:01 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of xavier.leroy@gmail.com) identity=pra; client-ip=74.125.82.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="xavier.leroy@gmail.com"; x-sender="xavier.leroy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of xavier.leroy@gmail.com designates 74.125.82.47 as permitted sender) identity=mailfrom; client-ip=74.125.82.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="xavier.leroy@gmail.com"; x-sender="xavier.leroy@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f47.google.com) identity=helo; client-ip=74.125.82.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="xavier.leroy@gmail.com"; x-sender="postmaster@mail-wg0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DDAgDOhpFVlC9SfUpBGoNlXwaDGKsMjlSCG4V2gTgHTAEBAQEBARIBAQEBBwsLCR8whCMBAQIBARIRHQESGwsBAwELAQUFBAcaHQICIhIBBQEKEgYTEhCHeAMKCA06pWc+MYs/hGSLJScDCoV0AQsBGQEFDos8gjuBfEuCc4FDBYVaCoYuhRWCXYRZhnyBfIt5iHwSI4EVEQZJg0I8MQEBgkYBAQE X-IPAS-Result: A0DDAgDOhpFVlC9SfUpBGoNlXwaDGKsMjlSCG4V2gTgHTAEBAQEBARIBAQEBBwsLCR8whCMBAQIBARIRHQESGwsBAwELAQUFBAcaHQICIhIBBQEKEgYTEhCHeAMKCA06pWc+MYs/hGSLJScDCoV0AQsBGQEFDos8gjuBfEuCc4FDBYVaCoYuhRWCXYRZhnyBfIt5iHwSI4EVEQZJg0I8MQEBgkYBAQE X-IronPort-AV: E=Sophos;i="5.15,371,1432591200"; d="scan'208";a="167900296" Received: from mail-wg0-f47.google.com ([74.125.82.47]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 29 Jun 2015 20:01:00 +0200 Received: by wgqq4 with SMTP id q4so147904240wgq.1 for ; Mon, 29 Jun 2015 11:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=qveBytvC1Py6gljRyG3mtZ+ELBmAuLNl5f1JjZRaB3Y=; b=IRtNBnDFbzIN52ks7+vubakcsxWnFtHyCL7xtJ1Cy1Zo/lZsZfFMOeoTDkczKIn712 PGOA+yrEdDiHEhxTM3le6SdlFk4JGDGTe2XOrYMGv9E4pj3k+QCRwS5G0nHJ0OZlioJS cnoQUqTi7VfN8JN/VKed9NfkzTF9Ib63K0mu3/jYo1QXG9qOtXAuMulpDwBoEOX8RlrQ TbSbltpbqn3ieFJazdy90BeCwfr4mPFFzNjFQAdWr+QQY5LWaJOKUUzEzUaRFH9gqHPf GTng5wMFxr7vbO5zK4Cx0vfRifHpCakPtjOI1O8HQBnbuCMJ4u1iHwZzMXAH4TOj6pGy zGnQ== X-Received: by 10.180.37.229 with SMTP id b5mr24909306wik.16.1435600860247; Mon, 29 Jun 2015 11:01:00 -0700 (PDT) MIME-Version: 1.0 Sender: xavier.leroy@gmail.com Received: by 10.27.170.68 with HTTP; Mon, 29 Jun 2015 11:00:30 -0700 (PDT) In-Reply-To: <20150629175026.GE31462@annexia.org> References: <20150629175026.GE31462@annexia.org> From: Xavier Leroy Date: Mon, 29 Jun 2015 20:00:30 +0200 X-Google-Sender-Auth: DbzyCsD188_pTKgKR_mADYbjm9I Message-ID: To: "Richard W.M. Jones" Cc: caml users Content-Type: multipart/alternative; boundary=e89a8f647017507aa90519abdff1 Subject: Re: [Caml-list] =?UTF-8?Q?ppc64le_behaviour_of_Int64=2Emin=5Fint_?= =?UTF-8?Q?=C3=B7_-1?= --e89a8f647017507aa90519abdff1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Richard, You need to put "let division_crashes_on_overflow =3D true" in asmcomp/$ARC= H/ arch.ml, just like in asmcomp/power/arch.ml. The name of the variable is perhaps counterintuitive but means "min_int / -1 doesn't do what we want, so add tests (in cmmgen) for this case". - Xavier 2015-06-29 19:50 GMT+02:00 Richard W.M. Jones : > Downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=3D1236615 > > OCaml expects Int64.min_int =C3=B7 -1 to overflow and wrap around > (resulting in Int64.min_int). There is also a test case in the test > suite for this. See this previously fixed bug: > > http://caml.inria.fr/mantis/view.php?id=3D5513 > > The compiler seems to cater for the case where an overflow in the > division throws an exception. > > Unfortunately ppc64le does neither of these things: On ppc64le the > result of the computation is explicitly undefined, it sets a flag bit > (OV), but it doesn't throw an exception. > > [See page 76 of > https://www.power.org/wp-content/uploads/2013/05/PowerISA_V2.07_PUBLIC.pdf > ] > > I wonder if there is a way to tell the compiler about this? I could > add a conditional branch, but that would make the expansion of every > Int64.div and Int64.rem quite large (but maybe that doesn't matter as > these functions are going to be slow anyway?) > > Suggestions welcome ... > > Rich. > > -- > Richard Jones > Red Hat > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > --e89a8f647017507aa90519abdff1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Richard,

You need to put "l= et division_crashes_on_overflow =3D true" in asmcomp/$ARCH/arch.ml, just like in asmcomp/power/arch.ml.=C2=A0 The name of the variable is perhaps counterintui= tive but means "min_int / -1 doesn't do what we want, so add tests= (in cmmgen) for this case".

- Xavier


2015-06-29 19:50 GMT+02= :00 Richard W.M. Jones <rich@annexia.org>:
Downstream bug: https://bugzill= a.redhat.com/show_bug.cgi?id=3D1236615

OCaml expects Int64.min_int =C3=B7 -1 to overflow and wrap around
(resulting in Int64.min_int).=C2=A0 There is also a test case in the test suite for this.=C2=A0 See this previously fixed bug:

http://caml.inria.fr/mantis/view.php?id=3D5513

The compiler seems to cater for the case where an overflow in the
division throws an exception.

Unfortunately ppc64le does neither of these things: On ppc64le the
result of the computation is explicitly undefined, it sets a flag bit
(OV), but it doesn't throw an exception.

[See page 76 of
https://www.power.org/wp-c= ontent/uploads/2013/05/PowerISA_V2.07_PUBLIC.pdf ]

I wonder if there is a way to tell the compiler about this?=C2=A0 I could add a conditional branch, but that would make the expansion of every
Int64.div and Int64.rem quite large (but maybe that doesn't matter as these functions are going to be slow anyway?)

Suggestions welcome ...

Rich.

--
Richard Jones
Red Hat

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--e89a8f647017507aa90519abdff1--