diff mbox

[i386] : Prevent to assume for 64-bit ms-abi that DX_REG is used as function-value

Message ID CAEwic4Ym-HtjP03VFKWXYBcvQuoLe=KejMtL7iHnLEFBOR3LvA@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz June 3, 2014, 6:21 p.m. UTC
Hello,

this patch fixes a nit detected in ix86_function_value_regno_p.  For
x64 ms-abi we don't have DX_REG-register as valid function-value
register.

ChangeLog

2014-06-03  Kai Tietz  <ktietz@redhat.com>

        * config/i386/i386.c (ix86_function_value_regno_p): Disallow DX_REG for
        64-bit ms-abi.

Tested for x86_64-w64-mingw32, and x86_64-unknown-linux-gnu.  If there
are no objections I will commit that patch tomorrow.

Regards,
Kai

Comments

Richard Henderson June 3, 2014, 7:57 p.m. UTC | #1
On 06/03/2014 11:21 AM, Kai Tietz wrote:
>      case AX_REG:
>      case DX_REG:
> -      return true;
> +      return (regno != DX_REG || !TARGET_64BIT || ix86_abi != MS_ABI);

You might as well eliminate the first test, and split the case entries:

  case AX_REG:
    return true;
  case DX_REG:
    return !TARGET_64BIT || ix86_abi != MS_ABI;

Otherwise it looks ok.


r~
diff mbox

Patch

Index: i386.c
===================================================================
--- i386.c      (Revision 211198)
+++ i386.c      (Arbeitskopie)
@@ -7775,7 +7775,7 @@  ix86_function_value_regno_p (const unsigned int r
     {
     case AX_REG:
     case DX_REG:
-      return true;
+      return (regno != DX_REG || !TARGET_64BIT || ix86_abi != MS_ABI);
     case DI_REG:
     case SI_REG:
       return TARGET_64BIT && ix86_abi != MS_ABI;