Home | History | Annotate | Download | only in SystemZ
      1 ; Test indirect jumps.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
      4 
      5 define i32 @f1(i32 %x, i32 %y, i32 %op) {
      6 ; CHECK-LABEL: f1:
      7 ; CHECK: ahi %r4, -1
      8 ; CHECK: clibh %r4, 5, 0(%r14)
      9 ; CHECK: llgfr [[OP64:%r[0-5]]], %r4
     10 ; CHECK: sllg [[INDEX:%r[1-5]]], [[OP64]], 3
     11 ; CHECK: larl [[BASE:%r[1-5]]]
     12 ; CHECK: lg [[TARGET:%r[1-5]]], 0([[BASE]],[[INDEX]])
     13 ; CHECK: br [[TARGET]]
     14 entry:
     15   switch i32 %op, label %exit [
     16     i32 1, label %b.add
     17     i32 2, label %b.sub
     18     i32 3, label %b.and
     19     i32 4, label %b.or
     20     i32 5, label %b.xor
     21     i32 6, label %b.mul
     22   ]
     23 
     24 b.add:
     25   %add = add i32 %x, %y
     26   br label %exit
     27 
     28 b.sub:
     29   %sub = sub i32 %x, %y
     30   br label %exit
     31 
     32 b.and:
     33   %and = and i32 %x, %y
     34   br label %exit
     35 
     36 b.or:
     37   %or = or i32 %x, %y
     38   br label %exit
     39 
     40 b.xor:
     41   %xor = xor i32 %x, %y
     42   br label %exit
     43 
     44 b.mul:
     45   %mul = mul i32 %x, %y
     46   br label %exit
     47 
     48 exit:
     49   %res = phi i32 [ %x,   %entry ],
     50                  [ %add, %b.add ],
     51                  [ %sub, %b.sub ],
     52                  [ %and, %b.and ],
     53                  [ %or,  %b.or ],
     54                  [ %xor, %b.xor ],
     55                  [ %mul, %b.mul ]
     56   ret i32 %res
     57 }
     58