diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-09-17 08:46:39 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-09-17 08:46:39 -0700 |
commit | a0791d0ed4f147ef347e83f4aedc7ad03f1a2008 (patch) | |
tree | 7b3526910798e4cff7a7200d684383046bac6225 /gcc/tree.c | |
parent | e252b51ccde010cbd2a146485d8045103cd99533 (diff) | |
parent | 89be17a1b231ade643f28fbe616d53377e069da8 (diff) | |
download | gcc-a0791d0ed4f147ef347e83f4aedc7ad03f1a2008.zip gcc-a0791d0ed4f147ef347e83f4aedc7ad03f1a2008.tar.gz gcc-a0791d0ed4f147ef347e83f4aedc7ad03f1a2008.tar.bz2 |
Merge from trunk revision 89be17a1b231ade643f28fbe616d53377e069da8.
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -10737,6 +10737,35 @@ signed_type_for (tree type) return signed_or_unsigned_type_for (0, type); } +/* - For VECTOR_TYPEs: + - The truth type must be a VECTOR_BOOLEAN_TYPE. + - The number of elements must match (known_eq). + - targetm.vectorize.get_mask_mode exists, and exactly + the same mode as the truth type. + - Otherwise, the truth type must be a BOOLEAN_TYPE + or useless_type_conversion_p to BOOLEAN_TYPE. */ +bool +is_truth_type_for (tree type, tree truth_type) +{ + machine_mode mask_mode = TYPE_MODE (truth_type); + machine_mode vmode = TYPE_MODE (type); + machine_mode tmask_mode; + + if (TREE_CODE (type) == VECTOR_TYPE) + { + if (VECTOR_BOOLEAN_TYPE_P (truth_type) + && known_eq (TYPE_VECTOR_SUBPARTS (type), + TYPE_VECTOR_SUBPARTS (truth_type)) + && targetm.vectorize.get_mask_mode (vmode).exists (&tmask_mode) + && tmask_mode == mask_mode) + return true; + + return false; + } + + return useless_type_conversion_p (boolean_type_node, truth_type); +} + /* If TYPE is a vector type, return a signed integer vector type with the same width and number of subparts. Otherwise return boolean_type_node. */ |