Home | History | Annotate | Download | only in AArch64
      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
      3 
      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
     10 ; CHECK-NEXT:  ret
     11 
     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
     17 ; CHECK-BE-NEXT:  ret
     18 
     19   %prod = mul i128 %lhs, %rhs
     20   ret i128 %prod
     21 }
     22 
     23 ; The machine combiner should create madd instructions when
     24 ; optimizing for size because that's smaller than mul + add.
     25 
     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
     32 ; CHECK-NEXT:  ret
     33 
     34   %prod = mul i128 %lhs, %rhs
     35   ret i128 %prod
     36 }
     37 
     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
     44 ; CHECK-NEXT:  ret
     45 
     46   %prod = mul i128 %lhs, %rhs
     47   ret i128 %prod
     48 }
     49 
     50