1 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
3 define i32 @test_madd32(i32 %val0, i32 %val1, i32 %val2) {
4 ; CHECK-LABEL: test_madd32:
5 %mid = mul i32 %val1, %val2
6 %res = add i32 %val0, %mid
7 ; CHECK: madd {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
11 define i64 @test_madd64(i64 %val0, i64 %val1, i64 %val2) {
12 ; CHECK-LABEL: test_madd64:
13 %mid = mul i64 %val1, %val2
14 %res = add i64 %val0, %mid
15 ; CHECK: madd {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
19 define i32 @test_msub32(i32 %val0, i32 %val1, i32 %val2) {
20 ; CHECK-LABEL: test_msub32:
21 %mid = mul i32 %val1, %val2
22 %res = sub i32 %val0, %mid
23 ; CHECK: msub {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
27 define i64 @test_msub64(i64 %val0, i64 %val1, i64 %val2) {
28 ; CHECK-LABEL: test_msub64:
29 %mid = mul i64 %val1, %val2
30 %res = sub i64 %val0, %mid
31 ; CHECK: msub {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
35 define i64 @test_smaddl(i64 %acc, i32 %val1, i32 %val2) {
36 ; CHECK-LABEL: test_smaddl:
37 %ext1 = sext i32 %val1 to i64
38 %ext2 = sext i32 %val2 to i64
39 %prod = mul i64 %ext1, %ext2
40 %res = add i64 %acc, %prod
41 ; CHECK: smaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
45 define i64 @test_smsubl(i64 %acc, i32 %val1, i32 %val2) {
46 ; CHECK-LABEL: test_smsubl:
47 %ext1 = sext i32 %val1 to i64
48 %ext2 = sext i32 %val2 to i64
49 %prod = mul i64 %ext1, %ext2
50 %res = sub i64 %acc, %prod
51 ; CHECK: smsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
55 define i64 @test_umaddl(i64 %acc, i32 %val1, i32 %val2) {
56 ; CHECK-LABEL: test_umaddl:
57 %ext1 = zext i32 %val1 to i64
58 %ext2 = zext i32 %val2 to i64
59 %prod = mul i64 %ext1, %ext2
60 %res = add i64 %acc, %prod
61 ; CHECK: umaddl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
65 define i64 @test_umsubl(i64 %acc, i32 %val1, i32 %val2) {
66 ; CHECK-LABEL: test_umsubl:
67 %ext1 = zext i32 %val1 to i64
68 %ext2 = zext i32 %val2 to i64
69 %prod = mul i64 %ext1, %ext2
70 %res = sub i64 %acc, %prod
71 ; CHECK: umsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}}
75 define i64 @test_smulh(i64 %lhs, i64 %rhs) {
76 ; CHECK-LABEL: test_smulh:
77 %ext1 = sext i64 %lhs to i128
78 %ext2 = sext i64 %rhs to i128
79 %res = mul i128 %ext1, %ext2
80 %high = lshr i128 %res, 64
81 %val = trunc i128 %high to i64
82 ; CHECK: smulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
86 define i64 @test_umulh(i64 %lhs, i64 %rhs) {
87 ; CHECK-LABEL: test_umulh:
88 %ext1 = zext i64 %lhs to i128
89 %ext2 = zext i64 %rhs to i128
90 %res = mul i128 %ext1, %ext2
91 %high = lshr i128 %res, 64
92 %val = trunc i128 %high to i64
93 ; CHECK: umulh {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
97 define i32 @test_mul32(i32 %lhs, i32 %rhs) {
98 ; CHECK-LABEL: test_mul32:
99 %res = mul i32 %lhs, %rhs
100 ; CHECK: mul {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
104 define i64 @test_mul64(i64 %lhs, i64 %rhs) {
105 ; CHECK-LABEL: test_mul64:
106 %res = mul i64 %lhs, %rhs
107 ; CHECK: mul {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
111 define i32 @test_mneg32(i32 %lhs, i32 %rhs) {
112 ; CHECK-LABEL: test_mneg32:
113 %prod = mul i32 %lhs, %rhs
114 %res = sub i32 0, %prod
115 ; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
119 define i64 @test_mneg64(i64 %lhs, i64 %rhs) {
120 ; CHECK-LABEL: test_mneg64:
121 %prod = mul i64 %lhs, %rhs
122 %res = sub i64 0, %prod
123 ; CHECK: mneg {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}
127 define i64 @test_smull(i32 %lhs, i32 %rhs) {
128 ; CHECK-LABEL: test_smull:
129 %ext1 = sext i32 %lhs to i64
130 %ext2 = sext i32 %rhs to i64
131 %res = mul i64 %ext1, %ext2
132 ; CHECK: smull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
136 define i64 @test_umull(i32 %lhs, i32 %rhs) {
137 ; CHECK-LABEL: test_umull:
138 %ext1 = zext i32 %lhs to i64
139 %ext2 = zext i32 %rhs to i64
140 %res = mul i64 %ext1, %ext2
141 ; CHECK: umull {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
145 define i64 @test_smnegl(i32 %lhs, i32 %rhs) {
146 ; CHECK-LABEL: test_smnegl:
147 %ext1 = sext i32 %lhs to i64
148 %ext2 = sext i32 %rhs to i64
149 %prod = mul i64 %ext1, %ext2
150 %res = sub i64 0, %prod
151 ; CHECK: smnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
155 define i64 @test_umnegl(i32 %lhs, i32 %rhs) {
156 ; CHECK-LABEL: test_umnegl:
157 %ext1 = zext i32 %lhs to i64
158 %ext2 = zext i32 %rhs to i64
159 %prod = mul i64 %ext1, %ext2
160 %res = sub i64 0, %prod
161 ; CHECK: umnegl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}
165 @a = common global i32 0, align 4
166 @b = common global i32 0, align 4
167 @c = common global i32 0, align 4
169 define void @test_mneg(){
170 ; CHECK-LABEL: test_mneg:
171 %1 = load i32, i32* @a, align 4
172 %2 = load i32, i32* @b, align 4
175 store i32 %4, i32* @c, align 4
176 ; CHECK: mneg {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}