From patchwork Sun Jun 16 09:19:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 251664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 053BD2C0092 for ; Sun, 16 Jun 2013 19:20:07 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=ApSCdyFsX6rWR/1b 9ejqY7ODf7bJJ8QdAOSPLVx2/TC+c1KJV3cyTp0vqXJ5Ya5+VNBO9pLnCTqgCfQw I3Kp5OgTqQgYGuSwPpETEXGNbAebVjj0adY9plDZAhTl5/Ry5lKm2Ibkpp/OLxpc WmfaOYEV+fWQ1KYiLYh/Ya68hxE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=+1cGrw+OPQK40A2IAny9+k mhWQg=; b=VXIDX2DhLDdNXTQlQkGtnQzHa29Yl9fjDMmHvTmhPPNEHHmOS+Ys0G UXQHmtSqZ8CdTtPb7ytfhrfgw/uFJmXL1AkNyk+KL2LsnU4d+ODXUazxFC6Br2fS 81phikkZufuGNsncWecyz3QPGQ0Rw5XjmAYyl6s1AW9NMwOivXQd4= Received: (qmail 15966 invoked by alias); 16 Jun 2013 09:20:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 15954 invoked by uid 89); 16 Jun 2013 09:20:01 -0000 X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 16 Jun 2013 09:19:58 +0000 Received: by mail-wi0-f180.google.com with SMTP id c10so1369283wiw.1 for ; Sun, 16 Jun 2013 02:19:56 -0700 (PDT) X-Received: by 10.180.108.168 with SMTP id hl8mr2421761wib.23.1371374396580; Sun, 16 Jun 2013 02:19:56 -0700 (PDT) Received: from localhost ([2.26.176.198]) by mx.google.com with ESMTPSA id r9sm14150967wik.1.2013.06.16.02.19.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 16 Jun 2013 02:19:55 -0700 (PDT) From: Richard Sandiford To: =?utf-8?Q?J=C3=BCrgen_Urban?= Mail-Followup-To: =?utf-8?Q?J=C3=BCrgen_Urban?= , gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] MIPS r5900, --with-llsc=? References: <87zjv77ygt.fsf@talisman.default> <87k3lz5ecn.fsf@talisman.default> Date: Sun, 16 Jun 2013 10:19:49 +0100 In-Reply-To: (=?utf-8?Q?=22J=C3=BCrgen?= Urban"'s message of "Sun, 16 Jun 2013 00:02:26 +0200 (CEST)") Message-ID: <87fvwi1kga.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 X-Virus-Found: No "Jürgen Urban" writes: > Hello Richard, > >> >> > How much other changes will be currently accepted here? There is other >> >> > stuff which I want to prepare and submit here, e.g.: > >> >> > 3. fix use of ll/sc in libgomp, either increase mips ISA level or use >> >> > syscall (which is broken in Linux 2.6.35.4). > > The attached patch fixes problem 3. libgomp was not the cause of the > problem. When linux is detected in gcc/config.gcc, the variable > "with_llsc" is set to "yes". This happens before the CPU is checked. I > fixed this by storing the original parameter. I think this is better > than moving the code up. I think this shows that the current mips*-linux* targets are setting with_llsc in the wrong place. They should be doing it further down, where other with_foo defaults are set. Also, I only just noticed that VxWorks and R5900 were setting with_arch in the with_cpu block. --with-cpu isn't supported/meaningful for MIPS. Is the second patch below OK for your target? (Not yet applied.) > The patch for gcc/config/mips/mips.h fixes that ".set mips2" wasn't used > when with_llsc=yes was configured. > > The patch for gcc/config/mips/mips.c gets lld and scd working. These > instructions are normally not emulated by the Linux kernel and the > syscall only supports 32 bit. So I changed my kernel to support lld and > scd. Looks good, thanks. I tweaked the mips.c change to follow coding conventions and kept !TARGET_MIPS16 last. Applied as follows. Thanks, Richard [Applied patch] gcc/ 2013-06-16 Jürgen Urban * config/mips/mips.h (ISA_HAS_LL_SC): Exclude TARGET_MIPS5900. * config/mips/mips.c (mips_start_ll_sc_sync_block): Output ".set mips3" for 64-bit targets. [Suggested config.gcc patch] gcc/ * config.gcc (mips*-mti-linux*, mips64*-*-linux*, mipsisa64*-*-linux*) (mips*-*-linux*): Move default with_llsc setting to where other defaults are set. (mips*-*-vxworks*): Move with_arch default from with_cpu block to with_arch block. (mips64r5900-*-*, mips64r5900el-*-*, mipsr5900-*-*, mipsr5900el-*-*): Likewise. Remove default with_tune setting. Move default float setting to its own block. Handle with_llsc in the same block as above. Index: gcc/config.gcc =================================================================== --- gcc/config.gcc 2013-06-16 09:41:57.518019616 +0100 +++ gcc/config.gcc 2013-06-16 09:59:57.660470388 +0100 @@ -1813,7 +1813,6 @@ mips*-mti-linux*) tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33 MIPS_ABI_DEFAULT=ABI_32" gnu_ld=yes gas=yes - test x$with_llsc != x || with_llsc=yes ;; mips64*-*-linux* | mipsisa64*-*-linux*) tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h mips/linux-common.h" @@ -1834,7 +1833,6 @@ mips64*-*-linux* | mipsisa64*-*-linux*) esac gnu_ld=yes gas=yes - test x$with_llsc != x || with_llsc=yes ;; mips*-*-linux*) # Linux MIPS, either endian. tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h" @@ -1850,7 +1848,6 @@ mips*-*-linux*) # Linux MIPS, either mipsisa32*) tm_defines="${tm_defines} MIPS_ISA_DEFAULT=32" esac - test x$with_llsc != x || with_llsc=yes ;; mips*-mti-elf*) tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h mips/mti-elf.h" @@ -2982,22 +2979,6 @@ if test x$with_cpu = x ; then ;; esac ;; - mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*) - with_arch=r5900 - with_tune=r5900 - if test x$with_llsc = x; then - # r5900 doesn't support ll, sc, lld and scd instructions: - with_llsc=no - fi - if test x$with_float = x; then - # r5900 doesn't support 64 bit float: - # 32 bit float doesn't comply with IEEE 754. - with_float=soft - fi - ;; - mips*-*-vxworks) - with_arch=mips2 - ;; powerpc*-*-*spe*) if test x$enable_e500_double = xyes; then with_cpu=8548 @@ -3058,6 +3039,12 @@ if test x$with_arch = x ; then x86_64-*-*) with_arch=$arch ;; + mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*) + with_arch=r5900 + ;; + mips*-*-vxworks) + with_arch=mips2 + ;; esac # Avoid overriding --with-arch-32 and --with-arch-64 values. @@ -3092,6 +3079,17 @@ if test x$with_arch = x ; then esac fi +# Infer a default setting for --with-float. +if test x$with_float = x; then + case ${target} in + mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*) + # The R5900 doesn't support 64-bit float. 32-bit float doesn't + # comply with IEEE 754. + with_float=soft + ;; + esac +fi + # Support --with-fpmath. if test x$with_fpmath != x; then case ${target} in @@ -3126,6 +3124,20 @@ if test x$with_schedule = x; then esac fi +# Infer a default setting for --with-llsc. +if test x$with_llsc = x; then + case ${target} in + mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*) + # The R5900 doesn't support LL(D) and SC(D). + with_llsc=no + ;; + mips*-*-linux*) + # The kernel emulates LL and SC where necessary. + with_llsc=yes + ;; + esac +fi + # Validate and mark as valid any --with options supported # by this target. In order to use a particular --with option # you must list it in supported_defaults; validating the value