spirv/opencl: Cast opcode up front to avoid warnings

From Kristian Hoegsberg
b40281d8306367e68dde6b723d2114d9cb5fca5a in mainline Mesa
This commit is contained in:
jsg 2020-09-22 06:14:43 +00:00
parent ead9561df6
commit 37d3b3aad0

View File

@ -316,7 +316,9 @@ bool
vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode, vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
const uint32_t *w, unsigned count) 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_Fabs:
case OpenCLstd_SAbs: case OpenCLstd_SAbs:
case OpenCLstd_UAbs: case OpenCLstd_UAbs:
@ -352,7 +354,7 @@ vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
case OpenCLstd_SSub_sat: case OpenCLstd_SSub_sat:
case OpenCLstd_USub_sat: case OpenCLstd_USub_sat:
case OpenCLstd_Trunc: case OpenCLstd_Trunc:
handle_instr(b, ext_opcode, w, count, handle_alu); handle_instr(b, cl_opcode, w, count, handle_alu);
return true; return true;
case OpenCLstd_SAbs_diff: case OpenCLstd_SAbs_diff:
case OpenCLstd_UAbs_diff: case OpenCLstd_UAbs_diff:
@ -389,22 +391,22 @@ vtn_handle_opencl_instruction(struct vtn_builder *b, SpvOp ext_opcode,
case OpenCLstd_S_Upsample: case OpenCLstd_S_Upsample:
case OpenCLstd_U_Upsample: case OpenCLstd_U_Upsample:
case OpenCLstd_Clz: case OpenCLstd_Clz:
handle_instr(b, ext_opcode, w, count, handle_special); handle_instr(b, cl_opcode, w, count, handle_special);
return true; return true;
case OpenCLstd_Vloadn: case OpenCLstd_Vloadn:
vtn_handle_opencl_vload(b, ext_opcode, w, count); vtn_handle_opencl_vload(b, cl_opcode, w, count);
return true; return true;
case OpenCLstd_Vstoren: case OpenCLstd_Vstoren:
vtn_handle_opencl_vstore(b, ext_opcode, w, count); vtn_handle_opencl_vstore(b, cl_opcode, w, count);
return true; return true;
case OpenCLstd_Shuffle: case OpenCLstd_Shuffle:
handle_instr(b, ext_opcode, w, count, handle_shuffle); handle_instr(b, cl_opcode, w, count, handle_shuffle);
return true; return true;
case OpenCLstd_Shuffle2: case OpenCLstd_Shuffle2:
handle_instr(b, ext_opcode, w, count, handle_shuffle2); handle_instr(b, cl_opcode, w, count, handle_shuffle2);
return true; return true;
case OpenCLstd_Printf: case OpenCLstd_Printf:
handle_instr(b, ext_opcode, w, count, handle_printf); handle_instr(b, cl_opcode, w, count, handle_printf);
return true; return true;
case OpenCLstd_Prefetch: case OpenCLstd_Prefetch:
/* TODO maybe add a nir instruction for this? */ /* TODO maybe add a nir instruction for this? */