@@ -7311,6 +7311,12 @@ candidate as a replacement for the if-convertible sequence described in
@code{if_info}.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP (rtx @var{x})
+This hook returns true if the target supports condition move instructions
+ that enables fault suppression of memory operands when the condition code
+ evaluates to false.
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_NEW_ADDRESS_PROFITABLE_P (rtx @var{memref}, rtx_insn * @var{insn}, rtx @var{new_addr})
Return @code{true} if it is profitable to replace the address in
@var{memref} with @var{new_addr}. This allows targets to prevent the
@@ -4748,6 +4748,8 @@ Define this macro if a non-short-circuit operation produced by
@hook TARGET_NOCE_CONVERSION_PROFITABLE_P
+@hook TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP
+
@hook TARGET_NEW_ADDRESS_PROFITABLE_P
@hook TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P
@@ -3993,6 +3993,17 @@ candidate as a replacement for the if-convertible sequence described in\n\
bool, (rtx_insn *seq, struct noce_if_info *if_info),
default_noce_conversion_profitable_p)
+/* Return true if the target support condition move instructions that enables
+ fault suppression of memory operands when the condition code evaluates to
+ false. */
+DEFHOOK
+(have_conditional_move_mem_notrap,
+ "This hook returns true if the target supports condition move instructions\n\
+ that enables fault suppression of memory operands when the condition code\n\
+ evaluates to false.",
+bool, (rtx x),
+default_have_conditional_move_mem_notrap)
+
/* Return true if new_addr should be preferred over the existing address used by
memref in insn. */
DEFHOOK
@@ -2816,4 +2816,12 @@ default_memtag_untagged_pointer (rtx tagged_pointer, rtx target)
return untagged_base;
}
+/* The default implementation of
+ TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP. */
+bool
+default_have_conditional_move_mem_notrap (rtx x ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
#include "gt-targhooks.h"
@@ -305,5 +305,6 @@ extern rtx default_memtag_add_tag (rtx, poly_int64, uint8_t);
extern rtx default_memtag_set_tag (rtx, rtx, rtx);
extern rtx default_memtag_extract_tag (rtx, rtx);
extern rtx default_memtag_untagged_pointer (rtx, rtx);
+extern bool default_have_conditional_move_mem_notrap (rtx x);
#endif /* GCC_TARGHOOKS_H */
From: konglin1 <lingling.kong@intel.com> APX CFCMOV feature implements conditionally faulting which means that all memory faults are suppressed when the condition code evaluates to false and load or store a memory operand. Now we could load or store a memory operand may trap or fault for conditional move. In middle-end, now we don't support a conditional move if we knew that a load from A or B could trap or fault. To enable CFCMOV, we add a target HOOK TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP in if-conversion pass to allow convert to cmov. gcc/ChangeLog: * doc/tm.texi: Regenerated. * doc/tm.texi.in: Add TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP * target.def (bool,): New hook. * targhooks.cc (default_have_conditional_move_mem_notrap): New function to hook TARGET_HAVE_CONDITIONAL_MOVE_MEM_NOTRAP. * targhooks.h (default_have_conditional_move_mem_notrap): New target hook declear. --- gcc/doc/tm.texi | 6 ++++++ gcc/doc/tm.texi.in | 2 ++ gcc/target.def | 11 +++++++++++ gcc/targhooks.cc | 8 ++++++++ gcc/targhooks.h | 1 + 5 files changed, 28 insertions(+)