mirror of git://gcc.gnu.org/git/gcc.git
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: r249028
This commit is contained in:
parent
73f49ad743
commit
2163b9bcc6
|
|
@ -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 Jan Hubicka <hubicka@ucw.cz>
|
2017-06-08 Jan Hubicka <hubicka@ucw.cz>
|
||||||
|
|
||||||
* predict.c (unlikely_executed_edge_p): Move ahead.
|
* predict.c (unlikely_executed_edge_p): Move ahead.
|
||||||
|
|
|
||||||
|
|
@ -12762,24 +12762,6 @@
|
||||||
(set_attr "znver1_decode" "vector")
|
(set_attr "znver1_decode" "vector")
|
||||||
(set_attr "mode" "<MODE>")])
|
(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"
|
(define_insn_and_split "ctz<mode>2"
|
||||||
[(set (match_operand:SWI48 0 "register_operand" "=r")
|
[(set (match_operand:SWI48 0 "register_operand" "=r")
|
||||||
(ctz:SWI48
|
(ctz:SWI48
|
||||||
|
|
@ -12899,24 +12881,6 @@
|
||||||
operands[2] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode)-1);
|
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"
|
(define_insn_and_split "clz<mode>2_lzcnt"
|
||||||
[(set (match_operand:SWI48 0 "register_operand" "=r")
|
[(set (match_operand:SWI48 0 "register_operand" "=r")
|
||||||
(clz:SWI48
|
(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 Tom de Vries <tom@codesourcery.com>
|
2017-06-08 Tom de Vries <tom@codesourcery.com>
|
||||||
|
|
||||||
* gcc.c-torture/compile/930506-2.c: Use dg-require-effective-target
|
* gcc.c-torture/compile/930506-2.c: Use dg-require-effective-target
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@
|
||||||
unsigned int
|
unsigned int
|
||||||
foo (unsigned short x)
|
foo (unsigned short x)
|
||||||
{
|
{
|
||||||
return x ? __builtin_ctz (x) : 16U;
|
return x ? __builtin_ctzs (x) : 16U;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@
|
||||||
unsigned int
|
unsigned int
|
||||||
foo (unsigned short x)
|
foo (unsigned short x)
|
||||||
{
|
{
|
||||||
return x ? __builtin_clz (x) : 16U;
|
return x ? __builtin_clzs (x) : 16U;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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