1; RUN: llc -mtriple=arm-eabi -mattr=+v6t2 %s -o - | FileCheck %s
2; RUN: llc -mtriple=arm-eabi -mattr=+v6t2 -arm-use-mulops=false %s -o - \
3; RUN:  | FileCheck %s -check-prefix=NO_MULOPS
4
5define i32 @f1(i32 %a, i32 %b, i32 %c) {
6    %tmp1 = mul i32 %a, %b
7    %tmp2 = sub i32 %c, %tmp1
8    ret i32 %tmp2
9}
10
11; sub doesn't commute, so no mls for this one
12define i32 @f2(i32 %a, i32 %b, i32 %c) {
13    %tmp1 = mul i32 %a, %b
14    %tmp2 = sub i32 %tmp1, %c
15    ret i32 %tmp2
16}
17
18; CHECK-LABEL: f1:
19; CHECK: mls	r0, r0, r1, r2
20; NO_MULOPS-LABEL: f1:
21; NO_MULOPS: mul r0, r0, r1
22; NO_MULOPS-NEXT: sub r0, r2, r0
23
24; CHECK-LABEL: f2:
25; CHECK: mul r0, r0, r1
26; CHECK-NEXT: sub r0, r0, r2
27; NO_MULOPS-LABEL: f2:
28; NO_MULOPS: mul r0, r0, r1
29; NO_MULOPS-NEXT: sub r0, r0, r2
30