From patchwork Tue Sep 6 21:05:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 113667 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 DF35EB6F70 for ; Wed, 7 Sep 2011 07:05:45 +1000 (EST) Received: (qmail 5051 invoked by alias); 6 Sep 2011 21:05:43 -0000 Received: (qmail 5042 invoked by uid 22791); 6 Sep 2011 21:05:42 -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, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Sep 2011 21:05:28 +0000 Received: by yxl11 with SMTP id 11so3268264yxl.20 for ; Tue, 06 Sep 2011 14:05:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.253.15 with SMTP id a15mr582748ybi.82.1315343127455; Tue, 06 Sep 2011 14:05:27 -0700 (PDT) Received: by 10.146.86.16 with HTTP; Tue, 6 Sep 2011 14:05:27 -0700 (PDT) Date: Tue, 6 Sep 2011 23:05:27 +0200 Message-ID: Subject: [PATCH, i386]: Fix XPASS: gcc.target/i386/builtin-apply-mmx.c execution test + some cleanups 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! x32 follows x86_64 ABI, so no MMX regs are saved/restored in __builtin_apply_args/__builtin_return, even with -mmmx. The patch also includes some cleanups in this area. 2011-09-06 Uros Bizjak * config/i386/i386.c (ix86_function_value_regno_p): Use AX_REG. (function_value_32): Do not check TARGET_MMX, TARGET_SSE or TARGET_AVX. testsuite/ChangeLog: 2011-09-06 Uros Bizjak * gcc.target/i386/builtin-apply-mmx.c: Require ia32 effective target. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 178608) +++ config/i386/i386.c (working copy) @@ -7015,7 +7015,7 @@ ix86_function_value_regno_p (const unsigned int re { switch (regno) { - case 0: + case AX_REG: return true; case FIRST_FLOAT_REG: @@ -7053,18 +7053,18 @@ function_value_32 (enum machine_mode orig_mode, en we normally prevent this case when mmx is not available. However some ABIs may require the result to be returned like DImode. */ if (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 8) - regno = TARGET_MMX ? FIRST_MMX_REG : 0; + regno = FIRST_MMX_REG; /* 16-byte vector modes in %xmm0. See ix86_return_in_memory for where we prevent this case when sse is not available. However some ABIs may require the result to be returned like integer TImode. */ else if (mode == TImode || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16)) - regno = TARGET_SSE ? FIRST_SSE_REG : 0; + regno = FIRST_SSE_REG; /* 32-byte vector modes in %ymm0. */ else if (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 32) - regno = TARGET_AVX ? FIRST_SSE_REG : 0; + regno = FIRST_SSE_REG; /* Floating point return values in %st(0) (unless -mno-fp-ret-in-387). */ else if (X87_FLOAT_MODE_P (mode) && TARGET_FLOAT_RETURNS_IN_80387) @@ -7098,6 +7098,8 @@ function_value_64 (enum machine_mode orig_mode, en /* Handle libcalls, which don't provide a type node. */ if (valtype == NULL) { + unsigned int regno; + switch (mode) { case SFmode: @@ -7108,15 +7110,19 @@ function_value_64 (enum machine_mode orig_mode, en case SDmode: case DDmode: case TDmode: - return gen_rtx_REG (mode, FIRST_SSE_REG); + regno = FIRST_SSE_REG; + break; case XFmode: case XCmode: - return gen_rtx_REG (mode, FIRST_FLOAT_REG); + regno = FIRST_FLOAT_REG; + break; case TCmode: return NULL; default: - return gen_rtx_REG (mode, AX_REG); + regno = AX_REG; } + + return gen_rtx_REG (mode, regno); } else if (POINTER_TYPE_P (valtype)) { Index: testsuite/gcc.target/i386/builtin-apply-mmx.c =================================================================== --- testsuite/gcc.target/i386/builtin-apply-mmx.c (revision 178608) +++ testsuite/gcc.target/i386/builtin-apply-mmx.c (working copy) @@ -11,7 +11,7 @@ /* { dg-do run { xfail { ! *-*-darwin* } } } */ /* { dg-options "-O2 -mmmx" } */ -/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target ia32 } */ #include "mmx-check.h"