[PATCH] [OpenCL] fix the various -cl-* flags to relax FP arith

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Mon Dec 1 13:19:40 PST 2014

On 12/01/2014 06:13 PM, Matt Arsenault wrote:
> I think the test should also check for the function target attribute.

Not sure of this as Hal said that those are being phased out.
I added a test for the attributes that were there already anyways,
but didn't add a new attribute for the no-signed-zeros.

> What about the other flags? I think this patch should handle (maybe just
> test?) all of the CL fast math flags instead of just this one (
> -cl-no-signed-zeros, -cl-unsafe-math-optimizations,
> -cl-finite-math-only, and -cl-fast-relaxed-math)

Done. The OpenCL flags seem to be supersets of the
flags of LLVM, so there might be more optimization
opportunities to extract from those than these flags

For example:

"Allow optimizations for floating-point arithmetic that (a) assume that 
arguments and results are valid, (b) may violate IEEE 754 standard and 
(c) may violate the OpenCL numerical compliance requirements as defined 
in section 7.4 for single-precision floating-point, section 9.3.9 for 
double-precision floating-point, and edge case behavior in section 7.5. 
This option includes the -cl-no-signed-zeros and -cl-mad-enable options."

Now it just sets the nnans flag even though (b) and (c) allow
pretty much anything (if read with "lawyer's eyes").

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-3.6-opencl-c-relaxed-fpmath-options.patch
Type: text/x-patch
Size: 5529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141201/af713ce7/attachment.bin>

More information about the cfe-commits mailing list