summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/phi.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/phi.ll')
-rw-r--r--llvm/test/CodeGen/WebAssembly/phi.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/phi.ll b/llvm/test/CodeGen/WebAssembly/phi.ll
new file mode 100644
index 00000000000..c217cbf3572
--- /dev/null
+++ b/llvm/test/CodeGen/WebAssembly/phi.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s -asm-verbose=false | FileCheck %s
+
+; Test that phis are lowered.
+
+target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+; CHECK-LABEL: test0
+; CHECK: (setlocal [[REG:@.*]] (argument 0))
+; CHECK: (setlocal [[REG]] (sdiv [[REG]] {{.*}}))
+; CHECK: (return [[REG]])
+define i32 @test0(i32 %p) {
+entry:
+ %t = icmp slt i32 %p, 0
+ br i1 %t, label %true, label %done
+true:
+ %a = sdiv i32 %p, 3
+ br label %done
+done:
+ %s = phi i32 [ %a, %true ], [ %p, %entry ]
+ ret i32 %s
+}
OpenPOWER on IntegriCloud