initial import
[patches.git] / asterisk-pic-fix.patch
1 Index: codecs/gsm/src/k6opt.s
2 ===================================================================
3 --- codecs/gsm/src/k6opt.s (revision 49815)
4 +++ codecs/gsm/src/k6opt.s (working copy)
5 @@ -1,23 +1,24 @@
6 .file "k6opt.s"
7 .version "01.01"
8 -/* gcc2_compiled.: */
9 -.section .rodata
10 - .align 4
11 - .type coefs,@object
12 - .size coefs,24
13 -coefs:
14 - .value -134
15 - .value -374
16 - .value 0
17 - .value 2054
18 - .value 5741
19 - .value 8192
20 - .value 5741
21 - .value 2054
22 - .value 0
23 - .value -374
24 - .value -134
25 - .value 0
26 +
27 +/* load a mask into a mmx register ... use the stack to avoid TEXTRELS */
28 +.macro load_immq mask reg
29 + pushl $h_\mask
30 + pushl $l_\mask
31 + movq (%esp), \reg
32 +.endm
33 +.macro cleanup_immq num
34 + addl \num * 8, %esp
35 +.endm
36 +
37 +/* some coefficients for us to play with */
38 +.set h_coefs1, 0xFE8AFF7A /* -134 -374 */
39 +.set l_coefs1, 0x08060000 /* 0 2504 */
40 +.set h_coefs2, 0x2000166D /* 5741 8192 */
41 +.set l_coefs2, 0x0806166D /* 5741 2054 */
42 +.set h_coefs3, 0xFE8A0000 /* 0 -374 */
43 +.set l_coefs3, 0x0000FF7A /* -134 0 */
44 +
45 .text
46 .align 4
47 /* void Weighting_filter (const short *e, short *x) */
48 @@ -34,9 +35,10 @@ Weighting_filter:
49 addl $-10,%ebx
50 emms
51 movl $0x1000,%eax; movd %eax,%mm5 /* for rounding */
52 - movq coefs,%mm1
53 - movq coefs+8,%mm2
54 - movq coefs+16,%mm3
55 + load_immq coefs1, %mm1
56 + load_immq coefs2, %mm2
57 + load_immq coefs3, %mm3
58 + cleanup_immq 3
59 xorl %esi,%esi
60 .p2align 2
61 .L21:
62 @@ -229,6 +231,8 @@ k6iprod:
63
64 .align 4
65 /* void k6vsraw P3((short *p, int n, int bits) */
66 +.set h_ones, 0x00010001
67 +.set l_ones, 0x00010001
68 .globl k6vsraw
69 .type k6vsraw,@function
70 k6vsraw:
71 @@ -242,7 +246,8 @@ k6vsraw:
72 leal -16(%esi,%eax,2),%edx /* edx = top - 16 */
73 emms
74 movd %ecx,%mm3
75 - movq ones,%mm2
76 + load_immq ones, %mm2
77 + cleanup_immq 1
78 psllw %mm3,%mm2; psrlw $1,%mm2
79 cmpl %edx,%esi; ja .L306
80
81 @@ -362,22 +367,10 @@ k6vsllw:
82 .size k6vsllw,.Lfe5-k6vsllw
83
84
85 -.section .rodata
86 - .align 4
87 - .type extremes,@object
88 - .size extremes,8
89 -extremes:
90 - .long 0x80008000
91 - .long 0x7fff7fff
92 - .type ones,@object
93 - .size ones,8
94 -ones:
95 - .long 0x00010001
96 - .long 0x00010001
97 -
98 -.text
99 .align 4
100 /* long k6maxmin (const short *p, int n, short *out) */
101 +.set extremes_1, 0x80008000
102 +.set extremes_2, 0x7fff7fff
103 .globl k6maxmin
104 .type k6maxmin,@function
105 k6maxmin:
106 @@ -391,8 +384,10 @@ k6maxmin:
107
108 cmpl %edx,%esi
109 jbe .L52
110 - movd extremes,%mm0
111 - movd extremes+4,%mm1
112 + mov $extremes_1, %ecx
113 + movd %ecx, %mm0
114 + mov $extremes_2, %ecx
115 + movd %ecx, %mm1
116 jmp .L58
117
118 .p2align 2