1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
5 ; When inst combining an FCMP with the LHS coming from a uitofp instruction, we
6 ; can't lower it to signed ICMP instructions.
8 define i1 @test1(i32 %val) {
10 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[VAL:%.*]], 0
11 ; CHECK-NEXT: ret i1 [[TMP1]]
13 %1 = uitofp i32 %val to double
14 %2 = fcmp ole double %1, 0.000000e+00
18 define i1 @test2(i32 %val) {
19 ; CHECK-LABEL: @test2(
20 ; CHECK-NEXT: ret i1 false
22 %1 = uitofp i32 %val to double
23 %2 = fcmp olt double %1, 0.000000e+00
27 define i1 @test3(i32 %val) {
28 ; CHECK-LABEL: @test3(
29 ; CHECK-NEXT: ret i1 true
31 %1 = uitofp i32 %val to double
32 %2 = fcmp oge double %1, 0.000000e+00
36 define i1 @test4(i32 %val) {
37 ; CHECK-LABEL: @test4(
38 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i32 [[VAL:%.*]], 0
39 ; CHECK-NEXT: ret i1 [[TMP1]]
41 %1 = uitofp i32 %val to double
42 %2 = fcmp ogt double %1, 0.000000e+00
46 define i1 @test5(i32 %val) {
47 ; CHECK-LABEL: @test5(
48 ; CHECK-NEXT: ret i1 true
50 %1 = uitofp i32 %val to double
51 %2 = fcmp ogt double %1, -4.400000e+00
55 define i1 @test6(i32 %val) {
56 ; CHECK-LABEL: @test6(
57 ; CHECK-NEXT: ret i1 false
59 %1 = uitofp i32 %val to double
60 %2 = fcmp olt double %1, -4.400000e+00
64 ; Check that optimizing unsigned >= comparisons correctly distinguishes
65 ; positive and negative constants. <rdar://problem/12029145>
66 define i1 @test7(i32 %val) {
67 ; CHECK-LABEL: @test7(
68 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i32 [[VAL:%.*]], 3
69 ; CHECK-NEXT: ret i1 [[TMP1]]
71 %1 = uitofp i32 %val to double
72 %2 = fcmp oge double %1, 3.200000e+00