1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -passes=early-cse -earlycse-debug-hash -S -o - %s | FileCheck %s 3 4declare double @atan2(double, double) #0 5define double @f_atan2() { 6; CHECK-LABEL: @f_atan2( 7; CHECK-NEXT: ret double 0x3FDDAC6{{.+}} 8; 9 %res = tail call fast double @atan2(double 1.0, double 2.0) 10 ret double %res 11} 12 13declare float @fmodf(float, float) #0 14define float @f_fmodf() { 15; CHECK-LABEL: @f_fmodf( 16; CHECK-NEXT: ret float 1.000000e+00 17; 18 %res = tail call fast float @fmodf(float 1.0, float 2.0) 19 ret float %res 20} 21 22declare float @remainderf(float, float) #0 23define float @f_remainderf_fold1() { 24; CHECK-LABEL: @f_remainderf_fold1( 25; CHECK-NEXT: ret float 1.000000e+00 26; 27 %res = tail call fast float @remainderf(float 1.0, float 2.0) 28 ret float %res 29} 30 31define float @f_remainderf_fold2() { 32; CHECK-LABEL: @f_remainderf_fold2( 33; CHECK-NEXT: ret float -5.000000e-01 34; 35 %res = tail call fast float @remainderf(float 1.5, float 1.0) 36 ret float %res 37} 38 39define float @f_remainderf_nofold() { 40; CHECK-LABEL: @f_remainderf_nofold( 41; CHECK-NEXT: [[RES:%.*]] = tail call fast float @remainderf(float 1.000000e+00, float 0.000000e+00) 42; CHECK-NEXT: ret float [[RES]] 43; 44 %res = tail call fast float @remainderf(float 1.0, float 0.0) 45 ret float %res 46} 47 48declare double @remainder(double, double) #0 49define double @f_remainder_fold1() { 50; CHECK-LABEL: @f_remainder_fold1( 51; CHECK-NEXT: ret double 1.000000e+00 52; 53 %res = tail call fast double @remainder(double 1.0, double 2.0) 54 ret double %res 55} 56 57define double @f_remainder_fold2() { 58; CHECK-LABEL: @f_remainder_fold2( 59; CHECK-NEXT: ret double -5.000000e-01 60; 61 %res = tail call fast double @remainder(double 1.5, double 1.0) 62 ret double %res 63} 64 65define double @f_remainder_nofold() { 66; CHECK-LABEL: @f_remainder_nofold( 67; CHECK-NEXT: [[RES:%.*]] = tail call fast double @remainder(double 1.000000e+00, double 0.000000e+00) 68; CHECK-NEXT: ret double [[RES]] 69; 70 %res = tail call fast double @remainder(double 1.0, double 0.0) 71 ret double %res 72} 73 74declare double @pow(double, double) #0 75define double @f_pow() { 76; CHECK-LABEL: @f_pow( 77; CHECK-NEXT: ret double 1.000000e+00 78; 79 %res = tail call fast double @pow(double 1.0, double 2.0) 80 ret double %res 81} 82 83declare float @llvm.pow.f32(float, float) 84define float @i_powf() { 85; CHECK-LABEL: @i_powf( 86; CHECK-NEXT: ret float 1.000000e+00 87; 88 %res = tail call fast float @llvm.pow.f32(float 1.0, float 2.0) 89 ret float %res 90} 91 92declare double @llvm.powi.f64.i32(double, i32) 93define double @i_powi() { 94; CHECK-LABEL: @i_powi( 95; CHECK-NEXT: ret double 1.000000e+00 96; 97 %res = tail call fast double @llvm.powi.f64.i32(double 1.0, i32 2) 98 ret double %res 99} 100 101; Make sure that the type is correct after constant folding 102 103define half @pr98665() { 104; CHECK-LABEL: @pr98665( 105; CHECK-NEXT: ret half 0xH3C00 106; 107 %x = call half @llvm.powi.f16.i32(half 0xH3C00, i32 1) 108 ret half %x 109} 110 111define float @powi_f32() { 112; CHECK-LABEL: @powi_f32( 113; CHECK-NEXT: ret float 0.000000e+00 114; 115 %y = call float @llvm.powi.f32.i32(float 0.0, i32 10) 116 ret float %y 117} 118 119attributes #0 = { nofree nounwind willreturn } 120