llvm-6502/test/CodeGen/MBlaze/jumptable.ll
Stephen Lin 8b2b8a1835 Mass update to CodeGen tests to use CHECK-LABEL for labels corresponding to function definitions for more informative error messages. No functionality change and all updated tests passed locally.
This update was done with the following bash script:

  find test/CodeGen -name "*.ll" | \
  while read NAME; do
    echo "$NAME"
    if ! grep -q "^; *RUN: *llc.*debug" $NAME; then
      TEMP=`mktemp -t temp`
      cp $NAME $TEMP
      sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \
      while read FUNC; do
        sed -i '' "s/;\(.*\)\([A-Za-z0-9_-]*\):\( *\)$FUNC: *\$/;\1\2-LABEL:\3$FUNC:/g" $TEMP
      done
      sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP
      sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP
      sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP
      sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP
      mv $TEMP $NAME
    fi
  done


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186280 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-14 06:24:09 +00:00

80 lines
1.8 KiB
LLVM

; Ensure that jump tables can be handled by the mblaze backend. The
; jump table should be lowered to a "br" instruction using one of the
; available registers.
;
; RUN: llc < %s -march=mblaze | FileCheck %s
define i32 @jmptable(i32 %arg)
{
; CHECK-LABEL: jmptable:
switch i32 %arg, label %DEFAULT [ i32 0, label %L0
i32 1, label %L1
i32 2, label %L2
i32 3, label %L3
i32 4, label %L4
i32 5, label %L5
i32 6, label %L6
i32 7, label %L7
i32 8, label %L8
i32 9, label %L9 ]
; CHECK: lw [[REG:r[0-9]*]]
; CHECK: brad [[REG]]
L0:
%var0 = add i32 %arg, 0
br label %DONE
L1:
%var1 = add i32 %arg, 1
br label %DONE
L2:
%var2 = add i32 %arg, 2
br label %DONE
L3:
%var3 = add i32 %arg, 3
br label %DONE
L4:
%var4 = add i32 %arg, 4
br label %DONE
L5:
%var5 = add i32 %arg, 5
br label %DONE
L6:
%var6 = add i32 %arg, 6
br label %DONE
L7:
%var7 = add i32 %arg, 7
br label %DONE
L8:
%var8 = add i32 %arg, 8
br label %DONE
L9:
%var9 = add i32 %arg, 9
br label %DONE
DEFAULT:
unreachable
DONE:
%rval = phi i32 [ %var0, %L0 ],
[ %var1, %L1 ],
[ %var2, %L2 ],
[ %var3, %L3 ],
[ %var4, %L4 ],
[ %var5, %L5 ],
[ %var6, %L6 ],
[ %var7, %L7 ],
[ %var8, %L8 ],
[ %var9, %L9 ]
ret i32 %rval
; CHECK: rtsd
}