Files
clang-p2996/llvm/test/CodeGen/X86/stdcall.ll
Wesley Wiser 2dd883439c [Mangler] Calculate the argument list byte count suffix correctly when returning large values
`__stdcall`, `__fastcall` and `__vectorcall` return large values via a
hidden pointer argument. However, the size of that argument should not
be included in the argument list byte count suffix added to the
function's decorated name.

This patch fixes that issue so that LLVM generates the same decorated
name as MSVC does.

MSVC example: https://godbolt.org/z/nc35MKPhr

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D110719
2021-09-29 11:42:28 -07:00

40 lines
1.1 KiB
LLVM

; RUN: llc -mtriple="i386-pc-mingw32" < %s | FileCheck %s
; PR5851
%0 = type { void (...)* }
define internal x86_stdcallcc void @MyFunc() nounwind {
entry:
; CHECK: MyFunc@0:
; CHECK: retl
ret void
}
; PR14410
define x86_stdcallcc i32 @"\01DoNotMangle"(i32 %a) {
; CHECK: DoNotMangle:
; CHECK: retl $4
entry:
ret i32 %a
}
%struct.large_type = type { i64, i64, i64 }
define x86_stdcallcc void @ReturnLargeType(%struct.large_type* noalias nocapture sret(%struct.large_type) align 8 %agg.result) {
; CHECK: ReturnLargeType@0:
; CHECK: retl
entry:
%a = getelementptr inbounds %struct.large_type, %struct.large_type* %agg.result, i32 0, i32 0
store i64 123, i64* %a, align 8
%b = getelementptr inbounds %struct.large_type, %struct.large_type* %agg.result, i32 0, i32 1
store i64 456, i64* %b, align 8
%c = getelementptr inbounds %struct.large_type, %struct.large_type* %agg.result, i32 0, i32 2
store i64 789, i64* %c, align 8
ret void
}
@B = global %0 { void (...)* bitcast (void ()* @MyFunc to void (...)*) }, align 4
; CHECK: _B:
; CHECK: .long _MyFunc@0