From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CC6A23858D32; Mon, 8 May 2023 09:06:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC6A23858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683536781; bh=6S8dpbYt1oQ/sTpSANtZEZhdlT1I6pWQlfYDVs+64c4=; h=From:To:Subject:Date:From; b=CnXfKej31ck2OCl/1tqd5O9n5mBcpL9wMRSFpgwqp6m/o8IEltvwiN2ndfPKzPvN2 tHK1f0E/wgALBwtxGK2uCpv86zEJ9eLeeTdbfX/hV0MlZhrxFnccDw69fNQZ2aLXir EeLzXAVhK2N0IO6/t3AFeolEZ2IqBFMWtlbjgkFU= From: "pskocik at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109766] New: Passing doubles through the stack generates a stack adjustment pear each such argument at -Os/-Oz. Date: Mon, 08 May 2023 09:06:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pskocik at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109766 Bug ID: 109766 Summary: Passing doubles through the stack generates a stack adjustment pear each such argument at -Os/-Oz. Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: pskocik at gmail dot com Target Milestone: --- /* Passing doubles through the stack generates a stack adjustment pear each s= uch argument at -Os/-Oz. These stack adjustments are only coalesced at -O1/-O2/-O3, leaving -Os/-Oz with larger code. */ #define $expr(...) (__extension__({__VA_ARGS__;})) #define $regF0 $expr(register double x __asm("xmm0"); x) #define $regF1 $expr(register double x __asm("xmm1"); x) #define $regF2 $expr(register double x __asm("xmm2"); x) #define $regF3 $expr(register double x __asm("xmm3"); x) #define $regF4 $expr(register double x __asm("xmm4"); x) #define $regF5 $expr(register double x __asm("xmm5"); x) #define $regF6 $expr(register double x __asm("xmm6"); x) #define $regF7 $expr(register double x __asm("xmm7"); x) void func(char const*Fmt, ...); void callfunc(char const*Fmt, double D0, double D1, double D2, double D3, double D4, double D5, double D6, double D7){ func(Fmt,$regF0,$regF1,$regF2,$regF3,$regF4,$regF5,$regF6,$regF7, D0,D1,D2,D3,D4,D5,D6,D7); /* //gcc @ -Os/-Oz 0000000000000000 : 0: 50 push %rax 1: b0 08 mov $0x8,%al 3: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 8: 66 0f d6 3c 24 movq %xmm7,(%rsp) d: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 12: 66 0f d6 34 24 movq %xmm6,(%rsp) 17: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 1c: 66 0f d6 2c 24 movq %xmm5,(%rsp) 21: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 26: 66 0f d6 24 24 movq %xmm4,(%rsp) 2b: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 30: 66 0f d6 1c 24 movq %xmm3,(%rsp) 35: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 3a: 66 0f d6 14 24 movq %xmm2,(%rsp) 3f: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 44: 66 0f d6 0c 24 movq %xmm1,(%rsp) 49: 48 8d 64 24 f8 lea -0x8(%rsp),%rsp 4e: 66 0f d6 04 24 movq %xmm0,(%rsp) 53: e8 00 00 00 00 callq 58 54: R_X86_64_PLT32 func-0x4 58: 48 83 c4 48 add $0x48,%rsp 5c: c3 retq $sz(callfunc)=3D93 //clang @ -Os/-Oz 0000000000000000 : 0: 48 83 ec 48 sub $0x48,%rsp 4: f2 0f 11 7c 24 38 movsd %xmm7,0x38(%rsp) a: f2 0f 11 74 24 30 movsd %xmm6,0x30(%rsp) 10: f2 0f 11 6c 24 28 movsd %xmm5,0x28(%rsp) 16: f2 0f 11 64 24 20 movsd %xmm4,0x20(%rsp) 1c: f2 0f 11 5c 24 18 movsd %xmm3,0x18(%rsp) 22: f2 0f 11 54 24 10 movsd %xmm2,0x10(%rsp) 28: f2 0f 11 4c 24 08 movsd %xmm1,0x8(%rsp) 2e: f2 0f 11 04 24 movsd %xmm0,(%rsp) 33: b0 08 mov $0x8,%al 35: e8 00 00 00 00 callq 3a 36: R_X86_64_PLT32 func-0x4 3a: 48 83 c4 48 add $0x48,%rsp 3e: c3 retq=20=20=20 $sz(callfunc)=3D63 //gcc @ -O1 0000000000000000 : 0: 48 83 ec 48 sub $0x48,%rsp 4: f2 0f 11 7c 24 38 movsd %xmm7,0x38(%rsp) a: f2 0f 11 74 24 30 movsd %xmm6,0x30(%rsp) 10: f2 0f 11 6c 24 28 movsd %xmm5,0x28(%rsp) 16: f2 0f 11 64 24 20 movsd %xmm4,0x20(%rsp) 1c: f2 0f 11 5c 24 18 movsd %xmm3,0x18(%rsp) 22: f2 0f 11 54 24 10 movsd %xmm2,0x10(%rsp) 28: f2 0f 11 4c 24 08 movsd %xmm1,0x8(%rsp) 2e: f2 0f 11 04 24 movsd %xmm0,(%rsp) 33: b8 08 00 00 00 mov $0x8,%eax 38: e8 00 00 00 00 callq 3d 39: R_X86_64_PLT32 func-0x4 3d: 48 83 c4 48 add $0x48,%rsp 41: c3 retq=20=20=20 $sz(callfunc)=3D66 */ } https://godbolt.org/z/d8T3hxqWK=