[libclc] r330207 - powr: Use denormal path only

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 17 12:35:32 PDT 2018


Author: jvesely
Date: Tue Apr 17 12:35:32 2018
New Revision: 330207

URL: http://llvm.org/viewvc/llvm-project?rev=330207&view=rev
Log:
powr: Use denormal path only

It's OK to either flush to 0 or return denormal result if the device
does not support denormals. See sec 7.2 and 7.5.3 of OCL specs
Fixes CTS on carrizo and turks.
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewer: Aaron Watry <awatry at gmail.com>

Modified:
    libclc/trunk/generic/lib/math/clc_powr.cl

Modified: libclc/trunk/generic/lib/math/clc_powr.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/clc_powr.cl?rev=330207&r1=330206&r2=330207&view=diff
==============================================================================
--- libclc/trunk/generic/lib/math/clc_powr.cl (original)
+++ libclc/trunk/generic/lib/math/clc_powr.cl Tue Apr 17 12:35:32 2018
@@ -165,17 +165,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_powr(
     tv = USE_TABLE(exp_tbl_ep, j);
 
     float expylogx = mad(tv.s0, poly, mad(tv.s1, poly, tv.s1)) + tv.s0;
-    float sexpylogx;
-    if (!__clc_fp32_subnormals_supported()) {
-		int explg = ((as_uint(expylogx) & EXPBITS_SP32 >> 23) - 127);
-		m = (23-(m + 149)) == 0 ? 1: m;
-		uint mantissa =  ((as_uint(expylogx) & MANTBITS_SP32)|IMPBIT_SP32) >> (23-(m + 149));
-		sexpylogx = as_float(mantissa);
-    } else {
-		sexpylogx = expylogx * as_float(0x1 << (m + 149));
-    }
-
-
+    float sexpylogx = expylogx * as_float(0x1 << (m + 149));
     float texpylogx = as_float(as_int(expylogx) + m2);
     expylogx = m < -125 ? sexpylogx : texpylogx;
 




More information about the cfe-commits mailing list