[libclc] Enable clang fp reciprocal in clc_native_divide/recip/rsqrt/tan (#149269)

The pragma adds `arcp` flag to `fdiv` instruction in these functions.
The flag can provide better performance.
This commit is contained in:
Wenju He 2025-07-18 07:50:35 +08:00 committed by GitHub
parent 0b6df5485e
commit cf36f49c04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 0 deletions

View File

@ -8,5 +8,6 @@
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_native_divide(__CLC_GENTYPE x,
__CLC_GENTYPE y) {
_Pragma("clang fp reciprocal(on)");
return x / y;
}

View File

@ -7,5 +7,6 @@
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_native_recip(__CLC_GENTYPE val) {
_Pragma("clang fp reciprocal(on)");
return 1.0f / val;
}

View File

@ -7,5 +7,6 @@
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_native_rsqrt(__CLC_GENTYPE val) {
_Pragma("clang fp reciprocal(on)");
return 1.0f / __clc_native_sqrt(val);
}

View File

@ -7,5 +7,6 @@
//===----------------------------------------------------------------------===//
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_native_tan(__CLC_GENTYPE val) {
_Pragma("clang fp reciprocal(on)");
return __clc_native_sin(val) / __clc_native_cos(val);
}