diff options
| author | carrot <carrot@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-27 23:00:54 +0000 |
|---|---|---|
| committer | carrot <carrot@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-27 23:00:54 +0000 |
| commit | 3124cebd384eaa2700301e16992b800b02544042 (patch) | |
| tree | 078fd737cd0729d6f98934885164977c9638dff4 | |
| parent | 0065d92f0dc45afbcb52b077aa4a95b56bbe54b2 (diff) | |
| download | ppe42-gcc-3124cebd384eaa2700301e16992b800b02544042.tar.gz ppe42-gcc-3124cebd384eaa2700301e16992b800b02544042.zip | |
PR target/62262
* config/aarch64/aarch64.md (*andim_ashift<mode>_bfiz): Check the shift
amount before using it.
* gcc.target/aarch64/pr62262.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@214610 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/config/aarch64/aarch64.md | 3 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.target/aarch64/pr62262.c | 20 |
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3610de6515a..8ef3609cf3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-08-27 Guozhi Wei <carrot@google.com> + + PR target/62262 + * config/aarch64/aarch64.md (*andim_ashift<mode>_bfiz): Check the shift + amount before using it. + 2014-08-26 Joel Sherrill <joel.sherrill@oarcorp.com> * doc/invoke.texi: -fno-cxa-atexit should be -fno-use-cxa-atexit. diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index df81045e96f..319f80591bb 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3157,7 +3157,8 @@ (and:GPI (ashift:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand 2 "const_int_operand" "n")) (match_operand 3 "const_int_operand" "n")))] - "exact_log2 ((INTVAL (operands[3]) >> INTVAL (operands[2])) + 1) >= 0 + "(INTVAL (operands[2]) < (<GPI:sizen>)) + && exact_log2 ((INTVAL (operands[3]) >> INTVAL (operands[2])) + 1) >= 0 && (INTVAL (operands[3]) & ((1 << INTVAL (operands[2])) - 1)) == 0" "ubfiz\\t%<w>0, %<w>1, %2, %P3" [(set_attr "type" "bfm")] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ee5aa3afc4..4e56ec2f041 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-08-27 Guozhi Wei <carrot@google.com> + + PR target/62262 + * gcc.target/aarch64/pr62262.c: New test. + 2014-08-26 Dominik Vogt <vogt@linux.vnet.ibm.com> * gfortran.dg/bessel_7.f90: Bump allowed precision to avoid diff --git a/gcc/testsuite/gcc.target/aarch64/pr62262.c b/gcc/testsuite/gcc.target/aarch64/pr62262.c new file mode 100644 index 00000000000..5bf90bf7fe3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr62262.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-use" } */ + +static inline int CLZ(int mask) { + return mask ? __builtin_clz(mask) : 32; +} + +int foo(int value) +{ + if (value == 0) + return 0; + + int bias = CLZ(value); + value >>= bias; + int zeros = CLZ(value << 1); + value <<= zeros; + + int packed = (unsigned)(value << 9) >> 9; + return packed; +} |

