gimple-isel: Fold x CMP y ? -1 : 0 to x CMP y [PR97872]
gcc/ 2020-12-08 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR target/97872 * gimple-isel.cc (gimple_expand_vec_cond_expr): Try to fold x CMP y ? -1 : 0 to x CMP y. gcc/testsuite/ 2020-12-08 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR target/97872 * gcc.target/arm/pr97872.c: New test.
This commit is contained in:
parent
e844c04e35
commit
3a6e3ad38a
2 changed files with 26 additions and 0 deletions
|
@ -184,6 +184,20 @@ gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi,
|
|||
|
||||
tree op0_type = TREE_TYPE (op0);
|
||||
tree op0a_type = TREE_TYPE (op0a);
|
||||
|
||||
/* Try to fold x CMP y ? -1 : 0 to x CMP y. */
|
||||
|
||||
if (integer_minus_onep (op1)
|
||||
&& integer_zerop (op2)
|
||||
&& TYPE_MODE (TREE_TYPE (lhs)) == TYPE_MODE (TREE_TYPE (op0))
|
||||
&& expand_vec_cmp_expr_p (op0a_type, op0_type, tcode))
|
||||
{
|
||||
tree conv_op = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), op0);
|
||||
gassign *new_stmt = gimple_build_assign (lhs, conv_op);
|
||||
gsi_replace (gsi, new_stmt, true);
|
||||
return new_stmt;
|
||||
}
|
||||
|
||||
if (used_vec_cond_exprs >= 2
|
||||
&& (get_vcond_mask_icode (mode, TYPE_MODE (op0_type))
|
||||
!= CODE_FOR_nothing)
|
||||
|
|
12
gcc/testsuite/gcc.target/arm/pr97872.c
Normal file
12
gcc/testsuite/gcc.target/arm/pr97872.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-require-effective-target arm_neon_ok } */
|
||||
/* { dg-options "-O3" } */
|
||||
/* { dg-add-options arm_neon } */
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
uint8x8_t f1(int8x8_t a, int8x8_t b) {
|
||||
return a < b;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "vbsl" } } */
|
Loading…
Add table
Reference in a new issue