Commit bbbf30ee authored by Frank Barchard's avatar Frank Barchard

Remove volatile from variables to improve performance

BUG=libyuv:703
TEST=compile and disassemble.  see registers used not stack.
R=wangcheng@google.com

Change-Id: Iaa07ee5d0c35252994491bb2868276e161149efd
Reviewed-on: https://chromium-review.googlesource.com/500427
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: 's avatarCheng Wang <wangcheng@google.com>
parent 2136e349
...@@ -19,7 +19,7 @@ extern "C" { ...@@ -19,7 +19,7 @@ extern "C" {
#if ORIGINAL_C #if ORIGINAL_C
uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) { uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 diff = 0u; uint32 diff = 0u;
int i; int i;
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i) {
...@@ -39,7 +39,7 @@ uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) { ...@@ -39,7 +39,7 @@ uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) {
// Hakmem method for hamming distance. // Hakmem method for hamming distance.
uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) { uint32 HammingDistance_C(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 diff = 0u; uint32 diff = 0u;
int i; int i;
for (i = 0; i < count - 3; i += 4) { for (i = 0; i < count - 3; i += 4) {
......
...@@ -23,7 +23,7 @@ extern "C" { ...@@ -23,7 +23,7 @@ extern "C" {
(defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER))) (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER)))
uint32 HammingDistance_X86(const uint8* src_a, const uint8* src_b, int count) { uint32 HammingDistance_X86(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 diff = 0u; uint32 diff = 0u;
int i; int i;
for (i = 0; i < count - 7; i += 8) { for (i = 0; i < count - 7; i += 8) {
......
...@@ -22,7 +22,7 @@ extern "C" { ...@@ -22,7 +22,7 @@ extern "C" {
!defined(__aarch64__) !defined(__aarch64__)
uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) { uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 sse; uint32 sse;
asm volatile ( asm volatile (
"vmov.u8 q8, #0 \n" "vmov.u8 q8, #0 \n"
"vmov.u8 q10, #0 \n" "vmov.u8 q10, #0 \n"
......
...@@ -22,7 +22,7 @@ extern "C" { ...@@ -22,7 +22,7 @@ extern "C" {
#if 0 #if 0
uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) { uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 diff; uint32 diff;
asm volatile ( asm volatile (
"eor v4.16b, v4.16b, v4.16b \n" "eor v4.16b, v4.16b, v4.16b \n"
"eor v5.16b, v5.16b, v5.16b \n" "eor v5.16b, v5.16b, v5.16b \n"
...@@ -51,7 +51,7 @@ uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) { ...@@ -51,7 +51,7 @@ uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
#endif #endif
uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) { uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 diff; uint32 diff;
asm volatile ( asm volatile (
"movi d6, #0 \n" "movi d6, #0 \n"
...@@ -82,7 +82,7 @@ uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) { ...@@ -82,7 +82,7 @@ uint32 HammingDistance_NEON(const uint8* src_a, const uint8* src_b, int count) {
} }
uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) { uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count) {
volatile uint32 sse; uint32 sse;
asm volatile ( asm volatile (
"eor v16.16b, v16.16b, v16.16b \n" "eor v16.16b, v16.16b, v16.16b \n"
"eor v18.16b, v18.16b, v18.16b \n" "eor v18.16b, v18.16b, v18.16b \n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment