Skip to content

Commit fc9ec25

Browse files
committed
Fix lit test
1 parent b0aa1db commit fc9ec25

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2332,14 +2332,15 @@ SDValue NVPTXTargetLowering::LowerBITCAST(SDValue Op, SelectionDAG &DAG) const {
23322332
EVT fromVT = Op->getOperand(0)->getValueType(0);
23332333

23342334
if (VT == MVT::v2i8) {
2335+
// Bitcast to i16 and unpack elements into a vector
23352336
SDValue reg = maybeBitcast(MVT::i16, Op->getOperand(0));
2336-
// Promote result to v2i16
23372337
SDValue v0 = DAG.getNode(ISD::TRUNCATE, dl, MVT::i8, reg);
23382338
SDValue C8 = DAG.getConstant(8, dl, MVT::i16);
23392339
SDValue v1 = DAG.getNode(ISD::TRUNCATE, dl, MVT::i8,
23402340
DAG.getNode(ISD::SRL, dl, MVT::i16, {reg, C8}));
23412341
return DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v2i8, {v0, v1});
23422342
} else if (fromVT == MVT::v2i8) {
2343+
// Pack vector elements into i16 and bitcast to final type
23432344
SDValue v0 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i8,
23442345
Op->getOperand(0), DAG.getIntPtrConstant(0, dl));
23452346
SDValue v1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i8,

llvm/test/CodeGen/NVPTX/i8x2-instructions.ll

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_90 -mattr=+ptx80 -asm-verbose=false \
22
; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
3-
; RUN: | FileCheck -allow-deprecated-dag-overlap -check-prefixes COMMON,I16x2 %s
3+
; RUN: | FileCheck %s
44
; RUN: %if ptxas %{ \
55
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mcpu=sm_90 -asm-verbose=false \
66
; RUN: -O0 -disable-post-ra -frame-pointer=all -verify-machineinstrs \
@@ -9,26 +9,26 @@
99

1010
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
1111

12-
; COMMON-LABEL: test_trunc_2xi8(
13-
; COMMON: ld.param.u32 [[R1:%r[0-9]+]], [test_trunc_2xi8_param_0];
14-
; COMMON: mov.b32 {[[RS1:%rs[0-9]+]], [[RS2:%rs[0-9]+]]}, [[R1]];
15-
; COMMON: shl.b16 [[RS3:%rs[0-9]+]], [[RS2]], 8;
16-
; COMMON: and.b16 [[RS4:%rs[0-9]+]], [[RS1]], 255;
17-
; COMMON: or.b16 [[RS5:%rs[0-9]+]], [[RS4]], [[RS3]]
18-
; COMMON: cvt.u32.u16 [[R2:%r[0-9]]], [[RS5]]
19-
; COMMON: st.param.b32 [func_retval0+0], [[R2]];
12+
; CHECK-LABEL: test_trunc_2xi8(
13+
; CHECK: ld.param.u32 [[R1:%r[0-9]+]], [test_trunc_2xi8_param_0];
14+
; CHECK: mov.b32 {[[RS1:%rs[0-9]+]], [[RS2:%rs[0-9]+]]}, [[R1]];
15+
; CHECK: shl.b16 [[RS3:%rs[0-9]+]], [[RS2]], 8;
16+
; CHECK: and.b16 [[RS4:%rs[0-9]+]], [[RS1]], 255;
17+
; CHECK: or.b16 [[RS5:%rs[0-9]+]], [[RS4]], [[RS3]]
18+
; CHECK: cvt.u32.u16 [[R2:%r[0-9]]], [[RS5]]
19+
; CHECK: st.param.b32 [func_retval0], [[R2]];
2020
define i16 @test_trunc_2xi8(<2 x i16> %a) #0 {
2121
%trunc = trunc <2 x i16> %a to <2 x i8>
2222
%res = bitcast <2 x i8> %trunc to i16
2323
ret i16 %res
2424
}
2525

26-
; COMMON-LABEL: test_zext_2xi8(
27-
; COMMON: ld.param.u16 [[RS1:%rs[0-9]+]], [test_zext_2xi8_param_0];
28-
; COMMON: shr.u16 [[RS2:%rs[0-9]+]], [[RS1]], 8;
29-
; COMMON: mov.b32 [[R1:%r[0-9]+]], {[[RS1]], [[RS2]]}
30-
; COMMON: and.b32 [[R2:%r[0-9]+]], [[R1]], 16711935;
31-
; COMMON: st.param.b32 [func_retval0+0], [[R2]];
26+
; CHECK-LABEL: test_zext_2xi8(
27+
; CHECK: ld.param.u16 [[RS1:%rs[0-9]+]], [test_zext_2xi8_param_0];
28+
; CHECK: shr.u16 [[RS2:%rs[0-9]+]], [[RS1]], 8;
29+
; CHECK: mov.b32 [[R1:%r[0-9]+]], {[[RS1]], [[RS2]]}
30+
; CHECK: and.b32 [[R2:%r[0-9]+]], [[R1]], 16711935;
31+
; CHECK: st.param.b32 [func_retval0], [[R2]];
3232
define <2 x i16> @test_zext_2xi8(i16 %a) #0 {
3333
%vec = bitcast i16 %a to <2 x i8>
3434
%ext = zext <2 x i8> %vec to <2 x i16>

0 commit comments

Comments
 (0)