[PATCH] D124435: [X86] Always extend the integer parameters in callee
Phoebe Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 26 05:21:42 PDT 2022
pengfei added inline comments.
================
Comment at: clang/test/CodeGen/X86/integer_argument_passing.c:2
+// RUN: %clang_cc1 -O2 -triple -x86_64-linux-gnu %s -emit-llvm -o - | FileCheck %s --check-prefixes=EXTEND,CHECK
+// RUN: %clang_cc1 -O2 -triple -i386-linux-gnu %s -emit-llvm -o - | FileCheck %s --check-prefixes=EXTEND,CHECK
+// RUN: %clang_cc1 -O2 -triple -i386-pc-win32 %s -emit-llvm -o - | FileCheck %s --check-prefixes=EXTEND,CHECK
----------------
pengfei wrote:
> LiuChen3 wrote:
> > pengfei wrote:
> > > Maybe we can remove the tests for i386 given it's only for 64 bits ABI?
> > According to the meaning of `ConservativeExtend`, I think the 32bit ABI needs to be modified as well:
> > https://godbolt.org/z/W1Ma1T3f3
> > The dump of currently clang-cl:
> > ```
> > _square:
> > movb 4(%esp), %al
> > mulb %al
> > mulb 8(%esp)
> > retl
> >
> > .def _baz;
> > .scl 2;
> > .type 32;
> > .endef
> > .section .text,"xr",one_only,_baz
> > .globl _baz
> > .p2align 4, 0x90
> > _baz:
> > movswl 4(%esp), %eax
> > pushl %eax
> > calll _bar
> > addl $4, %esp
> > retl
> > ```
> > Of course with this patch the behavior of clang-cl is still different from cl.exe, but I think it fits the meaning of `ConservativeExtend`.
> My point was, i386 is passing arguments by stack. The extensions don't make sense under the circumstances. That's what I understood the comments in above test 2007-06-18-SextAttrAggregate.c
Oh, seems I misunderstood it. The stack still needs extensions since it's aligned to 4 bytes. But from the above output, the clang-cl is wrong, because it extends on caller which MSVC extends on callee. So back the another question, we should change for Windows too, right?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124435/new/
https://reviews.llvm.org/D124435
More information about the cfe-commits
mailing list