summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2020-01-14 14:04:53 +0100
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2020-01-14 14:10:57 +0100
commit81ee484484a0be59da8f749a9b4cf56bb8d37402 (patch)
tree3077a1a8f617e560e41a0dc867070a4ecd31dac3 /llvm/test/CodeGen/SystemZ
parentdf186507e1d07c3ddba091a076ba7a33dbdc5867 (diff)
downloadbcm5719-llvm-81ee484484a0be59da8f749a9b4cf56bb8d37402.tar.gz
bcm5719-llvm-81ee484484a0be59da8f749a9b4cf56bb8d37402.zip
[FPEnv] Fix chain handling regression after 04a8696
Code in getRoot made the assumption that every node in PendingLoads must always itself have a dependency on the current DAG root node. After the changes in 04a8696, it turns out that this assumption no longer holds true, causing wrong codegen in some cases (e.g. stores after constrained FP intrinsics might get deleted). To fix this, we now need to make sure that the TokenFactor created by getRoot always includes the previous root, if there is no implicit dependency already present. The original getControlRoot code already has exactly this check, so this patch simply reuses that code now for getRoot as well. This fixes the regression. NFC if no constrained FP intrinsic is present.
Diffstat (limited to 'llvm/test/CodeGen/SystemZ')
-rw-r--r--llvm/test/CodeGen/SystemZ/fp-strict-alias.ll64
1 files changed, 61 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/SystemZ/fp-strict-alias.ll b/llvm/test/CodeGen/SystemZ/fp-strict-alias.ll
index e2b2e05a902..5091c3dc97b 100644
--- a/llvm/test/CodeGen/SystemZ/fp-strict-alias.ll
+++ b/llvm/test/CodeGen/SystemZ/fp-strict-alias.ll
@@ -5,6 +5,7 @@
declare float @llvm.experimental.constrained.sqrt.f32(float, metadata, metadata)
declare float @llvm.sqrt.f32(float)
declare void @llvm.s390.sfpc(i32)
+declare void @bar()
; The basic assumption of all following tests is that on z13, we never
; want to see two square root instructions directly in a row, so the
@@ -300,7 +301,7 @@ define void @f13(float %f1) {
ret void
}
-define void @f14(float %f1) {
+define void @f14(float %f1) #0 {
; CHECK-LABEL: f14:
; CHECK-NOT: sqeb
; CHECK: br %r14
@@ -313,7 +314,7 @@ define void @f14(float %f1) {
ret void
}
-define void @f15(float %f1) {
+define void @f15(float %f1) #0 {
; CHECK-LABEL: f15:
; CHECK-NOT: sqeb
; CHECK: br %r14
@@ -326,7 +327,7 @@ define void @f15(float %f1) {
ret void
}
-define void @f16(float %f1) {
+define void @f16(float %f1) #0 {
; CHECK-LABEL: f16:
; CHECK: sqebr
; CHECK: br %r14
@@ -339,4 +340,61 @@ define void @f16(float %f1) {
ret void
}
+
+; Verify that constrained intrinsics and memory operations get their
+; chains linked up properly.
+
+define void @f17(float %in, float* %out) #0 {
+; CHECK-LABEL: f17:
+; CHECK: sqebr
+; CHECK: ste
+; CHECK: jg bar
+ %sqrt = call float @llvm.sqrt.f32(float %in)
+ store float %sqrt, float* %out, align 4
+ tail call void @bar() #0
+ ret void
+}
+
+define void @f18(float %in, float* %out) #0 {
+; CHECK-LABEL: f18:
+; CHECK: sqebr
+; CHECK: ste
+; CHECK: jg bar
+ %sqrt = call float @llvm.experimental.constrained.sqrt.f32(
+ float %in,
+ metadata !"round.dynamic",
+ metadata !"fpexcept.ignore") #0
+ store float %sqrt, float* %out, align 4
+ tail call void @bar() #0
+ ret void
+}
+
+define void @f19(float %in, float* %out) #0 {
+; CHECK-LABEL: f19:
+; CHECK: sqebr
+; CHECK: ste
+; CHECK: jg bar
+ %sqrt = call float @llvm.experimental.constrained.sqrt.f32(
+ float %in,
+ metadata !"round.dynamic",
+ metadata !"fpexcept.maytrap") #0
+ store float %sqrt, float* %out, align 4
+ tail call void @bar() #0
+ ret void
+}
+
+define void @f20(float %in, float* %out) #0 {
+; CHECK-LABEL: f20:
+; CHECK: sqebr
+; CHECK: ste
+; CHECK: jg bar
+ %sqrt = call float @llvm.experimental.constrained.sqrt.f32(
+ float %in,
+ metadata !"round.dynamic",
+ metadata !"fpexcept.strict") #0
+ store float %sqrt, float* %out, align 4
+ tail call void @bar() #0
+ ret void
+}
+
attributes #0 = { strictfp }
OpenPOWER on IntegriCloud