Skip to content

Commit 9b24ccc

Browse files
authored
[NVPTX] Allow more argument integer types, such as i256 and i96 (#154824)
The refactoring of ComputePTXValueVTs in #154476 caused the complier to no longer crash when lowering i256 and i96. This has caused a few tests to unexpectedly pass. Update these tests and tweak how we emit parameter declarations to correctly lower these types.
1 parent 933d872 commit 9b24ccc

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

llvm/lib/Target/NVPTX/NVPTXUtilities.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@ inline unsigned promoteScalarArgumentSize(unsigned size) {
8282
return 32;
8383
if (size <= 64)
8484
return 64;
85+
if (size <= 128)
86+
return 128;
8587
return size;
8688
}
8789

8890
bool shouldEmitPTXNoReturn(const Value *V, const TargetMachine &TM);
8991

9092
inline bool shouldPassAsArray(Type *Ty) {
9193
return Ty->isAggregateType() || Ty->isVectorTy() ||
92-
Ty->getScalarSizeInBits() == 128 || Ty->isHalfTy() || Ty->isBFloatTy();
94+
Ty->getScalarSizeInBits() >= 128 || Ty->isHalfTy() || Ty->isBFloatTy();
9395
}
9496

9597
namespace NVPTX {

llvm/test/CodeGen/Generic/add-with-overflow-128.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
; RUN: llc < %s
22

3-
; NVPTX fails to LowerFormalArguments for arg type i96
4-
; the arg byte size must be one of the {16, 8, 4, 2}
5-
; XFAIL: target=nvptx{{.*}}
63

74
@ok = internal constant [4 x i8] c"%d\0A\00"
85
@no = internal constant [4 x i8] c"no\0A\00"

llvm/test/CodeGen/Generic/icmp-illegal.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
; RUN: llc < %s | FileCheck %s
22

3-
; NVPTX fails to LowerFormalArguments for arg size > i128
4-
; the arg byte size must be one of the {16, 8, 4, 2}
5-
; XFAIL: target=nvptx{{.*}}
6-
73
; CHECK-LABEL: test_ult
84
define i1 @test_ult(i256 %a) nounwind {
95
%1 = icmp ult i256 %a, -6432394258550908438

0 commit comments

Comments
 (0)