[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck closed https://github.com/llvm/llvm-project/pull/129045 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/129045 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Fraser Cormack via cfe-commits
@@ -0,0 +1,4 @@ +__attribute__((weak)) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE +__clc_rsqrt(__CLC_GENTYPE val) { + return __CLC_FP_LIT(1.0) / __clc_sqrt(val); frasercrmck wrote: Good point. Perhaps we just use the elementwise sqrt builtin. I'm not sure I want to t

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/129045 >From 4efd607ca71b91847c9271740df7aab4534fe01b Mon Sep 17 00:00:00 2001 From: Fraser Cormack Date: Thu, 27 Feb 2025 12:48:25 + Subject: [PATCH 1/3] [libclc] Move rsqrt to the CLC library This also adds

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,4 @@ +__attribute__((weak)) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE +__clc_rsqrt(__CLC_GENTYPE val) { + return __CLC_FP_LIT(1.0) / __clc_sqrt(val); arsenm wrote: ```suggestion __clc_rsqrt(__CLC_GENTYPE val) { #pragma clang fp contract(fast) return __

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,4 @@ +__attribute__((weak)) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE +__clc_rsqrt(__CLC_GENTYPE val) { + return __CLC_FP_LIT(1.0) / __clc_sqrt(val); arsenm wrote: For this to work as you want, probably needs to directly use the sqrt builtin (or really, w

[libclc] [libclc] Move rsqrt to the CLC library (PR #129045)

2025-02-27 Thread Fraser Cormack via cfe-commits
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/129045 This also adds missing half variants to certain targets. It also optimizes some targets' implementations to perform the operation directly in vector types, as opposed to scalarizing. >From 4efd607ca71b9184