summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ/multiselect.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/SystemZ/multiselect.ll')
-rw-r--r--llvm/test/CodeGen/SystemZ/multiselect.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/multiselect.ll b/llvm/test/CodeGen/SystemZ/multiselect.ll
new file mode 100644
index 00000000000..d2078ff291b
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/multiselect.ll
@@ -0,0 +1,21 @@
+; Test that multiple select statements using the same condition are expanded
+; into a single conditional branch.
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+
+define void @test(i32 signext %positive, double %base, double %offset, double* %rmin, double* %rmax) {
+entry:
+; CHECK: cijlh %r2, 0,
+; CHECK-NOT: cij
+; CHECK-NOT: je
+; CHECK-NOT: jlh
+
+ %tobool = icmp eq i32 %positive, 0
+ %add = fadd double %base, %offset
+ %min = select i1 %tobool, double %add, double %base
+ %max = select i1 %tobool, double %base, double %add
+ store double %min, double* %rmin, align 8
+ store double %max, double* %rmax, align 8
+ ret void
+}
+
OpenPOWER on IntegriCloud