This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
alpha prefetch
- From: Richard Henderson <rth at twiddle dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Dec 2001 23:42:52 -0800
- Subject: alpha prefetch
* config/alpha/alpha.h (TARGET_FIXUP_EV5_PREFETCH): New.
* config/alpha/linux.h (TARGET_FIXUP_EV5_PREFETCH): New.
* config/alpha/alpha.md (prefetch): New.
Index: alpha.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.h,v
retrieving revision 1.143
diff -c -p -d -r1.143 alpha.h
*** alpha.h 2001/12/09 21:47:49 1.143
--- alpha.h 2001/12/12 06:26:23
*************** extern enum alpha_fp_trap_mode alpha_fpt
*** 206,211 ****
--- 206,214 ----
#ifndef TARGET_LD_BUGGY_LDGP
#define TARGET_LD_BUGGY_LDGP 0
#endif
+ #ifndef TARGET_FIXUP_EV5_PREFETCH
+ #define TARGET_FIXUP_EV5_PREFETCH 0
+ #endif
/* Macro to define tables used to set the flags.
This is a list in braces of pairs in braces,
Index: alpha.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.md,v
retrieving revision 1.165
diff -c -p -d -r1.165 alpha.md
*** alpha.md 2001/12/12 02:53:38 1.165
--- alpha.md 2001/12/12 06:26:28
*************** fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi
*** 6716,6721 ****
--- 6716,6759 ----
[(set_attr "length" "16")
(set_attr "type" "multi")])
+ ;; Prefetch data.
+ ;;
+ ;; On EV4, these instructions are nops -- no load occurs.
+ ;;
+ ;; On EV5, these instructions act as a normal load, and thus can trap
+ ;; if the address is invalid. The OS may (or may not) handle this in
+ ;; the entMM fault handler and suppress the fault. If so, then this
+ ;; has the effect of a read prefetch instruction.
+ ;;
+ ;; On EV6, these become official prefetch instructions.
+
+ (define_insn "prefetch"
+ [(prefetch (match_operand:DI 0 "address_operand" "p")
+ (match_operand:DI 1 "const_int_operand" "n")
+ (match_operand:DI 2 "const_int_operand" "n"))]
+ "TARGET_FIXUP_EV5_PREFETCH || TARGET_CPU_EV6"
+ {
+ /* Interpret "no temporal locality" as this data should be evicted once
+ it is used. The "evict next" alternatives load the data into the cache
+ and leave the LRU eviction counter pointing to that block. */
+ static const char * const alt[2][2] = {
+ {
+ "lds $f31,%a0", /* read, evict next */
+ "ldl $31,%a0", /* read, evict last */
+ },
+ {
+ "ldt $f31,%a0", /* write, evict next */
+ "ldq $31,%a0", /* write, evict last */
+ }
+ };
+
+ bool write = INTVAL (operands[1]) != 0;
+ bool lru = INTVAL (operands[2]) != 0;
+
+ return alt[write][lru];
+ }
+ [(set_attr "type" "ild")])
+
;; Close the trap shadow of preceding instructions. This is generated
;; by alpha_reorg.
Index: linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/linux.h,v
retrieving revision 1.24
diff -c -p -d -r1.24 linux.h
*** linux.h 2001/06/11 19:51:02 1.24
--- linux.h 2001/12/12 06:26:28
*************** SUB_CPP_PREDEFINES
*** 46,51 ****
--- 46,55 ----
#undef TARGET_CAN_FAULT_IN_PROLOGUE
#define TARGET_CAN_FAULT_IN_PROLOGUE 1
+ /* OS fixes up EV5 data fault on prefetch. */
+ #undef TARGET_FIXUP_EV5_PREFETCH
+ #define TARGET_FIXUP_EV5_PREFETCH 1
+
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"