Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions llvm/lib/Target/Hexagon/HexagonCallingConv.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
//
//===----------------------------------------------------------------------===//


class CCIfBothVarArgAndArgVarArg<CCAction A>
: CCIf<"State.isVarArg() && ArgFlags.isVarArg()", A>;

def CC_HexagonStack: CallingConv<[
CCIfType<[i32,v2i16,v4i8],
CCAssignToStack<4,4>>,
Expand All @@ -23,7 +27,7 @@ def CC_Hexagon_Legacy: CallingConv<[

CCIfByVal<
CCPassByVal<8,8>>,
CCIfArgVarArg<
CCIfBothVarArgAndArgVarArg<
CCDelegateTo<CC_HexagonStack>>,

// Pass split values in pairs, allocate odd register if necessary.
Expand Down Expand Up @@ -53,7 +57,7 @@ def CC_Hexagon: CallingConv<[

CCIfByVal<
CCPassByVal<8,1>>,
CCIfArgVarArg<
CCIfBothVarArgAndArgVarArg<
CCDelegateTo<CC_HexagonStack>>,

// Pass split values in pairs, allocate odd register if necessary.
Expand Down
15 changes: 15 additions & 0 deletions llvm/test/CodeGen/Hexagon/vararg-musl.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; RUN: llc -mtriple=hexagon-unknown-linux-musl < %s | FileCheck %s -check-prefix=MUSL
; RUN: llc -mtriple=hexagon-unknown-none-elf < %s | FileCheck %s -check-prefix=NONMUSL
Comment on lines +1 to +2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of (or in addition to?) this test, maybe we should add RUN lines to some of the existing vararg tests?

$ grep RUN llvm/test/CodeGen/Hexagon/vararg*
llvm/test/CodeGen/Hexagon/vararg_align_check.ll:; RUN: llc -mtriple=hexagon -mcpu=hexagonv62 -mtriple=hexagon-unknown-linux-musl -O0 < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/vararg-deallocate-sp.ll:; RUN: llc -mtriple=hexagon -mtriple=hexagon-unknown-linux-musl < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/vararg_double_onstack.ll:; RUN: llc -mtriple=hexagon -mcpu=hexagonv62 -mtriple=hexagon-unknown-linux-musl -O0 < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/vararg-formal.ll:; RUN: llc -mtriple=hexagon < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/vararg-linux-abi.ll:; RUN: llc -mtriple=hexagon -mtriple=hexagon-unknown-linux-musl < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/vararg.ll:; RUN: llc -mtriple=hexagon -mcpu=hexagonv62 -mtriple=hexagon-unknown-linux-musl -O0 < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/vararg_named.ll:; RUN: llc -mtriple=hexagon -mcpu=hexagonv62 -mtriple=hexagon-unknown-linux-musl -O0 < %s | FileCheck %s
llvm/test/CodeGen/Hexagon/varargs-memv.ll:; RUN: llc -mtriple=hexagon < %s

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have looked into the vararg tests and did not immediately find
one that could be readily adapted. The best candidate would be
varargs-memv.ll. However this one also checks for something else.
On the other hand, there may be some value in having a simple
dedicated test like vararg-musl.ll.
If anybody can point me to a suitable test, I can make the adaption,
otherwise I would suggest to just keep vararg-musl.ll as it is.


; MUSL-NOT: memw
; NONMUSL: memw

declare i32 @f0(i32 %a0, ...)

define i32 @f1(i32 %a0, i32 %a1) #0 {
b1:
%v7 = call i32 (i32, ...) @f0(i32 %a0, i32 %a1)
ret i32 %v7
}

attributes #0 = { nounwind }