@@ -5255,6 +5255,16 @@ define i1 @test_icmp_shl_nuw(i64 %x) {
52555255 ret i1 %cmp
52565256}
52575257
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+
52585268define i1 @test_icmp_shl_nsw (i64 %x ) {
52595269; CHECK-LABEL: @test_icmp_shl_nsw(
52605270; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[X:%.*]], 3
@@ -5265,6 +5275,17 @@ define i1 @test_icmp_shl_nsw(i64 %x) {
52655275 ret i1 %cmp
52665276}
52675277
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+
52685289define <2 x i1 > @test_icmp_shl_vec (<2 x i64 > %x ) {
52695290; CHECK-LABEL: @test_icmp_shl_vec(
52705291; CHECK-NEXT: [[TMP1:%.*]] = trunc <2 x i64> [[X:%.*]] to <2 x i32>
@@ -5295,3 +5316,13 @@ define i1 @test_icmp_shl_sgt(i64 %x) {
52955316 %cmp = icmp sgt i64 %shl , 8589934591
52965317 ret i1 %cmp
52975318}
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