AArch64/ARM64: enable more AArch64 tests on ARM64.
[oota-llvm.git] / test / CodeGen / AArch64 / dp-3source.ll
1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
3
4 define i32 @test_madd32(i32 %val0, i32 %val1, i32 %val2) {
5 ; CHECK-LABEL: test_madd32:
6   %mid = mul i32 %val1, %val2
7   %res = add i32 %val0, %mid
8 ; CHECK: madd {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
9   ret i32 %res
10 }
11
12 define i64 @test_madd64(i64 %val0, i64 %val1, i64 %val2) {
13 ; CHECK-LABEL: test_madd64:
14   %mid = mul i64 %val1, %val2
15   %res = add i64 %val0, %mid
16 ; CHECK: madd {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
17   ret i64 %res
18 }
19
20 define i32 @test_msub32(i32 %val0, i32 %val1, i32 %val2) {
21 ; CHECK-LABEL: test_msub32:
22   %mid = mul i32 %val1, %val2
23   %res = sub i32 %val0, %mid
24 ; CHECK: msub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
25   ret i32 %res
26 }
27
28 define i64 @test_msub64(i64 %val0, i64 %val1, i64 %val2) {
29 ; CHECK-LABEL: test_msub64:
30   %mid = mul i64 %val1, %val2
31   %res = sub i64 %val0, %mid
32 ; CHECK: msub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
33   ret i64 %res
34 }
35
36 define i64 @test_smaddl(i64 %acc, i32 %val1, i32 %val2) {
37 ; CHECK-LABEL: test_smaddl:
38   %ext1 = sext i32 %val1 to i64
39   %ext2 = sext i32 %val2 to i64
40   %prod = mul i64 %ext1, %ext2
41   %res = add i64 %acc, %prod
42 ; CHECK: smaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
43   ret i64 %res
44 }
45
46 define i64 @test_smsubl(i64 %acc, i32 %val1, i32 %val2) {
47 ; CHECK-LABEL: test_smsubl:
48   %ext1 = sext i32 %val1 to i64
49   %ext2 = sext i32 %val2 to i64
50   %prod = mul i64 %ext1, %ext2
51   %res = sub i64 %acc, %prod
52 ; CHECK: smsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
53   ret i64 %res
54 }
55
56 define i64 @test_umaddl(i64 %acc, i32 %val1, i32 %val2) {
57 ; CHECK-LABEL: test_umaddl:
58   %ext1 = zext i32 %val1 to i64
59   %ext2 = zext i32 %val2 to i64
60   %prod = mul i64 %ext1, %ext2
61   %res = add i64 %acc, %prod
62 ; CHECK: umaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
63   ret i64 %res
64 }
65
66 define i64 @test_umsubl(i64 %acc, i32 %val1, i32 %val2) {
67 ; CHECK-LABEL: test_umsubl:
68   %ext1 = zext i32 %val1 to i64
69   %ext2 = zext i32 %val2 to i64
70   %prod = mul i64 %ext1, %ext2
71   %res = sub i64 %acc, %prod
72 ; CHECK: umsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
73   ret i64 %res
74 }
75
76 define i64 @test_smulh(i64 %lhs, i64 %rhs) {
77 ; CHECK-LABEL: test_smulh:
78   %ext1 = sext i64 %lhs to i128
79   %ext2 = sext i64 %rhs to i128
80   %res = mul i128 %ext1, %ext2
81   %high = lshr i128 %res, 64
82   %val = trunc i128 %high to i64
83 ; CHECK: smulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
84   ret i64 %val
85 }
86
87 define i64 @test_umulh(i64 %lhs, i64 %rhs) {
88 ; CHECK-LABEL: test_umulh:
89   %ext1 = zext i64 %lhs to i128
90   %ext2 = zext i64 %rhs to i128
91   %res = mul i128 %ext1, %ext2
92   %high = lshr i128 %res, 64
93   %val = trunc i128 %high to i64
94 ; CHECK: umulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
95   ret i64 %val
96 }
97
98 define i32 @test_mul32(i32 %lhs, i32 %rhs) {
99 ; CHECK-LABEL: test_mul32:
100   %res = mul i32 %lhs, %rhs
101 ; CHECK: mul {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
102   ret i32 %res
103 }
104
105 define i64 @test_mul64(i64 %lhs, i64 %rhs) {
106 ; CHECK-LABEL: test_mul64:
107   %res = mul i64 %lhs, %rhs
108 ; CHECK: mul {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
109   ret i64 %res
110 }
111
112 define i32 @test_mneg32(i32 %lhs, i32 %rhs) {
113 ; CHECK-LABEL: test_mneg32:
114   %prod = mul i32 %lhs, %rhs
115   %res = sub i32 0, %prod
116 ; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
117   ret i32 %res
118 }
119
120 define i64 @test_mneg64(i64 %lhs, i64 %rhs) {
121 ; CHECK-LABEL: test_mneg64:
122   %prod = mul i64 %lhs, %rhs
123   %res = sub i64 0, %prod
124 ; CHECK: mneg {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
125   ret i64 %res
126 }
127
128 define i64 @test_smull(i32 %lhs, i32 %rhs) {
129 ; CHECK-LABEL: test_smull:
130   %ext1 = sext i32 %lhs to i64
131   %ext2 = sext i32 %rhs to i64
132   %res = mul i64 %ext1, %ext2
133 ; CHECK: smull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
134   ret i64 %res
135 }
136
137 define i64 @test_umull(i32 %lhs, i32 %rhs) {
138 ; CHECK-LABEL: test_umull:
139   %ext1 = zext i32 %lhs to i64
140   %ext2 = zext i32 %rhs to i64
141   %res = mul i64 %ext1, %ext2
142 ; CHECK: umull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
143   ret i64 %res
144 }
145
146 define i64 @test_smnegl(i32 %lhs, i32 %rhs) {
147 ; CHECK-LABEL: test_smnegl:
148   %ext1 = sext i32 %lhs to i64
149   %ext2 = sext i32 %rhs to i64
150   %prod = mul i64 %ext1, %ext2
151   %res = sub i64 0, %prod
152 ; CHECK: smnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
153   ret i64 %res
154 }
155
156 define i64 @test_umnegl(i32 %lhs, i32 %rhs) {
157 ; CHECK-LABEL: test_umnegl:
158   %ext1 = zext i32 %lhs to i64
159   %ext2 = zext i32 %rhs to i64
160   %prod = mul i64 %ext1, %ext2
161   %res = sub i64 0, %prod
162 ; CHECK: umnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
163   ret i64 %res
164 }