1 ; RUN: opt -S -instcombine < %s | FileCheck %s
3 declare float @llvm.copysign.f32(float, float) #0
4 declare double @llvm.copysign.f64(double, double) #0
6 ; CHECK-LABEL: @constant_fold_copysign_f32_01
7 ; CHECK-NEXT: ret float -1.000000e+00
8 define float @constant_fold_copysign_f32_01() #0 {
9 %x = call float @llvm.copysign.f32(float 1.0, float -2.0) #0
13 ; CHECK-LABEL: @constant_fold_copysign_f32_02
14 ; CHECK-NEXT: ret float 2.000000e+00
15 define float @constant_fold_copysign_f32_02() #0 {
16 %x = call float @llvm.copysign.f32(float -2.0, float 1.0) #0
20 ; CHECK-LABEL: @constant_fold_copysign_f32_03
21 ; CHECK-NEXT: ret float -2.000000e+00
22 define float @constant_fold_copysign_f32_03() #0 {
23 %x = call float @llvm.copysign.f32(float -2.0, float -1.0) #0
27 ; CHECK-LABEL: @constant_fold_copysign_f64_01
28 ; CHECK-NEXT: ret double -1.000000e+00
29 define double @constant_fold_copysign_f64_01() #0 {
30 %x = call double @llvm.copysign.f64(double 1.0, double -2.0) #0
34 ; CHECK-LABEL: @constant_fold_copysign_f64_02
35 ; CHECK-NEXT: ret double 1.000000e+00
36 define double @constant_fold_copysign_f64_02() #0 {
37 %x = call double @llvm.copysign.f64(double -1.0, double 2.0) #0
41 ; CHECK-LABEL: @constant_fold_copysign_f64_03
42 ; CHECK-NEXT: ret double -1.000000e+00
43 define double @constant_fold_copysign_f64_03() #0 {
44 %x = call double @llvm.copysign.f64(double -1.0, double -2.0) #0
49 attributes #0 = { nounwind readnone }