1 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 ; When inst combining an FCMP with the LHS coming from a uitofp instruction, we
5 ; can't lower it to signed ICMP instructions.
8 define i1 @test1(i32 %val) {
9 %1 = uitofp i32 %val to double
10 %2 = fcmp ole double %1, 0.000000e+00
11 ; CHECK: icmp eq i32 %val, 0
15 ; CHECK-LABEL: @test2(
16 define i1 @test2(i32 %val) {
17 %1 = uitofp i32 %val to double
18 %2 = fcmp olt double %1, 0.000000e+00
23 ; CHECK-LABEL: @test3(
24 define i1 @test3(i32 %val) {
25 %1 = uitofp i32 %val to double
26 %2 = fcmp oge double %1, 0.000000e+00
31 ; CHECK-LABEL: @test4(
32 define i1 @test4(i32 %val) {
33 %1 = uitofp i32 %val to double
34 %2 = fcmp ogt double %1, 0.000000e+00
35 ; CHECK: icmp ne i32 %val, 0
39 ; CHECK-LABEL: @test5(
40 define i1 @test5(i32 %val) {
41 %1 = uitofp i32 %val to double
42 %2 = fcmp ogt double %1, -4.400000e+00
47 ; CHECK-LABEL: @test6(
48 define i1 @test6(i32 %val) {
49 %1 = uitofp i32 %val to double
50 %2 = fcmp olt double %1, -4.400000e+00
55 ; Check that optimizing unsigned >= comparisons correctly distinguishes
56 ; positive and negative constants. <rdar://problem/12029145>
57 ; CHECK-LABEL: @test7(
58 define i1 @test7(i32 %val) {
59 %1 = uitofp i32 %val to double
60 %2 = fcmp oge double %1, 3.200000e+00
62 ; CHECK: icmp ugt i32 %val, 3