Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
swiftshader
Commits
35ec373d
Commit
35ec373d
authored
Jul 18, 2014
by
Matt Wala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix array index in test initialization.
Index() % NumElementsInType should be Index() % NumValues. BUG=none R=stichnot@chromium.org Review URL:
https://codereview.chromium.org/404553007
parent
7b34b597
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
test_arith_main.cpp
crosstest/test_arith_main.cpp
+8
-7
No files found.
crosstest/test_arith_main.cpp
View file @
35ec373d
...
@@ -19,9 +19,6 @@ namespace Subzero_ {
...
@@ -19,9 +19,6 @@ namespace Subzero_ {
#include "test_arith.h"
#include "test_arith.h"
}
}
volatile
unsigned
Values
[]
=
INT_VALUE_ARRAY
;
const
static
size_t
NumValues
=
sizeof
(
Values
)
/
sizeof
(
*
Values
);
template
<
class
T
>
bool
inputsMayTriggerException
(
T
Value1
,
T
Value2
)
{
template
<
class
T
>
bool
inputsMayTriggerException
(
T
Value1
,
T
Value2
)
{
// Avoid HW divide-by-zero exception.
// Avoid HW divide-by-zero exception.
if
(
Value2
==
0
)
if
(
Value2
==
0
)
...
@@ -37,6 +34,8 @@ template <typename TypeUnsigned, typename TypeSigned>
...
@@ -37,6 +34,8 @@ template <typename TypeUnsigned, typename TypeSigned>
void
testsInt
(
size_t
&
TotalTests
,
size_t
&
Passes
,
size_t
&
Failures
)
{
void
testsInt
(
size_t
&
TotalTests
,
size_t
&
Passes
,
size_t
&
Failures
)
{
typedef
TypeUnsigned
(
*
FuncTypeUnsigned
)(
TypeUnsigned
,
TypeUnsigned
);
typedef
TypeUnsigned
(
*
FuncTypeUnsigned
)(
TypeUnsigned
,
TypeUnsigned
);
typedef
TypeSigned
(
*
FuncTypeSigned
)(
TypeSigned
,
TypeSigned
);
typedef
TypeSigned
(
*
FuncTypeSigned
)(
TypeSigned
,
TypeSigned
);
volatile
unsigned
Values
[]
=
INT_VALUE_ARRAY
;
const
static
size_t
NumValues
=
sizeof
(
Values
)
/
sizeof
(
*
Values
);
static
struct
{
static
struct
{
const
char
*
Name
;
const
char
*
Name
;
FuncTypeUnsigned
FuncLlc
;
FuncTypeUnsigned
FuncLlc
;
...
@@ -160,6 +159,8 @@ template <typename TypeUnsigned, typename TypeSigned,
...
@@ -160,6 +159,8 @@ template <typename TypeUnsigned, typename TypeSigned,
void
testsVecInt
(
size_t
&
TotalTests
,
size_t
&
Passes
,
size_t
&
Failures
)
{
void
testsVecInt
(
size_t
&
TotalTests
,
size_t
&
Passes
,
size_t
&
Failures
)
{
typedef
TypeUnsigned
(
*
FuncTypeUnsigned
)(
TypeUnsigned
,
TypeUnsigned
);
typedef
TypeUnsigned
(
*
FuncTypeUnsigned
)(
TypeUnsigned
,
TypeUnsigned
);
typedef
TypeSigned
(
*
FuncTypeSigned
)(
TypeSigned
,
TypeSigned
);
typedef
TypeSigned
(
*
FuncTypeSigned
)(
TypeSigned
,
TypeSigned
);
volatile
unsigned
Values
[]
=
INT_VALUE_ARRAY
;
const
static
size_t
NumValues
=
sizeof
(
Values
)
/
sizeof
(
*
Values
);
static
struct
{
static
struct
{
const
char
*
Name
;
const
char
*
Name
;
FuncTypeUnsigned
FuncLlc
;
FuncTypeUnsigned
FuncLlc
;
...
@@ -192,8 +193,8 @@ void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
...
@@ -192,8 +193,8 @@ void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
// Initialize the test vectors.
// Initialize the test vectors.
TypeUnsigned
Value1
,
Value2
;
TypeUnsigned
Value1
,
Value2
;
for
(
size_t
j
=
0
;
j
<
NumElementsInType
;)
{
for
(
size_t
j
=
0
;
j
<
NumElementsInType
;)
{
ElementTypeUnsigned
Element1
=
Values
[
Index
()
%
Num
ElementsInType
];
ElementTypeUnsigned
Element1
=
Values
[
Index
()
%
Num
Values
];
ElementTypeUnsigned
Element2
=
Values
[
Index
()
%
Num
ElementsInType
];
ElementTypeUnsigned
Element2
=
Values
[
Index
()
%
Num
Values
];
if
(
Funcs
[
f
].
ExcludeDivExceptions
&&
if
(
Funcs
[
f
].
ExcludeDivExceptions
&&
inputsMayTriggerException
<
ElementTypeSigned
>
(
Element1
,
Element2
))
inputsMayTriggerException
<
ElementTypeSigned
>
(
Element1
,
Element2
))
continue
;
continue
;
...
@@ -310,8 +311,8 @@ void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
...
@@ -310,8 +311,8 @@ void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
// Initialize the test vectors.
// Initialize the test vectors.
v4f32
Value1
,
Value2
;
v4f32
Value1
,
Value2
;
for
(
size_t
j
=
0
;
j
<
NumElementsInType
;
++
j
)
{
for
(
size_t
j
=
0
;
j
<
NumElementsInType
;
++
j
)
{
Value1
[
j
]
=
Values
[
Index
()
%
Num
ElementsInType
];
Value1
[
j
]
=
Values
[
Index
()
%
Num
Values
];
Value2
[
j
]
=
Values
[
Index
()
%
Num
ElementsInType
];
Value2
[
j
]
=
Values
[
Index
()
%
Num
Values
];
}
}
// Perform the test.
// Perform the test.
v4f32
ResultSz
=
Funcs
[
f
].
FuncSz
(
Value1
,
Value2
);
v4f32
ResultSz
=
Funcs
[
f
].
FuncSz
(
Value1
,
Value2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment