17592e3a8SSanjay Patel; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2cee313d2SEric Christopher; RUN: opt < %s -passes='float2int' -S | FileCheck %s 3cee313d2SEric Christopher 4cee313d2SEric Christopher; 5cee313d2SEric Christopher; Positive tests 6cee313d2SEric Christopher; 7cee313d2SEric Christopher 8cee313d2SEric Christopherdefine i16 @simple1(i8 %a) { 97592e3a8SSanjay Patel; CHECK-LABEL: @simple1( 107592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 117592e3a8SSanjay Patel; CHECK-NEXT: [[T21:%.*]] = add i32 [[TMP1]], 1 127592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[T21]] to i16 137592e3a8SSanjay Patel; CHECK-NEXT: ret i16 [[TMP2]] 147592e3a8SSanjay Patel; 157592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 167592e3a8SSanjay Patel %t2 = fadd float %t1, 1.0 177592e3a8SSanjay Patel %t3 = fptoui float %t2 to i16 187592e3a8SSanjay Patel ret i16 %t3 19cee313d2SEric Christopher} 20cee313d2SEric Christopher 21cee313d2SEric Christopherdefine i8 @simple2(i8 %a) { 227592e3a8SSanjay Patel; CHECK-LABEL: @simple2( 237592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 247592e3a8SSanjay Patel; CHECK-NEXT: [[T21:%.*]] = sub i32 [[TMP1]], 1 257592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[T21]] to i8 267592e3a8SSanjay Patel; CHECK-NEXT: ret i8 [[TMP2]] 277592e3a8SSanjay Patel; 287592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 297592e3a8SSanjay Patel %t2 = fsub float %t1, 1.0 307592e3a8SSanjay Patel %t3 = fptoui float %t2 to i8 317592e3a8SSanjay Patel ret i8 %t3 32cee313d2SEric Christopher} 33cee313d2SEric Christopher 34cee313d2SEric Christopherdefine i32 @simple3(i8 %a) { 357592e3a8SSanjay Patel; CHECK-LABEL: @simple3( 367592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 377592e3a8SSanjay Patel; CHECK-NEXT: [[T21:%.*]] = sub i32 [[TMP1]], 1 387592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[T21]] 397592e3a8SSanjay Patel; 407592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 417592e3a8SSanjay Patel %t2 = fsub float %t1, 1.0 427592e3a8SSanjay Patel %t3 = fptoui float %t2 to i32 437592e3a8SSanjay Patel ret i32 %t3 44cee313d2SEric Christopher} 45cee313d2SEric Christopher 46cee313d2SEric Christopherdefine i1 @cmp(i8 %a, i8 %b) { 477592e3a8SSanjay Patel; CHECK-LABEL: @cmp( 487592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 497592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = zext i8 [[B:%.*]] to i32 507592e3a8SSanjay Patel; CHECK-NEXT: [[T31:%.*]] = icmp slt i32 [[TMP1]], [[TMP2]] 517592e3a8SSanjay Patel; CHECK-NEXT: ret i1 [[T31]] 527592e3a8SSanjay Patel; 537592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 547592e3a8SSanjay Patel %t2 = uitofp i8 %b to float 557592e3a8SSanjay Patel %t3 = fcmp ult float %t1, %t2 567592e3a8SSanjay Patel ret i1 %t3 57cee313d2SEric Christopher} 58cee313d2SEric Christopher 59cee313d2SEric Christopherdefine i32 @simple4(i32 %a) { 607592e3a8SSanjay Patel; CHECK-LABEL: @simple4( 617592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[A:%.*]] to i64 627592e3a8SSanjay Patel; CHECK-NEXT: [[T21:%.*]] = add i64 [[TMP1]], 1 637592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[T21]] to i32 647592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[TMP2]] 657592e3a8SSanjay Patel; 667592e3a8SSanjay Patel %t1 = uitofp i32 %a to double 677592e3a8SSanjay Patel %t2 = fadd double %t1, 1.0 687592e3a8SSanjay Patel %t3 = fptoui double %t2 to i32 697592e3a8SSanjay Patel ret i32 %t3 70cee313d2SEric Christopher} 71cee313d2SEric Christopher 72cee313d2SEric Christopherdefine i32 @simple5(i8 %a, i8 %b) { 737592e3a8SSanjay Patel; CHECK-LABEL: @simple5( 747592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 757592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = zext i8 [[B:%.*]] to i32 767592e3a8SSanjay Patel; CHECK-NEXT: [[T31:%.*]] = add i32 [[TMP1]], 1 777592e3a8SSanjay Patel; CHECK-NEXT: [[T42:%.*]] = mul i32 [[T31]], [[TMP2]] 787592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[T42]] 797592e3a8SSanjay Patel; 807592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 817592e3a8SSanjay Patel %t2 = uitofp i8 %b to float 827592e3a8SSanjay Patel %t3 = fadd float %t1, 1.0 837592e3a8SSanjay Patel %t4 = fmul float %t3, %t2 847592e3a8SSanjay Patel %t5 = fptoui float %t4 to i32 857592e3a8SSanjay Patel ret i32 %t5 86cee313d2SEric Christopher} 87cee313d2SEric Christopher 889fab46caSCameron McInallydefine i32 @simple6(i8 %a, i8 %b) { 897592e3a8SSanjay Patel; CHECK-LABEL: @simple6( 907592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 917592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = zext i8 [[B:%.*]] to i32 927592e3a8SSanjay Patel; CHECK-NEXT: [[T31:%.*]] = sub i32 0, [[TMP1]] 937592e3a8SSanjay Patel; CHECK-NEXT: [[T42:%.*]] = mul i32 [[T31]], [[TMP2]] 947592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[T42]] 957592e3a8SSanjay Patel; 967592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 977592e3a8SSanjay Patel %t2 = uitofp i8 %b to float 987592e3a8SSanjay Patel %t3 = fneg float %t1 997592e3a8SSanjay Patel %t4 = fmul float %t3, %t2 1007592e3a8SSanjay Patel %t5 = fptoui float %t4 to i32 1017592e3a8SSanjay Patel ret i32 %t5 1029fab46caSCameron McInally} 1039fab46caSCameron McInally 104cee313d2SEric Christopher; The two chains don't interact - failure of one shouldn't 105cee313d2SEric Christopher; cause failure of the other. 106cee313d2SEric Christopher 107cee313d2SEric Christopherdefine i32 @multi1(i8 %a, i8 %b, i8 %c, float %d) { 1087592e3a8SSanjay Patel; CHECK-LABEL: @multi1( 1097592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 1107592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = zext i8 [[B:%.*]] to i32 1117592e3a8SSanjay Patel; CHECK-NEXT: [[FC:%.*]] = uitofp i8 [[C:%.*]] to float 1127592e3a8SSanjay Patel; CHECK-NEXT: [[X1:%.*]] = add i32 [[TMP1]], [[TMP2]] 1137592e3a8SSanjay Patel; CHECK-NEXT: [[Z:%.*]] = fadd float [[FC]], [[D:%.*]] 1147592e3a8SSanjay Patel; CHECK-NEXT: [[W:%.*]] = fptoui float [[Z]] to i32 1157592e3a8SSanjay Patel; CHECK-NEXT: [[R:%.*]] = add i32 [[X1]], [[W]] 1167592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[R]] 1177592e3a8SSanjay Patel; 118cee313d2SEric Christopher %fa = uitofp i8 %a to float 119cee313d2SEric Christopher %fb = uitofp i8 %b to float 120cee313d2SEric Christopher %fc = uitofp i8 %c to float 121cee313d2SEric Christopher %x = fadd float %fa, %fb 122cee313d2SEric Christopher %y = fptoui float %x to i32 123cee313d2SEric Christopher %z = fadd float %fc, %d 124cee313d2SEric Christopher %w = fptoui float %z to i32 125cee313d2SEric Christopher %r = add i32 %y, %w 126cee313d2SEric Christopher ret i32 %r 127cee313d2SEric Christopher} 128cee313d2SEric Christopher 129cee313d2SEric Christopherdefine i16 @simple_negzero(i8 %a) { 1307592e3a8SSanjay Patel; CHECK-LABEL: @simple_negzero( 1317592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 1327592e3a8SSanjay Patel; CHECK-NEXT: [[T21:%.*]] = add i32 [[TMP1]], 0 1337592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[T21]] to i16 1347592e3a8SSanjay Patel; CHECK-NEXT: ret i16 [[TMP2]] 1357592e3a8SSanjay Patel; 1367592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 1377592e3a8SSanjay Patel %t2 = fadd fast float %t1, -0.0 1387592e3a8SSanjay Patel %t3 = fptoui float %t2 to i16 1397592e3a8SSanjay Patel ret i16 %t3 140cee313d2SEric Christopher} 141cee313d2SEric Christopher 142cee313d2SEric Christopherdefine i32 @simple_negative(i8 %call) { 1437592e3a8SSanjay Patel; CHECK-LABEL: @simple_negative( 1447592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = sext i8 [[CALL:%.*]] to i32 1457592e3a8SSanjay Patel; CHECK-NEXT: [[MUL1:%.*]] = mul i32 [[TMP1]], -3 1467592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[MUL1]] to i8 1477592e3a8SSanjay Patel; CHECK-NEXT: [[CONV3:%.*]] = sext i8 [[TMP2]] to i32 1487592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[CONV3]] 1497592e3a8SSanjay Patel; 150cee313d2SEric Christopher %conv1 = sitofp i8 %call to float 151cee313d2SEric Christopher %mul = fmul float %conv1, -3.000000e+00 152cee313d2SEric Christopher %conv2 = fptosi float %mul to i8 153cee313d2SEric Christopher %conv3 = sext i8 %conv2 to i32 154cee313d2SEric Christopher ret i32 %conv3 155cee313d2SEric Christopher} 156cee313d2SEric Christopher 157771769beSCameron McInallydefine i16 @simple_fneg(i8 %a) { 1587592e3a8SSanjay Patel; CHECK-LABEL: @simple_fneg( 1597592e3a8SSanjay Patel; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[A:%.*]] to i32 1607592e3a8SSanjay Patel; CHECK-NEXT: [[T21:%.*]] = sub i32 0, [[TMP1]] 1617592e3a8SSanjay Patel; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[T21]] to i16 1627592e3a8SSanjay Patel; CHECK-NEXT: ret i16 [[TMP2]] 1637592e3a8SSanjay Patel; 1647592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 1657592e3a8SSanjay Patel %t2 = fneg fast float %t1 1667592e3a8SSanjay Patel %t3 = fptoui float %t2 to i16 1677592e3a8SSanjay Patel ret i16 %t3 168771769beSCameron McInally} 169771769beSCameron McInally 170cee313d2SEric Christopher; 171cee313d2SEric Christopher; Negative tests 172cee313d2SEric Christopher; 173cee313d2SEric Christopher 174cee313d2SEric Christopher; The two chains intersect, which means because one fails, no 175cee313d2SEric Christopher; transform can occur. 1767592e3a8SSanjay Patel 177cee313d2SEric Christopherdefine i32 @neg_multi1(i8 %a, i8 %b, i8 %c, float %d) { 1787592e3a8SSanjay Patel; CHECK-LABEL: @neg_multi1( 1797592e3a8SSanjay Patel; CHECK-NEXT: [[FA:%.*]] = uitofp i8 [[A:%.*]] to float 1807592e3a8SSanjay Patel; CHECK-NEXT: [[FC:%.*]] = uitofp i8 [[C:%.*]] to float 1817592e3a8SSanjay Patel; CHECK-NEXT: [[X:%.*]] = fadd float [[FA]], [[FC]] 1827592e3a8SSanjay Patel; CHECK-NEXT: [[Y:%.*]] = fptoui float [[X]] to i32 1837592e3a8SSanjay Patel; CHECK-NEXT: [[Z:%.*]] = fadd float [[FC]], [[D:%.*]] 1847592e3a8SSanjay Patel; CHECK-NEXT: [[W:%.*]] = fptoui float [[Z]] to i32 1857592e3a8SSanjay Patel; CHECK-NEXT: [[R:%.*]] = add i32 [[Y]], [[W]] 1867592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[R]] 1877592e3a8SSanjay Patel; 188cee313d2SEric Christopher %fa = uitofp i8 %a to float 189cee313d2SEric Christopher %fc = uitofp i8 %c to float 190cee313d2SEric Christopher %x = fadd float %fa, %fc 191cee313d2SEric Christopher %y = fptoui float %x to i32 192cee313d2SEric Christopher %z = fadd float %fc, %d 193cee313d2SEric Christopher %w = fptoui float %z to i32 194cee313d2SEric Christopher %r = add i32 %y, %w 195cee313d2SEric Christopher ret i32 %r 196cee313d2SEric Christopher} 197cee313d2SEric Christopher 198cee313d2SEric Christopher; The i32 * i32 = i64, which has 64 bits, which is greater than the 52 bits 199cee313d2SEric Christopher; that can be exactly represented in a double. 2007592e3a8SSanjay Patel 201cee313d2SEric Christopherdefine i64 @neg_muld(i32 %a, i32 %b) { 2027592e3a8SSanjay Patel; CHECK-LABEL: @neg_muld( 2037592e3a8SSanjay Patel; CHECK-NEXT: [[FA:%.*]] = uitofp i32 [[A:%.*]] to double 2047592e3a8SSanjay Patel; CHECK-NEXT: [[FB:%.*]] = uitofp i32 [[B:%.*]] to double 2057592e3a8SSanjay Patel; CHECK-NEXT: [[MUL:%.*]] = fmul double [[FA]], [[FB]] 2067592e3a8SSanjay Patel; CHECK-NEXT: [[R:%.*]] = fptoui double [[MUL]] to i64 2077592e3a8SSanjay Patel; CHECK-NEXT: ret i64 [[R]] 2087592e3a8SSanjay Patel; 209cee313d2SEric Christopher %fa = uitofp i32 %a to double 210cee313d2SEric Christopher %fb = uitofp i32 %b to double 211cee313d2SEric Christopher %mul = fmul double %fa, %fb 212cee313d2SEric Christopher %r = fptoui double %mul to i64 213cee313d2SEric Christopher ret i64 %r 214cee313d2SEric Christopher} 215cee313d2SEric Christopher 216cee313d2SEric Christopher; The i16 * i16 = i32, which can't be represented in a float, but can in a 217cee313d2SEric Christopher; double. This should fail, as the written code uses floats, not doubles so 218cee313d2SEric Christopher; the original result may be inaccurate. 2197592e3a8SSanjay Patel 220cee313d2SEric Christopherdefine i32 @neg_mulf(i16 %a, i16 %b) { 2217592e3a8SSanjay Patel; CHECK-LABEL: @neg_mulf( 2227592e3a8SSanjay Patel; CHECK-NEXT: [[FA:%.*]] = uitofp i16 [[A:%.*]] to float 2237592e3a8SSanjay Patel; CHECK-NEXT: [[FB:%.*]] = uitofp i16 [[B:%.*]] to float 2247592e3a8SSanjay Patel; CHECK-NEXT: [[MUL:%.*]] = fmul float [[FA]], [[FB]] 2257592e3a8SSanjay Patel; CHECK-NEXT: [[R:%.*]] = fptoui float [[MUL]] to i32 2267592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[R]] 2277592e3a8SSanjay Patel; 228cee313d2SEric Christopher %fa = uitofp i16 %a to float 229cee313d2SEric Christopher %fb = uitofp i16 %b to float 230cee313d2SEric Christopher %mul = fmul float %fa, %fb 231cee313d2SEric Christopher %r = fptoui float %mul to i32 232cee313d2SEric Christopher ret i32 %r 233cee313d2SEric Christopher} 234cee313d2SEric Christopher 235cee313d2SEric Christopher; "false" doesn't have an icmp equivalent. 2367592e3a8SSanjay Patel 237cee313d2SEric Christopherdefine i1 @neg_cmp(i8 %a, i8 %b) { 2387592e3a8SSanjay Patel; CHECK-LABEL: @neg_cmp( 2397592e3a8SSanjay Patel; CHECK-NEXT: [[T1:%.*]] = uitofp i8 [[A:%.*]] to float 2407592e3a8SSanjay Patel; CHECK-NEXT: [[T2:%.*]] = uitofp i8 [[B:%.*]] to float 2417592e3a8SSanjay Patel; CHECK-NEXT: [[T3:%.*]] = fcmp false float [[T1]], [[T2]] 2427592e3a8SSanjay Patel; CHECK-NEXT: ret i1 [[T3]] 2437592e3a8SSanjay Patel; 2447592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 2457592e3a8SSanjay Patel %t2 = uitofp i8 %b to float 2467592e3a8SSanjay Patel %t3 = fcmp false float %t1, %t2 2477592e3a8SSanjay Patel ret i1 %t3 248cee313d2SEric Christopher} 249cee313d2SEric Christopher 250cee313d2SEric Christopher; Division isn't a supported operator. 2517592e3a8SSanjay Patel 252cee313d2SEric Christopherdefine i16 @neg_div(i8 %a) { 2537592e3a8SSanjay Patel; CHECK-LABEL: @neg_div( 2547592e3a8SSanjay Patel; CHECK-NEXT: [[T1:%.*]] = uitofp i8 [[A:%.*]] to float 2557592e3a8SSanjay Patel; CHECK-NEXT: [[T2:%.*]] = fdiv float [[T1]], 1.000000e+00 2567592e3a8SSanjay Patel; CHECK-NEXT: [[T3:%.*]] = fptoui float [[T2]] to i16 2577592e3a8SSanjay Patel; CHECK-NEXT: ret i16 [[T3]] 2587592e3a8SSanjay Patel; 2597592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 2607592e3a8SSanjay Patel %t2 = fdiv float %t1, 1.0 2617592e3a8SSanjay Patel %t3 = fptoui float %t2 to i16 2627592e3a8SSanjay Patel ret i16 %t3 263cee313d2SEric Christopher} 264cee313d2SEric Christopher 265cee313d2SEric Christopher; 1.2 is not an integer. 2667592e3a8SSanjay Patel 267cee313d2SEric Christopherdefine i16 @neg_remainder(i8 %a) { 2687592e3a8SSanjay Patel; CHECK-LABEL: @neg_remainder( 2697592e3a8SSanjay Patel; CHECK-NEXT: [[T1:%.*]] = uitofp i8 [[A:%.*]] to float 2707592e3a8SSanjay Patel; CHECK-NEXT: [[T2:%.*]] = fadd float [[T1]], 1.250000e+00 2717592e3a8SSanjay Patel; CHECK-NEXT: [[T3:%.*]] = fptoui float [[T2]] to i16 2727592e3a8SSanjay Patel; CHECK-NEXT: ret i16 [[T3]] 2737592e3a8SSanjay Patel; 2747592e3a8SSanjay Patel %t1 = uitofp i8 %a to float 2757592e3a8SSanjay Patel %t2 = fadd float %t1, 1.25 2767592e3a8SSanjay Patel %t3 = fptoui float %t2 to i16 2777592e3a8SSanjay Patel ret i16 %t3 278cee313d2SEric Christopher} 279cee313d2SEric Christopher 280cee313d2SEric Christopher; i80 > i64, which is the largest bitwidth handleable by default. 2817592e3a8SSanjay Patel 282cee313d2SEric Christopherdefine i80 @neg_toolarge(i80 %a) { 2837592e3a8SSanjay Patel; CHECK-LABEL: @neg_toolarge( 2847592e3a8SSanjay Patel; CHECK-NEXT: [[T1:%.*]] = uitofp i80 [[A:%.*]] to fp128 2857592e3a8SSanjay Patel; CHECK-NEXT: [[T2:%.*]] = fadd fp128 [[T1]], [[T1]] 2867592e3a8SSanjay Patel; CHECK-NEXT: [[T3:%.*]] = fptoui fp128 [[T2]] to i80 2877592e3a8SSanjay Patel; CHECK-NEXT: ret i80 [[T3]] 2887592e3a8SSanjay Patel; 2897592e3a8SSanjay Patel %t1 = uitofp i80 %a to fp128 2907592e3a8SSanjay Patel %t2 = fadd fp128 %t1, %t1 2917592e3a8SSanjay Patel %t3 = fptoui fp128 %t2 to i80 2927592e3a8SSanjay Patel ret i80 %t3 293cee313d2SEric Christopher} 294cee313d2SEric Christopher 2957592e3a8SSanjay Patel; The sequence %t1..%t3 cannot be converted because %t4 uses %t2. 2967592e3a8SSanjay Patel 297cee313d2SEric Christopherdefine i32 @neg_calluser(i32 %value) { 2987592e3a8SSanjay Patel; CHECK-LABEL: @neg_calluser( 2997592e3a8SSanjay Patel; CHECK-NEXT: [[T1:%.*]] = sitofp i32 [[VALUE:%.*]] to double 3007592e3a8SSanjay Patel; CHECK-NEXT: [[T2:%.*]] = fadd double [[T1]], 1.000000e+00 3017592e3a8SSanjay Patel; CHECK-NEXT: [[T3:%.*]] = fcmp olt double [[T2]], 0.000000e+00 3027592e3a8SSanjay Patel; CHECK-NEXT: [[T4:%.*]] = tail call double @g(double [[T2]]) 3037592e3a8SSanjay Patel; CHECK-NEXT: [[T5:%.*]] = fptosi double [[T4]] to i32 3047592e3a8SSanjay Patel; CHECK-NEXT: [[T6:%.*]] = zext i1 [[T3]] to i32 3057592e3a8SSanjay Patel; CHECK-NEXT: [[T7:%.*]] = add i32 [[T6]], [[T5]] 3067592e3a8SSanjay Patel; CHECK-NEXT: ret i32 [[T7]] 3077592e3a8SSanjay Patel; 3087592e3a8SSanjay Patel %t1 = sitofp i32 %value to double 3097592e3a8SSanjay Patel %t2 = fadd double %t1, 1.0 3107592e3a8SSanjay Patel %t3 = fcmp olt double %t2, 0.000000e+00 3117592e3a8SSanjay Patel %t4 = tail call double @g(double %t2) 3127592e3a8SSanjay Patel %t5 = fptosi double %t4 to i32 3137592e3a8SSanjay Patel %t6 = zext i1 %t3 to i32 3147592e3a8SSanjay Patel %t7 = add i32 %t6, %t5 3157592e3a8SSanjay Patel ret i32 %t7 316cee313d2SEric Christopher} 3177592e3a8SSanjay Patel 318cee313d2SEric Christopherdeclare double @g(double) 319cee313d2SEric Christopher 320cee313d2SEric Christopherdefine <4 x i16> @neg_vector(<4 x i8> %a) { 3217592e3a8SSanjay Patel; CHECK-LABEL: @neg_vector( 3227592e3a8SSanjay Patel; CHECK-NEXT: [[T1:%.*]] = uitofp <4 x i8> [[A:%.*]] to <4 x float> 3237592e3a8SSanjay Patel; CHECK-NEXT: [[T2:%.*]] = fptoui <4 x float> [[T1]] to <4 x i16> 3247592e3a8SSanjay Patel; CHECK-NEXT: ret <4 x i16> [[T2]] 3257592e3a8SSanjay Patel; 3267592e3a8SSanjay Patel %t1 = uitofp <4 x i8> %a to <4 x float> 3277592e3a8SSanjay Patel %t2 = fptoui <4 x float> %t1 to <4 x i16> 3287592e3a8SSanjay Patel ret <4 x i16> %t2 329cee313d2SEric Christopher} 330*13e71ce6SSanjay Patel 331*13e71ce6SSanjay Patel; Don't crash while processing unreachable (non-standard) IR. 332*13e71ce6SSanjay Patel 333*13e71ce6SSanjay Pateldefine void @PR38502() { 334*13e71ce6SSanjay Patel; CHECK-LABEL: @PR38502( 335*13e71ce6SSanjay Patel; CHECK-NEXT: entry: 336*13e71ce6SSanjay Patel; CHECK-NEXT: ret void 337*13e71ce6SSanjay Patel; CHECK: bogusBB: 338*13e71ce6SSanjay Patel; CHECK-NEXT: [[INC1:%.*]] = fadd double [[INC:%.*]], 1.000000e+00 339*13e71ce6SSanjay Patel; CHECK-NEXT: [[INC]] = fadd double [[INC1]], 1.000000e+00 340*13e71ce6SSanjay Patel; CHECK-NEXT: [[TOBOOL:%.*]] = fcmp une double [[INC]], 0.000000e+00 341*13e71ce6SSanjay Patel; CHECK-NEXT: br label [[BOGUSBB:%.*]] 342*13e71ce6SSanjay Patel; 343*13e71ce6SSanjay Patelentry: 344*13e71ce6SSanjay Patel ret void 345*13e71ce6SSanjay Patel 346*13e71ce6SSanjay PatelbogusBB: ; preds = %bogusBB 347*13e71ce6SSanjay Patel %inc1 = fadd double %inc, 1.000000e+00 348*13e71ce6SSanjay Patel %inc = fadd double %inc1, 1.000000e+00 349*13e71ce6SSanjay Patel %tobool = fcmp une double %inc, 0.000000e+00 350*13e71ce6SSanjay Patel br label %bogusBB 351*13e71ce6SSanjay Patel} 352