From patchwork Mon Nov 7 21:03:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 124183 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]) by ozlabs.org (Postfix) with SMTP id 4827C1007D4 for ; Tue, 8 Nov 2011 08:04:06 +1100 (EST) Received: (qmail 20594 invoked by alias); 7 Nov 2011 21:04:02 -0000 Received: (qmail 20578 invoked by uid 22791); 7 Nov 2011 21:04:01 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Nov 2011 21:03:41 +0000 Received: by gyh4 with SMTP id 4so4887534gyh.20 for ; Mon, 07 Nov 2011 13:03:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.192.132 with SMTP id i4mr37954156yhn.80.1320699821261; Mon, 07 Nov 2011 13:03:41 -0800 (PST) Received: by 10.147.114.16 with HTTP; Mon, 7 Nov 2011 13:03:41 -0800 (PST) Date: Mon, 7 Nov 2011 22:03:41 +0100 Message-ID: Subject: [PATCH, i386]: Vectorize BUILT_IN_{I,LL}RINT{,F} when appropriate From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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 Hello! Attached patch fixes omission from "(int) rint ()" conversion to __builtin_irint (). We can vectorize this function when out_mode is SImode, no matter how the builtin is called. Throw in also BUILT_IN_LLRINT, just for completion ... 2011-11-07 Uros Bizjak * config/i386/i386.c (ix86_builtin_vectorized_function): Handle BUILT_IN_IRINT, BUILT_IN_IRINTF, BUILT_IN_LLRINT and BUILT_IN_LLRINTF. Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. BTW: It would be nice if convert.c also converted "(int) lrint ()" to __builtin_lrint (), but this is somehow beyond my middle-end skills... Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 181110) +++ config/i386/i386.c (working copy) @@ -29268,13 +29268,17 @@ ix86_builtin_vectorized_function (tree fndecl, tre } break; + case BUILT_IN_IRINT: case BUILT_IN_LRINT: + case BUILT_IN_LLRINT: if (out_mode == SImode && out_n == 4 && in_mode == DFmode && in_n == 2) return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX]; break; + case BUILT_IN_IRINTF: case BUILT_IN_LRINTF: + case BUILT_IN_LLRINTF: if (out_mode == SImode && in_mode == SFmode) { if (out_n == 4 && in_n == 4)