Fix gcc.c-torture/execute/builtin-prefetch-6.c for SH RTPs

Richard Sandiford richard@codesourcery.com
Wed Jul 4 09:40:00 GMT 2007


This patch fixes gcc.c-torture/execute/builtin-prefetch-6.c for
SH VxWorks RTPs; they cannot use "pref" for __builtin_prefetch
for the reasons given in the patch.

Tested on sh-wrs-vxworks.  OK to install?

Richard


gcc/
	* config/sh/sh.md (*prefetch_i4): Disable for TARGET_VXWORKS_RTP.
	(prefetch): Likewise if "pref" would be used.

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	2007-07-04 02:07:24.000000000 -0700
+++ gcc/config/sh/sh.md	2007-07-04 02:25:02.000000000 -0700
@@ -13565,18 +13565,21 @@ (define_insn "*prefetch_i4"
   [(prefetch (match_operand:SI 0 "register_operand" "r")
              (match_operand:SI 1 "const_int_operand" "n")
              (match_operand:SI 2 "const_int_operand" "n"))]
-  "TARGET_HARD_SH4 || TARGET_SHCOMPACT"
+  "(TARGET_HARD_SH4 || TARGET_SHCOMPACT) && !TARGET_VXWORKS_RTP"
   "*
 {
   return \"pref @%0\";
 }"
   [(set_attr "type" "other")])
 
+;; In user mode, the "pref" instruction will raise a RADDERR exception
+;; for accesses to [0x80000000,0xffffffff].  This makes it an unsuitable
+;; implementation of __builtin_prefetch for VxWorks RTPs.
 (define_expand "prefetch"
   [(prefetch (match_operand 0 "address_operand" "p")
              (match_operand:SI 1 "const_int_operand" "n")
              (match_operand:SI 2 "const_int_operand" "n"))]
-  "TARGET_HARD_SH4 || TARGET_SH5"
+  "(TARGET_HARD_SH4 || TARGET_SH5) && (TARGET_SHMEDIA || !TARGET_VXWORKS_RTP)"
   "
 {
   if (GET_MODE (operands[0]) != Pmode



More information about the Gcc-patches mailing list