2
2
3
3
define i64 @test_or (i64 %x , i32 %y ) {
4
4
;
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))
6
6
; c1 <= leadingzeros(zext(y))
7
7
;
8
8
; CHECK-LABEL: test_or
@@ -21,7 +21,7 @@ define i64 @test_or(i64 %x, i32 %y) {
21
21
22
22
define i64 @test_xor (i64 %x , i32 %y ) {
23
23
;
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))
25
25
; c1 <= leadingzeros(zext(y))
26
26
;
27
27
; CHECK-LABEL: test_xor
@@ -40,7 +40,7 @@ define i64 @test_xor(i64 %x, i32 %y) {
40
40
41
41
define i64 @test_and (i64 %x , i32 %y ) {
42
42
;
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))
44
44
; c1 <= leadingzeros(zext(y))
45
45
;
46
46
; CHECK-LABEL: test_and
@@ -59,7 +59,7 @@ define i64 @test_and(i64 %x, i32 %y) {
59
59
60
60
define <2 x i16 > @test_vec (<2 x i16 > %x , <2 x i8 > %y ) {
61
61
;
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))
63
63
; c1 <= leadingzeros(zext(y))
64
64
; x, y - vectors
65
65
;
@@ -83,8 +83,8 @@ define <2 x i16> @test_vec(<2 x i16> %x, <2 x i8> %y) {
83
83
84
84
define i64 @test_negative_c (i64 %x , i32 %y ) {
85
85
;
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)).
88
88
;
89
89
; CHECK-LABEL: test_negative_c
90
90
; CHECK: ld.param.u64 %[[X:rd[0-9]+]], [test_negative_c_param_0];
@@ -105,9 +105,8 @@ declare void @use(i64)
105
105
106
106
define i64 @test_negative_use_lop (i64 %x , i32 %y ) {
107
107
;
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"
111
110
;
112
111
; CHECK-LABEL: test_negative_use_lop
113
112
; 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) {
116
115
; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
117
116
; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 5;
118
117
; CHECK: { // callseq
119
- ; CHECK: st.param.b64 [param0], %[[OR]];
118
+ ; CHECK: st.param.b64 [param0], %[[OR]];
120
119
; CHECK: } // callseq
121
120
; CHECK: st.param.b64 [func_retval0], %[[SHR]];
122
121
;
@@ -128,12 +127,10 @@ define i64 @test_negative_use_lop(i64 %x, i32 %y) {
128
127
ret i64 %srl
129
128
}
130
129
131
-
132
130
define i64 @test_negative_use_shl (i64 %x , i32 %y ) {
133
131
;
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"
137
134
;
138
135
; CHECK-LABEL: test_negative_use_shl
139
136
; 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) {
142
139
; CHECK: or.b64 %[[OR:rd[0-9]+]], %[[X]], %[[SHL]];
143
140
; CHECK: shr.u64 %[[SHR:rd[0-9]+]], %[[OR]], 5;
144
141
; CHECK: { // callseq
145
- ; CHECK: st.param.b64 [param0], %[[SHL]];
142
+ ; CHECK: st.param.b64 [param0], %[[SHL]];
146
143
; CHECK: } // callseq
147
144
; CHECK: st.param.b64 [func_retval0], %[[SHR]];
148
145
;
0 commit comments