mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-31 16:02:52 +01:00
cf082ae903
This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $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 mv $TEMP $NAME fi done llvm-svn: 186268
32 lines
844 B
LLVM
32 lines
844 B
LLVM
; RUN: opt < %s -reassociate -S | FileCheck %s
|
|
|
|
define i64 @multistep1(i64 %a, i64 %b, i64 %c) {
|
|
; Check that a*a*b+a*a*c is turned into a*(a*(b+c)).
|
|
; CHECK-LABEL: @multistep1(
|
|
%t0 = mul i64 %a, %b
|
|
%t1 = mul i64 %a, %t0 ; a*(a*b)
|
|
%t2 = mul i64 %a, %c
|
|
%t3 = mul i64 %a, %t2 ; a*(a*c)
|
|
%t4 = add i64 %t1, %t3
|
|
; CHECK-NEXT: add i64 %c, %b
|
|
; CHECK-NEXT: mul i64 %tmp{{.*}}, %a
|
|
; CHECK-NEXT: mul i64 %tmp{{.*}}, %a
|
|
; CHECK-NEXT: ret
|
|
ret i64 %t4
|
|
}
|
|
|
|
define i64 @multistep2(i64 %a, i64 %b, i64 %c, i64 %d) {
|
|
; Check that a*b+a*c+d is turned into a*(b+c)+d.
|
|
; CHECK-LABEL: @multistep2(
|
|
%t0 = mul i64 %a, %b
|
|
%t1 = mul i64 %a, %c
|
|
%t2 = add i64 %t1, %d ; a*c+d
|
|
%t3 = add i64 %t0, %t2 ; a*b+(a*c+d)
|
|
; CHECK-NEXT: add i64 %c, %b
|
|
; CHECK-NEXT: mul i64 %tmp{{.*}}, %a
|
|
; CHECK-NEXT: add i64 %tmp{{.*}}, %d
|
|
; CHECK-NEXT: ret
|
|
ret i64 %t3
|
|
}
|
|
|