1 ; RUN: opt -S -instcombine < %s | FileCheck %s
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
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
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
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
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>)
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
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
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
56 attributes #0 = { nounwind readnone }