1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=ipsccp -S < %s | FileCheck %s
4 define float @sitofp_and(i8 %x) {
5 ; CHECK-LABEL: @sitofp_and(
6 ; CHECK-NEXT: [[PX:%.*]] = and i8 [[X:%.*]], 127
7 ; CHECK-NEXT: [[R:%.*]] = uitofp nneg i8 [[PX]] to float
8 ; CHECK-NEXT: ret float [[R]]
11 %r = sitofp i8 %px to float
15 define half @sitofp_const(i8 %x) {
16 ; CHECK-LABEL: @sitofp_const(
17 ; CHECK-NEXT: ret half 0xH5140
19 %r = sitofp i8 42 to half
23 define double @sitofp_zext(i7 %x) {
24 ; CHECK-LABEL: @sitofp_zext(
25 ; CHECK-NEXT: [[PX:%.*]] = zext i7 [[X:%.*]] to i8
26 ; CHECK-NEXT: [[R:%.*]] = uitofp nneg i8 [[PX]] to double
27 ; CHECK-NEXT: ret double [[R]]
29 %px = zext i7 %x to i8
30 %r = sitofp i8 %px to double
36 define double @sitofp_not_nonneg(i7 %x) {
37 ; CHECK-LABEL: @sitofp_not_nonneg(
38 ; CHECK-NEXT: [[PX:%.*]] = sext i7 [[X:%.*]] to i8
39 ; CHECK-NEXT: [[R:%.*]] = sitofp i8 [[PX]] to double
40 ; CHECK-NEXT: ret double [[R]]
42 %px = sext i7 %x to i8
43 %r = sitofp i8 %px to double
47 ; x is known non-negative in t block
49 define float @dominating_condition(i32 %x) {
50 ; CHECK-LABEL: @dominating_condition(
52 ; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[X:%.*]], 0
53 ; CHECK-NEXT: br i1 [[CMP]], label [[T:%.*]], label [[F:%.*]]
55 ; CHECK-NEXT: [[A:%.*]] = uitofp nneg i32 [[X]] to float
56 ; CHECK-NEXT: br label [[EXIT:%.*]]
58 ; CHECK-NEXT: br label [[EXIT]]
60 ; CHECK-NEXT: [[COND:%.*]] = phi float [ [[A]], [[T]] ], [ 4.200000e+01, [[F]] ]
61 ; CHECK-NEXT: ret float [[COND]]
64 %cmp = icmp sge i32 %x, 0
65 br i1 %cmp, label %t, label %f
68 %a = sitofp i32 %x to float
75 %cond = phi float [ %a, %t ], [ 42.0, %f ]
79 ; x is known non-negative in f block
81 define float @dominating_condition_alt(i32 %x) {
82 ; CHECK-LABEL: @dominating_condition_alt(
84 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[X:%.*]], 2000000000
85 ; CHECK-NEXT: br i1 [[CMP]], label [[T:%.*]], label [[F:%.*]]
87 ; CHECK-NEXT: br label [[EXIT:%.*]]
89 ; CHECK-NEXT: [[A:%.*]] = uitofp nneg i32 [[X]] to float
90 ; CHECK-NEXT: br label [[EXIT]]
92 ; CHECK-NEXT: [[COND:%.*]] = phi float [ -4.200000e+01, [[T]] ], [ [[A]], [[F]] ]
93 ; CHECK-NEXT: ret float [[COND]]
96 %cmp = icmp ugt i32 %x, 2000000000
97 br i1 %cmp, label %t, label %f
103 %a = sitofp i32 %x to float
107 %cond = phi float [ -42.0, %t ], [ %a, %f ]