Mesa (master): spirv/opencl: Cast opcode up front to avoid warnings

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 4 06:25:01 UTC 2020


Module: Mesa
Branch: master
Commit: 0bc516fceb742e4c1ce2d47f129d19d8bb005d13
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0bc516fceb742e4c1ce2d47f129d19d8bb005d13

Author: Kristian H. Kristensen <hoegsberg at google.com>
Date:   Mon Feb  3 12:11:45 2020 -0800

spirv/opencl: Cast opcode up front to avoid warnings

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3686>

---

 src/compiler/spirv/vtn_opencl.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/compiler/spirv/vtn_opencl.c b/src/compiler/spirv/vtn_opencl.c
index 81328d23854..7cd127af894 100644
--- a/src/compiler/spirv/vtn_opencl.c
+++ b/src/compiler/spirv/vtn_opencl.c
@@ -316,7 +316,9 @@ bool
 vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
                               const uint32_t *w, unsigned count)
 {
-   switch ((enum OpenCLstd_Entrypoints)ext_opcode) {
+   enum OpenCLstd_Entrypoints cl_opcode = (enum OpenCLstd_Entrypoints) ext_opcode;
+
+   switch (cl_opcode) {
    case OpenCLstd_Fabs:
    case OpenCLstd_SAbs:
    case OpenCLstd_UAbs:
@@ -352,7 +354,7 @@ vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
    case OpenCLstd_SSub_sat:
    case OpenCLstd_USub_sat:
    case OpenCLstd_Trunc:
-      handle_instr(b, ext_opcode, w, count, handle_alu);
+      handle_instr(b, cl_opcode, w, count, handle_alu);
       return true;
    case OpenCLstd_SAbs_diff:
    case OpenCLstd_UAbs_diff:
@@ -388,22 +390,22 @@ vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
    case OpenCLstd_Smoothstep:
    case OpenCLstd_S_Upsample:
    case OpenCLstd_U_Upsample:
-      handle_instr(b, ext_opcode, w, count, handle_special);
+      handle_instr(b, cl_opcode, w, count, handle_special);
       return true;
    case OpenCLstd_Vloadn:
-      vtn_handle_opencl_vload(b, ext_opcode, w, count);
+      vtn_handle_opencl_vload(b, cl_opcode, w, count);
       return true;
    case OpenCLstd_Vstoren:
-      vtn_handle_opencl_vstore(b, ext_opcode, w, count);
+      vtn_handle_opencl_vstore(b, cl_opcode, w, count);
       return true;
    case OpenCLstd_Shuffle:
-      handle_instr(b, ext_opcode, w, count, handle_shuffle);
+      handle_instr(b, cl_opcode, w, count, handle_shuffle);
       return true;
    case OpenCLstd_Shuffle2:
-      handle_instr(b, ext_opcode, w, count, handle_shuffle2);
+      handle_instr(b, cl_opcode, w, count, handle_shuffle2);
       return true;
    case OpenCLstd_Printf:
-      handle_instr(b, ext_opcode, w, count, handle_printf);
+      handle_instr(b, cl_opcode, w, count, handle_printf);
       return true;
    case OpenCLstd_Prefetch:
       /* TODO maybe add a nir instruction for this? */



More information about the mesa-commit mailing list