summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-csl-arm/gcc_optab_arm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-csl-arm/gcc_optab_arm.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-csl-arm/gcc_optab_arm.patch97
1 files changed, 0 insertions, 97 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-csl-arm/gcc_optab_arm.patch b/meta/recipes-devtools/gcc/gcc-csl-arm/gcc_optab_arm.patch
deleted file mode 100644
index 5738a470ff..0000000000
--- a/meta/recipes-devtools/gcc/gcc-csl-arm/gcc_optab_arm.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1Upstream-Status: Pending
2
3ARM is the only architecture that has a helper function that returns
4an unbiased result. This fix is trivial enough that we can show it
5doesn't effect any of the other arches. Can we consider this a
6regression fix since it used to work until the helper was added :}
7
8Tested with no regressions on x86_64-pc-linux-gnu and arm-none-eabi.
9
10Cheers,
11Carlos.
12--
13Carlos O'Donell
14CodeSourcery
15carlos@codesourcery.com
16(650) 331-3385 x716
17
18gcc/
19
202006-01-27 Carlos O'Donell <carlos@codesourcery.com>
21
22 * optabs.c (prepare_cmp_insn): If unbaised and unsigned then bias
23 the comparison routine return.
24
25gcc/testsuite/
26
272006-01-27 Carlos O'Donell <carlos@codesourcery.com>
28
29 * gcc.dg/unsigned-long-compare.c: New test.
30
31Index: gcc/optabs.c
32===================================================================
33--- 1/gcc/optabs.c (revision 110300)
34+++ 2/gcc/optabs.c (working copy)
35@@ -3711,18 +3711,24 @@
36 result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST_MAKE_BLOCK,
37 word_mode, 2, x, mode, y, mode);
38
39+ /* There are two kinds of comparison routines. Biased routines
40+ return 0/1/2, and unbiased routines return -1/0/1. Other parts
41+ of gcc expect that the comparison operation is equivalent
42+ to the modified comparison. For signed comparisons compare the
43+ result against 1 in the unbiased case, and zero in the biased
44+ case. For unsigned comparisons always compare against 1 after
45+ biasing the unbased result by adding 1. This gives us a way to
46+ represent LTU. */
47 *px = result;
48 *pmode = word_mode;
49- if (TARGET_LIB_INT_CMP_BIASED)
50- /* Integer comparison returns a result that must be compared
51- against 1, so that even if we do an unsigned compare
52- afterward, there is still a value that can represent the
53- result "less than". */
54- *py = const1_rtx;
55- else
56+ *py = const1_rtx;
57+
58+ if (!TARGET_LIB_INT_CMP_BIASED)
59 {
60- *py = const0_rtx;
61- *punsignedp = 1;
62+ if (*punsignedp)
63+ *px = plus_constant (result, 1);
64+ else
65+ *py = const0_rtx;
66 }
67 return;
68 }
69Index: gcc/testsuite/gcc.dg/unsigned-long-compare.c
70===================================================================
71--- 1/gcc/testsuite/gcc.dg/unsigned-long-compare.c (revision 0)
72+++ 2/gcc/testsuite/gcc.dg/unsigned-long-compare.c (revision 0)
73@@ -0,0 +1,24 @@
74+/* Copyright (C) 2006 Free Software Foundation, Inc. */
75+/* Contributed by Carlos O'Donell on 2006-01-27 */
76+
77+/* Test a division corner case where the expression simplifies
78+ to a comparison, and the optab expansion is wrong. The optab
79+ expansion emits a function whose return is unbiased and needs
80+ adjustment. */
81+/* Origin: Carlos O'Donell <carlos@codesourcery.com> */
82+/* { dg-do run { target arm-*-*eabi* } } */
83+/* { dg-options "" } */
84+#include <stdlib.h>
85+
86+#define BIG_CONSTANT 0xFFFFFFFF80000000ULL
87+
88+int main (void)
89+{
90+ unsigned long long OneULL = 1ULL;
91+ unsigned long long result;
92+
93+ result = OneULL / BIG_CONSTANT;
94+ if (result)
95+ abort ();
96+ exit (0);
97+}