Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: third_party/libpng/pnggccrd.c

Issue 1118002: libpng: update to 1.2.43 (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* pnggccrd.c was removed from libpng-1.2.20. */ 1 /* pnggccrd.c was removed from libpng-1.2.20. */
2 2
3 /* This code snippet is for use by configure's compilation test. */ 3 /* This code snippet is for use by configure's compilation test. */
4 4
5 #if (!defined _MSC_VER) && \ 5 #if (!defined _MSC_VER) && \
6 defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ 6 defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
7 defined(PNG_MMX_CODE_SUPPORTED) 7 defined(PNG_MMX_CODE_SUPPORTED)
8 8
9 int PNGAPI png_dummy_mmx_support(void); 9 int PNGAPI png_dummy_mmx_support(void);
10 10
11 static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested 11 static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested
12 12
13 int PNGAPI 13 int PNGAPI
14 png_dummy_mmx_support(void) __attribute__((noinline)); 14 png_dummy_mmx_support(void) __attribute__((noinline));
15 15
16 int PNGAPI 16 int PNGAPI
17 png_dummy_mmx_support(void) 17 png_dummy_mmx_support(void)
18 { 18 {
19 int result; 19 int result;
20 #if defined(PNG_MMX_CODE_SUPPORTED) // superfluous, but what the heck 20 #ifdef PNG_MMX_CODE_SUPPORTED // superfluous, but what the heck
21 __asm__ __volatile__ ( 21 __asm__ __volatile__ (
22 #if defined(__x86_64__) 22 #ifdef __x86_64__
23 "pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction 23 "pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
24 "pushq %%rcx \n\t" // so does rcx... 24 "pushq %%rcx \n\t" // so does rcx...
25 "pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux) 25 "pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
26 "pushfq \n\t" // save Eflag to stack 26 "pushfq \n\t" // save Eflag to stack
27 "popq %%rax \n\t" // get Eflag from stack into rax 27 "popq %%rax \n\t" // get Eflag from stack into rax
28 "movq %%rax, %%rcx \n\t" // make another copy of Eflag in rcx 28 "movq %%rax, %%rcx \n\t" // make another copy of Eflag in rcx
29 "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21) 29 "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
30 "pushq %%rax \n\t" // save modified Eflag back to stack 30 "pushq %%rax \n\t" // save modified Eflag back to stack
31 "popfq \n\t" // restore modified value to Eflag reg 31 "popfq \n\t" // restore modified value to Eflag reg
32 "pushfq \n\t" // save Eflag to stack 32 "pushfq \n\t" // save Eflag to stack
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23) 64 "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
65 "cmpl $0, %%edx \n\t" // 0 = MMX not supported 65 "cmpl $0, %%edx \n\t" // 0 = MMX not supported
66 "jz 0f \n\t" // non-zero = yes, MMX IS supported 66 "jz 0f \n\t" // non-zero = yes, MMX IS supported
67 67
68 "movl $1, %%eax \n\t" // set return value to 1 68 "movl $1, %%eax \n\t" // set return value to 1
69 "jmp 1f \n\t" // DONE: have MMX support 69 "jmp 1f \n\t" // DONE: have MMX support
70 70
71 "0: \n\t" // .NOT_SUPPORTED: target label for jump in structions 71 "0: \n\t" // .NOT_SUPPORTED: target label for jump in structions
72 "movl $0, %%eax \n\t" // set return value to 0 72 "movl $0, %%eax \n\t" // set return value to 0
73 "1: \n\t" // .RETURN: target label for jump instructi ons 73 "1: \n\t" // .RETURN: target label for jump instructi ons
74 #if defined(__x86_64__) 74 #ifdef __x86_64__
75 "popq %%rdx \n\t" // restore rdx 75 "popq %%rdx \n\t" // restore rdx
76 "popq %%rcx \n\t" // restore rcx 76 "popq %%rcx \n\t" // restore rcx
77 "popq %%rbx \n\t" // restore rbx 77 "popq %%rbx \n\t" // restore rbx
78 #else 78 #else
79 "popl %%edx \n\t" // restore edx 79 "popl %%edx \n\t" // restore edx
80 "popl %%ecx \n\t" // restore ecx 80 "popl %%ecx \n\t" // restore ecx
81 "popl %%ebx \n\t" // restore ebx 81 "popl %%ebx \n\t" // restore ebx
82 #endif 82 #endif
83 83
84 // "ret \n\t" // DONE: no MMX support 84 // "ret \n\t" // DONE: no MMX support
85 // (fall through to standard C "ret") 85 // (fall through to standard C "ret")
86 86
87 : "=a" (result) // output list 87 : "=a" (result) // output list
88 88
89 : // any variables used on input (none) 89 : // any variables used on input (none)
90 90
91 // no clobber list 91 // no clobber list
92 // , "%ebx", "%ecx", "%edx" // GRR: we handle these manually 92 // , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
93 // , "memory" // if write to a variable gcc thought was in a reg 93 // , "memory" // if write to a variable gcc thought was in a reg
94 // , "cc" // "condition codes" (flag bits) 94 // , "cc" // "condition codes" (flag bits)
95 ); 95 );
96 _mmx_supported = result; 96 _mmx_supported = result;
97 #else 97 #else
98 _mmx_supported = 0; 98 _mmx_supported = 0;
99 #endif /* PNG_MMX_CODE_SUPPORTED */ 99 #endif /* PNG_MMX_CODE_SUPPORTED */
100 100
101 return _mmx_supported; 101 return _mmx_supported;
102 } 102 }
103 #endif 103 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698