*
*/
+#if defined(__GNUC__) && __GNUC__ < 5 && defined(__PIC__)
+# define BOUNDED_EBX
+#endif
+
/*
* for plain i386
*/
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_EBX
unsigned int old_ebx;
-
+#endif
/*
* ESI - src
* EDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_EBX
"\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
+#endif
/*
* initialization, load ESI, EDI, EBX registers
*/
"\tjnz 1b\n"
"7:"
+#ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
-
- : [size] "+m" (size), [old_ebx] "=m" (old_ebx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_EBX
+ , [old_ebx] "=m" (old_ebx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_EBX
+ , "ebx"
+#endif
);
}
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_EBX
unsigned int old_ebx;
-
+#endif
/*
* ESI - src
* EDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_EBX
"\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
+#endif
/*
* initialization, load ESI, EDI, EBX registers
*/
"\tjnz 1b\n"
"\temms\n"
"5:"
+#ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
-
- : [size] "+m" (size), [old_ebx] "=m" (old_ebx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_EBX
+ , [old_ebx] "=m" (old_ebx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_EBX
+ , "ebx"
+#endif
#ifdef HAVE_MMX
, "mm0"
#else
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_EBX
unsigned int old_ebx;
-
+#endif
/*
* ESI - src
* EDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_EBX
"\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
+#endif
/*
* initialization, load ESI, EDI, EBX registers
*/
"\tjmp 1b\n"
"6:"
+#ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
-
- : [size] "+m" (size), [old_ebx] "=m" (old_ebx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_EBX
+ , [old_ebx] "=m" (old_ebx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_EBX
+ , "ebx"
+#endif
);
}
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_EBX
unsigned int old_ebx;
-
+#endif
/*
* ESI - src
* EDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_EBX
"\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
+#endif
/*
* initialization, load ESI, EDI, EBX registers
*/
"\tjmp 1b\n"
"6:"
+#ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
-
- : [size] "+m" (size), [old_ebx] "=m" (old_ebx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_EBX
+ , [old_ebx] "=m" (old_ebx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_EBX
+ , "ebx"
+#endif
);
}
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_EBX
unsigned int old_ebx;
-
+#endif
/*
* ESI - src
* EDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_EBX
"\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
+#endif
/*
* initialization, load ESI, EDI, EBX registers
*/
"\tjnz 1b\n"
"6:"
+#ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
-
- : [size] "+m" (size), [old_ebx] "=m" (old_ebx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_EBX
+ , [old_ebx] "=m" (old_ebx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "esi", "edi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_EBX
+ , "ebx"
+#endif
);
}
+
+#ifdef BOUNDED_EBX
+# undef BOUNDED_EBX
+#endif
*
*/
+#if defined(__GNUC__) && __GNUC__ < 5 && defined(__PIC__)
+# define BOUNDED_RBX
+#endif
+
/*
* MMX optimized
*/
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_RBX
unsigned long long old_rbx;
-
+#endif
/*
* RSI - src
* RDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_RBX
"\tmovq %%rbx, %[old_rbx]\n"
+#endif
/*
* initialization, load RSI, RDI, RBX registers
*/
"6:"
"\temms\n"
+#ifdef BOUNDED_RBX
"\tmovq %[old_rbx], %%rbx\n"
-
- : [size] "+m" (size), [old_rbx] "=m" (old_rbx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_RBX
+ , [old_rbx] "=m" (old_rbx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_RBX
+ , "rbx"
+#endif
#ifdef HAVE_MMX
, "mm0"
#else
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_RBX
unsigned long long old_rbx;
-
+#endif
/*
* RSI - src
* RDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_RBX
"\tmovq %%rbx, %[old_rbx]\n"
+#endif
/*
* initialization, load RSI, RDI, RBX registers
*/
"\tjnz 1b\n"
"6:"
+#ifdef BOUNDED_RBX
"\tmovq %[old_rbx], %%rbx\n"
-
- : [size] "+m" (size), [old_rbx] "=m" (old_rbx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_RBX
+ , [old_rbx] "=m" (old_rbx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_RBX
+ , "rbx"
+#endif
);
}
volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step)
{
+#ifdef BOUNDED_RBX
unsigned long long old_rbx;
-
+#endif
/*
* RSI - src
* RDI - dst
*/
__asm__ __volatile__ (
"\n"
-
+#ifdef BOUNDED_RBX
"\tmovq %%rbx, %[old_rbx]\n"
+#endif
/*
* initialization, load RSI, RDI, RBX registers
*/
"\tjnz 1b\n"
"6:"
+#ifdef BOUNDED_RBX
"\tmovq %[old_rbx], %%rbx\n"
-
- : [size] "+m" (size), [old_rbx] "=m" (old_rbx)
+#endif
+ : [size] "+m" (size)
+#ifdef BOUNDED_RBX
+ , [old_rbx] "=m" (old_rbx)
+#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
+#ifndef BOUNDED_RBX
+ , "rbx"
+#endif
);
}
+
+#ifdef BOUNDED_RBX
+# undef BOUNDED_RBX
+#endif