@@ -57,33 +57,37 @@ define i64 @test_and(i64 %x, i32 %y) {
5757 ret i64 %srl
5858}
5959
60- define <2 x i64 > @test_or_vec (<2 x i64 > %x , <2 x i32 > %y ) {
60+ 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))
6464;
65- ; CHECK-LABEL: test_or
66- ; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_or_param_0];
67- ; CHECK: ld.param.u32 %[[Y:rd[0-9]+]], [test_or_param_1];
68- ; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[X]], 5;
69- ; CHECK: or.b64 %[[LOP:rd[0-9]+]], %[[SHR]], %[[Y]];
70- ; CHECK: st.param.b64 [func_retval0], %[[LOP]];
65+ ; CHECK-LABEL: test_vec
66+ ; CHECK: ld.param.u32 %[[X:r[0-9]+]], [test_vec_param_0];
67+ ; CHECK: ld.param.u32 %[[P1:r[0-9]+]], [test_vec_param_1];
68+ ; CHECK: and.b32 %[[Y:r[0-9]+]], %[[P1]], 16711935;
69+ ; CHECK: mov.b32 {%[[X1:rs[0-9]+]], %[[X2:rs[0-9]+]]}, %[[X]];
70+ ; CHECK: shr.u16 %[[SHR2:rs[0-9]+]], %[[X2]], 5;
71+ ; CHECK: shr.u16 %[[SHR1:rs[0-9]+]], %[[X1]], 5;
72+ ; CHECK: mov.b32 %[[SHR:r[0-9]+]], {%[[SHR1]], %[[SHR2]]};
73+ ; CHECK: or.b32 %[[LOP:r[0-9]+]], %[[SHR]], %[[Y]];
74+ ; CHECK: st.param.b32 [func_retval0], %[[LOP]];
7175;
72- %ext = zext <2 x i32 > %y to <2 x i64 >
73- %shl = shl <2 x i64 > %ext , splat(i64 5 )
74- %or = or <2 x i64 > %x , %shl
75- %srl = lshr <2 x i64 > %or , splat(i64 5 )
76- ret <2 x i64 > %srl
76+ %ext = zext <2 x i8 > %y to <2 x i16 >
77+ %shl = shl <2 x i16 > %ext , splat(i16 5 )
78+ %or = or <2 x i16 > %x , %shl
79+ %srl = lshr <2 x i16 > %or , splat(i16 5 )
80+ ret <2 x i16 > %srl
7781}
7882
79- define i64 @test2 (i64 %x , i32 %y ) {
83+ define i64 @test_negative_c (i64 %x , i32 %y ) {
8084;
8185; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
8286; c1 > leadingzeros(zext(y)).
8387;
84- ; CHECK-LABEL: test2
85- ; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test2_param_0 ];
86- ; CHECK: ld.param.u32 %[[Y:rd[0-9]+]], [test2_param_1 ];
88+ ; CHECK-LABEL: test_negative_c
89+ ; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_c_param_0 ];
90+ ; CHECK: ld.param.u32 %[[Y:rd[0-9]+]], [test_negative_c_param_1 ];
8791; CHECK: shl.b64 %[[SHL:rd[0-9]+]], %[[Y]], 33;
8892; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
8993; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 33;
0 commit comments