1 ; RUN: llc -mtriple=arm64-apple-ios7.0 -mcpu=cyclone %s -o - | FileCheck %s
2 ; RUN: llc -mtriple=aarch64_be-linux-gnu -mcpu=cyclone %s -o - | FileCheck --check-prefix=CHECK-BE %s
4 define i128 @test_128bitmul(i128 %lhs, i128 %rhs) {
5 ; CHECK-LABEL: test_128bitmul:
6 ; CHECK: umulh [[HI:x[0-9]+]], x0, x2
7 ; CHECK: madd [[TEMP1:x[0-9]+]], x0, x3, [[HI]]
8 ; CHECK-DAG: madd x1, x1, x2, [[TEMP1]]
9 ; CHECK-DAG: mul x0, x0, x2
12 ; CHECK-BE-LABEL: test_128bitmul:
13 ; CHECK-BE: umulh [[HI:x[0-9]+]], x1, x3
14 ; CHECK-BE: madd [[TEMP1:x[0-9]+]], x1, x2, [[HI]]
15 ; CHECK-BE-DAG: madd x0, x0, x3, [[TEMP1]]
16 ; CHECK-BE-DAG: mul x1, x1, x3
19 %prod = mul i128 %lhs, %rhs
23 ; The machine combiner should create madd instructions when
24 ; optimizing for size because that's smaller than mul + add.
26 define i128 @test_128bitmul_optsize(i128 %lhs, i128 %rhs) optsize {
27 ; CHECK-LABEL: test_128bitmul_optsize:
28 ; CHECK: umulh [[HI:x[0-9]+]], x0, x2
29 ; CHECK-NEXT: madd [[TEMP1:x[0-9]+]], x0, x3, [[HI]]
30 ; CHECK-DAG: madd x1, x1, x2, [[TEMP1]]
31 ; CHECK-DAG: mul x0, x0, x2
34 %prod = mul i128 %lhs, %rhs
38 define i128 @test_128bitmul_minsize(i128 %lhs, i128 %rhs) minsize {
39 ; CHECK-LABEL: test_128bitmul_minsize:
40 ; CHECK: umulh [[HI:x[0-9]+]], x0, x2
41 ; CHECK-NEXT: madd [[TEMP1:x[0-9]+]], x0, x3, [[HI]]
42 ; CHECK-DAG: madd x1, x1, x2, [[TEMP1]]
43 ; CHECK-DAG: mul x0, x0, x2
46 %prod = mul i128 %lhs, %rhs