llvm-6502/test/CodeGen/MBlaze/callind.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

81 lines
1.8 KiB
LLVM

; Ensure that indirect calls work and that they are lowered to some
; sort of branch and link instruction.
;
; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s
declare i32 @printf(i8*, ...)
@MSG = internal constant [13 x i8] c"Message: %d\0A\00"
@FUNS = private constant [5 x i32 (i32,i32)*]
[ i32 (i32,i32)* @doadd,
i32 (i32,i32)* @dosub,
i32 (i32,i32)* @domul,
i32 (i32,i32)* @dodiv,
i32 (i32,i32)* @dorem ]
define i32 @doadd(i32 %a, i32 %b)
{
; CHECK-LABEL: doadd:
%tmp.0 = add i32 %a, %b
ret i32 %tmp.0
; CHECK: rtsd
}
define i32 @dosub(i32 %a, i32 %b)
{
; CHECK-LABEL: dosub:
%tmp.0 = sub i32 %a, %b
ret i32 %tmp.0
; CHECK: rtsd
}
define i32 @domul(i32 %a, i32 %b)
{
; CHECK-LABEL: domul:
%tmp.0 = mul i32 %a, %b
ret i32 %tmp.0
; CHECK: rtsd
}
define i32 @dodiv(i32 %a, i32 %b)
{
; CHECK-LABEL: dodiv:
%tmp.0 = sdiv i32 %a, %b
ret i32 %tmp.0
; CHECK: rtsd
}
define i32 @dorem(i32 %a, i32 %b)
{
; CHECK-LABEL: dorem:
%tmp.0 = srem i32 %a, %b
ret i32 %tmp.0
; CHECK: rtsd
}
define i32 @callind(i32 %a, i32 %b)
{
; CHECK-LABEL: callind:
entry:
br label %loop
loop:
%tmp.0 = phi i32 [ 0, %entry ], [ %tmp.3, %loop ]
%dst.0 = getelementptr [5 x i32 (i32,i32)*]* @FUNS, i32 0, i32 %tmp.0
%dst.1 = load i32 (i32,i32)** %dst.0
%tmp.1 = call i32 %dst.1(i32 %a, i32 %b)
; CHECK-NOT: brli
; CHECK-NOT: brlai
; CHECK: brl
call i32 (i8*,...)* @printf( i8* getelementptr([13 x i8]* @MSG,i32 0,i32 0),
i32 %tmp.1)
; CHECK: brl
%tmp.2 = add i32 %tmp.0, 1
%tmp.3 = urem i32 %tmp.2, 5
br label %loop
; CHECK: br
}