[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(
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
error, j);
goto exit;
return error;
}
}
else
@@ -124,13 +124,13 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
sizeof(gOutBuffer[j]), &gOutBuffer[j])))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
if ((error = clSetKernelArg(kernels[j][thread_id], 1,
sizeof(gInBuffer), &gInBuffer)))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
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)))
{
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)))
{
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",
f->name, sizeNames[k], err, ((double *)gIn)[j], t[j],
q[j]);
error = -1;
goto exit;
return -1;
}
}
}
@@ -221,6 +220,5 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
vlog("\n");
exit:
return error;
}

View File

@@ -97,7 +97,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
error, j);
goto exit;
return error;
}
}
else
@@ -123,13 +123,13 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
sizeof(gOutBuffer[j]), &gOutBuffer[j])))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
if ((error = clSetKernelArg(kernels[j][thread_id], 1,
sizeof(gInBuffer), &gInBuffer)))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
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)))
{
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)))
{
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",
f->name, sizeNames[k], err, ((float *)gIn)[j],
((cl_uint *)gIn)[j], t[j], q[j]);
error = -1;
goto exit;
return -1;
}
}
}
@@ -219,6 +218,5 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
vlog("\n");
exit:
return error;
}