1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s
4 define ptr @test_scalar_msub(ptr %a, ptr %b) {
5 ; CHECK-LABEL: test_scalar_msub:
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: ldp w8, w11, [x1]
8 ; CHECK-NEXT: ldp w9, w10, [x0]
9 ; CHECK-NEXT: mul w12, w8, w9
10 ; CHECK-NEXT: mul w8, w10, w8
11 ; CHECK-NEXT: madd w8, w11, w9, w8
12 ; CHECK-NEXT: msub w9, w11, w10, w12
13 ; CHECK-NEXT: stp w9, w8, [x0]
16 %0 = load i32, ptr %a, align 4
17 %1 = load i32, ptr %b, align 4
18 %mul = mul nsw i32 %1, %0
19 %_M_imag = getelementptr inbounds i8, ptr %a, i64 4
20 %2 = load i32, ptr %_M_imag, align 4
21 %_M_imag.i = getelementptr inbounds i8, ptr %b, i64 4
22 %3 = load i32, ptr %_M_imag.i, align 4
23 %mul3 = mul nsw i32 %3, %2
24 %sub = sub nsw i32 %mul, %mul3
25 %mul6 = mul nsw i32 %3, %0
26 %mul9 = mul nsw i32 %2, %1
27 %add = add nsw i32 %mul6, %mul9
28 store i32 %add, ptr %_M_imag, align 4
29 store i32 %sub, ptr %a, align 4
33 define ptr @test_scalar_msub_i64(ptr %a, ptr %b) {
34 ; CHECK-LABEL: test_scalar_msub_i64:
35 ; CHECK: // %bb.0: // %entry
36 ; CHECK-NEXT: ldr x8, [x1]
37 ; CHECK-NEXT: ldur x9, [x0, #4]
38 ; CHECK-NEXT: ldr x10, [x0]
39 ; CHECK-NEXT: ldur x12, [x1, #4]
40 ; CHECK-NEXT: mul x11, x9, x8
41 ; CHECK-NEXT: mul x8, x8, x10
42 ; CHECK-NEXT: madd x10, x12, x10, x11
43 ; CHECK-NEXT: msub x8, x12, x9, x8
44 ; CHECK-NEXT: stur x10, [x0, #4]
45 ; CHECK-NEXT: str x8, [x0]
48 %0 = load i64, ptr %a, align 8
49 %1 = load i64, ptr %b, align 8
50 %mul = mul nsw i64 %1, %0
51 %_M_imag = getelementptr inbounds i8, ptr %a, i64 4
52 %2 = load i64, ptr %_M_imag, align 8
53 %_M_imag.i = getelementptr inbounds i8, ptr %b, i64 4
54 %3 = load i64, ptr %_M_imag.i, align 8
55 %mul3 = mul nsw i64 %3, %2
56 %sub = sub nsw i64 %mul, %mul3
57 %mul6 = mul nsw i64 %3, %0
58 %mul9 = mul nsw i64 %2, %1
59 %add = add nsw i64 %mul6, %mul9
60 store i64 %add, ptr %_M_imag, align 8
61 store i64 %sub, ptr %a, align 8