Add LLVM support for Swift.
[oota-llvm.git] / test / CodeGen / ARM / mls.ll
1 ; RUN: llc < %s -march=arm -mattr=+v6t2 | FileCheck %s
2 ; RUN: llc < %s -march=arm -mattr=+v6t2 -arm-use-mulops=false | FileCheck %s -check-prefix=NO_MULOPS
3
4 define i32 @f1(i32 %a, i32 %b, i32 %c) {
5     %tmp1 = mul i32 %a, %b
6     %tmp2 = sub i32 %c, %tmp1
7     ret i32 %tmp2
8 }
9
10 ; sub doesn't commute, so no mls for this one
11 define i32 @f2(i32 %a, i32 %b, i32 %c) {
12     %tmp1 = mul i32 %a, %b
13     %tmp2 = sub i32 %tmp1, %c
14     ret i32 %tmp2
15 }
16
17 ; CHECK: f1:
18 ; CHECK: mls    r0, r0, r1, r2
19 ; NO_MULOPS: f1:
20 ; NO_MULOPS: mul r0, r0, r1
21 ; NO_MULOPS-NEXT: sub r0, r2, r0
22
23 ; CHECK: f2:
24 ; CHECK: mul r0, r0, r1
25 ; CHECK-NEXT: sub r0, r0, r2
26 ; NO_MULOPS: f2:
27 ; NO_MULOPS: mul r0, r0, r1
28 ; NO_MULOPS-NEXT: sub r0, r0, r2