[libclc] libclc: Disable contract in trig reductions (PR #186432)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 13 09:04:03 PDT 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/186432

This fixes conformance test failures.

>From 9ac7f6f77e9e1fcd2072f606ee1b922724170049 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 13 Mar 2026 16:59:53 +0100
Subject: [PATCH] libclc: Disable contract in trig reductions

This fixes conformance test failures.
---
 libclc/clc/lib/generic/math/clc_sincos_helpers.inc      | 2 ++
 libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libclc/clc/lib/generic/math/clc_sincos_helpers.inc b/libclc/clc/lib/generic/math/clc_sincos_helpers.inc
index 2a71b5626ccc5..f8c2b03054374 100644
--- a/libclc/clc/lib/generic/math/clc_sincos_helpers.inc
+++ b/libclc/clc/lib/generic/math/clc_sincos_helpers.inc
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#pragma OPENCL FP_CONTRACT OFF
+
 _CLC_DEF _CLC_OVERLOAD __CLC_FLOATN __clc_sinf_piby4(__CLC_FLOATN x,
                                                      __CLC_FLOATN y) {
   // Taylor series for sin(x) is x - x^3/3! + x^5/5! - x^7/7! ...
diff --git a/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc b/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc
index f8c089edc8838..ae97b7963f7b3 100644
--- a/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc
+++ b/libclc/clc/lib/generic/math/clc_sincos_helpers_fp64.inc
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#pragma OPENCL FP_CONTRACT OFF
+
 _CLC_DEF _CLC_OVERLOAD void __clc_sincos_piby4(__CLC_DOUBLEN x,
                                                __CLC_DOUBLEN xx,
                                                private __CLC_DOUBLEN *sinval,



More information about the cfe-commits mailing list