summaryrefslogtreecommitdiffstats
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorcarlos <carlos@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-30 19:58:57 +0000
committercarlos <carlos@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-30 19:58:57 +0000
commit989816a46794eb30809abdfc54b872d9d01ccdf4 (patch)
tree871296de6da055e93d32b7275c42ab6acba8cf73 /gcc/optabs.c
parent98d08fbcc489d9707f09fb30a00e8976e08a8011 (diff)
downloadppe42-gcc-989816a46794eb30809abdfc54b872d9d01ccdf4.tar.gz
ppe42-gcc-989816a46794eb30809abdfc54b872d9d01ccdf4.zip
gcc/
2006-01-30 Carlos O'Donell <carlos@codesourcery.com> * optabs.c (prepare_cmp_insn): If unbaised and unsigned then bias the comparison routine return. gcc/testsuite/ 2006-01-30 Carlos O'Donell <carlos@codesourcery.com> * gcc.dg/unsigned-long-compare.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 48a3406dc6b..bdbb88cce33 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3711,18 +3711,24 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST_MAKE_BLOCK,
word_mode, 2, x, mode, y, mode);
+ /* There are two kinds of comparison routines. Biased routines
+ return 0/1/2, and unbiased routines return -1/0/1. Other parts
+ of gcc expect that the comparison operation is equivalent
+ to the modified comparison. For signed comparisons compare the
+ result against 1 in the biased case, and zero in the unbiased
+ case. For unsigned comparisons always compare against 1 after
+ biasing the unbased result by adding 1. This gives us a way to
+ represent LTU. */
*px = result;
*pmode = word_mode;
- if (TARGET_LIB_INT_CMP_BIASED)
- /* Integer comparison returns a result that must be compared
- against 1, so that even if we do an unsigned compare
- afterward, there is still a value that can represent the
- result "less than". */
- *py = const1_rtx;
- else
+ *py = const1_rtx;
+
+ if (!TARGET_LIB_INT_CMP_BIASED)
{
- *py = const0_rtx;
- *punsignedp = 1;
+ if (*punsignedp)
+ *px = plus_constant (result, 1);
+ else
+ *py = const0_rtx;
}
return;
}
OpenPOWER on IntegriCloud