Skip to content

Commit 71db1d9

Browse files
committed
negative case
1 parent d6a319b commit 71db1d9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/CodeGen/NVPTX/shift-opt.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ define <2 x i16> @test_vec(<2 x i16> %x, <2 x i8> %y) {
6161
;
6262
; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
6363
; c1 <= leadingzeros(zext(y))
64+
; x, y - vectors
6465
;
6566
; CHECK-LABEL: test_vec
6667
; CHECK: ld.param.u32 %[[X:r[0-9]+]], [test_vec_param_0];
@@ -99,3 +100,28 @@ define i64 @test_negative_c(i64 %x, i32 %y) {
99100
%srl = lshr i64 %or, 33
100101
ret i64 %srl
101102
}
103+
104+
declare void @use(i64)
105+
106+
define i64 @test_negative_use_lop(i64 %x, i32 %y) {
107+
;
108+
; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
109+
; c1 <= leadingzeros(zext(y))
110+
;
111+
;
112+
;
113+
; CHECK-LABEL: test_negative_use_lop
114+
; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_c_param_0];
115+
; CHECK: ld.param.u32 %[[Y:rd[0-9]+]], [test_negative_c_param_1];
116+
; CHECK: shl.b64 %[[SHL:rd[0-9]+]], %[[Y]], 33;
117+
; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
118+
; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 33;
119+
; CHECK: st.param.b64 [func_retval0], %[[SHR]];
120+
;
121+
%ext = zext i32 %y to i64
122+
%shl = shl i64 %ext, 5
123+
%or = or i64 %x, %shl
124+
%srl = lshr i64 %or, 5
125+
call void @use(i64 %or)
126+
ret i64 %srl
127+
}

0 commit comments

Comments
 (0)