1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
3 ; This test depends on branching support, which is not yet checked in.
6 ; Test that phis are lowered.
8 target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128"
9 target triple = "wasm32-unknown-unknown"
14 ; CHECK: (setlocal [[REG:@.*]] (argument 0))
15 ; CHECK: (setlocal [[REG]] (sdiv [[REG]] {{.*}}))
16 ; CHECK: (return [[REG]])
17 define i32 @test0(i32 %p) {
19 %t = icmp slt i32 %p, 0
20 br i1 %t, label %true, label %done
25 %s = phi i32 [ %a, %true ], [ %p, %entry ]
33 ; CHECK: (setlocal [[REG0:@.*]] [[REG1:@.*]])
34 ; CHECK: (setlocal [[REG1]] [[REG2:@.*]])
35 ; CHECK: (setlocal [[REG2]] [[REG0]])
36 define i32 @test1(i32 %n) {
41 %a = phi i32 [ 0, %entry ], [ %b, %loop ]
42 %b = phi i32 [ 1, %entry ], [ %a, %loop ]
43 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ]
45 %i.next = add i32 %i, 1
46 %t = icmp slt i32 %i.next, %n
47 br i1 %t, label %loop, label %exit