Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -S -instcombine < %s | FileCheck %s
      2 
      3 declare float @llvm.ceil.f32(float) #0
      4 declare double @llvm.ceil.f64(double) #0
      5 declare <4 x float> @llvm.ceil.v4f32(<4 x float>) #0
      6 
      7 ; CHECK-LABEL: @constant_fold_ceil_f32_01
      8 ; CHECK-NEXT: ret float 1.000000e+00
      9 define float @constant_fold_ceil_f32_01() #0 {
     10   %x = call float @llvm.ceil.f32(float 1.00) #0
     11   ret float %x
     12 }
     13 
     14 ; CHECK-LABEL: @constant_fold_ceil_f32_02
     15 ; CHECK-NEXT: ret float 2.000000e+00
     16 define float @constant_fold_ceil_f32_02() #0 {
     17   %x = call float @llvm.ceil.f32(float 1.25) #0
     18   ret float %x
     19 }
     20 
     21 ; CHECK-LABEL: @constant_fold_ceil_f32_03
     22 ; CHECK-NEXT: ret float -1.000000e+00
     23 define float @constant_fold_ceil_f32_03() #0 {
     24   %x = call float @llvm.ceil.f32(float -1.25) #0
     25   ret float %x
     26 }
     27 
     28 ; CHECK-LABEL: @constant_fold_ceil_v4f32_01
     29 ; CHECK-NEXT: ret <4 x float> <float 1.000000e+00, float 2.000000e+00, float -1.000000e+00, float -1.000000e+00>
     30 define <4 x float> @constant_fold_ceil_v4f32_01() #0 {
     31   %x = call <4 x float> @llvm.ceil.v4f32(<4 x float> <float 1.00, float 1.25, float -1.25, float -1.00>)
     32   ret <4 x float> %x
     33 }
     34 
     35 ; CHECK-LABEL: @constant_fold_ceil_f64_01
     36 ; CHECK-NEXT: ret double 1.000000e+00
     37 define double @constant_fold_ceil_f64_01() #0 {
     38   %x = call double @llvm.ceil.f64(double 1.0) #0
     39   ret double %x
     40 }
     41 
     42 ; CHECK-LABEL: @constant_fold_ceil_f64_02
     43 ; CHECK-NEXT: ret double 2.000000e+00
     44 define double @constant_fold_ceil_f64_02() #0 {
     45   %x = call double @llvm.ceil.f64(double 1.3) #0
     46   ret double %x
     47 }
     48 
     49 ; CHECK-LABEL: @constant_fold_ceil_f64_03
     50 ; CHECK-NEXT: ret double -1.000000e+00
     51 define double @constant_fold_ceil_f64_03() #0 {
     52   %x = call double @llvm.ceil.f64(double -1.75) #0
     53   ret double %x
     54 }
     55 
     56 attributes #0 = { nounwind readnone }
     57