re PR target/81015 (Bad codegen for __builtin_clz(unsigned short))
PR target/81015 Revert: 2016-12-14 Uros Bizjak <ubizjak@gmail.com> PR target/59874 * config/i386/i386.md (*ctzhi2): New insn_and_split pattern. (*clzhi2): Ditto. testsuite/ChangeLog: PR target/81015 * gcc.target/i386/pr59874-1.c (foo): Call __builtin_ctzs. * gcc.target/i386/pr59874-2.c (foo): Call __builtin_clzs. * gcc.target/i386/pr81015.c: New test. From-SVN: r249039
This commit is contained in:
parent
7d75cd45a7
commit
2d4d4a3bc5
100
gcc/ChangeLog
100
gcc/ChangeLog
@ -1,3 +1,13 @@
|
||||
2017-06-08 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/81015
|
||||
Revert:
|
||||
2016-12-14 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/59874
|
||||
* config/i386/i386.md (*ctzhi2): New insn_and_split pattern.
|
||||
(*clzhi2): Ditto.
|
||||
|
||||
2017-06-08 David Edelsohn <dje.gcc@gmail.com>
|
||||
|
||||
Backport from mainline
|
||||
@ -87,14 +97,14 @@
|
||||
|
||||
2017-05-31 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
Backport from mainline
|
||||
2017-04-24 Martin Jambor <mjambor@suse.cz>
|
||||
Backport from mainline
|
||||
2017-04-24 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR tree-optimization/80293
|
||||
* tree-sra.c (scalarizable_type_p): New parameter const_decl, make
|
||||
char arrays not totally scalarizable if it is false.
|
||||
(analyze_all_variable_accesses): Pass correct value in the new
|
||||
parameter. Add a statistics counter.
|
||||
PR tree-optimization/80293
|
||||
* tree-sra.c (scalarizable_type_p): New parameter const_decl, make
|
||||
char arrays not totally scalarizable if it is false.
|
||||
(analyze_all_variable_accesses): Pass correct value in the new
|
||||
parameter. Add a statistics counter.
|
||||
|
||||
2017-05-30 Max Filippov <jcmvbkbc@gmail.com>
|
||||
|
||||
@ -515,58 +525,58 @@
|
||||
Backport from mainline
|
||||
2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
PR target/80464
|
||||
* config/s390/vector.md: Split MEM->GPR vector moves for
|
||||
non-s_operand addresses.
|
||||
PR target/80464
|
||||
* config/s390/vector.md: Split MEM->GPR vector moves for
|
||||
non-s_operand addresses.
|
||||
|
||||
2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
Backport from mainline
|
||||
2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
PR target/79895
|
||||
* config/s390/predicates.md (reload_const_wide_int_operand): New
|
||||
predicate.
|
||||
* config/s390/s390.md ("movti"): Remove d/P alternative.
|
||||
("movti_bigconst"): New pattern definition.
|
||||
PR target/79895
|
||||
* config/s390/predicates.md (reload_const_wide_int_operand): New
|
||||
predicate.
|
||||
* config/s390/s390.md ("movti"): Remove d/P alternative.
|
||||
("movti_bigconst"): New pattern definition.
|
||||
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
Backport from maineline
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
PR target/80080
|
||||
* s390-protos.h (s390_expand_cs_hqi): Removed.
|
||||
(s390_expand_cs, s390_expand_atomic_exchange_tdsi): New prototypes.
|
||||
* config/s390/s390.c (s390_emit_compare_and_swap): Handle all integer
|
||||
modes as well as CCZ1mode and CCZmode.
|
||||
(s390_expand_atomic_exchange_tdsi, s390_expand_atomic): Adapt to new
|
||||
signature of s390_emit_compare_and_swap.
|
||||
(s390_expand_cs_hqi): Likewise, make static.
|
||||
(s390_expand_cs_tdsi): Generate an explicit compare before trying
|
||||
compare-and-swap, in some cases.
|
||||
(s390_expand_cs): Wrapper function.
|
||||
(s390_expand_atomic_exchange_tdsi): New backend specific expander for
|
||||
atomic_exchange.
|
||||
(s390_match_ccmode_set): Allow CCZmode <-> CCZ1 mode.
|
||||
* config/s390/s390.md ("atomic_compare_and_swap<mode>"): Merge the
|
||||
patterns for small and large integers. Forbid symref memory operands.
|
||||
Move expander to s390.c. Require cc register.
|
||||
("atomic_compare_and_swap<DGPR:mode><CCZZ1:mode>_internal")
|
||||
("*atomic_compare_and_swap<TDI:mode><CCZZ1:mode>_1")
|
||||
("*atomic_compare_and_swapdi<CCZZ1:mode>_2")
|
||||
("*atomic_compare_and_swapsi<CCZZ1:mode>_3"): Use s_operand to forbid
|
||||
symref memory operands. Remove CC mode and call s390_match_ccmode
|
||||
instead.
|
||||
("atomic_exchange<mode>"): Allow and implement all integer modes.
|
||||
PR target/80080
|
||||
* s390-protos.h (s390_expand_cs_hqi): Removed.
|
||||
(s390_expand_cs, s390_expand_atomic_exchange_tdsi): New prototypes.
|
||||
* config/s390/s390.c (s390_emit_compare_and_swap): Handle all integer
|
||||
modes as well as CCZ1mode and CCZmode.
|
||||
(s390_expand_atomic_exchange_tdsi, s390_expand_atomic): Adapt to new
|
||||
signature of s390_emit_compare_and_swap.
|
||||
(s390_expand_cs_hqi): Likewise, make static.
|
||||
(s390_expand_cs_tdsi): Generate an explicit compare before trying
|
||||
compare-and-swap, in some cases.
|
||||
(s390_expand_cs): Wrapper function.
|
||||
(s390_expand_atomic_exchange_tdsi): New backend specific expander for
|
||||
atomic_exchange.
|
||||
(s390_match_ccmode_set): Allow CCZmode <-> CCZ1 mode.
|
||||
* config/s390/s390.md ("atomic_compare_and_swap<mode>"): Merge the
|
||||
patterns for small and large integers. Forbid symref memory operands.
|
||||
Move expander to s390.c. Require cc register.
|
||||
("atomic_compare_and_swap<DGPR:mode><CCZZ1:mode>_internal")
|
||||
("*atomic_compare_and_swap<TDI:mode><CCZZ1:mode>_1")
|
||||
("*atomic_compare_and_swapdi<CCZZ1:mode>_2")
|
||||
("*atomic_compare_and_swapsi<CCZZ1:mode>_3"): Use s_operand to forbid
|
||||
symref memory operands. Remove CC mode and call s390_match_ccmode
|
||||
instead.
|
||||
("atomic_exchange<mode>"): Allow and implement all integer modes.
|
||||
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
Backport from mainline
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
* config/s390/s390.md (define_peephole2): New peephole to help
|
||||
combining the load-and-test pattern with volatile memory.
|
||||
* config/s390/s390.md (define_peephole2): New peephole to help
|
||||
combining the load-and-test pattern with volatile memory.
|
||||
|
||||
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
@ -574,8 +584,8 @@
|
||||
Backport from mainline
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
* config/s390/s390.md ("cstorecc4"): Use load-on-condition and deal
|
||||
with CCZmode for TARGET_Z196.
|
||||
* config/s390/s390.md ("cstorecc4"): Use load-on-condition and deal
|
||||
with CCZmode for TARGET_Z196.
|
||||
|
||||
2017-04-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
@ -634,7 +644,7 @@
|
||||
(build_array_type): Likewise. Add typeless_storage argument.
|
||||
|
||||
2017-04-19 Eric Botcazou <ebotcazou@adacore.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/80426
|
||||
* tree-vrp.c (extract_range_from_binary_expr_1): For an additive
|
||||
@ -676,7 +686,7 @@
|
||||
are only used in debug insns.
|
||||
|
||||
2017-04-19 Eric Botcazou <ebotcazou@adacore.com>
|
||||
Vladimir Makarov <vmakarov@redhat.com>
|
||||
Vladimir Makarov <vmakarov@redhat.com>
|
||||
|
||||
* config/sparc/predicates.md (input_operand): Add comment. Return
|
||||
true for any memory operand when LRA is in progress.
|
||||
|
@ -12690,24 +12690,6 @@
|
||||
(set_attr "znver1_decode" "vector")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_insn_and_split "*ctzhi2"
|
||||
[(set (match_operand:SI 0 "register_operand")
|
||||
(ctz:SI
|
||||
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand"))))
|
||||
(clobber (reg:CC FLAGS_REG))]
|
||||
"TARGET_BMI
|
||||
&& can_create_pseudo_p ()"
|
||||
"#"
|
||||
"&& 1"
|
||||
[(const_int 0)]
|
||||
{
|
||||
rtx tmp = gen_reg_rtx (HImode);
|
||||
|
||||
emit_insn (gen_tzcnt_hi (tmp, operands[1]));
|
||||
emit_insn (gen_zero_extendhisi2 (operands[0], tmp));
|
||||
DONE;
|
||||
})
|
||||
|
||||
(define_insn_and_split "ctz<mode>2"
|
||||
[(set (match_operand:SWI48 0 "register_operand" "=r")
|
||||
(ctz:SWI48
|
||||
@ -12827,24 +12809,6 @@
|
||||
operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)-1);
|
||||
})
|
||||
|
||||
(define_insn_and_split "*clzhi2"
|
||||
[(set (match_operand:SI 0 "register_operand")
|
||||
(clz:SI
|
||||
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand"))))
|
||||
(clobber (reg:CC FLAGS_REG))]
|
||||
"TARGET_LZCNT
|
||||
&& can_create_pseudo_p ()"
|
||||
"#"
|
||||
"&& 1"
|
||||
[(const_int 0)]
|
||||
{
|
||||
rtx tmp = gen_reg_rtx (HImode);
|
||||
|
||||
emit_insn (gen_lzcnt_hi (tmp, operands[1]));
|
||||
emit_insn (gen_zero_extendhisi2 (operands[0], tmp));
|
||||
DONE;
|
||||
})
|
||||
|
||||
(define_insn_and_split "clz<mode>2_lzcnt"
|
||||
[(set (match_operand:SWI48 0 "register_operand" "=r")
|
||||
(clz:SWI48
|
||||
|
@ -1,3 +1,10 @@
|
||||
2017-06-08 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/81015
|
||||
* gcc.target/i386/pr59874-1.c (foo): Call __builtin_ctzs.
|
||||
* gcc.target/i386/pr59874-2.c (foo): Call __builtin_clzs.
|
||||
* gcc.target/i386/pr81015.c: New test.
|
||||
|
||||
2017-06-08 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/81006
|
||||
@ -98,11 +105,11 @@
|
||||
|
||||
2017-05-31 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
Backport from mainline
|
||||
2017-04-24 Martin Jambor <mjambor@suse.cz>
|
||||
Backport from mainline
|
||||
2017-04-24 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR tree-optimization/80293
|
||||
* g++.dg/tree-ssa/pr80293.C: New test.
|
||||
PR tree-optimization/80293
|
||||
* g++.dg/tree-ssa/pr80293.C: New test.
|
||||
|
||||
2017-05-29 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
@ -339,26 +346,26 @@
|
||||
Backport from mainline
|
||||
2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
PR target/80464
|
||||
* gfortran.fortran-torture/compile/pr80464.f90: New test.
|
||||
PR target/80464
|
||||
* gfortran.fortran-torture/compile/pr80464.f90: New test.
|
||||
|
||||
2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
Backport from mainline
|
||||
2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
|
||||
|
||||
PR target/79895
|
||||
* gcc.target/s390/pr79895.c: New test.
|
||||
PR target/79895
|
||||
* gcc.target/s390/pr79895.c: New test.
|
||||
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
Backport from maineline
|
||||
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
PR target/80080
|
||||
* gcc.target/s390/md/atomic_compare_exchange-1.c: New test.
|
||||
* gcc.target/s390/md/atomic_compare_exchange-1.inc: New test.
|
||||
* gcc.target/s390/md/atomic_exchange-1.inc: New test.
|
||||
PR target/80080
|
||||
* gcc.target/s390/md/atomic_compare_exchange-1.c: New test.
|
||||
* gcc.target/s390/md/atomic_compare_exchange-1.inc: New test.
|
||||
* gcc.target/s390/md/atomic_exchange-1.inc: New test.
|
||||
|
||||
2017-04-25 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
@ -419,7 +426,7 @@
|
||||
* gcc.dg/torture/pr80341.c: Require int32plus.
|
||||
|
||||
2017-04-19 Eric Botcazou <ebotcazou@adacore.com>
|
||||
Jeff Law <law@redhat.com>
|
||||
Jeff Law <law@redhat.com>
|
||||
|
||||
* gcc.c-torture/compile/20170419-1.c: New test.
|
||||
|
||||
|
@ -6,5 +6,5 @@
|
||||
unsigned int
|
||||
foo (unsigned short x)
|
||||
{
|
||||
return x ? __builtin_ctz (x) : 16U;
|
||||
return x ? __builtin_ctzs (x) : 16U;
|
||||
}
|
||||
|
@ -6,5 +6,5 @@
|
||||
unsigned int
|
||||
foo (unsigned short x)
|
||||
{
|
||||
return x ? __builtin_clz (x) : 16U;
|
||||
return x ? __builtin_clzs (x) : 16U;
|
||||
}
|
||||
|
21
gcc/testsuite/gcc.target/i386/pr81015.c
Normal file
21
gcc/testsuite/gcc.target/i386/pr81015.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-O2 -mlzcnt" } */
|
||||
/* { dg-require-effective-target lzcnt } */
|
||||
|
||||
#include "lzcnt-check.h"
|
||||
|
||||
int
|
||||
__attribute__ ((noinline, noclone))
|
||||
foo (unsigned short a)
|
||||
{
|
||||
return __builtin_clz (a);
|
||||
}
|
||||
|
||||
static void
|
||||
lzcnt_test ()
|
||||
{
|
||||
int res = foo (1);
|
||||
|
||||
if (res != 31)
|
||||
abort ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user