66
77define i1 @shl_add_const_eq_base (i64 %v0 , i64 %v3 ) {
88; CHECK-LABEL: @shl_add_const_eq_base(
9- ; CHECK-NEXT: [[V1:%.*]] = shl nsw i64 %v0, 5
10- ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 %v3, 5
11- ; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V4]], 32
12- ; CHECK-NEXT: [[V6:%.*]] = icmp eq i64 [[V1]], [[V5]]
9+ ; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V3:%.*]], 1
10+ ; CHECK-NEXT: [[V6:%.*]] = icmp eq i64 [[V1:%.*]], [[V5]]
1311; CHECK-NEXT: ret i1 [[V6]]
1412;
1513 %v1 = shl nsw i64 %v0 , 5
@@ -22,10 +20,8 @@ define i1 @shl_add_const_eq_base(i64 %v0, i64 %v3) {
2220; Test: icmp ne
2321define i1 @shl_add_const_ne (i64 %v0 , i64 %v3 ) {
2422; CHECK-LABEL: @shl_add_const_ne(
25- ; CHECK-NEXT: [[V1:%.*]] = shl nsw i64 [[V0:%.*]], 5
26- ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 [[V3:%.*]], 5
27- ; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V4]], 32
28- ; CHECK-NEXT: [[V6:%.*]] = icmp ne i64 [[V1]], [[V5]]
23+ ; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V3:%.*]], 1
24+ ; CHECK-NEXT: [[V6:%.*]] = icmp ne i64 [[V1:%.*]], [[V5]]
2925; CHECK-NEXT: ret i1 [[V6]]
3026;
3127 %v1 = shl nsw i64 %v0 , 5
@@ -38,8 +34,8 @@ define i1 @shl_add_const_ne(i64 %v0, i64 %v3) {
3834; Test: shl amounts do not match (5 vs 4).
3935define i1 @shl_add_const_eq_mismatch_shl_amt (i64 %v0 , i64 %v3 ) {
4036; CHECK-LABEL: @shl_add_const_eq_mismatch_shl_amt(
41- ; CHECK-NEXT: [[V1:%.*]] = shl nsw i64 %v0 , 5
42- ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 %v3 , 4
37+ ; CHECK-NEXT: [[V1:%.*]] = shl nsw i64 [[V0:%.*]] , 5
38+ ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 [[V3:%.*]] , 4
4339; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V4]], 16
4440; CHECK-NEXT: [[V6:%.*]] = icmp eq i64 [[V1]], [[V5]]
4541; CHECK-NEXT: ret i1 [[V6]]
@@ -54,8 +50,8 @@ define i1 @shl_add_const_eq_mismatch_shl_amt(i64 %v0, i64 %v3) {
5450; Test: Constant is wrong (32 vs 64).
5551define i1 @shl_add_const_eq_wrong_constant (i64 %v0 , i64 %v3 ) {
5652; CHECK-LABEL: @shl_add_const_eq_wrong_constant(
57- ; CHECK-NEXT: [[V1:%.*]] = shl nsw i64 %v0 , 5
58- ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 %v3 , 5
53+ ; CHECK-NEXT: [[V1:%.*]] = shl nsw i64 [[V0:%.*]] , 5
54+ ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 [[V3:%.*]] , 5
5955; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V4]], 64
6056; CHECK-NEXT: [[V6:%.*]] = icmp eq i64 [[V1]], [[V5]]
6157; CHECK-NEXT: ret i1 [[V6]]
@@ -70,8 +66,8 @@ define i1 @shl_add_const_eq_wrong_constant(i64 %v0, i64 %v3) {
7066; Test: Missing NSW flag on one of the shl instructions.
7167define i1 @shl_add_const_eq_no_nsw_on_v1 (i64 %v0 , i64 %v3 ) {
7268; CHECK-LABEL: @shl_add_const_eq_no_nsw_on_v1(
73- ; CHECK-NEXT: [[V1:%.*]] = shl i64 %v0 , 5
74- ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 %v3 , 5
69+ ; CHECK-NEXT: [[V1:%.*]] = shl i64 [[V0:%.*]] , 5
70+ ; CHECK-NEXT: [[V4:%.*]] = shl nsw i64 [[V3:%.*]] , 5
7571; CHECK-NEXT: [[V5:%.*]] = add nsw i64 [[V4]], 32
7672; CHECK-NEXT: [[V6:%.*]] = icmp eq i64 [[V1]], [[V5]]
7773; CHECK-NEXT: ret i1 [[V6]]
@@ -86,8 +82,8 @@ define i1 @shl_add_const_eq_no_nsw_on_v1(i64 %v0, i64 %v3) {
8682; Test: Lower bit width (i8) and different shift amount (3). Constant is 8.
8783define i1 @shl_add_const_eq_i8 (i8 %v0 , i8 %v3 ) {
8884; CHECK-LABEL: @shl_add_const_eq_i8(
89- ; CHECK-NEXT: [[V7 :%.*]] = add nsw i8 %v3 , 1
90- ; CHECK-NEXT: [[V6:%.*]] = icmp eq i8 %v0 , [[V7 ]]
85+ ; CHECK-NEXT: [[TMP1 :%.*]] = add nsw i8 [[V3:%.*]] , 1
86+ ; CHECK-NEXT: [[V6:%.*]] = icmp eq i8 [[V0:%.*]] , [[TMP1 ]]
9187; CHECK-NEXT: ret i1 [[V6]]
9288;
9389 %v1 = shl nsw i8 %v0 , 3
@@ -100,8 +96,8 @@ define i1 @shl_add_const_eq_i8(i8 %v0, i8 %v3) {
10096; Test: i32 bit width and larger shift amount (10). Constant is 1024.
10197define i1 @shl_add_const_eq_i32 (i32 %v0 , i32 %v3 ) {
10298; CHECK-LABEL: @shl_add_const_eq_i32(
103- ; CHECK-NEXT: [[V7 :%.*]] = add nsw i32 %v3 , 1
104- ; CHECK-NEXT: [[V6:%.*]] = icmp eq i32 %v0 , [[V7 ]]
99+ ; CHECK-NEXT: [[TMP1 :%.*]] = add nsw i32 [[V3:%.*]] , 1
100+ ; CHECK-NEXT: [[V6:%.*]] = icmp eq i32 [[V0:%.*]] , [[TMP1 ]]
105101; CHECK-NEXT: ret i1 [[V6]]
106102;
107103 %v1 = shl nsw i32 %v0 , 10
0 commit comments