llvm.org GIT mirror llvm / c689f67
[NVPTX] Add lowering of i128 numbers as struct fields Addition to D34555 - override VTs computation with ComputePTXValueVTs for struct fields. Author: Denys Zariaiev<denys.zariaiev@gmail.com> Differential Revision: https://reviews.llvm.org/D55144 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348057 91177308-0d34-0410-b5e6-96231b3b80d8 Artem Belevich 2 years ago
2 changed file(s) with 25 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
176176 Offsets->push_back(StartingOffset + 8);
177177 }
178178
179 return;
180 }
181
182 // Given a struct type, recursively traverse the elements with custom ComputePTXValueVTs.
183 if (StructType *STy = dyn_cast(Ty)) {
184 auto const *SL = DL.getStructLayout(STy);
185 auto ElementNum = 0;
186 for(auto *EI : STy->elements()) {
187 ComputePTXValueVTs(TLI, DL, EI, ValueVTs, Offsets,
188 StartingOffset + SL->getElementOffset(ElementNum));
189 ++ElementNum;
190 }
179191 return;
180192 }
181193
0 ; RUN: llc < %s -O0 -march=nvptx64 -mcpu=sm_20 | FileCheck %s
1
2 ; CHECK-LABEL: .visible .func (.param .align 16 .b8 func_retval0[32]) foo(
3 define { i128, i128 } @foo(i64 %a, i32 %b) {
4 %1 = sext i64 %a to i128
5 %2 = sext i32 %b to i128
6 %3 = insertvalue { i128, i128 } undef, i128 %1, 0
7 %4 = insertvalue { i128, i128 } %3, i128 %2, 1
8
9 ; CHECK: st.param.v2.b64 [func_retval0+0], {%[[REG1:rd[0-9]+]], %[[REG2:rd[0-9]+]]};
10 ; CHECK: st.param.v2.b64 [func_retval0+16], {%[[REG3:rd[0-9]+]], %[[REG4:rd[0-9]+]]};
11 ret { i128, i128 } %4
12 }