1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=early-cse -earlycse-debug-hash < %s | FileCheck %s
4 declare float @truncf(float) #0
5 declare float @llvm.trunc.f32(float)
6 declare double @trunc(double) #0
7 declare double @llvm.trunc.f64(double)
9 define float @constant_fold_trunc_f32_01() #0 {
10 ; CHECK-LABEL: @constant_fold_trunc_f32_01(
11 ; CHECK-NEXT: ret float 1.000000e+00
13 %x = call float @truncf(float 1.25) #0
17 define float @constant_fold_trunc_f32_02() #0 {
18 ; CHECK-LABEL: @constant_fold_trunc_f32_02(
19 ; CHECK-NEXT: ret float -1.000000e+00
21 %x = call float @llvm.trunc.f32(float -1.25) #0
25 define float @constant_fold_trunc_f32_03() #0 {
26 ; CHECK-LABEL: @constant_fold_trunc_f32_03(
27 ; CHECK-NEXT: ret float 1.000000e+00
29 %x = call float @truncf(float 1.5) #0
33 define float @constant_fold_trunc_f32_04() #0 {
34 ; CHECK-LABEL: @constant_fold_trunc_f32_04(
35 ; CHECK-NEXT: ret float -1.000000e+00
37 %x = call float @llvm.trunc.f32(float -1.5) #0
41 define float @constant_fold_trunc_f32_05() #0 {
42 ; CHECK-LABEL: @constant_fold_trunc_f32_05(
43 ; CHECK-NEXT: ret float 2.000000e+00
45 %x = call float @truncf(float 2.75) #0
49 define float @constant_fold_trunc_f32_06() #0 {
50 ; CHECK-LABEL: @constant_fold_trunc_f32_06(
51 ; CHECK-NEXT: ret float -2.000000e+00
53 %x = call float @llvm.trunc.f32(float -2.75) #0
57 define double @constant_fold_trunc_f64_01() #0 {
58 ; CHECK-LABEL: @constant_fold_trunc_f64_01(
59 ; CHECK-NEXT: ret double 1.000000e+00
61 %x = call double @trunc(double 1.3) #0
65 define double @constant_fold_trunc_f64_02() #0 {
66 ; CHECK-LABEL: @constant_fold_trunc_f64_02(
67 ; CHECK-NEXT: ret double -1.000000e+00
69 %x = call double @llvm.trunc.f64(double -1.3) #0
73 define double @constant_fold_trunc_f64_03() #0 {
74 ; CHECK-LABEL: @constant_fold_trunc_f64_03(
75 ; CHECK-NEXT: ret double 1.000000e+00
77 %x = call double @trunc(double 1.5) #0
81 define double @constant_fold_trunc_f64_04() #0 {
82 ; CHECK-LABEL: @constant_fold_trunc_f64_04(
83 ; CHECK-NEXT: ret double -1.000000e+00
85 %x = call double @llvm.trunc.f64(double -1.5) #0
89 define double @constant_fold_trunc_f64_05() #0 {
90 ; CHECK-LABEL: @constant_fold_trunc_f64_05(
91 ; CHECK-NEXT: ret double 2.000000e+00
93 %x = call double @trunc(double 2.7) #0
97 define double @constant_fold_trunc_f64_06() #0 {
98 ; CHECK-LABEL: @constant_fold_trunc_f64_06(
99 ; CHECK-NEXT: ret double -2.000000e+00
101 %x = call double @llvm.trunc.f64(double -2.7) #0
105 attributes #0 = { nounwind readnone willreturn }