Skip to content

Commit 2753e74

Browse files
committed
addressing comments from alsepkow
1 parent 17786f1 commit 2753e74

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

tools/clang/unittests/HLSLExec/LongVectorOps.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ OP_DEFAULT_DEFINES(UnaryMath, Frexp, 1, "TestFrexp", "", " -DFUNC_FREXP=1")
129129
OP_DEFAULT(FloatSpecial, IsFinite, 1, "isfinite", "")
130130
OP_DEFAULT(FloatSpecial, IsInf, 1, "isinf", "")
131131
OP_DEFAULT(FloatSpecial, IsNan, 1, "isnan", "")
132-
OP(FloatSpecial, ModF, 1, "TestModF", "", " -DFUNC_TEST_MODF=1",
133-
"LongVectorOp", Default1, Default2, Default3)
132+
OP_DEFAULT_DEFINES(FloatSpecial, ModF, 1, "TestModF", "", " -DFUNC_TEST_MODF=1")
134133

135134
OP_DEFAULT(BinaryComparison, LessThan, 2, "", "<")
136135
OP_DEFAULT(BinaryComparison, LessEqual, 2, "", "<=")

tools/clang/unittests/HLSLExec/LongVectors.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,6 @@ static constexpr Operation Operations[] = {
103103
#include "LongVectorOps.def"
104104
};
105105

106-
#define OP_WITH_OUT_PARAM(OPERATION, TYPE, IMPL) \
107-
template <> struct ExpectedBuilder<OpType::OPERATION, TYPE> { \
108-
static std::vector<TYPE> buildExpected(Op<OpType::OPERATION, TYPE, 1>, \
109-
const InputSets<TYPE> &Inputs) { \
110-
DXASSERT_NOMSG(Inputs.size() == 1); \
111-
size_t VectorSize = Inputs[0].size(); \
112-
std::vector<TYPE> Expected; \
113-
Expected.resize(VectorSize * 2); \
114-
for (size_t I = 0; I < VectorSize; ++I) { \
115-
IMPL \
116-
} \
117-
return Expected; \
118-
} \
119-
};
120-
121106
constexpr const Operation &getOperation(OpType Op) {
122107
if (Op < OpType::NumOpTypes)
123108
return Operations[unsigned(Op)];
@@ -643,6 +628,21 @@ struct StrictValidation {
643628
#define DEFAULT_OP_2(OP, IMPL) OP_2(OP, DefaultValidation<T>, IMPL)
644629
#define DEFAULT_OP_3(OP, IMPL) OP_3(OP, DefaultValidation<T>, IMPL)
645630

631+
#define OP_WITH_OUT_PARAM_1(OPERATION, TYPE, IMPL) \
632+
template <> struct ExpectedBuilder<OpType::OPERATION, TYPE> { \
633+
static std::vector<TYPE> buildExpected(Op<OpType::OPERATION, TYPE, 1>, \
634+
const InputSets<TYPE> &Inputs) { \
635+
DXASSERT_NOMSG(Inputs.size() == 1); \
636+
const size_t VectorSize = Inputs[0].size(); \
637+
std::vector<TYPE> Expected; \
638+
Expected.resize(VectorSize * 2); \
639+
for (size_t I = 0; I < VectorSize; ++I) { \
640+
IMPL \
641+
} \
642+
return Expected; \
643+
} \
644+
};
645+
646646
//
647647
// TernaryMath
648648
//
@@ -1030,7 +1030,7 @@ DEFAULT_OP_1(OpType::Log2, (std::log2(A)));
10301030
// with special logic. Frexp is only supported for fp32 values.
10311031
template <> struct Op<OpType::Frexp, float, 1> : DefaultValidation<float> {};
10321032

1033-
OP_WITH_OUT_PARAM(Frexp, float, {
1033+
OP_WITH_OUT_PARAM_1(Frexp, float, {
10341034
int Exp = 0;
10351035
float Man = std::frexp(Inputs[0][I], &Exp);
10361036

@@ -1233,14 +1233,14 @@ FLOAT_SPECIAL_OP(OpType::IsNan, (std::isnan(A)));
12331233

12341234
template <typename T> struct Op<OpType::ModF, T, 1> : DefaultValidation<T> {};
12351235

1236-
OP_WITH_OUT_PARAM(ModF, float, {
1236+
OP_WITH_OUT_PARAM_1(ModF, float, {
12371237
float Exp = 0.0f;
12381238
float Man = std::modf(Inputs[0][I], &Exp);
12391239
Expected[I] = Man;
12401240
Expected[I + VectorSize] = Exp;
12411241
});
12421242

1243-
OP_WITH_OUT_PARAM(ModF, HLSLHalf_t, {
1243+
OP_WITH_OUT_PARAM_1(ModF, HLSLHalf_t, {
12441244
float Exp = 0.0f;
12451245
float Inp = float(Inputs[0][I]);
12461246
float Man = std::modf(Inp, &Exp);

0 commit comments

Comments
 (0)