Skip to content

Commit 49d77d8

Browse files
authored
[X86][GlobalISel] Enable nest arguments (#165173)
Nest arguments are supported by CC in X86CallingConv.td. Nothing special is required in GlobalISel as we reuse the code. Nest attribute is mostly generated by fortran frontend.
1 parent 3ce893f commit 49d77d8

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

llvm/lib/Target/X86/GISel/X86CallLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ bool X86CallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
280280
if (Arg.hasAttribute(Attribute::ByVal) ||
281281
Arg.hasAttribute(Attribute::InReg) ||
282282
Arg.hasAttribute(Attribute::SwiftSelf) ||
283-
Arg.hasAttribute(Attribute::SwiftError) ||
284-
Arg.hasAttribute(Attribute::Nest) || VRegs[Idx].size() > 1)
283+
Arg.hasAttribute(Attribute::SwiftError) || VRegs[Idx].size() > 1)
285284
return false;
286285

287286
if (Arg.hasAttribute(Attribute::StructRet)) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86
3+
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X86
4+
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86
5+
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64
6+
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64
7+
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X64
8+
9+
; The src array should be in R10 or ECX register due to nest attribute
10+
define i32 @nest_arg(ptr nest %src) {
11+
; X86-LABEL: nest_arg:
12+
; X86: # %bb.0:
13+
; X86-NEXT: movl 8(%ecx), %eax
14+
; X86-NEXT: retl
15+
;
16+
; X64-LABEL: nest_arg:
17+
; X64: # %bb.0:
18+
; X64-NEXT: movl 8(%r10), %eax
19+
; X64-NEXT: retq
20+
%off = getelementptr [3 x i32], ptr %src, i32 0, i32 2
21+
%ret = load i32, ptr %off
22+
ret i32 %ret
23+
}

0 commit comments

Comments
 (0)