75 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3; PR30214 5; When inst combining an FCMP with the LHS coming from a uitofp instruction, we6; can't lower it to signed ICMP instructions.7 8define i1 @test1(i32 %val) {9; CHECK-LABEL: @test1(10; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[VAL:%.*]], 011; CHECK-NEXT: ret i1 [[TMP1]]12;13 %1 = uitofp i32 %val to double14 %2 = fcmp ole double %1, 0.000000e+0015 ret i1 %216}17 18define i1 @test2(i32 %val) {19; CHECK-LABEL: @test2(20; CHECK-NEXT: ret i1 false21;22 %1 = uitofp i32 %val to double23 %2 = fcmp olt double %1, 0.000000e+0024 ret i1 %225}26 27define i1 @test3(i32 %val) {28; CHECK-LABEL: @test3(29; CHECK-NEXT: ret i1 true30;31 %1 = uitofp i32 %val to double32 %2 = fcmp oge double %1, 0.000000e+0033 ret i1 %234}35 36define i1 @test4(i32 %val) {37; CHECK-LABEL: @test4(38; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i32 [[VAL:%.*]], 039; CHECK-NEXT: ret i1 [[TMP1]]40;41 %1 = uitofp i32 %val to double42 %2 = fcmp ogt double %1, 0.000000e+0043 ret i1 %244}45 46define i1 @test5(i32 %val) {47; CHECK-LABEL: @test5(48; CHECK-NEXT: ret i1 true49;50 %1 = uitofp i32 %val to double51 %2 = fcmp ogt double %1, -4.400000e+0052 ret i1 %253}54 55define i1 @test6(i32 %val) {56; CHECK-LABEL: @test6(57; CHECK-NEXT: ret i1 false58;59 %1 = uitofp i32 %val to double60 %2 = fcmp olt double %1, -4.400000e+0061 ret i1 %262}63 64; Check that optimizing unsigned >= comparisons correctly distinguishes65; positive and negative constants. <rdar://problem/12029145>66define i1 @test7(i32 %val) {67; CHECK-LABEL: @test7(68; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[VAL:%.*]], 369; CHECK-NEXT: ret i1 [[TMP1]]70;71 %1 = uitofp i32 %val to double72 %2 = fcmp oge double %1, 3.200000e+0073 ret i1 %274}75