aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-11-14 13:36:59 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-11-14 13:36:59 +0100
commit5bfba2b58ddb37c89e0633a2dc48fa8c4430a026 (patch)
tree3301ff30b33aa7dca70e7973ded9ef79e67615d8 /gcc/config
parentff4d8480403be6ab92e07f6981e7bfc04c3863c9 (diff)
downloadgcc-5bfba2b58ddb37c89e0633a2dc48fa8c4430a026.zip
gcc-5bfba2b58ddb37c89e0633a2dc48fa8c4430a026.tar.gz
gcc-5bfba2b58ddb37c89e0633a2dc48fa8c4430a026.tar.bz2
re PR rtl-optimization/87817 (gcc.target/i386/bmi2-bzhi-2.c execution test)
PR rtl-optimization/87817 * config/i386/i386.c (ix86_fold_builtin): For _bzhi_u{32,64} if last argument has low 8 bits clear, fold to 0. * gcc.target/i386/bmi2-bzhi-3.c (main): Add a couple of new tests. From-SVN: r266140
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b3e0807..76a92b1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -32671,6 +32671,8 @@ ix86_fold_builtin (tree fndecl, int n_args,
unsigned int idx = tree_to_uhwi (args[1]) & 0xff;
if (idx >= TYPE_PRECISION (TREE_TYPE (args[0])))
return args[0];
+ if (idx == 0)
+ return build_int_cst (TREE_TYPE (TREE_TYPE (fndecl)), 0);
if (!tree_fits_uhwi_p (args[0]))
break;
unsigned HOST_WIDE_INT res = tree_to_uhwi (args[0]);