From c901bc0d8e9c3b7cd199c141f3ebea16f0201af0 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 11 Nov 2016 17:21:52 +0100 Subject: [PATCH] re PR target/78310 (ICE: insn does not satisfy its constraints: {*bmi2_rorxdi3_1} with -mbmi2) PR target/78310 * config/i386/i386.md (rotate to rotatex splitter): Avoid overflow when calculating operand 2. (rotate to rotatex zext splitter): Ditto. testsuite/ChangeLog: PR target/78310 * gcc.target/i386/pr78310.c: New test. From-SVN: r242076 --- gcc/ChangeLog | 23 +++++++++++++---------- gcc/config/i386/i386.md | 10 ++++++---- gcc/testsuite/ChangeLog | 9 +++++++-- gcc/testsuite/gcc.target/i386/pr78310.c | 15 +++++++++++++++ 4 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr78310.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65afc8a0947..7dd5931b839 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-11-11 Uros Bizjak + + PR target/78310 + * config/i386/i386.md (rotate to rotatex splitter): Avoid overflow + when calculating operand 2. + (rotate to rotatex zext splitter): Ditto. + 2016-11-11 Jeff Law * gimple-ssa-isolate-paths.c (is_divmod_with_given_divisor): New @@ -43,10 +50,8 @@ (rs6000_secondary_reload_simple_move): Likewise. (rs6000_preferred_reload_class): Don't force integer constants to be loaded into vector registers that we can easily make into - memory (or being created in the GPRs and moved over with direct - move). - * config/rs6000/vsx.md (UNSPEC_P9_MEMORY): Delete, no longer - used. + memory (or being created in the GPRs and moved over with direct move). + * config/rs6000/vsx.md (UNSPEC_P9_MEMORY): Delete, no longer used. (vsx_extract_): Rework V4SImode, V8HImode, and V16QImode vector extraction on ISA 3.0 when the scalar integer can be allocated in vector registers. Generate the VEC_SELECT directy, @@ -70,8 +75,7 @@ (zero_extendhi): Likewise. (extendqi): Likewise. (extendhi2): Likewise. - (HImode splitter for load/sign extend in vector register): - Likewise. + (HImode splitter for load/sign extend in vector register): Likewise. (float2): Eliminate old method of optimizing floating point conversions to/from small data types and rewrite it to support QImode/HImode being allowed in vector @@ -98,8 +102,8 @@ 2016-11-10 Pat Haugen PR rtl-optimization/78241 - * loop-unroll.c (unroll_loop_runtime_iterations): Don't adjust 'niter', but - emit initial peel copy if niter expr is not reliable. + * loop-unroll.c (unroll_loop_runtime_iterations): Don't adjust 'niter', + but emit initial peel copy if niter expr is not reliable. 2016-11-10 Segher Boessenkool @@ -180,8 +184,7 @@ 2016-11-10 Siddhesh Poyarekar - * config/aarch64/aarch64-cores.def (qdf24xx): Update part - number. + * config/aarch64/aarch64-cores.def (qdf24xx): Update part number. (falkor): New core. * config/aarch64/aarch64-tune.md: Regenerated. * config/arm/arm-cores.def (falkor): New core. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a5650a1ea14..b46d6d1ee98 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -10908,8 +10908,9 @@ [(set (match_dup 0) (rotatert:SWI48 (match_dup 1) (match_dup 2)))] { - operands[2] - = GEN_INT (GET_MODE_BITSIZE (mode) - INTVAL (operands[2])); + int bitsize = GET_MODE_BITSIZE (mode); + + operands[2] = GEN_INT ((bitsize - INTVAL (operands[2])) % bitsize); }) (define_split @@ -10975,8 +10976,9 @@ [(set (match_dup 0) (zero_extend:DI (rotatert:SI (match_dup 1) (match_dup 2))))] { - operands[2] - = GEN_INT (GET_MODE_BITSIZE (SImode) - INTVAL (operands[2])); + int bitsize = GET_MODE_BITSIZE (SImode); + + operands[2] = GEN_INT ((bitsize - INTVAL (operands[2])) % bitsize); }) (define_split diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6da1cd87cc9..16a2597a5a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-11 Uros Bizjak + + PR target/78310 + * gcc.target/i386/pr78310.c: New test. + 2016-11-11 Jeff Law * gcc.dg/tree-ssa/isolate-6.c: New test. @@ -2892,8 +2897,8 @@ arm_fp16_alternative_ok. * g++.dg/ext/arm-fp16/arm-fp16-ops-4.C: Likewise. * gcc.dg/torture/arm-fp16-int-convert-alt.c: Likewise. - * gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c: Likewise. - * gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c: Likewise. + * gcc.dg/torture/arm-fp16-ops-3.c: Likewise. + * gcc.dg/torture/arm-fp16-ops-4.c: Likewise. * gcc.target/arm/fp16-compile-alt-1.c: Likewise. * gcc.target/arm/fp16-compile-alt-10.c: Likewise. * gcc.target/arm/fp16-compile-alt-11.c: Likewise. diff --git a/gcc/testsuite/gcc.target/i386/pr78310.c b/gcc/testsuite/gcc.target/i386/pr78310.c new file mode 100644 index 00000000000..dfeae4c827c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr78310.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O -mbmi2" } */ + +unsigned long long a; +int b; + +int +fn1(int p1) +{ + p1 &= 1; + p1 &= (short)~p1; + b = a; + a = a << p1 | a >> (64 - p1); + return p1 + 1 + a; +} -- 2.30.2