summaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-06 17:00:13 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-06 17:00:13 +0000
commitc76c77aad87bbe8b69cdadcd36e0baa1f7f5f7cc (patch)
tree621d9340f7661e102a0c50897112ac42be195aee /libgo/runtime
parent8a1b0e9ba38c40171ab347e3aec5e973d9c9621a (diff)
downloadgcc-c76c77aad87bbe8b69cdadcd36e0baa1f7f5f7cc.tar.gz
runtime: Use stckf unconditionally on s390.
2014-11-05 Dominik Vogt <vogt@linux.vnet.ibm.com> * libgo/runtime/runtime.c (runtime_cputicks): s390: use stckf unconditionally git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217195 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/runtime.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c
index abc1affcf74..496e77b75c5 100644
--- a/libgo/runtime/runtime.c
+++ b/libgo/runtime/runtime.c
@@ -195,12 +195,12 @@ runtime_cputicks(void)
asm("rdtsc" : "=a" (low), "=d" (high));
return (int64)(((uint64)high << 32) | (uint64)low);
#elif defined (__s390__) || defined (__s390x__)
- uint64 clock;
-#ifdef S390_HAVE_STCKF
- asm("stckf\t%0" : "=Q" (clock) : : );
-#else
- clock = 0;
-#endif
+ uint64 clock = 0;
+ /* stckf may not write the return variable in case of a clock error, so make
+ it read-write to prevent that the initialisation is optimised out.
+ Note: Targets below z9-109 will crash when executing store clock fast, i.e.
+ we don't support Go for machines older than that. */
+ asm volatile(".insn s,0xb27c0000,%0" /* stckf */ : "+Q" (clock) : : "cc" );
return (int64)clock;
#else
// FIXME: implement for other processors.