forked from opencv/opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
- Loading branch information
Showing
14 changed files
with
203 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// check sanity of vsx aligned ld/st | ||
// https://github.com/opencv/opencv/issues/13211 | ||
|
||
#include <altivec.h> | ||
|
||
#define vsx_ld vec_vsx_ld | ||
#define vsx_st vec_vsx_st | ||
|
||
template<typename T> | ||
static void fill(T& d, int from = 0, int to = 16) | ||
{ | ||
for (int i = from; i < to; i++) | ||
d[i] = i; | ||
} | ||
|
||
template<typename T, typename Tvec> | ||
static bool check_data(T& d, Tvec& v, int from = 0, int to = 16) | ||
{ | ||
for (int i = from; i < to; i++) | ||
{ | ||
if (d[i] != vec_extract(v, i)) | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
int main() | ||
{ | ||
unsigned char __attribute__ ((aligned (16))) rbuf[16]; | ||
unsigned char __attribute__ ((aligned (16))) wbuf[16]; | ||
__vector unsigned char a; | ||
|
||
// 1- check aligned load and store | ||
fill(rbuf); | ||
a = vec_ld(0, rbuf); | ||
if (!check_data(rbuf, a)) | ||
return 1; | ||
vec_st(a, 0, wbuf); | ||
if (!check_data(wbuf, a)) | ||
return 11; | ||
|
||
// 2- check mixing aligned load and unaligned store | ||
a = vec_ld(0, rbuf); | ||
vsx_st(a, 0, wbuf); | ||
if (!check_data(wbuf, a)) | ||
return 2; | ||
|
||
// 3- check mixing unaligned load and aligned store | ||
a = vsx_ld(0, rbuf); | ||
vec_st(a, 0, wbuf); | ||
if (!check_data(wbuf, a)) | ||
return 3; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.