1 ; RUN: llc < %s -verify-machineinstrs -mtriple=arm64-eabi -aarch64-neon-syntax=apple -aarch64-enable-simd-scalar=true -asm-verbose=false -disable-adv-copy-opt=false | FileCheck %s -check-prefix=CHECK
2 ; RUN: llc < %s -verify-machineinstrs -mtriple=arm64-eabi -aarch64-neon-syntax=generic -aarch64-enable-simd-scalar=true -asm-verbose=false -disable-adv-copy-opt=false | FileCheck %s -check-prefix=GENERIC
4 define <2 x i64> @bar(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
6 ; CHECK: add.2d v[[REG:[0-9]+]], v0, v1
7 ; CHECK: add d[[REG3:[0-9]+]], d[[REG]], d1
8 ; CHECK: sub d[[REG2:[0-9]+]], d[[REG]], d1
10 ; CHECK: fmov [[COPY_REG2:x[0-9]+]], d[[REG2]]
12 ; CHECK: mov.d v0[1], [[COPY_REG2]]
16 ; GENERIC: add v[[REG:[0-9]+]].2d, v0.2d, v1.2d
17 ; GENERIC: add d[[REG3:[0-9]+]], d[[REG]], d1
18 ; GENERIC: sub d[[REG2:[0-9]+]], d[[REG]], d1
20 ; GENERIC: fmov [[COPY_REG2:x[0-9]+]], d[[REG2]]
22 ; GENERIC: mov v0.d[1], [[COPY_REG2]]
24 %add = add <2 x i64> %a, %b
25 %vgetq_lane = extractelement <2 x i64> %add, i32 0
26 %vgetq_lane2 = extractelement <2 x i64> %b, i32 0
27 %add3 = add i64 %vgetq_lane, %vgetq_lane2
28 %sub = sub i64 %vgetq_lane, %vgetq_lane2
29 %vecinit = insertelement <2 x i64> undef, i64 %add3, i32 0
30 %vecinit8 = insertelement <2 x i64> %vecinit, i64 %sub, i32 1
31 ret <2 x i64> %vecinit8
34 define double @subdd_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
35 ; CHECK-LABEL: subdd_su64:
36 ; CHECK: sub d0, d1, d0
38 ; GENERIC-LABEL: subdd_su64:
39 ; GENERIC: sub d0, d1, d0
41 %vecext = extractelement <2 x i64> %a, i32 0
42 %vecext1 = extractelement <2 x i64> %b, i32 0
43 %sub.i = sub nsw i64 %vecext1, %vecext
44 %retval = bitcast i64 %sub.i to double
48 define double @vaddd_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
49 ; CHECK-LABEL: vaddd_su64:
50 ; CHECK: add d0, d1, d0
52 ; GENERIC-LABEL: vaddd_su64:
53 ; GENERIC: add d0, d1, d0
55 %vecext = extractelement <2 x i64> %a, i32 0
56 %vecext1 = extractelement <2 x i64> %b, i32 0
57 %add.i = add nsw i64 %vecext1, %vecext
58 %retval = bitcast i64 %add.i to double
62 ; sub MI doesn't access dsub register.
63 define double @add_sub_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
64 ; CHECK-LABEL: add_sub_su64:
65 ; CHECK: add d0, d1, d0
66 ; CHECK: sub d0, {{d[0-9]+}}, d0
68 ; GENERIC-LABEL: add_sub_su64:
69 ; GENERIC: add d0, d1, d0
70 ; GENERIC: sub d0, {{d[0-9]+}}, d0
72 %vecext = extractelement <2 x i64> %a, i32 0
73 %vecext1 = extractelement <2 x i64> %b, i32 0
74 %add.i = add i64 %vecext1, %vecext
75 %sub.i = sub i64 0, %add.i
76 %retval = bitcast i64 %sub.i to double
79 define double @and_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
80 ; CHECK-LABEL: and_su64:
81 ; CHECK: and.8b v0, v1, v0
83 ; GENERIC-LABEL: and_su64:
84 ; GENERIC: and v0.8b, v1.8b, v0.8b
86 %vecext = extractelement <2 x i64> %a, i32 0
87 %vecext1 = extractelement <2 x i64> %b, i32 0
88 %or.i = and i64 %vecext1, %vecext
89 %retval = bitcast i64 %or.i to double
93 define double @orr_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
94 ; CHECK-LABEL: orr_su64:
95 ; CHECK: orr.8b v0, v1, v0
97 ; GENERIC-LABEL: orr_su64:
98 ; GENERIC: orr v0.8b, v1.8b, v0.8b
100 %vecext = extractelement <2 x i64> %a, i32 0
101 %vecext1 = extractelement <2 x i64> %b, i32 0
102 %or.i = or i64 %vecext1, %vecext
103 %retval = bitcast i64 %or.i to double
107 define double @xorr_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
108 ; CHECK-LABEL: xorr_su64:
109 ; CHECK: eor.8b v0, v1, v0
111 ; GENERIC-LABEL: xorr_su64:
112 ; GENERIC: eor v0.8b, v1.8b, v0.8b
114 %vecext = extractelement <2 x i64> %a, i32 0
115 %vecext1 = extractelement <2 x i64> %b, i32 0
116 %xor.i = xor i64 %vecext1, %vecext
117 %retval = bitcast i64 %xor.i to double