[PATCH] D138924: [test-suite][tsvc] Use fabs in s318 and s3113
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 07:07:49 PST 2022
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: rengolin, fhahn, jdoerfert, hfinkel.
Herald added a project: All.
SjoerdMeijer requested review of this revision.
In the s318 and s3113 kernels, the integer variant of the `abs()` function was to determined the absolute value. It operates on a float value, and the result is stored in a variable `max` which has the float type, which makes me think the intention here was to use `fabs()` variant, not the integer `abs()` variant.
https://reviews.llvm.org/D138924
Files:
MultiSource/Benchmarks/TSVC/tsc.inc
MultiSource/Benchmarks/TSVC/types.h
Index: MultiSource/Benchmarks/TSVC/types.h
===================================================================
--- MultiSource/Benchmarks/TSVC/types.h
+++ MultiSource/Benchmarks/TSVC/types.h
@@ -5,11 +5,14 @@
#define LEN2 256
#ifndef TYPE
-#define TYPE float
+ #define TYPE float
+ #define FABS(x) fabsf(x)
+#else
+ #define FABS(x) fabs(x)
#endif
#ifndef X_TYPE
-#define X_TYPE TYPE
+ #define X_TYPE TYPE
#endif
#ifndef ALIGNMENT
Index: MultiSource/Benchmarks/TSVC/tsc.inc
===================================================================
--- MultiSource/Benchmarks/TSVC/tsc.inc
+++ MultiSource/Benchmarks/TSVC/tsc.inc
@@ -3760,14 +3760,14 @@
for (int nl = 0; nl < ntimes/2; nl++) {
k = 0;
index = 0;
- max = abs(a[0]);
+ max = FABS(a[0]);
k += inc;
for (int i = 1; i < LEN; i++) {
- if (abs(a[k]) <= max) {
+ if (FABS(a[k]) <= max) {
goto L5;
}
index = i;
- max = abs(a[k]);
+ max = FABS(a[k]);
L5:
k += inc;
}
@@ -3971,10 +3971,10 @@
TYPE max;
for (int nl = 0; nl < ntimes*4; nl++) {
- max = abs(a[0]);
+ max = FABS(a[0]);
for (int i = 0; i < LEN; i++) {
- if ((abs(a[i])) > max) {
- max = abs(a[i]);
+ if ((FABS(a[i])) > max) {
+ max = FABS(a[i]);
}
}
dummy(a, b, c, d, e, aa, bb, cc, max);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138924.478581.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221129/d7a34419/attachment.bin>
More information about the llvm-commits
mailing list