ARM: use the proper target object format for WoA
[oota-llvm.git] / test / CodeGen / AArch64 / neon-fma.ll
1 ; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon -fp-contract=fast | FileCheck %s
2 ; RUN: llc < %s -verify-machineinstrs -mtriple=arm64-none-linux-gnu -mattr=+neon -fp-contract=fast | FileCheck %s
3
4 define <2 x float> @fmla2xfloat(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
5 ;CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
6         %tmp1 = fmul <2 x float> %A, %B;
7         %tmp2 = fadd <2 x float> %C, %tmp1;
8         ret <2 x float> %tmp2
9 }
10
11 define <4 x float> @fmla4xfloat(<4 x float> %A, <4 x float> %B, <4 x float> %C) {
12 ;CHECK: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
13         %tmp1 = fmul <4 x float> %A, %B;
14         %tmp2 = fadd <4 x float> %C, %tmp1;
15         ret <4 x float> %tmp2
16 }
17
18 define <2 x double> @fmla2xdouble(<2 x double> %A, <2 x double> %B, <2 x double> %C) {
19 ;CHECK: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
20         %tmp1 = fmul <2 x double> %A, %B;
21         %tmp2 = fadd <2 x double> %C, %tmp1;
22         ret <2 x double> %tmp2
23 }
24
25
26 define <2 x float> @fmls2xfloat(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
27 ;CHECK: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
28         %tmp1 = fmul <2 x float> %A, %B;
29         %tmp2 = fsub <2 x float> %C, %tmp1;
30         ret <2 x float> %tmp2
31 }
32
33 define <4 x float> @fmls4xfloat(<4 x float> %A, <4 x float> %B, <4 x float> %C) {
34 ;CHECK: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
35         %tmp1 = fmul <4 x float> %A, %B;
36         %tmp2 = fsub <4 x float> %C, %tmp1;
37         ret <4 x float> %tmp2
38 }
39
40 define <2 x double> @fmls2xdouble(<2 x double> %A, <2 x double> %B, <2 x double> %C) {
41 ;CHECK: fmls {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
42         %tmp1 = fmul <2 x double> %A, %B;
43         %tmp2 = fsub <2 x double> %C, %tmp1;
44         ret <2 x double> %tmp2
45 }
46
47
48 ; Another set of tests for when the intrinsic is used.
49
50 declare <2 x float> @llvm.fma.v2f32(<2 x float>, <2 x float>, <2 x float>)
51 declare <4 x float> @llvm.fma.v4f32(<4 x float>, <4 x float>, <4 x float>)
52 declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>)
53
54 define <2 x float> @fmla2xfloat_fused(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
55 ;CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
56         %val = call <2 x float> @llvm.fma.v2f32(<2 x float> %A, <2 x float> %B, <2 x float> %C)
57         ret <2 x float> %val
58 }
59
60 define <4 x float> @fmla4xfloat_fused(<4 x float> %A, <4 x float> %B, <4 x float> %C) {
61 ;CHECK: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
62         %val = call <4 x float> @llvm.fma.v4f32(<4 x float> %A, <4 x float> %B, <4 x float> %C)
63         ret <4 x float> %val
64 }
65
66 define <2 x double> @fmla2xdouble_fused(<2 x double> %A, <2 x double> %B, <2 x double> %C) {
67 ;CHECK: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
68         %val = call <2 x double> @llvm.fma.v2f64(<2 x double> %A, <2 x double> %B, <2 x double> %C)
69         ret <2 x double> %val
70 }
71
72 define <2 x float> @fmls2xfloat_fused(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
73 ;CHECK: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
74         %negA = fsub <2 x float> <float -0.0, float -0.0>, %A
75         %val = call <2 x float> @llvm.fma.v2f32(<2 x float> %negA, <2 x float> %B, <2 x float> %C)
76         ret <2 x float> %val
77 }
78
79 define <4 x float> @fmls4xfloat_fused(<4 x float> %A, <4 x float> %B, <4 x float> %C) {
80 ;CHECK: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
81         %negA = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %A
82         %val = call <4 x float> @llvm.fma.v4f32(<4 x float> %negA, <4 x float> %B, <4 x float> %C)
83         ret <4 x float> %val
84 }
85
86 define <2 x double> @fmls2xdouble_fused(<2 x double> %A, <2 x double> %B, <2 x double> %C) {
87 ;CHECK: fmls {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
88         %negA = fsub <2 x double> <double -0.0, double -0.0>, %A
89         %val = call <2 x double> @llvm.fma.v2f64(<2 x double> %negA, <2 x double> %B, <2 x double> %C)
90         ret <2 x double> %val
91 }
92
93 declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>)
94 declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>)
95 declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>)
96
97 define <2 x float> @fmuladd2xfloat(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
98 ;CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
99         %val = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %A, <2 x float> %B, <2 x float> %C)
100         ret <2 x float> %val
101 }
102
103 define <4 x float> @fmuladd4xfloat_fused(<4 x float> %A, <4 x float> %B, <4 x float> %C) {
104 ;CHECK: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
105         %val = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %A, <4 x float> %B, <4 x float> %C)
106         ret <4 x float> %val
107 }
108
109 define <2 x double> @fmuladd2xdouble_fused(<2 x double> %A, <2 x double> %B, <2 x double> %C) {
110 ;CHECK: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
111         %val = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %A, <2 x double> %B, <2 x double> %C)
112         ret <2 x double> %val
113 }
114
115
116 ; Another set of tests that check for multiply single use
117
118 define <2 x float> @fmla2xfloati_su(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
119 ;CHECK-NOT: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
120   %tmp1 = fmul <2 x float> %A, %B;
121   %tmp2 = fadd <2 x float> %C, %tmp1;
122   %tmp3 = fadd <2 x float> %tmp2, %tmp1;
123   ret <2 x float> %tmp3
124 }
125
126 define <2 x double> @fmls2xdouble_su(<2 x double> %A, <2 x double> %B, <2 x double> %C) {
127 ;CHECK-NOT: fmls {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
128         %tmp1 = fmul <2 x double> %A, %B;
129         %tmp2 = fsub <2 x double> %C, %tmp1;
130         %tmp3 = fsub <2 x double> %tmp2, %tmp1;
131         ret <2 x double> %tmp3
132 }
133