From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18276 invoked by alias); 15 Oct 2011 10:51:00 -0000 Received: (qmail 18268 invoked by uid 22791); 15 Oct 2011 10:50:59 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from usmamail.tilera.com (HELO USMAMAIL.TILERA.COM) (206.83.70.75) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 15 Oct 2011 10:50:43 +0000 Received: from [192.168.1.6] (98.229.97.107) by USMAExch2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server id 14.0.694.0; Sat, 15 Oct 2011 06:50:42 -0400 Message-ID: <4E996585.6090805@tilera.com> Date: Sat, 15 Oct 2011 13:31:00 -0000 From: Walter Lee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Subject: [PATCH] New port for TILEPro and TILE-Gx: 6/7 libgomp port References: <4E996398.2000507@tilera.com> In-Reply-To: <4E996398.2000507@tilera.com> Content-Type: multipart/mixed; boundary="------------020802090601040906000201" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg01380.txt.bz2 --------------020802090601040906000201 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Content-length: 113 Here is the libgomp port. * configure.tgt: Handle tilegx and tilepro. * config/linux/tile/futex.h: New file. --------------020802090601040906000201 Content-Type: text/plain; name="libgomp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libgomp.diff" Content-length: 3148 diff -r -u -p -N /home/packages/gcc-4.7.0-179959/libgomp/config/linux/tile/futex.h ./libgomp/config/linux/tile/futex.h --- /home/packages/gcc-4.7.0-179959/libgomp/config/linux/tile/futex.h 1969-12-31 19:00:00.000000000 -0500 +++ ./libgomp/config/linux/tile/futex.h 2011-10-14 18:14:11.657740000 -0400 @@ -0,0 +1,73 @@ +/* Copyright (C) 2011 + Free Software Foundation, Inc. + Contributed by Walter Lee (walt@tilera.com) + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +/* Provide target-specific access to the futex system call. */ + +#include +#include + +static inline void +sys_futex0 (int *addr, int op, int val) +{ + long _sys_result; + long _clobber_r2, _clobber_r3, _clobber_r4, _clobber_r5, _clobber_r10; + int err; + + __asm__ __volatile__ ( + "swint1" + : "=R00" (_sys_result), "=R01" (err), "=R02" (_clobber_r2), + "=R03" (_clobber_r3), "=R04" (_clobber_r4), "=R05" (_clobber_r5), + "=R10" (_clobber_r10) + : "R10" (SYS_futex), "R00" (addr), "R01" (op), "R02" (val), + "R03" (0) + : "r6", "r7", + "r8", "r9", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "memory"); +} + +static inline void +futex_wait (int *addr, int val) +{ + sys_futex0 (addr, FUTEX_WAIT, val); +} + +static inline void +futex_wake (int *addr, int count) +{ + sys_futex0 (addr, FUTEX_WAKE, count); +} + +static inline void +cpu_relax (void) +{ + __asm volatile ("" : : : "memory"); +} + +static inline void +atomic_write_barrier (void) +{ + __sync_synchronize (); +} diff -r -u -p -N /home/packages/gcc-4.7.0-179959/libgomp/configure.tgt ./libgomp/configure.tgt --- /home/packages/gcc-4.7.0-179959/libgomp/configure.tgt 2011-10-14 00:46:46.000000000 -0400 +++ ./libgomp/configure.tgt 2011-10-14 18:14:11.167723000 -0400 @@ -51,6 +51,10 @@ if test $enable_linux_futex = yes; then config_path="linux/s390 linux posix" ;; + tile*-*-linux*) + config_path="linux/tile linux posix" + ;; + # Note that bare i386 is not included here. We need cmpxchg. i[456]86-*-linux*) config_path="linux/x86 linux posix" --------------020802090601040906000201--