From owner-svn-src-head@freebsd.org Sun May 21 23:15:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A01FD78163; Sun, 21 May 2017 23:15:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 355E01193; Sun, 21 May 2017 23:15:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4LNFX9a067722; Sun, 21 May 2017 23:15:33 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4LNFWQw067717; Sun, 21 May 2017 23:15:32 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705212315.v4LNFWQw067717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 21 May 2017 23:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r318601 - in head: contrib/compiler-rt/lib/builtins lib/libcompiler_rt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 May 2017 23:15:34 -0000 Author: adrian Date: Sun May 21 23:15:32 2017 New Revision: 318601 URL: https://svnweb.freebsd.org/changeset/base/318601 Log: [libcompiler-rt] add bswapdi2/bswapsi2 This is required for mips gcc 6.3 userland to build/run. Reviewed by: emaste, dim Approved by: emaste Differential Revision: https://reviews.freebsd.org/D10838 Added: head/contrib/compiler-rt/lib/builtins/bswapdi2.c (contents, props changed) head/contrib/compiler-rt/lib/builtins/bswapsi2.c (contents, props changed) Modified: head/contrib/compiler-rt/lib/builtins/README.txt head/lib/libcompiler_rt/Makefile.inc Modified: head/contrib/compiler-rt/lib/builtins/README.txt ============================================================================== --- head/contrib/compiler-rt/lib/builtins/README.txt Sun May 21 22:28:28 2017 (r318600) +++ head/contrib/compiler-rt/lib/builtins/README.txt Sun May 21 23:15:32 2017 (r318601) @@ -57,8 +57,8 @@ si_int __popcountsi2(si_int a); // bit si_int __popcountdi2(di_int a); // bit population si_int __popcountti2(ti_int a); // bit population -uint32_t __bswapsi2(uint32_t a); // a byteswapped, arm only -uint64_t __bswapdi2(uint64_t a); // a byteswapped, arm only +uint32_t __bswapsi2(uint32_t a); // a byteswapped, arm/mips only +uint64_t __bswapdi2(uint64_t a); // a byteswapped, arm/mips only // Integral arithmetic Added: head/contrib/compiler-rt/lib/builtins/bswapdi2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/builtins/bswapdi2.c Sun May 21 23:15:32 2017 (r318601) @@ -0,0 +1,28 @@ +/* ===-- bswapdi2.c - Implement __bswapdi2 ---------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __bswapdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +COMPILER_RT_ABI uint64_t +__bswapdi2 (uint64_t u) +{ + return ((((u) & 0xff00000000000000ULL) >> 56) + | (((u) & 0x00ff000000000000ULL) >> 40) + | (((u) & 0x0000ff0000000000ULL) >> 24) + | (((u) & 0x000000ff00000000ULL) >> 8) + | (((u) & 0x00000000ff000000ULL) << 8) + | (((u) & 0x0000000000ff0000ULL) << 24) + | (((u) & 0x000000000000ff00ULL) << 40) + | (((u) & 0x00000000000000ffULL) << 56)); +} Added: head/contrib/compiler-rt/lib/builtins/bswapsi2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/compiler-rt/lib/builtins/bswapsi2.c Sun May 21 23:15:32 2017 (r318601) @@ -0,0 +1,25 @@ +/* ===-- bswapsi2.c - Implement __bswapsi2 ---------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __bswapsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +COMPILER_RT_ABI uint32_t +__bswapsi2 (uint32_t u) +{ + + return ((((u) & 0xff000000) >> 24) + | (((u) & 0x00ff0000) >> 8) + | (((u) & 0x0000ff00) << 8) + | (((u) & 0x000000ff) << 24)); +} Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Sun May 21 22:28:28 2017 (r318600) +++ head/lib/libcompiler_rt/Makefile.inc Sun May 21 23:15:32 2017 (r318601) @@ -224,3 +224,10 @@ SRCS+= switch8.S SRCS+= switchu8.S SRCS+= sync_synchronize.S .endif + +# GCC-6.3 on mips32 requires bswap32 built-in. +.if ${MACHINE_CPUARCH} == "mips" +SRCS+= bswapdi2.c +SRCS+= bswapsi2.c +.endif +