From patchwork Sun Dec 8 21:59:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1205774 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515466-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JZg8Xvcw"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jLrhSyiV"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47WKx953SKz9sP6 for ; Mon, 9 Dec 2019 08:59:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=LY2D02gWB8iy01sqrrQpDhHqleYcngpVtbd7PDY9dlYKI1 WrNURAn4LbXVOgwqpF3eSXd81VCEOlNEuAKVtyOHspnuscjz6OeZx1SHJ9C5jPPL +vjmgdjdH75S4soFk4lV8OsL+oaxz5kaqsVB9i54ZvQYIrLs+5NGQ9/9xPJHU= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=0LbIMxIXNQBr6BT7IkaHfW29+uU=; b=JZg8XvcwLfheSbBN+AIN qgiXMwP0H7GczL/n/IvuXiJ06+kvIJaCw7YUkabnCmK67g8tFvooK92Qq4ohClS4 TzPUTZITh0iuldsuvFMK0/dl0LQIN4me6HNwFdz6JUwUofJ5OiAiAHodCCzLi3Z6 RzQJt84iepFsaloRjMMtBNM= Received: (qmail 34708 invoked by alias); 8 Dec 2019 21:59:31 -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 34697 invoked by uid 89); 8 Dec 2019 21:59:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-ua1-f44.google.com Received: from mail-ua1-f44.google.com (HELO mail-ua1-f44.google.com) (209.85.222.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Dec 2019 21:59:30 +0000 Received: by mail-ua1-f44.google.com with SMTP id q22so1159771uam.6 for ; Sun, 08 Dec 2019 13:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=aW0eS2CbJ5kLiQeL/65FoRu2LOSrZJ27umE2ViU4oG4=; b=jLrhSyiVrJ9skRBPvlW70bYbmnE8VK3/SSU4/CTyQwRvj6Rp7CDIpZtfwSx30i8I+w dfDWFlWzjH+8dVSUVzuhUQI/S3KjiwWUrwv/Dw07yop4FvoyaL0zZYpIX6W2xFXMCQ68 1UqzjwSdJ8cpVc+Fctudnn7tGGAf5geYVFI3bCpctciNyT3PxS7+2oOaH8UrTKm4gIfq ZqyMFOQbgGFoE69uPJTsu70s9qp5DW2oLsTXWK5fLwuhmAF3/Uc03fHqZ8/WL7x9b79U Pt+19NBAY5/obVgB33Db6mlbh0Mwg52MHGk3hDSVQfupG5pwGBtv0i2CJ/I0eXd8AoHN hUAA== MIME-Version: 1.0 From: Andrew Pinski Date: Sun, 8 Dec 2019 13:59:16 -0800 Message-ID: Subject: [committed] Add a bswap testcase To: GCC Patches X-IsSubscribed: yes Hi, While testing a GCC patch (which I am not ready to submit yet), I wrote a testcase which had produced wrong code (with an earlier version of the patch). There was no other testcase for it in the testsuite so I adding one. This is a reduced testcase from the uboot PCIe code. Thanks, Andrew Pinski * gcc.c-torture/execute/bswap-3.c: New testcase. Index: ChangeLog =================================================================== --- ChangeLog (revision 279099) +++ ChangeLog (working copy) @@ -1,3 +1,7 @@ +2019-12-08 Andrew Pinski + + * gcc.c-torture/execute/bswap-3.c: New test. + 2019-12-08 Sandra Loosemore Revert: Index: gcc.c-torture/execute/bswap-3.c =================================================================== --- gcc.c-torture/execute/bswap-3.c (nonexistent) +++ gcc.c-torture/execute/bswap-3.c (working copy) @@ -0,0 +1,25 @@ +/* { dg-require-effective-target int32plus } */ + +int f(unsigned int a) __attribute__((noipa)); +int f(unsigned int a) +{ + return ((__builtin_bswap32(a))>>24) & 0x3; +} + + +int g(unsigned int a) __attribute__((noipa)); +int g(unsigned int a) +{ + return a&0x3; +} + +int main(void) +{ + for (int b = 0; b <= 0xF; b++) + { + if (f(b) != g(b)) + __builtin_abort (); + } + return 0; +} +