[NFC] math_brute_force: drop unneeded gotos (#1843)

Simplify code by returning directly instead of using goto statements.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2024-06-27 09:46:33 +02:00
committed by GitHub
parent c7b682f12a
commit fcbccab4d1
2 changed files with 12 additions and 16 deletions

View File

@@ -98,7 +98,7 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
vlog_error( vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
error, j); error, j);
goto exit; return error;
} }
} }
else else
@@ -124,13 +124,13 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
sizeof(gOutBuffer[j]), &gOutBuffer[j]))) sizeof(gOutBuffer[j]), &gOutBuffer[j])))
{ {
LogBuildError(programs[j]); LogBuildError(programs[j]);
goto exit; return error;
} }
if ((error = clSetKernelArg(kernels[j][thread_id], 1, if ((error = clSetKernelArg(kernels[j][thread_id], 1,
sizeof(gInBuffer), &gInBuffer))) sizeof(gInBuffer), &gInBuffer)))
{ {
LogBuildError(programs[j]); LogBuildError(programs[j]);
goto exit; return error;
} }
if ((error = clEnqueueNDRangeKernel(gQueue, kernels[j][thread_id], if ((error = clEnqueueNDRangeKernel(gQueue, kernels[j][thread_id],
@@ -138,7 +138,7 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
NULL, NULL))) NULL, NULL)))
{ {
vlog_error("FAILED -- could not execute kernel\n"); vlog_error("FAILED -- could not execute kernel\n");
goto exit; return error;
} }
} }
@@ -159,7 +159,7 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
BUFFER_SIZE, gOut[j], 0, NULL, NULL))) BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
{ {
vlog_error("ReadArray failed %d\n", error); vlog_error("ReadArray failed %d\n", error);
goto exit; return error;
} }
} }
@@ -188,8 +188,7 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
"\nERROR: %sD%s: %d ulp error at %.13la: *%d vs. %d\n", "\nERROR: %sD%s: %d ulp error at %.13la: *%d vs. %d\n",
f->name, sizeNames[k], err, ((double *)gIn)[j], t[j], f->name, sizeNames[k], err, ((double *)gIn)[j], t[j],
q[j]); q[j]);
error = -1; return -1;
goto exit;
} }
} }
} }
@@ -221,6 +220,5 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
vlog("\n"); vlog("\n");
exit:
return error; return error;
} }

View File

@@ -97,7 +97,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
vlog_error( vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
error, j); error, j);
goto exit; return error;
} }
} }
else else
@@ -123,13 +123,13 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
sizeof(gOutBuffer[j]), &gOutBuffer[j]))) sizeof(gOutBuffer[j]), &gOutBuffer[j])))
{ {
LogBuildError(programs[j]); LogBuildError(programs[j]);
goto exit; return error;
} }
if ((error = clSetKernelArg(kernels[j][thread_id], 1, if ((error = clSetKernelArg(kernels[j][thread_id], 1,
sizeof(gInBuffer), &gInBuffer))) sizeof(gInBuffer), &gInBuffer)))
{ {
LogBuildError(programs[j]); LogBuildError(programs[j]);
goto exit; return error;
} }
if ((error = clEnqueueNDRangeKernel(gQueue, kernels[j][thread_id], if ((error = clEnqueueNDRangeKernel(gQueue, kernels[j][thread_id],
@@ -137,7 +137,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
NULL, NULL))) NULL, NULL)))
{ {
vlog_error("FAILED -- could not execute kernel\n"); vlog_error("FAILED -- could not execute kernel\n");
goto exit; return error;
} }
} }
@@ -158,7 +158,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
BUFFER_SIZE, gOut[j], 0, NULL, NULL))) BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
{ {
vlog_error("ReadArray failed %d\n", error); vlog_error("ReadArray failed %d\n", error);
goto exit; return error;
} }
} }
@@ -187,8 +187,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
"*%d vs. %d\n", "*%d vs. %d\n",
f->name, sizeNames[k], err, ((float *)gIn)[j], f->name, sizeNames[k], err, ((float *)gIn)[j],
((cl_uint *)gIn)[j], t[j], q[j]); ((cl_uint *)gIn)[j], t[j], q[j]);
error = -1; return -1;
goto exit;
} }
} }
} }
@@ -219,6 +218,5 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
vlog("\n"); vlog("\n");
exit:
return error; return error;
} }