From patchwork Sun Aug 11 02:35:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Perez Read X-Patchwork-Id: 266277 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 BA5B42C00CA for ; Sun, 11 Aug 2013 12:35:25 +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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=Ntspyw+Usj+SKD3sWXoYeZaJkBBTz7RZf0HbEd41EzomxI 637r6hNP2G6muiMmH7N+t2e9kCUt51NWPr58Ybn1TWlYy06uck9itig8fWwOtj11 V29hBNfIuW64qgxqO+wXd33dyIurOg1arXjS2MkmQyg8dtE9Fp17Mbo9U+KE0= 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:date:message-id:subject:from:to:content-type; s= default; bh=qUZCflURsY4kYM/WNnsAyDUWds4=; b=e4eQBK17h6BnJBoRGk5R hw2VegPM7/Oqe19mX1U+YK0FPymMqy9U/hd50UW/ycvwRng/QxmrRbV3HrEKEX54 RlYUea6fPax2o+IgBTxPDqZdmHz73RLckWi8g7D4Gxb/ptDGrLc50+6NNlmOIVKJ gYYzAg197g7GMtUbdaOlTMI= Received: (qmail 31243 invoked by alias); 11 Aug 2013 02:35:16 -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 31215 invoked by uid 89); 11 Aug 2013 02:35:14 -0000 X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.2 Received: from mail-ve0-f194.google.com (HELO mail-ve0-f194.google.com) (209.85.128.194) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 11 Aug 2013 02:35:13 +0000 Received: by mail-ve0-f194.google.com with SMTP id 15so1866289vea.5 for ; Sat, 10 Aug 2013 19:35:11 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.116.70 with SMTP id ju6mr3015866vdb.112.1376188511008; Sat, 10 Aug 2013 19:35:11 -0700 (PDT) Received: by 10.220.189.8 with HTTP; Sat, 10 Aug 2013 19:35:10 -0700 (PDT) Date: Sun, 11 Aug 2013 10:35:10 +0800 Message-ID: Subject: [PATCH] x86-64 gcc generate wrong assembly instruction movabs for intel syntax From: Perez Read To: gcc-patches@gcc.gnu.org X-Virus-Found: No When compiles below testcase with gcc -masm=intel -O2 --cut here-- int test(){ long *ptr = (long*)0xFFFF800000000000; *ptr = -1; return 0; } --cut here-- movabs is incorrectly translated into "mov [rax], -1", and causes compile error "Error: ambiguous operand size for `mov' ". It should be "mov QWORD PTR [rax], -1" Bootstrap passed. Regression tested on x86_64-unknown-linux-gnu (pc). 2013-08-10 Perez Read * config/i386/i386.md (*movabs_1) : Add PTR before operand 0 for intel asm alternative. * testsuite/gcc.target/i386/movabs-1.c : New test. Index: gcc/config/i386/i386.md =================================================================== --- gcc/config/i386/i386.md (revision 201646) +++ gcc/config/i386/i386.md (working copy) @@ -2255,7 +2255,7 @@ "TARGET_LP64 && ix86_check_movabs (insn, 0)" "@ movabs{}\t{%1, %P0|[%P0], %1} - mov{}\t{%1, %a0|%a0, %1}" + mov{}\t{%1, %a0| PTR %a0, %1}" [(set_attr "type" "imov") (set_attr "modrm" "0,*") (set_attr "length_address" "8,0") Index: gcc/testsuite/gcc.target/i386/movabs-1.c =================================================================== --- gcc/testsuite/gcc.target/i386/movabs-1.c (revision 0) +++ gcc/testsuite/gcc.target/i386/movabs-1.c (working copy) @@ -0,0 +1,10 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -masm=intel" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target masm_intel } */ + +void +foo (void) +{ + *(volatile long*)0xFFFF800000000000 = -1; +}