summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-03-13 12:36:19 +0100
committerMarge Bot <[email protected]>2020-03-26 10:14:22 +0000
commit7b2bfb6bc4e354cfaf3f9f2774906c54c03cff0e (patch)
treec2a163f308772a864af74d900149a9a45a6f4393 /src
parent25cb87bcdd558747f3dd06be033c2a93ab634d53 (diff)
vtn/opencl: add native exp10/log10-support
Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4318>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/spirv/vtn_opencl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_opencl.c b/src/compiler/spirv/vtn_opencl.c
index 5eeaed4c3b4..b696241209d 100644
--- a/src/compiler/spirv/vtn_opencl.c
+++ b/src/compiler/spirv/vtn_opencl.c
@@ -195,8 +195,12 @@ handle_special(struct vtn_builder *b, enum OpenCLstd_Entrypoints opcode,
return nir_upsample(nb, srcs[0], srcs[1]);
case OpenCLstd_Native_exp:
return nir_fexp(nb, srcs[0]);
+ case OpenCLstd_Native_exp10:
+ return nir_fexp2(nb, nir_fmul_imm(nb, srcs[0], log(10) / log(2)));
case OpenCLstd_Native_log:
return nir_flog(nb, srcs[0]);
+ case OpenCLstd_Native_log10:
+ return nir_fmul_imm(nb, nir_flog2(nb, srcs[0]), log(2) / log(10));
default:
vtn_fail("No NIR equivalent");
return NULL;
@@ -396,7 +400,9 @@ vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
case OpenCLstd_U_Upsample:
case OpenCLstd_Clz:
case OpenCLstd_Native_exp:
+ case OpenCLstd_Native_exp10:
case OpenCLstd_Native_log:
+ case OpenCLstd_Native_log10:
handle_instr(b, cl_opcode, w, count, handle_special);
return true;
case OpenCLstd_Vloadn: