summaryrefslogtreecommitdiff
path: root/patches/gmp/5.0.1/120-fix-r0-clobbering-issue.patch
blob: d12d6b2c74f5940e4aa7193be4596ae894dc24f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Removed ChangeLog part

# HG changeset patch
# User Torbjorn Granlund <tege@gmplib.org>
# Date 1342891151 -7200
# Node ID 829215e83ff1db3cd00e510a737092df691442d5
# Parent  816c18dbd492050ef8892e91602d9e758abc2988
Fix r0 clobbering issue with "large" code affecting elf+darwin PIC.

diff -r 816c18dbd492 -r 829215e83ff1 mpn/powerpc32/vmx/mod_34lsub1.asm
--- a/mpn/powerpc32/vmx/mod_34lsub1.asm	Tue Jun 19 15:02:48 2012 +0200
+++ b/mpn/powerpc32/vmx/mod_34lsub1.asm	Sat Jul 21 19:19:11 2012 +0200
@@ -1,6 +1,7 @@
 dnl  PowerPC-32 mpn_mod_34lsub1 -- mpn remainder mod 2^24-1.
 
-dnl  Copyright 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+dnl  Copyright 2002, 2003, 2005, 2006, 2007, 2012 Free Software Foundation,
+dnl  Inc.
 
 dnl  This file is part of the GNU MP Library.
 
@@ -135,15 +136,15 @@
 
 	andi.	r7, up, 15
 	vxor	a0, v0, v0
-	lis	r0, 0xaaaa
+	lis	r9, 0xaaaa
 	vxor	a1, v0, v0
-	ori	r0, r0, 0xaaab
+	ori	r9, r9, 0xaaab
 	vxor	a2, v0, v0
 	li	r5, 16
 	vxor	c0, v0, v0
 	li	r6, 32
 	vxor	c1, v0, v0
-	LEAL(	r11, cnsts)
+	LEAL(	r11, cnsts)		C CAUTION clobbers r0 for elf, darwin
 	vxor	c2, v0, v0
 	vxor	z, v0, v0
 
@@ -158,7 +159,7 @@
 	vsldoi	a2, z, a2, 12
 
 	addi	n, n, 9
-	mulhwu	r0, n, r0
+	mulhwu	r0, n, r9
 	srwi	r0, r0, 3		C r0 = floor(n/12)
 	mtctr	r0
 
@@ -174,7 +175,7 @@
 	vsldoi	a1, z, a1, 8
 
 	addi	n, n, 6
-	mulhwu	r0, n, r0
+	mulhwu	r0, n, r9
 	srwi	r0, r0, 3		C r0 = floor(n/12)
 	mtctr	r0
 
@@ -188,7 +189,7 @@
 	vsldoi	a0, z, a0, 4
 
 	addi	n, n, 3
-	mulhwu	r0, n, r0
+	mulhwu	r0, n, r9
 	srwi	r0, r0, 3		C r0 = floor(n/12)
 	mtctr	r0
 
@@ -197,7 +198,7 @@
 	b	L(0)
 
 L(aligned16):
-	mulhwu	r0, n, r0
+	mulhwu	r0, n, r9
 	srwi	r0, r0, 3		C r0 = floor(n/12)
 	mtctr	r0