diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-08 10:11:09 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-08 10:11:09 +0000 |
commit | 6195c0dd4e15f50ac89491b48e050751f8231304 (patch) | |
tree | 1f49de2cfcd902f18c22b5539315d7b0fb4db972 /gcc/config/arm/arm.c | |
parent | d7ce7f9586bca838e0dcc7e39100ffe6edcd74f3 (diff) | |
download | gcc-6195c0dd4e15f50ac89491b48e050751f8231304.tar.gz |
2012-03-08 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk [future 4.8] rev 185094 using svnmerge
2011-03-08 Basile Starynkevitch <basile@starynkevitch.net>
[gcc/]
* melt-build.tpl (meltframe.args): Add -Iinclude-fixed if it exists.
* melt-build.mk: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@185096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/arm/arm.c')
-rw-r--r-- | gcc/config/arm/arm.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 21816d65dcb..dfba8e15fc1 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -10037,6 +10037,42 @@ minmax_code (rtx x) } } +/* Match pair of min/max operators that can be implemented via usat/ssat. */ + +bool +arm_sat_operator_match (rtx lo_bound, rtx hi_bound, + int *mask, bool *signed_sat) +{ + /* The high bound must be a power of two minus one. */ + int log = exact_log2 (INTVAL (hi_bound) + 1); + if (log == -1) + return false; + + /* The low bound is either zero (for usat) or one less than the + negation of the high bound (for ssat). */ + if (INTVAL (lo_bound) == 0) + { + if (mask) + *mask = log; + if (signed_sat) + *signed_sat = false; + + return true; + } + + if (INTVAL (lo_bound) == -INTVAL (hi_bound) - 1) + { + if (mask) + *mask = log + 1; + if (signed_sat) + *signed_sat = true; + + return true; + } + + return false; +} + /* Return 1 if memory locations are adjacent. */ int adjacent_mem_locations (rtx a, rtx b) |