@@ -107,15 +107,17 @@ define i64 @test_negative_use_lop(i64 %x, i32 %y) {
107107;
108108; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
109109; c1 <= leadingzeros(zext(y))
110- ;
111- ;
110+ ; multiple usage of "or"
112111;
113112; 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 ;
113+ ; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_use_lop_param_0 ];
114+ ; CHECK: ld.param.u32 %[[Y:r [0-9]+]], [test_negative_use_lop_param_1 ];
115+ ; CHECK: mul.wide.u32 %[[SHL:rd[0-9]+]], %[[Y]], 32 ;
117116; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
118- ; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 33;
117+ ; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 5;
118+ ; CHECK: { // callseq
119+ ; CHECK: st.param.b64 [param0], %[[OR]];
120+ ; CHECK: } // callseq
119121; CHECK: st.param.b64 [func_retval0], %[[SHR]];
120122;
121123 %ext = zext i32 %y to i64
@@ -124,4 +126,30 @@ define i64 @test_negative_use_lop(i64 %x, i32 %y) {
124126 %srl = lshr i64 %or , 5
125127 call void @use (i64 %or )
126128 ret i64 %srl
127- }
129+ }
130+
131+
132+ define i64 @test_negative_use_shl (i64 %x , i32 %y ) {
133+ ;
134+ ; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
135+ ; c1 <= leadingzeros(zext(y))
136+ ; multiple usage of "shl"
137+ ;
138+ ; CHECK-LABEL: test_negative_use_shl
139+ ; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_use_shl_param_0];
140+ ; CHECK: ld.param.u32 %[[Y:r[0-9]+]], [test_negative_use_shl_param_1];
141+ ; CHECK: mul.wide.u32 %[[SHL:rd[0-9]+]], %[[Y]], 32;
142+ ; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
143+ ; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 5;
144+ ; CHECK: { // callseq
145+ ; CHECK: st.param.b64 [param0], %[[SHL]];
146+ ; CHECK: } // callseq
147+ ; CHECK: st.param.b64 [func_retval0], %[[SHR]];
148+ ;
149+ %ext = zext i32 %y to i64
150+ %shl = shl i64 %ext , 5
151+ %or = or i64 %x , %shl
152+ %srl = lshr i64 %or , 5
153+ call void @use (i64 %shl )
154+ ret i64 %srl
155+ }
0 commit comments