Commit e83d297b by Janis Johnson Committed by Janis Johnson

builtin-types.def (BT_FN_VOID_PTR_VAR): New.

	* builtin-types.def (BT_FN_VOID_PTR_VAR): New.
	* builtins.def (BUILT_IN_PREFETCH): Change arguments.
	* builtins.c (expand_builtin_prefetch): Two arguments are now optional,
	with defaults for read prefetch with high degree of locality.
	* doc/extend.texi (__builtin_prefetch): Update documentation.
	* doc/md.texi (prefetch): Add documentation.

From-SVN: r47741
parent e94c6dee
2001-12-06 Janis Johnson <janis187@us.ibm.com>
* builtin-types.def (BT_FN_VOID_PTR_VAR): New.
* builtins.def (BUILT_IN_PREFETCH): Change arguments.
* builtins.c (expand_builtin_prefetch): Two arguments are now optional,
with defaults for read prefetch with high degree of locality.
* doc/extend.texi (__builtin_prefetch): Update documentation.
* doc/md.texi (prefetch): Add documentation.
2001-12-06 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> 2001-12-06 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* fixinc/inclhack.def (stdio_va_list): Handle __VA_LIST__ in Tru64 * fixinc/inclhack.def (stdio_va_list): Handle __VA_LIST__ in Tru64
......
...@@ -167,6 +167,8 @@ DEF_FUNCTION_TYPE_VAR_0 (BT_FN_PTR_VAR, BT_PTR) ...@@ -167,6 +167,8 @@ DEF_FUNCTION_TYPE_VAR_0 (BT_FN_PTR_VAR, BT_PTR)
DEF_FUNCTION_TYPE_VAR_1 (BT_FN_VOID_VALIST_REF_VAR, DEF_FUNCTION_TYPE_VAR_1 (BT_FN_VOID_VALIST_REF_VAR,
BT_VOID, BT_VALIST_REF) BT_VOID, BT_VALIST_REF)
DEF_FUNCTION_TYPE_VAR_1 (BT_FN_VOID_PTR_VAR,
BT_VOID, BT_PTR)
DEF_FUNCTION_TYPE_VAR_1 (BT_FN_INT_CONST_STRING_VAR, DEF_FUNCTION_TYPE_VAR_1 (BT_FN_INT_CONST_STRING_VAR,
BT_INT, BT_CONST_STRING) BT_INT, BT_CONST_STRING)
......
...@@ -727,9 +727,26 @@ expand_builtin_prefetch (arglist) ...@@ -727,9 +727,26 @@ expand_builtin_prefetch (arglist)
tree arg0, arg1, arg2; tree arg0, arg1, arg2;
rtx op0, op1, op2; rtx op0, op1, op2;
if (!validate_arglist (arglist, POINTER_TYPE, 0))
return;
arg0 = TREE_VALUE (arglist); arg0 = TREE_VALUE (arglist);
arg1 = TREE_VALUE (TREE_CHAIN (arglist)); /* Arguments 1 and 2 are optional; argument 1 (read/write) defaults to
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); zero (read) and argument 2 (locality) defaults to 3 (high degree of
locality). */
if (TREE_CHAIN (arglist))
{
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
if (TREE_CHAIN (TREE_CHAIN (arglist)))
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
else
arg2 = build_int_2 (3, 0);
}
else
{
arg1 = integer_zero_node;
arg2 = build_int_2 (3, 0);
}
/* Argument 0 is an address. */ /* Argument 0 is an address. */
op0 = expand_expr (arg0, NULL_RTX, Pmode, EXPAND_NORMAL); op0 = expand_expr (arg0, NULL_RTX, Pmode, EXPAND_NORMAL);
......
...@@ -338,7 +338,7 @@ DEF_GCC_BUILTIN(BUILT_IN_TRAP, ...@@ -338,7 +338,7 @@ DEF_GCC_BUILTIN(BUILT_IN_TRAP,
BT_FN_VOID) BT_FN_VOID)
DEF_GCC_BUILTIN(BUILT_IN_PREFETCH, DEF_GCC_BUILTIN(BUILT_IN_PREFETCH,
"__builtin_prefetch", "__builtin_prefetch",
BT_FN_VOID_PTR_INT_INT) BT_FN_VOID_PTR_VAR)
/* Stdio builtins. */ /* Stdio builtins. */
DEF_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR, DEF_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR,
......
...@@ -4442,7 +4442,7 @@ if (__builtin_expect (ptr != NULL, 1)) ...@@ -4442,7 +4442,7 @@ if (__builtin_expect (ptr != NULL, 1))
when testing pointer or floating-point values. when testing pointer or floating-point values.
@end deftypefn @end deftypefn
@deftypefn {Built-in Function} void __builtin_prefetch (void *@var{addr}, int @var{rw}, int @var{locality}) @deftypefn {Built-in Function} void __builtin_prefetch (void *@var{addr}, ...)
This function is used to minimize cache-miss latency by moving data into This function is used to minimize cache-miss latency by moving data into
a cache before it is accessed. a cache before it is accessed.
You can insert calls to @code{__builtin_prefetch} into code for which You can insert calls to @code{__builtin_prefetch} into code for which
...@@ -4452,14 +4452,17 @@ If the prefetch is done early enough before the access then the data will ...@@ -4452,14 +4452,17 @@ If the prefetch is done early enough before the access then the data will
be in the cache by the time it is accessed. be in the cache by the time it is accessed.
The value of @var{addr} is the address of the memory to prefetch. The value of @var{addr} is the address of the memory to prefetch.
There are two optional arguments, @var{rw} and @var{locality}.
The value of @var{rw} is a compile-time constant one or zero; one The value of @var{rw} is a compile-time constant one or zero; one
means that the prefetch is preparing for a write to the memory address. means that the prefetch is preparing for a write to the memory address
and zero, the default, means that the prefetch is preparing for a read.
The value @var{locality} must be a compile-time constant integer between The value @var{locality} must be a compile-time constant integer between
zero and three. A value of zero means that the data has no temporal zero and three. A value of zero means that the data has no temporal
locality, so it need not be left in the cache after the access. A value locality, so it need not be left in the cache after the access. A value
of three means that the data has a high degree of temporal locality and of three means that the data has a high degree of temporal locality and
should be left in all levels of cache possible. Values of one and two should be left in all levels of cache possible. Values of one and two
mean, respectively, a low or moderate degree of temporal locality. mean, respectively, a low or moderate degree of temporal locality. The
default is three.
@smallexample @smallexample
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
......
...@@ -3015,6 +3015,22 @@ A typical @code{conditional_trap} pattern looks like ...@@ -3015,6 +3015,22 @@ A typical @code{conditional_trap} pattern looks like
"@dots{}") "@dots{}")
@end smallexample @end smallexample
@cindex @code{prefetch} instruction pattern
@item @samp{prefetch}
This pattern, if defined, emits code for a non-faulting data prefetch
instruction. Operand 0 is the address of the memory to prefetch. Operand 1
is a constant 1 if the prefetch is preparing for a write to the memory
address, or a constant 0 otherwise. Operand 2 is the expected degree of
temporal locality of the data and is a value between 0 and 3, inclusive; 0
means that the data has no temporal locality, so it need not be left in the
cache after the access; 3 means that the data has a high degree of temporal
locality and should be left in all levels of cache possible; 1 and 2 mean,
respectively, a low or moderate degree of temporal locality.
Targets that do not support write prefetches or locality hints can ignore
the values of operands 1 and 2.
@cindex @code{cycle_display} instruction pattern @cindex @code{cycle_display} instruction pattern
@item @samp{cycle_display} @item @samp{cycle_display}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment