1 ; Verify that floating-point strict signaling compares cannot be omitted
2 ; even if CC already has the right value.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 \
5 ; RUN: -enable-misched=0 -no-integrated-as | FileCheck %s
7 ; We need -enable-misched=0 to make sure f12 and following routines really
8 ; test the compare elimination pass.
11 declare float @llvm.fabs.f32(float %f)
13 ; Test addition followed by EQ, which could use the CC result of the addition.
14 define float @f1(float %a, float %b, ptr %dest) #0 {
16 ; CHECK-DAG: aebr %f0, %f2
17 ; CHECK-DAG: lzer [[REG:%f[0-9]+]]
18 ; CHECK-NEXT: kebr %f0, [[REG]]
19 ; CHECK-NEXT: ber %r14
22 %res = call float @llvm.experimental.constrained.fadd.f32(
24 metadata !"round.dynamic",
25 metadata !"fpexcept.strict") #0
26 %cmp = call i1 @llvm.experimental.constrained.fcmps.f32(
27 float %res, float 0.0,
29 metadata !"fpexcept.strict") #0
30 br i1 %cmp, label %exit, label %store
33 store float %b, ptr %dest
40 ; Test the result of LOAD POSITIVE.
41 define float @f6(float %dummy, float %a, ptr %dest) #0 {
43 ; CHECK-DAG: lpdfr %f0, %f2
44 ; CHECK-DAG: lzer [[REG:%f[0-9]+]]
45 ; CHECK-NEXT: kebr %f0, [[REG]]
46 ; CHECK-NEXT: bhr %r14
49 %res = call float @llvm.fabs.f32(float %a) #0
50 %cmp = call i1 @llvm.experimental.constrained.fcmps.f32(
51 float %res, float 0.0,
53 metadata !"fpexcept.strict") #0
54 br i1 %cmp, label %exit, label %store
57 store float %res, ptr %dest
64 ; Test the result of LOAD NEGATIVE.
65 define float @f7(float %dummy, float %a, ptr %dest) #0 {
67 ; CHECK-DAG: lndfr %f0, %f2
68 ; CHECK-DAG: lzer [[REG:%f[0-9]+]]
69 ; CHECK-NEXT: kebr %f0, [[REG]]
70 ; CHECK-NEXT: blr %r14
73 %abs = call float @llvm.fabs.f32(float %a) #0
74 %res = fneg float %abs
75 %cmp = call i1 @llvm.experimental.constrained.fcmps.f32(
76 float %res, float 0.0,
78 metadata !"fpexcept.strict") #0
79 br i1 %cmp, label %exit, label %store
82 store float %res, ptr %dest
89 ; Test the result of LOAD COMPLEMENT.
90 define float @f8(float %dummy, float %a, ptr %dest) #0 {
92 ; CHECK-DAG: lcdfr %f0, %f2
93 ; CHECK-DAG: lzer [[REG:%f[0-9]+]]
94 ; CHECK-NEXT: kebr %f0, [[REG]]
95 ; CHECK-NEXT: bler %r14
99 %cmp = call i1 @llvm.experimental.constrained.fcmps.f32(
100 float %res, float 0.0,
102 metadata !"fpexcept.strict") #0
103 br i1 %cmp, label %exit, label %store
106 store float %res, ptr %dest
113 ; Test that LER does not get converted to LTEBR.
114 define float @f12(float %dummy, float %val) #0 {
116 ; CHECK: ler %f0, %f2
118 ; CHECK-NEXT: blah %f0
119 ; CHECK-NEXT: #NO_APP
120 ; CHECK-NEXT: lzer [[REG:%f[0-9]+]]
121 ; CHECK-NEXT: kebr %f2, [[REG]]
122 ; CHECK-NEXT: blr %r14
125 %ret = call float asm "blah $1", "=f,{f0}"(float %val) #0
126 %cmp = call i1 @llvm.experimental.constrained.fcmps.f32(
127 float %val, float 0.0,
129 metadata !"fpexcept.strict") #0
130 br i1 %cmp, label %exit, label %store
133 call void asm sideeffect "blah", ""() #0
140 attributes #0 = { strictfp }
142 declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata)
143 declare float @llvm.experimental.constrained.fsub.f32(float, float, metadata, metadata)
144 declare float @llvm.experimental.constrained.fmul.f32(float, float, metadata, metadata)
145 declare float @llvm.experimental.constrained.fdiv.f32(float, float, metadata, metadata)
146 declare i1 @llvm.experimental.constrained.fcmps.f32(float, float, metadata, metadata)
147 declare i1 @llvm.experimental.constrained.fcmps.f64(double, double, metadata, metadata)
148 declare i1 @llvm.experimental.constrained.fcmps.f128(fp128, fp128, metadata, metadata)