[FastISel][AArch64] Optimize compare-and-branch for i1 to use 'tbz'.
[oota-llvm.git] / test / CodeGen / AArch64 / madd-combiner.ll
1 ; RUN: llc -mtriple=aarch64-apple-darwin -verify-machineinstrs < %s | FileCheck %s
2
3 ; Test that we use the correct register class.
4 define i32 @mul_add_imm(i32 %a, i32 %b) {
5 ; CHECK-LABEL: mul_add_imm
6 ; CHECK:       orr [[REG:w[0-9]+]], wzr, #0x4
7 ; CHECK-NEXT:  madd  {{w[0-9]+}}, w0, w1, [[REG]]
8   %1 = mul i32 %a, %b
9   %2 = add i32 %1, 4
10   ret i32 %2
11 }
12
13 define i32 @mul_sub_imm1(i32 %a, i32 %b) {
14 ; CHECK-LABEL: mul_sub_imm1
15 ; CHECK:       orr [[REG:w[0-9]+]], wzr, #0x4
16 ; CHECK-NEXT:  msub  {{w[0-9]+}}, w0, w1, [[REG]]
17   %1 = mul i32 %a, %b
18   %2 = sub i32 4, %1
19   ret i32 %2
20 }