[PATCH] Handle sqrt() shrinking in SimplifyLibCalls like any other call

Hal Finkel hfinkel at anl.gov
Thu Oct 23 13:32:28 PDT 2014


----- Original Message -----
> From: "Stephen Canon" <scanon at apple.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: llvm-commits at cs.uiuc.edu, spatel at rotateright.com, beanz at apple.com,
> reviews+D5919+public+763adead774985f1 at reviews.llvm.org
> Sent: Thursday, October 23, 2014 3:26:47 PM
> Subject: Re: [PATCH] Handle sqrt() shrinking in SimplifyLibCalls like any other call
> 
> On Oct 23, 2014, at 3:57 PM, Hal Finkel < hfinkel at anl.gov > wrote:
> 
> ----- Original Message -----
> 
> 
> From: "Hal Finkel" < hfinkel at anl.gov >
> To: "Stephen Canon" < scanon at apple.com >
> Cc: llvm-commits at cs.uiuc.edu , spatel at rotateright.com ,
> beanz at apple.com ,
> reviews+D5919+public+763adead774985f1 at reviews.llvm.org
> Sent: Thursday, October 23, 2014 2:51:34 PM
> Subject: Re: [PATCH] Handle sqrt() shrinking in SimplifyLibCalls like
> any other call
> 
> ----- Original Message -----
> 
> 
> From: "Stephen Canon" < scanon at apple.com >
> To: "Hal Finkel" < hfinkel at anl.gov >
> Cc: llvm-commits at cs.uiuc.edu , spatel at rotateright.com ,
> beanz at apple.com ,
> reviews+D5919+public+763adead774985f1 at reviews.llvm.org
> Sent: Thursday, October 23, 2014 2:46:17 PM
> Subject: Re: [PATCH] Handle sqrt() shrinking in SimplifyLibCalls
> like any other call
> 
> (float)sqrt((double)x) —> sqrtf(x) is a valid transformation [See
> Sam
> Figueroa’s thesis for details].
> 
> Does this assume that the sqrtf is correct to <= 0.5ulps?
> 
> I suppose that C99 F.3 does say that, "The sqrt functions in <math.h>
> provide the IEC 60559 square root operation.", so perhaps this is a
> safe assumption on a compliant system.
> 
> Alright, Sanjay, go ahead. You're not actually changing anything. ;)
> 
> Yeah, I would say that a system without a correctly rounded sqrtf is
> broken. (But: Annex F is not required).

True, but a user can always pass -fno-builtin-sqrt if this really bothers them.

 -Hal


-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-commits mailing list