[libclc] libclc: clspv: update gen_convert.cl for clspv (PR #66902)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 14 03:29:47 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 0f1847cb2c5462a09d65a9b5ac24904ac3c15a0f...5614f89c90cf865c88fbcf95d707e34dfeb18a19 libclc/generic/lib/gen_convert.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- gen_convert.py 2024-03-14 10:17:28.000000 +0000
+++ gen_convert.py 2024-03-14 10:29:40.440233 +0000
@@ -28,11 +28,11 @@
# convert_<destTypen><_sat><_roundingMode>(<sourceTypen>)
import sys
clspv = False
-if len(sys.argv) == 2 and sys.argv[1] == '--clspv':
+if len(sys.argv) == 2 and sys.argv[1] == "--clspv":
clspv = True
types = [
"char",
"uchar",
@@ -255,10 +255,11 @@
)
if close_conditional:
print("#endif")
+
# Do not generate default conversion for clspv as they are handle natively
if not clspv:
for src in types:
for dst in types:
generate_default_conversion(src, dst, "")
@@ -462,11 +463,15 @@
)
else:
print(" {SRC}{N} abs_x = fabs(x);".format(SRC=src, N=size))
print(" {SRC}{N} abs_y = fabs(y);".format(SRC=src, N=size))
if clspv:
- print(" {BOOL}{N} c = convert_{BOOL}{N}(abs_y > abs_x);".format(BOOL=bool_type[dst], N=size))
+ print(
+ " {BOOL}{N} c = convert_{BOOL}{N}(abs_y > abs_x);".format(
+ BOOL=bool_type[dst], N=size
+ )
+ )
if sizeof_type[src] >= 4 and src in int_types:
print(
" c = c || convert_{BOOL}{N}(({SRC}{N}){SRC_MAX} == x);".format(
BOOL=bool_type[dst], N=size, SRC=src, SRC_MAX=limit_max[src]
)
@@ -488,11 +493,15 @@
DST=dst, N=size, BOOL=bool_type[dst]
)
)
if mode == "_rtn":
if clspv:
- print(" {BOOL}{N} c = convert_{BOOL}{N}(y > x);".format(BOOL=bool_type[dst], N=size))
+ print(
+ " {BOOL}{N} c = convert_{BOOL}{N}(y > x);".format(
+ BOOL=bool_type[dst], N=size
+ )
+ )
if sizeof_type[src] >= 4 and src in int_types:
print(
" c = c || convert_{BOOL}{N}(({SRC}{N}){SRC_MAX} == x);".format(
BOOL=bool_type[dst], N=size, SRC=src, SRC_MAX=limit_max[src]
)
``````````
</details>
https://github.com/llvm/llvm-project/pull/66902
More information about the cfe-commits
mailing list