22
33define i64 @test_or (i64 %x , i32 %y ) {
44;
5- ; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
5+ ; Fold: srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
66; c1 <= leadingzeros(zext(y))
77;
88; CHECK-LABEL: test_or
@@ -21,7 +21,7 @@ define i64 @test_or(i64 %x, i32 %y) {
2121
2222define i64 @test_xor (i64 %x , i32 %y ) {
2323;
24- ; srl (xor (x, shl(zext(y),c1)),c1) -> xor(srl(x,c1), zext(y))
24+ ; Fold: srl (xor (x, shl(zext(y),c1)),c1) -> xor(srl(x,c1), zext(y))
2525; c1 <= leadingzeros(zext(y))
2626;
2727; CHECK-LABEL: test_xor
@@ -40,7 +40,7 @@ define i64 @test_xor(i64 %x, i32 %y) {
4040
4141define i64 @test_and (i64 %x , i32 %y ) {
4242;
43- ; srl (and (x, shl(zext(y),c1)),c1) -> and(srl(x,c1), zext(y))
43+ ; Fold: srl (and (x, shl(zext(y),c1)),c1) -> and(srl(x,c1), zext(y))
4444; c1 <= leadingzeros(zext(y))
4545;
4646; CHECK-LABEL: test_and
@@ -59,7 +59,7 @@ define i64 @test_and(i64 %x, i32 %y) {
5959
6060define <2 x i16 > @test_vec (<2 x i16 > %x , <2 x i8 > %y ) {
6161;
62- ; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
62+ ; Fold: srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
6363; c1 <= leadingzeros(zext(y))
6464; x, y - vectors
6565;
@@ -83,8 +83,8 @@ define <2 x i16> @test_vec(<2 x i16> %x, <2 x i8> %y) {
8383
8484define i64 @test_negative_c (i64 %x , i32 %y ) {
8585;
86- ; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
87- ; c1 > leadingzeros(zext(y)).
86+ ; Do not fold: srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
87+ ; Reason: c1 > leadingzeros(zext(y)).
8888;
8989; CHECK-LABEL: test_negative_c
9090; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_c_param_0];
@@ -105,9 +105,8 @@ declare void @use(i64)
105105
106106define i64 @test_negative_use_lop (i64 %x , i32 %y ) {
107107;
108- ; srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
109- ; c1 <= leadingzeros(zext(y))
110- ; multiple usage of "or"
108+ ; Do not fold: srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
109+ ; Reason: multiple usage of "or"
111110;
112111; CHECK-LABEL: test_negative_use_lop
113112; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_use_lop_param_0];
@@ -116,7 +115,7 @@ define i64 @test_negative_use_lop(i64 %x, i32 %y) {
116115; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
117116; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 5;
118117; CHECK: { // callseq
119- ; CHECK: st.param.b64 [param0], %[[OR]];
118+ ; CHECK: st.param.b64 [param0], %[[OR]];
120119; CHECK: } // callseq
121120; CHECK: st.param.b64 [func_retval0], %[[SHR]];
122121;
@@ -128,12 +127,10 @@ define i64 @test_negative_use_lop(i64 %x, i32 %y) {
128127 ret i64 %srl
129128}
130129
131-
132130define i64 @test_negative_use_shl (i64 %x , i32 %y ) {
133131;
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"
132+ ; Do not fold: srl (or (x, shl(zext(y),c1)),c1) -> or(srl(x,c1), zext(y))
133+ ; Reason: multiple usage of "shl"
137134;
138135; CHECK-LABEL: test_negative_use_shl
139136; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_use_shl_param_0];
@@ -142,7 +139,7 @@ define i64 @test_negative_use_shl(i64 %x, i32 %y) {
142139; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
143140; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 5;
144141; CHECK: { // callseq
145- ; CHECK: st.param.b64 [param0], %[[SHL]];
142+ ; CHECK: st.param.b64 [param0], %[[SHL]];
146143; CHECK: } // callseq
147144; CHECK: st.param.b64 [func_retval0], %[[SHR]];
148145;
0 commit comments