@@ -5255,6 +5255,16 @@ define i1 @test_icmp_shl_nuw(i64 %x) {
5255
5255
ret i1 %cmp
5256
5256
}
5257
5257
5258
+ define i1 @test_icmp_shl_nuw_i31 (i31 %x ) {
5259
+ ; CHECK-LABEL: @test_icmp_shl_nuw_i31(
5260
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i31 [[X:%.*]], 250
5261
+ ; CHECK-NEXT: ret i1 [[CMP]]
5262
+ ;
5263
+ %shl = shl nuw i31 %x , 23
5264
+ %cmp = icmp ugt i31 %shl , -50331648
5265
+ ret i1 %cmp
5266
+ }
5267
+
5258
5268
define i1 @test_icmp_shl_nsw (i64 %x ) {
5259
5269
; CHECK-LABEL: @test_icmp_shl_nsw(
5260
5270
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[X:%.*]], 3
@@ -5265,6 +5275,17 @@ define i1 @test_icmp_shl_nsw(i64 %x) {
5265
5275
ret i1 %cmp
5266
5276
}
5267
5277
5278
+ define i1 @test_icmp_shl_nsw_i31 (i31 %x ) {
5279
+ ; CHECK-LABEL: @test_icmp_shl_nsw_i31(
5280
+ ; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i31 [[X:%.*]] to i8
5281
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[TMP1]], -6
5282
+ ; CHECK-NEXT: ret i1 [[CMP]]
5283
+ ;
5284
+ %shl = shl nsw i31 %x , 23
5285
+ %cmp = icmp ugt i31 %shl , -50331648
5286
+ ret i1 %cmp
5287
+ }
5288
+
5268
5289
define <2 x i1 > @test_icmp_shl_vec (<2 x i64 > %x ) {
5269
5290
; CHECK-LABEL: @test_icmp_shl_vec(
5270
5291
; CHECK-NEXT: [[TMP1:%.*]] = trunc <2 x i64> [[X:%.*]] to <2 x i32>
@@ -5295,3 +5316,13 @@ define i1 @test_icmp_shl_sgt(i64 %x) {
5295
5316
%cmp = icmp sgt i64 %shl , 8589934591
5296
5317
ret i1 %cmp
5297
5318
}
5319
+
5320
+ define i1 @pr94897 (i32 range(i32 -2147483648 , 0 ) %x ) {
5321
+ ; CHECK-LABEL: @pr94897(
5322
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[X:%.*]], -3
5323
+ ; CHECK-NEXT: ret i1 [[CMP]]
5324
+ ;
5325
+ %shl = shl nsw i32 %x , 24
5326
+ %cmp = icmp ugt i32 %shl , -50331648
5327
+ ret i1 %cmp
5328
+ }
0 commit comments