aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.cc
diff options
context:
space:
mode:
authorRobin Dapp <rdapp@ventanamicro.com>2024-08-08 12:54:36 +0200
committerRobin Dapp <rdapp@ventanamicro.com>2024-11-18 11:48:41 +0100
commit6b6bd53619fd11bab3def8dee737711a7ee539ea (patch)
tree7633bfa749a80103fcb0cc4d1460e75b75caf5f4 /gcc/tree-if-conv.cc
parent8f68d9cb7897df188f7dcd733d8c385f77fd8011 (diff)
downloadgcc-6b6bd53619fd11bab3def8dee737711a7ee539ea.zip
gcc-6b6bd53619fd11bab3def8dee737711a7ee539ea.tar.gz
gcc-6b6bd53619fd11bab3def8dee737711a7ee539ea.tar.bz2
tree-ifcvt: Add zero maskload else value.
When predicating a load we implicitly assume that the else value is zero. This matters in case the loaded value is padded (like e.g. a Bool) and we must ensure that the padding bytes are zero on targets that don't implicitly zero inactive elements. A former version of this patch still had this handling in ifcvt but the latest version defers it to the vectorizer. gcc/ChangeLog: * tree-if-conv.cc (predicate_load_or_store): Add zero else operand and comment.
Diffstat (limited to 'gcc/tree-if-conv.cc')
-rw-r--r--gcc/tree-if-conv.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index eb98164..f1a1f8f 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -2555,9 +2555,17 @@ predicate_load_or_store (gimple_stmt_iterator *gsi, gassign *stmt, tree mask)
ref);
if (TREE_CODE (lhs) == SSA_NAME)
{
+ /* Get a zero else value. This might not be what a target actually uses
+ but we cannot be sure about which vector mode the vectorizer will
+ choose. Therefore, leave the decision whether we need to force the
+ inactive elements to zero to the vectorizer. */
+ tree els = vect_get_mask_load_else (MASK_LOAD_ELSE_ZERO,
+ TREE_TYPE (lhs));
+
new_stmt
- = gimple_build_call_internal (IFN_MASK_LOAD, 3, addr,
- ptr, mask);
+ = gimple_build_call_internal (IFN_MASK_LOAD, 4, addr,
+ ptr, mask, els);
+
gimple_call_set_lhs (new_stmt, lhs);
gimple_set_vuse (new_stmt, gimple_vuse (stmt));
}