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=true | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-NOOPT
2 ; 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 -check-prefix=CHECK-OPT
3 ; RUN: llc < %s -verify-machineinstrs -mtriple=arm64-eabi -aarch64-neon-syntax=generic -aarch64-enable-simd-scalar=true -asm-verbose=false -disable-adv-copy-opt=true | FileCheck %s -check-prefix=GENERIC -check-prefix=GENERIC-NOOPT
4 ; 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 -check-prefix=GENERIC-OPT
6 define <2 x i64> @bar(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
8 ; CHECK: add.2d v[[REG:[0-9]+]], v0, v1
9 ; CHECK: add d[[REG3:[0-9]+]], d[[REG]], d1
10 ; CHECK: sub d[[REG2:[0-9]+]], d[[REG]], d1
12 ; CHECK: fmov [[COPY_REG2:x[0-9]+]], d[[REG2]]
14 ; CHECK: mov.d v0[1], [[COPY_REG2]]
18 ; GENERIC: add v[[REG:[0-9]+]].2d, v0.2d, v1.2d
19 ; GENERIC: add d[[REG3:[0-9]+]], d[[REG]], d1
20 ; GENERIC: sub d[[REG2:[0-9]+]], d[[REG]], d1
22 ; GENERIC: fmov [[COPY_REG2:x[0-9]+]], d[[REG2]]
24 ; GENERIC: mov v0.d[1], [[COPY_REG2]]
26 %add = add <2 x i64> %a, %b
27 %vgetq_lane = extractelement <2 x i64> %add, i32 0
28 %vgetq_lane2 = extractelement <2 x i64> %b, i32 0
29 %add3 = add i64 %vgetq_lane, %vgetq_lane2
30 %sub = sub i64 %vgetq_lane, %vgetq_lane2
31 %vecinit = insertelement <2 x i64> undef, i64 %add3, i32 0
32 %vecinit8 = insertelement <2 x i64> %vecinit, i64 %sub, i32 1
33 ret <2 x i64> %vecinit8
36 define double @subdd_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
37 ; CHECK-LABEL: subdd_su64:
38 ; CHECK: sub d0, d1, d0
40 ; GENERIC-LABEL: subdd_su64:
41 ; GENERIC: sub d0, d1, d0
43 %vecext = extractelement <2 x i64> %a, i32 0
44 %vecext1 = extractelement <2 x i64> %b, i32 0
45 %sub.i = sub nsw i64 %vecext1, %vecext
46 %retval = bitcast i64 %sub.i to double
50 define double @vaddd_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
51 ; CHECK-LABEL: vaddd_su64:
52 ; CHECK: add d0, d1, d0
54 ; GENERIC-LABEL: vaddd_su64:
55 ; GENERIC: add d0, d1, d0
57 %vecext = extractelement <2 x i64> %a, i32 0
58 %vecext1 = extractelement <2 x i64> %b, i32 0
59 %add.i = add nsw i64 %vecext1, %vecext
60 %retval = bitcast i64 %add.i to double
64 ; sub MI doesn't access dsub register.
65 define double @add_sub_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
66 ; CHECK-LABEL: add_sub_su64:
67 ; CHECK: add d0, d1, d0
68 ; CHECK: sub d0, {{d[0-9]+}}, d0
70 ; GENERIC-LABEL: add_sub_su64:
71 ; GENERIC: add d0, d1, d0
72 ; GENERIC: sub d0, {{d[0-9]+}}, d0
74 %vecext = extractelement <2 x i64> %a, i32 0
75 %vecext1 = extractelement <2 x i64> %b, i32 0
76 %add.i = add i64 %vecext1, %vecext
77 %sub.i = sub i64 0, %add.i
78 %retval = bitcast i64 %sub.i to double
81 define double @and_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
82 ; CHECK-LABEL: and_su64:
83 ; CHECK: and.8b v0, v1, v0
85 ; GENERIC-LABEL: and_su64:
86 ; GENERIC: and v0.8b, v1.8b, v0.8b
88 %vecext = extractelement <2 x i64> %a, i32 0
89 %vecext1 = extractelement <2 x i64> %b, i32 0
90 %or.i = and i64 %vecext1, %vecext
91 %retval = bitcast i64 %or.i to double
95 define double @orr_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
96 ; CHECK-LABEL: orr_su64:
97 ; CHECK: orr.8b v0, v1, v0
99 ; GENERIC-LABEL: orr_su64:
100 ; GENERIC: orr v0.8b, v1.8b, v0.8b
102 %vecext = extractelement <2 x i64> %a, i32 0
103 %vecext1 = extractelement <2 x i64> %b, i32 0
104 %or.i = or i64 %vecext1, %vecext
105 %retval = bitcast i64 %or.i to double
109 define double @xorr_su64(<2 x i64> %a, <2 x i64> %b) nounwind readnone {
110 ; CHECK-LABEL: xorr_su64:
111 ; CHECK: eor.8b v0, v1, v0
113 ; GENERIC-LABEL: xorr_su64:
114 ; GENERIC: eor v0.8b, v1.8b, v0.8b
116 %vecext = extractelement <2 x i64> %a, i32 0
117 %vecext1 = extractelement <2 x i64> %b, i32 0
118 %xor.i = xor i64 %vecext1, %vecext
119 %retval = bitcast i64 %xor.i to double